collabmd 0.1.39 → 0.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/README.md +75 -1
  2. package/dist/client/assets/{CodeMirrorEditor-UCMRAMCV-75Zi8U_A.js → CodeMirrorEditor-UCMRAMCV-DHEFSr_E.js} +1 -1
  3. package/dist/client/assets/{ar-SA-NXDWD63E-CTf_wpt3.js → ar-SA-NXDWD63E-S8m2UyIj.js} +1 -1
  4. package/dist/client/assets/{arc-DD8jaAGl.js → arc-OeTCl9Oy.js} +1 -1
  5. package/dist/client/assets/architecture-7EHR7CIX-BQpCYB3J.js +1 -0
  6. package/dist/client/assets/{architectureDiagram-Q4EWVU46-BftXiJA8.js → architectureDiagram-3BPJPVTR-CDqq0KA0.js} +3 -3
  7. package/dist/client/assets/{az-AZ-MXSORGZV-C_C9i9u3.js → az-AZ-MXSORGZV-DSzWvZBB.js} +1 -1
  8. package/dist/client/assets/bases-preview-controller-CBHDzzot.js +143 -0
  9. package/dist/client/assets/{bg-BG-O6MV2KSF-YmfvQf63.js → bg-BG-O6MV2KSF-C5nBekx3.js} +1 -1
  10. package/dist/client/assets/blockDiagram-GPEHLZMM-Z9jBLpGg.js +132 -0
  11. package/dist/client/assets/{bn-IN-MMW2ORAC-BTEFR4Ed.js → bn-BD-T2VJNT7N-D-8xXOzM.js} +1 -1
  12. package/dist/client/assets/{bn-BD-T2VJNT7N-BD0ob0JE.js → bn-IN-MMW2ORAC-D-8xXOzM.js} +1 -1
  13. package/dist/client/assets/button-2ZnWQkWV.js +1 -0
  14. package/dist/client/assets/{c4Diagram-AHTNJAMY-Gz7ZAK0d.js → c4Diagram-AAUBKEIU-UA_Eopag.js} +2 -2
  15. package/dist/client/assets/{ca-ES-MKBCGNOG-aLX_cjA0.js → ca-ES-MKBCGNOG-B3Ly68p3.js} +1 -1
  16. package/dist/client/assets/channel-CpvwJaGK.js +1 -0
  17. package/dist/client/assets/{chunk-EDXVE4YY-M4QxyGNt.js → chunk-2J33WTMH-DjYq2kZ3.js} +1 -1
  18. package/dist/client/assets/chunk-3OPIFGDE-DucrRywM.js +62 -0
  19. package/dist/client/assets/{chunk-4BX2VUAB-D5YiFdu1.js → chunk-4BX2VUAB-DcdHBPEH.js} +1 -1
  20. package/dist/client/assets/chunk-4EGX6M5U-BfCFom1o.js +1 -0
  21. package/dist/client/assets/{chunk-55IACEB6-VHgZjidg.js → chunk-55IACEB6-B7ycySPI.js} +1 -1
  22. package/dist/client/assets/chunk-5DO6E6H7-DP8QnaJj.js +1 -0
  23. package/dist/client/assets/chunk-5ZQYHXKU-C4q4UVKa.js +2 -0
  24. package/dist/client/assets/chunk-727SXJPM-DdWH2cfs.js +206 -0
  25. package/dist/client/assets/chunk-AQP2D5EJ-D8o8QwFY.js +231 -0
  26. package/dist/client/assets/{chunk-LIHQZDEY-DtYrHuCi.js → chunk-BR22UD5L-CT6fcRkN.js} +1 -1
  27. package/dist/client/assets/{chunk-BSJP7CBP-D2KkrA_B.js → chunk-BSJP7CBP-COmh28sk.js} +1 -1
  28. package/dist/client/assets/chunk-CSCIHK7Q-D0bHjxCO.js +123 -0
  29. package/dist/client/assets/chunk-FHYWG6QK-Ce318laP.js +1 -0
  30. package/dist/client/assets/{chunk-FMBD7UC4-qQT7MtX2.js → chunk-FMBD7UC4-CM39cCCr.js} +1 -1
  31. package/dist/client/assets/chunk-KSCS5N6A-Bk33m7yK.js +10 -0
  32. package/dist/client/assets/{chunk-ZZ45TVLE-DGIhE_ST.js → chunk-L5ZTLDWV-J2sQu4Os.js} +1 -1
  33. package/dist/client/assets/chunk-LZXEDZCA-CTmBbzaL.js +2 -0
  34. package/dist/client/assets/chunk-MMN3DZ5N-pTRxhVYl.js +35 -0
  35. package/dist/client/assets/chunk-MPE355IW-C_vkbqLj.js +1 -0
  36. package/dist/client/assets/chunk-MZUSXYTE-BnVcgphH.js +1 -0
  37. package/dist/client/assets/chunk-N66VUXT2-B6CG-CnY.js +1 -0
  38. package/dist/client/assets/{chunk-YZCP3GAM-D1jf1WUI.js → chunk-ND2GUHAM-D-_vkA5V.js} +1 -1
  39. package/dist/client/assets/chunk-NNHCCRGN-DlpIbxXb.js +159 -0
  40. package/dist/client/assets/{chunk-X2U36JSP-D3OEPG7k.js → chunk-NZK2D7GU-Dc42C0Jt.js} +1 -1
  41. package/dist/client/assets/{chunk-U2HBQHQK-BBXgsocS.js → chunk-O5CBEL6O-DdEDfb8z.js} +4 -4
  42. package/dist/client/assets/chunk-PUPMXCY4-BZ88kQjK.js +1 -0
  43. package/dist/client/assets/chunk-QZHKN3VN-D5YLQvjj.js +1 -0
  44. package/dist/client/assets/{chunk-SRAX5OIU-yDw8XRsi.js → chunk-SRAX5OIU-CiRgnkYo.js} +1 -1
  45. package/dist/client/assets/chunk-UIBZB4QT-r8p3pBHw.js +1 -0
  46. package/dist/client/assets/chunk-WCWK7LTN-DrKYkgXF.js +1 -0
  47. package/dist/client/assets/chunk-WU5MYG2G-Cg2iUbET.js +1 -0
  48. package/dist/client/assets/{chunk-XPW4576I-BUfyrOtN.js → chunk-XPW4576I-BZyvtu42.js} +1 -1
  49. package/dist/client/assets/{chunk-Z5NKEFVG-Vu8zBV4H.js → chunk-Z5NKEFVG-Dknufskm.js} +7 -7
  50. package/dist/client/assets/chunk-aKtaBQYM.js +1 -0
  51. package/dist/client/assets/classDiagram-4FO5ZUOK-CGWY0cfg.js +1 -0
  52. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CGWY0cfg.js +1 -0
  53. package/dist/client/assets/{cose-bilkent-S5V4N54A-A8ssRFyt.js → cose-bilkent-S5V4N54A-BuQb9WEM.js} +1 -1
  54. package/dist/client/assets/{cs-CZ-V77HGUP7-Du3y53BB.js → cs-CZ-V77HGUP7-6BCNHMpz.js} +1 -1
  55. package/dist/client/assets/{cytoscape.esm-BurByw8X.js → cytoscape.esm-DelgaX4f.js} +2 -2
  56. package/dist/client/assets/{da-DK-I5RFNTM4-CDJtjf5s.js → da-DK-I5RFNTM4-CVeCWpi2.js} +1 -1
  57. package/dist/client/assets/dagre-BM42HDAG-ux5hA7G6.js +4 -0
  58. package/dist/client/assets/dagre-Bx709z4p.js +1 -0
  59. package/dist/client/assets/{de-CH-WLRDEVBV-CLV2tVw6.js → de-CH-WLRDEVBV-CV-FNCkY.js} +1 -1
  60. package/dist/client/assets/{de-DE-DTI4WUSC-B53J0BQ8.js → de-DE-DTI4WUSC-CV-FNCkY.js} +1 -1
  61. package/dist/client/assets/diagram-2AECGRRQ-Cx-EPj3F.js +43 -0
  62. package/dist/client/assets/{diagram-5BDNPKRD-BuK-UBuN.js → diagram-5GNKFQAL-B6qUTxVg.js} +2 -2
  63. package/dist/client/assets/diagram-KO2AKTUF-BedClayW.js +3 -0
  64. package/dist/client/assets/{diagram-TYMM5635-CT8BdT4s.js → diagram-LMA3HP47-DCwyG0i5.js} +1 -1
  65. package/dist/client/assets/diagram-OG6HWLK6-BZD0jSxR.js +24 -0
  66. package/dist/client/assets/diagram-action-icons-aa_KOv9h.js +36 -0
  67. package/dist/client/assets/{dist-BXiFOexW.js → dist-B-m0-H59.js} +1 -1
  68. package/dist/client/assets/dist-B6Q0y0J8.js +1 -0
  69. package/dist/client/assets/dist-BCQCG0we.js +1 -0
  70. package/dist/client/assets/{dist-Bz-8_JmE.js → dist-BEyxdnUD.js} +1 -1
  71. package/dist/client/assets/{dist-eAgBpkKv.js → dist-BYneHrvV.js} +1 -1
  72. package/dist/client/assets/dist-BsPHL5xw2.js +1 -0
  73. package/dist/client/assets/{dist-CRyP6okk.js → dist-CX-kKEdL.js} +1 -1
  74. package/dist/client/assets/{dist-Bp_j2hKC.js → dist-CaLooK5r.js} +1 -1
  75. package/dist/client/assets/{dist-CQZDuOJ9.js → dist-Cd4FT8TV.js} +1 -1
  76. package/dist/client/assets/{dist-CIt_ogHO.js → dist-ClWZ99Dh.js} +1 -1
  77. package/dist/client/assets/{dist-D8d0IGSI.js → dist-D01mg-Uh.js} +1 -1
  78. package/dist/client/assets/{dist-fpFkgu34.js → dist-D36UTodj.js} +1 -1
  79. package/dist/client/assets/{dist-bkoMCmF7.js → dist-D6YOhZ_d.js} +1 -1
  80. package/dist/client/assets/{dist-CH3l6nVf.js → dist-D8jTFU06.js} +1 -1
  81. package/dist/client/assets/dist-DGI-0uwF.js +1 -0
  82. package/dist/client/assets/{dist-Das5WX49.js → dist-DGO-wCq8.js} +1 -1
  83. package/dist/client/assets/dist-DMKYvLqD.js +1 -0
  84. package/dist/client/assets/{dist-8EAyH6_p.js → dist-DRQhk99i.js} +1 -1
  85. package/dist/client/assets/{dist-uyVGTnZh.js → dist-DScq22KK.js} +1 -1
  86. package/dist/client/assets/{dist-wkd-N1L5.js → dist-DbpddOpB.js} +1 -1
  87. package/dist/client/assets/{dist-1SMeCZhf.js → dist-Dl5uZm2T.js} +1 -1
  88. package/dist/client/assets/{dist-_THc9HiJ.js → dist-DvpEZjAN.js} +1 -1
  89. package/dist/client/assets/dist-Dw8hKOQm.js +1 -0
  90. package/dist/client/assets/{dist-NcJIpTJ8.js → dist-G7j-noyR.js} +1 -1
  91. package/dist/client/assets/dist-PItC1DRE.js +1 -0
  92. package/dist/client/assets/{dist-QktK6LIH.js → dist-cMoydUa-.js} +1 -1
  93. package/dist/client/assets/dist-cTuGB1EW.js +9 -0
  94. package/dist/client/assets/{dist-yy8SO13g.js → dist-efgaKpVU.js} +1 -1
  95. package/dist/client/assets/{dist-B7XQNod9.js → dist-nx-MGJIM.js} +1 -1
  96. package/dist/client/assets/{dist-DplP0BiK.js → dist-pww3cL4Q.js} +7 -7
  97. package/dist/client/assets/dist-uhQ-mkuh.js +2 -0
  98. package/dist/client/assets/{dockerfile-D8_6_FRV.js → dockerfile-BLkNEvjs.js} +1 -1
  99. package/dist/client/assets/drawio-editor-BM_W6Lkj.js +9 -0
  100. package/dist/client/assets/drawio-embed-controller-BKHnRnaj.js +1 -0
  101. package/dist/client/assets/drawioEditor-DBfHYCO5.js +2 -0
  102. package/dist/client/assets/editor-session-VueuoR_r.js +16 -0
  103. package/dist/client/assets/{el-GR-ZXDJ2OS4-DFmRQv0o.js → el-GR-ZXDJ2OS4-DzgGVibO.js} +1 -1
  104. package/dist/client/assets/{en-CMP6EMR6-D9x8hVSu.js → en-CMP6EMR6-l-4iz8RC.js} +1 -1
  105. package/dist/client/assets/{erDiagram-SMLLAGMA-6VFZA3Qb.js → erDiagram-TEJ5UH35-7XmGIzui.js} +2 -2
  106. package/dist/client/assets/{es-ES-DYQHAD43-BiGWIrBG.js → es-ES-DYQHAD43-DP98e8ox.js} +1 -1
  107. package/dist/client/assets/{eu-ES-QDSYU5Y3-BjwS0kZi.js → eu-ES-QDSYU5Y3-DrEfH-2N.js} +1 -1
  108. package/dist/client/assets/eventmodeling-FCH6USID-D-VxYsbw.js +1 -0
  109. package/dist/client/assets/excalidraw-editor-B3ffLqi6.css +1 -0
  110. package/dist/client/assets/excalidraw-editor-C6fTkMBx.js +9 -0
  111. package/dist/client/assets/excalidraw-embed-controller-BKx05cjZ.js +1 -0
  112. package/dist/client/assets/excalidraw-embed-reconciler-DGiagExg.js +1 -0
  113. package/dist/client/assets/{excalidraw-mermaid-stub-Df0Q2qkW.js → excalidraw-mermaid-stub-DE5FTiZB.js} +1 -1
  114. package/dist/client/assets/excalidraw-scene-DjODomMW.js +176 -0
  115. package/dist/client/assets/excalidrawEditor-DQD_lLF4.js +2 -0
  116. package/dist/client/assets/{export-page-Bnk-YQp-.js → export-page-D0iHYSPi.js} +4 -4
  117. package/dist/client/assets/exportDocument-Ct-Zvf7_.js +2 -0
  118. package/dist/client/assets/{fa-IR-26LZG4PM-BgANg2TD.js → fa-IR-26LZG4PM-CEwnMxEY.js} +1 -1
  119. package/dist/client/assets/{factor-Cz-hzBGH.js → factor-D7LVTn2l.js} +1 -1
  120. package/dist/client/assets/{fi-FI-6YS4KDE4-CBL5f3oN.js → fi-FI-6YS4KDE4-DPKGe_vC.js} +1 -1
  121. package/dist/client/assets/file-history-view-controller-CK3oHDCT.js +112 -0
  122. package/dist/client/assets/{flowDiagram-DWJPFMVM-DO9RH8YQ.js → flowDiagram-I6XJVG4X-DgTAG2K2.js} +6 -6
  123. package/dist/client/assets/{fr-FR-BRLLPTZC-CRibNSLG.js → fr-FR-BRLLPTZC-CgMmN9yd.js} +1 -1
  124. package/dist/client/assets/ganttDiagram-6RSMTGT7-Curra433.js +292 -0
  125. package/dist/client/assets/git-diff-view-controller-qorJ_Quo.js +150 -0
  126. package/dist/client/assets/git-panel-controller-DG8ws6B_.js +203 -0
  127. package/dist/client/assets/gitGraph-WXDBUCRP-CRS5XD98.js +1 -0
  128. package/dist/client/assets/gitGraphDiagram-PVQCEYII-DVf7-iH0.js +106 -0
  129. package/dist/client/assets/{gl-ES-OKUZTLYG-DEDwa_xt.js → gl-ES-OKUZTLYG-qCIGpEXP.js} +1 -1
  130. package/dist/client/assets/graphlib-B8gBHxth.js +1 -0
  131. package/dist/client/assets/{haxe-CcPA1xnA.js → haxe-DjVOVvNP.js} +1 -1
  132. package/dist/client/assets/{he-IL-26MGYIU7-47wxy70N.js → he-IL-26MGYIU7-_Pd-m9Sj.js} +1 -1
  133. package/dist/client/assets/{hi-IN-Q4ZOGTP2-bhV7c3dK.js → hi-IN-Q4ZOGTP2-B4kd5rva.js} +1 -1
  134. package/dist/client/assets/{hu-HU-P2OXPSN5-xG-gBMzE.js → hu-HU-P2OXPSN5-DL2sEPhQ.js} +1 -1
  135. package/dist/client/assets/{id-ID-2EIKXYN6-MQuYaNHo.js → id-ID-2EIKXYN6-DqXHubyc.js} +1 -1
  136. package/dist/client/assets/image-MLCQRF34-BT938jMR.js +1 -0
  137. package/dist/client/assets/index-AdGl0Mjr.js +2 -0
  138. package/dist/client/assets/index-V7z92VYK.css +1 -0
  139. package/dist/client/assets/info-J43DQDTF-CdrjkAmK.js +1 -0
  140. package/dist/client/assets/{infoDiagram-42DDH7IO-C77Pt7T1.js → infoDiagram-5YYISTIA-DT8NjvZp.js} +1 -1
  141. package/dist/client/assets/input-CXk9Zxz9.js +1 -0
  142. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-Cy1fwvvg.js → ishikawaDiagram-YF4QCWOH-axeWdm72.js} +2 -2
  143. package/dist/client/assets/{it-IT-4CFKVXI2-v2kj-y7j.js → it-IT-4CFKVXI2-CyToZF8R.js} +1 -1
  144. package/dist/client/assets/{ja-JP-MAND2Z4V-BahXSQz-.js → ja-JP-MAND2Z4V-CdMMUzyq.js} +1 -1
  145. package/dist/client/assets/{javascript-gTK9fxz6.js → javascript-B9TABJff.js} +1 -1
  146. package/dist/client/assets/javascript-BRzqD9BA.js +1 -0
  147. package/dist/client/assets/{journeyDiagram-VCZTEJTY-CYWaI6re.js → journeyDiagram-JHISSGLW-_K7qmGID.js} +3 -3
  148. package/dist/client/assets/{jsx-runtime-1KUJVfx8.js → jsx-runtime-DqMcooe2.js} +1 -1
  149. package/dist/client/assets/{kaa-HQRTCXTJ-BF26ydFa.js → kaa-HQRTCXTJ-D6kVHP9w.js} +1 -1
  150. package/dist/client/assets/{kab-KAB-JKIKKTGH-CEIH0F80.js → kab-KAB-JKIKKTGH-XYCYTUmV.js} +1 -1
  151. package/dist/client/assets/{kanban-definition-6JOO6SKY-DY1xE7tm.js → kanban-definition-UN3LZRKU-DaPREf-3.js} +6 -6
  152. package/dist/client/assets/keyboard-shortcuts-Ctp9_GHy.js +1 -0
  153. package/dist/client/assets/{kk-KZ-HXQ63ZFC-CxWjc9Sf.js → kk-KZ-HXQ63ZFC-Du2sGLmI.js} +1 -1
  154. package/dist/client/assets/{km-KH-PKL3LSGX-DJlCteEp.js → km-KH-PKL3LSGX-B2OnEat4.js} +1 -1
  155. package/dist/client/assets/{ko-KR-KXLREZX3-B1gtI_ci.js → ko-KR-KXLREZX3-CcxALsEE.js} +1 -1
  156. package/dist/client/assets/{ku-TR-MJ4IER3X-Bf41y2v2.js → ku-TR-MJ4IER3X-HDyr9f4z.js} +1 -1
  157. package/dist/client/assets/line-CbpIuf9e.js +1 -0
  158. package/dist/client/assets/{linear-dsIQT_iU.js → linear-BGe2G4b5.js} +1 -1
  159. package/dist/client/assets/{lt-LT-H6WFQ6FJ-DA1or-Eo.js → lt-LT-H6WFQ6FJ-BzZe8pg9.js} +1 -1
  160. package/dist/client/assets/{lv-LV-GOCK6SJW-qa0BoYMm.js → lv-LV-GOCK6SJW-CMspwH0q.js} +1 -1
  161. package/dist/client/assets/main-C8f6FlSO.js +789 -0
  162. package/dist/client/assets/mermaid-parser.core-C4gZtCl9.js +4 -0
  163. package/dist/client/assets/mermaid-runtime-CX_vmg3J.js +9 -0
  164. package/dist/client/assets/{mindmap-definition-QFDTVHPH-DB_M5r-j.js → mindmap-definition-RKZ34NQL-DB1uitpo.js} +23 -23
  165. package/dist/client/assets/{mr-IN-IXVLDMEQ-DXFRgvgb.js → mr-IN-IXVLDMEQ-C6mqoMmX.js} +1 -1
  166. package/dist/client/assets/{my-MM-YG6MYTTD-BKDIfalJ.js → my-MM-YG6MYTTD-Q33bVx2B.js} +1 -1
  167. package/dist/client/assets/navigation-D173qvIt.css +1 -0
  168. package/dist/client/assets/{nb-NO-XGWJISD2-DbwbopH8.js → nb-NO-XGWJISD2-B1jdnBFb.js} +1 -1
  169. package/dist/client/assets/{nl-NL-XVDVCPNC-ChSneTSU.js → nl-NL-XVDVCPNC-DoQkA2lu.js} +1 -1
  170. package/dist/client/assets/{nn-NO-EMX5MJX5-Cf7ZWKWZ.js → nn-NO-EMX5MJX5-Db3tHf5b.js} +1 -1
  171. package/dist/client/assets/{nsis-QPGhLAeY.js → nsis-AQ_alPln.js} +1 -1
  172. package/dist/client/assets/{oc-FR-ROEINTVO-lM7Nl7hD.js → oc-FR-ROEINTVO-DLu-4Ze0.js} +1 -1
  173. package/dist/client/assets/{ordinal-Dz3y_j0K.js → ordinal-hYBb2elL.js} +1 -1
  174. package/dist/client/assets/{pa-IN-ZYN6SUDY-C9WNUTeR.js → pa-IN-ZYN6SUDY-XvJuMxJR.js} +1 -1
  175. package/dist/client/assets/packet-YPE3B663-r4oAflYS.js +1 -0
  176. package/dist/client/assets/percentages-5DKR754L-D_KAYeu8.js +1 -0
  177. package/dist/client/assets/{pica-CgGaIJly.js → pica-DjQMjoX_.js} +1 -1
  178. package/dist/client/assets/pie-LRSECV5Y-DkaVktH1.js +1 -0
  179. package/dist/client/assets/pieDiagram-4H26LBE5-CdDwk3iQ.js +30 -0
  180. package/dist/client/assets/{pl-PL-6VTG7PHC-DqRVepnC.js → pl-PL-6VTG7PHC-DjJq8QfA.js} +1 -1
  181. package/dist/client/assets/preview-diagram-utils-DnqteI9Q.js +1 -0
  182. package/dist/client/assets/preview-render-compiler-Dts88fM3.js +35 -0
  183. package/dist/client/assets/preview-render-compiler-VKNqrOZN.js +1 -0
  184. package/dist/client/assets/preview-render-profile-CU6rvKx3.js +23 -0
  185. package/dist/client/assets/preview-render-worker-CFKBP7xz.js +59 -0
  186. package/dist/client/assets/{pt-BR-5YFKRR5G-CopLYEA6.js → pt-BR-5YFKRR5G-Dg2lIz1V.js} +1 -1
  187. package/dist/client/assets/{pt-PT-GEIXXZ67-BjZ_Lphg.js → pt-PT-GEIXXZ67-COIg15TS.js} +1 -1
  188. package/dist/client/assets/{pug-lkTEco3G.js → pug-Ck0YjsGM.js} +1 -1
  189. package/dist/client/assets/quadrantDiagram-W4KKPZXB-C6n3eYzo.js +7 -0
  190. package/dist/client/assets/quick-switcher-controller-CVRUPEKp.js +12 -0
  191. package/dist/client/assets/radar-GUYGQ44K-Bjhhjq-k.js +1 -0
  192. package/dist/client/assets/{requirementDiagram-MS252O5E-CtUIQnWa.js → requirementDiagram-4Y6WPE33-B-sVI-jx.js} +4 -4
  193. package/dist/client/assets/{ro-RO-E2P6TFZI-DakDz5Xu.js → ro-RO-E2P6TFZI-CdCIa8N3.js} +1 -1
  194. package/dist/client/assets/{room-z2w9b96b.js → room-CpCcgtG8.js} +1 -1
  195. package/dist/client/assets/{ru-RU-YBIIY43T-BMvCT-XT.js → ru-RU-YBIIY43T-C5TT1jTX.js} +1 -1
  196. package/dist/client/assets/runtime-config-CDgeuPWN.js +1 -0
  197. package/dist/client/assets/runtime-paths-DvpihCEq.js +1 -0
  198. package/dist/client/assets/{sankeyDiagram-XADWPNL6-tcSeuifE.js → sankeyDiagram-5OEKKPKP-EY2cdbUV.js} +36 -6
  199. package/dist/client/assets/segmented-control-DhUkW6ro.js +1 -0
  200. package/dist/client/assets/sequenceDiagram-3UESZ5HK-D6h6knAb.js +162 -0
  201. package/dist/client/assets/{si-LK-673C2CI2-hGdH1S9E.js → si-LK-673C2CI2-f_5ZzunQ.js} +1 -1
  202. package/dist/client/assets/{sk-SK-CKZHQ4AP-DiRA-fj8.js → sk-SK-CKZHQ4AP-4jimlXp1.js} +1 -1
  203. package/dist/client/assets/{sl-SI-557H2GWM-DN94n_1-.js → sl-SI-557H2GWM-BnZ04ZfX.js} +1 -1
  204. package/dist/client/assets/{src-BuiVcSz-.js → src-DSz_pbBa.js} +1 -1
  205. package/dist/client/assets/stateDiagram-AJRCARHV-Ca8ZuIR2.js +1 -0
  206. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DGRDwQhE.js +1 -0
  207. package/dist/client/assets/subset-shared.chunk-DcaFK0zo.js +1 -0
  208. package/dist/client/assets/{subset-worker.chunk-kj1e3wjW.js → subset-worker.chunk-CVu8sQYq.js} +1 -1
  209. package/dist/client/assets/{sv-SE-XOPKKDWS-CkHUNABj.js → sv-SE-XOPKKDWS-B2uKmd06.js} +1 -1
  210. package/dist/client/assets/{ta-IN-XBH7DQI3-W-157oVK.js → ta-IN-XBH7DQI3-Bld4KtCz.js} +1 -1
  211. package/dist/client/assets/{th-TH-TOCWH3R4-BsU-Pydr.js → th-TH-TOCWH3R4-DUlvnJTX.js} +1 -1
  212. package/dist/client/assets/{timeline-definition-GMOUNBTQ-Bs6U53Mo.js → timeline-definition-PNZ67QCA-BAhvj49M.js} +5 -5
  213. package/dist/client/assets/{tr-TR-GXW6CYY5-CTddyq89.js → tr-TR-GXW6CYY5-BXTTqJlZ.js} +1 -1
  214. package/dist/client/assets/treeView-BLDUP644-DbX5QpdZ.js +1 -0
  215. package/dist/client/assets/treemap-LRROVOQU-DT4YRX1p.js +1 -0
  216. package/dist/client/assets/turtle-Cx3rYX2g.js +1 -0
  217. package/dist/client/assets/{uk-UA-IJKTNUDG-1LzXkII3.js → uk-UA-IJKTNUDG-DbQpa2ug.js} +1 -1
  218. package/dist/client/assets/{uz-UZ-TBZZEA4V-kqm-qcUj.js → uz-UZ-TBZZEA4V-Dt35hEMk.js} +1 -1
  219. package/dist/client/assets/vault-api-client-BPVNCJZC.js +1 -0
  220. package/dist/client/assets/vault-api-client-VAfZ8okg.js +1 -0
  221. package/dist/client/assets/{vault-utils-CRpy8MQz.js → vault-utils-kIbqyWPm.js} +1 -1
  222. package/dist/client/assets/vennDiagram-CIIHVFJN-GGrxyoPK.js +34 -0
  223. package/dist/client/assets/{vi-VN-MULSGNVB-C3H2AUhm.js → vi-VN-MULSGNVB-BgxNIE1N.js} +1 -1
  224. package/dist/client/assets/wardley-L42UT6IY-Ba5lVG9E.js +1 -0
  225. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-C-scJfPY.js → wardleyDiagram-YWT4CUSO-BgYuJM9o.js} +61 -3
  226. package/dist/client/assets/{xychartDiagram-5P7HB3ND-D3nQoxhz.js → xychartDiagram-2RQKCTM6-DKA6F9sv.js} +3 -3
  227. package/dist/client/assets/{yjs-provider-reset-guard-DSPzcvAO.js → yjs-provider-reset-guard-BicD2Ate.js} +1 -1
  228. package/dist/client/assets/{zh-CN-MVX3E32U-BULPbsyl.js → zh-CN-MVX3E32U-W0nclq-N.js} +1 -1
  229. package/dist/client/assets/{zh-HK-JNU5RLIE-bNGmeSaW.js → zh-HK-JNU5RLIE-C2VRLD9Z.js} +1 -1
  230. package/dist/client/assets/{zh-TW-LENVCA6T-CQDp064P.js → zh-TW-LENVCA6T-Ci7udZjZ.js} +1 -1
  231. package/dist/client/drawio-editor.html +3 -3
  232. package/dist/client/excalidraw-editor.html +3 -3
  233. package/dist/client/export-document.html +4 -4
  234. package/dist/client/index.html +5 -5
  235. package/package.json +21 -21
  236. package/src/client/application/app-shell/comments-feature.js +108 -0
  237. package/src/client/application/app-shell/git-feature.js +6 -1
  238. package/src/client/application/app-shell/ui-feature-shell.js +7 -4
  239. package/src/client/application/app-shell/ui-feature-sidebar.js +11 -2
  240. package/src/client/application/app-shell-elements.js +2 -0
  241. package/src/client/application/diagram-chrome.js +708 -0
  242. package/src/client/application/mermaid-preview-hydrator.js +44 -524
  243. package/src/client/application/plantuml-preview-hydrator.js +22 -518
  244. package/src/client/application/preview-renderer.js +21 -5
  245. package/src/client/application/quick-switcher-loader.js +14 -0
  246. package/src/client/application/workspace-route-controller.js +25 -1
  247. package/src/client/bootstrap/app-shell-feature-surface.js +67 -0
  248. package/src/client/bootstrap/collabmd-app-shell.js +111 -356
  249. package/src/client/bootstrap/lazy-controller-feature.js +434 -0
  250. package/src/client/domain/drawio-frame-load.js +28 -0
  251. package/src/client/domain/hash-routes.js +16 -1
  252. package/src/client/domain/runtime-paths.js +7 -0
  253. package/src/client/drawio-editor.js +23 -10
  254. package/src/client/excalidraw-editor.js +66 -13
  255. package/src/client/infrastructure/editor-session.js +4 -0
  256. package/src/client/infrastructure/editor-view-adapter.js +30 -0
  257. package/src/client/infrastructure/runtime-config.js +17 -2
  258. package/src/client/infrastructure/vault-api-client.js +16 -0
  259. package/src/client/presentation/app-shell-template.js +29 -12
  260. package/src/client/presentation/bases-preview-controller.js +33 -16
  261. package/src/client/presentation/comment-overview-controller.js +238 -0
  262. package/src/client/presentation/comment-ui/comment-ui-state.js +23 -0
  263. package/src/client/presentation/drawio-embed-controller.js +230 -64
  264. package/src/client/presentation/excalidraw-embed-controller.js +51 -60
  265. package/src/client/presentation/file-explorer-controller.js +9 -0
  266. package/src/client/presentation/file-explorer-view.js +11 -1
  267. package/src/client/presentation/quick-switcher-controller.js +217 -21
  268. package/src/client/presentation/quick-switcher-text-search.js +125 -0
  269. package/src/client/styles/components/navigation.css +43 -8
  270. package/src/client/styles/components/scrollbars.css +5 -0
  271. package/src/client/styles/features/comment-overview.css +196 -0
  272. package/src/client/styles/features/comments.css +1 -0
  273. package/src/client/styles/features/diagram-preview.css +43 -23
  274. package/src/client/styles/features/quick-switcher.css +153 -15
  275. package/src/client/styles/layout/responsive.css +3 -2
  276. package/src/client/styles/layout/shell.css +6 -3
  277. package/src/client/styles/surfaces/excalidraw-editor.css +4 -0
  278. package/src/server/application/workspace-reconciliation.js +446 -0
  279. package/src/server/config/env.js +74 -0
  280. package/src/server/create-app-server.js +68 -38
  281. package/src/server/domain/bases/base-expression-runtime.js +183 -147
  282. package/src/server/domain/bases/base-index-snapshot-store.js +53 -2
  283. package/src/server/domain/bases/base-query-service.js +55 -38
  284. package/src/server/domain/collaboration/collaboration-document-store.js +6 -2
  285. package/src/server/domain/collaboration/collaboration-room.js +66 -2
  286. package/src/server/domain/comment-overview.js +108 -0
  287. package/src/server/domain/hosted-workspace-contract.js +18 -0
  288. package/src/server/domain/hosted-workspace.js +744 -0
  289. package/src/server/domain/ripgrep-search-service.js +365 -0
  290. package/src/server/domain/workspace-state.js +848 -2
  291. package/src/server/infrastructure/github/github-app-client.js +205 -0
  292. package/src/server/infrastructure/github/github-setup-flow.js +86 -0
  293. package/src/server/infrastructure/http/create-git-api-command-handler.js +1 -1
  294. package/src/server/infrastructure/http/create-hosted-api-handler.js +200 -0
  295. package/src/server/infrastructure/http/create-request-handler.js +23 -1
  296. package/src/server/infrastructure/http/create-static-handler.js +14 -1
  297. package/src/server/infrastructure/http/create-vault-api-command-handler.js +44 -119
  298. package/src/server/infrastructure/http/create-vault-api-handler.js +2 -0
  299. package/src/server/infrastructure/http/create-vault-api-query-handler.js +56 -35
  300. package/src/server/infrastructure/http/request-body.js +12 -2
  301. package/src/server/infrastructure/persistence/hosted-metadata-store.js +500 -0
  302. package/src/server/infrastructure/persistence/sidecar-store.js +53 -2
  303. package/src/server/infrastructure/persistence/vault-content-adapter.js +8 -8
  304. package/src/server/infrastructure/persistence/vault-file-store.js +64 -135
  305. package/src/server/infrastructure/websocket/attach-collaboration-gateway.js +49 -5
  306. package/src/server/infrastructure/workspace/file-system-sync-service.js +28 -411
  307. package/src/server/infrastructure/workspace/workspace-mutation-coordinator.js +13 -621
  308. package/src/server/infrastructure/workspace/workspace-state-file-system-adapter.js +37 -0
  309. package/dist/client/assets/_baseFor-BSErPbF2.js +0 -1
  310. package/dist/client/assets/architecture-YZFGNWBL-DWWrde02.js +0 -1
  311. package/dist/client/assets/blockDiagram-DXYQGD6D-6UN-nR8-.js +0 -132
  312. package/dist/client/assets/channel-XGCkuPi6.js +0 -1
  313. package/dist/client/assets/chunk-2KRD3SAO-CFcF2aNP.js +0 -1
  314. package/dist/client/assets/chunk-336JU56O-DvrrHsJT.js +0 -2
  315. package/dist/client/assets/chunk-426QAEUC-CEbmCgux.js +0 -1
  316. package/dist/client/assets/chunk-4TB4RGXK-CoouNThi.js +0 -206
  317. package/dist/client/assets/chunk-5FUZZQ4R-CxIIxXPy.js +0 -62
  318. package/dist/client/assets/chunk-5PVQY5BW-ciE7eHID.js +0 -2
  319. package/dist/client/assets/chunk-67CJDMHE-CW-fbgQB.js +0 -1
  320. package/dist/client/assets/chunk-7N4EOEYR-DbAW6XnF.js +0 -1
  321. package/dist/client/assets/chunk-AA7GKIK3-ClDHDAza.js +0 -1
  322. package/dist/client/assets/chunk-CIAEETIT-BnB8a6HR.js +0 -1
  323. package/dist/client/assets/chunk-ENJZ2VHE-BQj_1YA_.js +0 -10
  324. package/dist/client/assets/chunk-FOC6F5B3-Bw6XfKDP.js +0 -1
  325. package/dist/client/assets/chunk-ICPOFSXX-DqJi89rc.js +0 -122
  326. package/dist/client/assets/chunk-K5T4RW27-CQtjKF2g.js +0 -94
  327. package/dist/client/assets/chunk-KGLVRYIC-BWSPiKjp.js +0 -1
  328. package/dist/client/assets/chunk-ORNJ4GCN-Csga44e5.js +0 -1
  329. package/dist/client/assets/chunk-OYMX7WX6-DvtmCasj.js +0 -231
  330. package/dist/client/assets/chunk-QZHKN3VN-CHVH9_3S.js +0 -1
  331. package/dist/client/assets/chunk-YHkbxXgt.js +0 -1
  332. package/dist/client/assets/chunk-YKPWT25G-GISHuloq.js +0 -35
  333. package/dist/client/assets/classDiagram-6PBFFD2Q-D1KhAUL3.js +0 -1
  334. package/dist/client/assets/classDiagram-v2-HSJHXN6E-BSyyJpnR.js +0 -1
  335. package/dist/client/assets/clone-DI0bYZ1L.js +0 -1
  336. package/dist/client/assets/dagre-Dn6rkrte.js +0 -1
  337. package/dist/client/assets/dagre-KV5264BT-COzej2en.js +0 -4
  338. package/dist/client/assets/diagram-G4DWMVQ6-CbswIU9X.js +0 -24
  339. package/dist/client/assets/diagram-MMDJMWI5-BE-yOVGX.js +0 -43
  340. package/dist/client/assets/dist-BCzW2jDH.js +0 -1
  341. package/dist/client/assets/dist-BEk5kTf_.js +0 -1
  342. package/dist/client/assets/dist-BOn786F3.js +0 -1
  343. package/dist/client/assets/dist-BwUX6zpo.js +0 -1
  344. package/dist/client/assets/dist-D-ixVAsS2.js +0 -1
  345. package/dist/client/assets/dist-DwgKARew.js +0 -2
  346. package/dist/client/assets/dist-GgGgSSbl.js +0 -1
  347. package/dist/client/assets/dist-ZuMKSK7c.js +0 -9
  348. package/dist/client/assets/dist-tRNsnttY.js +0 -1
  349. package/dist/client/assets/drawio-editor-B_Sr8Z_Z.js +0 -9
  350. package/dist/client/assets/drawioEditor-DBSyP3_d.js +0 -2
  351. package/dist/client/assets/editor-session-C1scHGLl.js +0 -16
  352. package/dist/client/assets/excalidraw-editor-B0XXVLHd.js +0 -9
  353. package/dist/client/assets/excalidraw-editor-BZCE9ydu.css +0 -1
  354. package/dist/client/assets/excalidraw-scene-wAbVSY1L.js +0 -176
  355. package/dist/client/assets/excalidrawEditor-37sk03H8.js +0 -2
  356. package/dist/client/assets/exportDocument-WQNApAbg.js +0 -2
  357. package/dist/client/assets/flatten-DjXjUsvv.js +0 -1
  358. package/dist/client/assets/ganttDiagram-T4ZO3ILL-B-NMvHWN.js +0 -292
  359. package/dist/client/assets/gitGraph-7Q5UKJZL-DWNinXu4.js +0 -1
  360. package/dist/client/assets/gitGraphDiagram-UUTBAWPF-B95qkCUx.js +0 -106
  361. package/dist/client/assets/graphlib-CAwOVCJc.js +0 -1
  362. package/dist/client/assets/image-J2CAS7OM-DD4DaQTs.js +0 -1
  363. package/dist/client/assets/index-BoKmcqkH.js +0 -2
  364. package/dist/client/assets/index-maPm_Kvk.css +0 -1
  365. package/dist/client/assets/info-OMHHGYJF-DtYG_rX0.js +0 -1
  366. package/dist/client/assets/isEmpty-CpfhGGBo.js +0 -1
  367. package/dist/client/assets/javascript-qUBHINSy.js +0 -1
  368. package/dist/client/assets/line-BCItEgq3.js +0 -1
  369. package/dist/client/assets/main-BKumyd95.js +0 -1410
  370. package/dist/client/assets/mermaid-parser.core-CsTVsPcD.js +0 -4
  371. package/dist/client/assets/mermaid-runtime-BGlnoUXY.js +0 -11
  372. package/dist/client/assets/navigation-Du6CLhvs.css +0 -1
  373. package/dist/client/assets/packet-4T2RLAQJ-CUVefhAv.js +0 -1
  374. package/dist/client/assets/percentages-5DKR754L-DuhOjTM2.js +0 -1
  375. package/dist/client/assets/pie-ZZUOXDRM-BHBJ1dLX.js +0 -1
  376. package/dist/client/assets/pieDiagram-DEJITSTG-BOo-WzjZ.js +0 -30
  377. package/dist/client/assets/preview-diagram-utils-Nqpp4FNV.js +0 -1
  378. package/dist/client/assets/preview-render-compiler-9SmLUP5V.js +0 -1
  379. package/dist/client/assets/preview-render-compiler-IUtgIlOM.js +0 -35
  380. package/dist/client/assets/preview-render-profile-Bf6R7v4w.js +0 -23
  381. package/dist/client/assets/preview-render-worker-BwQ5sPy9.js +0 -59
  382. package/dist/client/assets/quadrantDiagram-34T5L4WZ-2vfo0l5S.js +0 -7
  383. package/dist/client/assets/quick-switcher-controller-B1erSgJ1.js +0 -5
  384. package/dist/client/assets/radar-PYXPWWZC-2jR4qZNU.js +0 -1
  385. package/dist/client/assets/reduce-ChpYjEUB.js +0 -1
  386. package/dist/client/assets/runtime-config-BcUbZKho.js +0 -1
  387. package/dist/client/assets/sequenceDiagram-FGHM5R23-DtF-1Kt2.js +0 -157
  388. package/dist/client/assets/stateDiagram-FHFEXIEX-DKk7Sb0f.js +0 -1
  389. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-DJUaiADr.js +0 -1
  390. package/dist/client/assets/subset-shared.chunk-CWNYNLru.js +0 -1
  391. package/dist/client/assets/treeView-SZITEDCU-DN5dP2ol.js +0 -1
  392. package/dist/client/assets/treemap-W4RFUUIX-Dva7DBJR.js +0 -1
  393. package/dist/client/assets/turtle-BkP3ExOG.js +0 -1
  394. package/dist/client/assets/vault-api-client-BDKKvtOF.js +0 -1
  395. package/dist/client/assets/vennDiagram-DHZGUBPP-DNnIjRae.js +0 -34
  396. package/dist/client/assets/wardley-RL74JXVD-CDZW5uzY.js +0 -1
  397. /package/dist/client/assets/{apl-C1JYSI8J.js → apl-CnwPGSsG.js} +0 -0
  398. /package/dist/client/assets/{array-B3agRrCs.js → array-BifhSqXX.js} +0 -0
  399. /package/dist/client/assets/{asciiarmor-DHW75j1s.js → asciiarmor-qTkVPQu6.js} +0 -0
  400. /package/dist/client/assets/{asn1-CQiG40kG.js → asn1-Dr8qZg38.js} +0 -0
  401. /package/dist/client/assets/{asterisk-BWExh0n4.js → asterisk-Bja0s6e1.js} +0 -0
  402. /package/dist/client/assets/{base-h1uscjTi.js → base-CxPEiHuy.js} +0 -0
  403. /package/dist/client/assets/{brainfuck-CTNFyOLg.js → brainfuck-D5EjA2JK.js} +0 -0
  404. /package/dist/client/assets/{chunk-3PELD44J-DymL2rGq.js → chunk-3PELD44J-C625MXe_.js} +0 -0
  405. /package/dist/client/assets/{chunk-A66AFZZU-BFHL744F.js → chunk-A66AFZZU-BbU3ThId.js} +0 -0
  406. /package/dist/client/assets/{chunk-LOOWOR4L-C5BUwXgZ.js → chunk-LOOWOR4L-CGCAV5nC.js} +0 -0
  407. /package/dist/client/assets/{clike-BFTLRaGS.js → clike-DHH8Ad3s.js} +0 -0
  408. /package/dist/client/assets/{clojure-D-DYVqu7.js → clojure-BflJGmDX.js} +0 -0
  409. /package/dist/client/assets/{cmake-DtGL-Unu.js → cmake-CyVbuzPu.js} +0 -0
  410. /package/dist/client/assets/{cobol-DP4QggbL.js → cobol-B_OZ4V-R.js} +0 -0
  411. /package/dist/client/assets/{coffeescript-B7GZajzV.js → coffeescript-B2pKbFk8.js} +0 -0
  412. /package/dist/client/assets/{commonlisp-COlJYiQT.js → commonlisp-CcllspGY.js} +0 -0
  413. /package/dist/client/assets/{crystal-I_dE9xG-.js → crystal-M5-qzICs.js} +0 -0
  414. /package/dist/client/assets/{css-CmhPNxBE.js → css-CYpP4FRV.js} +0 -0
  415. /package/dist/client/assets/{cypher-DEGl2llJ.js → cypher-p9eYesGn.js} +0 -0
  416. /package/dist/client/assets/{d-BspB0dox.js → d-BhMjBjQP.js} +0 -0
  417. /package/dist/client/assets/{defaultLocale-B_FbTTbl.js → defaultLocale-C8Fc0cco.js} +0 -0
  418. /package/dist/client/assets/{diff-BWuPUsEo.js → diff-ChtP43wD.js} +0 -0
  419. /package/dist/client/assets/{drawio-room-1i6Nn0_Z.js → drawio-room-B3OZRHTH.js} +0 -0
  420. /package/dist/client/assets/{dtd-C6brJFPg.js → dtd-DTF72YNO.js} +0 -0
  421. /package/dist/client/assets/{dylan-Bft86ZSB.js → dylan-C6jEEEk-.js} +0 -0
  422. /package/dist/client/assets/{ebnf-D6ifG44A.js → ebnf-D4c0_ac3.js} +0 -0
  423. /package/dist/client/assets/{ecl-D9rhJ9-u.js → ecl-BSZaIHnp.js} +0 -0
  424. /package/dist/client/assets/{eiffel-DwxtewZF.js → eiffel-BEjRio4Q.js} +0 -0
  425. /package/dist/client/assets/{elm-B1TncobV.js → elm-Cshzl8qu.js} +0 -0
  426. /package/dist/client/assets/{erlang-BDJZNtt8.js → erlang-DaB2Rkuy.js} +0 -0
  427. /package/dist/client/assets/{excalidraw-mermaid-stub-DzxtBcQW.js → excalidraw-mermaid-stub-BNckbX2n.js} +0 -0
  428. /package/dist/client/assets/{fcl-CUXJFJn1.js → fcl-ClOhbFR7.js} +0 -0
  429. /package/dist/client/assets/{file-kind-DmKq2MvD.js → file-kind-BKPOIRPE.js} +0 -0
  430. /package/dist/client/assets/{forth-nvhcMz63.js → forth-Cezjo90N.js} +0 -0
  431. /package/dist/client/assets/{fortran-BZID-z10.js → fortran-Bt6PBEDR.js} +0 -0
  432. /package/dist/client/assets/{gas-DjQsZDGE.js → gas-BHEdbvp9.js} +0 -0
  433. /package/dist/client/assets/{gherkin-S0kHlzux.js → gherkin-oBAE_ms0.js} +0 -0
  434. /package/dist/client/assets/{groovy-Di--Vb9Z.js → groovy-BC3IOsC8.js} +0 -0
  435. /package/dist/client/assets/{haskell-C6qH3-aI.js → haskell-BRsoo5mP.js} +0 -0
  436. /package/dist/client/assets/{http-DG1Y9fpK.js → http-CLVgA2GD.js} +0 -0
  437. /package/dist/client/assets/{idl-B64p3NTJ.js → idl-BUZw3wgd.js} +0 -0
  438. /package/dist/client/assets/{image-blob-reduce.esm-D8JQdTFk.js → image-blob-reduce.esm-NzmDxm1v.js} +0 -0
  439. /package/dist/client/assets/{init-DtLQcSuO.js → init-D6jRqBbL.js} +0 -0
  440. /package/dist/client/assets/{julia-B22G9Bym.js → julia-CQfgDRfP.js} +0 -0
  441. /package/dist/client/assets/{katex-CXYULLWy.js → katex-C7GtLiLd.js} +0 -0
  442. /package/dist/client/assets/{vault-api-client-D7Ck0CvR.css → keyboard-shortcuts-D7Ck0CvR.css} +0 -0
  443. /package/dist/client/assets/{livescript-CkcuHqeS.js → livescript-BXxG0Yva.js} +0 -0
  444. /package/dist/client/assets/{lua-Cg0FqIlO.js → lua-CL1SqxuB.js} +0 -0
  445. /package/dist/client/assets/{mathematica-CKVhKnoY.js → mathematica-u8YMmbU0.js} +0 -0
  446. /package/dist/client/assets/{mbox-DANyzFJ2.js → mbox-BEMVcqjs.js} +0 -0
  447. /package/dist/client/assets/{mirc-BVG2S5rO.js → mirc-C9zpzAZU.js} +0 -0
  448. /package/dist/client/assets/{mllike-C0p7lv48.js → mllike-B45xgp2S.js} +0 -0
  449. /package/dist/client/assets/{modelica-vJ-Qa9jV.js → modelica-CqHI_q-D.js} +0 -0
  450. /package/dist/client/assets/{mscgen-vUD-SWGJ.js → mscgen-qgSLujhx.js} +0 -0
  451. /package/dist/client/assets/{mumps-D0KfUTSd.js → mumps-CW_TBmxz.js} +0 -0
  452. /package/dist/client/assets/{nginx-DkVceJrH.js → nginx-BMaDbqW3.js} +0 -0
  453. /package/dist/client/assets/{ntriples-BBuCIfS0.js → ntriples-d28e9m0E.js} +0 -0
  454. /package/dist/client/assets/{octave-BTv2CqSQ.js → octave-D2Q8cUp1.js} +0 -0
  455. /package/dist/client/assets/{oz-D8SjVDNU.js → oz-BwTct_5T.js} +0 -0
  456. /package/dist/client/assets/{pascal-T-tfhVyx.js → pascal-Dp_KdFgX.js} +0 -0
  457. /package/dist/client/assets/{path-DIlZIGue.js → path-BWPyau1x.js} +0 -0
  458. /package/dist/client/assets/{perl-BDrCkHRd.js → perl-CdEHsPfU.js} +0 -0
  459. /package/dist/client/assets/{pig-BEyI4fPq.js → pig-AF4Hwhju.js} +0 -0
  460. /package/dist/client/assets/{powershell-DtnFc6GG.js → powershell-CzG71I4L.js} +0 -0
  461. /package/dist/client/assets/{preload-helper-Bo9GmnuQ.js → preload-helper-kNaey6uv.js} +0 -0
  462. /package/dist/client/assets/{properties-DWUvbxV9.js → properties-C357ku5U.js} +0 -0
  463. /package/dist/client/assets/{protobuf-CQGoYyfE.js → protobuf-D1ij_kNL.js} +0 -0
  464. /package/dist/client/assets/{puppet-Dd-qWO3p.js → puppet-B4hC2X4m.js} +0 -0
  465. /package/dist/client/assets/{python-BUyhM0Ew.js → python-BqYw9LYJ.js} +0 -0
  466. /package/dist/client/assets/{q-Dls1OX0D.js → q-B9NhS7L_.js} +0 -0
  467. /package/dist/client/assets/{r-DeZ8Mdev.js → r-DADKenSm.js} +0 -0
  468. /package/dist/client/assets/{rough.esm-BU2knLt9.js → rough.esm-CSKSodPl.js} +0 -0
  469. /package/dist/client/assets/{roundRect-BzEouiv_.js → roundRect-D01gJrlt.js} +0 -0
  470. /package/dist/client/assets/{rpm-CjWxLM68.js → rpm-gpDK5sbt.js} +0 -0
  471. /package/dist/client/assets/{ruby-CB34f2Gf.js → ruby-DsYpTuWg.js} +0 -0
  472. /package/dist/client/assets/{runtime-config-loader-_D2KZKn-.js → runtime-config-loader-BUK56BZz.js} +0 -0
  473. /package/dist/client/assets/{sas-Bji4HDQq.js → sas-C2OyD2Y6.js} +0 -0
  474. /package/dist/client/assets/{scheme-C3elI80V.js → scheme-CyDdOh7e.js} +0 -0
  475. /package/dist/client/assets/{shell-DUveK2Hb.js → shell-Du5Qg9im.js} +0 -0
  476. /package/dist/client/assets/{sieve-2ogwMVx4.js → sieve-BAxa3IjF.js} +0 -0
  477. /package/dist/client/assets/{simple-mode-pOKc0mfx.js → simple-mode-DRpGK0lJ.js} +0 -0
  478. /package/dist/client/assets/{smalltalk-BuGhc6lW.js → smalltalk-BLp5-jwC.js} +0 -0
  479. /package/dist/client/assets/{solr-DTxshpm8.js → solr-BBopId9w.js} +0 -0
  480. /package/dist/client/assets/{sparql-vm8qNO8J.js → sparql-Dz-mlCAC.js} +0 -0
  481. /package/dist/client/assets/{spreadsheet-C6Vbtl9-.js → spreadsheet-CTIncYxj.js} +0 -0
  482. /package/dist/client/assets/{sql-GL7dVWcd.js → sql-DcCJ9jop.js} +0 -0
  483. /package/dist/client/assets/{stex-CEwW0Q_0.js → stex-sDrdk2BW.js} +0 -0
  484. /package/dist/client/assets/{stylus-D1SZIMDs.js → stylus-DLLZ8dgm.js} +0 -0
  485. /package/dist/client/assets/{swift-CKcKnWv9.js → swift-DKB6_1j6.js} +0 -0
  486. /package/dist/client/assets/{tcl-SPk7uiDB.js → tcl-BGfruO1u.js} +0 -0
  487. /package/dist/client/assets/{textile-C48beRus.js → textile-DWBqthVk.js} +0 -0
  488. /package/dist/client/assets/{tiddlywiki-CiImjFLN.js → tiddlywiki-VlUiK86J.js} +0 -0
  489. /package/dist/client/assets/{tiki-HkXZ4BIW.js → tiki-CxVlf5KZ.js} +0 -0
  490. /package/dist/client/assets/{toml-BmfpMy1_.js → toml-LvoKBwCs.js} +0 -0
  491. /package/dist/client/assets/{troff-BjbEOT5E.js → troff-C2dAgh7P.js} +0 -0
  492. /package/dist/client/assets/{ttcn-NA-V4KnY.js → ttcn-BePYh-hG.js} +0 -0
  493. /package/dist/client/assets/{ttcn-cfg-TPHncdGN.js → ttcn-cfg-CY0aot7Q.js} +0 -0
  494. /package/dist/client/assets/{vb-C19AQWqO.js → vb-BthdM_4N.js} +0 -0
  495. /package/dist/client/assets/{vbscript-CHJk3s95.js → vbscript-D9f6rSsU.js} +0 -0
  496. /package/dist/client/assets/{velocity-Ya0P4sQU.js → velocity-CqftRsjg.js} +0 -0
  497. /package/dist/client/assets/{verilog-DSARZZPc.js → verilog-D-x6ne0Z.js} +0 -0
  498. /package/dist/client/assets/{vhdl-CnYyYTpa.js → vhdl-CMrOq2q1.js} +0 -0
  499. /package/dist/client/assets/{webidl-DttrYZRT.js → webidl-D5jiJvOU.js} +0 -0
  500. /package/dist/client/assets/{xquery-CEDTd8qs.js → xquery-fj_R-kMw.js} +0 -0
  501. /package/dist/client/assets/{yacas-C7dxlPB0.js → yacas-CXXgtw0p.js} +0 -0
  502. /package/dist/client/assets/{z80-BqEfFSnA.js → z80-CL1naaMV.js} +0 -0
@@ -1,176 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ar-SA-NXDWD63E-CTf_wpt3.js","./chunk-SRAX5OIU-yDw8XRsi.js","./chunk-YHkbxXgt.js","./az-AZ-MXSORGZV-C_C9i9u3.js","./bg-BG-O6MV2KSF-YmfvQf63.js","./bn-BD-T2VJNT7N-BD0ob0JE.js","./bn-IN-MMW2ORAC-BTEFR4Ed.js","./ca-ES-MKBCGNOG-aLX_cjA0.js","./cs-CZ-V77HGUP7-Du3y53BB.js","./da-DK-I5RFNTM4-CDJtjf5s.js","./de-CH-WLRDEVBV-CLV2tVw6.js","./de-DE-DTI4WUSC-B53J0BQ8.js","./el-GR-ZXDJ2OS4-DFmRQv0o.js","./en-CMP6EMR6-D9x8hVSu.js","./chunk-LOOWOR4L-C5BUwXgZ.js","./es-ES-DYQHAD43-BiGWIrBG.js","./eu-ES-QDSYU5Y3-BjwS0kZi.js","./fa-IR-26LZG4PM-BgANg2TD.js","./fi-FI-6YS4KDE4-CBL5f3oN.js","./fr-FR-BRLLPTZC-CRibNSLG.js","./gl-ES-OKUZTLYG-DEDwa_xt.js","./he-IL-26MGYIU7-47wxy70N.js","./hi-IN-Q4ZOGTP2-bhV7c3dK.js","./hu-HU-P2OXPSN5-xG-gBMzE.js","./id-ID-2EIKXYN6-MQuYaNHo.js","./it-IT-4CFKVXI2-v2kj-y7j.js","./ja-JP-MAND2Z4V-BahXSQz-.js","./kaa-HQRTCXTJ-BF26ydFa.js","./kab-KAB-JKIKKTGH-CEIH0F80.js","./kk-KZ-HXQ63ZFC-CxWjc9Sf.js","./km-KH-PKL3LSGX-DJlCteEp.js","./ko-KR-KXLREZX3-B1gtI_ci.js","./ku-TR-MJ4IER3X-Bf41y2v2.js","./lt-LT-H6WFQ6FJ-DA1or-Eo.js","./lv-LV-GOCK6SJW-qa0BoYMm.js","./mr-IN-IXVLDMEQ-DXFRgvgb.js","./my-MM-YG6MYTTD-BKDIfalJ.js","./nb-NO-XGWJISD2-DbwbopH8.js","./nl-NL-XVDVCPNC-ChSneTSU.js","./nn-NO-EMX5MJX5-Cf7ZWKWZ.js","./oc-FR-ROEINTVO-lM7Nl7hD.js","./pa-IN-ZYN6SUDY-C9WNUTeR.js","./percentages-5DKR754L-DuhOjTM2.js","./chunk-3PELD44J-DymL2rGq.js","./pl-PL-6VTG7PHC-DqRVepnC.js","./pt-BR-5YFKRR5G-CopLYEA6.js","./pt-PT-GEIXXZ67-BjZ_Lphg.js","./ro-RO-E2P6TFZI-DakDz5Xu.js","./ru-RU-YBIIY43T-BMvCT-XT.js","./si-LK-673C2CI2-hGdH1S9E.js","./sk-SK-CKZHQ4AP-DiRA-fj8.js","./sl-SI-557H2GWM-DN94n_1-.js","./sv-SE-XOPKKDWS-CkHUNABj.js","./ta-IN-XBH7DQI3-W-157oVK.js","./th-TH-TOCWH3R4-BsU-Pydr.js","./tr-TR-GXW6CYY5-CTddyq89.js","./uk-UA-IJKTNUDG-1LzXkII3.js","./uz-UZ-TBZZEA4V-kqm-qcUj.js","./vi-VN-MULSGNVB-C3H2AUhm.js","./zh-CN-MVX3E32U-BULPbsyl.js","./zh-HK-JNU5RLIE-bNGmeSaW.js","./zh-TW-LENVCA6T-CQDp064P.js","./image-J2CAS7OM-DD4DaQTs.js","./chunk-YKPWT25G-GISHuloq.js","./preload-helper-Bo9GmnuQ.js","./chunk-A66AFZZU-BFHL744F.js","./CodeMirrorEditor-UCMRAMCV-75Zi8U_A.js","./dist-Bz-8_JmE.js","./dist-DplP0BiK.js","./jsx-runtime-1KUJVfx8.js","./excalidraw-mermaid-stub-Df0Q2qkW.js","./excalidraw-mermaid-stub-DzxtBcQW.js"])))=>i.map(i=>d[i]);
2
- import{s as e,t}from"./chunk-YHkbxXgt.js";import{t as n}from"./preload-helper-Bo9GmnuQ.js";import{t as r}from"./chunk-A66AFZZU-BFHL744F.js";import{i,n as a,r as o}from"./chunk-SRAX5OIU-yDw8XRsi.js";import{n as s,t as c}from"./jsx-runtime-1KUJVfx8.js";import{$ as l,$a as u,$i as d,$o as f,$r as p,$s as m,$t as h,A as g,Aa as _,Ac as v,Ai as y,An as b,Ao as x,Ar as S,As as C,At as w,B as T,Ba as E,Bc as D,Bi as O,Bn as k,Bo as ee,Br as te,Bs as ne,Bt as re,C as ie,Ca as ae,Cc as oe,Ci as se,Cn as ce,Co as le,Cr as ue,Ct as de,D as fe,Da as pe,Dc as me,Di as he,Dn as ge,Do as _e,Dr as ve,Ds as ye,Dt as be,E as xe,Ea as Se,Ec as Ce,Ei as we,En as Te,Eo as Ee,Er as De,Es as Oe,Et as ke,F as Ae,Fa as je,Fc as Me,Fi as Ne,Fn as Pe,Fo as Fe,Fr as Ie,Fs as Le,Ft as Re,G as ze,Ga as Be,Gc as Ve,Gi as He,Gn as Ue,Go as We,Gr as Ge,Gs as Ke,Gt as qe,H as Je,Ha as Ye,Hc as Xe,Hi as Ze,Hn as Qe,Ho as $e,Hr as et,Hs as tt,Ht as nt,I as rt,Ia as it,Ic as at,Ii as ot,In as st,Io as ct,Ir as lt,Is as ut,It as dt,J as ft,Ja as pt,Ji as mt,Jn as A,Jo as ht,Jr as gt,Js as _t,Jt as vt,K as yt,Ka as j,Kc as bt,Ki as M,Kn as xt,Kr as St,Ks as Ct,Kt as wt,L as Tt,La as Et,Lc as Dt,Li as Ot,Ln as kt,Lo as At,Lr as jt,Ls as Mt,Lt as Nt,M as Pt,Ma as Ft,Mc as It,Mi as Lt,Mn as Rt,Mo as zt,Mr as Bt,Ms as Vt,Mt as Ht,N as Ut,Na as Wt,Nc as Gt,Ni as Kt,Nn as qt,No as Jt,Nr as Yt,Ns as Xt,Nt as Zt,O as Qt,Oa as $t,Oc as en,Oi as tn,On as nn,Oo as rn,Or as an,Os as on,Ot as sn,P as cn,Pa as ln,Pc as un,Pi as dn,Pn as fn,Po as pn,Pr as mn,Ps as hn,Pt as gn,Q as _n,Qa as vn,Qi as yn,Qn as bn,Qo as xn,Qr as Sn,Qs as Cn,Qt as wn,R as Tn,Ra as En,Rc as Dn,Ri as On,Rn as kn,Ro as An,Rr as jn,Rs as Mn,Rt as Nn,S as Pn,Sa as Fn,Sc as In,Si as Ln,Sn as Rn,So as zn,Sr as Bn,Ss as Vn,St as Hn,T as Un,Ta as Wn,Tc as Gn,Ti as Kn,Tn as qn,To as Jn,Tr as Yn,Ts as Xn,Tt as Zn,U as Qn,Ua as $n,Uc as er,Ui as tr,Un as nr,Ur as rr,Us as ir,Ut as ar,V as or,Va as sr,Vc as cr,Vi as lr,Vn as ur,Vo as dr,Vr as fr,Vs as pr,Vt as mr,Wa as hr,Wc as N,Wi as gr,Wn as _r,Wo as vr,Wr as yr,Ws as br,Wt as xr,X as Sr,Xa as Cr,Xi as wr,Xn as Tr,Xr as Er,Xs as Dr,Xt as Or,Y as kr,Ya as Ar,Yi as jr,Yn as Mr,Yo as Nr,Yr as Pr,Ys as Fr,Yt as Ir,Za as Lr,Zi as Rr,Zn as zr,Zo as Br,Zr as Vr,Zs as Hr,Zt as Ur,_ as Wr,_a as Gr,_c as Kr,_i as qr,_n as Jr,_o as Yr,_r as Xr,_s as Zr,_t as Qr,a as $r,aa as ei,ac as ti,ai as ni,an as ri,ao as ii,ar as ai,as as oi,at as si,b as ci,ba as li,bc as ui,bi as di,bn as fi,bo as pi,br as mi,bs as hi,bt as gi,c as _i,ca as vi,cc as yi,ci as bi,cn as xi,co as Si,cr as Ci,cs as wi,ct as Ti,d as Ei,da as Di,dc as Oi,di as ki,dn as P,do as Ai,dr as ji,ds as Mi,dt as Ni,ea as Pi,ec as Fi,ei as Ii,en as Li,eo as Ri,er as zi,es as Bi,et as Vi,f as Hi,fa as Ui,fc as Wi,fi as Gi,fn as Ki,fo as qi,fr as Ji,fs as Yi,ft as Xi,g as Zi,ga as Qi,gc as $i,gi as F,gn as ea,go as ta,gr as na,gs as ra,gt as ia,h as aa,ha as oa,hc as sa,hi as ca,hn as la,ho as ua,hr as I,hs as da,ht as fa,ia as pa,ic as ma,ii as ha,in as ga,io as _a,ir as va,is as ya,it as ba,j as xa,ja as Sa,jc as Ca,ji as wa,jn as Ta,jr as Ea,js as Da,jt as Oa,k as ka,ka as Aa,kc as ja,ki as Ma,kn as Na,ko as L,kr as Pa,ks as Fa,kt as Ia,l as La,la as Ra,lc as za,li as Ba,ln as Va,lo as Ha,lr as Ua,ls as Wa,lt as Ga,m as Ka,ma as qa,mc as Ja,mi as Ya,mn as Xa,mr as Za,ms as Qa,mt as $a,n as eo,na as to,nc as no,ni as ro,nn as io,no as ao,nr as oo,ns as so,nt as co,o as lo,oa as uo,oc as fo,oi as po,on as mo,oo as ho,or as go,os as _o,ot as vo,p as yo,pa as bo,pc as xo,pi as So,pn as Co,po as wo,pr as To,ps as Eo,pt as Do,q as Oo,qa as ko,qi as Ao,qn as jo,qo as Mo,qr as No,qs as Po,qt as Fo,r as Io,ra as Lo,rc as Ro,ri as zo,rn as Bo,ro as Vo,rr as Ho,rs as Uo,rt as Wo,s as Go,sa as Ko,sc as qo,si as Jo,sn as Yo,so as Xo,sr as Zo,ss as Qo,st as $o,t as es,ta as ts,tc as ns,ti as rs,tn as is,to as as,tr as os,ts as ss,tt as cs,u as ls,ua as us,uc as ds,ui as fs,un as ps,uo as ms,ur as hs,us as gs,ut as _s,v as vs,va as ys,vi as bs,vn as xs,vo as Ss,vr as Cs,vt as ws,w as Ts,wa as Es,wc as Ds,wi as Os,wn as ks,wo as As,wr as js,ws as Ms,wt as Ns,x as Ps,xa as Fs,xc as Is,xi as Ls,xn as Rs,xo as zs,xr as Bs,xs as Vs,xt as Hs,y as Us,ya as Ws,yc as Gs,yi as Ks,yn as qs,yo as Js,yr as Ys,ys as R,yt as Xs,z as Zs,za as Qs,zc as z,zi as $s,zn as ec,zo as tc,zr as nc,zs as rc,zt as B}from"./chunk-YKPWT25G-GISHuloq.js";import{_ as ic}from"./chunk-LOOWOR4L-C5BUwXgZ.js";import{r as ac}from"./chunk-3PELD44J-DymL2rGq.js";import{n as oc}from"./excalidraw-mermaid-stub-DzxtBcQW.js";var sc=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.5`})),cc=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=sc()})),V=e(s(),1),H=c(),lc=e(cc(),1);function uc(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=uc(e[t]))&&(r&&(r+=` `),r+=n);else for(t in e)e[t]&&(r&&(r+=` `),r+=t);return r}function U(){for(var e=0,t,n,r=``;e<arguments.length;)(t=arguments[e++])&&(n=uc(t))&&(r&&(r+=` `),r+=n);return r}var dc=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=S(t)||0,y(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(S(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 v(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 x(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(x(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=x(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return v(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,t,r){var i=!0,a=!0;if(typeof e!=`function`)throw TypeError(n);return y(r)&&(i=`leading`in r?!!r.leading:i,a=`trailing`in r?!!r.trailing:a),_(e,t,{leading:i,maxWait:t,trailing:a})}function y(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function b(e){return!!e&&typeof e==`object`}function x(e){return typeof e==`symbol`||b(e)&&p.call(e)==i}function S(e){if(typeof e==`number`)return e;if(x(e))return r;if(y(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=y(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=v}))(),1),fc=0;function pc(e,t){let n=`atom${++fc}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=mc,r.write=hc),t&&(r.write=t),r}function mc(e){return e(this)}function hc(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}var gc=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,_c=e=>`init`in e,vc=e=>!!e.write,yc=new WeakMap,bc=e=>Cc(e)&&!yc.get(e)?.[1],xc=(e,t)=>{let n=yc.get(e);n&&(n[1]=!0,n[0].forEach(e=>e(t)))},Sc=e=>{if(yc.has(e))return;let t=[new Set,!1];yc.set(e,t);let n=()=>{t[1]=!0};e.then(n,n),e.onCancel=e=>{t[0].add(e)}},Cc=e=>typeof e?.then==`function`,wc=e=>`v`in e||`e`in e,Tc=e=>{if(`e`in e)throw e.e;return e.v},Ec=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},Dc=(e,t,n,r,i)=>{var a;n.d.set(r,i.n),bc(n.v)&&Ec(t,n.v,i),(a=i.m)==null||a.t.add(t),e&&jc(e,r,t)},Oc=()=>({D:new Map,H:new Set,M:new Set,L:new Set}),kc=(e,t,n)=>{e[t].add(n)},Ac=(e,t,n)=>{e.D.has(t)||(e.D.set(t,new Set),kc(e,`M`,()=>{var t;(t=n.m)==null||t.l.forEach(t=>kc(e,`M`,t))}))},jc=(e,t,n)=>{let r=e.D.get(t);r&&r.add(n)},Mc=(e,t)=>e.D.get(t),Nc=e=>{let t,n=!1,r=e=>{try{e()}catch(e){n||=(t=e,!0)}};for(;e.H.size||e.M.size||e.L.size;)e.D.clear(),e.H.forEach(r),e.H.clear(),e.M.forEach(r),e.M.clear(),e.L.forEach(r),e.L.clear();if(n)throw t},Pc=(...[e,t,n,r])=>{let i=(t,n,r)=>{let i=`v`in n,a=n.v,o=bc(n.v)?n.v:null;if(Cc(r)){Sc(r);for(let i of n.d.keys())Ec(t,r,e(i));n.v=r}else n.v=r;delete n.e,delete n.x,(!i||!Object.is(a,n.v))&&(++n.n,o&&xc(o,r))},a=(n,r)=>{var o;let s=e(r);if(wc(s)&&(s.m&&!s.x||Array.from(s.d).every(([e,t])=>a(n,e).n===t)))return s;s.d.clear();let c=!0,l=t=>{if(gc(r,t)){let n=e(t);if(!wc(n))if(_c(t))i(t,n,t.init);else throw Error(`no atom init`);return Tc(n)}let o=a(n,t);try{return Tc(o)}finally{if(c)Dc(n,r,s,t,o);else{let e=Oc();Dc(e,r,s,t,o),d(e,r,s),Nc(e)}}},f,p,m={get signal(){return f||=new AbortController,f.signal},get setSelf(){return!p&&vc(r)&&(p=(...e)=>{if(!c)return u(r,...e)}),p}};try{let e=t(r,l,m);if(i(r,s,e),Cc(e)){(o=e.onCancel)==null||o.call(e,()=>f?.abort());let t=()=>{if(s.m){let e=Oc();d(e,r,s),Nc(e)}};e.then(t,t)}return s}catch(e){return delete s.v,s.e=e,delete s.x,++s.n,s}finally{c=!1}},o=e=>Tc(a(void 0,e)),s=(t,n,r)=>{var i;let a=new Map;for(let t of r.m?.t||[]){let n=e(t);n.m&&a.set(t,n)}for(let t of r.p)a.set(t,e(t));return(i=Mc(t,n))==null||i.forEach(t=>{a.set(t,e(t))}),a},c=(e,t,n)=>{let r=[],i=new Set,o=new Set,c=[[t,n]];for(;c.length>0;){let[t,n]=c[c.length-1];if(o.has(t)){c.pop();continue}if(i.has(t)){r.push([t,n,n.n]),o.add(t),n.x=!0,c.pop();continue}i.add(t);for(let[r,a]of s(e,t,n))t!==r&&!i.has(r)&&c.push([r,a])}kc(e,`H`,()=>{let n=new Set([t]);for(let t=r.length-1;t>=0;--t){let[i,o,s]=r[t],c=!1;for(let e of o.d.keys())if(e!==i&&n.has(e)){c=!0;break}c&&(a(e,i),d(e,i,o),s!==o.n&&(Ac(e,i,o),n.add(i))),delete o.x}})},l=(t,r,...o)=>{let s=!0,u=e=>Tc(a(t,e)),f=(n,...a)=>{let o=e(n);try{if(gc(r,n)){if(!_c(n))throw Error(`atom not writable`);let e=o.n,r=a[0];i(n,o,r),d(t,n,o),e!==o.n&&(Ac(t,n,o),c(t,n,o));return}else return l(t,n,...a)}finally{s||Nc(t)}};try{return n(r,u,f,...o)}finally{s=!1}},u=(e,...t)=>{let n=Oc();try{return l(n,e,...t)}finally{Nc(n)}},d=(t,n,r)=>{if(r.m&&!bc(r.v)){for(let i of r.d.keys())r.m.d.has(i)||(f(t,i,e(i)).t.add(n),r.m.d.add(i));for(let i of r.m.d||[])r.d.has(i)||(r.m.d.delete(i),p(t,i,e(i))?.t.delete(n))}},f=(t,n,i)=>{if(!i.m){a(t,n);for(let r of i.d.keys())f(t,r,e(r)).t.add(n);if(i.m={l:new Set,d:new Set(i.d.keys()),t:new Set},vc(n)){let e=i.m,a,o=(e,t)=>{let r=!0;a=(...t)=>{try{return l(e,n,...t)}finally{r||Nc(e)}};try{return t()}finally{r=!1}};kc(t,`L`,()=>{let i=o(t,()=>r(n,(...e)=>a(...e)));i&&(e.u=e=>o(e,i))})}}return i.m},p=(t,n,r)=>{if(r.m&&!r.m.l.size&&!Array.from(r.m.t).some(t=>e(t).m?.d.has(n))){let i=r.m.u;i&&kc(t,`L`,()=>i(t)),delete r.m;for(let i of r.d.keys())p(t,i,e(i))?.t.delete(n);return}return r.m};return{get:o,set:u,sub:(t,n)=>{let r=Oc(),i=e(t),a=f(r,t,i).l;return a.add(n),Nc(r),()=>{a.delete(n);let e=Oc();p(e,t,i),Nc(e)}},unstable_derive:i=>Pc(...i(e,t,n,r))}},Fc=()=>{let e=new WeakMap;return Pc(t=>{let n=e.get(t);return n||(n={d:new Map,p:new Set,n:0},e.set(t,n)),n},(e,...t)=>e.read(...t),(e,...t)=>e.write(...t),(e,...t)=>e.onMount?.call(e,...t))},Ic,Lc=()=>(Ic||=Fc(),Ic),Rc=(0,V.createContext)(void 0),zc=e=>{let t=(0,V.useContext)(Rc);return e?.store||t||Lc()},Bc=e=>typeof e?.then==`function`,Vc=e=>{e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t})},Hc=V.use||(e=>{if(e.status===`pending`)throw e;if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:(Vc(e),e)}),Uc=new WeakMap,Wc=e=>{let t=Uc.get(e);return t||(t=new Promise((n,r)=>{let i=e,a=e=>t=>{i===e&&n(t)},o=e=>t=>{i===e&&r(t)},s=e=>{`onCancel`in e&&typeof e.onCancel==`function`&&e.onCancel(e=>{Bc(e)?(Uc.set(e,t),i=e,e.then(a(e),o(e)),s(e)):n(e)})};e.then(a(e),o(e)),s(e)}),Uc.set(e,t)),t};function Gc(e,t){let n=zc(t),[[r,i,a],o]=(0,V.useReducer)(t=>{let r=n.get(e);return Object.is(t[0],r)&&t[1]===n&&t[2]===e?t:[r,n,e]},void 0,()=>[n.get(e),n,e]),s=r;(i!==n||a!==e)&&(o(),s=n.get(e));let c=t?.delay;return(0,V.useEffect)(()=>{let t=n.sub(e,()=>{if(typeof c==`number`){let t=n.get(e);Bc(t)&&Vc(Wc(t)),setTimeout(o,c);return}o()});return o(),t},[n,e,c]),(0,V.useDebugValue)(s),Bc(s)?Hc(Wc(s)):s}function Kc(e,t){let n=zc(t);return(0,V.useCallback)((...t)=>n.set(e,...t),[n,e])}function qc(e,t){return[Gc(e,t),Kc(e,t)]}var Jc=new WeakMap;function Yc(e,t){let n=zc(t),r=Xc(n);for(let[i,a]of e)(!r.has(i)||t?.dangerouslyForceHydrate)&&(r.add(i),n.set(i,a))}var Xc=e=>{let t=Jc.get(e);return t||(t=new WeakSet,Jc.set(e,t)),t};function Zc(){return Zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zc.apply(this,arguments)}function Qc(){let e=(0,V.createContext)(null);function t({store:t,initialValues:n=[],children:r}){let i=(0,V.useRef)(t);return i.current||=Fc(),Yc(n,{store:i.current}),(0,H.jsx)(e.Provider,{value:i.current,children:r})}let n=t=>{let n=(0,V.useContext)(e);if(!n)throw Error(`Missing Provider from createIsolation`);return zc(Zc({store:n},t))};return{Provider:t,useStore:n,useAtom:(e,t)=>{let r=n();return qc(e,Zc({store:r},t))},useAtomValue:(e,t)=>{let r=n();return Gc(e,Zc({store:r},t))},useSetAtom:(e,t)=>{let r=n();return Kc(e,Zc({store:r},t))}}}var{read:$c,write:el}=pc(null);(0,V.createContext)({scope:void 0,baseStore:void 0});function tl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function nl(...e){return t=>{let n=!1,r=e.map(e=>{let r=tl(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():tl(e[t],null)}}}}function rl(...e){return V.useCallback(nl(...e),e)}function il(e){let t=al(e),n=V.forwardRef((e,n)=>{let{children:r,...i}=e,a=V.Children.toArray(r),o=a.find(sl);if(o){let e=o.props.children,r=a.map(t=>t===o?V.Children.count(e)>1?V.Children.only(null):V.isValidElement(e)?e.props.children:null:t);return(0,H.jsx)(t,{...i,ref:n,children:V.isValidElement(e)?V.cloneElement(e,void 0,r):null})}return(0,H.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function al(e){let t=V.forwardRef((e,t)=>{let{children:n,...r}=e;if(V.isValidElement(n)){let e=ll(n),i=cl(r,n.props);return n.type!==V.Fragment&&(i.ref=t?nl(t,e):e),V.cloneElement(n,i)}return V.Children.count(n)>1?V.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ol=Symbol(`radix.slottable`);function sl(e){return V.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ol}function cl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ll(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ul=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=il(`Primitive.${t}`),r=V.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function dl(e,t){e&&lc.flushSync(()=>e.dispatchEvent(t))}function fl(e,t=[]){let n=[];function r(t,r){let i=V.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=V.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=V.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>V.createContext(e));return function(n){let r=n?.[e]||t;return V.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,pl(i,...t)]}function pl(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function ml(e){let t=e+`CollectionProvider`,[n,r]=fl(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=V.useRef(null),a=V.useRef(new Map).current;return(0,H.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=il(s),l=V.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,H.jsx)(c,{ref:rl(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=il(u),p=V.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=V.useRef(null),s=rl(t,o),c=a(u,n);return V.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,H.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return V.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}typeof window<`u`&&window.document&&window.document.createElement;function W(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var hl=globalThis?.document?V.useLayoutEffect:()=>{},gl=V.useInsertionEffect||hl;function _l({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=vl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=V.useRef(e!==void 0);V.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,V.useCallback(t=>{if(s){let n=yl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function vl({defaultProp:e,onChange:t}){let[n,r]=V.useState(e),i=V.useRef(n),a=V.useRef(t);return gl(()=>{a.current=t},[t]),V.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function yl(e){return typeof e==`function`}function bl(e,t){return V.useReducer((e,n)=>t[e][n]??e,e)}var xl=e=>{let{present:t,children:n}=e,r=Sl(t),i=typeof n==`function`?n({present:r.isPresent}):V.Children.only(n),a=rl(r.ref,wl(i));return typeof n==`function`||r.isPresent?V.cloneElement(i,{ref:a}):null};xl.displayName=`Presence`;function Sl(e){let[t,n]=V.useState(),r=V.useRef(null),i=V.useRef(e),a=V.useRef(`none`),[o,s]=bl(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return V.useEffect(()=>{let e=Cl(r.current);a.current=o===`mounted`?e:`none`},[o]),hl(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Cl(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),hl(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Cl(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Cl(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:V.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Cl(e){return e?.animationName||`none`}function wl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Tl=V.useId||(()=>void 0),El=0;function Dl(e){let[t,n]=V.useState(Tl());return hl(()=>{e||n(e=>e??String(El++))},[e]),e||(t?`radix-${t}`:``)}var Ol=V.createContext(void 0);function kl(e){let t=V.useContext(Ol);return e||t||`ltr`}function Al(e){let t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...e)=>t.current?.(...e),[])}function jl(e,t=globalThis?.document){let n=Al(e);V.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Ml=`DismissableLayer`,Nl=`dismissableLayer.update`,Pl=`dismissableLayer.pointerDownOutside`,Fl=`dismissableLayer.focusOutside`,Il,Ll=V.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Rl=V.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=V.useContext(Ll),[u,d]=V.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=V.useState({}),m=rl(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Vl(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Hl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return jl(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),V.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Il=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Ul(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Il)}},[u,f,n,l]),V.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Ul())},[u,l]),V.useEffect(()=>{let e=()=>p({});return document.addEventListener(Nl,e),()=>document.removeEventListener(Nl,e)},[]),(0,H.jsx)(ul.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:W(e.onFocusCapture,S.onFocusCapture),onBlurCapture:W(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:W(e.onPointerDownCapture,x.onPointerDownCapture)})});Rl.displayName=Ml;var zl=`DismissableLayerBranch`,Bl=V.forwardRef((e,t)=>{let n=V.useContext(Ll),r=V.useRef(null),i=rl(t,r);return V.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,H.jsx)(ul.div,{...e,ref:i})});Bl.displayName=zl;function Vl(e,t=globalThis?.document){let n=Al(e),r=V.useRef(!1),i=V.useRef(()=>{});return V.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Wl(Pl,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Hl(e,t=globalThis?.document){let n=Al(e),r=V.useRef(!1);return V.useEffect(()=>{let e=e=>{e.target&&!r.current&&Wl(Fl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ul(){let e=new CustomEvent(Nl);document.dispatchEvent(e)}function Wl(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?dl(i,a):i.dispatchEvent(a)}var Gl=`focusScope.autoFocusOnMount`,Kl=`focusScope.autoFocusOnUnmount`,ql={bubbles:!1,cancelable:!0},Jl=`FocusScope`,Yl=V.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=V.useState(null),l=Al(i),u=Al(a),d=V.useRef(null),f=rl(t,e=>c(e)),p=V.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;V.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:nu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||nu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&nu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),V.useEffect(()=>{if(s){ru.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Gl,ql);s.addEventListener(Gl,l),s.dispatchEvent(t),t.defaultPrevented||(Xl(ou(Ql(s)),{select:!0}),document.activeElement===e&&nu(s))}return()=>{s.removeEventListener(Gl,l),setTimeout(()=>{let t=new CustomEvent(Kl,ql);s.addEventListener(Kl,u),s.dispatchEvent(t),t.defaultPrevented||nu(e??document.body,{select:!0}),s.removeEventListener(Kl,u),ru.remove(p)},0)}}},[s,l,u,p]);let m=V.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Zl(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&nu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&nu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,H.jsx)(ul.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Yl.displayName=Jl;function Xl(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(nu(r,{select:t}),document.activeElement!==n)return}function Zl(e){let t=Ql(e);return[$l(t,e),$l(t.reverse(),e)]}function Ql(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $l(e,t){for(let n of e)if(!eu(n,{upTo:t}))return n}function eu(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function tu(e){return e instanceof HTMLInputElement&&`select`in e}function nu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tu(e)&&t&&e.select()}}var ru=iu();function iu(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=au(e,t),e.unshift(t)},remove(t){e=au(e,t),e[0]?.resume()}}}function au(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ou(e){return e.filter(e=>e.tagName!==`A`)}var su=`Portal`,cu=V.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=V.useState(!1);hl(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?lc.createPortal((0,H.jsx)(ul.div,{...r,ref:t}),o):null});cu.displayName=su;var lu=0;function uu(){V.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??du()),document.body.insertAdjacentElement(`beforeend`,e[1]??du()),lu++,()=>{lu===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),lu--}},[])}function du(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var fu=function(){return fu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},fu.apply(this,arguments)};function pu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function mu(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var hu=`right-scroll-bar-position`,gu=`width-before-scroll-bar`,_u=`with-scroll-bars-hidden`,vu=`--removed-body-scroll-bar-size`;function yu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function bu(e,t){var n=(0,V.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var xu=typeof window<`u`?V.useLayoutEffect:V.useEffect,Su=new WeakMap;function Cu(e,t){var n=bu(t||null,function(t){return e.forEach(function(e){return yu(e,t)})});return xu(function(){var t=Su.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||yu(e,null)}),i.forEach(function(e){r.has(e)||yu(e,a)})}Su.set(n,e)},[e]),n}function wu(e){return e}function Tu(e,t){t===void 0&&(t=wu);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Eu(e){e===void 0&&(e={});var t=Tu(null);return t.options=fu({async:!0,ssr:!1},e),t}var Du=function(e){var t=e.sideCar,n=pu(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return V.createElement(r,fu({},n))};Du.isSideCarExport=!0;function Ou(e,t){return e.useMedium(t),Du}var ku=Eu(),Au=function(){},ju=V.forwardRef(function(e,t){var n=V.useRef(null),r=V.useState({onScrollCapture:Au,onWheelCapture:Au,onTouchMoveCapture:Au}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=pu(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Cu([n,t]),C=fu(fu({},b),i);return V.createElement(V.Fragment,null,u&&V.createElement(x,{sideCar:ku,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?V.cloneElement(V.Children.only(s),fu(fu({},C),{ref:S})):V.createElement(v,fu({},C,{className:c,ref:S}),s))});ju.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ju.classNames={fullWidth:gu,zeroRight:hu};var Mu,Nu=function(){if(Mu)return Mu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Pu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Nu();return t&&e.setAttribute(`nonce`,t),e}function Fu(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Iu(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Lu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Pu())&&(Fu(t,n),Iu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ru=function(){var e=Lu();return function(t,n){V.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},zu=function(){var e=Ru();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Bu={left:0,top:0,right:0,gap:0},Vu=function(e){return parseInt(e||``,10)||0},Hu=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Vu(n),Vu(r),Vu(i)]},Uu=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Bu;var t=Hu(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Wu=zu(),Gu=`data-scroll-locked`,Ku=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
3
- .${_u} {
4
- overflow: hidden ${r};
5
- padding-right: ${s}px ${r};
6
- }
7
- body[${Gu}] {
8
- overflow: hidden ${r};
9
- overscroll-behavior: contain;
10
- ${[t&&`position: relative ${r};`,n===`margin`&&`
11
- padding-left: ${i}px;
12
- padding-top: ${a}px;
13
- padding-right: ${o}px;
14
- margin-left:0;
15
- margin-top:0;
16
- margin-right: ${s}px ${r};
17
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
18
- }
19
-
20
- .${hu} {
21
- right: ${s}px ${r};
22
- }
23
-
24
- .${gu} {
25
- margin-right: ${s}px ${r};
26
- }
27
-
28
- .${hu} .${hu} {
29
- right: 0 ${r};
30
- }
31
-
32
- .${gu} .${gu} {
33
- margin-right: 0 ${r};
34
- }
35
-
36
- body[${Gu}] {
37
- ${vu}: ${s}px;
38
- }
39
- `},qu=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Ju=function(){V.useEffect(function(){return document.body.setAttribute(Gu,(qu()+1).toString()),function(){var e=qu()-1;e<=0?document.body.removeAttribute(Gu):document.body.setAttribute(Gu,e.toString())}},[])},Yu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Ju();var a=V.useMemo(function(){return Uu(i)},[i]);return V.createElement(Wu,{styles:Ku(a,!t,i,n?``:`!important`)})},Xu=!1;if(typeof window<`u`)try{var Zu=Object.defineProperty({},`passive`,{get:function(){return Xu=!0,!0}});window.addEventListener(`test`,Zu,Zu),window.removeEventListener(`test`,Zu,Zu)}catch{Xu=!1}var Qu=Xu?{passive:!1}:!1,$u=function(e){return e.tagName===`TEXTAREA`},ed=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!$u(e)&&n[t]===`visible`)},td=function(e){return ed(e,`overflowY`)},nd=function(e){return ed(e,`overflowX`)},rd=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),od(e,r)){var i=sd(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},id=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},ad=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},od=function(e,t){return e===`v`?td(t):nd(t)},sd=function(e,t){return e===`v`?id(t):ad(t)},cd=function(e,t){return e===`h`&&t===`rtl`?-1:1},ld=function(e,t,n,r,i){var a=cd(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=sd(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&od(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},ud=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},dd=function(e){return[e.deltaX,e.deltaY]},fd=function(e){return e&&`current`in e?e.current:e},pd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},md=function(e){return`
40
- .block-interactivity-${e} {pointer-events: none;}
41
- .allow-interactivity-${e} {pointer-events: all;}
42
- `},hd=0,gd=[];function _d(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(hd++)[0],a=V.useState(zu)[0],o=V.useRef(e);V.useEffect(function(){o.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=mu([e.lockRef.current],(e.shards||[]).map(fd),!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=V.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=ud(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=rd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=rd(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 ld(h,t,e,h===`h`?s:c,!0)},[]),c=V.useCallback(function(e){var n=e;if(!(!gd.length||gd[gd.length-1]!==a)){var r=`deltaY`in n?dd(n):ud(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&pd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(fd).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=V.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:vd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=V.useCallback(function(e){n.current=ud(e),r.current=void 0},[]),d=V.useCallback(function(t){l(t.type,dd(t),t.target,s(t,e.lockRef.current))},[]),f=V.useCallback(function(t){l(t.type,ud(t),t.target,s(t,e.lockRef.current))},[]);V.useEffect(function(){return gd.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Qu),document.addEventListener(`touchmove`,c,Qu),document.addEventListener(`touchstart`,u,Qu),function(){gd=gd.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Qu),document.removeEventListener(`touchmove`,c,Qu),document.removeEventListener(`touchstart`,u,Qu)}},[]);var p=e.removeScrollBar,m=e.inert;return V.createElement(V.Fragment,null,m?V.createElement(a,{styles:md(i)}):null,p?V.createElement(Yu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function vd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var yd=Ou(ku,_d),bd=V.forwardRef(function(e,t){return V.createElement(ju,fu({},e,{ref:t,sideCar:yd}))});bd.classNames=ju.classNames;var xd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Sd=new WeakMap,Cd=new WeakMap,wd={},Td=0,Ed=function(e){return e&&(e.host||Ed(e.parentNode))},Dd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ed(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})},Od=function(e,t,n,r){var i=Dd(t,Array.isArray(e)?e:[e]);wd[n]||(wd[n]=new WeakMap);var a=wd[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=(Sd.get(e)||0)+1,l=(a.get(e)||0)+1;Sd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Cd.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(),Td++,function(){o.forEach(function(e){var t=Sd.get(e)-1,i=a.get(e)-1;Sd.set(e,t),a.set(e,i),t||(Cd.has(e)||e.removeAttribute(r),Cd.delete(e)),i||e.removeAttribute(n)}),Td--,Td||(Sd=new WeakMap,Sd=new WeakMap,Cd=new WeakMap,wd={})}},kd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||xd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Od(r,i,n,`aria-hidden`)):function(){return null}},Ad=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})),jd=t(((e,t)=>{t.exports=Ad()}));function Md(e){let[t,n]=V.useState(void 0);return hl(()=>{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 Nd=[`top`,`right`,`bottom`,`left`],Pd=Math.min,Fd=Math.max,Id=Math.round,Ld=Math.floor,Rd=e=>({x:e,y:e}),zd={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Bd(e,t,n){return Fd(e,Pd(t,n))}function Vd(e,t){return typeof e==`function`?e(t):e}function Hd(e){return e.split(`-`)[0]}function Ud(e){return e.split(`-`)[1]}function Wd(e){return e===`x`?`y`:`x`}function Gd(e){return e===`y`?`height`:`width`}function Kd(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function qd(e){return Wd(Kd(e))}function Jd(e,t,n){n===void 0&&(n=!1);let r=Ud(e),i=qd(e),a=Gd(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=rf(o)),[o,rf(o)]}function Yd(e){let t=rf(e);return[Xd(e),t,Xd(t)]}function Xd(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Zd=[`left`,`right`],Qd=[`right`,`left`],$d=[`top`,`bottom`],ef=[`bottom`,`top`];function tf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Qd:Zd:t?Zd:Qd;case`left`:case`right`:return t?$d:ef;default:return[]}}function nf(e,t,n,r){let i=Ud(e),a=tf(Hd(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Xd)))),a}function rf(e){let t=Hd(e);return zd[t]+e.slice(t.length)}function af(e){return{top:0,right:0,bottom:0,left:0,...e}}function of(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:af(e)}function sf(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 cf(e,t,n){let{reference:r,floating:i}=e,a=Kd(t),o=qd(t),s=Gd(o),c=Hd(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(Ud(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 lf(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}=Vd(t,e),p=of(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=sf(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=sf(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 uf=50,df=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:lf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=cf(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<uf&&(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}=cf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ff=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}=Vd(e,t)||{};if(l==null)return{};let d=of(u),f={x:n,y:r},p=qd(i),m=Gd(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=Pd(d[_],T),D=Pd(d[v],T),O=E,k=C-h[m]-D,ee=C/2-h[m]/2+w,te=Bd(O,ee,k),ne=!c.arrow&&Ud(i)!=null&&ee!==te&&a.reference[m]/2-(ee<O?E:D)-h[m]/2<0,re=ne?ee<O?ee-O:ee-k:0;return{[p]:f[p]+re,data:{[p]:te,centerOffset:ee-te-re,...ne&&{alignmentOffset:re}},reset:ne}}}),pf=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}=Vd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Hd(r),_=Kd(o),v=Hd(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[rf(o)]:Yd(o)),x=p!==`none`;!d&&x&&b.push(...nf(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=Jd(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`&&_!==Kd(t))||T.every(e=>Kd(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=Kd(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 mf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hf(e){return Nd.some(t=>e[t]>=0)}var gf=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Vd(e,t);switch(i){case`referenceHidden`:{let e=mf(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:hf(e)}}}case`escaped`:{let e=mf(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:hf(e)}}}default:return{}}}}},_f=new Set([`left`,`top`]);async function vf(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Hd(n),s=Ud(n),c=Kd(n)===`y`,l=_f.has(o)?-1:1,u=a&&c?-1:1,d=Vd(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 yf=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 vf(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}}}}},bf=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}=Vd(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Kd(Hd(i)),p=Wd(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=Bd(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=Bd(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}}}}}},xf=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}=Vd(e,t),u={x:n,y:r},d=Kd(i),f=Wd(d),p=u[f],m=u[d],h=Vd(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=_f.has(Hd(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}}}},Sf=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}=Vd(e,t),u=await o.detectOverflow(t,l),d=Hd(i),f=Ud(i),p=Kd(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=Pd(h-u[g],v),x=Pd(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=Fd(u.left,0),t=Fd(u.right,0),n=Fd(u.top,0),r=Fd(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Fd(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Fd(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 Cf(){return typeof window<`u`}function wf(e){return Df(e)?(e.nodeName||``).toLowerCase():`#document`}function Tf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ef(e){return((Df(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Df(e){return Cf()?e instanceof Node||e instanceof Tf(e).Node:!1}function Of(e){return Cf()?e instanceof Element||e instanceof Tf(e).Element:!1}function kf(e){return Cf()?e instanceof HTMLElement||e instanceof Tf(e).HTMLElement:!1}function Af(e){return!Cf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Tf(e).ShadowRoot}function jf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Hf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Mf(e){return/^(table|td|th)$/.test(wf(e))}function Nf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Pf=/transform|translate|scale|rotate|perspective|filter/,Ff=/paint|layout|strict|content/,If=e=>!!e&&e!==`none`,Lf;function Rf(e){let t=Of(e)?Hf(e):e;return If(t.transform)||If(t.translate)||If(t.scale)||If(t.rotate)||If(t.perspective)||!Bf()&&(If(t.backdropFilter)||If(t.filter))||Pf.test(t.willChange||``)||Ff.test(t.contain||``)}function zf(e){let t=Wf(e);for(;kf(t)&&!Vf(t);){if(Rf(t))return t;if(Nf(t))return null;t=Wf(t)}return null}function Bf(){return Lf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Lf}function Vf(e){return/^(html|body|#document)$/.test(wf(e))}function Hf(e){return Tf(e).getComputedStyle(e)}function Uf(e){return Of(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wf(e){if(wf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Af(e)&&e.host||Ef(e);return Af(t)?t.host:t}function Gf(e){let t=Wf(e);return Vf(t)?e.ownerDocument?e.ownerDocument.body:e.body:kf(t)&&jf(t)?t:Gf(t)}function Kf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Gf(e),i=r===e.ownerDocument?.body,a=Tf(r);if(i){let e=qf(a);return t.concat(a,a.visualViewport||[],jf(r)?r:[],e&&n?Kf(e):[])}else return t.concat(r,Kf(r,[],n))}function qf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jf(e){let t=Hf(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=kf(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Id(n)!==a||Id(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Yf(e){return Of(e)?e:e.contextElement}function Xf(e){let t=Yf(e);if(!kf(t))return Rd(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Jf(t),o=(a?Id(n.width):n.width)/r,s=(a?Id(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Zf=Rd(0);function Qf(e){let t=Tf(e);return!Bf()||!t.visualViewport?Zf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $f(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tf(e)?!1:t}function ep(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Yf(e),o=Rd(1);t&&(r?Of(r)&&(o=Xf(r)):o=Xf(e));let s=$f(a,n,r)?Qf(a):Rd(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=Tf(a),t=r&&Of(r)?Tf(r):r,n=e,i=qf(n);for(;i&&r&&t!==n;){let e=Xf(i),t=i.getBoundingClientRect(),r=Hf(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=Tf(i),i=qf(n)}}return sf({width:u,height:d,x:c,y:l})}function tp(e,t){let n=Uf(e).scrollLeft;return t?t.left+n:ep(Ef(e)).left+n}function np(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-tp(e,n),y:n.top+t.scrollTop}}function rp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ef(r),s=t?Nf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Rd(1),u=Rd(0),d=kf(r);if((d||!d&&!a)&&((wf(r)!==`body`||jf(o))&&(c=Uf(r)),d)){let e=ep(r);l=Xf(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?np(o,c):Rd(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 ip(e){return Array.from(e.getClientRects())}function ap(e){let t=Ef(e),n=Uf(e),r=e.ownerDocument.body,i=Fd(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Fd(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+tp(e),s=-n.scrollTop;return Hf(r).direction===`rtl`&&(o+=Fd(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var op=25;function sp(e,t){let n=Tf(e),r=Ef(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Bf();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=tp(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<=op&&(a-=o)}else l<=op&&(a+=l);return{width:a,height:o,x:s,y:c}}function cp(e,t){let n=ep(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=kf(e)?Xf(e):Rd(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function lp(e,t,n){let r;if(t===`viewport`)r=sp(e,n);else if(t===`document`)r=ap(Ef(e));else if(Of(t))r=cp(t,n);else{let n=Qf(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return sf(r)}function up(e,t){let n=Wf(e);return n===t||!Of(n)||Vf(n)?!1:Hf(n).position===`fixed`||up(n,t)}function dp(e,t){let n=t.get(e);if(n)return n;let r=Kf(e,[],!1).filter(e=>Of(e)&&wf(e)!==`body`),i=null,a=Hf(e).position===`fixed`,o=a?Wf(e):e;for(;Of(o)&&!Vf(o);){let t=Hf(o),n=Rf(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||jf(o)&&!n&&up(e,o))?r=r.filter(e=>e!==o):i=t,o=Wf(o)}return t.set(e,r),r}function fp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Nf(t)?[]:dp(t,this._c):[].concat(n),r],o=lp(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=lp(t,a[e],i);s=Fd(n.top,s),c=Pd(n.right,c),l=Pd(n.bottom,l),u=Fd(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function pp(e){let{width:t,height:n}=Jf(e);return{width:t,height:n}}function mp(e,t,n){let r=kf(t),i=Ef(t),a=n===`fixed`,o=ep(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Rd(0);function l(){c.x=tp(i)}if(r||!r&&!a)if((wf(t)!==`body`||jf(i))&&(s=Uf(t)),r){let e=ep(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?np(i,s):Rd(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 hp(e){return Hf(e).position===`static`}function gp(e,t){if(!kf(e)||Hf(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ef(e)===n&&(n=n.ownerDocument.body),n}function _p(e,t){let n=Tf(e);if(Nf(e))return n;if(!kf(e)){let t=Wf(e);for(;t&&!Vf(t);){if(Of(t)&&!hp(t))return t;t=Wf(t)}return n}let r=gp(e,t);for(;r&&Mf(r)&&hp(r);)r=gp(r,t);return r&&Vf(r)&&hp(r)&&!Rf(r)?n:r||zf(e)||n}var vp=async function(e){let t=this.getOffsetParent||_p,n=this.getDimensions,r=await n(e.floating);return{reference:mp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yp(e){return Hf(e).direction===`rtl`}var bp={convertOffsetParentRelativeRectToViewportRelativeRect:rp,getDocumentElement:Ef,getClippingRect:fp,getOffsetParent:_p,getElementRects:vp,getClientRects:ip,getDimensions:pp,getScale:Xf,isElement:Of,isRTL:yp};function xp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Sp(e,t){let n=null,r,i=Ef(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=Ld(d),h=Ld(i.clientWidth-(u+f)),g=Ld(i.clientHeight-(d+p)),_=Ld(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Fd(0,Pd(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&&!xp(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 Cp(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=Yf(e),u=i||a?[...l?Kf(l):[],...t?Kf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Sp(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?ep(e):null;c&&g();function g(){let t=ep(e);h&&!xp(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 wp=yf,Tp=bf,Ep=pf,Dp=Sf,Op=gf,kp=ff,Ap=xf,jp=(e,t,n)=>{let r=new Map,i={platform:bp,...n},a={...i.platform,_c:r};return df(e,t,{...i,platform:a})},Mp=typeof document<`u`?V.useLayoutEffect:function(){};function Np(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(!Np(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)&&!Np(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Pp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fp(e,t){let n=Pp(e);return Math.round(t*n)/n}function Ip(e){let t=V.useRef(e);return Mp(()=>{t.current=e}),t}function Lp(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]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V.useState(r);Np(f,r)||p(r);let[m,h]=V.useState(null),[g,_]=V.useState(null),v=V.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=V.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=V.useRef(null),C=V.useRef(null),w=V.useRef(u),T=c!=null,E=Ip(c),D=Ip(i),O=Ip(l),k=V.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),jp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};ee.current&&!Np(w.current,t)&&(w.current=t,lc.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Mp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ee=V.useRef(!1);Mp(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Mp(()=>{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 te=V.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),ne=V.useMemo(()=>({reference:b,floating:x}),[b,x]),re=V.useMemo(()=>{let e={position:n,left:0,top:0};if(!ne.floating)return e;let t=Fp(ne.floating,u.x),r=Fp(ne.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Pp(ne.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ne.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:k,refs:te,elements:ne,floatingStyles:re}),[u,k,te,ne,re])}var Rp=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?{}:kp({element:r.current,padding:i}).fn(n):r?kp({element:r,padding:i}).fn(n):{}}}},zp=(e,t)=>{let n=wp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bp=(e,t)=>{let n=Tp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vp=(e,t)=>({fn:Ap(e).fn,options:[e,t]}),Hp=(e,t)=>{let n=Ep(e);return{name:n.name,fn:n.fn,options:[e,t]}},Up=(e,t)=>{let n=Dp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wp=(e,t)=>{let n=Op(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gp=(e,t)=>{let n=Rp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kp=`Arrow`,qp=V.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,H.jsx)(ul.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,H.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});qp.displayName=Kp;var Jp=qp,Yp=`Popper`,[Xp,Zp]=fl(Yp),[Qp,$p]=Xp(Yp),em=e=>{let{__scopePopper:t,children:n}=e,[r,i]=V.useState(null);return(0,H.jsx)(Qp,{scope:t,anchor:r,onAnchorChange:i,children:n})};em.displayName=Yp;var tm=`PopperAnchor`,nm=V.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=$p(tm,n),o=V.useRef(null),s=rl(t,o),c=V.useRef(null);return V.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,H.jsx)(ul.div,{...i,ref:s})});nm.displayName=tm;var rm=`PopperContent`,[im,am]=Xp(rm),om=V.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=$p(rm,n),[_,v]=V.useState(null),y=rl(t,e=>v(e)),[b,x]=V.useState(null),S=Md(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(um),altBoundary:O},{refs:ee,floatingStyles:te,placement:ne,isPositioned:re,middlewareData:ie}=Lp({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>Cp(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[zp({mainAxis:i+w,alignmentAxis:o}),c&&Bp({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Vp():void 0,...k}),c&&Hp({...k}),Up({...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&&Gp({element:b,padding:s}),dm({arrowWidth:C,arrowHeight:w}),f&&Wp({strategy:`referenceHidden`,...k})]}),[ae,oe]=fm(ne),se=Al(m);hl(()=>{re&&se?.()},[re,se]);let ce=ie.arrow?.x,le=ie.arrow?.y,ue=ie.arrow?.centerOffset!==0,[de,fe]=V.useState();return hl(()=>{_&&fe(window.getComputedStyle(_).zIndex)},[_]),(0,H.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:re?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(` `),...ie.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,H.jsx)(im,{scope:n,placedSide:ae,onArrowChange:x,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,H.jsx)(ul.div,{"data-side":ae,"data-align":oe,...h,ref:y,style:{...h.style,animation:re?void 0:`none`}})})})});om.displayName=rm;var sm=`PopperArrow`,cm={top:`bottom`,right:`left`,bottom:`top`,left:`right`},lm=V.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=am(sm,n),a=cm[i.placedSide];return(0,H.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,H.jsx)(Jp,{...r,ref:t,style:{...r.style,display:`block`}})})});lm.displayName=sm;function um(e){return e!==null}var dm=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]=fm(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 fm(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var pm=em,mm=nm,hm=om,gm=lm,_m=`rovingFocusGroup.onEntryFocus`,vm={bubbles:!1,cancelable:!0},ym=`RovingFocusGroup`,[bm,xm,Sm]=ml(ym),[Cm,wm]=fl(ym,[Sm]),[Tm,Em]=Cm(ym),Dm=V.forwardRef((e,t)=>(0,H.jsx)(bm.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(bm.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(Om,{...e,ref:t})})}));Dm.displayName=ym;var Om=V.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=V.useRef(null),p=rl(t,f),m=kl(a),[h,g]=_l({prop:o,defaultProp:s??null,onChange:c,caller:ym}),[_,v]=V.useState(!1),y=Al(l),b=xm(n),x=V.useRef(!1),[S,C]=V.useState(0);return V.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(_m,y),()=>e.removeEventListener(_m,y)},[y]),(0,H.jsx)(Tm,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:V.useCallback(e=>g(e),[g]),onItemShiftTab:V.useCallback(()=>v(!0),[]),onFocusableItemAdd:V.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:V.useCallback(()=>C(e=>e-1),[]),children:(0,H.jsx)(ul.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:W(e.onMouseDown,()=>{x.current=!0}),onFocus:W(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(_m,vm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Pm([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:W(e.onBlur,()=>v(!1))})})}),km=`RovingFocusGroupItem`,Am=V.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Dl(),l=a||c,u=Em(km,n),d=u.currentTabStopId===l,f=xm(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return V.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,H.jsx)(bm.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(ul.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:W(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:W(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:W(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Nm(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?Fm(n,r+1):n.slice(r+1)}setTimeout(()=>Pm(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Am.displayName=km;var jm={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Mm(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Nm(e,t,n){let r=Mm(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return jm[r]}function Pm(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Fm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Im=Dm,Lm=Am,Rm=[`Enter`,` `],zm=[`ArrowDown`,`PageUp`,`Home`],Bm=[`ArrowUp`,`PageDown`,`End`],Vm=[...zm,...Bm],Hm={ltr:[...Rm,`ArrowRight`],rtl:[...Rm,`ArrowLeft`]},Um={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Wm=`Menu`,[Gm,Km,qm]=ml(Wm),[Jm,Ym]=fl(Wm,[qm,Zp,wm]),Xm=Zp(),Zm=wm(),[Qm,$m]=Jm(Wm),[eh,th]=Jm(Wm),nh=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Xm(t),[c,l]=V.useState(null),u=V.useRef(!1),d=Al(a),f=kl(i);return V.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,H.jsx)(pm,{...s,children:(0,H.jsx)(Qm,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,H.jsx)(eh,{scope:t,onClose:V.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};nh.displayName=Wm;var rh=`MenuAnchor`,ih=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xm(n);return(0,H.jsx)(mm,{...i,...r,ref:t})});ih.displayName=rh;var ah=`MenuPortal`,[oh,sh]=Jm(ah,{forceMount:void 0}),ch=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=$m(ah,t);return(0,H.jsx)(oh,{scope:t,forceMount:n,children:(0,H.jsx)(xl,{present:n||a.open,children:(0,H.jsx)(cu,{asChild:!0,container:i,children:r})})})};ch.displayName=ah;var lh=`MenuContent`,[uh,dh]=Jm(lh),fh=V.forwardRef((e,t)=>{let n=sh(lh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$m(lh,e.__scopeMenu),o=th(lh,e.__scopeMenu);return(0,H.jsx)(Gm.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(xl,{present:r||a.open,children:(0,H.jsx)(Gm.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(ph,{...i,ref:t}):(0,H.jsx)(mh,{...i,ref:t})})})})}),ph=V.forwardRef((e,t)=>{let n=$m(lh,e.__scopeMenu),r=V.useRef(null),i=rl(t,r);return V.useEffect(()=>{let e=r.current;if(e)return kd(e)},[]),(0,H.jsx)(gh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:W(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mh=V.forwardRef((e,t)=>{let n=$m(lh,e.__scopeMenu);return(0,H.jsx)(gh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hh=il(`MenuContent.ScrollLock`),gh=V.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=$m(lh,n),_=th(lh,n),v=Xm(n),y=Zm(n),b=Km(n),[x,S]=V.useState(null),C=V.useRef(null),w=rl(t,C,g.onContentChange),T=V.useRef(0),E=V.useRef(``),D=V.useRef(0),O=V.useRef(null),k=V.useRef(`right`),ee=V.useRef(0),te=m?bd:V.Fragment,ne=m?{as:hh,allowPinchZoom:!0}:void 0,re=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=eg(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())};V.useEffect(()=>()=>window.clearTimeout(T.current),[]),uu();let ie=V.useCallback(e=>k.current===O.current?.side&&ng(e,O.current?.area),[]);return(0,H.jsx)(uh,{scope:n,searchRef:E,onItemEnter:V.useCallback(e=>{ie(e)&&e.preventDefault()},[ie]),onItemLeave:V.useCallback(e=>{ie(e)||(C.current?.focus(),S(null))},[ie]),onTriggerLeave:V.useCallback(e=>{ie(e)&&e.preventDefault()},[ie]),pointerGraceTimerRef:D,onPointerGraceIntentChange:V.useCallback(e=>{O.current=e},[]),children:(0,H.jsx)(te,{...ne,children:(0,H.jsx)(Yl,{asChild:!0,trapped:i,onMountAutoFocus:W(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(Rl,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,H.jsx)(Im,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:W(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(hm,{role:`menu`,"aria-orientation":`vertical`,"data-state":Yh(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:W(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&&re(e.key));let i=C.current;if(e.target!==i||!Vm.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Bm.includes(e.key)&&a.reverse(),Qh(a)}),onBlur:W(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:W(e.onPointerMove,rg(e=>{let t=e.target,n=ee.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>ee.current?`right`:`left`,ee.current=e.clientX)}))})})})})})})});fh.displayName=lh;var _h=`MenuGroup`,vh=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(ul.div,{role:`group`,...r,ref:t})});vh.displayName=_h;var yh=`MenuLabel`,bh=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(ul.div,{...r,ref:t})});bh.displayName=yh;var xh=`MenuItem`,Sh=`menu.itemSelect`,Ch=V.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=V.useRef(null),o=th(xh,e.__scopeMenu),s=dh(xh,e.__scopeMenu),c=rl(t,a),l=V.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Sh,{bubbles:!0,cancelable:!0});e.addEventListener(Sh,e=>r?.(e),{once:!0}),dl(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,H.jsx)(wh,{...i,ref:c,disabled:n,onClick:W(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:W(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:W(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Rm.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ch.displayName=xh;var wh=V.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=dh(xh,n),s=Zm(n),c=V.useRef(null),l=rl(t,c),[u,d]=V.useState(!1),[f,p]=V.useState(``);return V.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,H.jsx)(Gm.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,H.jsx)(Lm,{asChild:!0,...s,focusable:!r,children:(0,H.jsx)(ul.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:W(e.onPointerMove,rg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:W(e.onPointerLeave,rg(e=>o.onItemLeave(e))),onFocus:W(e.onFocus,()=>d(!0)),onBlur:W(e.onBlur,()=>d(!1))})})})}),Th=`MenuCheckboxItem`,Eh=V.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(Ph,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(Ch,{role:`menuitemcheckbox`,"aria-checked":Xh(n)?`mixed`:n,...i,ref:t,"data-state":Zh(n),onSelect:W(i.onSelect,()=>r?.(Xh(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Eh.displayName=Th;var Dh=`MenuRadioGroup`,[Oh,kh]=Jm(Dh,{value:void 0,onValueChange:()=>{}}),Ah=V.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Al(r);return(0,H.jsx)(Oh,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,H.jsx)(vh,{...i,ref:t})})});Ah.displayName=Dh;var jh=`MenuRadioItem`,Mh=V.forwardRef((e,t)=>{let{value:n,...r}=e,i=kh(jh,e.__scopeMenu),a=n===i.value;return(0,H.jsx)(Ph,{scope:e.__scopeMenu,checked:a,children:(0,H.jsx)(Ch,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Zh(a),onSelect:W(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Mh.displayName=jh;var Nh=`MenuItemIndicator`,[Ph,Fh]=Jm(Nh,{checked:!1}),Ih=V.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Fh(Nh,n);return(0,H.jsx)(xl,{present:r||Xh(a.checked)||a.checked===!0,children:(0,H.jsx)(ul.span,{...i,ref:t,"data-state":Zh(a.checked)})})});Ih.displayName=Nh;var Lh=`MenuSeparator`,Rh=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,H.jsx)(ul.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Rh.displayName=Lh;var zh=`MenuArrow`,Bh=V.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Xm(n);return(0,H.jsx)(gm,{...i,...r,ref:t})});Bh.displayName=zh;var Vh=`MenuSub`,[Hh,Uh]=Jm(Vh),Wh=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=$m(Vh,t),o=Xm(t),[s,c]=V.useState(null),[l,u]=V.useState(null),d=Al(i);return V.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,H.jsx)(pm,{...o,children:(0,H.jsx)(Qm,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,H.jsx)(Hh,{scope:t,contentId:Dl(),triggerId:Dl(),trigger:s,onTriggerChange:c,children:n})})})};Wh.displayName=Vh;var Gh=`MenuSubTrigger`,Kh=V.forwardRef((e,t)=>{let n=$m(Gh,e.__scopeMenu),r=th(Gh,e.__scopeMenu),i=Uh(Gh,e.__scopeMenu),a=dh(Gh,e.__scopeMenu),o=V.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=V.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return V.useEffect(()=>u,[u]),V.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,H.jsx)(ih,{asChild:!0,...l,children:(0,H.jsx)(wh,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Yh(n.open),...e,ref:nl(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:W(e.onPointerMove,rg(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:W(e.onPointerLeave,rg(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:W(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Hm[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Kh.displayName=Gh;var qh=`MenuSubContent`,Jh=V.forwardRef((e,t)=>{let n=sh(lh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$m(lh,e.__scopeMenu),o=th(lh,e.__scopeMenu),s=Uh(qh,e.__scopeMenu),c=V.useRef(null),l=rl(t,c);return(0,H.jsx)(Gm.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(xl,{present:r||a.open,children:(0,H.jsx)(Gm.Slot,{scope:e.__scopeMenu,children:(0,H.jsx)(gh,{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:W(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:W(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:W(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Um[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Jh.displayName=qh;function Yh(e){return e?`open`:`closed`}function Xh(e){return e===`indeterminate`}function Zh(e){return Xh(e)?`indeterminate`:e?`checked`:`unchecked`}function Qh(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $h(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function eg(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=$h(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 tg(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 ng(e,t){return t?tg({x:e.clientX,y:e.clientY},t):!1}function rg(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ig=nh,ag=ih,og=ch,sg=fh,cg=vh,lg=bh,ug=Ch,dg=Eh,fg=Ah,pg=Mh,mg=Ih,hg=Rh,gg=Bh,_g=Wh,vg=Kh,yg=Jh,bg=`DropdownMenu`,[xg,Sg]=fl(bg,[Ym]),Cg=Ym(),[wg,Tg]=xg(bg),Eg=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Cg(t),l=V.useRef(null),[u,d]=_l({prop:i,defaultProp:a??!1,onChange:o,caller:bg});return(0,H.jsx)(wg,{scope:t,triggerId:Dl(),triggerRef:l,contentId:Dl(),open:u,onOpenChange:d,onOpenToggle:V.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,H.jsx)(ig,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Eg.displayName=bg;var Dg=`DropdownMenuTrigger`,Og=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Tg(Dg,n),o=Cg(n);return(0,H.jsx)(ag,{asChild:!0,...o,children:(0,H.jsx)(ul.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:nl(t,a.triggerRef),onPointerDown:W(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:W(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Og.displayName=Dg;var kg=`DropdownMenuPortal`,Ag=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Cg(t);return(0,H.jsx)(og,{...r,...n})};Ag.displayName=kg;var jg=`DropdownMenuContent`,Mg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Tg(jg,n),a=Cg(n),o=V.useRef(!1);return(0,H.jsx)(sg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:W(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:W(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)`}})});Mg.displayName=jg;var Ng=`DropdownMenuGroup`,Pg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(cg,{...i,...r,ref:t})});Pg.displayName=Ng;var Fg=`DropdownMenuLabel`,Ig=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(lg,{...i,...r,ref:t})});Ig.displayName=Fg;var Lg=`DropdownMenuItem`,Rg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(ug,{...i,...r,ref:t})});Rg.displayName=Lg;var zg=`DropdownMenuCheckboxItem`,Bg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(dg,{...i,...r,ref:t})});Bg.displayName=zg;var Vg=`DropdownMenuRadioGroup`,Hg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(fg,{...i,...r,ref:t})});Hg.displayName=Vg;var Ug=`DropdownMenuRadioItem`,Wg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(pg,{...i,...r,ref:t})});Wg.displayName=Ug;var Gg=`DropdownMenuItemIndicator`,Kg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(mg,{...i,...r,ref:t})});Kg.displayName=Gg;var qg=`DropdownMenuSeparator`,Jg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(hg,{...i,...r,ref:t})});Jg.displayName=qg;var Yg=`DropdownMenuArrow`,Xg=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(gg,{...i,...r,ref:t})});Xg.displayName=Yg;var Zg=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Cg(t),[s,c]=_l({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,H.jsx)(_g,{...o,open:s,onOpenChange:c,children:n})},Qg=`DropdownMenuSubTrigger`,$g=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(vg,{...i,...r,ref:t})});$g.displayName=Qg;var e_=`DropdownMenuSubContent`,t_=V.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Cg(n);return(0,H.jsx)(yg,{...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)`}})});t_.displayName=e_;var n_=Eg,r_=Og,i_=Mg,a_=Rg,o_=Zg,s_=$g,c_=t_,l_=`Popover`,[u_,d_]=fl(l_,[Zp]),f_=Zp(),[p_,m_]=u_(l_),h_=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=f_(t),c=V.useRef(null),[l,u]=V.useState(!1),[d,f]=_l({prop:r,defaultProp:i??!1,onChange:a,caller:l_});return(0,H.jsx)(pm,{...s,children:(0,H.jsx)(p_,{scope:t,contentId:Dl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:V.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:V.useCallback(()=>u(!0),[]),onCustomAnchorRemove:V.useCallback(()=>u(!1),[]),modal:o,children:n})})};h_.displayName=l_;var g_=`PopoverAnchor`,__=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=m_(g_,n),a=f_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return V.useEffect(()=>(o(),()=>s()),[o,s]),(0,H.jsx)(mm,{...a,...r,ref:t})});__.displayName=g_;var v_=`PopoverTrigger`,y_=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=m_(v_,n),a=f_(n),o=rl(t,i.triggerRef),s=(0,H.jsx)(ul.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":P_(i.open),...r,ref:o,onClick:W(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,H.jsx)(mm,{asChild:!0,...a,children:s})});y_.displayName=v_;var b_=`PopoverPortal`,[x_,S_]=u_(b_,{forceMount:void 0}),C_=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=m_(b_,t);return(0,H.jsx)(x_,{scope:t,forceMount:n,children:(0,H.jsx)(xl,{present:n||a.open,children:(0,H.jsx)(cu,{asChild:!0,container:i,children:r})})})};C_.displayName=b_;var w_=`PopoverContent`,T_=V.forwardRef((e,t)=>{let n=S_(w_,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=m_(w_,e.__scopePopover);return(0,H.jsx)(xl,{present:r||a.open,children:a.modal?(0,H.jsx)(D_,{...i,ref:t}):(0,H.jsx)(O_,{...i,ref:t})})});T_.displayName=w_;var E_=il(`PopoverContent.RemoveScroll`),D_=V.forwardRef((e,t)=>{let n=m_(w_,e.__scopePopover),r=V.useRef(null),i=rl(t,r),a=V.useRef(!1);return V.useEffect(()=>{let e=r.current;if(e)return kd(e)},[]),(0,H.jsx)(bd,{as:E_,allowPinchZoom:!0,children:(0,H.jsx)(k_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:W(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:W(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:W(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),O_=V.forwardRef((e,t)=>{let n=m_(w_,e.__scopePopover),r=V.useRef(!1),i=V.useRef(!1);return(0,H.jsx)(k_,{...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()}})}),k_=V.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=m_(w_,n),p=f_(n);return uu(),(0,H.jsx)(Yl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Rl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,H.jsx)(hm,{"data-state":P_(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)`}})})})}),A_=`PopoverClose`,j_=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=m_(A_,n);return(0,H.jsx)(ul.button,{type:`button`,...r,ref:t,onClick:W(e.onClick,()=>i.onOpenChange(!1))})});j_.displayName=A_;var M_=`PopoverArrow`,N_=V.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=f_(n);return(0,H.jsx)(gm,{...i,...r,ref:t})});N_.displayName=M_;function P_(e){return e?`open`:`closed`}var F_=h_,I_=y_,L_=C_,R_=T_,z_=N_,B_=`Tabs`,[V_,H_]=fl(B_,[wm]),U_=wm(),[W_,G_]=V_(B_),K_=V.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=kl(s),[d,f]=_l({prop:r,onChange:i,defaultProp:a??``,caller:B_});return(0,H.jsx)(W_,{scope:n,baseId:Dl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,H.jsx)(ul.div,{dir:u,"data-orientation":o,...l,ref:t})})});K_.displayName=B_;var q_=`TabsList`,J_=V.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=G_(q_,n),o=U_(n);return(0,H.jsx)(Im,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,H.jsx)(ul.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});J_.displayName=q_;var Y_=`TabsTrigger`,X_=V.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=G_(Y_,n),s=U_(n),c=$_(o.baseId,r),l=ev(o.baseId,r),u=r===o.value;return(0,H.jsx)(Lm,{asChild:!0,...s,focusable:!i,active:u,children:(0,H.jsx)(ul.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:W(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:W(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:W(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});X_.displayName=Y_;var Z_=`TabsContent`,Q_=V.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=G_(Z_,n),c=$_(s.baseId,r),l=ev(s.baseId,r),u=r===s.value,d=V.useRef(u);return V.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,H.jsx)(xl,{present:i||u,children:({present:n})=>(0,H.jsx)(ul.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})})});Q_.displayName=Z_;function $_(e,t){return`${e}-trigger-${t}`}function ev(e,t){return`${e}-content-${t}`}var tv=K_,nv=J_,rv=X_,iv=Q_,av=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),ov=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},sv=e=>e?ov(e):ov,cv=t((e=>{var t=s(),n=jd();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}})),lv=e(t(((e,t)=>{t.exports=cv()}))(),1),{useDebugValue:uv}=V.default,{useSyncExternalStoreWithSelector:dv}=lv.default,fv=e=>e;function pv(e,t=fv,n){let r=dv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return uv(r),r}var mv=e=>{let t=typeof e==`function`?sv(e):e,n=(e,n)=>pv(t,e,n);return Object.assign(n,t),n},hv=e=>e?mv(e):mv,gv,_v=typeof window<`u`&&((gv=window.document)!=null&&gv.createElement||window.navigator?.product===`ReactNative`)?V.useLayoutEffect:V.useEffect;function vv(){let e=hv(e=>({current:[],version:0,set:e}));return{In:({children:t})=>{let n=e(e=>e.set),r=e(e=>e.version);return _v(()=>{n(e=>({version:e.version+1}))},[]),_v(()=>(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 V.createElement(V.Fragment,null,t)}}}function yv(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function bv(e,t,n){let r=yv(t,n);if(r===0)return yv(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)),yv(e,xv(t,n,i))}function xv(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Sv(e,t){return Cv(e,0,e.length,t)}function Cv(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=bv(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(Cv(e,t,l+1,r,a),Cv(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function wv(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}function Tv(e){return[-e[0],-e[1]]}function Ev(e,t){return[e[0]+t[0],e[1]+t[1]]}function Dv(e,t){return[e[0]-t[0],e[1]-t[1]]}function Ov(e,t){return[e[0]*t,e[1]*t]}function kv(e,t){return[e[0]/t,e[1]/t]}function Av(e){return[e[1],-e[0]]}function jv(e,t){return e[0]*t[0]+e[1]*t[1]}function Mv(e,t){return e[0]===t[0]&&e[1]===t[1]}function Nv(e){return Math.hypot(e[0],e[1])}function Pv(e){return e[0]*e[0]+e[1]*e[1]}function Fv(e,t){return Pv(Dv(e,t))}function Iv(e){return kv(e,Nv(e))}function Lv(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Rv(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 zv(e,t,n){return Ev(e,Ov(Dv(t,e),n))}function Bv(e,t,n){return Ev(e,Ov(t,n))}var{min:Vv,PI:Hv}=Math,Uv=.275,Wv=Hv+1e-4;function Gv(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=Vv(1,t.distance/n);r=Vv(1,e+(Vv(1,1-i)-e)*(i*Uv))}return(e+r)/2},e[0].pressure),x=wv(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=Vv(1,l/n),t=Vv(1,1-e);r=Vv(1,b+(t-b)*(e*Uv))}x=wv(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 ee=(t<e.length-1?e[t+1]:e[t]).vector,te=t<e.length-1?jv(c,ee):1,ne=jv(c,C)<0&&!O,re=te!==null&&te<0;if(ne||re){let e=Ov(Av(C),x);for(let t=0;t<=1;t+=.07692307692307693)E=Rv(Dv(s,e),s,Wv*t),v.push(E),D=Rv(Ev(s,e),s,Wv*-t),y.push(D);w=E,T=D,re&&(O=!0);continue}if(O=!1,t===e.length-1){let e=Ov(Av(c),x);v.push(Dv(s,e)),y.push(Ev(s,e));continue}let ie=Ov(Av(zv(ee,c,te)),x);E=Dv(s,ie),(t<=1||Fv(w,E)>_)&&(v.push(E),w=E),D=Ev(s,ie),(t<=1||Fv(T,D)>_)&&(y.push(D),T=D),b=r,C=c}let k=e[0].point.slice(0,2),ee=e.length>1?e[e.length-1].point.slice(0,2):Ev(e[0].point,[1,1]),te=[],ne=[];if(e.length===1){if(!(h||g)||l){let e=Bv(k,Iv(Av(Dv(k,ee))),-(S||x)),t=[];for(let n=1/13,r=n;r<=1;r+=n)t.push(Rv(e,k,Wv*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=Rv(y[0],k,Wv*t);te.push(e)}else{let e=Dv(v[0],y[0]),t=Ov(e,.5),n=Ov(e,.51);te.push(Dv(k,t),Dv(k,n),Ev(k,n),Ev(k,t))}let t=Av(Tv(e[e.length-1].vector));if(g||h&&e.length===1)ne.push(ee);else if(f){let e=Bv(ee,t,x);for(let t=1/29,n=t;n<1;n+=t)ne.push(Rv(e,ee,Wv*3*n))}else ne.push(Ev(ee,Ov(t,x)),Ev(ee,Ov(t,x*.99)),Dv(ee,Ov(t,x*.99)),Dv(ee,Ov(t,x)))}return v.concat(ne,y.reverse(),te)}function Kv(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(zv(o[0],e,t/4))}o.length===1&&(o=[...o,[...Ev(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):zv(u.point,o[e],a);if(Mv(u.point,t))continue;let n=Lv(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:Iv(Dv(u.point,t)),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function qv(e,t={}){return Gv(Kv(e,t),t)}function Jv(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}Jv({},`LaserPointer`,()=>ly);function Yv([e,t,n],[r,i,a]){return[e+r,t+i,n+a]}function Xv([e,t,n],[r,i,a]){return[e-r,t-i,n-a]}function Zv([e,t,n],r){return[e*r,t*r,n*r]}function Qv([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function $v([e,t,n],r){return[Math.cos(r)*e-Math.sin(r)*t,Math.sin(r)*e+Math.cos(r)*t,n]}function ey(e,t,n){return Yv(e,Zv(Xv(t,e),n))}function ty(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 ny(e){return Math.atan2(Math.sin(e),Math.cos(e))}function ry([e,t]){return Math.sqrt(e**2+t**2)}function iy([e,t],[n,r]){return Math.sqrt((n-e)**2+(r-t)**2)}function ay(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=iy(e[n-1],e[n]);return t+=iy(e[e.length-2],e[e.length-1]),t}var oy=(e,t,n)=>Math.max(t,Math.min(n,e));function sy(e,t,n){let r=iy(t,n);if(r===0)return iy(e,t);let i=oy(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r**2,0,1);return iy([t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]],e)}function cy(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=sy(i,n,r);return o>e?[o,a]:[e,t]},[0,-1]);if(i>=t){let i=e[a];return[...cy([n,...e.slice(1,a),i],t).slice(0,-1),i,...cy([i,...e.slice(a,-1),r],t).slice(1)]}else return[n,r]}var ly=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=ey(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),ay(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=cy(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(Yv(e,Zv($v([1,0,0],t),i)));return a.push(Yv(e,Zv([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=ty(e,[e[0],e[1]-100,e[2]],i);for(let t=c;t<=Math.PI+c;t+=Math.PI/16)s.push(Yv(e,Zv($v([1,0,0],t),a)));for(let e=Math.PI+c;e<=Math.PI*2+c;e+=Math.PI/16)s.push(Yv(i,Zv($v([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=iy(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 _=Qv(Xv(d,f)),v=Qv(Xv(p,f)),y=$v(_,Math.PI/2),b=$v(_,-Math.PI/2),x=$v(v,Math.PI/2),S=$v(v,-Math.PI/2),C=Yv(f,Zv(y,g)),w=Yv(f,Zv(b,g)),T=Yv(f,Zv(x,g)),E=Yv(f,Zv(S,g)),D=Yv(y,S),O=Yv(b,x),k=Yv(f,Zv(ry(D)===0?_:Qv(D),g)),ee=Yv(f,Zv(ry(O)===0?v:Qv(O),g)),te=ny(ty(f,d,p)),ne=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(o);if(Math.abs(te)<ne){let e=Math.abs(ny(Math.PI-te));if(e===0)continue;if(te<0){a.push(w,ee);for(let t=0;t<=e;t+=e/4)i.push(Yv(f,$v(Zv(y,g),t)));for(let t=e;t>=0;t-=e/4)a.push(Yv(f,$v(Zv(y,g),t)));a.push(ee,T)}else{i.push(C,k);for(let t=0;t<=e;t+=e/4)a.push(Yv(f,$v(Zv(y,-g),-t)));for(let t=e;t>=0;t-=e/4)i.push(Yv(f,$v(Zv(y,-g),-t)));i.push(k,E)}}else i.push(k),a.push(ee);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(Yv(e,Zv($v([1,0,0],n),this.options.size)));return t.push(Yv(e,Zv([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=Qv(Xv(d,u)),h=Qv(Xv(f,p)),g=$v(m,-Math.PI/2),_=$v(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(Yv(u,$v(Zv(g,v),-e)));y.unshift(Yv(u,Zv(g,-v)))}else y.push(u);for(let e=0;e<=Math.PI*3;e+=Math.PI/16)x.push(Yv(p,$v(Zv(_,-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`?cy(S,this.options.simplify):S}},uy=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),dy=Qc(),{useAtom:fy,useSetAtom:py,useAtomValue:my,useStore:hy}=dy,gy=dy.Provider,_y=Fc(),vy=a({"./locales/ar-SA.json":()=>n(()=>import(`./ar-SA-NXDWD63E-CTf_wpt3.js`),__vite__mapDeps([0,1,2]),import.meta.url),"./locales/az-AZ.json":()=>n(()=>import(`./az-AZ-MXSORGZV-C_C9i9u3.js`),__vite__mapDeps([3,1,2]),import.meta.url),"./locales/bg-BG.json":()=>n(()=>import(`./bg-BG-O6MV2KSF-YmfvQf63.js`),__vite__mapDeps([4,1,2]),import.meta.url),"./locales/bn-BD.json":()=>n(()=>import(`./bn-BD-T2VJNT7N-BD0ob0JE.js`),__vite__mapDeps([5,1,2]),import.meta.url),"./locales/bn-IN.json":()=>n(()=>import(`./bn-IN-MMW2ORAC-BTEFR4Ed.js`),__vite__mapDeps([6,1,2]),import.meta.url),"./locales/ca-ES.json":()=>n(()=>import(`./ca-ES-MKBCGNOG-aLX_cjA0.js`),__vite__mapDeps([7,1,2]),import.meta.url),"./locales/cs-CZ.json":()=>n(()=>import(`./cs-CZ-V77HGUP7-Du3y53BB.js`),__vite__mapDeps([8,1,2]),import.meta.url),"./locales/da-DK.json":()=>n(()=>import(`./da-DK-I5RFNTM4-CDJtjf5s.js`),__vite__mapDeps([9,1,2]),import.meta.url),"./locales/de-CH.json":()=>n(()=>import(`./de-CH-WLRDEVBV-CLV2tVw6.js`),__vite__mapDeps([10,1,2]),import.meta.url),"./locales/de-DE.json":()=>n(()=>import(`./de-DE-DTI4WUSC-B53J0BQ8.js`),__vite__mapDeps([11,1,2]),import.meta.url),"./locales/el-GR.json":()=>n(()=>import(`./el-GR-ZXDJ2OS4-DFmRQv0o.js`),__vite__mapDeps([12,1,2]),import.meta.url),"./locales/en.json":()=>n(()=>import(`./en-CMP6EMR6-D9x8hVSu.js`),__vite__mapDeps([13,14,1,2]),import.meta.url),"./locales/es-ES.json":()=>n(()=>import(`./es-ES-DYQHAD43-BiGWIrBG.js`),__vite__mapDeps([15,1,2]),import.meta.url),"./locales/eu-ES.json":()=>n(()=>import(`./eu-ES-QDSYU5Y3-BjwS0kZi.js`),__vite__mapDeps([16,1,2]),import.meta.url),"./locales/fa-IR.json":()=>n(()=>import(`./fa-IR-26LZG4PM-BgANg2TD.js`),__vite__mapDeps([17,1,2]),import.meta.url),"./locales/fi-FI.json":()=>n(()=>import(`./fi-FI-6YS4KDE4-CBL5f3oN.js`),__vite__mapDeps([18,1,2]),import.meta.url),"./locales/fr-FR.json":()=>n(()=>import(`./fr-FR-BRLLPTZC-CRibNSLG.js`),__vite__mapDeps([19,1,2]),import.meta.url),"./locales/gl-ES.json":()=>n(()=>import(`./gl-ES-OKUZTLYG-DEDwa_xt.js`),__vite__mapDeps([20,1,2]),import.meta.url),"./locales/he-IL.json":()=>n(()=>import(`./he-IL-26MGYIU7-47wxy70N.js`),__vite__mapDeps([21,1,2]),import.meta.url),"./locales/hi-IN.json":()=>n(()=>import(`./hi-IN-Q4ZOGTP2-bhV7c3dK.js`),__vite__mapDeps([22,1,2]),import.meta.url),"./locales/hu-HU.json":()=>n(()=>import(`./hu-HU-P2OXPSN5-xG-gBMzE.js`),__vite__mapDeps([23,1,2]),import.meta.url),"./locales/id-ID.json":()=>n(()=>import(`./id-ID-2EIKXYN6-MQuYaNHo.js`),__vite__mapDeps([24,1,2]),import.meta.url),"./locales/it-IT.json":()=>n(()=>import(`./it-IT-4CFKVXI2-v2kj-y7j.js`),__vite__mapDeps([25,1,2]),import.meta.url),"./locales/ja-JP.json":()=>n(()=>import(`./ja-JP-MAND2Z4V-BahXSQz-.js`),__vite__mapDeps([26,1,2]),import.meta.url),"./locales/kaa.json":()=>n(()=>import(`./kaa-HQRTCXTJ-BF26ydFa.js`),__vite__mapDeps([27,1,2]),import.meta.url),"./locales/kab-KAB.json":()=>n(()=>import(`./kab-KAB-JKIKKTGH-CEIH0F80.js`),__vite__mapDeps([28,1,2]),import.meta.url),"./locales/kk-KZ.json":()=>n(()=>import(`./kk-KZ-HXQ63ZFC-CxWjc9Sf.js`),__vite__mapDeps([29,1,2]),import.meta.url),"./locales/km-KH.json":()=>n(()=>import(`./km-KH-PKL3LSGX-DJlCteEp.js`),__vite__mapDeps([30,1,2]),import.meta.url),"./locales/ko-KR.json":()=>n(()=>import(`./ko-KR-KXLREZX3-B1gtI_ci.js`),__vite__mapDeps([31,1,2]),import.meta.url),"./locales/ku-TR.json":()=>n(()=>import(`./ku-TR-MJ4IER3X-Bf41y2v2.js`),__vite__mapDeps([32,1,2]),import.meta.url),"./locales/lt-LT.json":()=>n(()=>import(`./lt-LT-H6WFQ6FJ-DA1or-Eo.js`),__vite__mapDeps([33,1,2]),import.meta.url),"./locales/lv-LV.json":()=>n(()=>import(`./lv-LV-GOCK6SJW-qa0BoYMm.js`),__vite__mapDeps([34,1,2]),import.meta.url),"./locales/mr-IN.json":()=>n(()=>import(`./mr-IN-IXVLDMEQ-DXFRgvgb.js`),__vite__mapDeps([35,1,2]),import.meta.url),"./locales/my-MM.json":()=>n(()=>import(`./my-MM-YG6MYTTD-BKDIfalJ.js`),__vite__mapDeps([36,1,2]),import.meta.url),"./locales/nb-NO.json":()=>n(()=>import(`./nb-NO-XGWJISD2-DbwbopH8.js`),__vite__mapDeps([37,1,2]),import.meta.url),"./locales/nl-NL.json":()=>n(()=>import(`./nl-NL-XVDVCPNC-ChSneTSU.js`),__vite__mapDeps([38,1,2]),import.meta.url),"./locales/nn-NO.json":()=>n(()=>import(`./nn-NO-EMX5MJX5-Cf7ZWKWZ.js`),__vite__mapDeps([39,1,2]),import.meta.url),"./locales/oc-FR.json":()=>n(()=>import(`./oc-FR-ROEINTVO-lM7Nl7hD.js`),__vite__mapDeps([40,1,2]),import.meta.url),"./locales/pa-IN.json":()=>n(()=>import(`./pa-IN-ZYN6SUDY-C9WNUTeR.js`),__vite__mapDeps([41,1,2]),import.meta.url),"./locales/percentages.json":()=>n(()=>import(`./percentages-5DKR754L-DuhOjTM2.js`),__vite__mapDeps([42,43,1,2]),import.meta.url),"./locales/pl-PL.json":()=>n(()=>import(`./pl-PL-6VTG7PHC-DqRVepnC.js`),__vite__mapDeps([44,1,2]),import.meta.url),"./locales/pt-BR.json":()=>n(()=>import(`./pt-BR-5YFKRR5G-CopLYEA6.js`),__vite__mapDeps([45,1,2]),import.meta.url),"./locales/pt-PT.json":()=>n(()=>import(`./pt-PT-GEIXXZ67-BjZ_Lphg.js`),__vite__mapDeps([46,1,2]),import.meta.url),"./locales/ro-RO.json":()=>n(()=>import(`./ro-RO-E2P6TFZI-DakDz5Xu.js`),__vite__mapDeps([47,1,2]),import.meta.url),"./locales/ru-RU.json":()=>n(()=>import(`./ru-RU-YBIIY43T-BMvCT-XT.js`),__vite__mapDeps([48,1,2]),import.meta.url),"./locales/si-LK.json":()=>n(()=>import(`./si-LK-673C2CI2-hGdH1S9E.js`),__vite__mapDeps([49,1,2]),import.meta.url),"./locales/sk-SK.json":()=>n(()=>import(`./sk-SK-CKZHQ4AP-DiRA-fj8.js`),__vite__mapDeps([50,1,2]),import.meta.url),"./locales/sl-SI.json":()=>n(()=>import(`./sl-SI-557H2GWM-DN94n_1-.js`),__vite__mapDeps([51,1,2]),import.meta.url),"./locales/sv-SE.json":()=>n(()=>import(`./sv-SE-XOPKKDWS-CkHUNABj.js`),__vite__mapDeps([52,1,2]),import.meta.url),"./locales/ta-IN.json":()=>n(()=>import(`./ta-IN-XBH7DQI3-W-157oVK.js`),__vite__mapDeps([53,1,2]),import.meta.url),"./locales/th-TH.json":()=>n(()=>import(`./th-TH-TOCWH3R4-BsU-Pydr.js`),__vite__mapDeps([54,1,2]),import.meta.url),"./locales/tr-TR.json":()=>n(()=>import(`./tr-TR-GXW6CYY5-CTddyq89.js`),__vite__mapDeps([55,1,2]),import.meta.url),"./locales/uk-UA.json":()=>n(()=>import(`./uk-UA-IJKTNUDG-1LzXkII3.js`),__vite__mapDeps([56,1,2]),import.meta.url),"./locales/uz-UZ.json":()=>n(()=>import(`./uz-UZ-TBZZEA4V-kqm-qcUj.js`),__vite__mapDeps([57,1,2]),import.meta.url),"./locales/vi-VN.json":()=>n(()=>import(`./vi-VN-MULSGNVB-C3H2AUhm.js`),__vite__mapDeps([58,1,2]),import.meta.url),"./locales/zh-CN.json":()=>n(()=>import(`./zh-CN-MVX3E32U-BULPbsyl.js`),__vite__mapDeps([59,1,2]),import.meta.url),"./locales/zh-HK.json":()=>n(()=>import(`./zh-HK-JNU5RLIE-bNGmeSaW.js`),__vite__mapDeps([60,1,2]),import.meta.url),"./locales/zh-TW.json":()=>n(()=>import(`./zh-TW-LENVCA6T-CQDp064P.js`),__vite__mapDeps([61,1,2]),import.meta.url)}),yy=85,by={code:`en`,label:`English`},xy=[by,...[{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=>ac[e.code]>=yy).sort((e,t)=>e.label>t.label?1:-1)],Sy=`__test__`;it()&&xy.unshift({code:Sy,label:`test language`},{code:`${Sy}.rtl`,label:`‪test language (rtl)‬`,rtl:!0});var Cy=by,wy={},Ty=async e=>{if(Cy=e,document.documentElement.dir=Cy.rtl?`rtl`:`ltr`,document.documentElement.lang=Cy.code,e.code.startsWith(Sy))wy={};else try{wy=await vy(`./locales/${Cy.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),wy=ic}_y.set(Oy,e.code)},Ey=()=>Cy,Dy=(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},G=(e,t,n)=>{if(Cy.code.startsWith(Sy))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let i=e.split(`.`),a=Dy(wy,i)||Dy(ic,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},Oy=pc(by.code),ky=()=>({t:G,langCode:my(Oy)}),Ay=e=>`var(--icon-fill-color)`,jy=e=>e===R.LIGHT?`#fff`:`#1e1e1e`,K=(e,t=512)=>{let{width:n=512,height:r=n,mirror:i,style:a,...o}=typeof t==`number`?{width:t}:t;return(0,H.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,H.jsx)(`path`,{fill:`currentColor`,d:e}):e})},q={width:24,height:24,fill:`none`,strokeWidth:2,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},J={width:20,height:20,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},My={width:40,height:20};K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`rect`,{x:3,y:8,width:18,height:4,rx:1}),(0,H.jsx)(`line`,{x1:12,y1:8,x2:12,y2:21}),(0,H.jsx)(`path`,{d:`M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7`}),(0,H.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`})]}),q);var Ny=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,H.jsx)(`path`,{d:`M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,H.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3`,y2:`19`}),(0,H.jsx)(`line`,{x1:`12`,y1:`6`,x2:`12`,y2:`19`}),(0,H.jsx)(`line`,{x1:`21`,y1:`6`,x2:`21`,y2:`19`})]}),q),Py=K((0,H.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,H.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),q),Fy=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1`})]}),q),Iy=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,H.jsx)(`path`,{d:`M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,H.jsx)(`path`,{d:`M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]}),q),Ly=K((0,H.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M9 4v6l-2 4v2h10v-2l-2 -4v-6`}),(0,H.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`21`}),(0,H.jsx)(`line`,{x1:`8`,y1:`4`,x2:`16`,y2:`4`})]}),q),Ry=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M6.5 9.5l3.5 -3`}),(0,H.jsx)(`path`,{d:`M14 5.5l3 1.5`}),(0,H.jsx)(`path`,{d:`M18.5 10l-2.5 7`}),(0,H.jsx)(`path`,{d:`M13.5 17.5l-7 -5`})]}),q),zy=K((0,H.jsxs)(`g`,{children:[(0,H.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,H.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,H.jsx)(`mask`,{id:`UnlockedIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:6,y:1,width:9,height:9,children:(0,H.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,H.jsx)(`g`,{mask:`url(#UnlockedIcon)`,children:(0,H.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`})})]}),J),By=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.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,H.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,H.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`})]}),J),Vy=K((0,H.jsx)(`g`,{fill:`currentColor`,children:(0,H.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}),Hy=K((0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z`,fill:`currentColor`}),(0,H.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`}),Uy=K((0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.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`}),Wy=K((0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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,H.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`});K((0,H.jsx)(`g`,{fill:`currentColor`,children:(0,H.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 Gy=K((0,H.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M13.5 13.5l4.5 4.5`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),Ky=K((0,H.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,children:[(0,H.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,H.jsx)(`path`,{d:`M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M5 17c0 1.42 .316 2.805 1 4`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),qy=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})]}),q),Jy=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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`})]}),q),Yy=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),q),Xy=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,H.jsx)(`line`,{x1:`15`,y1:`16`,x2:`19`,y2:`12`}),(0,H.jsx)(`line`,{x1:`15`,y1:`8`,x2:`19`,y2:`12`})]}),q),Zy=K((0,H.jsx)(`path`,{d:`M4.167 10h11.666`,strokeWidth:`1.5`}),J),Qy=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z`}),(0,H.jsx)(`path`,{d:`M16 7h4`}),(0,H.jsx)(`path`,{d:`M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3`})]}),q),$y=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.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,H.jsx)(`path`,{d:`m11.25 5.417 3.333 3.333`})]}),J),eb=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`20`,x2:`7`,y2:`20`}),(0,H.jsx)(`line`,{x1:`14`,y1:`20`,x2:`21`,y2:`20`}),(0,H.jsx)(`line`,{x1:`6.9`,y1:`15`,x2:`13.8`,y2:`15`}),(0,H.jsx)(`line`,{x1:`10.2`,y1:`6.3`,x2:`16`,y2:`20`}),(0,H.jsx)(`polyline`,{points:`5 20 11 4 13 4 20 20`})]}),q),tb=K((0,H.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,H.jsx)(`path`,{d:`M10 5v14`}),(0,H.jsx)(`path`,{d:`M12 19h-4`}),(0,H.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,H.jsx)(`path`,{d:`M18 12v7`}),(0,H.jsx)(`path`,{d:`M17 19h2`})]}),q),nb=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M12.5 6.667h.01`}),(0,H.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,H.jsx)(`path`,{d:`m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166`}),(0,H.jsx)(`path`,{d:`m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667`})]}),J),rb=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M18 13.3l-6.3 -6.3`})]}),q),ib=K((0,H.jsx)(`path`,{strokeWidth:`1.25`,d:`M10 4.167v11.666M4.167 10h11.666`}),J),ab=K((0,H.jsx)(`path`,{d:`M5 10h10`,strokeWidth:`1.25`}),J),ob=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M21 21l-6 -6`}),(0,H.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,H.jsx)(`path`,{d:`M3 4v4h4`})]}),q),sb=K((0,H.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`}),J),cb=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`polyline`,{points:`12 16 18 10 12 4`}),(0,H.jsx)(`polyline`,{points:`8 4 2 10 8 16`})]}),J),lb=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.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,H.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`})]}),J),ub=K((0,H.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`}),J),db=K((0,H.jsx)(`g`,{stroke:`currentColor`,strokeLinejoin:`round`,children:(0,H.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`})}),{...J,strokeWidth:1.5}),fb=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`6`,x2:`20`,y2:`6`}),(0,H.jsx)(`line`,{x1:`4`,y1:`12`,x2:`20`,y2:`12`}),(0,H.jsx)(`line`,{x1:`4`,y1:`18`,x2:`20`,y2:`18`})]}),q),pb=K((0,H.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`}),J),mb=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,H.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,H.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),q),hb=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,H.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,H.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),q),gb=K((0,H.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`}),J),_b=K((0,H.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`}),J),vb=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.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,H.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`})]}),J),yb=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4 4l11.733 16h4.267l-11.733 -16z`}),(0,H.jsx)(`path`,{d:`M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772`})]}),q),bb=K((0,H.jsx)(`polyline`,{fill:`none`,stroke:`currentColor`,points:`20 6 9 17 4 12`}),{width:24,height:24}),xb=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.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,H.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`})]}),J),Sb=K(`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}),Cb=K(`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}),wb=K((0,H.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`}),J);K(`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}),K(`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 Tb=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z`}),(0,H.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,H.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`})]}),q),Eb=K((0,H.jsx)(`g`,{strokeWidth:1.5,children:(0,H.jsx)(`path`,{d:`M6 18l12 -12`})}),q),Db=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M15 8h.01`}),(0,H.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,H.jsx)(`path`,{d:`M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4`}),(0,H.jsx)(`path`,{d:`M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598`}),(0,H.jsx)(`path`,{d:`M19 16v6`}),(0,H.jsx)(`path`,{d:`M22 19l-3 3l-3 -3`})]}),q),Ob=K(`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});K(`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}),K(`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 kb=K(`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`);K(`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 Ab=K((0,H.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`}),J),jb=K((0,H.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`}),J),Mb=K(`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}),Nb=K((0,H.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`}),J);K(`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`),K(`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}),K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M12 14v-11`}),(0,H.jsx)(`path`,{d:`M9 6l3 -3l3 3`})]}),q),K((0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.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}),K((0,H.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 Pb=(0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M12 10l0 10`}),(0,H.jsx)(`path`,{d:`M12 10l4 4`}),(0,H.jsx)(`path`,{d:`M12 10l-4 4`}),(0,H.jsx)(`path`,{d:`M4 4l16 0`})]}),Fb=(0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M12 5l0 14`}),(0,H.jsx)(`path`,{d:`M16 9l-4 -4`}),(0,H.jsx)(`path`,{d:`M8 9l4 -4`})]}),Ib=K(Fb,q),Lb=K(Fb,{...q,style:{transform:`rotate(180deg)`}}),Rb=K(Pb,q),zb=K(Pb,{...q,style:{transform:`rotate(180deg)`}}),Bb=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M3.333 3.333h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Vb=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Hb=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Ub=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M16.667 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Wb=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M16.667 3.333v13.334M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Gb=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M3.333 3.333h13.334M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Kb=K((0,H.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M1.667 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M8.333 10h3.334`,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M15.417 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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`})]}),J),qb=K((0,H.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M10 18.333v-2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M10 11.667V8.333`,strokeLinejoin:`round`}),(0,H.jsx)(`path`,{d:`M10 4.583V1.667`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.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`})]}),J),Jb=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,H.jsx)(`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`}),(0,H.jsx)(`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`}),(0,H.jsx)(`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`})]}),q);K(`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 Yb=K(`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`),Xb=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`path`,{d:`M15 5 5 15M5 5l10 10`})}),(0,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J);K(`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}),K(`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}),K(`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 Zb=V.memo(({theme:e})=>K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Ay(e)}),(0,H.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:Ay(e),strokeWidth:`2`}),(0,H.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Ay(e)}),(0,H.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:Ay(e),strokeWidth:`2`}),(0,H.jsxs)(`g`,{fill:jy(e),stroke:Ay(e),strokeWidth:`6`,children:[(0,H.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`2.5`,y:`149.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`147.5`,y:`2.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),Qb=V.memo(({theme:e})=>K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Ay(e)}),(0,H.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:Ay(e),strokeWidth:`2`}),(0,H.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Ay(e)}),(0,H.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:Ay(e),strokeWidth:`2`}),(0,H.jsxs)(`g`,{fill:jy(e),stroke:Ay(e),strokeWidth:`6`,children:[(0,H.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`78.5`,y:`149.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`147.5`,y:`78.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`105.5`,y:`2.5`,width:`30`,height:`30`}),(0,H.jsx)(`rect`,{x:`2.5`,y:`102.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),$b=K((0,H.jsx)(`g`,{strokeWidth:1.25,children:(0,H.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`})}),J),ex=K((0,H.jsxs)(H.Fragment,{children:[(0,H.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,H.jsx)(`mask`,{id:`FillHachureIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:2,y:2,width:16,height:16,children:(0,H.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,H.jsx)(`g`,{mask:`url(#FillHachureIcon)`,children:(0,H.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`})})]}),J),tx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`g`,{clipPath:`url(#a)`,children:[(0,H.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,H.jsx)(`mask`,{id:`FillCrossHatchIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:-1,y:-1,width:22,height:22,children:(0,H.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,H.jsx)(`g`,{mask:`url(#FillCrossHatchIcon)`,children:(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),nx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`g`,{clipPath:`url(#a)`,children:(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),{...J,fill:`currentColor`}),rx=K((0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`path`,{d:`M4.167 10h11.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),J),ix=K((0,H.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),J),ax=K((0,H.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`3.75`,strokeLinecap:`round`,strokeLinejoin:`round`}),J);V.memo(({theme:e})=>K((0,H.jsx)(`path`,{d:`M6 10H34`,stroke:Ay(e),strokeWidth:2,fill:`none`,strokeLinecap:`round`}),{width:40,height:20}));var ox=K((0,H.jsxs)(`g`,{strokeWidth:`2`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M5 12h2`}),(0,H.jsx)(`path`,{d:`M17 12h2`}),(0,H.jsx)(`path`,{d:`M11 12h2`})]}),q),sx=K((0,H.jsxs)(`g`,{strokeWidth:`2`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4 12v.01`}),(0,H.jsx)(`path`,{d:`M8 12v.01`}),(0,H.jsx)(`path`,{d:`M12 12v.01`}),(0,H.jsx)(`path`,{d:`M16 12v.01`}),(0,H.jsx)(`path`,{d:`M20 12v.01`})]}),q),cx=K((0,H.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`}),J),lx=K((0,H.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`}),J),ux=K((0,H.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`}),J),dx=K((0,H.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,H.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,H.jsx)(`path`,{d:`M13.3333 3.33331V3.34331`}),(0,H.jsx)(`path`,{d:`M16.6667 3.33331V3.34331`}),(0,H.jsx)(`path`,{d:`M16.6667 6.66669V6.67669`}),(0,H.jsx)(`path`,{d:`M16.6667 10V10.01`}),(0,H.jsx)(`path`,{d:`M3.33334 13.3333V13.3433`}),(0,H.jsx)(`path`,{d:`M16.6667 13.3333V13.3433`}),(0,H.jsx)(`path`,{d:`M3.33334 16.6667V16.6767`}),(0,H.jsx)(`path`,{d:`M6.66666 16.6667V16.6767`}),(0,H.jsx)(`path`,{d:`M10 16.6667V16.6767`}),(0,H.jsx)(`path`,{d:`M13.3333 16.6667V16.6767`}),(0,H.jsx)(`path`,{d:`M16.6667 16.6667V16.6767`})]}),J),fx=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4 12v-4a4 4 0 0 1 4 -4h4`}),(0,H.jsx)(`line`,{x1:`16`,y1:`4`,x2:`16`,y2:`4.01`}),(0,H.jsx)(`line`,{x1:`20`,y1:`4`,x2:`20`,y2:`4.01`}),(0,H.jsx)(`line`,{x1:`20`,y1:`8`,x2:`20`,y2:`8.01`}),(0,H.jsx)(`line`,{x1:`20`,y1:`12`,x2:`20`,y2:`12.01`}),(0,H.jsx)(`line`,{x1:`4`,y1:`16`,x2:`4`,y2:`16.01`}),(0,H.jsx)(`line`,{x1:`20`,y1:`16`,x2:`20`,y2:`16.01`}),(0,H.jsx)(`line`,{x1:`4`,y1:`20`,x2:`4`,y2:`20.01`}),(0,H.jsx)(`line`,{x1:`8`,y1:`20`,x2:`8`,y2:`20.01`}),(0,H.jsx)(`line`,{x1:`12`,y1:`20`,x2:`12`,y2:`20.01`}),(0,H.jsx)(`line`,{x1:`16`,y1:`20`,x2:`16`,y2:`20.01`}),(0,H.jsx)(`line`,{x1:`20`,y1:`20`,x2:`20`,y2:`20.01`})]}),q),px=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,opacity:.3,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:[(0,H.jsx)(`path`,{d:`M7,11 H19`}),(0,H.jsx)(`path`,{d:`M25,6 L33,16 M33,6 L25,16`})]}),My)),mx=V.memo(({flip:e=!1})=>K((0,H.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`path`,{d:`M7,11 H33 M23,5 L33,11 L23,17`})}),My)),hx=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{d:`M7,11 H23`,strokeWidth:2,strokeLinecap:`round`}),(0,H.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),My)),gx=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`,children:[(0,H.jsx)(`path`,{d:`M7,11 H23`}),(0,H.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),My)),_x=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,children:[(0,H.jsx)(`path`,{d:`M7,11 H25`,strokeWidth:2,strokeLinecap:`round`}),(0,H.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),My)),vx=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,children:[(0,H.jsx)(`path`,{d:`M7,11 H25`,strokeLinecap:`round`}),(0,H.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),My)),yx=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{d:`M7,11 H21`,strokeWidth:2,strokeLinecap:`round`}),(0,H.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),My)),bx=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,strokeWidth:2,strokeLinecap:`round`,children:[(0,H.jsx)(`path`,{d:`M7,11 H21`}),(0,H.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),My)),xx=V.memo(({flip:e=!1})=>K((0,H.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:(0,H.jsx)(`path`,{d:`M11,11 H31 M31,5 V17`})}),My)),Sx=V.memo(({flip:e=!1})=>K((0,H.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,H.jsx)(`path`,{d:`M35,11 H7 M15,5 V17`})}),My)),Cx=V.memo(({flip:e=!1})=>K((0,H.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,H.jsx)(`path`,{d:`M35,11 H7 M15,11 L7,5 M15,11 L7,17`})}),My)),wx=V.memo(({flip:e=!1})=>K((0,H.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,H.jsx)(`path`,{d:`M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17`})}),My)),Tx=V.memo(({flip:e=!1})=>K((0,H.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,H.jsx)(`path`,{d:`M35,11 H7 M15,5 V17 M7,5 V17`})}),My)),Ex=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,H.jsx)(`path`,{d:`M35,11 H19 M11,11 H7 M7,5 V17`}),(0,H.jsx)(`circle`,{cx:`15`,cy:`11`,r:`4`})]}),My)),Dx=V.memo(({flip:e=!1})=>K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,H.jsx)(`path`,{d:`M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17`}),(0,H.jsx)(`circle`,{cx:`23`,cy:`11`,r:`4`})]}),My)),Ox=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`g`,{clipPath:`url(#a)`,children:(0,H.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,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),kx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`g`,{clipPath:`url(#a)`,children:(0,H.jsx)(`path`,{d:`M5 16.667V3.333L10 15l5-11.667v13.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),Ax=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`g`,{clipPath:`url(#a)`,children:(0,H.jsx)(`path`,{d:`M5.833 3.333v13.334h8.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`a`,children:(0,H.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),J),jx=K((0,H.jsx)(H.Fragment,{children:(0,H.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`})}),J),Mx=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,H.jsx)(`path`,{d:`M10 5v14`}),(0,H.jsx)(`path`,{d:`M12 19h-4`}),(0,H.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,H.jsx)(`path`,{d:`M18 12v7`}),(0,H.jsx)(`path`,{d:`M17 19h2`})]}),q),Nx=K((0,H.jsx)(H.Fragment,{children:(0,H.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M7 12h10`}),(0,H.jsx)(`path`,{d:`M7 5v14`}),(0,H.jsx)(`path`,{d:`M17 5v14`}),(0,H.jsx)(`path`,{d:`M15 19h4`}),(0,H.jsx)(`path`,{d:`M15 5h4`}),(0,H.jsx)(`path`,{d:`M5 19h4`}),(0,H.jsx)(`path`,{d:`M5 5h4`})]})}),q),Px=K((0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.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`})})}),J),Fx=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,H.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,H.jsx)(`path`,{d:`M14 4l-4 16`})]}),q),Ix=Fx,Lx=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,H.jsx)(`line`,{x1:`4`,y1:`12`,x2:`12`,y2:`12`}),(0,H.jsx)(`line`,{x1:`4`,y1:`16`,x2:`16`,y2:`16`})]}),q),Rx=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,H.jsx)(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`}),(0,H.jsx)(`line`,{x1:`6`,y1:`16`,x2:`18`,y2:`16`})]}),q),zx=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,H.jsx)(`line`,{x1:`10`,y1:`12`,x2:`20`,y2:`12`}),(0,H.jsx)(`line`,{x1:`8`,y1:`16`,x2:`20`,y2:`16`})]}),q),Bx=V.memo(({theme:e})=>K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`4`}),(0,H.jsx)(`rect`,{x:`9`,y:`8`,width:`6`,height:`12`,rx:`2`})]}),q)),Vx=V.memo(({theme:e})=>K((0,H.jsxs)(`g`,{strokeWidth:`2`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`20`,x2:`20`,y2:`20`}),(0,H.jsx)(`rect`,{x:`9`,y:`4`,width:`6`,height:`12`,rx:`2`})]}),q)),Hx=V.memo(({theme:e})=>K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`line`,{x1:`4`,y1:`12`,x2:`9`,y2:`12`}),(0,H.jsx)(`line`,{x1:`15`,y1:`12`,x2:`20`,y2:`12`}),(0,H.jsx)(`rect`,{x:`9`,y:`6`,width:`6`,height:`12`,rx:`2`})]}),q)),Ux=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M21 19h-18l9 -15`}),(0,H.jsx)(`path`,{d:`M20.615 15.171h.015`}),(0,H.jsx)(`path`,{d:`M19.515 11.771h.015`}),(0,H.jsx)(`path`,{d:`M17.715 8.671h.015`}),(0,H.jsx)(`path`,{d:`M15.415 5.971h.015`})]}),q),Wx=K((0,H.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});K((0,H.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 Gx=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,H.jsx)(`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`}),(0,H.jsx)(`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,H.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`})]}),q),Kx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`}),(0,H.jsx)(`path`,{d:`M7 11l5 5l5 -5`}),(0,H.jsx)(`path`,{d:`M12 4l0 12`})]}),q),qx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.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`})]}),q),Jx=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,H.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,H.jsx)(`path`,{d:`M9.15 14.85l8.85 -10.85`}),(0,H.jsx)(`path`,{d:`M6 4l8.85 10.85`})]}),q),Yx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`}),(0,H.jsx)(`path`,{d:`M12 17l0 .01`}),(0,H.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),q);K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M7 4v16l13 -8z`})]}),q),K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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`})]}),q);var Xx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]}),q),Zx=K((0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M12 9v4`}),(0,H.jsx)(`path`,{d:`M12 17h.01`})]}),q),Qx=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M11 7l6 6`}),(0,H.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`})]}),q),$x=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M12 3l-4 7h8z`}),(0,H.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,H.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`})]}),q),eS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4 7l16 0`}),(0,H.jsx)(`path`,{d:`M4 17l16 0`}),(0,H.jsx)(`path`,{d:`M7 4l0 16`}),(0,H.jsx)(`path`,{d:`M17 4l0 16`})]}),q),tS=K((0,H.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`})),nS=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`}),(0,H.jsx)(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})]}),q),rS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M6 10l-2 1l8 4l8 -4l-2 -1`}),(0,H.jsx)(`path`,{d:`M4 15l8 4l8 -4`}),(0,H.jsx)(`path`,{d:`M12 4v7`}),(0,H.jsx)(`path`,{d:`M15 8l-3 3l-3 -3`})]}),q),iS=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{d:`M4.16602 10H15.8327`}),(0,H.jsx)(`path`,{d:`M12.5 13.3333L15.8333 10`}),(0,H.jsx)(`path`,{d:`M12.5 6.66666L15.8333 9.99999`})]}),J),aS=K((0,H.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`rotate(90 10 10)`,children:[(0,H.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,H.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),oS=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,H.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,H.jsx)(`path`,{d:`M15 6l3 3`}),(0,H.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,H.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`})]}),q);K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,H.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,H.jsx)(`path`,{d:`M15 6l3 3`}),(0,H.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,H.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`})]}),q),K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35`}),(0,H.jsx)(`path`,{d:`M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946`}),(0,H.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,H.jsx)(`path`,{d:`M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45`}),(0,H.jsx)(`path`,{d:`M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946`}),(0,H.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`})]}),q);var sS=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`}),(0,H.jsx)(`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`}),(0,H.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`}),(0,H.jsx)(`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`})]}),q),cS=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0`}),(0,H.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`})]}),q),lS=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M10.585 10.587a2 2 0 0 0 2.829 2.828`}),(0,H.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,H.jsx)(`path`,{d:`M3 3l18 18`})]}),q),uS=K((0,H.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.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,H.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,H.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,H.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,H.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),q),dS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.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,H.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,H.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,H.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,H.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),q),fS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`}),(0,H.jsx)(`path`,{d:`M21 21l-6 -6`})]}),q),pS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M20.984 12.53a9 9 0 1 0 -7.552 8.355`}),(0,H.jsx)(`path`,{d:`M12 7v5l3 3`}),(0,H.jsx)(`path`,{d:`M19 16l-2 3h4l-2 3`})]}),q),mS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M12 8l0 4l2 2`}),(0,H.jsx)(`path`,{d:`M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5`})]}),q),hS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M5 10a7 7 0 0 0 14 0`}),(0,H.jsx)(`path`,{d:`M8 21l8 0`}),(0,H.jsx)(`path`,{d:`M12 17l0 4`})]}),q),gS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M3 3l18 18`}),(0,H.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,H.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,H.jsx)(`path`,{d:`M8 21l8 0`}),(0,H.jsx)(`path`,{d:`M12 17l0 4`})]}),q),_S=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`})]}),q),vS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M12 20v.01`}),(0,H.jsx)(`path`,{d:`M16 20v.01`}),(0,H.jsx)(`path`,{d:`M8 20v.01`}),(0,H.jsx)(`path`,{d:`M4 20v.01`}),(0,H.jsx)(`path`,{d:`M4 16v.01`}),(0,H.jsx)(`path`,{d:`M4 12v.01`}),(0,H.jsx)(`path`,{d:`M4 8v.01`}),(0,H.jsx)(`path`,{d:`M4 4v.01`}),(0,H.jsx)(`path`,{d:`M8 4v.01`}),(0,H.jsx)(`path`,{d:`M12 4v.01`}),(0,H.jsx)(`path`,{d:`M16 4v.01`}),(0,H.jsx)(`path`,{d:`M20 4v.01`}),(0,H.jsx)(`path`,{d:`M20 8v.01`}),(0,H.jsx)(`path`,{d:`M20 12v.01`}),(0,H.jsx)(`path`,{d:`M20 16v.01`}),(0,H.jsx)(`path`,{d:`M20 20v.01`})]}),q),yS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M5 3v18`}),(0,H.jsx)(`path`,{d:`M19 21v-18`}),(0,H.jsx)(`path`,{d:`M5 7h14`}),(0,H.jsx)(`path`,{d:`M5 15h14`}),(0,H.jsx)(`path`,{d:`M8 13v4`}),(0,H.jsx)(`path`,{d:`M11 13v4`}),(0,H.jsx)(`path`,{d:`M16 13v4`}),(0,H.jsx)(`path`,{d:`M14 5v4`}),(0,H.jsx)(`path`,{d:`M11 5v4`}),(0,H.jsx)(`path`,{d:`M8 5v4`}),(0,H.jsx)(`path`,{d:`M3 21h18`})]}),q),bS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M3 12l18 0`}),(0,H.jsx)(`path`,{d:`M7 16l10 0l-10 5l0 -5`}),(0,H.jsx)(`path`,{d:`M7 8l10 0l-10 -5l0 5`})]}),q),xS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M12 3l0 18`}),(0,H.jsx)(`path`,{d:`M16 7l0 10l5 0l-5 -10`}),(0,H.jsx)(`path`,{d:`M8 7l0 10l-5 0l5 -10`})]}),q),SS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2`}),(0,H.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`})]}),q),CS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0`}),(0,H.jsx)(`path`,{d:`M22 22l-3 -3`}),(0,H.jsx)(`path`,{d:`M6 18h-1a2 2 0 0 1 -2 -2v-1`}),(0,H.jsx)(`path`,{d:`M3 11v-1`}),(0,H.jsx)(`path`,{d:`M3 6v-1a2 2 0 0 1 2 -2h1`}),(0,H.jsx)(`path`,{d:`M10 3h1`}),(0,H.jsx)(`path`,{d:`M15 3h1a2 2 0 0 1 2 2v1`})]}),q),wS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,H.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,H.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,H.jsx)(`path`,{d:`M10 15l2 6l2 -6`}),(0,H.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`})]}),q),TS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,H.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,H.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`}),(0,H.jsx)(`path`,{d:`M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6`}),(0,H.jsx)(`path`,{d:`M11 21v-6l3 6v-6`})]}),q),ES=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M4 8l5 0`}),(0,H.jsx)(`path`,{d:`M15 8l4 0`})]}),q),DS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,H.jsx)(`path`,{d:`M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,H.jsx)(`path`,{d:`M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z`}),(0,H.jsx)(`path`,{d:`M16.746 16.726a3 3 0 1 0 .252 -5.555`})]}),q),OS=K((0,H.jsxs)(`g`,{stroke:`currentColor`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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`})]}),{...q,strokeWidth:1.5});K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M21 12h-13l3 -3`}),(0,H.jsx)(`path`,{d:`M11 15l-3 -3`})]}),q);var kS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M10 9l5 3l-5 3z`})]}),q),AS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M3 6h18`}),(0,H.jsx)(`path`,{d:`M3 12h18`}),(0,H.jsx)(`path`,{d:`M3 18h18`}),(0,H.jsx)(`path`,{d:`M6 3v18`}),(0,H.jsx)(`path`,{d:`M12 3v18`}),(0,H.jsx)(`path`,{d:`M18 3v18`})]}),q),jS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.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,H.jsx)(`path`,{d:`M17 5c-6.627 0 -12 5.373 -12 12`})]}),q),MS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M6 18l12 -12`}),(0,H.jsx)(`path`,{d:`M18 10v-4h-4`})]}),q),NS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7`}),(0,H.jsx)(`path`,{d:`M18 4l3 3l-3 3`})]}),q),PS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{d:`M16,12L20,9L16,6`}),(0,H.jsx)(`path`,{d:`M6 20c0 -6.075 4.925 -11 11 -11h3`})]}),q),FS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M6 9l6 6l6 -6`})]}),q),IS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),q),LS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),q),RS=K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M8 5v10a1 1 0 0 0 1 1h10`}),(0,H.jsx)(`path`,{d:`M5 8h10a1 1 0 0 1 1 1v10`})]}),q),zS=K((0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M5 7l0 10`}),(0,H.jsx)(`path`,{d:`M7 5l10 0`}),(0,H.jsx)(`path`,{d:`M7 19l10 0`}),(0,H.jsx)(`path`,{d:`M19 7l0 10`})]}),q);K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M4 12h7a1 1 0 0 1 1 1v7`})]}),q);var BS=K((0,H.jsxs)(`g`,{strokeWidth:1.5,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M4 6l8 0`}),(0,H.jsx)(`path`,{d:`M16 6l4 0`}),(0,H.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M4 12l2 0`}),(0,H.jsx)(`path`,{d:`M10 12l10 0`}),(0,H.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M4 18l11 0`}),(0,H.jsx)(`path`,{d:`M19 18l1 0`})]}),q),VS=K((0,H.jsxs)(`g`,{strokeWidth:1,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4`})]}),q),HS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,H.jsx)(`path`,{d:`M13.5 6.5l4 4`})]}),q);K((0,H.jsxs)(`g`,{strokeWidth:1,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M11 7l-5 5l5 5`}),(0,H.jsx)(`path`,{d:`M17 7l-5 5l5 5`})]}),q);var US=K((0,H.jsxs)(`g`,{strokeWidth:`1.75`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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,H.jsx)(`path`,{d:`M15 4l0 16`})]}),q);K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.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`})]}),q),K((0,H.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M3 4l18 0`}),(0,H.jsx)(`path`,{d:`M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10`}),(0,H.jsx)(`path`,{d:`M12 16l0 4`}),(0,H.jsx)(`path`,{d:`M9 20l6 0`}),(0,H.jsx)(`path`,{d:`M8 12l3 -3l2 2l3 -3`})]}),q);var WS=(0,H.jsx)(`div`,{style:{width:`1rem`,height:`1rem`}}),GS=K((0,H.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`polyline`,{points:`9 6 15 12 9 18`})]}),q),KS=K((0,H.jsxs)(`g`,{strokeWidth:1.25,children:[(0,H.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,H.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M4 6l8 0`}),(0,H.jsx)(`path`,{d:`M16 6l4 0`}),(0,H.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M4 12l2 0`}),(0,H.jsx)(`path`,{d:`M10 12l10 0`}),(0,H.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,H.jsx)(`path`,{d:`M4 18l11 0`}),(0,H.jsx)(`path`,{d:`M19 18l1 0`})]}),q),qS=({size:e=`1em`,circleWidth:t=8,synchronized:n=!1,className:r=``})=>{let i=-(V.useRef(Date.now()).current%1600);return(0,H.jsx)(`div`,{className:`Spinner ${r}`,children:(0,H.jsx)(`svg`,{viewBox:`0 0 100 100`,style:{width:e,height:e,"--spinner-delay":n?`${i}ms`:0},children:(0,H.jsx)(`circle`,{cx:`50`,cy:`50`,r:50-t/2,strokeWidth:t,fill:`none`,strokeMiterlimit:`10`})})})},Y=V.forwardRef(({size:e=`medium`,visible:t=!0,className:n=``,...r},i)=>{let{id:a}=hz(),o=V.useRef(null);V.useImperativeHandle(i,()=>o.current);let s=`ToolIcon_size_${e}`,[c,l]=(0,V.useState)(!1),u=(0,V.useRef)(!0),d=async e=>{let t=`onClick`in r&&r.onClick?.(e);if(x(t))try{l(!0),await t}catch(e){if(e instanceof T)console.warn(e);else throw e}finally{u.current&&l(!1)}};(0,V.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let f=(0,V.useRef)(null);if(r.type===`button`||r.type===`icon`||r.type===`submit`){let e=r.type===`icon`?`button`:r.type;return(0,H.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,H.jsxs)(`div`,{className:`ToolIcon__icon`,"aria-hidden":`true`,"aria-disabled":!!r.disabled,children:[r.icon||r.label,r.keyBindingLabel&&(0,H.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel}),r.isLoading&&(0,H.jsx)(qS,{})]}),r.showAriaLabel&&(0,H.jsxs)(`div`,{className:`ToolIcon__label`,children:[r[`aria-label`],` `,c&&(0,H.jsx)(qS,{})]}),r.children]})}return(0,H.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,H.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,H.jsxs)(`div`,{className:`ToolIcon__icon`,children:[r.icon,r.keyBindingLabel&&(0,H.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel})]})]})});Y.displayName=`ToolButton`;var JS=[],X=e=>(JS=JS.concat(e),e),YS=(e,t,n)=>{let r=new Set(A(e.filter(e=>I(e)),t).map(e=>e.id)),i={},a=n.scene.getNonDeletedElementsMap(),o=new Set;for(let t of r){let n=Jo(e,t);for(let e of n)if(!o.has(e.id)){if(Ra(e)){let t=Xa(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=Ra(e)?Xa(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&&Tr(r)&&n.scene.mutateElement(r,{startBinding:e.id===r.startBinding?.elementId?null:r.startBinding,endBinding:e.id===r.endBinding?.elementId?null:r.endBinding})}),P(e,{isDeleted:!0}))}return e.frameId&&r.has(e.frameId)?(s=!1,Ra(e)||(i[e.id]=!0),P(e,{frameId:null})):Ra(e)&&t.selectedElementIds[e.containerId]?P(e,{isDeleted:!0}):e}),l=t.editingGroupId;if(s&&t.editingGroupId){let e=mr(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=mr(c,r).filter(e=>!e.isDeleted);e.length>1&&(l=r,e.forEach(e=>{i[e.id]=!0}))}}}}return{elements:c,appState:{...t,...jr({selectedElementIds:i,editingGroupId:l},c,t,null)}}},XS=(e,t)=>{if(e.editingGroupId){let n=mr(nc(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},ZS=X({name:`deleteSelectedElements`,label:`labels.delete`,icon:sb,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=B.getElement(n,a);if(!o||i==null)return!1;if(i.length>=o.points.length){let n=e.map(e=>e.id===o.id?P(e,{isDeleted:!0}):e);return{elements:n,appState:{...XS(t,n),selectedLinearElement:null},captureUpdate:F.IMMEDIATELY}}return B.deletePoints(o,r,i),{elements:e,appState:{...t,selectedLinearElement:{...t.selectedLinearElement,selectedPointsIndices:i?.[0]>0?[i[0]-1]:[0]}},captureUpdate:F.IMMEDIATELY}}let{elements:i,appState:a}=YS(e,t,r);return Se(i,i.filter(e=>e.isDeleted)),a=XS(a,i),{elements:i,appState:{...a,activeTool:Vt(t,{type:r.state.preferredSelectionTool.type}),multiElement:null,newElement:null,activeEmbeddable:null,selectedLinearElement:null},captureUpdate:Ge(nc(e),t)?F.IMMEDIATELY:F.EVENTUALLY}},keyTest:(e,t,n)=>(e.key===L.BACKSPACE||e.key===L.DELETE)&&!e[L.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=mz()===`mobile`;return(0,H.jsx)(Y,{type:`button`,icon:sb,title:G(`labels.delete`),"aria-label":G(`labels.delete`),onClick:()=>n(null),disabled:!Ge(nc(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?zn:{}}})}}),Z=e=>e.replace(/\b(Opt(?:ion)?|Alt)\b/i,G(Wi?`keys.option`:`keys.alt`)).replace(/\bShift\b/i,G(`keys.shift`)).replace(/\b(Enter|Return)\b/i,G(`keys.enter`)).replace(/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,G(Wi?`keys.cmd`:`keys.ctrl`)).replace(/\b(Esc(?:ape)?)\b/i,G(`keys.escape`)).replace(/\b(Space(?:bar)?)\b/i,G(`keys.spacebar`)).replace(/\b(Del(?:ete)?)\b/i,G(`keys.delete`)),QS=X({name:`sendBackward`,label:`labels.sendBackward`,keywords:[`move down`,`zindex`,`layer`],icon:Lb,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Qe(e,t,r.scene),appState:t,captureUpdate:F.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[L.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Ye.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,H.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${G(`labels.sendBackward`)} \u2014 ${Z(`CtrlOrCmd+[`)}`,children:Lb})}),$S=X({name:`bringForward`,label:`labels.bringForward`,keywords:[`move up`,`zindex`,`layer`],icon:Ib,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Ni(e,t,r.scene),appState:t,captureUpdate:F.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[L.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Ye.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,H.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${G(`labels.bringForward`)} \u2014 ${Z(`CtrlOrCmd+]`)}`,children:Ib})}),eC=X({name:`sendToBack`,label:`labels.sendToBack`,keywords:[`move down`,`zindex`,`layer`],icon:zb,trackEvent:{category:`element`},perform:(e,t)=>({elements:Co(e,t),appState:t,captureUpdate:F.IMMEDIATELY}),keyTest:e=>Wi?e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.BRACKET_LEFT:e[L.CTRL_OR_CMD]&&e.shiftKey&&e.code===Ye.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,H.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${G(`labels.sendToBack`)} \u2014 ${Z(Wi?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)}`,children:zb})}),tC=X({name:`bringToFront`,label:`labels.bringToFront`,keywords:[`move up`,`zindex`,`layer`],icon:Rb,trackEvent:{category:`element`},perform:(e,t)=>({elements:jo(e,t),appState:t,captureUpdate:F.IMMEDIATELY}),keyTest:e=>Wi?e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.BRACKET_RIGHT:e[L.CTRL_OR_CMD]&&e.shiftKey&&e.code===Ye.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,H.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:t=>e(null),title:`${G(`labels.bringToFront`)} \u2014 ${Z(Wi?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)}`,children:Rb})}),nC=X({name:`selectAll`,label:`labels.selectAll`,icon:vS,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,...jr({editingGroupId:null,selectedElementIds:i},nc(e),t,r),selectedLinearElement:Object.keys(i).length===1&&Bo(e[0])?new B(e[0],ko(e)):null},captureUpdate:F.IMMEDIATELY}},keyTest:e=>e[L.CTRL_OR_CMD]&&e.key===L.A}),rC=X({name:`duplicateSelection`,label:`labels.duplicateSelection`,icon:lb,trackEvent:{category:`element`},perform:(e,t,n,r)=>{if(t.selectedElementsAreBeingDragged)return!1;if(t.selectedLinearElement?.isEditing)try{return{elements:e,appState:B.duplicateSelectedPoints(t,r.scene),captureUpdate:F.IMMEDIATELY}}catch{return!1}let{duplicatedElements:i,elementsWithDuplicates:a}=li({type:`in-place`,elements:e,idsOfElementsToDuplicate:ko(A(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:xr(a,ko(i)),appState:{...t,...ei(i,nc(a),t)},captureUpdate:F.IMMEDIATELY}},keyTest:e=>e[L.CTRL_OR_CMD]&&e.key===L.D,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=mz()===`mobile`;return(0,H.jsx)(Y,{type:`button`,icon:lb,title:`${G(`labels.duplicateSelection`)} \u2014 ${Z(`CtrlOrCmd+D`)}`,"aria-label":G(`labels.duplicateSelection`),onClick:()=>n(null),disabled:!Ge(nc(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?zn:{}}})}}),iC=new Set([`command_palette`,`export`]),aC=(e,t,n,i)=>{try{if(typeof window>`u`||r.VITE_WORKER_ID||r.VITE_APP_ENABLE_TRACKING!==`true`||!iC.has(e)||it())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)}},oC=(0,V.forwardRef)((e,t)=>{let{title:n,className:r,testId:i,active:a,standalone:o,icon:s,onClick:c}=e;return(0,H.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)}),sC=e=>(0,H.jsx)(H.Fragment,{children:e.options.map(t=>e.type===`button`?(0,H.jsx)(oC,{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,H.jsxs)(`label`,{className:U({active:e.value===t.value}),title:t.text,children:[(0,H.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))}),cC=()=>(0,H.jsx)(`div`,{style:{width:1,height:`1rem`,backgroundColor:`var(--default-border-color)`,margin:`0 auto`}}),lC=V.createContext(null),uC=()=>V.useContext(lC),dC=e=>{let[t,n]=(0,V.useState)(null),r=pz(),{theme:i}=uC(),{container:a}=hz();return(0,V.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,V.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 fC(e,t,n){(0,V.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(j.POINTER_DOWN,r),document.addEventListener(j.TOUCH_START,r),()=>{document.removeEventListener(j.POINTER_DOWN,r),document.removeEventListener(j.TOUCH_START,r)}},[e,t,n])}var pC=e=>{let t=(0,V.useRef)(e);return Object.assign(t.current,e),t.current},mC=pc(null),hC=({onCancel:e,onChange:t,onSelect:n,colorPickerType:r})=>{let i=dC({className:`excalidraw-eye-dropper-backdrop`,parentSelector:`.excalidraw-eye-dropper-container`}),a=uC(),o=gz(),s=dz(),c=pC({app:s,onCancel:e,onChange:t,onSelect:n,selectedElements:A(o,a)}),{container:l}=hz();(0,V.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 Jt(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===L.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(j.KEYDOWN,g),i.addEventListener(j.POINTER_DOWN,m),i.addEventListener(j.POINTER_UP,h),window.addEventListener(`pointermove`,d,{passive:!0}),window.addEventListener(j.BLUR,f),()=>{t=!1,i.removeEventListener(j.KEYDOWN,g),i.removeEventListener(j.POINTER_DOWN,m),i.removeEventListener(j.POINTER_UP,h),window.removeEventListener(`pointermove`,d),window.removeEventListener(j.BLUR,f)}},[c,s.canvas,i,r,l,a.offsetLeft,a.offsetTop]);let u=(0,V.useRef)(null);return fC(u,()=>{e()},e=>!!e.target.closest(`.excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop`)),i?(0,lc.createPortal)((0,H.jsx)(`div`,{ref:u,className:`excalidraw-eye-dropper-preview`}),i):null},gC=V.forwardRef(({children:e,padding:t,className:n,style:r},i)=>(0,H.jsx)(`div`,{className:U(`Island`,n),style:{"--padding":t,...r},ref:i,children:e})),_C=V.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=pz(),f=d.formFactor===`phone`&&!d.isLandscape;return(0,H.jsx)(L_,{container:t,children:(0,H.jsxs)(R_,{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&&!An(document.activeElement)&&t.focus(),i()},children:[(0,H.jsx)(gC,{padding:3,style:r,children:n}),(0,H.jsx)(z_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})}),vC=()=>document.querySelector(`.excalidraw-wysiwyg`),yC=()=>{let e=vC();return e?{start:e.selectionStart,end:e.selectionEnd}:null},bC=e=>{setTimeout(()=>{let t=vC();t&&(t.focus(),e&&(t.selectionStart=e.start,t.selectionEnd=e.end))},0)},xC=(e,t,n,r)=>{t&&r&&r();let i=t&&n?yC():null;e(),t&&n&&bC(i)},SC=()=>{let[e,t]=(0,V.useState)(null);return{saveCaretPosition:(0,V.useCallback)(()=>{t(yC())},[]),restoreCaretPosition:(0,V.useCallback)(()=>{setTimeout(()=>{let n=vC();n&&(n.focus(),e&&(n.selectionStart=e.start,n.selectionEnd=e.end,t(null)))},0)},[e]),clearSavedPosition:(0,V.useCallback)(()=>{t(null)},[]),hasSavedPosition:!!e}},CC=(e=100)=>{let t=vC();if(t){let n=t.onblur;t.onblur=null,setTimeout(()=>{t.onblur=n},e)}},wC=({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},TC=[[`q`,`w`,`e`,`r`,`t`],[`a`,`s`,`d`,`f`,`g`],[`z`,`x`,`c`,`v`,`b`]].flat(),EC=({color:e,palette:t})=>!Object.values(t).flat().includes(e),DC=(e,t,n)=>{let r={elementBackground:`backgroundColor`,elementStroke:`strokeColor`},i=e.filter(e=>{if(e.isDeleted)return!1;let i=e[r[t]];return EC({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)},OC=pc(null),kC=({color:e,onChange:t,label:n,colorPickerType:r,placeholder:i})=>{let a=pz(),[o,s]=(0,V.useState)(e),[c,l]=fy(OC);(0,V.useEffect)(()=>{s(e)},[e]);let u=(0,V.useCallback)(e=>{let n=e.toLowerCase(),r=ln(n);r&&t(r),s(n)},[t]),d=(0,V.useRef)(null),f=(0,V.useRef)(null);(0,V.useEffect)(()=>{d.current&&d.current.focus()},[c]);let[p,m]=fy(mC);return(0,V.useEffect)(()=>()=>{m(null)},[m]),(0,H.jsxs)(`div`,{className:`color-picker__input-label`,children:[(0,H.jsx)(`div`,{className:`color-picker__input-hash`,children:`#`}),(0,H.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!==L.TAB&&(e.key===L.ESCAPE&&f.current?.focus(),e.stopPropagation())},placeholder:i}),a.formFactor!==`phone`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{style:{width:`1px`,height:`1.25rem`,backgroundColor:`var(--default-border-color)`}}),(0,H.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:`${G(`labels.eyeDropper`)} \u2014 ${L.I.toLocaleUpperCase()} or ${Z(`Alt`)} `,children:Qx})]})]})},AC=({color:e,keyLabel:t,isShade:n=!1})=>(0,H.jsxs)(`div`,{className:`color-picker__button__hotkey-label`,style:{color:Nr(e)?`#fff`:`#000`},children:[n&&`⇧`,t]}),jC=({colors:e,color:t,onChange:n,label:r})=>{let[i,a]=fy(OC),o=(0,V.useRef)(null);return(0,V.useEffect)(()=>{o.current&&o.current.focus()},[t,i]),(0,H.jsx)(`div`,{className:`color-picker-content--default`,children:e.map((e,i)=>(0,H.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,H.jsx)(`div`,{className:`color-picker__button-outline`}),(0,H.jsx)(AC,{color:e,keyLabel:i+1})]},i))})},MC=({palette:e,color:t,onChange:n,activeShade:r,showHotKey:i=!0})=>{let a=wC({color:t,palette:e}),[o,s]=fy(OC),c=(0,V.useRef)(null);return(0,V.useEffect)(()=>{c.current&&o===`baseColors`&&c.current.focus()},[a?.colorName,o]),(0,H.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=TC[o],d=G(`colors.${e.replace(/\d+/,``)}`,null,``);return(0,H.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,H.jsx)(`div`,{className:`color-picker__button-outline`}),i&&(0,H.jsx)(AC,{color:l,keyLabel:u})]},e)})})},NC=({children:e})=>(0,H.jsx)(`div`,{className:`color-picker__heading`,children:e}),PC=({color:e,onChange:t,palette:n,showHotKey:r})=>{let i=wC({color:e||`transparent`,palette:n}),[a,o]=fy(OC),s=(0,V.useRef)(null);if((0,V.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,H.jsx)(`div`,{className:`color-picker-content--default shades`,children:l.map((n,i)=>(0,H.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,H.jsx)(`div`,{className:`color-picker__button-outline`}),r&&(0,H.jsx)(AC,{color:n,keyLabel:i+1,isShade:!0})]},i))})}return(0,H.jsxs)(`div`,{className:`color-picker-content--default`,style:{position:`relative`},tabIndex:-1,children:[(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,className:`color-picker__button color-picker__button--large color-picker__button--no-focus-visible`}),(0,H.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:G(`colorPicker.noShades`)})]})},FC=(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}}},IC=({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(TC.includes(e.key)){let t=TC.indexOf(e.key),i=r[Object.keys(r)[t]];return n(Array.isArray(i)?i[o]:i),a(`baseColors`),!0}return!1},LC=({event:e,activeColorPickerSection:t,palette:n,color:r,onChange:i,customColors:a,setActiveColorPickerSection:o,updateData:s,activeShade:c,onEyeDropperToggle:l,onEscape:u})=>{if(e[L.CTRL_OR_CMD])return!1;if(e.key===L.ESCAPE)return u(e),!0;if(e.key===L.ALT)return l(!0),!0;if(e.key===L.I)return l(),!0;let d=wC({color:r,palette:n});if(e.key===L.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(Mi.black)),e.preventDefault(),e.stopPropagation(),!0}if(IC({e,colorObj:d,onChange:i,palette:n,customColors:a,setActiveColorPickerSection:o,activeShade:c}))return!0;if(t===`shades`&&d){let{shade:t}=d,r=FC(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=FC(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=FC(e.key,t,a.length);if(n!==void 0){let e=a[n];return i(e),!0}}return!1},RC=V.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`?G(`labels.stroke`):n===`elementBackground`?G(`labels.background`):null:null,[p]=V.useState(()=>n===`canvasBackground`?[]:DC(r,n,i)),[m,h]=fy(OC),g=wC({color:e,palette:i});(0,V.useEffect)(()=>{if(!m){let t=!!e&&EC({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,V.useState)(g?.shade??(n===`elementBackground`?1:4));(0,V.useEffect)(()=>{g?.shade!=null&&v(g.shade);let e=e=>{e.key===L.ALT&&c(!1)};return document.addEventListener(j.KEYUP,e,{capture:!0}),()=>{document.removeEventListener(j.KEYUP,e,{capture:!0})}},[g,c]);let y=V.useRef(null);return(0,V.useImperativeHandle)(d,()=>y.current),(0,V.useEffect)(()=>{y?.current?.focus()},[]),(0,H.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":G(`labels.colorPicker`),children:(0,H.jsxs)(`div`,{ref:y,onKeyDown:n=>{LC({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,H.jsx)(`div`,{className:`color-picker__title`,children:f}),!!p.length&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(NC,{children:G(`colorPicker.mostUsedCustomColors`)}),(0,H.jsx)(jC,{colors:p,color:e,label:G(`colorPicker.mostUsedCustomColors`),onChange:t})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(NC,{children:G(`colorPicker.colors`)}),(0,H.jsx)(MC,{color:e,palette:i,onChange:t,activeShade:_,showHotKey:u})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(NC,{children:G(`colorPicker.shades`)}),(0,H.jsx)(PC,{color:e,onChange:t,palette:i,showHotKey:u})]}),o]})})}),zC=({onChange:e,type:t,activeColor:n,topPicks:r})=>{let i;return t===`elementStroke`&&(i=At),t===`elementBackground`&&(i=Ss),t===`canvasBackground`&&(i=Ri),r&&(i=r),i?(0,H.jsx)(`div`,{className:`color-picker__top-picks`,children:i.map(t=>(0,H.jsx)(`button`,{className:U(`color-picker__button`,{active:t===n,"is-transparent":t===`transparent`||!t,"has-outline":!Nr(t,240)}),style:{"--swatch-color":t},type:`button`,title:t,onClick:()=>e(t),"data-testid":`color-top-pick-${t}`,children:(0,H.jsx)(`div`,{className:`color-picker__button-outline`})},t))}):(console.error(`Invalid type for TopPicks`),null)},BC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=Mi,updateData:o,getOpenPopup:s,appState:c})=>{let{container:l}=hz(),u=mz(),d=u!==`full`,f=u===`mobile`,[,p]=fy(OC),[m,h]=fy(mC),g=(0,H.jsxs)(`div`,{children:[(0,H.jsx)(NC,{children:G(`colorPicker.hexCode`)}),(0,H.jsx)(kC,{color:t||``,label:r,onChange:e=>{n(e)},colorPickerType:e,placeholder:G(`colorPicker.color`)})]}),_=(0,V.useRef)(null),v=()=>{_.current?.focus()};return(0,H.jsx)(_C,{container:l,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!c.editingTextElement,onFocusOutside:e=>{pi(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,H.jsx)(RC,{ref:_,palette:a,color:t,onChange:e=>{let t=c.editingTextElement?yC():null;n(e),c.editingTextElement&&t&&bC(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})},VC=({label:e,color:t,type:n,mode:r=`background`,onToggle:i,editingTextElement:a})=>{let o=mz(),s=o!==`full`,c=o===`mobile`;return(0,H.jsxs)(I_,{type:`button`,className:U(`color-picker__button active-color properties-trigger`,{"is-transparent":!t||t===`transparent`,"has-outline":!t||!Nr(t,240),"compact-sizing":s,"mobile-border":c}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:G(n===`elementStroke`?`labels.showStroke`:`labels.showBackground`),"data-openpopup":n,onClick:e=>{e.preventDefault(),e.stopPropagation(),a&&CC(),i()},children:[(0,H.jsx)(`div`,{className:`color-picker__button-outline`,children:!t&&Eb}),s&&t&&r===`stroke`&&(0,H.jsx)(`div`,{className:`color-picker__button-background`,children:(0,H.jsx)(`span`,{style:{color:t&&Nr(t,240)?`#fff`:`#111`},children:VS})})]})},HC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=Mi,topPicks:o,updateData:s,appState:c})=>{let l=(0,V.useRef)(c.openPopup);(0,V.useEffect)(()=>{l.current=c.openPopup},[c.openPopup]);let u=mz()!==`full`;return(0,H.jsx)(`div`,{children:(0,H.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`color-picker-container`,{"color-picker-container--no-top-picks":u}),children:[!u&&(0,H.jsx)(zC,{activeColor:t,onChange:n,type:e,topPicks:o}),!u&&(0,H.jsx)(cC,{}),(0,H.jsxs)(F_,{open:c.openPopup===e,onOpenChange:t=>{t&&s({openPopup:e})},children:[(0,H.jsx)(VC,{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,H.jsx)(BC,{type:e,color:t,onChange:n,label:r,elements:i,palette:a,updateData:s,getOpenPopup:()=>l.current,appState:c})]})]})})},UC=V.forwardRef(({className:e,placeholder:t,onChange:n},r)=>(0,H.jsxs)(`div`,{className:U(`QuickSearch__wrapper`,e),children:[fS,(0,H.jsx)(`input`,{ref:r,className:`QuickSearch__input`,type:`text`,placeholder:t,onChange:e=>n(e.target.value.trim().toLowerCase())})]})),WC=({className:e,placeholder:t,children:n})=>{let r=!V.Children.count(n);return(0,H.jsx)(`div`,{className:U(`ScrollableList__wrapper`,e),role:`menu`,children:r?(0,H.jsx)(`div`,{className:`empty`,children:t}):n})},GC=({children:e,className:t=``,style:n,title:r})=>(0,H.jsxs)(`div`,{className:`dropdown-menu-group ${t}`,style:n,children:[r&&(0,H.jsx)(`p`,{className:`dropdown-menu-group-title`,children:r}),e]}),KC=GC;GC.displayName=`DropdownMenuGroup`;var qC=V.createContext({}),JC=(e=``,t=!1,n=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?`dropdown-menu-item--selected`:``} ${n?`dropdown-menu-item--hovered`:``}`.trim(),YC=e=>{let t=(0,V.useContext)(qC);return zs(e,e=>{t.onSelect?.(e)})},XC=({children:e,...t})=>(0,H.jsx)(`span`,{...t,style:{textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,...t.style},children:e}),ZC=({textStyle:e,icon:t,shortcut:n,children:r,badge:i})=>{let a=pz();return(0,H.jsxs)(H.Fragment,{children:[t&&(0,H.jsx)(`div`,{className:`dropdown-menu-item__icon`,children:t}),(0,H.jsx)(`div`,{style:e,className:`dropdown-menu-item__text`,children:(0,H.jsx)(XC,{children:r})}),i&&(0,H.jsx)(`div`,{className:`dropdown-menu-item__badge`,children:i}),n&&a.formFactor!==`phone`&&(0,H.jsx)(`div`,{className:`dropdown-menu-item__shortcut`,children:n})]})},QC=({icon:e,badge:t,value:n,children:r,shortcut:i,className:a,selected:o,onSelect:s,...c})=>{let l=YC(s);return(0,H.jsx)(a_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,H.jsx)(`button`,{...c,value:n,className:JC(a,o),title:c.title??c[`aria-label`],children:(0,H.jsx)(ZC,{icon:e,shortcut:i,badge:t,children:r})})})};QC.displayName=`DropdownMenuItem`;var $C={GREEN:`green`,RED:`red`,BLUE:`blue`},ew=({type:e=$C.BLUE,children:t})=>{let{theme:n}=_z(),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 $C.GREEN:Object.assign(r,{backgroundColor:`var(--background-color-badge)`,color:`var(--color-badge)`});break;case $C.RED:Object.assign(r,{backgroundColor:`pink`,color:`darkred`});break;case $C.BLUE:default:Object.assign(r,{background:`var(--color-promo)`,color:`var(--color-surface-lowest)`})}return(0,H.jsx)(`div`,{className:`DropDownMenuItemBadge`,style:r,children:t})};ew.displayName=`DropdownMenuItemBadge`,QC.Badge=ew;var tw=QC,nw=({event:e,inputRef:t,hoveredFont:n,filteredFonts:r,onClose:i,onSelect:a,onHover:o})=>{if(!e[L.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===L.F)return t.current?.focus(),!0;if(e.key===L.ESCAPE)return i(),!0;if(e.key===L.ENTER)return n?.value&&a(n.value),!0;if(e.key===L.ARROW_DOWN)return n?.next?o(n.next.value):r[0]?.value&&o(r[0].value),!0;if(e.key===L.ARROW_UP)return n?.prev?o(n.prev.value):r[r.length-1]?.value&&o(r[r.length-1].value),!0},rw=e=>{switch(e){case oi.Excalifont:case oi.Virgil:return $y;case oi.Nunito:case oi.Helvetica:return Px;case oi[`Lilita One`]:return Nx;case oi[`Comic Shanns`]:case oi.Cascadia:return Ix;default:return Px}},iw=(e,t)=>Object.entries(oi).find(([,t])=>t===e)?.[0]??t[0]?.fontFace?.family??`Unknown`,aw=V.memo(({selectedFontFamily:e,hoveredFontFamily:t,onSelect:n,onHover:r,onLeave:i,onOpen:a,onClose:o})=>{let{container:s}=hz(),c=dz(),{fonts:l}=c,{showDeprecatedFonts:u}=fz(),d=mz(),[f,p]=(0,V.useState)(``),m=(0,V.useRef)(null),h=(0,V.useMemo)(()=>Array.from(fe.registered.entries()).filter(([e,{metadata:t}])=>!t.private&&!t.fallback).map(([e,{metadata:t,fontFaces:n}])=>{let r={value:e,icon:rw(e),text:iw(e,n)};return t.deprecated&&Object.assign(r,{deprecated:t.deprecated,badge:{type:$C.RED,placeholder:G(`fontList.badge.old`)}}),r}).sort((e,t)=>e.text.toLowerCase()>t.text.toLowerCase()?1:-1),[]),g=(0,V.useMemo)(()=>new Set(l.getSceneFamilies()),[e]),_=(0,V.useMemo)(()=>h.filter(e=>g.has(e.value)),[h,g]),v=(0,V.useMemo)(()=>h.filter(e=>!g.has(e.value)&&(u||!e.deprecated)),[h,g,u]),y=(0,V.useMemo)(()=>hi([..._,...v].filter(e=>e.text?.toLowerCase().includes(f))),[_,v,f]),b=(0,V.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,V.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,V.useCallback)(e=>{nw({event:e,inputRef:m,hoveredFont:b,filteredFonts:y,onSelect:x,onHover:r,onClose:o})&&(e.preventDefault(),e.stopPropagation())},[b,y,x,r,o]);(0,V.useEffect)(()=>(a(),()=>{o()}),[]);let C=(0,V.useMemo)(()=>y.filter(e=>g.has(e.value)),[y,g]),w=(0,V.useMemo)(()=>y.filter(e=>!g.has(e.value)),[y,g]),T=({font:t,order:n})=>{let i=(0,V.useRef)(null),a=t.value===b?.value,o=t.value===e;return(0,V.useEffect)(()=>{a&&(n===0?i.current?.scrollIntoView?.({block:`end`}):i.current?.scrollIntoView?.({block:`nearest`}))},[a,n]),(0,H.jsx)(`button`,{ref:i,type:`button`,value:t.value,className:JC(``,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,H.jsx)(ZC,{icon:t.icon,badge:t.badge&&(0,H.jsx)(ew,{type:t.badge.type,children:t.badge.placeholder}),textStyle:{fontFamily:ra({fontFamily:t.value})},children:t.text})})},D=[];return C.length&&D.push((0,H.jsx)(KC,{title:G(`fontList.sceneFonts`),children:C.map((e,t)=>(0,H.jsx)(T,{font:e,order:t},e.value))},`group_1`)),w.length&&D.push((0,H.jsx)(KC,{title:G(`fontList.availableFonts`),children:w.map((e,t)=>(0,H.jsx)(T,{font:e,order:t+C.length},e.value))},`group_2`)),(0,H.jsxs)(_C,{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,H.jsx)(UC,{ref:m,placeholder:G(`quickSearch.placeholder`),onChange:E(p,20)}),(0,H.jsx)(WC,{className:`dropdown-menu fonts manual-hover`,placeholder:G(`fontList.empty`),children:D.length?D:null})]})},(e,t)=>e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),ow=({selectedFontFamily:e,isOpened:t=!1,compactMode:n=!1})=>{let r=vz(),i=n?{...zn,width:`2rem`,height:`2rem`}:{};return(0,H.jsx)(I_,{asChild:!0,children:(0,H.jsx)(`div`,{"data-openpopup":`fontFamily`,className:`properties-trigger`,children:(0,H.jsx)(oC,{standalone:!0,icon:eb,title:G(`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}})})})},sw=[{value:oi.Excalifont,icon:$y,text:G(`labels.handDrawn`),testId:`font-family-hand-drawn`},{value:oi.Nunito,icon:Px,text:G(`labels.normal`),testId:`font-family-normal`},{value:oi[`Comic Shanns`],icon:Ix,text:G(`labels.code`),testId:`font-family-code`}];new Set(sw.map(e=>e.value));var cw=V.memo(({isOpened:e,selectedFontFamily:t,hoveredFontFamily:n,onSelect:r,onHover:i,onLeave:a,onPopupChange:o,compactMode:s=!1})=>{let c=(0,V.useMemo)(()=>sw,[]),l=(0,V.useCallback)(e=>{e&&r(e)},[r]);return(0,H.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`FontPicker__container`,{"FontPicker__container--compact":s}),children:[!s&&(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{type:`button`,options:c,value:t,onClick:l})}),!s&&(0,H.jsx)(cC,{}),(0,H.jsxs)(F_,{open:e,onOpenChange:o,children:[(0,H.jsx)(ow,{selectedFontFamily:t,isOpened:e,compactMode:s}),e&&(0,H.jsx)(aw,{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),lw=({className:e,icon:t,size:n=`1em`})=>(0,H.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}),uw=({label:e,open:t,openTrigger:n,children:r,className:i,showCollapsedIcon:a=!0})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{cursor:`pointer`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},className:i,onClick:n,children:[e,a&&(0,H.jsx)(lw,{icon:t?IS:FS})]}),t&&(0,H.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:r})]}),dw=pc(!1),fw=4,pw=`default`,mw=e=>e.flatMap(e=>e.options),hw=(e,t)=>{for(let n of e){let e=n.options.find(t);if(e)return e}return null},gw=(e,t)=>e.some(e=>e.options.some(t)),_w=e=>e.flatMap(e=>Array.from({length:Math.ceil(e.options.length/fw)},(t,n)=>e.options.slice(n*fw,n*fw+fw)));function vw({visibleSections:e,hiddenSections:t=[],value:n,label:r,onChange:i,onClose:a}){let{container:o}=hz(),[s,c]=fy(dw),l=mw([...e,...t]),u=_w([...e,...s?t:[]]),d=e=>{let t=l.find(t=>t.keyBinding===e.key.toLowerCase());if(!(e.metaKey||e.altKey||e.ctrlKey)&&t)i(t.value),e.preventDefault();else if(e.key===L.TAB){let t=l.findIndex(e=>e.value===n);i(l[e.shiftKey?(l.length+t-1)%l.length:(t+1)%l.length].value)}else if(Mn(e.key)){let t=Ey().rtl,r=l.findIndex(e=>e.value===n);if(r!==-1){let a=l.length,o=r;switch(e.key){case t?L.ARROW_LEFT:L.ARROW_RIGHT:o=(r+1)%a;break;case t?L.ARROW_RIGHT:L.ARROW_LEFT:o=(a+r-1)%a;break;case L.ARROW_DOWN:{let t=u.findIndex(e=>e.some(e=>e.value===n)),a=u[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=u[(t+1)%u.length];i((s[Math.min(o,s.length-1)]??l[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}case L.ARROW_UP:{let t=u.findIndex(e=>e.some(e=>e.value===n)),a=u[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=u[(u.length+t-1)%u.length];i((s[Math.min(o,s.length-1)]??l[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}}i(l[o].value)}e.preventDefault()}else (e.key===L.ESCAPE||e.key===L.ENTER)&&(e.preventDefault(),a());e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()};(0,V.useEffect)(()=>{gw(t,e=>e.value===n)&&c(!0)},[n,t,c]);let f=e=>(0,H.jsx)(`div`,{className:`picker-content`,children:e.map(e=>(0,H.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,H.jsx)(`span`,{className:`picker-keybinding`,children:e.keyBinding})]},e.text))}),p=e=>e.map((e,t)=>e.name===pw?(0,H.jsx)(V.Fragment,{children:f(e.options)},`${e.name}-${t}`):(0,H.jsxs)(`div`,{className:`picker-section`,children:[(0,H.jsx)(`div`,{className:`picker-section-label`,children:e.name}),f(e.options)]},`${e.name}-${t}`));return(0,H.jsx)(R_,{className:`picker`,role:`dialog`,"aria-modal":`true`,"aria-label":r,side:`bottom`,align:`start`,sideOffset:12,alignOffset:12,style:{zIndex:`var(--zIndex-ui-styles-popup)`},onKeyDown:d,collisionBoundary:o??void 0,children:(0,H.jsxs)(`div`,{className:`picker-sections`,children:[p(e),t.length>0&&(0,H.jsx)(uw,{label:G(`labels.more_options`),open:s,openTrigger:()=>{c(e=>!e)},className:`picker-collapsible`,children:(0,H.jsx)(`div`,{className:`picker-sections`,children:p(t)})})]})})}function yw({value:e,label:t,visibleSections:n,hiddenSections:r,onChange:i}){let[a,o]=V.useState(!1),s=(0,V.useMemo)(()=>hw(n,t=>t.value===e)??hw(r??[],t=>t.value===e),[n,r,e]);return(0,H.jsx)(`div`,{children:(0,H.jsxs)(F_,{open:a,onOpenChange:e=>o(e),children:[(0,H.jsx)(I_,{type:`button`,"aria-label":t,onClick:()=>o(!a),className:a?`active`:``,children:s?.icon}),a&&(0,H.jsx)(vw,{visibleSections:n,hiddenSections:r,value:e,label:t,onChange:i,onClose:()=>{o(!1)}})]})})}var bw=({label:e,value:t,onChange:n,min:r=0,max:i=100,step:a=10,minLabel:o=r,hasCommonValue:s=!0,testId:c})=>{let l=V.useRef(null),u=V.useRef(null);return(0,V.useEffect)(()=>{if(l.current&&u.current){let e=l.current,n=u.current,a=e.offsetWidth,o=parseFloat(getComputedStyle(e).getPropertyValue(`--slider-thumb-size`))||16,s=(t-r)/(i-r||1)*100,c=s/100*(a-o)+o/2;n.style.left=`${c}px`,e.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${s}%, var(--button-bg) ${s}%, var(--button-bg) 100%)`}},[i,r,t]),(0,H.jsxs)(`label`,{className:`control-label`,children:[e,(0,H.jsxs)(`div`,{className:`range-wrapper`,children:[(0,H.jsx)(`input`,{style:{"--color-slider-track":s?void 0:`var(--button-bg)`},ref:l,type:`range`,min:r,max:i,step:a,onChange:e=>{n(+e.target.value)},value:t,className:`range-input`,"data-testid":c}),(0,H.jsx)(`div`,{className:`value-bubble`,ref:u,children:t===r?null:t}),(0,H.jsx)(`div`,{className:`zero-label`,children:o})]})]})},xw=.1,Sw=e=>{let t=Zr(e.editorInterface);return{stylesPanelMode:t,isCompact:t!==`full`,isMobile:t===`mobile`}},Cw=(e,t,n,r=!1)=>{let i=ko(A(e,t,{includeBoundTextElement:r}));return e.map(e=>i.get(e.id)||e.id===t.editingTextElement?.id?n(e):e)},ww=function(e,t,n,r,i){let a=t.state.editingTextElement,o=nc(e),s=null;if(a&&(s=n(a)),!s)if(Ge(o,t.state)){let e=t.scene.getSelectedElements(t.state);s=tc(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},Tw=(e,t,n)=>Ra(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}),Ew=(e,t,n,r,i)=>{let a=new Set,o=Cw(e,t,e=>{if(M(e)){let t=r(e);a.add(t);let i=P(e,{fontSize:t});return Gr(i,n.scene.getContainerElement(e),n.scene),i=Tw(e,i,n.scene),i}return e},!0);return A(e,t,{includeBoundTextElement:!0}).forEach(e=>{M(e)&&be(e,n.scene)}),{elements:o,appState:{...t,currentItemFontSize:a.size===1?[...a][0]:i??t.currentItemFontSize},captureUpdate:F.IMMEDIATELY}};X({name:`changeStrokeColor`,label:`labels.stroke`,trackEvent:!1,perform:(e,t,n)=>({...n?.currentItemStrokeColor&&{elements:Cw(e,t,e=>wr(e.type)?P(e,{strokeColor:n.currentItemStrokeColor}):e,!0)},appState:{...t,...n},captureUpdate:n?.currentItemStrokeColor?F.IMMEDIATELY:F.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Sw(r);return(0,H.jsxs)(H.Fragment,{children:[a===`full`&&(0,H.jsx)(`h3`,{"aria-hidden":`true`,children:G(`labels.stroke`)}),(0,H.jsx)(HC,{topPicks:At,palette:Lr,type:`elementStroke`,label:G(`labels.stroke`),color:ww(e,r,e=>e.strokeColor,!0,e=>e?null:t.currentItemStrokeColor),onChange:e=>n({currentItemStrokeColor:e}),elements:e,appState:t,updateData:n})]})}}),X({name:`changeBackgroundColor`,label:`labels.changeBackground`,trackEvent:!1,perform:(e,t,n,r)=>{if(!n?.currentItemBackgroundColor)return{appState:{...t,...n},captureUpdate:F.EVENTUALLY};let i,a=r.scene.getSelectedElements(t);if(!_o(n.currentItemBackgroundColor)&&a.every(e=>ks(e)&&ai(e.points))){let t=ko(a);i=e.map(e=>t.has(e.id)&&ks(e)?P(e,{backgroundColor:n.currentItemBackgroundColor,...Pe(e,!0)}):e)}else i=Cw(e,t,e=>P(e,{backgroundColor:n.currentItemBackgroundColor}));return{elements:i,appState:{...t,...n},captureUpdate:F.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Sw(r);return(0,H.jsxs)(H.Fragment,{children:[a===`full`&&(0,H.jsx)(`h3`,{"aria-hidden":`true`,children:G(`labels.background`)}),(0,H.jsx)(HC,{topPicks:Ss,palette:Qs,type:`elementBackground`,label:G(`labels.background`),color:ww(e,r,e=>e.backgroundColor,!0,e=>e?null:t.currentItemBackgroundColor),onChange:e=>n({currentItemBackgroundColor:e}),elements:e,appState:t,updateData:n})]})}}),X({name:`changeFillStyle`,label:`labels.fill`,trackEvent:!1,perform:(e,t,n,r)=>(aC(`element`,`changeFillStyle`,`${n} (${r.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),{elements:Cw(e,t,e=>P(e,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=A(e,t),a=i.length>0&&i.every(e=>e.fillStyle===`zigzag`);return(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.fill`)}),(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{type:`button`,options:[{value:`hachure`,text:`${G(a?`labels.zigzag`:`labels.hachure`)} (${Z(`Alt-Click`)})`,icon:a?$b:ex,active:a?!0:void 0,testId:`fill-hachure`},{value:`cross-hatch`,text:G(`labels.crossHatch`),icon:tx,testId:`fill-cross-hatch`},{value:`solid`,text:G(`labels.solid`),icon:nx,testId:`fill-solid`}],value:ww(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)}})})]})}}),X({name:`changeStrokeWidth`,label:`labels.strokeWidth`,trackEvent:!1,perform:(e,t,n)=>({elements:Cw(e,t,e=>P(e,{strokeWidth:n})),appState:{...t,currentItemStrokeWidth:n},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.strokeWidth`)}),(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{group:`stroke-width`,options:[{value:Ct.thin,text:G(`labels.thin`),icon:rx,testId:`strokeWidth-thin`},{value:Ct.bold,text:G(`labels.bold`),icon:ix,testId:`strokeWidth-bold`},{value:Ct.extraBold,text:G(`labels.extraBold`),icon:ax,testId:`strokeWidth-extraBold`}],value:ww(e,r,e=>e.strokeWidth,e=>e.hasOwnProperty(`strokeWidth`),e=>e?null:t.currentItemStrokeWidth),onChange:e=>n(e)})})]})}),X({name:`changeSloppiness`,label:`labels.sloppiness`,trackEvent:!1,perform:(e,t,n)=>({elements:Cw(e,t,e=>P(e,{seed:Ee(),roughness:n})),appState:{...t,currentItemRoughness:n},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.sloppiness`)}),(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{group:`sloppiness`,options:[{value:0,text:G(`labels.architect`),icon:cx},{value:1,text:G(`labels.artist`),icon:lx},{value:2,text:G(`labels.cartoonist`),icon:ux}],value:ww(e,r,e=>e.roughness,e=>e.hasOwnProperty(`roughness`),e=>e?null:t.currentItemRoughness),onChange:e=>n(e)})})]})}),X({name:`changeStrokeStyle`,label:`labels.strokeStyle`,trackEvent:!1,perform:(e,t,n)=>({elements:Cw(e,t,e=>P(e,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.strokeStyle`)}),(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{group:`strokeStyle`,options:[{value:`solid`,text:G(`labels.strokeStyle_solid`),icon:rx},{value:`dashed`,text:G(`labels.strokeStyle_dashed`),icon:ox},{value:`dotted`,text:G(`labels.strokeStyle_dotted`),icon:sx}],value:ww(e,r,e=>e.strokeStyle,e=>e.hasOwnProperty(`strokeStyle`),e=>e?null:t.currentItemStrokeStyle),onChange:e=>n(e)})})]})}),X({name:`changeOpacity`,label:`labels.opacity`,trackEvent:!1,perform:(e,t,n)=>({elements:Cw(e,t,e=>P(e,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,app:n,updateData:r})=>{let i=ww(e,n,e=>e.opacity,!0,e=>e?null:t.currentItemOpacity);return(0,H.jsx)(bw,{label:G(`labels.opacity`),value:i??t.currentItemOpacity,hasCommonValue:i!==null,onChange:r,min:0,max:100,step:10,testId:`opacity`})}}),X({name:`changeFontSize`,label:`labels.fontSize`,trackEvent:!1,perform:(e,t,n,r)=>Ew(e,t,r,()=>(Ar(n,`actionChangeFontSize: Expected a font size value`),n),n),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Sw(r);return(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.fontSize`)}),(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{group:`font-size`,options:[{value:Eo.sm,text:G(`labels.small`),icon:Ox,testId:`fontSize-small`},{value:Eo.md,text:G(`labels.medium`),icon:kx,testId:`fontSize-medium`},{value:Eo.lg,text:G(`labels.large`),icon:Ax,testId:`fontSize-large`},{value:Eo.xl,text:G(`labels.veryLarge`),icon:jx,testId:`fontSize-veryLarge`}],value:ww(e,r,e=>{if(M(e))return e.fontSize;let t=bn(e,r.scene.getNonDeletedElementsMap());return t?t.fontSize:null},e=>M(e)||bn(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:t.currentItemFontSize||20),onChange:e=>{xC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})]})}});var Dw=X({name:`decreaseFontSize`,label:`labels.decreaseFontSize`,icon:Mx,trackEvent:!1,perform:(e,t,n,r)=>Ew(e,t,r,e=>Math.round(1/(1+xw)*e.fontSize)),keyTest:e=>e[L.CTRL_OR_CMD]&&e.shiftKey&&(e.key===L.CHEVRON_LEFT||e.key===L.COMMA)}),Ow=X({name:`increaseFontSize`,label:`labels.increaseFontSize`,icon:Mx,trackEvent:!1,perform:(e,t,n,r)=>Ew(e,t,r,e=>Math.round(e.fontSize*(1+xw))),keyTest:e=>e[L.CTRL_OR_CMD]&&e.shiftKey&&(e.key===L.CHEVRON_RIGHT||e.key===L.PERIOD)});X({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:Cw(e,t,e=>{let t=i?.get(e.id);return t?P(e,{...t}):e},!0),appState:{...t,...s},captureUpdate:F.NEVER};Ar(n,`actionChangeFontFamily: value must be defined`);let{currentItemFontFamily:c,currentHoveredFontFamily:l}=n,u=F.EVENTUALLY,d,f=!1;if(c)d=c,u=F.IMMEDIATELY;else if(l){d=l,u=F.EVENTUALLY;let n=A(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(fe.loadedFontsCache.values()),f=Object.entries(oi).find(([e,t])=>t===d)?.[0];l&&f&&u.some(e=>e.startsWith(f))&&(s=!0),Object.assign(p,{elements:Cw(e,t,e=>{if(M(e)&&(e.fontFamily!==d||c)){let t=P(e,{fontFamily:d,lineHeight:hn(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 ${ra({fontFamily:d})}`,h=Array.from(a.values()).join();if(s||window.document.fonts.check(m,h))for(let[e,t]of n)Gr(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&&Gr(n,i,r.scene)}r.fonts.onLoaded(e)})}return p},PanelComponent:({elements:e,appState:t,app:n,updateData:r})=>{let i=(0,V.useRef)(new Map),a=(0,V.useRef)(null),[o,s]=(0,V.useState)({}),c=(0,V.useRef)(!0),{stylesPanelMode:l,isCompact:u}=Sw(n),d=(0,V.useMemo)(()=>{let r=(e,r)=>ww(e,n,e=>{if(M(e))return e.fontFamily;let t=bn(e,r);return t?t.fontFamily:null},e=>M(e)||bn(e,r)!==null,e=>e?null:t.currentItemFontFamily||wi);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,V.useEffect)(()=>{a.current=d},[d]),(0,V.useEffect)(()=>{Object.keys(o).length&&(r(o),s({}))},[o]),(0,V.useEffect)(()=>(c.current=!1,()=>{c.current=!0}),[]),(0,H.jsxs)(H.Fragment,{children:[l===`full`&&(0,H.jsx)(`legend`,{children:G(`labels.fontFamily`)}),(0,H.jsx)(cw,{isOpened:t.openPopup===`fontFamily`,selectedFontFamily:d,hoveredFontFamily:t.currentHoveredFontFamily,compactMode:l!==`full`,onSelect:e=>{xC(()=>{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,P(e||r,{},!0))}else{let n=A(e,t,{includeBoundTextElement:!0});for(let e of n)i.current.set(e.id,P(e,{},!0))}s({...o,openPopup:`fontFamily`})}else s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0}),i.current.clear(),u&&t.editingTextElement&&bC(null)}})]})}}),X({name:`changeTextAlign`,label:`Change text alignment`,trackEvent:!1,perform:(e,t,n,r)=>({elements:Cw(e,t,e=>{if(M(e)){let t=P(e,{textAlign:n});return Gr(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t,currentItemTextAlign:n},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let a=r.scene.getNonDeletedElementsMap(),{isCompact:o}=Sw(r);return(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.textAlign`)}),(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{group:`text-align`,options:[{value:`left`,text:G(`labels.left`),icon:Lx,testId:`align-left`},{value:`center`,text:G(`labels.center`),icon:Rx,testId:`align-horizontal-center`},{value:`right`,text:G(`labels.right`),icon:zx,testId:`align-right`}],value:ww(e,r,e=>{if(M(e))return e.textAlign;let t=bn(e,a);return t?t.textAlign:null},e=>M(e)||bn(e,a)!==null,e=>e?null:t.currentItemTextAlign),onChange:e=>{xC(()=>n(e),o,!!t.editingTextElement,i?.onPreventClose)}})})]})}}),X({name:`changeVerticalAlign`,label:`Change vertical alignment`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Cw(e,t,e=>{if(M(e)){let t=P(e,{verticalAlign:n});return Gr(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Sw(r);return(0,H.jsx)(`fieldset`,{children:(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{group:`text-align`,options:[{value:ns.TOP,text:G(`labels.alignTop`),icon:(0,H.jsx)(Bx,{theme:t.theme}),testId:`align-top`},{value:ns.MIDDLE,text:G(`labels.centerVertically`),icon:(0,H.jsx)(Hx,{theme:t.theme}),testId:`align-middle`},{value:ns.BOTTOM,text:G(`labels.alignBottom`),icon:(0,H.jsx)(Vx,{theme:t.theme}),testId:`align-bottom`}],value:ww(e,r,e=>{if(M(e)&&e.containerId)return e.verticalAlign;let t=bn(e,r.scene.getNonDeletedElementsMap());return t?t.verticalAlign:null},e=>M(e)||bn(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:ns.MIDDLE),onChange:e=>{xC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})})}}),X({name:`changeRoundness`,label:`Change edge roundness`,trackEvent:!1,perform:(e,t,n)=>({elements:Cw(e,t,e=>Tr(e)?e:P(e,{roundness:n===`round`?{type:Bn(e.type)?fo.ADAPTIVE_RADIUS:fo.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>{let a=Ie(nc(e),t).some(e=>e.roundness?.type===fo.LEGACY);return(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.edges`)}),(0,H.jsxs)(`div`,{className:`buttonList`,children:[(0,H.jsx)(sC,{group:`edges`,options:[{value:`sharp`,text:G(`labels.sharp`),icon:dx},{value:`round`,text:G(`labels.round`),icon:fx}],value:ww(e,r,e=>a?null:e.roundness?`round`:`sharp`,e=>!nt(e)&&e.hasOwnProperty(`roundness`),e=>e?null:t.currentItemRoundness),onChange:e=>n(e)}),i(`togglePolygon`)]})]})}});var kw=e=>({visibleSections:[{name:`default`,options:[{value:null,text:G(`labels.arrowhead_none`),keyBinding:`q`,icon:(0,H.jsx)(px,{flip:e})},{value:`arrow`,text:G(`labels.arrowhead_arrow`),keyBinding:`w`,icon:(0,H.jsx)(mx,{flip:e})},{value:`triangle`,text:G(`labels.arrowhead_triangle`),icon:(0,H.jsx)(hx,{flip:e}),keyBinding:`e`},{value:`triangle_outline`,text:G(`labels.arrowhead_triangle_outline`),icon:(0,H.jsx)(gx,{flip:e}),keyBinding:`r`}]}],hiddenSections:[{name:`default`,options:[{value:`circle`,text:G(`labels.arrowhead_circle`),keyBinding:`a`,icon:(0,H.jsx)(_x,{flip:e})},{value:`circle_outline`,text:G(`labels.arrowhead_circle_outline`),keyBinding:`s`,icon:(0,H.jsx)(vx,{flip:e})},{value:`diamond`,text:G(`labels.arrowhead_diamond`),icon:(0,H.jsx)(yx,{flip:e}),keyBinding:`d`},{value:`diamond_outline`,text:G(`labels.arrowhead_diamond_outline`),icon:(0,H.jsx)(bx,{flip:e}),keyBinding:`f`},{value:`bar`,text:G(`labels.arrowhead_bar`),keyBinding:`z`,icon:(0,H.jsx)(xx,{flip:e})}]},{name:G(`labels.cardinality`),options:[{value:`cardinality_one`,text:G(`labels.arrowhead_cardinality_one`),icon:(0,H.jsx)(Sx,{flip:e}),keyBinding:`x`},{value:`cardinality_many`,text:G(`labels.arrowhead_cardinality_many`),icon:(0,H.jsx)(Cx,{flip:e}),keyBinding:`c`},{value:`cardinality_one_or_many`,text:G(`labels.arrowhead_cardinality_one_or_many`),icon:(0,H.jsx)(wx,{flip:e}),keyBinding:`v`},{value:`cardinality_exactly_one`,text:G(`labels.arrowhead_cardinality_exactly_one`),icon:(0,H.jsx)(Tx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_one`,text:G(`labels.arrowhead_cardinality_zero_or_one`),icon:(0,H.jsx)(Ex,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_many`,text:G(`labels.arrowhead_cardinality_zero_or_many`),icon:(0,H.jsx)(Dx,{flip:e}),keyBinding:null}]}]});X({name:`changeArrowhead`,label:`Change arrowheads`,trackEvent:!1,perform:(e,t,n)=>(Ar(n,`actionChangeArrowhead: value must be defined`),{elements:Cw(e,t,e=>{if(Bo(e)){let{position:t,type:r}=n;if(t===`start`)return P(e,{startArrowhead:r});if(t===`end`)return P(e,{endArrowhead:r})}return e}),appState:{...t,[n.position===`start`?`currentItemStartArrowhead`:`currentItemEndArrowhead`]:n.type},captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=Ey().rtl,a=(0,V.useMemo)(()=>kw(!i),[i]),o=(0,V.useMemo)(()=>kw(!!i),[i]);return(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.arrowheads`)}),(0,H.jsxs)(`div`,{className:`iconSelectList buttonList`,children:[(0,H.jsx)(yw,{visibleSections:a.visibleSections,hiddenSections:a.hiddenSections,label:`arrowhead_start`,value:ww(e,r,e=>Bo(e)&&lt(e.type)?Gi(e.startArrowhead):t.currentItemStartArrowhead,!0,e=>e?null:t.currentItemStartArrowhead),onChange:e=>n({position:`start`,type:e})}),(0,H.jsx)(yw,{visibleSections:o.visibleSections,hiddenSections:o.hiddenSections,label:`arrowhead_end`,value:ww(e,r,e=>Bo(e)&&lt(e.type)?Gi(e.endArrowhead):t.currentItemEndArrowhead,!0,e=>e?null:t.currentItemEndArrowhead),onChange:e=>n({position:`end`,type:e})})]})]})}}),X({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,H.jsxs)(`div`,{className:`selected-shape-actions`,children:[i(`changeArrowhead`),i(`changeArrowType`)]})}),X({name:`changeArrowType`,label:`Change arrow types`,trackEvent:!1,perform:(e,t,n,r)=>{let i=Cw(e,t,e=>{if(!nt(e))return e;let i=r.scene.getNonDeletedElementsMap(),a=B.getPointAtIndexGlobalCoordinates(e,0,i),o=B.getPointAtIndexGlobalCoordinates(e,-1,i),s=P(e,{x:n===Ja.elbow?a[0]:e.x,y:n===Ja.elbow?a[1]:e.y,roundness:n===Ja.round?{type:fo.PROPORTIONAL_RADIUS}:null,elbowed:n===Ja.elbow,angle:n===Ja.elbow?0:e.angle,points:n===Ja.elbow||e.elbowed?[B.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},a,i),B.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},o,i)]:e.points});if(Tr(s)){s.fixedSegments=null;let e=r.scene.getNonDeletedElementsMap();r.dismissLinearEditor();let n=B.getPointAtIndexGlobalCoordinates(s,0,e),i=B.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,...Zo(s,a,`start`,e,t.isBindingEnabled)}:null,l=o&&s.endBinding?{...s.endBinding,...Zo(s,o,`end`,e,t.isBindingEnabled)}:null;s={...s,startBinding:c,endBinding:l,...$o(s,e,{points:[n,i].map(e=>N(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&&la(s,n,t.bindMode===`inside`?`inside`:`orbit`,`start`,r.scene)}if(s.endBinding){let n=e.get(s.endBinding.elementId);n&&la(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 B(t,ko(e)))}return{elements:i,appState:a,captureUpdate:F.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.arrowtypes`)}),(0,H.jsx)(`div`,{className:`buttonList`,children:(0,H.jsx)(sC,{group:`arrowtypes`,options:[{value:Ja.sharp,text:G(`labels.arrowtype_sharp`),icon:MS,testId:`sharp-arrow`},{value:Ja.round,text:G(`labels.arrowtype_round`),icon:PS,testId:`round-arrow`},{value:Ja.elbow,text:G(`labels.arrowtype_elbowed`),icon:NS,testId:`elbow-arrow`}],value:ww(e,r,e=>nt(e)?e.elbowed?Ja.elbow:e.roundness?Ja.round:Ja.sharp:null,e=>nt(e),e=>e?null:t.currentItemArrowType),onChange:e=>n(e)})})]})});var Aw=()=>{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},jw=(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`})},Mw=(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,jw(t,e.getBoundingClientRect())},Nw=({children:e,label:t,long:n=!1,style:r,disabled:i})=>((0,V.useEffect)(()=>()=>Aw().classList.remove(`excalidraw-tooltip--visible`),[]),i?null:(0,H.jsx)(`div`,{className:`excalidraw-tooltip-wrapper`,onPointerEnter:e=>Mw(e.currentTarget,Aw(),t,n),onPointerLeave:()=>Aw().classList.remove(`excalidraw-tooltip--visible`),style:r,children:e})),Pw=`<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">`,Fw=`<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"/>`,Iw=`<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"/>`,Lw=`data:${Vs.svg},${encodeURIComponent(`${Pw}${Iw}</svg>`)}`,Rw=`data:${Vs.svg},${encodeURIComponent(`${Pw}${Fw}${Iw}</svg>`)}`,zw=e=>{e&&(e.style.cursor=``)},Bw=(e,t)=>{e&&(e.style.cursor=t)},Vw,Hw,Uw=(e,t)=>{(!Vw||Vw.theme!==t)&&(()=>{let e=t===R.DARK;Vw=document.createElement(`canvas`),Vw.theme=t,Vw.height=20,Vw.width=20;let n=Vw.getContext(`2d`);n.lineWidth=1,n.beginPath(),n.arc(Vw.width/2,Vw.height/2,5,0,2*Math.PI),n.fillStyle=e?`#000`:`#fff`,n.fill(),n.strokeStyle=e?`#fff`:`#000`,n.stroke(),Hw=Vw.toDataURL(Vs.svg)})(),Bw(e,`url(${Hw}) ${20/2} ${20/2}, auto`)},Ww=(e,t)=>{if(e)if(t.activeTool.type===`selection`)zw(e);else if(Us(t))e.style.cursor=on.GRAB;else if(Wr(t))Uw(e,t.theme);else if(t.activeTool.type===`laser`){let n=t.theme===R.LIGHT?Lw:Rw;e.style.cursor=`url(${n}), auto`}else [`image`,`custom`].includes(t.activeTool.type)?t.activeTool.type!==`image`&&(e.style.cursor=on.AUTO):e.style.cursor=on.CROSSHAIR},Gw=({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}}};X({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?F.IMMEDIATELY:F.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r,data:i})=>(0,H.jsx)(HC,{palette:null,topPicks:Ri,label:G(`labels.canvasBackground`),type:`canvasBackground`,color:t.viewBackgroundColor,onChange:e=>n({viewBackgroundColor:e}),"data-testid":`canvas-background-picker`,elements:e,appState:t,updateData:n})});var Kw=X({name:`clearCanvas`,label:`labels.clearCanvas`,icon:sb,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=>P(e,{isDeleted:!0})),appState:{...vs(),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:F.IMMEDIATELY})}),qw=X({name:`zoomIn`,label:`buttons.zoomIn`,viewMode:!0,icon:ib,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Gw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:ls(t.zoom.value+Js)},t),userToFollow:null},captureUpdate:F.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,H.jsx)(Y,{type:`button`,className:`zoom-in-button zoom-button`,icon:ib,title:`${G(`buttons.zoomIn`)} \u2014 ${Z(`CtrlOrCmd++`)}`,"aria-label":G(`buttons.zoomIn`),disabled:t.zoom.value>=30,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Ye.EQUAL||e.code===Ye.NUM_ADD)&&(e[L.CTRL_OR_CMD]||e.shiftKey)}),Jw=X({name:`zoomOut`,label:`buttons.zoomOut`,icon:ab,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Gw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:ls(t.zoom.value-Js)},t),userToFollow:null},captureUpdate:F.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,H.jsx)(Y,{type:`button`,className:`zoom-out-button zoom-button`,icon:ab,title:`${G(`buttons.zoomOut`)} \u2014 ${Z(`CtrlOrCmd+-`)}`,"aria-label":G(`buttons.zoomOut`),disabled:t.zoom.value<=as,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Ye.MINUS||e.code===Ye.NUM_SUBTRACT)&&(e[L.CTRL_OR_CMD]||e.shiftKey)}),Yw=X({name:`resetZoom`,label:`buttons.resetZoom`,icon:ob,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Gw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:ls(1)},t),userToFollow:null},captureUpdate:F.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,H.jsx)(Nw,{label:G(`buttons.resetZoom`),style:{height:`100%`},children:(0,H.jsxs)(Y,{type:`button`,className:`reset-zoom-button zoom-button`,title:G(`buttons.resetZoom`),"aria-label":G(`buttons.resetZoom`),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),`%`]})}),keyTest:e=>(e.code===Ye.ZERO||e.code===Ye.NUM_ZERO)&&(e[L.CTRL_OR_CMD]||e.shiftKey)}),Xw=(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)*Ce(n,.1,1);return Math.min(d,1)},Zw=({bounds:e,appState:t,canvasOffsets:n,fitToViewport:r=!1,viewportZoomFactor:i=1,minZoom:a=-1/0,maxZoom:o=1/0})=>{i=Ce(i,as,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=Xw(e,{width:_,height:v},i);let b=ls(Ce(Dn(y,Js,`floor`),a,o)),x=rt({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:F.EVENTUALLY}},Qw=({canvasOffsets:e,targetElements:t,appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o})=>Zw({canvasOffsets:e,bounds:Rn(nc(t)),appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o});X({name:`zoomToFitSelectionInViewport`,label:`labels.zoomToFitViewport`,icon:CS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return Qw({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Ye.TWO&&e.shiftKey&&!e.altKey&&!e[L.CTRL_OR_CMD]}),X({name:`zoomToFitSelection`,label:`helpDialog.zoomToSelection`,icon:CS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return Qw({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!0,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Ye.THREE&&e.shiftKey&&!e.altKey&&!e[L.CTRL_OR_CMD]}),X({name:`zoomToFit`,label:`helpDialog.zoomToFit`,icon:CS,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>Qw({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()}),keyTest:e=>e.code===Ye.ONE&&e.shiftKey&&!e.altKey&&!e[L.CTRL_OR_CMD]});var $w=X({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?ub:db,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n)=>({appState:{...t,theme:n||(t.theme===R.LIGHT?R.DARK:R.LIGHT)},captureUpdate:F.EVENTUALLY}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===Ye.D,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.toggleTheme});X({name:`toggleEraserTool`,label:`toolBar.eraser`,trackEvent:{category:`toolbar`},perform:(e,t,n,r)=>{let i;return i=Wr(t)?Vt(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):Vt(t,{type:`eraser`,lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:F.IMMEDIATELY}},keyTest:e=>e.key===L.E}),X({name:`toggleLassoTool`,label:`toolBar.lasso`,icon:Ky,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=Vt(t,{type:`selection`}):(i=Vt(t,{type:`lasso`,fromSelection:!1}),Bw(r.interactiveCanvas,on.CROSSHAIR)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:F.NEVER}}});var eT=X({name:`toggleHandTool`,label:`toolBar.hand`,trackEvent:{category:`toolbar`},icon:Gx,viewMode:!1,perform:(e,t,n,r)=>{let i;return Us(t)?i=Vt(t,{...t.activeTool.lastActiveTool||{type:`selection`},lastActiveToolBeforeEraser:null}):(i=Vt(t,{type:`hand`,lastActiveToolBeforeEraser:t.activeTool}),Bw(r.interactiveCanvas,on.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:F.IMMEDIATELY}},keyTest:e=>!e.altKey&&!e[L.CTRL_OR_CMD]&&e.key===L.H});X({name:`setEmbeddableAsActiveTool`,trackEvent:{category:`toolbar`},target:`Tool`,label:`toolBar.embeddable`,perform:(e,t,n,r)=>{let i=Vt(t,{type:`embeddable`});return Ww(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:Vt(t,{type:`embeddable`})},captureUpdate:F.EVENTUALLY}}});var tT=X({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=B.getElement(t.selectedLinearElement.elementId,c);Ar(l,`Arrow element should exist if selectedLinearElement is set`),Ar(o,`sceneCoords should be defined if actionFinalize is called with event`);let u=B.handlePointerUp(a,t.selectedLinearElement,t,r.scene);if(Xi(l)&&!t.selectedLinearElement.segmentMidPointHoveredCoords){let e=!!t.newElement;Ls(l,(e||!t.selectedLinearElement.selectedPointsIndices?[l.points.length-1]:t.selectedLinearElement.selectedPointsIndices).reduce((e,t)=>(e.set(t,{point:B.pointFromAbsoluteCoords(l,N(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:_t(a)})}else ks(l)&&t.selectedLinearElement?.isEditing&&!t.newElement&&!Mr(l.points)&&s.mutateElement(l,{polygon:!1});if(u!==t.selectedLinearElement){l&&Aa(l)&&(i=i.map(e=>e.id===l.id?P(e,{isDeleted:!0}):e));let n=t.activeTool?.locked;return{elements:l.points.length<2||Aa(l)?e.map(e=>e.id===l.id?P(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:F.IMMEDIATELY}}}window.document.activeElement instanceof HTMLElement&&o();let l=null;if(t.multiElement)l=t.multiElement;else if(t.newElement?.type===`freedraw`||Xi(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&&Aa(l)&&(i=i.map(e=>e.id===l?.id?P(e,{isDeleted:!0}):e)),Bo(l)||Ht(l)){if(Hn(l.points,t.zoom.value)&&(ks(l)||Ht(l))){let e=l.points,t=e[0],n=e.map((n,r)=>r===e.length-1?N(t[0],t[1]):n);ks(l)?s.mutateElement(l,{points:n,polygon:!0}):s.mutateElement(l,{points:n})}ks(l)&&!Mr(l.points)&&s.mutateElement(l,{polygon:!1})}}(!t.activeTool.locked&&t.activeTool.type!==`freedraw`||!l)&&zw(a);let u;u=t.activeTool.type===`eraser`?Vt(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):Vt(t,{type:r.state.preferredSelectionTool.type});let d=l&&Bo(l)?new B(l,ko(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:F.IMMEDIATELY}},keyTest:(e,t)=>e.key===L.ESCAPE&&t.selectedLinearElement?.isEditing||(e.key===L.ESCAPE||e.key===L.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>(0,H.jsx)(Y,{type:`button`,icon:kb,title:G(`buttons.done`),"aria-label":G(`buttons.done`),onClick:t,visible:e.multiElement!=null,size:n?.size||`medium`,style:{pointerEvents:`all`}})}),nT=(e,t)=>e.activeTool.type===`eraser`?Vt(e,{...e.activeTool.lastActiveTool||{type:t.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):Vt(e,{type:t.state.preferredSelectionTool.type}),rT=(e,t,n)=>{if(!e.editingGroupId)return null;let r=t.scene.getNonDeletedElements(),i=t.scene.getSelectedElements({selectedElementIds:n,elements:r}),a=i.length?i:mr(r,e.editingGroupId);for(let t of a){let n=t.groupIds.indexOf(e.editingGroupId);if(n!==-1&&t.groupIds[n+1])return t.groupIds[n+1]}return null};X({name:`deselect`,label:``,trackEvent:!1,perform:(e,t,n,r)=>{let i=nT(t,r);if(t.editingGroupId){let e=r.scene.getNonDeletedElements(),n=Object.keys(t.selectedElementIds).length>0?t.selectedElementIds:mr(e,t.editingGroupId).reduce((e,t)=>(e[t.id]=!0,e),{});return{appState:{...t,...jr({editingGroupId:rT(t,r,n),selectedElementIds:n},e,t,r),activeEmbeddable:null,activeTool:i,selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null},captureUpdate:F.IMMEDIATELY}}return{appState:{...t,activeEmbeddable:null,activeTool:i,editingGroupId:null,selectedElementIds:us({},t),selectedGroupIds:{},selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null},captureUpdate:F.IMMEDIATELY}},keyTest:(e,t,n,r)=>e.key!==L.ESCAPE||pi(e.target)?!1:!t.newElement&&t.multiElement===null&&!t.selectedLinearElement?.isEditing&&(t.activeEmbeddable!==null||t.activeTool.type!==r.state.preferredSelectionTool.type||!!t.editingGroupId||!!t.selectedLinearElement||Ge(r.scene.getNonDeletedElements(),t))});var iT=({children:e,checked:t,onChange:n,className:r})=>(0,H.jsxs)(`div`,{className:U(`Checkbox`,r,{"is-checked":t}),onClick:e=>{n(!t,e),e.currentTarget.querySelector(`.Checkbox-box`).focus()},children:[(0,H.jsx)(`button`,{type:`button`,className:`Checkbox-box`,role:`checkbox`,"aria-checked":t,children:bb}),(0,H.jsx)(`div`,{className:`Checkbox-label`,children:e})]}),aT=e=>{let t=e.title||(e.value===R.DARK?G(`buttons.lightMode`):G(`buttons.darkMode`));return(0,H.jsx)(Y,{type:`icon`,icon:e.value===R.LIGHT?oT.MOON:oT.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===R.DARK?R.LIGHT:R.DARK),"data-testid":`toggle-dark-mode`})},oT={SUN:(0,H.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,H.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,H.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,H.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`})})},sT=e=>{let{id:t}=hz(),[n,r]=(0,V.useState)(e.value);return(0,H.jsxs)(`div`,{className:`ProjectName`,children:[(0,H.jsx)(`label`,{className:`ProjectName-label`,htmlFor:`filename`,children:`${e.label}:`}),(0,H.jsx)(`input`,{type:`text`,className:`TextInput`,onBlur:t=>{e.ignoreFocus||Yi(t.target);let n=t.target.value;n!==e.value&&e.onChange(n)},onKeyDown:e=>{if(e.key===L.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)})]})},cT=5e3,lT=Object.assign(({message:e,onClose:t,closable:n=!1,duration:r=cT,style:i})=>{let a=(0,V.useRef)(0),o=r!==1/0,s=(0,V.useCallback)(()=>{o&&(a.current=window.setTimeout(()=>t(),r))},[t,r,o]);return(0,V.useEffect)(()=>{if(o)return s(),()=>clearTimeout(a.current)},[s,e,r,o]),(0,H.jsxs)(`div`,{className:`Toast`,role:`status`,onMouseEnter:o?()=>clearTimeout(a?.current):void 0,onMouseLeave:o?s:void 0,style:i,children:[(0,H.jsx)(`div`,{className:`Toast__message`,children:e}),n&&(0,H.jsx)(Y,{icon:Xb,"aria-label":`close`,type:`icon`,onClick:t,className:`close`})]})},{ProgressBar:({progress:e})=>(0,H.jsx)(`div`,{className:`Toast__progress-bar`,children:(0,H.jsx)(`div`,{className:`Toast__progress-bar-fill`,style:{width:`${Math.min(5,Math.round(e*100))}%`}})})});`clipboard`in navigator&&`readText`in navigator.clipboard;var uT=`clipboard`in navigator&&`writeText`in navigator.clipboard,dT=`clipboard`in navigator&&`write`in navigator.clipboard&&`ClipboardItem`in window&&`toBlob`in HTMLCanvasElement.prototype,fT=e=>!!([xo.excalidraw,xo.excalidrawClipboard,xo.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),pT=({types:e,files:t})=>{!e&&!t&&console.warn(`createPasteEvent: no types or files provided`);let n=new ClipboardEvent(j.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},mT=({elements:e,files:t})=>{let n=ko(e),r=new Set(e.filter(e=>I(e))),i=!1,a=e.reduce((e,n)=>(Xs(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:xo.excalidrawClipboard,elements:e.map(e=>{if(To(e,n)&&!r.has(To(e,n))){let t=w(e);return ge(t,n,{frameId:null}),t}return e}),files:t?a:void 0};return JSON.stringify(o)},hT=async(e,t,n)=>{let r=mT({elements:e,files:t});await DT({[Vs.excalidrawClipboard]:r,[Vs.text]:r},n)};function gT(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(gT(n));return t}var _T=e=>{let t=e.value;try{let e=gT(new DOMParser().parseFromString(t,Vs.html).body);if(e.length)return{type:`mixedContent`,value:e}}catch(e){console.error(`error in parseHTMLFromPaste: ${e.message}`)}return null},vT=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{[Vs.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(sr(ua,t))try{if(t===Vs.text||t===Vs.html)e[t]=await(await n.getType(t)).text();else if(Ka(t))e[t]=xa(await n.getType(t),t,void 0);else throw new Tt(`Unsupported clipboard type: ${t}`)}catch(e){console.warn(e instanceof Tt?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},yT=async(e,t=!1)=>{try{let n=e.findByType(Vs.html),r=!t&&n&&_T(n);return r?r.value.every(e=>e.type===`text`)?{type:`text`,value:e.getData(Vs.text)??r.value.map(e=>e.value).join(`
43
- `).trim()}:r:{type:`text`,value:(e.getData(Vs.text)||``).trim()}}catch{return{type:`text`,value:``}}},bT=function(e){return this.find(t=>t.type===e)||null},xT=function(e){return this.find(t=>t.type===e)?.value??null},ST=function(){return this.filter(e=>e.kind===`file`)},CT=e=>{let t;t=kT(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},wT=async e=>{let t;t=kT(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 ft(t);return e=await yo(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:bT,getData:xT,getFiles:ST})},TT=async(e,t=!1)=>{let n=await yT(e,t);if(n.type===`mixedContent`)return{mixedContent:n.value};try{let e=JSON.parse(n.value),r=e.type===xo.excalidrawClipboardWithAPI;if(fT(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}},ET=async e=>{try{await navigator.clipboard.write([new ClipboardItem({[Vs.png]:e})])}catch(t){if(x(e))await navigator.clipboard.write([new ClipboardItem({[Vs.png]:await e})]);else throw t}},DT=async(e,t)=>{e||=``;let n=Object.entries(typeof e==`string`?{[Vs.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===Vs.text);if(uT&&r)try{await navigator.clipboard.writeText(r[1]);return}catch(e){console.error(e)}if(r&&!OT(r[1]))throw Error(`Error copying to clipboard.`)},OT=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},kT=e=>e.type===j.PASTE||e.type===j.COPY||e.type===j.CUT,AT=(e,{selectedElementIds:t},n)=>{e=nc(e);let r=ko(e),i=n&&Ge(e,{selectedElementIds:t}),a=null,o=i?A(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return i&&(o.length===1&&I(o[0])?(a=o[0],o=kt(e,a,r)):o.length>1&&(o=A(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:a,exportedElements:As(o)}},jT=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(G(`alerts.cannotExportEmptyCanvas`));if(e===`svg`||e===`clipboard-svg`){let n=xe(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 ci(n.then(e=>new Blob([ho+e.outerHTML],{type:Vs.svg})),{description:`Export to SVG`,name:c,extension:r.exportEmbedScene?`excalidraw.svg`:`svg`,mimeTypes:[zt.svg],fileHandle:l});if(e===`clipboard-svg`){let e=await n.then(e=>e.outerHTML);try{await DT(e)}catch{throw Error(G(`errors.copyToSystemClipboardFailed`))}return}}let d=ie(t,r,i,{exportBackground:a,viewBackgroundColor:s,exportPadding:o,exportingFrame:u});if(e===`png`){let e=or(d);return r.exportEmbedScene&&(e=e.then(e=>n(async()=>{let{encodePngMetadata:e}=await import(`./image-J2CAS7OM-DD4DaQTs.js`);return{encodePngMetadata:e}},__vite__mapDeps([62,63,2,64,65,1]),import.meta.url).then(({encodePngMetadata:n})=>n({blob:e,metadata:lo(t,r,i,`local`)})))),ci(e,{description:`Export to PNG`,name:c,extension:r.exportEmbedScene?`excalidraw.png`:`png`,mimeTypes:[zt.png],fileHandle:l})}else if(e===`clipboard`)try{await ET(or(d))}catch(e){throw console.warn(e),e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(G(`canvasError.canvasTooBig`)):Dr&&e.name===`TypeError`?Error(`${G(`alerts.couldNotCopyToClipboard`)}
44
-
45
- ${G(`hints.firefox_clipboard_write`)}`):Error(G(`alerts.couldNotCopyToClipboard`))}else throw Error(`Unsupported export type`)},MT=async(e,t,n)=>{let r=Vi(t);if(!ze(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}=AT(i,a,!1);return await jT(r,l,a,o,{exportBackground:s,viewBackgroundColor:c,name:n,fileHandle:t,exportingFrame:u}),{fileHandle:t}},NT=X({name:`changeProjectName`,label:`labels.fileTitle`,trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},captureUpdate:F.EVENTUALLY}),PanelComponent:({appState:e,updateData:t,appProps:n,data:r,app:i})=>(0,H.jsx)(sT,{label:G(`labels.fileTitle`),value:i.getName(),onChange:e=>t(e),ignoreFocus:r?.ignoreFocus??!1})}),PT=X({name:`changeExportScale`,label:`imageExportDialog.scale`,trackEvent:{category:`export`,action:`scale`},perform:(e,t,n)=>({appState:{...t,exportScale:n},captureUpdate:F.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=nc(e),i=Ge(r,t)?A(r,t):r;return(0,H.jsx)(H.Fragment,{children:ui.map(e=>{let[r,a]=Ei(i,10,e),o=`${G(`imageExportDialog.label.scale`)} ${e}x (${r}x${a})`;return(0,H.jsx)(Y,{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)})})}}),FT=X({name:`changeExportBackground`,label:`imageExportDialog.label.withBackground`,trackEvent:{category:`export`,action:`toggleBackground`},perform:(e,t,n)=>({appState:{...t,exportBackground:n},captureUpdate:F.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,H.jsx)(iT,{checked:e.exportBackground,onChange:e=>t(e),children:G(`imageExportDialog.label.withBackground`)})}),IT=X({name:`changeExportEmbedScene`,label:`imageExportDialog.tooltip.embedScene`,trackEvent:{category:`export`,action:`embedScene`},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},captureUpdate:F.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,H.jsxs)(iT,{checked:e.exportEmbedScene,onChange:e=>t(e),children:[G(`imageExportDialog.label.embedScene`),(0,H.jsx)(Nw,{label:G(`imageExportDialog.tooltip.embedScene`),long:!0,children:(0,H.jsx)(`div`,{className:`excalidraw-tooltip-icon`,children:Mb})})]})}),LT=!1,RT=(e,t)=>{let n=t.message??G(`progressDialog.defaultMessage`);e.setAppState({toast:{message:t.progress==null?n:(0,H.jsxs)(H.Fragment,{children:[n,(0,H.jsx)(lT.ProgressBar,{progress:t.progress})]}),duration:1/0}})};async function zT(e,t){if(t.app.state.isLoading&&(RT(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`)RT(t.app,{message:n.message,progress:n.progress??null});else if(n.type===`done`)return}return}e instanceof Promise&&(RT(t.app,{progress:null}),await e)}function BT(e,t,n,r){let i=new AbortController,a=i.signal;return{abortController:i,data:new Promise(async i=>{try{r.props.onExport&&await zT(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 VT=X({name:`saveToActiveFile`,label:`buttons.save`,icon:pb,trackEvent:{category:`export`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{if(LT)return!1;LT=!0;let i=t.fileHandle,a=r.getName(),{abortController:o,data:s}=BT(e,t,r.files,r);try{let{fileHandle:e}=_i(i)?await MT(s,i,a):await kr({data:s,filename:a,fileHandle:i});return{captureUpdate:F.NEVER,appState:{fileHandle:e,toast:{message:i&&e?.name?G(`toast.fileSavedToFilename`).replace(`{filename}`,`"${e.name}"`):G(`toast.fileSaved`),duration:1500}}}}catch(e){return o.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:F.NEVER,appState:{toast:null}}}finally{LT=!1}},keyTest:e=>e.key===L.S&&e[L.CTRL_OR_CMD]&&!e.shiftKey}),HT=X({name:`saveFileToDisk`,label:`exportDialog.disk_title`,icon:pb,viewMode:!0,trackEvent:{category:`export`},perform:async(e,t,n,r)=>{if(LT)return!1;LT=!0;let{abortController:i,data:a}=BT(e,t,r.files,r);try{let{fileHandle:e}=await kr({data:a,filename:r.getName(),fileHandle:null});return{captureUpdate:F.NEVER,appState:{openDialog:null,fileHandle:e,toast:{message:G(`toast.fileSaved`),duration:3e3}}}}catch(e){return i.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:F.NEVER,appState:{toast:null}}}finally{LT=!1}},keyTest:e=>e.key.toLowerCase()===L.S&&e.shiftKey&&e[L.CTRL_OR_CMD],PanelComponent:({updateData:e})=>(0,H.jsx)(Y,{type:`button`,icon:Cb,title:G(`buttons.saveAs`),"aria-label":G(`buttons.saveAs`),showAriaLabel:pz().formFactor===`phone`,hidden:!co,onClick:()=>e(null),"data-testid":`save-as-button`})}),UT=X({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 Ts(t,e);return{elements:n,appState:r,files:i,captureUpdate:F.IMMEDIATELY}}catch(n){return n?.name===`AbortError`?(console.warn(n),!1):{elements:e,appState:{...t,errorMessage:n.message},files:r.files,captureUpdate:F.EVENTUALLY}}},keyTest:e=>e[L.CTRL_OR_CMD]&&e.key===L.O}),WT=X({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:F.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`-45px`,marginBottom:`10px`},children:(0,H.jsx)(aT,{value:e.exportWithDarkMode?R.DARK:R.LIGHT,onChange:e=>{t(e===R.DARK)},title:G(`imageExportDialog.label.darkMode`)})})}),GT=`{}`,KT=X({name:`copyStyles`,label:`labels.copyStyles`,icon:SS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=[],a=e.find(e=>t.selectedElementIds[e.id]);if(i.push(a),a&&ys(a)){let e=bn(a,r.scene.getNonDeletedElementsMap());i.push(e)}return a&&(GT=JSON.stringify(i)),{appState:{...t,toast:{message:G(`toast.copyStyles`)}},captureUpdate:F.EVENTUALLY}},keyTest:e=>e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.C}),qT=X({name:`pasteStyles`,label:`labels.pasteStyles`,icon:SS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=JSON.parse(GT),a=i[0],o=i[1];if(!b(a))return{elements:e,captureUpdate:F.EVENTUALLY};let s=A(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=P(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?Ue(t.roundness.type,e)?t.roundness:$a(e):null});if(M(n)){let e=t.fontSize||20,i=t.fontFamily||wi;n=P(n,{fontSize:e,fontFamily:i,textAlign:t.textAlign||`left`,lineHeight:t.lineHeight||hn(i)});let a=null;n.containerId&&(a=s.find(e=>M(n)&&e.id===n.containerId)||null),Gr(n,a,r.scene)}return n.type===`arrow`&&nt(t)&&(n=P(n,{startArrowhead:t.startArrowhead,endArrowhead:t.endArrowhead})),I(e)&&(n=P(n,{roundness:null,backgroundColor:`transparent`})),n}return e}),captureUpdate:F.IMMEDIATELY}},keyTest:e=>e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.V}),JT=X({name:`toggleShortcuts`,label:`welcomeScreen.defaults.helpHint`,icon:hb,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:F.EVENTUALLY}),keyTest:e=>e.key===L.QUESTION_MARK}),YT=e=>{if(e.length>=2){let t=e[0].groupIds;for(let n of t)if(e.reduce((e,t)=>e&&Pr(t,n),!0))return!0}return!1},XT=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return r.length>=2&&!YT(r)&&!Jr(r)},ZT=X({name:`group`,label:`labels.group`,icon:e=>(0,H.jsx)(Zb,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=Ns(r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}));if(i.length<2)return{appState:t,elements:e,captureUpdate:F.EVENTUALLY};let a=we(t);if(a.length===1){let n=a[0],r=new Set(mr(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:F.EVENTUALLY}}let o=[...e];new Set(i.map(e=>e.frameId)).size>1&&Di(i).forEach((e,t)=>{Oa(e,r.scene.getNonDeletedElementsMap())});let s=da(),c=ko(i);o=o.map(e=>c.get(e.id)?P(e,{groupIds:Ga(e.groupIds,s,t.editingGroupId)}):e);let l=mr(o,s),u=l[l.length-1],f=o.lastIndexOf(u),p=o.slice(f+1),m=xr([...o.slice(0,f).filter(e=>!Pr(e,s)),...l,...p],ko(l));return{appState:{...t,...d(s,{...t,selectedGroupIds:{}},nc(o))},elements:m,captureUpdate:F.IMMEDIATELY}},predicate:(e,t,n,r)=>XT(e,t,r),keyTest:e=>!e.shiftKey&&e[L.CTRL_OR_CMD]&&e.key===L.G,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!XT(e,t,r),type:`button`,icon:(0,H.jsx)(Zb,{theme:t.theme}),onClick:()=>n(null),title:`${G(`labels.group`)} \u2014 ${Z(`CtrlOrCmd+G`)}`,"aria-label":G(`labels.group`),visible:Ge(nc(e),t)})}),QT=X({name:`ungroup`,label:`labels.ungroup`,icon:e=>(0,H.jsx)(Qb,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=we(t),a=ko(e);if(i.length===0)return{appState:t,elements:e,captureUpdate:F.EVENTUALLY};let o=[...e],s=[];o=o.map(e=>{Ra(e)&&s.push(e.id);let n=oo(e.groupIds,t.selectedGroupIds);return n.length===e.groupIds.length?e:P(e,{groupIds:n})});let c=jr(t,nc(o),t,null),l=r.scene.getSelectedElements(t),u=new Set(l.filter(e=>e.frameId).map(e=>e.frameId));return po(e).filter(e=>u.has(e.id)).forEach(e=>{e&&(o=re(o,fa(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:F.IMMEDIATELY}},keyTest:e=>e.shiftKey&&e[L.CTRL_OR_CMD]&&e.key===L.G.toUpperCase(),predicate:(e,t)=>we(t).length>0,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,H.jsx)(Y,{type:`button`,hidden:we(t).length===0,icon:(0,H.jsx)(Qb,{theme:t.theme}),onClick:()=>n(null),title:`${G(`labels.ungroup`)} \u2014 ${Z(`CtrlOrCmd+Shift+G`)}`,"aria-label":G(`labels.ungroup`),visible:Ge(nc(e),t)})}),$T=(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 eE(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 tE=(e,t)=>`hsl(${Math.abs(eE(t?.id||e))%37*10}, 100%, 83%)`,nE=e=>{let t=e?.trim()?.codePointAt(0);return(t?String.fromCodePoint(t):`?`).toUpperCase()},rE=({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=tE(a,l);e.save(),e.strokeStyle=d,e.fillStyle=d;let f=t.remotePointerUserStates.get(a),p=u||f===We.IDLE||f===We.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`:ds,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=sa,e.strokeStyle=sa,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())):$T(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()}},iE=({color:e,onClick:t,name:n,src:r,className:i})=>{let a=nE(n),[o,s]=(0,V.useState)(!1),c=!o&&r,l=c?void 0:{background:e};return(0,H.jsx)(`div`,{className:U(`Avatar`,i),style:l,onClick:t,children:c?(0,H.jsx)(`img`,{className:`Avatar-img`,src:r,alt:a,referrerPolicy:`no-referrer`,onError:()=>s(!0)}):a})};X({name:`goToCollaborator`,label:`Go to a collaborator`,viewMode:!0,trackEvent:{category:`collab`},perform:(e,t,n)=>(Ar(n,`actionGoToCollaborator: collaborator should be defined when actionGoToCollaborator is called`),!n.socketId||t.userToFollow?.socketId===n.socketId||n.isCurrentUser?{appState:{...t,userToFollow:null},captureUpdate:F.EVENTUALLY}:{appState:{...t,userToFollow:{socketId:n.socketId,username:n.username||``},openMenu:t.openMenu===`canvas`?null:t.openMenu},captureUpdate:F.EVENTUALLY}),PanelComponent:({updateData:e,data:t,appState:n})=>{let{socketId:r,collaborator:i,withName:a,isBeingFollowed:o}=t,s=tE(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,H.jsxs)(`div`,{className:`UserList__collaborator-status-icon-speaking-indicator`,title:G(`userList.hint.isSpeaking`),children:[(0,H.jsx)(`div`,{}),(0,H.jsx)(`div`,{}),(0,H.jsx)(`div`,{})]}):i.isMuted?(0,H.jsx)(`div`,{className:`UserList__collaborator-status-icon-microphone-muted`,title:G(`userList.hint.micMuted`),children:gS}):(0,H.jsx)(`div`,{title:G(`userList.hint.inCall`),children:hS}):null;return a?(0,H.jsxs)(`div`,{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${c}`,style:{"--avatar-size":`1.5rem`},onClick:()=>e(i),children:[(0,H.jsx)(iE,{color:s,onClick:()=>{},name:i.username||``,src:i.avatarUrl,className:c}),(0,H.jsx)(`div`,{className:`UserList__collaborator-name`,children:i.username}),(0,H.jsxs)(`div`,{className:`UserList__collaborator-status-icons`,"aria-hidden":!0,children:[o&&(0,H.jsx)(`div`,{className:`UserList__collaborator-status-icon-is-followed`,title:G(`userList.hint.followStatus`),children:cS}),l]})]}):(0,H.jsxs)(`div`,{className:`UserList__collaborator UserList__collaborator--avatar-only ${c}`,children:[(0,H.jsx)(iE,{color:s,onClick:()=>{e(i)},name:i.username||``,src:i.avatarUrl,className:c}),l&&(0,H.jsx)(`div`,{className:`UserList__collaborator-status-icon`,children:l})]})}});var aE=X({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 pt)if(i.some(t=>t.type===e))return{captureUpdate:F.EVENTUALLY,appState:{...t,errorMessage:G(`errors.libraryElementTypeError.${e}`)}};return r.library.getLatestLibrary().then(e=>r.library.setLibrary([{id:da(),status:`unpublished`,elements:i.map(w),created:Date.now()},...e])).then(()=>({captureUpdate:F.EVENTUALLY,appState:{...t,toast:{message:G(`toast.addedToLibrary`)}}})).catch(e=>({captureUpdate:F.EVENTUALLY,appState:{...t,errorMessage:e.message}}))},label:`labels.addToLibrary`}),oE=(e,t)=>{let n=t.scene.getSelectedElements(e);return k(n,t.scene.getNonDeletedElementsMap(),e).length>1&&!n.some(e=>I(e))},sE=(e,t,n,r)=>{let i=ko($s(n.scene.getSelectedElements(t),r,n.scene,t));return Rs(e.map(e=>i.get(e.id)||e),t,n)};X({name:`alignTop`,label:`labels.alignTop`,icon:Bb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>oE(t,r),perform:(e,t,n,r)=>({appState:t,elements:sE(e,t,r,{position:`start`,axis:`y`}),captureUpdate:F.IMMEDIATELY}),keyTest:e=>e[L.CTRL_OR_CMD]&&e.shiftKey&&e.key===L.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!oE(t,r),type:`button`,icon:Bb,onClick:()=>n(null),title:`${G(`labels.alignTop`)} \u2014 ${Z(`CtrlOrCmd+Shift+Up`)}`,"aria-label":G(`labels.alignTop`),visible:Ge(nc(e),t)})}),X({name:`alignBottom`,label:`labels.alignBottom`,icon:Vb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>oE(t,r),perform:(e,t,n,r)=>({appState:t,elements:sE(e,t,r,{position:`end`,axis:`y`}),captureUpdate:F.IMMEDIATELY}),keyTest:e=>e[L.CTRL_OR_CMD]&&e.shiftKey&&e.key===L.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!oE(t,r),type:`button`,icon:Vb,onClick:()=>n(null),title:`${G(`labels.alignBottom`)} \u2014 ${Z(`CtrlOrCmd+Shift+Down`)}`,"aria-label":G(`labels.alignBottom`),visible:Ge(nc(e),t)})}),X({name:`alignLeft`,label:`labels.alignLeft`,icon:Hb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>oE(t,r),perform:(e,t,n,r)=>({appState:t,elements:sE(e,t,r,{position:`start`,axis:`x`}),captureUpdate:F.IMMEDIATELY}),keyTest:e=>e[L.CTRL_OR_CMD]&&e.shiftKey&&e.key===L.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!oE(t,r),type:`button`,icon:Hb,onClick:()=>n(null),title:`${G(`labels.alignLeft`)} \u2014 ${Z(`CtrlOrCmd+Shift+Left`)}`,"aria-label":G(`labels.alignLeft`),visible:Ge(nc(e),t)})}),X({name:`alignRight`,label:`labels.alignRight`,icon:Ub,trackEvent:{category:`element`},predicate:(e,t,n,r)=>oE(t,r),perform:(e,t,n,r)=>({appState:t,elements:sE(e,t,r,{position:`end`,axis:`x`}),captureUpdate:F.IMMEDIATELY}),keyTest:e=>e[L.CTRL_OR_CMD]&&e.shiftKey&&e.key===L.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!oE(t,r),type:`button`,icon:Ub,onClick:()=>n(null),title:`${G(`labels.alignRight`)} \u2014 ${Z(`CtrlOrCmd+Shift+Right`)}`,"aria-label":G(`labels.alignRight`),visible:Ge(nc(e),t)})}),X({name:`alignVerticallyCentered`,label:`labels.centerVertically`,icon:Kb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>oE(t,r),perform:(e,t,n,r)=>({appState:t,elements:sE(e,t,r,{position:`center`,axis:`y`}),captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!oE(t,r),type:`button`,icon:Kb,onClick:()=>n(null),title:G(`labels.centerVertically`),"aria-label":G(`labels.centerVertically`),visible:Ge(nc(e),t)})}),X({name:`alignHorizontallyCentered`,label:`labels.centerHorizontally`,icon:qb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>oE(t,r),perform:(e,t,n,r)=>({appState:t,elements:sE(e,t,r,{position:`center`,axis:`x`}),captureUpdate:F.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!oE(t,r),type:`button`,icon:qb,onClick:()=>n(null),title:G(`labels.centerHorizontally`),"aria-label":G(`labels.centerHorizontally`),visible:Ge(nc(e),t)})});var cE=(e,t)=>{let n=t.scene.getSelectedElements(e);return k(n,t.scene.getNonDeletedElementsMap(),e).length>2&&!n.some(e=>I(e))},lE=(e,t,n,r)=>{let i=ko(jn(n.scene.getSelectedElements(t),n.scene.getNonDeletedElementsMap(),r,t,n.scene));return Rs(e.map(e=>i.get(e.id)||e),t,n)};X({name:`distributeHorizontally`,label:`labels.distributeHorizontally`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:lE(e,t,r,{space:`between`,axis:`x`}),captureUpdate:F.IMMEDIATELY}),keyTest:e=>!e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.H,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!cE(t,r),type:`button`,icon:Wb,onClick:()=>n(null),title:`${G(`labels.distributeHorizontally`)} \u2014 ${Z(`Alt+H`)}`,"aria-label":G(`labels.distributeHorizontally`),visible:Ge(nc(e),t)})}),X({name:`distributeVertically`,label:`labels.distributeVertically`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:lE(e,t,r,{space:`between`,axis:`y`}),captureUpdate:F.IMMEDIATELY}),keyTest:e=>!e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.V,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,H.jsx)(Y,{hidden:!cE(t,r),type:`button`,icon:Gb,onClick:()=>n(null),title:`${G(`labels.distributeVertically`)} \u2014 ${Z(`Alt+V`)}`,"aria-label":G(`labels.distributeVertically`),visible:Ge(nc(e),t)})});var uE=X({name:`flipHorizontal`,label:`labels.flipHorizontal`,icon:xS,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Rs(fE(e,r.scene.getNonDeletedElementsMap(),t,`horizontal`,r),t,r),appState:t,captureUpdate:F.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Ye.H}),dE=X({name:`flipVertical`,label:`labels.flipVertical`,icon:bS,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Rs(fE(e,r.scene.getNonDeletedElementsMap(),t,`vertical`,r),t,r),appState:t,captureUpdate:F.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Ye.V&&!e[L.CTRL_OR_CMD]}),fE=(e,t,n,r,i)=>{let a=ko(pE(A(nc(e),n,{includeBoundTextElement:!0,includeElementsInFrames:!0}),t,r,i));return e.map(e=>a.get(e.id)||e)},pE=(e,t,n,r)=>{if(e.every(e=>nt(e)&&(e.startBinding||e.endBinding)))return e.map(e=>{let t=e;return P(t,{startArrowhead:t.endArrowhead,endArrowhead:t.startArrowhead})});let{midX:i,midY:a}=Ti(e);Lo(e,t,`nw`,r.scene,new Map(Array.from(t.values()).map(e=>[e.id,w(e)])),{flipByX:n===`horizontal`,flipByY:n===`vertical`,shouldResizeFromCenter:!0,shouldMaintainAspectRatio:!0}),Ws(e.filter(nt),r.scene,r.state);let{elbowArrows:o,otherElements:s}=e.reduce((e,t)=>Tr(t)?{...e,elbowArrows:e.elbowArrows.concat(t)}:{...e,otherElements:e.otherElements.concat(t)},{elbowArrows:[],otherElements:[]}),{midX:c,midY:l}=Ti(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},mE=X({name:`copy`,label:`labels.copy`,icon:lb,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await hT(i,r.files,n)}catch(e){return{captureUpdate:F.EVENTUALLY,appState:{...t,errorMessage:e.message}}}return{captureUpdate:F.EVENTUALLY}},keyTest:void 0}),hE=X({name:`paste`,label:`labels.paste`,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i;try{i=await vT()}catch(e){return e.name===`AbortError`||e.name===`NotAllowedError`?!1:(console.error(`actionPaste ${e.name}: ${e.message}`),Dr?{captureUpdate:F.EVENTUALLY,appState:{...t,errorMessage:G(`hints.firefox_clipboard_write`)}}:{captureUpdate:F.EVENTUALLY,appState:{...t,errorMessage:G(`errors.asyncPasteFailedOnRead`)}})}try{r.pasteFromClipboard(pT({types:i}))}catch(e){return console.error(e),{captureUpdate:F.EVENTUALLY,appState:{...t,errorMessage:G(`errors.asyncPasteFailedOnParse`)}}}return{captureUpdate:F.EVENTUALLY}},keyTest:void 0}),gE=X({name:`cut`,label:`labels.cut`,icon:Jx,trackEvent:{category:`element`},perform:(e,t,n,r)=>(mE.perform(e,t,n,r),ZS.perform(e,t,null,r)),keyTest:e=>e[L.CTRL_OR_CMD]&&e.key===L.X}),_E=X({name:`copyAsSvg`,label:`labels.copyAsSvg`,icon:wS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:F.EVENTUALLY};let{exportedElements:i,exportingFrame:a}=AT(e,t,!0);try{return await jT(`clipboard-svg`,i,t,r.files,{...t,exportingFrame:a,name:r.getName()}),{appState:{toast:{message:G(`toast.copyToClipboardAsSvg`,{exportSelection:r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).length?G(`toast.selection`):G(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?G(`buttons.darkMode`):G(`buttons.lightMode`)})}},captureUpdate:F.EVENTUALLY}}catch(e){return console.error(e),{appState:{errorMessage:e.message},captureUpdate:F.EVENTUALLY}}},predicate:e=>uT&&e.length>0,keywords:[`svg`,`clipboard`,`copy`]}),vE=X({name:`copyAsPng`,label:`labels.copyAsPng`,icon:TS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:F.EVENTUALLY};let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:a,exportingFrame:o}=AT(e,t,!0);try{return await jT(`clipboard`,a,t,r.files,{...t,exportingFrame:o,name:r.getName()}),{appState:{...t,toast:{message:G(`toast.copyToClipboardAsPng`,{exportSelection:i.length?G(`toast.selection`):G(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?G(`buttons.darkMode`):G(`buttons.lightMode`)})}},captureUpdate:F.EVENTUALLY}}catch(e){return console.error(e),{appState:{...t,errorMessage:e.message},captureUpdate:F.EVENTUALLY}}},predicate:e=>dT&&e.length>0,keyTest:e=>e.code===Ye.C&&e.altKey&&e.shiftKey,keywords:[`png`,`clipboard`,`copy`]}),yE=X({name:`copyText`,label:`labels.copyText`,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});try{DT(bi(i))}catch{throw Error(G(`errors.copyToSystemClipboardFailed`))}return{captureUpdate:F.EVENTUALLY}},predicate:(e,t,n,r)=>uT&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(M),keywords:[`text`,`clipboard`,`copy`]}),bE=X({name:`gridMode`,icon:AS,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:F.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[L.CTRL_OR_CMD]&&e.code===Ye.QUOTE}),xE=X({name:`zenMode`,label:`buttons.zenMode`,icon:DS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},captureUpdate:F.EVENTUALLY}},checked:e=>e.zenModeEnabled,predicate:(e,t,n,r)=>r.editorInterface.formFactor!==`phone`&&typeof n.zenModeEnabled>`u`,keyTest:e=>!e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.Z}),SE=X({name:`objectsSnapMode`,label:`buttons.objectsSnapMode`,icon:ES,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridModeEnabled:!1},captureUpdate:F.EVENTUALLY}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,n)=>typeof n.objectsSnapModeEnabled>`u`,keyTest:e=>!e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.S}),CE=X({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:F.NEVER}},checked:e=>e.bindingPreference===`enabled`}),wE=X({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:F.NEVER}},checked:e=>e.isMidpointSnappingEnabled}),TE=X({name:`stats`,label:`stats.fullTitle`,icon:yS,viewMode:!0,trackEvent:{category:`menu`},keywords:[`edit`,`attributes`,`customize`],perform(e,t){return{appState:{...t,stats:{...t.stats,open:!this.checked(t)}},captureUpdate:F.EVENTUALLY}},checked:e=>e.stats.open,keyTest:e=>!e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.SLASH}),EE=X({name:`unbindText`,label:`labels.unbindText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>r.scene.getSelectedElements(t).some(e=>ys(e)),perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=r.scene.getNonDeletedElementsMap();return i.forEach(e=>{let t=bn(e,a);if(t){let{width:n,height:i}=zi(t.originalText,ao(t),t.lineHeight),o=js(e.id);fn(e.id);let{x:s,y:c}=Es(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:F.IMMEDIATELY}}}),DE=X({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(O(i[0])?t=i[0]:O(i[1])&&(t=i[1]),e&&t&&bn(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])&&O(i[1])?(a=i[0],o=i[1]):(a=i[1],o=i[0]),r.scene.mutateElement(a,{containerId:o.id,verticalAlign:ns.MIDDLE,textAlign:ya.CENTER,autoResize:!0,angle:nt(o)?0:o?.angle??0}),r.scene.mutateElement(o,{boundElements:(o.boundElements||[]).concat({type:`text`,id:a.id})});let s=o.height;return Gr(a,o,r.scene),mo(o.id,s),{elements:OE(e,o,a),appState:{...t,selectedElementIds:{[o.id]:!0}},captureUpdate:F.IMMEDIATELY}}}),OE=(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),xr(r,ko([t,n])),r},kE=(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),xr(r,ko([t,n])),r},AE=X({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)&&!Ra(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)&&!Ra(e)){let n=_({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:Bn(`rectangle`)?fo.ADAPTIVE_RADIUS:fo.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:e.x-5,y:e.y-5,width:Nt(e.width,`rectangle`),height:Nt(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:ns.MIDDLE,boundElements:null,textAlign:ya.CENTER,autoResize:!0}),Gr(e,n,r.scene),a=kE([...a,n],n,e),o[n.id]=!0}return{elements:a,appState:{...t,selectedElementIds:o},captureUpdate:F.IMMEDIATELY}}}),jE=380,ME=42,NE=5,PE=85,FE=500,IE=!1,LE=new Map,RE=({element:e,scene:t,setAppState:n,onLinkOpen:r,setToast:i,updateEmbedValidationStatus:a})=>{let o=t.getNonDeletedElementsMap(),s=_z(),c=fz(),l=pz(),u=e.link||``,[d,f]=(0,V.useState)(u),p=(0,V.useRef)(null),m=s.showHyperlinkPopup===`editor`,g=(0,V.useCallback)(()=>{if(!p.current)return;let r=Vn(p.current.value)||null;if(!e.link&&r&&aC(`hyperlink`,`create`),qs(e)){if(s.activeEmbeddable?.element===e&&n({activeEmbeddable:null}),!r){t.mutateElement(e,{link:null}),a(e,!1);return}if(!h(r,c.validateEmbeddable))r&&i({message:G(`toast.unableToEmbed`),closable:!0}),e.link&&LE.set(e.id,e.link),t.mutateElement(e,{link:r}),a(e,!1);else{let{width:n,height:o}=e,s=Ao(r);s?.error instanceof URIError&&i({message:G(`toast.unrecognizedLinkFormat`),closable:!0});let c=s?s.intrinsicSize.w/s.intrinsicSize.h:1,l=LE.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),LE.has(e.id)&&LE.delete(e.id)}}else t.mutateElement(e,{link:r})},[e,t,i,c.validateEmbeddable,s.activeEmbeddable,n,a]);(0,V.useLayoutEffect)(()=>()=>{g()},[g]),(0,V.useEffect)(()=>{m&&p?.current&&!(l.formFactor===`phone`||l.isTouchScreen)&&p.current.select()},[m,l.formFactor,l.isTouchScreen]),(0,V.useEffect)(()=>{let t=null,r=r=>{m||(t&&clearTimeout(t),GE(e,o,s,N(r.clientX,r.clientY))&&(t=window.setTimeout(()=>{n({showHyperlinkPopup:!1})},FE)))};return window.addEventListener(j.POINTER_MOVE,r,!1),()=>{window.removeEventListener(j.POINTER_MOVE,r,!1),t&&clearTimeout(t)}},[s,e,m,n,o]);let _=(0,V.useCallback)(()=>{aC(`hyperlink`,`delete`),t.mutateElement(e,{link:null}),n({showHyperlinkPopup:!1})},[n,e,t]),v=()=>{aC(`hyperlink`,`edit`,`popup-ui`),n({showHyperlinkPopup:`editor`})},{x:y,y:b}=zE(e,s,o);return s.contextMenu||s.selectedElementsAreBeingDragged||s.resizingElement||s.isRotating||s.openMenu||s.viewModeEnabled?null:(0,H.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer`,style:{top:`${b}px`,left:`${y}px`,width:jE,padding:NE},children:[m?(0,H.jsx)(`input`,{className:U(`excalidraw-hyperlinkContainer-input`),placeholder:G(`labels.link.hint`),ref:p,value:d,onChange:e=>f(e.target.value),autoFocus:!0,onKeyDown:e=>{e.stopPropagation(),e[L.CTRL_OR_CMD]&&e.key===L.K&&e.preventDefault(),(e.key===L.ENTER||e.key===L.ESCAPE)&&(g(),n({showHyperlinkPopup:`info`}))}}):e.link?(0,H.jsx)(`a`,{href:Vn(e.link||``),className:`excalidraw-hyperlinkContainer-link`,target:so(e.link)?`_self`:`_blank`,onClick:t=>{if(e.link&&r){let n=$i(j.EXCALIDRAW_LINK,t.nativeEvent);r({...e,link:Vn(e.link)},n),n.defaultPrevented&&t.preventDefault()}},rel:`noopener noreferrer`,children:e.link}):(0,H.jsx)(`div`,{className:`excalidraw-hyperlinkContainer-link`,children:G(`labels.link.empty`)}),(0,H.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer__buttons`,children:[!m&&(0,H.jsx)(Y,{type:`button`,title:G(`buttons.edit`),"aria-label":G(`buttons.edit`),label:G(`buttons.edit`),onClick:v,className:`excalidraw-hyperlinkContainer--edit`,icon:$y}),(0,H.jsx)(Y,{type:`button`,title:G(`labels.linkToElement`),"aria-label":G(`labels.linkToElement`),label:G(`labels.linkToElement`),onClick:()=>{n({openDialog:{name:`elementLinkSelector`,sourceElementId:e.id}})},icon:zS}),u&&!qs(e)&&(0,H.jsx)(Y,{type:`button`,title:G(`buttons.remove`),"aria-label":G(`buttons.remove`),label:G(`buttons.remove`),onClick:_,className:`excalidraw-hyperlinkContainer--remove`,icon:sb})]})]})},zE=(e,t,n)=>{let[r,i]=si(e,n),{x:a,y:o}=Qa({sceneX:r+e.width/2,sceneY:i},t);return{x:a-t.offsetLeft-jE/2,y:o-t.offsetTop-PE}},BE=(e,t)=>{let n=A(e,t);return qs(n[0])?`labels.link.editEmbed`:n[0]?.link?`labels.link.edit`:`labels.link.create`},VE=null,HE=(e,t,n)=>{VE&&clearTimeout(VE),VE=window.setTimeout(()=>UE(e,t,n),300)},UE=(e,t,n)=>{if(!e.link)return;let r=Aw();r.classList.add(`excalidraw-tooltip--visible`),r.style.maxWidth=`20rem`,r.textContent=ke(e.link)?G(`labels.link.goToElement`):e.link;let[i,a,o,s]=si(e,n),[c,l,u,d]=$r([i,a,o,s],e.angle,t),f=Qa({sceneX:c,sceneY:l},t);jw(r,{left:f.x,top:f.y,width:u,height:d},`top`),aC(`hyperlink`,`tooltip`,`link-icon`),IE=!0},WE=()=>{VE&&clearTimeout(VE),IE&&(IE=!1,Aw().classList.remove(`excalidraw-tooltip--visible`))},GE=(e,t,n,[r,i])=>{let{x:a,y:o}=Xo({clientX:r,clientY:i},n),s=15/n.zoom.value;if(Ot(N(a,o),e,t))return!1;let[c,l,u]=si(e,t);if(a>=c&&a<=u&&o>=l-PE&&o<=l)return!1;let{x:d,y:f}=zE(e,n,t);return!(r>=d-s&&r<=d+jE+NE*2+s&&i>=f-s&&i<=f+s+NE*2+ME)},KE=X({name:`hyperlink`,label:(e,t)=>BE(e,t),icon:xb,perform:(e,t)=>t.showHyperlinkPopup===`editor`?!1:{elements:e,appState:{...t,showHyperlinkPopup:`editor`,openMenu:null},captureUpdate:F.IMMEDIATELY},trackEvent:{category:`hyperlink`,action:`click`},keyTest:e=>e[L.CTRL_OR_CMD]&&e.key===L.K,predicate:(e,t)=>A(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=A(e,t);return(0,H.jsx)(Y,{type:`button`,icon:xb,"aria-label":G(BE(e,t)),title:`${qs(e[0])?G(`labels.link.labelEmbed`):G(`labels.link.label`)} - ${Z(`CtrlOrCmd+K`)}`,onClick:()=>n(null),selected:r.length===1&&!!r[0].link})}}),qE=e=>e.every(e=>!e.locked),JE=X({name:`toggleElementLock`,label:(e,t,n)=>qE(n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}))?`labels.elementLock.lock`:`labels.elementLock.unlock`,icon:(e,t)=>qE(A(t,e))?By:zy,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=qE(i),o=ko(i),s=i.length>1&&Kn(i),c=i.length===1||s?null:da(),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]),P(e,{locked:a,groupIds:n.length===e.groupIds.length?e.groupIds:n})}),d=ko(u),f=a?{}:Object.fromEntries(i.map(e=>[e.id,!0])),p=i.map(e=>d.get(e.id)||e),m=a?{}:Rr(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:F.IMMEDIATELY}},keyTest:(e,t,n,r)=>e.key.toLocaleLowerCase()===L.L&&e[L.CTRL_OR_CMD]&&e.shiftKey&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),YE=X({name:`unlockAllElements`,trackEvent:{category:`canvas`},viewMode:!1,icon:zy,predicate:(e,t)=>A(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 P(e,{locked:!1,groupIds:e.groupIds.length===n.length?e.groupIds:n})}return e}),i=ko(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:Rr(a,t),lockedMultiSelections:{},activeLockedId:null},captureUpdate:F.IMMEDIATELY}},label:`labels.elementLock.unlockAll`}),XE=8,ZE=10,QE=[`rectangle`,`diamond`,`ellipse`],$E=[`line`,`sharpArrow`,`curvedArrow`,`elbowArrow`],eD=new Set(QE),tD=new Set($E),nD=e=>eD.has(e),rD=e=>e===`arrow`||tD.has(e),iD=pc(null),aD=new Map,oD=new Map,sD=({app:e})=>{let t=e.scene.getSelectedElements(e.state),n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(t.length===0){e.updateEditorAtom(iD,null);return}let r=dD(t);r&&!n.current?n.current=r:(n.current&&!r||n.current&&r!==n.current)&&(e.updateEditorAtom(iD,null),n.current=null)},[t,e]),(0,V.useEffect)(()=>()=>{aD.clear(),oD.clear()},[]),(0,H.jsx)(cD,{app:e,elements:t})},cD=({app:e,elements:t})=>{let n=dD(t),r=(0,V.useMemo)(()=>n===`generic`?mD(t):[],[n,t]),i=(0,V.useMemo)(()=>n===`linear`?hD(t):[],[n,t]),a=n===`generic`?r.every(e=>e.type===r[0].type):n===`linear`?i.every(e=>ea(e)===ea(i[0])):!1,[o,s]=(0,V.useState)({x:0,y:0}),c=(0,V.useRef)(``),l=(0,V.useRef)(null);(0,V.useEffect)(()=>{let t=[...r,...i].sort((e,t)=>e.id.localeCompare(t.id)),n=`
46
- ${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]=si(t[0],e.scene.getNonDeletedElementsMap());a=z(N(n,r),N(i,o),t[0].angle)}else{let{minX:e,maxY:n}=Ti(t);a=N(e,n)}let{x:o,y:l}=Qa({sceneX:a[0],sceneY:a[1]},e.state);s({x:o,y:l})},[r,i,e.scene,e.state]),(0,V.useEffect)(()=>{for(let e of i){let t=pD(e.id,wD(e));oD.has(t)||oD.set(t,e)}},[i]),(0,V.useEffect)(()=>{for(let t of r)if(!aD.has(t.id)){let n=bn(t,e.scene.getNonDeletedElementsMap());n&&aD.set(t.id,{fontSize:n.fontSize})}},[r,e.scene]);let u=n===`linear`?[[`line`,Zy],[`sharpArrow`,MS],[`curvedArrow`,PS],[`elbowArrow`,NS]]:n===`generic`?[[`rectangle`,qy],[`diamond`,Jy],[`ellipse`,Yy]]:[];return(0,H.jsx)(`div`,{ref:l,tabIndex:-1,style:{position:`absolute`,top:`${o.y+(ZE+8)*e.state.zoom.value-e.state.offsetTop}px`,left:`${o.x-e.state.offsetLeft-XE}px`,zIndex:2},className:Po.CONVERT_ELEMENT_TYPE_POPUP,children:u.map(([o,s])=>(0,H.jsx)(Y,{className:`Shape`,type:`radio`,icon:s,checked:a&&(n===`generic`&&r[0].type===o||n===`linear`&&ea(i[0])===o),name:`convertElementType-option`,title:o,keyBindingLabel:``,"aria-label":o,"data-testid":`toolbar-${o}`,onChange:()=>{e.state.activeTool.type!==o&&aC(`convertElementType`,o,`ui`),uD(e,{conversionType:n,nextType:o}),l.current?.focus()}},`${t[0].id}${t[0].version}_${o}`))})},lD=(e,t,n)=>{let r=yr(e,t),i=nn(e,t),a=zi(Sa(t.text,ao(t),r),ao(t),t.lineHeight),o=t.fontSize;for(;(a.width>r||a.height>i)&&o>0;){--o;let e={...t,fontSize:o};a=zi(t.text,ao(e),t.lineHeight)}ge(t,n.getNonDeletedElementsMap(),{fontSize:o,width:a.width,height:a.height}),Gr(t,e,n)},uD=(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=mD(i),r=t.every(e=>e.type===t[0].type)?QE.indexOf(t[0].type):-1;if(n??=QE[(r+QE.length+o)%QE.length],n&&nD(n)){let r={};for(let i of t){let t=SD(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=bn(t,e.scene.getNonDeletedElementsMap());n&&(aD.get(t.id)&&ge(n,e.scene.getNonDeletedElementsMap(),{fontSize:aD.get(t.id)?.fontSize??n.fontSize}),lD(t,n,e.scene))}e.setState(e=>({selectedElementIds:a,activeTool:Vt(e,{type:`selection`})}))}}if(t===`linear`){let t=hD(i);if(!n){let e=tc(t,ea);n=$E[((e?$E.indexOf(e):-1)+$E.length+o)%$E.length]}if(rD(n)){let r=[],i=e.scene.getElementsMapIncludingDeleted();for(let a of t){let t=oD.get(pD(a.id,n));if(t&&ea(t)===n)i.set(t.id,t),r.push(t);else{let t=SD(a,n,e);i.set(t.id,t),r.push(t)}}e.scene.replaceAllElements(i);for(let t of r)if(Bo(t))if(Tr(t)){let n=bD(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=$o(t,e.scene.getNonDeletedElementsMap(),{points:n,fixedSegments:r});ge(t,e.scene.getNonDeletedElementsMap(),{...i,endArrowhead:`arrow`})}else{let n=Oe([`line`,`sharpArrow`,`curvedArrow`],e=>oD.get(pD(t.id,e)));if(n){let r=n.points;e.scene.mutateElement(t,{points:r})}}}let r=hD(e.scene.getSelectedElements(e.state));e.setState(t=>({selectedElementIds:a,selectedLinearElement:r.length===1?new B(r[0],e.scene.getNonDeletedElementsMap()):null,activeTool:Vt(t,{type:`selection`})}))}return!0},dD=e=>{if(e.length===0)return null;let t=!1;for(let n of e){if(nD(n.type))return`generic`;fD(n)&&(t=!0)}return t?`linear`:null},fD=e=>Bo(e)&&(!nt(e)||!wn(e)&&!ys(e)),pD=(e,t)=>`${e}:${t}`,mD=e=>e.filter(e=>nD(e.type)),hD=e=>e.filter(e=>fD(e)),gD=20,_D=(e,t)=>e[0]===t[0],vD=(e,t)=>e[1]===t[1],yD=(e,t)=>_D(e,t)?Math.abs(e[1]-t[1]):Math.abs(e[0]-t[0]),bD=e=>{let t=[e.points[0]],n=xD(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])<gD?i[0]=r[0]:Math.abs(i[1]-r[1])<gD&&(i[1]=r[1]),_D(r,i)||vD(r,i)||t.push(N(r[0],i[1])),t.push(i)}let r=[t[0]];for(let e=1;e<t.length-1;++e)_D(t[e-1],t[e])&&_D(t[e],t[e+1])||vD(t[e-1],t[e])&&vD(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=_D(t,n),s=_D(n,a);if(o!==s){let e=yD(t,n),r=yD(n,a);if(e<gD||r<gD){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},xD=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},SD=(e,t,n)=>{if(!CD(e.type,t)){if(!Ha())throw Error(`Invalid conversion from ${e.type} to ${t}.`);return e}if(e.type===t)return e;if(Yo.delete(e),nD(t)){let r=Ki(_({...e,type:t,roundness:t===`diamond`&&e.roundness?{type:Bn(t)?fo.ADAPTIVE_RADIUS:fo.PROPORTIONAL_RADIUS}:e.roundness}));return mn(r,n.scene,n.state),r}if(rD(t))switch(t){case`line`:return Ki(Te({...e,type:`line`}));case`sharpArrow`:return Ki(is({...e,type:`arrow`,elbowed:!1,roundness:null,startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`curvedArrow`:return Ki(is({...e,type:`arrow`,elbowed:!1,roundness:{type:fo.PROPORTIONAL_RADIUS},startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`elbowArrow`:return Ki(is({...e,type:`arrow`,elbowed:!0,fixedSegments:null,roundness:null}))}return Oi(t,`unhandled conversion type: ${t}`),e},CD=(e,t)=>!!(nD(e)&&nD(t)||rD(e)&&rD(t)),wD=e=>Bo(e)?ea(e):e.type,TD=sD,ED=X({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 _y.set(iD,{type:`panel`}),{captureUpdate:F.NEVER}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>dD(e)!==null}),DD=X({name:`copyElementLink`,label:`labels.copyElementLink`,icon:qx,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=A(e,t);try{if(window.location){let n=Ui(i,t);return n?(await DT(r.props.generateLinkForSelection?r.props.generateLinkForSelection(n.id,n.type):xt(n.id,n.type)),{appState:{toast:{message:G(`toast.elementLinkCopied`),closable:!0}},captureUpdate:F.EVENTUALLY}):{appState:t,elements:e,app:r,captureUpdate:F.EVENTUALLY}}}catch(e){console.error(e)}return{appState:t,elements:e,app:r,captureUpdate:F.EVENTUALLY}},predicate:(e,t)=>Ko(A(e,t))}),OD=X({name:`linkToElement`,label:`labels.linkToElement`,icon:zS,perform:(e,t,n,r)=>{let i=A(e,t);return i.length!==1||!Ko(i)?{elements:e,appState:t,app:r,captureUpdate:F.EVENTUALLY}:{appState:{...t,openDialog:{name:`elementLinkSelector`,sourceElementId:A(e,t)[0].id}},captureUpdate:F.IMMEDIATELY}},predicate:(e,t,n,r)=>{let i=A(e,t);return t.openDialog?.name!==`elementLinkSelector`&&i.length===1&&Ko(i)},trackEvent:!1}),kD={toggleTheme:[Z(`Shift+Alt+D`)],saveScene:[Z(`CtrlOrCmd+S`)],loadScene:[Z(`CtrlOrCmd+O`)],clearCanvas:[Z(`CtrlOrCmd+Delete`)],imageExport:[Z(`CtrlOrCmd+Shift+E`)],commandPalette:[Z(`CtrlOrCmd+/`),Z(`CtrlOrCmd+Shift+P`)],cut:[Z(`CtrlOrCmd+X`)],copy:[Z(`CtrlOrCmd+C`)],paste:[Z(`CtrlOrCmd+V`)],copyStyles:[Z(`CtrlOrCmd+Alt+C`)],pasteStyles:[Z(`CtrlOrCmd+Alt+V`)],selectAll:[Z(`CtrlOrCmd+A`)],deleteSelectedElements:[Z(`Delete`)],duplicateSelection:[Z(`CtrlOrCmd+D`),Z(`Alt+${G(`helpDialog.drag`)}`)],sendBackward:[Z(`CtrlOrCmd+[`)],bringForward:[Z(`CtrlOrCmd+]`)],sendToBack:[Z(Wi?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)],bringToFront:[Z(Wi?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)],copyAsPng:[Z(`Shift+Alt+C`)],group:[Z(`CtrlOrCmd+G`)],ungroup:[Z(`CtrlOrCmd+Shift+G`)],gridMode:[Z(`CtrlOrCmd+'`)],zenMode:[Z(`Alt+Z`)],objectsSnapMode:[Z(`Alt+S`)],stats:[Z(`Alt+/`)],addToLibrary:[],flipHorizontal:[Z(`Shift+H`)],flipVertical:[Z(`Shift+V`)],viewMode:[Z(`Alt+R`)],hyperlink:[Z(`CtrlOrCmd+K`)],toggleElementLock:[Z(`CtrlOrCmd+Shift+L`)],resetZoom:[Z(`CtrlOrCmd+0`)],zoomOut:[Z(`CtrlOrCmd+-`)],zoomIn:[Z(`CtrlOrCmd++`)],zoomToFitSelection:[Z(`Shift+3`)],zoomToFit:[Z(`Shift+1`)],zoomToFitSelectionInViewport:[Z(`Shift+2`)],toggleEraserTool:[Z(`E`)],toggleHandTool:[Z(`H`)],setFrameAsActiveTool:[Z(`F`)],saveFileToDisk:[Z(`CtrlOrCmd+S`)],saveToActiveFile:[Z(`CtrlOrCmd+S`)],toggleShortcuts:[Z(`?`)],searchMenu:[Z(`CtrlOrCmd+F`)],wrapSelectionInFrame:[],toolLock:[Z(`Q`)]},AD=(e,t=0)=>{let n=kD[e];return n&&n.length>0?n[t]||n[0]:``},jD=RegExp(`[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]`,`g`),MD=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ND={À:`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`},PD=e=>e.replace(MD,e=>ND[e]||e).replace(jD,``),FD=()=>{let[e,t]=(0,V.useState)(null);return[e,(0,V.useCallback)(e=>t(e),[])]},ID=({elements:e,appState:t,files:n,maxWidthOrHeight:r,getDimensions:i,exportPadding:a,exportingFrame:o})=>{let s=ka(e,null,{deleteInvisibleElements:!0}),c=Sr(t,null),{exportBackground:l,viewBackgroundColor:u}=c;return ie(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}})},LD=async({elements:e,appState:t=vs(),files:n={},exportPadding:r,renderEmbeddables:i,exportingFrame:a,skipInliningFonts:o,reuseImages:s})=>xe(ka(e,null,{deleteInvisibleElements:!0}),{...Sr(t,null),exportPadding:r},n,{exportingFrame:a,renderEmbeddables:i,skipInliningFonts:o,reuseImages:s}),RD=pc(new Map),zD=async e=>await LD({elements:e,appState:{exportBackground:!1,viewBackgroundColor:Mi.white},files:null,renderEmbeddables:!1,skipInliningFonts:!0}),BD=(e,t,n,r)=>{let[i,a]=(0,V.useState)();return(0,V.useEffect)(()=>{if(t)if(e){let r=n.get(e);r?a(r):(async()=>{let r=await zD(t);r.querySelector(`.style-fonts`)?.remove(),r&&(n.set(e,r),a(r))})()}else (async()=>{a(await zD(t))})()},[e,t,n,a]),(0,V.useEffect)(()=>{let e=r.current;if(e)return i&&(e.innerHTML=i.outerHTML),()=>{e.innerHTML=``}},[i,r]),i},VD=()=>{let[e]=fy(RD);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:t=>{t.forEach(t=>e.delete(t))},svgCache:e}},HD=new ht,UD=pc({status:`loaded`,isInitialized:!1,libraryItems:[]}),WD=e=>As(e),GD=(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),KD=(e,t)=>{let n=[];for(let r of t)GD(e,r)&&n.push(r);return[...n,...e]},qD=(e,t)=>{let n=ko(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=ko(e);for(let e of t){let t=i.get(e.id);t?ZD(t)!==ZD(e)&&r.updatedItems.set(e.id,e):r.addedItems.set(e.id,e)}return r},JD=class{constructor(e){i(this,`currLibraryItems`,[]),i(this,`prevLibraryItems`,WD(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)_y.set(UD,e=>({status:`loading`,libraryItems:this.currLibraryItems,isInitialized:e.isInitialized}));else{_y.set(UD,{status:`loaded`,libraryItems:this.currLibraryItems,isInitialized:!0});try{let e=this.prevLibraryItems;this.prevLibraryItems=WD(this.currLibraryItems);let t=WD(this.currLibraryItems);this.app.props.onLibraryChange?.(t),HD.trigger(qD(e,t),t)}catch(e){console.error(e)}}}),i(this,`destroy`,()=>{this.updateQueue=[],this.currLibraryItems=[],_y.set(RD,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(WD(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:ne.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 Qt(o,i):Un(o,i),!t||window.confirm(G(`alerts.confirmAddLibrary`,{numShapes:s.length}))?(t&&this.app.focusContainer(),r(n?KD(this.currLibraryItems,s):s)):a(new T)}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=WD(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}},YD=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}=Ti(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}=Ti(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}=Ti(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},XD=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(Un((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(XD,`queue`,new ta),i(XD,`run`,async(e,t)=>{let n=new XD(e);return XD.queue.push(()=>t(n))});var ZD=e=>`${e.id}:${e.name||``}:${vo(e.elements)}`,QD=({theme:e,id:t,libraryReturnUrl:n})=>{let i=n||window.location.origin+window.location.pathname;return(0,H.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=${ma.excalidrawLibrary}`,target:`_excalidraw_libraries`,children:G(`labels.libraries`)})},$D=({libraryReturnUrl:e,theme:t,id:n,style:r,children:i,className:a})=>(0,H.jsxs)(`div`,{className:U(`library-menu-control-buttons`,a),style:r,children:[(0,H.jsx)(QD,{id:n,libraryReturnUrl:e,theme:t}),i]}),eO=pc(0),tO=e=>{let[t,n]=fy(eO);return(0,V.useEffect)(()=>{let{current:t}=e;if(!t)return;let r=(0,dc.default)(()=>{let{scrollTop:e}=t;n(e)},200);return t.addEventListener(`scroll`,r),()=>{r.cancel(),t.removeEventListener(`scroll`,r)}},[e,n]),t},nO=({label:e,onClick:t,className:n,children:r,actionType:i,type:a=`button`,isLoading:o,...s})=>(0,H.jsxs)(`button`,{className:U(`Dialog__action-button`,i?`Dialog__action-button--${i}`:``,n),type:a,"aria-label":e,onClick:t,...s,children:[r&&(0,H.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:r}),(0,H.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:e}),o&&(0,H.jsx)(`div`,{style:{position:`absolute`,inset:0},children:(0,H.jsx)(qS,{})})]}),rO=e=>{let{onConfirm:t,onCancel:n,children:r,confirmText:i=G(`buttons.confirm`),cancelText:a=G(`buttons.cancel`),className:o=``,...s}=e,c=vz(),l=py($O),{container:u}=hz();return(0,H.jsxs)(sk,{onCloseRequest:n,size:`small`,...s,className:`confirm-dialog ${o}`,children:[r,(0,H.jsxs)(`div`,{className:`confirm-dialog-buttons`,children:[(0,H.jsx)(nO,{label:a,onClick:()=>{c({openMenu:null}),l(!1),(0,lc.flushSync)(()=>{n()}),u?.focus()}}),(0,H.jsx)(nO,{label:i,onClick:()=>{c({openMenu:null}),l(!1),(0,lc.flushSync)(()=>{t()}),u?.focus()},actionType:`danger`})]})]})},iO=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(iO,`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(iO,`delete`,e=>{try{window.localStorage.removeItem(e)}catch(e){console.warn(`localStorage.removeItem error: ${e.message}`)}});var aO=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,oO=/{{([\w-]+)}}/,sO=/<([\w-]+)>/,cO=/<\/([\w-]+)>/,lO=(e,t)=>{let n=[{name:``,children:[]}];return e.split(aO).filter(Boolean).forEach(r=>{let i=r.match(sO),a=r.match(cO),o=r.match(oO);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=V.createElement(V.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},uO=({i18nKey:e,children:t,...n})=>{let{t:r}=ky();return V.createElement(V.Fragment,{},...lO(r(e),n))},dO=async e=>{let t=vr(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 ID({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 Ut(new File([await or(n)],`preview`,{type:Vs.png}),{outputType:Vs.jpg,maxWidthOrHeight:5e3})},fO=({libItem:e,appState:t,index:n,onChange:r,onRemove:i})=>{let a=(0,V.useRef)(null),o=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let n=a.current;n&&(async()=>{n.innerHTML=(await LD({elements:e.elements,appState:{...t,viewBackgroundColor:`#fff`,exportBackground:!0},files:null,skipInliningFonts:!0})).outerHTML})()},[e.elements,t]),(0,H.jsxs)(`div`,{className:`single-library-item`,children:[e.status===`published`&&(0,H.jsx)(`span`,{className:`single-library-item-status`,children:G(`labels.statusPublished`)}),(0,H.jsx)(`div`,{ref:a,className:`single-library-item__svg`}),(0,H.jsx)(Y,{"aria-label":G(`buttons.remove`),type:`button`,icon:Xb,className:`single-library-item--remove`,onClick:i.bind(null,e.id),title:G(`buttons.remove`)}),(0,H.jsxs)(`div`,{style:{display:`flex`,margin:`0.8rem 0`,width:`100%`,fontSize:`14px`,fontWeight:500,flexDirection:`column`},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,justifyContent:`space-between`,flexDirection:`column`},children:[(0,H.jsxs)(`div`,{style:{padding:`0.5em 0`},children:[(0,H.jsx)(`span`,{style:{fontWeight:500,color:`#868e96`},children:G(`publishDialog.itemName`)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,H.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,H.jsx)(`span`,{className:`error`,children:e.error})]})]})},pO=({onClose:e,libraryItems:t,appState:n,onSuccess:i,onError:a,updateItemsInStorage:o,onRemove:s})=>{let[c,l]=(0,V.useState)({authorName:``,githubHandle:``,name:``,description:``,twitterHandle:``,website:``}),[u,d]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let e=iO.get(Qo.PUBLISH_LIBRARY);e&&l(e)},[]);let[f,p]=(0,V.useState)(t.slice());(0,V.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=G(`publishDialog.errors.required`),n=!0),t.push({...e,error:r})}),n){p(t),d(!1);return}let o=await dO(f),s={type:xo.excalidrawLibrary,version:ma.excalidrawLibrary,source:Cr(),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})=>{iO.delete(Qo.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,H.jsx)(`div`,{className:`single-library-item-wrapper`,children:(0,H.jsx)(fO,{libItem:t,appState:n,index:r,onChange:(e,t)=>{let n=f.slice();n[t].name=e,p(n)},onRemove:s})},r))}),(0,H.jsx)(`div`,{className:`selected-library-items`,children:e})},_=(0,V.useCallback)(()=>{o(f),iO.set(Qo.PUBLISH_LIBRARY,c),e()},[f,e,o,c]),v=!!t.length,y=t.some(e=>e.status===`published`);return(0,H.jsx)(sk,{onCloseRequest:_,title:G(`publishDialog.title`),className:`publish-library`,children:v?(0,H.jsxs)(`form`,{onSubmit:h,children:[(0,H.jsx)(`div`,{className:`publish-library-note`,children:(0,H.jsx)(uO,{i18nKey:`publishDialog.noteDescription`,link:e=>(0,H.jsx)(`a`,{href:`https://libraries.excalidraw.com`,target:`_blank`,rel:`noopener`,children:e})})}),(0,H.jsx)(`span`,{className:`publish-library-note`,children:(0,H.jsx)(uO,{i18nKey:`publishDialog.noteGuidelines`,link:e=>(0,H.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries#guidelines`,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,H.jsx)(`div`,{className:`publish-library-note`,children:G(`publishDialog.noteItems`)}),y&&(0,H.jsx)(`span`,{className:`publish-library-note publish-library-warning`,children:G(`publishDialog.republishWarning`)}),g(),(0,H.jsxs)(`div`,{className:`publish-library__fields`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:G(`publishDialog.libraryName`)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,H.jsx)(`input`,{type:`text`,name:`name`,required:!0,value:c.name,onChange:m,placeholder:G(`publishDialog.placeholder.libraryName`)})]}),(0,H.jsxs)(`label`,{style:{alignItems:`flex-start`},children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:G(`publishDialog.libraryDesc`)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,H.jsx)(`textarea`,{name:`description`,rows:4,required:!0,value:c.description,onChange:m,placeholder:G(`publishDialog.placeholder.libraryDesc`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{children:G(`publishDialog.authorName`)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,H.jsx)(`input`,{type:`text`,name:`authorName`,required:!0,value:c.authorName,onChange:m,placeholder:G(`publishDialog.placeholder.authorName`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:G(`publishDialog.githubUsername`)}),(0,H.jsx)(`input`,{type:`text`,name:`githubHandle`,value:c.githubHandle,onChange:m,placeholder:G(`publishDialog.placeholder.githubHandle`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:G(`publishDialog.twitterUsername`)}),(0,H.jsx)(`input`,{type:`text`,name:`twitterHandle`,value:c.twitterHandle,onChange:m,placeholder:G(`publishDialog.placeholder.twitterHandle`)})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`span`,{children:G(`publishDialog.website`)}),(0,H.jsx)(`input`,{type:`text`,name:`website`,pattern:`https?://.+`,title:G(`publishDialog.errors.website`),value:c.website,onChange:m,placeholder:G(`publishDialog.placeholder.website`)})]}),(0,H.jsx)(`span`,{className:`publish-library-note`,children:(0,H.jsx)(uO,{i18nKey:`publishDialog.noteLicense`,link:e=>(0,H.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE`,target:`_blank`,rel:`noopener noreferrer`,children:e})})})]}),(0,H.jsxs)(`div`,{className:`publish-library__buttons`,children:[(0,H.jsx)(nO,{label:G(`buttons.saveLibNames`),onClick:_,"data-testid":`cancel-clear-canvas-button`}),(0,H.jsx)(nO,{type:`submit`,label:G(`buttons.submit`),actionType:`primary`,isLoading:u})]})]}):(0,H.jsx)(`p`,{style:{padding:`1em`,textAlign:`center`,fontWeight:500},children:G(`publishDialog.atleastOneLibItem`)})})},mO={Row:(0,V.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,H.jsx)(`div`,{className:U(`Stack Stack_horizontal`,i),style:{"--gap":t,alignItems:n,justifyContent:r,...a},ref:o,children:e})),Col:(0,V.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,H.jsx)(`div`,{className:U(`Stack Stack_vertical`,i),style:{"--gap":t,justifyItems:n,justifyContent:r,...a},ref:o,children:e}))},hO=({children:e,onClickOutside:t,className:n=``,onSelect:r,open:i=!0,align:a=`end`,style:o})=>{let s=pz(),c=(0,V.useRef)(null),l=pC({onClickOutside:t});fC(c,(0,V.useCallback)(e=>{c.current?.closest(`.${Po.DROPDOWN_MENU_EVENT_WRAPPER}`)?.contains(e.target)||l.onClickOutside?.()},[l])),(0,V.useEffect)(()=>{if(!i)return;let e=e=>{e.key===L.ESCAPE&&(e.stopImmediatePropagation(),l.onClickOutside?.())},t={capture:!0};return document.addEventListener(j.KEYDOWN,e,t),()=>{document.removeEventListener(j.KEYDOWN,e,t)}},[l,i]);let u=U(`dropdown-menu ${n}`,{"dropdown-menu--mobile":s.formFactor===`phone`}).trim();return(0,H.jsx)(qC.Provider,{value:{onSelect:r},children:(0,H.jsx)(i_,{ref:c,className:u,style:o,"data-testid":`dropdown-menu`,align:a,sideOffset:8,onCloseAutoFocus:e=>e.preventDefault(),children:s.formFactor===`phone`?(0,H.jsx)(mO.Col,{className:`dropdown-menu-container`,children:e}):(0,H.jsx)(gC,{className:`dropdown-menu-container`,padding:2,children:e})})})};hO.displayName=`DropdownMenuContent`;var gO=hO,_O=({children:e,className:t=``,selected:n,...r})=>(0,H.jsx)(`div`,{...r,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${n?`dropdown-menu-item--selected`:``}`.trim(),children:e}),vO=({icon:e,shortcut:t,href:n,children:r,onSelect:i,className:a=``,selected:o,rel:s=`noopener`,...c})=>{let l=YC(i);return(0,H.jsx)(a_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,H.jsx)(`a`,{...c,href:n,target:`_blank`,rel:`noopener ${s}`,className:JC(a,o),title:c.title??c[`aria-label`],children:(0,H.jsx)(ZC,{icon:e,shortcut:t,children:r})})})},yO=vO;vO.displayName=`DropdownMenuItemLink`;var bO=()=>(0,H.jsx)(`div`,{style:{height:`1px`,backgroundColor:`var(--default-border-color)`,margin:`6px 0`,flex:`0 0 auto`}}),xO=bO;bO.displayName=`DropdownMenuSeparator`;var SO=-4,CO=4,wO=({children:e,className:t})=>{let n=pz(),r=U(`dropdown-menu dropdown-submenu ${t}`,{"dropdown-menu--mobile":n.formFactor===`phone`}).trim(),i=(0,V.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+SO),c(SO+8))}}},[]),[a,o]=(0,V.useState)(CO),[s,c]=(0,V.useState)(SO);return(0,H.jsx)(c_,{className:r,sideOffset:a,alignOffset:s,collisionPadding:8,ref:i,children:n.formFactor===`phone`?(0,H.jsx)(mO.Col,{className:`dropdown-menu-container`,children:e}):(0,H.jsx)(gC,{className:`dropdown-menu-container`,padding:2,style:{zIndex:1},children:e})})},TO=wO;wO.displayName=`DropdownMenuSubContent`;var EO=({children:e,icon:t,shortcut:n,className:r})=>(0,H.jsxs)(s_,{className:`${JC(r)} dropdown-menu__submenu-trigger`,children:[(0,H.jsx)(ZC,{icon:t,shortcut:n,children:e}),(0,H.jsx)(`div`,{className:`dropdown-menu__submenu-trigger-icon`,children:GS})]}),DO=EO;EO.displayName=`DropdownMenuSubTrigger`;var OO=e=>t=>V.Children.toArray(t).find(t=>V.isValidElement(t)&&typeof t.type!=`string`&&t?.type.displayName&&t.type.displayName===e)||null,kO=OO(`DropdownMenuTrigger`),AO=OO(`DropdownMenuContent`),jO=OO(`DropdownMenuSubTrigger`),MO=OO(`DropdownMenuSubContent`),NO=({children:e})=>{let t=jO(e),n=MO(e);return(0,H.jsxs)(o_,{children:[t,n]})};NO.Trigger=DO,NO.Content=TO,NO.displayName=`DropdownMenuSub`;var PO=NO,FO=({className:e=``,children:t,onToggle:n,title:r,...i})=>{let a=pz(),o=U(`dropdown-menu-button ${e}`,`zen-mode-transition`,{"dropdown-menu-button--mobile":a.formFactor===`phone`}).trim();return(0,H.jsx)(r_,{className:o,onClick:n,type:`button`,"data-testid":`dropdown-menu-button`,title:r,...i,children:t})},IO=FO;FO.displayName=`DropdownMenuTrigger`;var LO=e=>(0,H.jsx)(tw,{...e,icon:e.checked?bb:WS}),RO=({children:e,open:t})=>{let n=kO(e),r=AO(e),i=r&&V.isValidElement(r)?V.cloneElement(r,{open:t}):r;return(0,H.jsx)(n_,{open:t,modal:!1,children:(0,H.jsxs)(`div`,{className:Po.DROPDOWN_MENU_EVENT_WRAPPER,style:{display:`contents`},children:[n,i]})})};RO.Trigger=IO,RO.Content=gO,RO.Item=tw,RO.ItemCheckbox=LO,RO.ItemLink=yO,RO.ItemCustom=_O,RO.Group=KC,RO.Separator=xO,RO.Sub=PO;var Q=RO;RO.displayName=`DropdownMenu`;var zO=(e,t)=>e.filter(e=>t.includes(e.id)),BO=({setAppState:e,selectedItems:t,library:n,onRemoveFromLibrary:r,resetLibrary:i,onSelectItems:a,appState:o,className:s})=>{let[c]=fy(UD),[l,u]=fy($O),d=()=>{let e=t.length?G(`alerts.removeItemsFromsLibrary`,{count:t.length}):G(`alerts.resetLibrary`);return(0,H.jsx)(rO,{onConfirm:()=>{t.length?r():i(),p(!1)},onCancel:()=>{p(!1)},title:t.length?G(`confirmDialog.removeItemsFromLib`):G(`confirmDialog.resetLibrary`),children:(0,H.jsx)(`p`,{children:e})})},[f,p]=(0,V.useState)(!1),m=!!t.length,h=m?c.libraryItems.filter(e=>t.includes(e.id)):c.libraryItems,g=G(m?`buttons.remove`:`buttons.resetLibrary`),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),x=(0,V.useCallback)(()=>(0,H.jsxs)(sk,{onCloseRequest:()=>b(null),title:G(`publishSuccessDialog.title`),className:`publish-library-success`,size:`small`,children:[(0,H.jsx)(`p`,{children:(0,H.jsx)(uO,{i18nKey:`publishSuccessDialog.content`,authorName:y.authorName,link:e=>(0,H.jsx)(`a`,{href:y?.url,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,H.jsx)(Y,{type:`button`,title:G(`buttons.close`),"aria-label":G(`buttons.close`),label:G(`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)};return(0,H.jsxs)(`div`,{className:U(`library-menu-dropdown-container`,s),children:[(0,H.jsxs)(Q,{open:l,children:[(0,H.jsx)(Q.Trigger,{onToggle:()=>u(!l),children:Fy}),(0,H.jsxs)(Q.Content,{onClickOutside:()=>u(!1),onSelect:()=>u(!1),className:`library-menu`,children:[!m&&(0,H.jsx)(Q.Item,{onSelect:async()=>{try{await n.updateLibrary({libraryItems:es({description:`Excalidraw library files`}),merge:!0,openLibraryMenu:!0})}catch(t){if(t?.name===`AbortError`){console.warn(t);return}e({errorMessage:G(`errors.importLibraryError`)})}},icon:wb,"data-testid":`lib-dropdown--load`,children:G(`buttons.load`)}),!!h.length&&(0,H.jsx)(Q.Item,{onSelect:async()=>{Zi(m?h:await n.getLatestLibrary()).catch(br).catch(t=>{e({errorMessage:t.message})})},icon:pb,"data-testid":`lib-dropdown--export`,children:G(`buttons.export`)}),m&&(0,H.jsx)(Q.Item,{icon:Wx,onSelect:()=>v(!0),"data-testid":`lib-dropdown--remove`,children:G(`buttons.publishLibrary`)}),!!h.length&&(0,H.jsx)(Q.Item,{onSelect:()=>p(!0),icon:sb,children:g})]})]}),t.length>0&&(0,H.jsx)(`div`,{className:`library-actions-counter`,children:t.length}),f&&d(),_&&(0,H.jsx)(pO,{onClose:()=>v(!1),libraryItems:zO(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()]})},VO=({selectedItems:e,onSelectItems:t,className:n})=>{let{library:r}=dz(),{clearLibraryCache:i,deleteItemsFromLibraryCache:a}=VD(),o=uC(),s=vz(),[c]=fy(UD),l=async n=>{let i=n.filter(t=>!e.includes(t.id));r.setLibrary(i).catch(()=>{s({errorMessage:G(`alerts.errorRemovingFromLibrary`)})}),a(e),t([])};return(0,H.jsx)(BO,{appState:o,setAppState:s,selectedItems:e,onSelectItems:t,library:r,onRemoveFromLibrary:()=>l(c.libraryItems),resetLibrary:()=>{r.resetLibrary(),i()},className:n})};function HO(){return[!1,(0,V.useCallback)(e=>e(),[])]}var UO=V.useTransition||HO,WO=(0,V.memo)(({id:e,elements:t,isPending:n,onClick:r,selected:i,onToggle:a,onDrag:o,svgCache:s})=>{let c=(0,V.useRef)(null),l=BD(e,t,s,c),[u,d]=(0,V.useState)(!1),f=pz().formFactor===`phone`,p=n&&(0,H.jsx)(`div`,{className:`library-unit__adder`,children:Py});return(0,H.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,H.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,H.jsx)(iT,{checked:i,onChange:(t,n)=>a(e,n),className:`library-unit__checkbox`})]})}),GO=()=>(0,H.jsx)(`div`,{className:`library-unit library-unit--skeleton`}),KO=({children:e})=>(0,H.jsx)(`div`,{className:`library-menu-items-container__grid`,children:e}),qO=(0,V.memo)(({items:e,onItemSelectToggle:t,onItemDrag:n,isItemSelected:r,onClick:i,svgCache:a,itemsRenderedPerBatch:o})=>{let[,s]=UO(),[c,l]=(0,V.useState)(0);return(0,V.useEffect)(()=>{c<e.length&&s(()=>{l(c+o)})},[c,e.length,s,o]),(0,H.jsx)(H.Fragment,{children:e.map((e,o)=>o<c?(0,H.jsx)(WO,{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,H.jsx)(GO,{},o))})}),JO=({type:e=`button`,onSelect:t,selected:n,children:r,className:i=``,...a})=>(0,H.jsx)(`button`,{onClick:zs(a.onClick,e=>{t()}),type:e,className:U(`excalidraw-button`,i,{selected:n}),...a,children:r}),YO=(0,V.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,V.useRef)(null);(0,V.useImperativeHandle)(f,()=>p.current),(0,V.useLayoutEffect)(()=>{a&&(p.current?.focus(),p.current?.select())},[a]);let[m,h]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:U(`ExcTextField`,l,{"ExcTextField--fullWidth":n,"ExcTextField--hasIcon":!!c}),onClick:()=>{p.current?.focus()},children:[c,t&&(0,H.jsx)(`div`,{className:`ExcTextField__label`,children:t}),(0,H.jsxs)(`div`,{className:U(`ExcTextField__input`,{"ExcTextField__input--readonly":i}),children:[(0,H.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,H.jsx)(JO,{onSelect:()=>h(!m),style:{border:0,userSelect:`none`},children:m?lS:cS})]})]})}),XO=17,ZO=64;function QO({isLoading:e,libraryItems:t,onAddToLibrary:n,onInsertLibraryItems:r,pendingElements:i,theme:a,id:o,libraryReturnUrl:s,onSelectItems:c,selectedItems:l}){let u=pz(),d=(0,V.useRef)(null),f=tO(d);(0,V.useEffect)(()=>{f>0&&d.current?.scrollTo(0,f)},[]);let{svgCache:p}=VD(),[m,h]=(0,V.useState)(null),[g,_]=(0,V.useState)(``),v=!t.length&&!i.length,y=!v&&!!g.trim(),b=(0,V.useMemo)(()=>{let e=PD(g.trim().toLowerCase());return e?t.filter(t=>{let n=t.name||``;return n.trim()&&PD(n.toLowerCase()).includes(e)}):[]},[t,g]),x=(0,V.useMemo)(()=>t.filter(e=>e.status!==`published`),[t]),S=(0,V.useMemo)(()=>t.filter(e=>e.status===`published`),[t]),C=(0,V.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=ko(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,V.useEffect)(()=>{l.length||h(null)},[l]);let w=(0,V.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:li({type:`everything`,elements:e.elements,randomizeSeed:!0}).duplicatedElements}))},[t,l]),T=(0,V.useCallback)((e,t)=>{let n={itemIds:l.includes(e)?l:[e]};t.dataTransfer.setData(Vs.excalidrawlibIds,JSON.stringify(n))},[l]),E=(0,V.useCallback)(e=>e?l.includes(e):!1,[l]),D=(0,V.useCallback)(()=>{n(i)},[i,n]),O=(0,V.useCallback)(e=>{e&&r(w(e))},[w,r]),k=p.size>=(b.length?b:t).length?ZO:XO,ee=(0,V.useRef)(null);(0,V.useEffect)(()=>{vn(()=>{ee.current?.focus()})},[]);let te=!y&&(0,H.jsxs)(H.Fragment,{children:[!v&&(0,H.jsx)(`div`,{className:`library-menu-items-container__header`,children:G(`labels.personalLib`)}),!i.length&&!x.length?(0,H.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[!S.length&&(0,H.jsx)(`div`,{className:`library-menu-items__no-items__label`,children:G(`library.noItems`)}),(0,H.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:S.length>0?G(`library.hint_emptyPrivateLibrary`):G(`library.hint_emptyLibrary`)})]}):(0,H.jsxs)(KO,{children:[i.length>0&&(0,H.jsx)(qO,{itemsRenderedPerBatch:k,items:[{id:null,elements:i}],onItemSelectToggle:C,onItemDrag:T,onClick:D,isItemSelected:E,svgCache:p}),(0,H.jsx)(qO,{itemsRenderedPerBatch:k,items:x,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})]}),S.length>0&&(0,H.jsx)(`div`,{className:`library-menu-items-container__header`,style:{marginTop:`0.75rem`},children:G(`labels.excalidrawLib`)}),S.length>0&&(0,H.jsx)(KO,{children:(0,H.jsx)(qO,{itemsRenderedPerBatch:k,items:S,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})})]}),ne=y&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`library-menu-items-container__header`,children:[G(`library.search.heading`),!e&&(0,H.jsxs)(`div`,{className:`library-menu-items-container__header__hint`,style:{cursor:`pointer`},onPointerDown:e=>e.preventDefault(),onClick:e=>{_(``)},children:[(0,H.jsx)(`kbd`,{children:`esc`}),` to clear`]})]}),b.length>0?(0,H.jsx)(KO,{children:(0,H.jsx)(qO,{itemsRenderedPerBatch:k,items:b,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})}):(0,H.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[(0,H.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:G(`library.search.noResults`)}),(0,H.jsx)(JO,{onPointerDown:e=>e.preventDefault(),onSelect:()=>{_(``)},style:{width:`auto`,marginTop:`1rem`},children:G(`library.search.clearSearch`)})]})]});return(0,H.jsxs)(`div`,{className:`library-menu-items-container`,style:i.length||x.length||S.length?{justifyContent:`flex-start`}:{borderBottom:0},children:[(0,H.jsxs)(`div`,{className:`library-menu-items-header`,children:[!v&&(0,H.jsx)(YO,{ref:ee,type:`search`,className:U(`library-menu-items-container__search`,{hideCancelButton:u.formFactor!==`phone`}),placeholder:G(`library.search.inputPlaceholder`),value:g,onChange:e=>_(e)}),(0,H.jsx)(VO,{selectedItems:l,onSelectItems:c,className:`library-menu-dropdown-container--in-heading`})]}),(0,H.jsxs)(mO.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,H.jsx)(`div`,{style:{position:`absolute`,top:`var(--container-padding-y)`,right:`var(--container-padding-x)`,transform:`translateY(50%)`},children:(0,H.jsx)(qS,{})}),te,ne,v&&(0,H.jsx)($D,{style:{padding:`16px 0`,width:`100%`},id:o,libraryReturnUrl:s,theme:a})]})]})}var $O=pc(!1),ek=({children:e})=>(0,H.jsx)(`div`,{className:`layer-ui__library`,children:e}),tk=(0,V.memo)(({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:n,setAppState:r,libraryReturnUrl:i,library:a,id:o,theme:s,selectedItems:c,onSelectItems:l})=>{let[u]=fy(UD),d=(0,V.useCallback)(e=>{(async(e,t)=>{aC(`element`,`addToLibrary`,`ui`);for(let t of pt)if(e.some(e=>e.type===t))return r({errorMessage:G(`errors.libraryElementTypeError.${t}`)});let i=[{status:`unpublished`,elements:e,id:da(),created:Date.now()},...t];n(),a.setLibrary(i).catch(()=>{r({errorMessage:G(`alerts.errorAddingToLibrary`)})})})(e,u.libraryItems)},[n,a,r,u.libraryItems]),f=(0,V.useMemo)(()=>u.libraryItems,[u]);if(u.status===`loading`&&!u.isInitialized)return(0,H.jsx)(ek,{children:(0,H.jsx)(`div`,{className:`layer-ui__library-message`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(qS,{size:`2em`}),(0,H.jsx)(`span`,{children:G(`labels.libraryLoadingMessage`)})]})})});let p=u.libraryItems.length>0||t.length>0;return(0,H.jsxs)(ek,{children:[(0,H.jsx)(QO,{isLoading:u.status===`loading`,libraryItems:f,onAddToLibrary:d,onInsertLibraryItems:e,pendingElements:t,id:o,libraryReturnUrl:i,theme:s,onSelectItems:l,selectedItems:c}),p&&(0,H.jsx)($D,{className:`library-menu-control-buttons--at-bottom`,style:{padding:`16px 12px 0 12px`},id:o,libraryReturnUrl:i,theme:s})]})}),nk=(e,t)=>({elements:e,pending:A(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}),selectedElementIds:t}),rk=(e,t)=>{let n=gz(),[r,i]=(0,V.useState)(()=>nk(n,e.selectedElementIds)),a=(0,V.useRef)(new Map);return(0,V.useEffect)(()=>{for(let e of r.pending)a.current.set(e.id,e.version)},[r.pending]),(0,V.useEffect)(()=>{t.state.cursorButton===`up`&&t.state.activeTool.type===`selection`&&i(r=>{if(!Uo(r.selectedElementIds,e.selectedElementIds))return a.current.clear(),nk(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 nk(n,e.selectedElementIds)}return r})},[t,t.state.cursorButton,t.state.activeTool.type,e.selectedElementIds,n]),r.pending},ik=(0,V.memo)(()=>{let e=dz(),{onInsertElements:t}=e,n=fz(),r=uC(),i=vz(),[a,o]=(0,V.useState)([]),s=(0,V.useMemo)(()=>e.library,[e.library]),c=rk(r,e);return(0,V.useEffect)(()=>Xt(document,j.KEYDOWN,t=>{if(t.key===L.ESCAPE&&t.target instanceof HTMLElement){let n=t.target;if(n.closest(`.${Po.SIDEBAR}`))a.length>0?(t.stopPropagation(),o([])):pi(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(`.${Po.SIDEBAR}`)&&(t.stopPropagation(),o([]))}}},{capture:!0}),[a,i,e]),(0,H.jsx)(tk,{pendingElements:c,onInsertLibraryItems:(0,V.useCallback)(n=>{t(YD(n)),e.focusContainer()},[t,e]),onAddToLibrary:(0,V.useCallback)(()=>{i({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[i]),setAppState:i,libraryReturnUrl:n.libraryReturnUrl,library:s,id:e.id,theme:r.theme,selectedItems:a,onSelectItems:o})}),ak=e=>{let{closeOnClickOutside:t=!0}=e,n=dC({className:`excalidraw-modal-container`}),r=(0,V.useRef)(document.body.classList.contains(`excalidraw-animations-disabled`));return n?(0,lc.createPortal)((0,H.jsxs)(`div`,{className:U(`Modal`,e.className,{"animations-disabled":r.current}),role:`dialog`,"aria-modal":`true`,onKeyDown:t=>{t.key===L.ESCAPE&&(t.nativeEvent.stopImmediatePropagation(),t.stopPropagation(),e.onCloseRequest())},"aria-labelledby":e.labelledBy,children:[(0,H.jsx)(`div`,{className:`Modal__background`,onClick:t?e.onCloseRequest:void 0}),(0,H.jsx)(`div`,{className:`Modal__content`,style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),n):null};function ok(e){if(e&&typeof e==`number`)return e;switch(e){case`small`:return 550;case`wide`:return 1024;default:return 800}}var sk=e=>{let[t,n]=FD(),[r]=(0,V.useState)(document.activeElement),{id:i}=hz(),a=pz().formFactor===`phone`;(0,V.useEffect)(()=>{if(!t)return;let n=wo(t);setTimeout(()=>{n.length>0&&e.autofocus!==!1&&(n[1]||n[0]).focus()});let r=e=>{if(e.key===L.TAB){let n=wo(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=vz(),s=py($O),c=()=>{o({openMenu:null}),s(!1),r.focus(),e.onCloseRequest()};return(0,H.jsx)(ak,{className:U(`Dialog`,e.className,{"Dialog--fullscreen":a}),labelledBy:`dialog-title`,maxWidth:ok(e.size),onCloseRequest:c,closeOnClickOutside:e.closeOnClickOutside,children:(0,H.jsxs)(gC,{ref:n,children:[e.title&&(0,H.jsx)(`h2`,{id:`${i}-dialog-title`,className:`Dialog__title`,children:(0,H.jsx)(`span`,{className:`Dialog__titleContent`,children:e.title})}),a&&(0,H.jsx)(`button`,{className:`Dialog__close`,onClick:c,title:G(`buttons.close`),"aria-label":G(`buttons.close`),type:`button`,children:Xb}),(0,H.jsx)(`div`,{className:`Dialog__content`,children:e.children})]})})},ck=[{icon:Gx,value:`hand`,key:L.H,numericKey:null,fillable:!1,toolbar:!0},{icon:Gy,value:`selection`,key:L.V,numericKey:L[1],fillable:!0,toolbar:!0},{icon:qy,value:`rectangle`,key:L.R,numericKey:L[2],fillable:!0,toolbar:!0},{icon:Jy,value:`diamond`,key:L.D,numericKey:L[3],fillable:!0,toolbar:!0},{icon:Yy,value:`ellipse`,key:L.O,numericKey:L[4],fillable:!0,toolbar:!0},{icon:Xy,value:`arrow`,key:L.A,numericKey:L[5],fillable:!0,toolbar:!0},{icon:Zy,value:`line`,key:L.L,numericKey:L[6],fillable:!0,toolbar:!0},{icon:$y,value:`freedraw`,key:[L.P,L.X],numericKey:L[7],fillable:!1,toolbar:!0},{icon:eb,value:`text`,key:L.T,numericKey:L[8],fillable:!1,toolbar:!0},{icon:nb,value:`image`,key:null,numericKey:L[9],fillable:!1,toolbar:!0},{icon:rb,value:`eraser`,key:L.E,numericKey:L[0],fillable:!1,toolbar:!0},{icon:aS,value:`laser`,key:L.K,numericKey:null,fillable:!1,toolbar:!1}],lk=e=>e.state.preferredSelectionTool.type===`lasso`?[{value:`lasso`,icon:Gy,key:L.V,numericKey:L[1],fillable:!0,toolbar:!0},...ck.slice(1)]:ck,uk=(e,t)=>lk(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,dk=V.createContext(null),fk=()=>V.useContext(dk),pk=Qc(),mk=()=>V.useMemo(()=>({MainMenuTunnel:vv(),WelcomeScreenMenuHintTunnel:vv(),WelcomeScreenToolbarHintTunnel:vv(),WelcomeScreenHelpHintTunnel:vv(),WelcomeScreenCenterTunnel:vv(),FooterCenterTunnel:vv(),DefaultSidebarTriggerTunnel:vv(),DefaultSidebarTabTriggersTunnel:vv(),OverwriteConfirmDialogTunnel:vv(),TTDDialogTriggerTunnel:vv(),tunnelsJotai:pk}),[]),hk=X({name:`viewMode`,label:`labels.viewMode`,icon:cS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},captureUpdate:F.EVENTUALLY}},checked:e=>e.viewModeEnabled,predicate:(e,t,n)=>typeof n.viewModeEnabled>`u`,keyTest:e=>!e[L.CTRL_OR_CMD]&&e.altKey&&e.code===Ye.R}),gk=({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,V.useState)(!1),p=n.type,m=l.type===p,{container:h}=hz();return!t.some(e=>e.type===p)&&d&&f(!1),(0,V.useEffect)(()=>{let t=e.onPointerDownEmitter.on(()=>{f(!1)});return()=>t?.()},[e]),(0,H.jsxs)(F_,{open:d,children:[(0,H.jsx)(I_,{asChild:!0,children:(0,H.jsx)(Y,{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,H.jsx)(R_,{className:`tool-popover-content`,sideOffset:26,collisionBoundary:h??void 0,children:t.map(({type:t,icon:n,title:r})=>(0,H.jsx)(Y,{className:U(i,{active:p===t}),type:`radio`,icon:n,checked:p===t,name:`${a}-option`,title:r||Be(t),keyBindingLabel:``,"aria-label":r||Be(t),"data-testid":`toolbar-${t}`,onChange:()=>{e.state.activeTool.type!==t&&aC(`toolbar`,t,`ui`),e.setActiveTool({type:t}),c?.(t)}},t))})]})},_k=U([Po.SHAPE_ACTIONS_THEME_SCOPE,`properties-content`]),vk=(e,t)=>{let n=t[0]?.type||null;for(let e of t)if(e.type!==n){n=null;break}return wr(e.activeTool.type)&&n!==`image`&&n!==`frame`&&n!==`magicframe`||t.some(e=>wr(e.type))},yk=(e,t)=>mt(e.activeTool.type)||t.some(e=>mt(e.type)),bk=({appState:e,elementsMap:t,renderAction:n,app:r})=>{let i=Ie(t,e),a=!1;i.length===2&&(ys(i[0])||ys(i[1]))&&(a=!0);let o=!!(e.editingTextElement||e.newElement),s=pz(),c=document.documentElement.getAttribute(`dir`)===`rtl`,l=mt(e.activeTool.type)&&!_o(e.currentItemBackgroundColor)||i.some(e=>mt(e.type)&&!_o(e.backgroundColor)),u=i.length===1||a,d=!e.selectedLinearElement?.isEditing&&i.length===1&&Bo(i[0])&&!Tr(i[0]),f=!e.croppingElementId&&i.length===1&&Pa(i[0]),p=!a&&oE(e,r);return(0,H.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,H.jsx)(`div`,{children:vk(e,i)&&n(`changeStrokeColor`)}),yk(e,i)&&(0,H.jsx)(`div`,{children:n(`changeBackgroundColor`)}),l&&n(`changeFillStyle`),(Yn(e.activeTool.type)||i.some(e=>Yn(e.type)))&&n(`changeStrokeWidth`),(e.activeTool.type===`freedraw`||i.some(e=>e.type===`freedraw`))&&n(`changeStrokeShape`),(Os(e.activeTool.type)||i.some(e=>Os(e.type)))&&(0,H.jsxs)(H.Fragment,{children:[n(`changeStrokeStyle`),n(`changeSloppiness`)]}),(Ir(e.activeTool.type)||i.some(e=>Ir(e.type)))&&(0,H.jsx)(H.Fragment,{children:n(`changeRoundness`)}),(St(e.activeTool.type)||i.some(e=>St(e.type)))&&(0,H.jsx)(H.Fragment,{children:n(`changeArrowType`)}),(e.activeTool.type===`text`||i.some(M))&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`fieldset`,{children:n(`changeFontFamily`)}),n(`changeFontSize`),(e.activeTool.type===`text`||tr(i,t))&&n(`changeTextAlign`)]}),y(i,t)&&n(`changeVerticalAlign`),(lt(e.activeTool.type)||i.some(e=>lt(e.type)))&&(0,H.jsx)(H.Fragment,{children:n(`changeArrowhead`)}),n(`changeOpacity`),(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.layers`)}),(0,H.jsxs)(`div`,{className:`buttonList`,children:[n(`sendToBack`),n(`sendBackward`),n(`bringForward`),n(`bringToFront`)]})]}),p&&!a&&(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.align`)}),(0,H.jsxs)(`div`,{className:`buttonList`,children:[c?(0,H.jsxs)(H.Fragment,{children:[n(`alignRight`),n(`alignHorizontallyCentered`),n(`alignLeft`)]}):(0,H.jsxs)(H.Fragment,{children:[n(`alignLeft`),n(`alignHorizontallyCentered`),n(`alignRight`)]}),i.length>2&&n(`distributeHorizontally`),(0,H.jsx)(`div`,{style:{flexBasis:`100%`,height:0}}),(0,H.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,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.actions`)}),(0,H.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`)]})]})]})},xk=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i})=>{let a=mt(e.activeTool.type)&&!_o(e.currentItemBackgroundColor)||r.some(e=>mt(e.type)&&!_o(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,H.jsx)(`div`,{className:`compact-action-item`,children:(0,H.jsxs)(F_,{open:s,onOpenChange:e=>{n(e?{openPopup:`compactStrokeStyles`}:{openPopup:null})},children:[(0,H.jsx)(I_,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:s}),title:G(`labels.stroke`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:s?null:`compactStrokeStyles`})},children:BS})}),s&&(0,H.jsx)(_C,{className:_k,container:i,style:{maxWidth:`13rem`},onClose:()=>{},children:(0,H.jsxs)(`div`,{className:`selected-shape-actions`,children:[a&&t(`changeFillStyle`),(Yn(e.activeTool.type)||r.some(e=>Yn(e.type)))&&t(`changeStrokeWidth`),(Os(e.activeTool.type)||r.some(e=>Os(e.type)))&&(0,H.jsxs)(H.Fragment,{children:[t(`changeStrokeStyle`),t(`changeSloppiness`)]}),(Ir(e.activeTool.type)||r.some(e=>Ir(e.type)))&&t(`changeRoundness`),t(`changeOpacity`)]})})]})}):null},Sk=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i,app:a})=>{let o=St(e.activeTool.type)||r.some(e=>St(e.type)),s=e.openPopup===`compactArrowProperties`;return o?(0,H.jsx)(`div`,{className:`compact-action-item`,children:(0,H.jsxs)(F_,{open:s,onOpenChange:e=>{n(e?{openPopup:`compactArrowProperties`}:{openPopup:null})},children:[(0,H.jsx)(I_,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:s}),title:G(`labels.arrowtypes`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:s?null:`compactArrowProperties`})},children:(()=>{let t=ww(r,a,e=>nt(e)?e.elbowed?`elbow`:e.roundness?`round`:`sharp`:null,e=>nt(e),t=>t?null:e.currentItemArrowType);return t===`elbow`?NS:t===`round`?PS:MS})()})}),s&&(0,H.jsx)(_C,{container:i,className:`properties-content`,style:{maxWidth:`13rem`},onClose:()=>{},children:t(`changeArrowProperties`)})]})}):null},Ck=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i,elementsMap:a})=>{let{saveCaretPosition:o,restoreCaretPosition:s}=SC(),c=e.openPopup===`compactTextProperties`;return(0,H.jsx)(`div`,{className:`compact-action-item`,children:(0,H.jsxs)(F_,{open:c,onOpenChange:t=>{t?(e.editingTextElement&&o(),n({openPopup:`compactTextProperties`})):(n({openPopup:null}),e.editingTextElement&&s())},children:[(0,H.jsx)(I_,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:c}),title:G(`labels.textAlign`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c?n({openPopup:null}):(e.editingTextElement&&o(),n({openPopup:`compactTextProperties`}))},children:tb})}),e.openPopup===`compactTextProperties`&&(0,H.jsx)(_C,{className:_k,container:i,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!e.editingTextElement,onClose:()=>{e.editingTextElement&&s()},children:(0,H.jsxs)(`div`,{className:`selected-shape-actions`,children:[(e.activeTool.type===`text`||r.some(M))&&t(`changeFontSize`),(e.activeTool.type===`text`||tr(r,a))&&t(`changeTextAlign`),y(r,a)&&t(`changeVerticalAlign`)]})})]})})},wk=({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&&Pa(n[0]),u=n.length===1,d=oE(e,a),f=!1;n.length===2&&(ys(n[0])||ys(n[1]))&&(f=!0);let p=document.documentElement.getAttribute(`dir`)===`rtl`,m=e.openPopup===`compactOtherProperties`;return c||n.length===0?null:(0,H.jsx)(`div`,{className:`compact-action-item`,children:(0,H.jsxs)(F_,{open:m,onOpenChange:e=>{r(e?{openPopup:`compactOtherProperties`}:{openPopup:null})},children:[(0,H.jsx)(I_,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:m}),title:G(`labels.actions`),onClick:e=>{e.preventDefault(),e.stopPropagation(),r({openPopup:m?null:`compactOtherProperties`})},children:Iy})}),m&&(0,H.jsx)(_C,{className:_k,container:i,style:{maxWidth:`12rem`,justifyContent:`center`,alignItems:`center`},onClose:()=>{},children:(0,H.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.layers`)}),(0,H.jsxs)(`div`,{className:`buttonList`,children:[t(`sendToBack`),t(`sendBackward`),t(`bringForward`),t(`bringToFront`)]})]}),d&&!f&&(0,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.align`)}),(0,H.jsxs)(`div`,{className:`buttonList`,children:[p?(0,H.jsxs)(H.Fragment,{children:[t(`alignRight`),t(`alignHorizontallyCentered`),t(`alignLeft`)]}):(0,H.jsxs)(H.Fragment,{children:[t(`alignLeft`),t(`alignHorizontallyCentered`),t(`alignRight`)]}),n.length>2&&t(`distributeHorizontally`),(0,H.jsx)(`div`,{style:{flexBasis:`100%`,height:0}}),(0,H.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,H.jsxs)(`fieldset`,{children:[(0,H.jsx)(`legend`,{children:G(`labels.actions`)}),(0,H.jsxs)(`div`,{className:`buttonList`,children:[t(`group`),t(`ungroup`),u&&t(`hyperlink`),l&&t(`cropEditor`),o&&t(`duplicateSelection`),s&&t(`deleteSelectedElements`)]})]})]})})]})})},Tk=({appState:e,renderAction:t,targetElements:n})=>!e.selectedLinearElement?.isEditing&&n.length===1&&Bo(n[0])&&!Tr(n[0])?(0,H.jsx)(`div`,{className:`compact-action-item`,children:t(`toggleLinearEditor`)}):null,Ek=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=Ie(t,e),{container:o}=hz(),s=!!(e.editingTextElement||e.newElement),c=!e.selectedLinearElement?.isEditing&&a.length===1&&Bo(a[0])&&!Tr(a[0]);return(0,H.jsxs)(`div`,{className:`compact-shape-actions`,children:[vk(e,a)&&(0,H.jsx)(`div`,{className:U(`compact-action-item`),children:n(`changeStrokeColor`)}),yk(e,a)&&(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),(0,H.jsx)(xk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o}),(0,H.jsx)(Sk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,app:r}),c&&(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`toggleLinearEditor`)}),(e.activeTool.type===`text`||a.some(M))&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,H.jsx)(Ck,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,elementsMap:t})]}),!s&&a.length>0&&(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),!s&&a.length>0&&(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)}),(0,H.jsx)(wk,{appState:e,renderAction:n,targetElements:a,setAppState:i,container:o,app:r})]})},Dk=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=Ie(t,e),{container:o}=hz(),s=(0,V.useRef)(null),c=s.current?.getBoundingClientRect()?.width??0,l=c>=374,u=c>=412;return(0,H.jsxs)(gC,{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,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6,flex:1},children:[vk(e,a)&&(0,H.jsx)(`div`,{className:U(`compact-action-item`),children:n(`changeStrokeColor`)}),yk(e,a)&&(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),(0,H.jsx)(xk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o}),(0,H.jsx)(Sk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,app:r}),(0,H.jsx)(Tk,{appState:e,renderAction:n,targetElements:a}),(e.activeTool.type===`text`||a.some(M))&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,H.jsx)(Ck,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,elementsMap:t})]}),(0,H.jsx)(wk,{appState:e,renderAction:n,targetElements:a,setAppState:i,container:o,app:r,showDuplicate:!u,showDelete:!l})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6},children:[(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`undo`)}),(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`redo`)}),u&&(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),l&&(0,H.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)})]})]})},Ok=({activeTool:e,setAppState:t,app:n,UIOptions:r})=>{let[i,a]=(0,V.useState)(!1),o=mz(),s=o===`full`,c=o===`compact`,l=[{type:`selection`,icon:Gy,title:Be(G(`toolBar.selection`))},{type:`lasso`,icon:Ky,title:Be(G(`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}=fk();return(0,H.jsxs)(H.Fragment,{children:[lk(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=G(`toolBar.${i}`),p=o&&Be(typeof o==`string`?o:o[0]),m=p?`${p} ${G(`helpDialog.or`)} ${s}`:`${s}`,h=i===`hand`?void 0:s||p;return(i===`selection`||i===`lasso`)&&c?(0,H.jsx)(gk,{app:n,options:l,activeTool:e,defaultOption:n.state.preferredSelectionTool.type,namePrefix:`selectionType`,title:Be(G(`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,H.jsx)(Y,{className:U(`Shape`,{fillable:u}),type:`radio`,icon:a,checked:e.type===i,name:`editor-current-shape`,title:`${Be(f)} \u2014 ${m}`,keyBindingLabel:h,"aria-label":Be(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&&aC(`toolbar`,i,`ui`),n.setActiveTool({type:i})}},i)}),(0,H.jsx)(`div`,{className:`App-toolbar__divider`}),(0,H.jsxs)(Q,{open:i,children:[(0,H.jsx)(Q.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:G(`toolBar.extraTools`),children:u?eS:p?cb:d&&!n.props.isCollaborating?aS:f?Ky:$x}),(0,H.jsxs)(Q.Content,{onClickOutside:()=>a(!1),onSelect:()=>a(!1),className:`App-toolbar__extra-tools-dropdown`,children:[(0,H.jsx)(Q.Item,{onSelect:()=>n.setActiveTool({type:`frame`}),icon:eS,shortcut:L.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:u,children:G(`toolBar.frame`)}),(0,H.jsx)(Q.Item,{onSelect:()=>n.setActiveTool({type:`embeddable`}),icon:cb,"data-testid":`toolbar-embeddable`,selected:p,children:G(`toolBar.embeddable`)}),(0,H.jsx)(Q.Item,{onSelect:()=>n.setActiveTool({type:`laser`}),icon:aS,"data-testid":`toolbar-laser`,selected:d,shortcut:L.K.toLocaleUpperCase(),children:G(`toolBar.laser`)}),s&&(0,H.jsx)(Q.Item,{onSelect:()=>n.setActiveTool({type:`lasso`}),icon:Ky,"data-testid":`toolbar-lasso`,selected:f,children:G(`toolBar.lasso`)}),(0,H.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),n.props.aiEnabled!==!1&&(0,H.jsx)(m.Out,{}),(0,H.jsx)(Q.Item,{onSelect:()=>n.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:tS,"data-testid":`toolbar-embeddable`,children:G(`toolBar.mermaidToExcalidraw`)}),n.props.aiEnabled!==!1&&n.plugins.diagramToCode&&(0,H.jsx)(Q.Item,{onSelect:()=>n.onMagicframeToolSelect(),icon:oS,"data-testid":`toolbar-magicframe`,badge:(0,H.jsx)(Q.Item.Badge,{children:`AI`}),children:G(`toolBar.magicframe`)})]})]})]})},kk=({renderAction:e,zoom:t})=>(0,H.jsx)(mO.Col,{gap:1,className:Po.ZOOM_ACTIONS,children:(0,H.jsxs)(mO.Row,{align:`center`,children:[e(`zoomOut`),e(`resetZoom`),e(`zoomIn`)]})}),Ak=({renderAction:e,className:t})=>(0,H.jsxs)(`div`,{className:`undo-redo-buttons ${t}`,children:[(0,H.jsx)(`div`,{className:`undo-button-container`,children:(0,H.jsx)(Nw,{label:G(`buttons.undo`),children:e(`undo`)})}),(0,H.jsx)(`div`,{className:`redo-button-container`,children:(0,H.jsxs)(Nw,{label:G(`buttons.redo`),children:[` `,e(`redo`)]})})]}),jk=({actionManager:e,showExitZenModeBtn:t})=>(0,H.jsx)(`button`,{type:`button`,className:U(`disable-zen-mode`,{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(xE),children:G(`buttons.exitZenMode`)}),Mk=({actionManager:e})=>(0,H.jsx)(`button`,{type:`button`,className:`disable-view-mode`,onClick:()=>e.executeAction(hk),children:HS}),Nk=e=>{let t=(0,V.useRef)({userFn:e});return t.current.userFn=e,t.current.stableFn||(t.current.stableFn=(...e)=>t.current.userFn(...e)),t.current.stableFn},Pk=pc(null),Fk=()=>{let[e,t]=fy(Pk),n=yz();return e&&e===`clearCanvas`?(0,H.jsx)(rO,{onConfirm:()=>{n.executeAction(Kw),t(null)},onCancel:()=>t(null),title:G(`clearCanvasDialog.title`),children:(0,H.jsxs)(`p`,{className:`clear-canvas__content`,children:[` `,G(`alerts.clearReset`)]})}):null},Ik={};o(Ik,{toggleTheme:()=>Lk});var Lk={...$w,category:`App`,label:`Toggle theme`,perform:({actionManager:e})=>{e.executeAction($w,`commandPalette`)}},Rk=pc(null),zk={app:`App`,export:`Export`,tools:`Tools`,editor:`Editor`,elements:`Elements`,links:`Links`,library:`Library`},Bk=e=>{switch(e){case zk.app:return 1;case zk.export:return 2;case zk.editor:return 3;case zk.tools:return 4;case zk.elements:return 5;case zk.links:return 6;default:return 10}},Vk=({shortcut:e,className:t,children:n})=>{let r=e.replace(`++`,`+$`).split(`+`);return(0,H.jsxs)(`div`,{className:U(`shortcut`,t),children:[r.map((e,t)=>(0,H.jsx)(`div`,{className:`shortcut-wrapper`,children:(0,H.jsx)(`div`,{className:`shortcut-key`,children:e===`$`?`+`:e})},e)),(0,H.jsx)(`div`,{className:`shortcut-desc`,children:n})]})},Hk=e=>!e.altKey&&e[L.CTRL_OR_CMD]&&(e.shiftKey&&e.key.toLowerCase()===L.P||e.key===L.SLASH);Object.assign(e=>{let t=uC(),n=vz();return(0,V.useEffect)(()=>{let e=e=>{Hk(e)&&(e.preventDefault(),e.stopPropagation(),n(e=>{let t=e.openDialog?.name===`commandPalette`?null:{name:`commandPalette`};return t&&aC(`command_palette`,`open`,`shortcut`),{openDialog:t}}))};return window.addEventListener(j.KEYDOWN,e,{capture:!0}),()=>window.removeEventListener(j.KEYDOWN,e,{capture:!0})},[n]),t.openDialog?.name===`commandPalette`?(0,H.jsx)(Uk,{...e}):null},{defaultItems:Ik});function Uk({customCommandPaletteItems:e}){let t=dz(),n=uC(),r=vz(),i=fz(),a=yz(),[o,s]=fy(Rk),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(null),d=pC({uiAppState:n,customCommandPaletteItems:e,appProps:i}),[f]=fy(UD),p=(0,V.useMemo)(()=>f.libraryItems?.filter(e=>!!e.name).map(e=>({label:e.name,icon:(0,H.jsx)(Wk,{id:e.id,elements:e.elements}),category:`Library`,order:Bk(`Library`),haystack:PD(e.name),perform:()=>{t.onInsertElements(YD([e]))}}))||[],[t,f.libraryItems]);(0,V.useEffect)(()=>{let{uiAppState:e,customCommandPaletteItems:n,appProps:i}=d,c=n=>{let r=``;return n.label&&(r=typeof n.label==`function`?G(n.label(t.scene.getNonDeletedElements(),e,t)):G(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:AD(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,KE,DD,OD].map(e=>m(e,zk.elements,(e,t)=>({...e,predicate:t.predicate?t.predicate:(e,t,n,r)=>A(e,t).length>0}))),h=[a.actions.toggleHandTool,a.actions.setFrameAsActiveTool,a.actions.toggleLassoTool].map(e=>m(e,zk.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,zk.editor)),_=[a.actions.saveToActiveFile,a.actions.saveFileToDisk,a.actions.copyAsPng,a.actions.copyAsSvg].map(e=>m(e,zk.export));f=[...d,...g,{label:c(Kw),icon:u(Kw),shortcut:AD(Kw.name),category:zk.editor,keywords:[`delete`,`destroy`],viewMode:!1,perform:()=>{_y.set(Pk,`clearCanvas`)}},{label:G(`buttons.exportImage`),category:zk.export,icon:Db,shortcut:AD(`imageExport`),keywords:[`export`,`image`,`png`,`jpeg`,`svg`,`clipboard`,`picture`],perform:()=>{r({openDialog:{name:`imageExport`}})}},..._];let v=[{label:G(`toolBar.library`),category:zk.app,icon:Ny,viewMode:!1,perform:()=>{e.openSidebar?r({openSidebar:null}):r({openSidebar:{name:ne.name,tab:ne.defaultTab}})}},{label:G(`search.title`),category:zk.app,icon:fS,viewMode:!0,perform:()=>{a.executeAction(qA)}},{label:G(`labels.shapeSwitch`),category:zk.elements,icon:_S,perform:()=>{a.executeAction(ED)}},{label:G(`labels.changeStroke`),keywords:[`color`,`outline`],category:zk.elements,icon:Tb,viewMode:!1,predicate:(e,t)=>{let n=A(e,t);return n.length>0&&vk(t,n)},perform:()=>{r(e=>({openPopup:`elementStroke`}))}},{label:G(`labels.changeBackground`),keywords:[`color`,`fill`],icon:Tb,category:zk.elements,viewMode:!1,predicate:(e,t)=>{let n=A(e,t);return n.length>0&&yk(t,n)},perform:()=>{r(e=>({openPopup:`elementBackground`}))}},{label:G(`labels.canvasBackground`),keywords:[`color`],icon:Tb,category:zk.editor,viewMode:!1,perform:()=>{r(e=>({openMenu:e.openMenu===`canvas`?null:`canvas`,openPopup:`canvasBackground`}))}},...ck.reduce((e,n)=>{let{value:r,icon:a,key:o,numericKey:s}=n;if(i.UIOptions.tools?.[r]===!1)return e;let c=o&&Be(typeof o==`string`?o:o[0])||s,l={label:G(`toolBar.${r}`),category:zk.tools,shortcut:c,icon:a,keywords:[`toolbar`],viewMode:!1,perform:({event:e})=>{t.setActiveTool({type:r})}};return e.push(l),e},[]),...h,{label:G(`toolBar.lock`),category:zk.tools,icon:e.activeTool.locked?By:zy,shortcut:L.Q.toLocaleUpperCase(),viewMode:!1,perform:()=>{t.toggleLock()}},{label:`${G(`labels.textToDiagram`)}...`,category:zk.tools,icon:dS,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`text-to-diagram`}}))}},{label:`${G(`toolBar.mermaidToExcalidraw`)}...`,category:zk.tools,icon:tS,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`mermaid`}}))}}],y=[...f,...v,...n||[]].map(e=>({...e,icon:e.icon||_S,order:e.order??Bk(e.category),haystack:`${PD(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,V.useState)(``),[g,_]=(0,V.useState)(null),[v,y]=(0,V.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=Nk(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=Nk(e=>{let t=pi(e.target)||Hk(e)||e.key===L.ESCAPE;if(t&&e.key!==L.ARROW_UP&&e.key!==L.ARROW_DOWN&&e.key!==L.ENTER)return;let n=Object.values(v).flat(),r=o&&!m&&S(o);if(e.key===L.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===L.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===L.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,V.useEffect)(()=>(window.addEventListener(j.KEYDOWN,C,{capture:!0}),()=>window.removeEventListener(j.KEYDOWN,C,{capture:!0})),[C]),(0,V.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=PD(m.toLocaleLowerCase().replace(/[<>_| -]/g,``));t=av.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,H.jsxs)(sk,{onCloseRequest:()=>b(),closeOnClickOutside:!0,title:!1,size:720,autofocus:!0,className:`command-palette-dialog`,children:[(0,H.jsx)(YO,{value:m,placeholder:G(`commandPalette.search.placeholder`),onChange:e=>{h(e)},selectOnRender:!0,ref:u}),t.editorInterface.formFactor!==`phone`&&(0,H.jsxs)(`div`,{className:`shortcuts-wrapper`,children:[(0,H.jsx)(Vk,{shortcut:`↑↓`,children:G(`commandPalette.shortcuts.select`)}),(0,H.jsx)(Vk,{shortcut:`↵`,children:G(`commandPalette.shortcuts.confirm`)}),(0,H.jsx)(Vk,{shortcut:Z(`Esc`),children:G(`commandPalette.shortcuts.close`)})]}),(0,H.jsxs)(`div`,{className:`commands`,children:[o&&!m&&(0,H.jsxs)(`div`,{className:`command-category`,children:[(0,H.jsxs)(`div`,{className:`command-category-title`,children:[G(`commandPalette.recents`),(0,H.jsx)(`div`,{className:`icon`,style:{marginLeft:`6px`},children:pS})]}),(0,H.jsx)(Gk,{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,H.jsxs)(`div`,{className:`command-category`,children:[(0,H.jsx)(`div`,{className:`command-category-title`,children:e}),v[e].map(r=>(0,H.jsx)(Gk,{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,H.jsxs)(`div`,{className:`no-match`,children:[(0,H.jsx)(`div`,{className:`icon`,children:fS}),` `,G(`commandPalette.search.noMatch`)]}):null]})]})}var Wk=({id:e,elements:t})=>{let n=(0,V.useRef)(null),{svgCache:r}=VD();return BD(e,t,r,n),(0,H.jsx)(`div`,{className:`library-item-icon`,ref:n})},Gk=({command:e,isSelected:t,disabled:n,onMouseMove:r,onClick:i,showShortcut:a,appState:o,size:s=`small`})=>{let c=()=>{};return(0,H.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?G(`commandPalette.itemNotAvailable`):``,children:[(0,H.jsxs)(`div`,{className:`name`,children:[e.icon&&(0,H.jsx)(lw,{className:`icon`,size:`var(--icon-size, 1rem)`,icon:typeof e.icon==`function`?e.icon(o,[]):e.icon}),(0,H.jsx)(XC,{children:e.label})]}),a&&e.shortcut&&(0,H.jsx)(Vk,{shortcut:e.shortcut})]})},Kk=e=>{if(!e)return[];for(let t of e.sets)if(t.type===`path`)return t.ops;return e.sets[0].ops},qk=e=>!!e&&e.type===`embeddable`,Jk=e=>!!e&&e.type===`iframe`,Yk=e=>!!e&&(e.type===`iframe`||e.type===`embeddable`),Xk=e=>e!=null&&e.type===`text`,Zk=e=>e!=null&&(e.type===`frame`||e.type===`magicframe`),Qk=e=>e!=null&&tA(e.type),$k=e=>e!=null&&e.type===`arrow`,eA=e=>$k(e)&&e.elbowed,tA=e=>e===`arrow`||e===`line`,nA=e=>e!==null&&`containerId`in e&&e.containerId!==null&&Xk(e),rA=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return ja(n,r)<=8/t}return!1},iA=(e,t)=>{if(t.roundness?.type===fo.PROPORTIONAL_RADIUS||t.roundness?.type===fo.LEGACY)return e*ut;if(t.roundness?.type===fo.ADAPTIVE_RADIUS){let n=t.roundness?.value??32;return e<=n/.25?e*ut:n}return 0};`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`.toLocaleUpperCase();var aA=[1,0],oA=[0,1],sA=[-1,0],cA=[0,-1],lA=e=>{let[t,n]=e,r=Math.abs(t),i=Math.abs(n);return t>i?aA:t<=-i?sA:n>r?oA:cA},uA=(e,t)=>lA(Dt(e,t)),dA=(e,t)=>pA(uA(e,t)),fA=(e,t)=>e[0]===t[0]&&e[1]===t[1],pA=e=>fA(e,aA)||fA(e,sA),mA=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]},hA=20,gA=15,_A=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 gA;case`cardinality_one`:case`cardinality_exactly_one`:case`cardinality_zero_or_one`:return hA;default:return 15}},vA=e=>{switch(e){case`bar`:return 90;case`arrow`:return 20;default:return 25}},yA=(e,t,n,r,i=0)=>{if(r===null||t.length<1)return null;let a=Kk(t[0]);if(a.length<1)return null;let o=n===`start`?1:a.length-1,s=a[o].data;Ar(s.length===6,`Op data length is not 6`);let c=N(s[4],s[5]),l=N(s[2],s[3]),u=N(s[0],s[1]),d=a[o-1],f=N(0,0);if(d.op===`move`){let e=en(d.data);Ar(e!=null,`Op data is not a point`),f=e}else d.op===`bcurveTo`&&(f=N(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=_A(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 O=vA(r);if(r===`cardinality_many`||r===`cardinality_one_or_many`){let[e,t]=z(N(w,T),N(E,D),Me(-O)),[n,r]=z(N(w,T),N(E,D),Me(O));return[E,D,e,t,n,r]}let[k,ee]=z(N(E,D),N(w,T),-O*Math.PI/180),[te,ne]=z(N(E,D),N(w,T),Me(O));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]=z(N(w+C*2,T),N(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]=z(N(w-C*2,T),N(w,T),Math.atan2(T-i,w-n))}return[w,T,k,ee,t,r,te,ne]}return[w,T,k,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:xA({...a.selectedElementIds,...l},o)},n},i=(e,t,n,i)=>{let a=i?i.scene.getSelectedElements({selectedElementIds:e.selectedElementIds,elements:t}):bA(t,e);return a.length?r(a,t,e,n):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:xA(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 bA=(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&&nA(a)&&t.selectedElementIds[a?.containerId]){i.push(a),r.add(a.id);continue}}if(n?.includeElementsInFrames){let t=[];return i.forEach(n=>{Zk(n)&&SA(e,n.id).forEach(e=>!r.has(e.id)&&t.push(e)),t.push(n)}),t}return i},xA=(e,t)=>Uo(t.selectedElementIds,e)?t.selectedElementIds:e,SA=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n},CA=typeof document<`u`?document.createElement(`img`):{src:``};CA.src=`data:${Vs.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 wA=typeof document<`u`?document.createElement(`img`):{src:``};wA.src=`data:${Vs.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 TA=new WeakMap,EA=e=>e===`rectangle`||e===`iframe`||e===`embeddable`||e===`line`||e===`diamond`||e===`image`,DA=class{};i(DA,`rg`,new ba),i(DA,`cache`,new WeakMap),i(DA,`get`,(e,t)=>{let n=DA.cache.get(e);if(n&&(t===null||n.theme===t))return n.shape}),i(DA,`delete`,e=>{DA.cache.delete(e),TA.delete(e)}),i(DA,`destroy`,()=>{DA.cache=new WeakMap}),i(DA,`generateElementShape`,(e,t)=>{let n=t?.isExporting?void 0:DA.get(e,t?t.theme:null);if(n!==void 0)return n;TA.delete(e);let r=RA(e,DA.rg,t||{isExporting:!1,canvasBackgroundColor:Mi.white,embedsValidationStatus:null,theme:R.LIGHT});return t?.isExporting||DA.cache.set(e,{shape:r,theme:t?.theme||R.LIGHT}),r});var OA=e=>[8,8+e],kA=e=>[1.5,6+e];function AA(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&&EA(e.type)||Qk(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var jA=(e,t=!1,n=!1)=>{let r={seed:e.seed,strokeLineDash:e.strokeStyle===`dashed`?OA(e.strokeWidth):e.strokeStyle===`dotted`?kA(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:AA(e),stroke:n?$n(e.strokeColor):e.strokeColor,preserveVertices:t||e.roughness<qi.cartoonist};switch(e.type){case`rectangle`:case`iframe`:case`embeddable`:case`diamond`:case`ellipse`:return r.fillStyle=e.fillStyle,r.fill=_o(e.backgroundColor)?void 0:n?$n(e.backgroundColor):e.backgroundColor,e.type===`ellipse`&&(r.curveFitting=1),r;case`line`:case`freedraw`:return rA(e.points)&&(r.fillStyle=e.fillStyle,r.fill=e.backgroundColor===`transparent`?void 0:n?$n(e.backgroundColor):e.backgroundColor),r;case`arrow`:return r;default:throw Error(`Unimplemented type ${e.type}`)}},MA=(e,t,n)=>Yk(e)&&(t||qk(e)&&n?.get(e.id)!==!0)&&_o(e.backgroundColor)&&_o(e.strokeColor)?{...e,roughness:0,backgroundColor:`#d3d3d3`,fillStyle:`solid`}:Jk(e)?{...e,strokeColor:_o(e.strokeColor)?`#000000`:e.strokeColor,backgroundColor:_o(e.backgroundColor)?`#f4f4f6`:e.backgroundColor}:e,NA=(e,t,n)=>{if(t===null)return[];let[,,r,i,a,o]=t;return[e.line(r,i,a,o,n)]},PA=(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)]},FA=(e,t)=>{let n={...t};if(e.strokeStyle===`dotted`){let t=kA(e.strokeWidth-1);n.strokeLineDash=[t[0],t[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},IA=(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)]},LA=(e,t,n,r,i,a,o,s)=>{if(r===null)return[];let c=s?$n(e.strokeColor):e.strokeColor,l=s?$n(o):o,u=.8;switch(r){case`circle`:case`circle_outline`:return IA(i,a,c,yA(e,t,n,r),r===`circle_outline`?l:c);case`triangle`:case`triangle_outline`:{let o=yA(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=yA(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 NA(i,yA(e,t,n,r),FA(e,a));case`cardinality_many`:return PA(i,yA(e,t,n,r),FA(e,a));case`cardinality_one_or_many`:{let r=FA(e,a);return[...PA(i,yA(e,t,n,`cardinality_many`),r),...NA(i,yA(e,t,n,`cardinality_one`,-.25),r)]}case`cardinality_exactly_one`:{let r=FA(e,a);return[...NA(i,yA(e,t,n,`cardinality_one`,-.5),r),...NA(i,yA(e,t,n,`cardinality_one`),r)]}case`cardinality_zero_or_one`:{let r=FA(e,a);return[...IA(i,a,c,yA(e,t,n,`circle_outline`,1.5),l,u),...NA(i,yA(e,t,n,`cardinality_one`,-.5),r)]}case`cardinality_zero_or_many`:{let r=FA(e,a);return[...PA(i,yA(e,t,n,`cardinality_many`),r),...IA(i,a,c,yA(e,t,n,`circle_outline`,1.5),l,u)]}default:return PA(i,yA(e,t,n,r),FA(e,a))}},RA=(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=iA(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`,jA(MA(e,n,i),!0,o))}else r=t.rectangle(0,0,e.width,e.height,jA(MA(e,n,i),!1,o));return r}case`diamond`:{let n,[r,i,a,s,c,l,u,d]=mA(e);if(e.roundness){let f=iA(Math.abs(r-u),e),p=iA(Math.abs(s-i),e);n=t.path(`M ${r+f} ${i+p} L ${a-f} ${s-p}
47
- C ${a} ${s}, ${a} ${s}, ${a-f} ${s+p}
48
- L ${c+f} ${l-p}
49
- C ${c} ${l}, ${c} ${l}, ${c-f} ${l-p}
50
- L ${u+f} ${d+p}
51
- C ${u} ${d}, ${u} ${d}, ${u+f} ${d-p}
52
- L ${r-f} ${i+p}
53
- C ${r} ${i}, ${r} ${i}, ${r+f} ${i+p}`,jA(e,!0,o))}else n=t.polygon([[r,i],[a,s],[c,l],[u,d]],jA(e,!1,o));return n}case`ellipse`:return t.ellipse(e.width/2,e.height/2,e.width,e.height,jA(e,!1,o));case`line`:case`arrow`:{let n,i=jA(e,!1,o),a=e.points.length?e.points:[N(0,0)];if(eA(e)?a.every(e=>Math.abs(e[0])<=1e6&&Math.abs(e[1])<=1e6)?n=[t.path(zA(a,16),jA(e,!0,o))]:(console.error(`Elbow arrow with extreme point positions detected. Arrow not rendered.`,e.id,JSON.stringify(a)),n=[]):n=e.roundness?[t.curve(a,i)]:i.fill?[t.polygon(a,i)]:[t.linearPath(a,i)],e.type===`arrow`){let{startArrowhead:a=null,endArrowhead:s=`arrow`}=e;if(a!==null){let s=LA(e,n,`start`,a,t,i,r,o);n.push(...s)}if(s!==null){let a=LA(e,n,`end`,s,t,i,r,o);n.push(...a)}}return n}case`freedraw`:{let n=[];if(rA(e.points)){let r=Sv(e.points,.75);n.push(t.curve(r,{...jA(e,!1,o),stroke:`none`}))}return n.push(BA(e)),n}case`frame`:case`magicframe`:case`text`:case`image`:return null;default:return Oi(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},zA=(e,t)=>{let n=[];for(let r=1;r<e.length-1;r+=1){let i=e[r-1],a=e[r+1],o=e[r],s=dA(o,i),c=dA(a,o),l=Math.min(t,ja(e[r],a)/2,ja(e[r],i)/2);s?i[0]<o[0]?n.push([e[r][0]-l,e[r][1]]):n.push([e[r][0]+l,e[r][1]]):i[1]<o[1]?n.push([e[r][0],e[r][1]-l]):n.push([e[r][0],e[r][1]+l]),n.push(e[r]),c?a[0]<o[0]?n.push([e[r][0]-l,e[r][1]]):n.push([e[r][0]+l,e[r][1]]):a[1]<o[1]?n.push([e[r][0],e[r][1]-l]):n.push([e[r][0],e[r][1]+l])}let r=[`M ${e[0][0]} ${e[0][1]}`];for(let e=0;e<n.length;e+=3)r.push(`L ${n[e][0]} ${n[e][1]}`),r.push(`Q ${n[e+1][0]} ${n[e+1][1]}, ${n[e+2][0]} ${n[e+2][1]}`);return r.push(`L ${e[e.length-1][0]} ${e[e.length-1][1]}`),r.join(` `)},BA=e=>WA(VA(e)),VA=e=>qv(e.simulatePressure?e.points:e.points.length?e.points.map(([t,n],r)=>[t,n,e.pressures[r]]):[[0,0,.5]],{simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:e=>Math.sin(e*Math.PI/2),last:!0}),HA=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],UA=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g,WA=e=>{if(!e.length)return``;let t=e.length-1;return e.reduce((e,n,r,i)=>(r===t?e.push(n,HA(n,i[0]),`L`,i[0],`Z`):e.push(n,HA(n,i[r+1])),e),[`M`,e[0],`Q`]).join(` `).replace(UA,`$1`)},GA=(e,t,n=!1)=>{let r=!1;for(let n in t){let i=t[n];if(typeof i<`u`){if(e[n]===i&&(typeof i!=`object`||!i))continue;r=!0}}return!r&&!n?e:{...e,...t,version:t.version??e.version+1,versionNonce:t.versionNonce??Ee(),updated:rc()}},KA=X({name:`toggleLinearEditor`,category:zk.elements,label:(e,t,n)=>n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds})[0]?.type===`arrow`?`labels.lineEditor.editArrow`:`labels.lineEditor.edit`,keywords:[`line`],trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(!t.selectedLinearElement?.isEditing&&i.length===1&&Bo(i[0])&&!Tr(i[0]))},perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];Ar(i,`No selected element found`),Ar(t.selectedLinearElement,`No selected linear element found`),Ar(i.id===t.selectedLinearElement.elementId,`Selected element ID and linear editor elementId does not match`);let a={...t.selectedLinearElement,isEditing:!t.selectedLinearElement.isEditing};return{appState:{...t,selectedLinearElement:a},captureUpdate:F.IMMEDIATELY}},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=n.scene.getSelectedElements({selectedElementIds:e.selectedElementIds})[0];if(!r)return null;let i=G(r.type===`arrow`?`labels.lineEditor.editArrow`:`labels.lineEditor.edit`);return(0,H.jsx)(Y,{type:`button`,icon:jS,title:i,"aria-label":i,onClick:()=>t(null)})}});X({name:`togglePolygon`,category:zk.elements,icon:Ry,keywords:[`loop`],label:(e,t,n)=>n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds}).some(e=>!ks(e)||!e.polygon)?`labels.polygon.convertToPolygon`:`labels.polygon.breakPolygon`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds});return i.length>0&&i.every(e=>ks(e)&&e.points.length>=4)},perform(e,t,n,r){let i=r.scene.getSelectedElements(t);if(i.some(e=>!ks(e)))return!1;let a=i,o=a.some(e=>!e.polygon),s=ko(a);return{elements:e.map(e=>!s.has(e.id)||!ks(e)?e:GA(e,{backgroundColor:o?e.backgroundColor:`transparent`,...Pe(e,o)})),appState:t,captureUpdate:F.IMMEDIATELY}},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=n.scene.getSelectedElements({selectedElementIds:e.selectedElementIds});if(r.length===0||r.some(e=>!ks(e)||!e.polygon||e.points.length<3))return null;let i=r.every(e=>ks(e)&&e.polygon),a=G(i?`labels.polygon.breakPolygon`:`labels.polygon.convertToPolygon`);return(0,H.jsx)(oC,{icon:Ry,title:a,"aria-label":a,active:i,onClick:()=>t(null),style:{marginLeft:`auto`}})}});var qA=X({name:`searchMenu`,icon:fS,keywords:[`search`,`find`],label:`search.title`,viewMode:!0,trackEvent:{category:`search_menu`,action:`toggle`,predicate:e=>e.gridModeEnabled},perform(e,t,n,r){if(t.openDialog)return!1;if(t.openSidebar?.name===ne.name&&t.openSidebar.tab===`search`){let e=r.excalidrawContainerValue.container?.querySelector(`.${Po.SEARCH_MENU_INPUT_WRAPPER} input`);return e?.focus(),e?.select(),!1}return{appState:{...t,openSidebar:{name:ne.name,tab:Xn},openDialog:null},captureUpdate:F.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[L.CTRL_OR_CMD]&&e.key===L.F}),JA=X({name:`cropEditor`,label:`helpDialog.cropStart`,icon:RS,viewMode:!0,trackEvent:{category:`menu`},keywords:[`image`,`crop`],perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];return{appState:{...t,isCropping:!1,croppingElementId:i.id},captureUpdate:F.IMMEDIATELY}},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(!t.croppingElementId&&i.length===1&&Pa(i[0]))},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=G(`helpDialog.cropStart`);return(0,H.jsx)(Y,{type:`button`,icon:RS,title:r,"aria-label":r,onClick:()=>t(null)})}}),YA=(e,t)=>{let n=t.scene.getSelectedElements(e);return n.length===1&&I(n[0])},XA=X({name:`selectAllElementsInFrame`,label:`labels.selectAllElementsInFrame`,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;if(I(i)){let n=Jo(nc(e),i.id).filter(e=>!(e.type===`text`&&e.containerId));return{elements:e,appState:{...t,selectedElementIds:n.reduce((e,t)=>(e[t.id]=!0,e),{})},captureUpdate:F.IMMEDIATELY}}return{elements:e,appState:t,captureUpdate:F.EVENTUALLY}},predicate:(e,t,n,r)=>YA(t,r)}),ZA=X({name:`removeAllElementsFromFrame`,label:`labels.removeAllElementsFromFrame`,trackEvent:{category:`history`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;return I(i)?{elements:S(e,i),appState:{...t,selectedElementIds:{[i.id]:!0}},captureUpdate:F.IMMEDIATELY}:{elements:e,appState:t,captureUpdate:F.EVENTUALLY}},predicate:(e,t,n,r)=>YA(t,r)});X({name:`updateFrameRendering`,label:`labels.updateFrameRendering`,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t)=>({elements:e,appState:{...t,frameRendering:{...t.frameRendering,enabled:!t.frameRendering.enabled}},captureUpdate:F.EVENTUALLY}),checked:e=>e.frameRendering.enabled}),X({name:`setFrameAsActiveTool`,label:`toolBar.frame`,trackEvent:{category:`toolbar`},icon:eS,viewMode:!1,perform:(e,t,n,r)=>{let i=Vt(t,{type:`frame`});return Ww(r.interactiveCanvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:Vt(t,{type:`frame`})},captureUpdate:F.EVENTUALLY}},keyTest:e=>!e[L.CTRL_OR_CMD]&&!e.shiftKey&&!e.altKey&&e.key.toLocaleLowerCase()===L.F});var QA=X({name:`wrapSelectionInFrame`,label:`labels.wrapSelectionInFrame`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=A(e,t);return i.length>0&&!i.some(e=>I(e))},perform:(e,t,n,r)=>{let i=A(e,t),a=r.scene.getNonDeletedElementsMap(),[o,s,c,l]=Rn(i,a),u=qa({x:o-16,y:s-16,width:c-o+32,height:l-s+32});if(t.editingGroupId){let e=mr(i,t.editingGroupId);for(let n of e){let e=n.groupIds.indexOf(t.editingGroupId);ge(n,a,{groupIds:n.groupIds.slice(0,e)})}}return{elements:oa([...r.scene.getElementsIncludingDeleted(),u],i,u,t),appState:{selectedElementIds:{[u.id]:!0}},captureUpdate:F.IMMEDIATELY}}}),$A=class extends de{applyTo(e,t,n){let[r,i]=this.elements.applyTo(e,n.elements,{excludedProperties:new Set([`version`,`versionNonce`])}),[a,o]=this.appState.applyTo(t,r);return[r,a,i||o]}static calculate(e,t){return super.calculate(e,t)}static inverse(e){return super.inverse(e)}static applyLatestChanges(e,t,n,r){return super.applyLatestChanges(e,t,n,r)}},ej=class{constructor(e=!0,t=!0){this.isUndoStackEmpty=e,this.isRedoStackEmpty=t}},tj=class e{constructor(e){this.store=e,i(this,`onHistoryChangedEmitter`,new ht),i(this,`undoStack`,[]),i(this,`redoStack`,[])}get isUndoStackEmpty(){return this.undoStack.length===0}get isRedoStackEmpty(){return this.redoStack.length===0}clear(){this.undoStack.length=0,this.redoStack.length=0}record(e){if(e.isEmpty()||e instanceof $A)return;let t=$A.inverse(e);this.undoStack.push(t),t.elements.isEmpty()||(this.redoStack.length=0),this.onHistoryChangedEmitter.trigger(new ej(this.isUndoStackEmpty,this.isRedoStackEmpty))}undo(t,n){return this.perform(t,n,()=>e.pop(this.undoStack),t=>e.push(this.redoStack,t))}redo(t,n){return this.perform(t,n,()=>e.pop(this.redoStack),t=>e.push(this.undoStack,t))}perform(e,t,n,r){try{let i=n();if(i===null)return;let a=F.IMMEDIATELY,o=this.store.snapshot,s=e,c=t,l=!1;for(;i;){try{[s,c,l]=i.applyTo(s,c,o);let e=o.elements,t=o.maybeClone(a,s,c),n=fi.create(o,t),r=$A.applyLatestChanges(i,e,s);r.isEmpty()||(this.store.scheduleMicroAction({action:a,change:n,delta:r}),i=r),o=t}finally{r(i)}if(l)break;i=n()}return[s,c]}finally{this.onHistoryChangedEmitter.trigger(new ej(this.isUndoStackEmpty,this.isRedoStackEmpty))}}static pop(e){if(!e.length)return null;let t=e.pop();return t===void 0?null:t}static push(e,t){let n=$A.inverse(t);return e.push(n)}},nj=(e,t)=>{let[n,r]=(0,V.useState)(t);return(0,V.useEffect)(()=>{let t=e.on(e=>{r(e)});return()=>{t()}},[e]),n},rj=(e,t,n)=>{if(!t.multiElement&&!t.resizingElement&&!t.editingTextElement&&!t.newElement&&!t.selectedElementsAreBeingDragged&&!t.selectionElement&&!e.flowChartCreator.isCreatingChart){let e=n();if(!e)return{captureUpdate:F.EVENTUALLY};let[t,r]=e;return{appState:r,elements:to(Array.from(t.values())),captureUpdate:F.NEVER}}return{captureUpdate:F.EVENTUALLY}},ij=e=>({name:`undo`,label:`buttons.undo`,icon:Ab,trackEvent:{category:`history`},viewMode:!1,perform:(t,n,r,i)=>rj(i,n,()=>e.undo(ko(t),n)),keyTest:e=>e[L.CTRL_OR_CMD]&&Fa(e,L.Z)&&!e.shiftKey,PanelComponent:({appState:t,updateData:n,data:r,app:i})=>{let{isUndoStackEmpty:a}=nj(e.onHistoryChangedEmitter,new ej(e.isUndoStackEmpty,e.isRedoStackEmpty)),o=mz()===`mobile`;return(0,H.jsx)(Y,{type:`button`,icon:Ab,"aria-label":G(`buttons.undo`),onClick:n,size:r?.size||`medium`,disabled:a,"data-testid":`button-undo`,style:{...o?zn:{}}})}}),aj=e=>({name:`redo`,label:`buttons.redo`,icon:jb,trackEvent:{category:`history`},viewMode:!1,perform:(t,n,r,i)=>rj(i,n,()=>e.redo(ko(t),n)),keyTest:e=>e[L.CTRL_OR_CMD]&&e.shiftKey&&Fa(e,L.Z)||Da&&e.ctrlKey&&!e.shiftKey&&Fa(e,L.Y),PanelComponent:({appState:t,updateData:n,data:r,app:i})=>{let{isRedoStackEmpty:a}=nj(e.onHistoryChangedEmitter,new ej(e.isUndoStackEmpty,e.isRedoStackEmpty)),o=mz()===`mobile`;return(0,H.jsx)(Y,{type:`button`,icon:jb,"aria-label":G(`buttons.redo`),onClick:n,size:r?.size||`medium`,disabled:a,"data-testid":`button-redo`,style:{...o?zn:{}}})}}),oj=X({name:`autoResize`,label:`labels.autoResize`,icon:null,trackEvent:{category:`element`},predicate:(e,t,n)=>{let r=A(e,t);return r.length===1&&M(r[0])&&!r[0].autoResize},perform:(e,t,n)=>{let r=A(e,t),i=b(n)&&M(n)?n:r[0];return{appState:t,elements:e.map(e=>{if(e.id===i?.id&&M(e)){let t=zi(e.originalText,ao(e),e.lineHeight);return P(e,{autoResize:!0,width:t.width,height:t.height,text:e.originalText})}return e}),captureUpdate:F.IMMEDIATELY}}}),sj=(e,t,n,r,i,a)=>{if(e.trackEvent)try{typeof e.trackEvent==`object`&&(!e.trackEvent.predicate||e.trackEvent.predicate(n,r,a))&&aC(e.trackEvent.category,e.trackEvent.action||e.name,`${t} (${i.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`)}catch(e){console.error(`error while logging action:`,e)}},cj=class{constructor(e,t,n,r){i(this,`actions`,{}),i(this,`updater`),i(this,`getAppState`),i(this,`getElementsIncludingDeleted`),i(this,`app`),i(this,`renderAction`,(e,t)=>{let n=this.app.props.UIOptions.canvasActions;if(this.actions[e]&&`PanelComponent`in this.actions[e]&&(!(e in n)||n[e])){let n=this.actions[e],r=n.PanelComponent;r.displayName=`PanelComponent`;let i=this.getElementsIncludingDeleted(),a=this.getAppState();return(0,H.jsx)(r,{elements:this.getElementsIncludingDeleted(),appState:this.getAppState(),updateData:e=>{sj(n,`ui`,a,i,this.app,e),this.updater(n.perform(this.getElementsIncludingDeleted(),this.getAppState(),e,this.app))},appProps:this.app.props,app:this.app,data:t,renderAction:this.renderAction})}return null}),i(this,`isActionEnabled`,e=>{let t=this.getElementsIncludingDeleted(),n=this.getAppState();return!e.predicate||e.predicate(t,n,this.app.props,this.app)}),this.updater=t=>{if(x(t))t.then(t=>e(t));else return e(t)},this.getAppState=t,this.getElementsIncludingDeleted=n,this.app=r}registerAction(e){this.actions[e.name]=e}registerAll(e){e.forEach(e=>this.registerAction(e))}handleKeyDown(e){let t=this.app.props.UIOptions.canvasActions,n=Object.values(this.actions).sort((e,t)=>(t.keyPriority||0)-(e.keyPriority||0)).filter(n=>(n.name in t?t[n.name]:!0)&&n.keyTest&&n.keyTest(e,this.getAppState(),this.getElementsIncludingDeleted(),this.app));if(n.length!==1)return n.length>1&&console.warn(`Canceling as multiple actions match this shortcut`,n),!1;let r=n[0];if(this.getAppState().viewModeEnabled&&r.viewMode!==!0)return!1;let i=this.getElementsIncludingDeleted(),a=this.getAppState();return sj(r,`keyboard`,a,i,this.app,null),e.preventDefault(),e.stopPropagation(),this.updater(n[0].perform(i,a,null,this.app)),!0}executeAction(e,t=`api`,n=null){let r=this.getElementsIncludingDeleted(),i=this.getAppState();sj(e,t,i,r,this.app,n),this.updater(e.perform(r,i,n,this.app))}},lj=class{constructor(){i(this,`targets`,new WeakMap),i(this,`rafIds`,new WeakMap)}register(e,t){this.targets.set(e,{callback:t,stopped:!0})}start(e){let t=this.targets.get(e);t&&(this.rafIds.has(e)||(this.targets.set(e,{...t,stopped:!1}),this.scheduleFrame(e)))}stop(e){let t=this.targets.get(e);t&&!t.stopped&&this.targets.set(e,{...t,stopped:!0}),this.cancelFrame(e)}constructFrame(e){return t=>{let n=this.targets.get(e);if(!n)return;let r=this.onFrame(n,t);!n.stopped&&!r?this.scheduleFrame(e):this.cancelFrame(e)}}scheduleFrame(e){let t=requestAnimationFrame(this.constructFrame(e));this.rafIds.set(e,t)}cancelFrame(e){if(this.rafIds.has(e)){let t=this.rafIds.get(e);cancelAnimationFrame(t)}this.rafIds.delete(e)}onFrame(e,t){return e.callback(t)??!1}},uj=e=>{let t=Array.from(e.values());return{x:fj(t,e=>e.x)/t.length,y:fj(t,e=>e.y)/t.length}},dj=([e,t])=>Math.hypot(e.x-t.x,e.y-t.y),fj=(e,t)=>e.reduce((e,n)=>e+t(n),0),pj=8,mj=99999,hj=e=>pj/e,gj=class{};i(gj,`referenceSnapPoints`,null),i(gj,`visibleGaps`,null),i(gj,`setReferenceSnapPoints`,e=>{gj.referenceSnapPoints=e}),i(gj,`getReferenceSnapPoints`,()=>gj.referenceSnapPoints),i(gj,`setVisibleGaps`,e=>{gj.visibleGaps=e}),i(gj,`getVisibleGaps`,()=>gj.visibleGaps),i(gj,`destroy`,()=>{gj.referenceSnapPoints=null,gj.visibleGaps=null});var _j=gj,vj=e=>e.props.gridModeEnabled??e.state.gridModeEnabled,yj=({event:e,app:t,selectedElements:n})=>{if(e){let n=t.state.activeTool.type===`lasso`&&t.state.selectedElementsAreBeingDragged;return(t.state.activeTool.type!==`lasso`||n)&&(t.state.objectsSnapModeEnabled&&!e[L.CTRL_OR_CMD]||!t.state.objectsSnapModeEnabled&&e[L.CTRL_OR_CMD]&&!vj(t))}return n.length===1&&n[0].type===`arrow`?!1:t.state.objectsSnapModeEnabled},bj=(e,t,n=.01)=>Math.abs(e-t)<=n,xj=(e,t,{omitCenter:n,boundingBoxCorners:r,dragOffset:i}={omitCenter:!1,boundingBoxCorners:!1})=>{let a=[];if(e.length===1){let o=e[0],[s,c,l,u,d,f]=si(o,t);i&&(s+=i.x,l+=i.x,d+=i.x,c+=i.y,u+=i.y,f+=i.y);let p=(l-s)/2,m=(u-c)/2;if((o.type===`diamond`||o.type===`ellipse`)&&!r){let e=z(N(s,c+m),N(d,f),o.angle),t=z(N(s+p,c),N(d,f),o.angle),r=z(N(l,c+m),N(d,f),o.angle),i=z(N(s+p,u),N(d,f),o.angle),h=N(d,f);a=n?[e,t,r,i]:[e,t,r,i,h]}else{let e=z(N(s,c),N(d,f),o.angle),t=z(N(l,c),N(d,f),o.angle),r=z(N(s,u),N(d,f),o.angle),i=z(N(l,u),N(d,f),o.angle),p=N(d,f);a=n?[e,t,r,i]:[e,t,r,i,p]}}else if(e.length>1){let[t,r,o,s]=mi(e,i??{x:0,y:0}),c=o-t,l=s-r,u=N(t,r),d=N(o,r),f=N(t,s),p=N(o,s),m=N(t+c/2,r+l/2);a=n?[u,d,f,p]:[u,d,f,p,m]}return a.map(e=>N(Oj(e[0]),Oj(e[1])))},Sj=(e,t,n,r)=>se(e,t,n,r),Cj=(e,t,n,r)=>{let i=Ys(Sj(e,t,n,r),r).filter(e=>!(e.length===1&&Ra(e[0]))).map(e=>Rn(e).map(e=>Oj(e))),a=i.sort((e,t)=>e[0]-t[0]),o=[],s=0;e:for(let e=0;e<a.length;e++){let t=a[e];for(let n=e+1;n<a.length;n++){if(++s>mj)break e;let e=a[n],[,r,i,c]=t,[l,u,,d]=e;i<l&&It(D(r,c),D(u,d))&&o.push({startBounds:t,endBounds:e,startSide:[N(i,r),N(i,c)],endSide:[N(l,u),N(l,d)],length:l-i,overlap:Ds(D(r,c),D(u,d))})}}let c=i.sort((e,t)=>e[1]-t[1]),l=[];s=0;e:for(let e=0;e<c.length;e++){let t=c[e];for(let n=e+1;n<c.length;n++){if(++s>mj)break e;let e=c[n],[r,,i,a]=t,[o,u,d]=e;a<u&&It(D(r,i),D(o,d))&&l.push({startBounds:t,endBounds:e,startSide:[N(r,a),N(i,a)],endSide:[N(o,u),N(d,u)],length:u-a,overlap:Ds(D(r,i),D(o,d))})}}return{horizontalGaps:o,verticalGaps:l}},wj=(e,t,n,r,i,a,o)=>{if(!yj({app:n,event:r,selectedElements:e})||e.length===0)return[];let s=_j.getVisibleGaps();if(s){let{horizontalGaps:n,verticalGaps:r}=s,[c,l,u,d]=mi(e,t).map(e=>Oj(e)),f=(c+u)/2,p=(l+d)/2;for(let e of n){if(!It(D(l,d),e.overlap))continue;let t=Oj(e.startSide[0][0]+e.length/2-f);if(e.length>u-c&&Math.abs(t)<=o.x){Math.abs(t)<o.x&&(i.length=0),o.x=Math.abs(t);let n={type:`gap`,direction:`center_horizontal`,gap:e,offset:t};i.push(n);continue}let[,,n]=e.endBounds,r=c-n,a=Oj(e.length-r);if(Math.abs(a)<=o.x){Math.abs(a)<o.x&&(i.length=0),o.x=Math.abs(a);let t={type:`gap`,direction:`side_right`,gap:e,offset:a};i.push(t);continue}let[s,,,]=e.startBounds,p=Oj(s-u-e.length);if(Math.abs(p)<=o.x){Math.abs(p)<o.x&&(i.length=0),o.x=Math.abs(p);let t={type:`gap`,direction:`side_left`,gap:e,offset:p};i.push(t);continue}}for(let e of r){if(!It(D(c,u),e.overlap))continue;let t=Oj(e.startSide[0][1]+e.length/2-p);if(e.length>d-l&&Math.abs(t)<=o.y){Math.abs(t)<o.y&&(a.length=0),o.y=Math.abs(t);let n={type:`gap`,direction:`center_vertical`,gap:e,offset:t};a.push(n);continue}let[,n,,]=e.startBounds,r=Oj(n-d-e.length);if(Math.abs(r)<=o.y){Math.abs(r)<o.y&&(a.length=0),o.y=Math.abs(r);let t={type:`gap`,direction:`side_top`,gap:e,offset:r};a.push(t);continue}let[,,,i]=e.endBounds,s=Oj(l-i),f=e.length-s;if(Math.abs(f)<=o.y){Math.abs(f)<o.y&&(a.length=0),o.y=Math.abs(f);let t={type:`gap`,direction:`side_bottom`,gap:e,offset:f};a.push(t);continue}}}},Tj=(e,t,n,r)=>Ys(Sj(e,t,n,r),r).filter(e=>!(e.length===1&&Ra(e[0]))).flatMap(e=>xj(e,r)),Ej=(e,t,n,r,i,a,o)=>{if(!yj({app:n,event:r,selectedElements:e})||e.length===0&&t.length===0)return[];let s=_j.getReferenceSnapPoints();if(s)for(let e of t)for(let t of s){let n=t[0]-e[0],r=t[1]-e[1];Math.abs(n)<=o.x&&(Math.abs(n)<o.x&&(i.length=0),i.push({type:`point`,points:[e,t],offset:n}),o.x=Math.abs(n)),Math.abs(r)<=o.y&&(Math.abs(r)<o.y&&(a.length=0),a.push({type:`point`,points:[e,t],offset:r}),o.y=Math.abs(r))}},Dj=(e,t,n,r,i)=>{let a=n.state,o=A(e,a);if(!yj({app:n,event:r,selectedElements:o})||o.length===0)return{snapOffset:{x:0,y:0},snapLines:[]};t.x=Oj(t.x),t.y=Oj(t.y);let s=[],c=[],l=hj(a.zoom.value),u={x:l,y:l};Ej(o,xj(o,i,{dragOffset:t}),n,r,s,c,u),wj(o,t,n,r,s,c,u);let d={x:s[0]?.offset??0,y:c[0]?.offset??0};u.x=0,u.y=0,s.length=0,c.length=0;let f={x:Oj(t.x+d.x),y:Oj(t.y+d.y)};Ej(o,xj(o,i,{dragOffset:f}),n,r,s,c,u),wj(o,f,n,r,s,c,u);let p=Aj(s,c),m=Mj(o,f,[...s,...c].filter(e=>e.type===`gap`));return{snapOffset:d,snapLines:[...p,...m]}},Oj=e=>Math.round(e*10**6)/10**6,kj=e=>{let t=new Map;for(let n of e){let e=n.join(`,`);t.has(e)||t.set(e,n)}return Array.from(t.values())},Aj=(e,t)=>{let n={},r={};if(e.length>0){for(let t of e)if(t.type===`point`){let e=Oj(t.points[0][0]);n[e]||(n[e]=[]),n[e].push(...t.points.map(e=>N(Oj(e[0]),Oj(e[1]))))}}if(t.length>0){for(let e of t)if(e.type===`point`){let t=Oj(e.points[0][1]);r[t]||(r[t]=[]),r[t].push(...e.points.map(e=>N(Oj(e[0]),Oj(e[1]))))}}return Object.entries(n).map(([e,t])=>({type:`points`,points:kj(t.map(t=>N(Number(e),t[1])).sort((e,t)=>e[1]-t[1]))})).concat(Object.entries(r).map(([e,t])=>({type:`points`,points:kj(t.map(t=>N(t[0],Number(e))).sort((e,t)=>e[0]-t[0]))})))},jj=e=>{let t=new Map;for(let n of e){let e=n.points.flat().map(e=>[Oj(e)]).join(`,`);t.has(e)||t.set(e,n)}return Array.from(t.values())},Mj=(e,t,n)=>{let[r,i,a,o]=mi(e,t),s=[];for(let e of n){let[t,n,c,l]=e.gap.startBounds,[u,d,f,p]=e.gap.endBounds,m=Ds(D(i,o),e.gap.overlap),h=Ds(D(r,a),e.gap.overlap);switch(e.direction){case`center_horizontal`:if(m){let t=(m[0]+m[1])/2;s.push({type:`gap`,direction:`horizontal`,points:[N(e.gap.startSide[0][0],t),N(r,t)]},{type:`gap`,direction:`horizontal`,points:[N(a,t),N(e.gap.endSide[0][0],t)]})}break;case`center_vertical`:if(h){let t=(h[0]+h[1])/2;s.push({type:`gap`,direction:`vertical`,points:[N(t,e.gap.startSide[0][1]),N(t,i)]},{type:`gap`,direction:`vertical`,points:[N(t,o),N(t,e.gap.endSide[0][1])]})}break;case`side_right`:if(m){let e=(m[0]+m[1])/2;s.push({type:`gap`,direction:`horizontal`,points:[N(c,e),N(u,e)]},{type:`gap`,direction:`horizontal`,points:[N(f,e),N(r,e)]})}break;case`side_left`:if(m){let e=(m[0]+m[1])/2;s.push({type:`gap`,direction:`horizontal`,points:[N(a,e),N(t,e)]},{type:`gap`,direction:`horizontal`,points:[N(c,e),N(u,e)]})}break;case`side_top`:if(h){let e=(h[0]+h[1])/2;s.push({type:`gap`,direction:`vertical`,points:[N(e,o),N(e,n)]},{type:`gap`,direction:`vertical`,points:[N(e,l),N(e,d)]})}break;case`side_bottom`:if(h){let e=(h[0]+h[1])/2;s.push({type:`gap`,direction:`vertical`,points:[N(e,l),N(e,d)]},{type:`gap`,direction:`vertical`,points:[N(e,p),N(e,i)]})}break}}return jj(s.map(e=>({...e,points:e.points.map(e=>N(Oj(e[0]),Oj(e[1])))})))},Nj=(e,t,n,r,i,a)=>{if(!yj({event:r,selectedElements:e,app:n})||e.length===0||e.length===1&&!bj(e[0].angle,0))return{snapOffset:{x:0,y:0},snapLines:[]};let[o,s,c,l]=Rn(t);a&&(a.includes(`e`)?c+=i.x:a.includes(`w`)&&(o+=i.x),a.includes(`n`)?s+=i.y:a.includes(`s`)&&(l+=i.y));let u=[];if(a)switch(a){case`e`:u.push(N(c,s),N(c,l));break;case`w`:u.push(N(o,s),N(o,l));break;case`n`:u.push(N(o,s),N(c,s));break;case`s`:u.push(N(o,l),N(c,l));break;case`ne`:u.push(N(c,s));break;case`nw`:u.push(N(o,s));break;case`se`:u.push(N(c,l));break;case`sw`:u.push(N(o,l));break}let d=hj(n.state.zoom.value),f={x:d,y:d},p=[],m=[];Ej(t,u,n,r,p,m,f);let h={x:p[0]?.offset??0,y:m[0]?.offset??0};f.x=0,f.y=0,p.length=0,m.length=0;let[g,_,v,y]=Rn(e).map(e=>Oj(e));return Ej(e,[N(g,_),N(g,y),N(v,_),N(v,y)],n,r,p,m,f),{snapOffset:h,snapLines:Aj(p,m)}},Pj=(e,t,n,r,i,a)=>{if(!yj({event:n,selectedElements:[e],app:t}))return{snapOffset:{x:0,y:0},snapLines:[]};let o=[N(r.x+i.x,r.y+i.y)],s=hj(t.state.zoom.value),c={x:s,y:s},l=[],u=[];Ej([e],o,t,n,l,u,c);let d={x:l[0]?.offset??0,y:u[0]?.offset??0};c.x=0,c.y=0,l.length=0,u.length=0;let f=xj([e],a,{boundingBoxCorners:!0,omitCenter:!0});return Ej([e],f,t,n,l,u,c),{snapOffset:d,snapLines:Aj(l,u)}},Fj=(e,t,n,r,i)=>{if(!yj({event:r,selectedElements:[],app:t}))return{originOffset:{x:0,y:0},snapLines:[]};let a=se(e,[],t.state,i),o=hj(t.state.zoom.value),s={x:o,y:o},c=[],l=[];for(let e of a){let t=xj([e],i);for(let e of t){let t=e[0]-n.x;Math.abs(t)<=Math.abs(s.x)&&(Math.abs(t)<Math.abs(s.x)&&(l.length=0),l.push({type:`pointer`,points:[e,N(e[0],n.y)],direction:`vertical`}),s.x=t);let r=e[1]-n.y;Math.abs(r)<=Math.abs(s.y)&&(Math.abs(r)<Math.abs(s.y)&&(c.length=0),c.push({type:`pointer`,points:[e,N(n.x,e[1])],direction:`horizontal`}),s.y=r)}}return{originOffset:{x:l.length>0?l[0].points[0][0]-n.x:0,y:c.length>0?c[0].points[0][1]-n.y:0},snapLines:[...l,...c]}},Ij=e=>e===pn.rectangle||e===pn.ellipse||e===pn.diamond||e===pn.frame||e===pn.magicframe||e===pn.image||e===pn.text,Lj=class{constructor(e){i(this,`scene`),i(this,`getRenderableElements`,(()=>{let e=({elementsMap:e,zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a,height:o,width:s})=>{let c=[];for(let l of e.values())gr(l,s,o,{zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a},e)&&c.push(l);return c},t=({elements:e,editingTextElement:t,newElementId:n})=>{let r=u(new Map);for(let i of e)n!==i.id&&(!t||t.type!==`text`||i.id!==t.id)&&r.set(i.id,i);return r};return Vo(({zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o,height:s,width:c,editingTextElement:l,newElementId:u,sceneNonce:d})=>{let f=t({elements:this.scene.getNonDeletedElements(),editingTextElement:l,newElementId:u});return{elementsMap:f,visibleElements:e({elementsMap:f,zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o,height:s,width:c})}})})()),this.scene=e}destroy(){Pt.cancel(),this.getRenderableElements.clear()}},Rj=5,zj=(e,t,n)=>{let[r,i]=si(e,n),{x:a,y:o}=Qa({sceneX:r+e.width,sceneY:i},t);return{x:a-t.offsetLeft+10,y:o-t.offsetTop}},Bj=({children:e,element:t,elementsMap:n})=>{let r=_z();if(r.contextMenu||r.newElement||r.resizingElement||r.isRotating||r.openMenu||r.viewModeEnabled)return null;let{x:i,y:a}=zj(t,r,n);return(0,H.jsx)(`div`,{className:`excalidraw-canvas-buttons`,style:{top:`${a}px`,left:`${i}px`,padding:Rj},children:e})},Vj=class{constructor(e,t,n){this.animationFrameHandler=e,this.app=t,this.options=n,i(this,`currentTrail`),i(this,`pastTrails`,[]),i(this,`container`),i(this,`trailElement`),i(this,`trailAnimation`),this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.trailElement=document.createElementNS(rn,`path`),this.options.animateTrail&&(this.trailAnimation=document.createElementNS(`http://www.w3.org/2000/svg`,`animate`),this.trailAnimation.setAttribute(`attributeName`,`stroke-dashoffset`),this.trailElement.setAttribute(`stroke-dasharray`,`7 7`),this.trailElement.setAttribute(`stroke-dashoffset`,`10`),this.trailAnimation.setAttribute(`from`,`0`),this.trailAnimation.setAttribute(`to`,`-14`),this.trailAnimation.setAttribute(`dur`,`0.3s`),this.trailElement.appendChild(this.trailAnimation))}get hasCurrentTrail(){return!!this.currentTrail}hasLastPoint(e,t){if(this.currentTrail){let n=this.currentTrail.originalPoints.length;return this.currentTrail.originalPoints[n-1][0]===e&&this.currentTrail.originalPoints[n-1][1]===t}return!1}start(e){e&&(this.container=e),this.trailElement.parentNode!==this.container&&this.container&&this.container.appendChild(this.trailElement),this.animationFrameHandler.start(this)}stop(){this.animationFrameHandler.stop(this),this.trailElement.parentNode===this.container&&this.container?.removeChild(this.trailElement)}startPath(e,t){this.currentTrail=new ly(this.options),this.currentTrail.addPoint([e,t,performance.now()]),this.update()}addPointToPath(e,t){this.currentTrail&&(this.currentTrail.addPoint([e,t,performance.now()]),this.update())}endPath(){this.currentTrail&&(this.currentTrail.close(),this.currentTrail.options.keepHead=!1,this.pastTrails.push(this.currentTrail),this.currentTrail=void 0,this.update())}getCurrentTrail(){return this.currentTrail}clearTrails(){this.pastTrails=[],this.currentTrail=void 0,this.update()}update(){this.start(),this.trailAnimation&&(this.trailAnimation.setAttribute(`begin`,`indefinite`),this.trailAnimation.setAttribute(`repeatCount`,`indefinite`))}onFrame(){let e=[];for(let t of this.pastTrails)e.push(this.drawTrail(t,this.app.state));if(this.currentTrail){let t=this.drawTrail(this.currentTrail,this.app.state);e.push(t)}this.pastTrails=this.pastTrails.filter(e=>e.getStrokeOutline().length!==0),e.length===0&&this.stop();let t=e.join(` `).trim();this.trailElement.setAttribute(`d`,t),this.trailAnimation?(this.trailElement.setAttribute(`fill`,(this.options.fill??(()=>`black`))(this)),this.trailElement.setAttribute(`stroke`,(this.options.stroke??(()=>`black`))(this))):this.trailElement.setAttribute(`fill`,(this.options.fill??(()=>`black`))(this))}drawTrail(e,t){let n=e.getStrokeOutline(e.options.size/t.zoom.value).map(([e,n])=>{let r=Qa({sceneX:e,sceneY:n},t);return[r.x,r.y]});return ct(this.trailAnimation?n.slice(0,n.length/2):n,!0)}},Hj=class{constructor(e,t){this.animationFrameHandler=e,this.app=t,i(this,`localTrail`),i(this,`collabTrails`,new Map),i(this,`container`),this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.localTrail=new Vj(e,t,{...this.getTrailOptions(),fill:()=>`red`})}getTrailOptions(){return{simplify:0,streamline:.4,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/1e3),n=(50-Math.min(50,e.totalLength-e.currentIndex))/50;return Math.min(En(n),En(t))}}}startPath(e,t){this.localTrail.startPath(e,t)}addPointToPath(e,t){this.localTrail.addPointToPath(e,t)}endPath(){this.localTrail.endPath()}start(e){this.container=e,this.animationFrameHandler.start(this),this.localTrail.start(e)}stop(){this.animationFrameHandler.stop(this),this.localTrail.stop()}onFrame(){this.updateCollabTrails()}updateCollabTrails(){if(!(!this.container||this.app.state.collaborators.size===0)){for(let[e,t]of this.app.state.collaborators.entries()){let n;this.collabTrails.has(e)?n=this.collabTrails.get(e):(n=new Vj(this.animationFrameHandler,this.app,{...this.getTrailOptions(),fill:()=>t.pointer?.laserColor||tE(e,t)}),n.start(this.container),this.collabTrails.set(e,n)),t.pointer&&t.pointer.tool===`laser`&&(t.button===`down`&&!n.hasCurrentTrail&&n.startPath(t.pointer.x,t.pointer.y),t.button===`down`&&n.hasCurrentTrail&&!n.hasLastPoint(t.pointer.x,t.pointer.y)&&n.addPointToPath(t.pointer.x,t.pointer.y),t.button===`up`&&n.hasCurrentTrail&&(n.addPointToPath(t.pointer.x,t.pointer.y),n.endPath()))}for(let e of this.collabTrails.keys())this.app.state.collaborators.has(e)||(this.collabTrails.get(e).stop(),this.collabTrails.delete(e))}}},Uj=e=>t=>{(0,lc.unstable_batchedUpdates)(e,t)},Wj=e=>Ai(t=>{(0,lc.unstable_batchedUpdates)(e,t)}),Gj=(()=>{let e;try{let t=V.version.split(`.`);e=Number(t[0])>17}catch{e=!1}let t=!1;return()=>window.EXCALIDRAW_THROTTLE_RENDER===!0?e?!0:(t||(t=!0,console.warn(`Excalidraw: render throttling is disabled on React versions < 18.`)),!1):!1})(),Kj=12,qj=16,Jj=10,Yj=qj+2,Xj=.8,Zj=e=>4/e,Qj=(e,t,n)=>{if(n!==`desktop`||qj>e.height*t*Xj)return null;let r=Zj(t),i=Kj/t,a=qj/t,o=N(e.x+e.width/2,e.y+e.height/2),s=z(N(o[0]+e.width/2+r+i,o[1]),o,e.angle);return{center:s,start:z(N(s[0],s[1]-a/2),s,e.angle),end:z(N(s[0],s[1]+a/2),s,e.angle),hitboxWidth:Jj/t,hitboxHeight:Yj/t}},$j=(e,t,n,r)=>{let i=Qj(t,n,r);if(!i)return!1;let a=z(N(e.x,e.y),i.center,-t.angle);return Math.abs(a[0]-i.center[0])<=i.hitboxWidth/2&&Math.abs(a[1]-i.center[1])<=i.hitboxHeight/2},eM=(e,t,n,r,i,a)=>{let{zoom:o}=r,s=180*n/Math.PI,c=e*(o.value-1)/2,l=t*(o.value-1)/2;return e>i&&o.value!==1&&(c=i*(o.value-1)/2),t>a&&o.value!==1&&(l=a*(o.value-1)/2),`translate(${c}px, ${l}px) scale(${o.value}) rotate(${s}deg)`},tM=(e,t)=>{let n=e.lastIndexOf(`
54
- `,Math.max(0,t-1))+1,r=e.indexOf(`
55
- `,t);return tt(e.slice(n,r===-1?e.length:r))?`rtl`:`ltr`},nM=e=>{let t=[0],n=0;for(let r of Array.from(e))n+=r.length,t.push(n);return t},rM=({text:e,font:t,lineHeightPx:n,direction:r,targetX:i})=>{if(!e||!document.body||typeof document.createRange!=`function`)return null;let a=nM(e),o=document.createElement(`div`),s=document.createTextNode(e),c=document.createRange(),l=[];o.dir=r,Object.assign(o.style,{position:`fixed`,top:`0`,left:`0`,margin:0,padding:0,border:0,opacity:`0`,pointerEvents:`none`,whiteSpace:`pre`,font:t,lineHeight:`${n}px`}),o.append(s),document.body.append(o);try{for(let e of a){c.setStart(s,e),c.setEnd(s,e);let t=c.getBoundingClientRect();if(!Number.isFinite(t.left))return null;l.push(t.left)}}catch{return null}finally{o.remove()}let u=Math.min(...l),d=a[0],f=1/0;for(let e=0;e<a.length;e++){let t=Math.abs(l[e]-u-i);t<f&&(f=t,d=a[e])}return d},iM=({id:e,onChange:t,onSubmit:n,getViewportCoords:r,element:i,canvas:a,excalidrawContainer:o,app:s,autoSelect:c=!0,initialCaretSceneCoords:l=null})=>{let u=null,d=(e,t)=>{if(!t.style.fontFamily||!t.style.fontSize)return!1;let n=t.style.fontFamily.replace(/"/g,``);return ra({fontFamily:e.fontFamily})!==n||`${e.fontSize}px`!==t.style.fontSize},f=s.state.theme,p=()=>{f=s.state.theme;let t=s.state,n=s.scene.getElement(e);if(!n)return;let{textAlign:i,verticalAlign:a}=n,o=s.scene.getNonDeletedElementsMap();if(n&&M(n)){let e=n.x,c=n.y,l=Xa(n,s.scene.getNonDeletedElementsMap()),f=n.width,p=n.height,h=n.width,g=n.height;if(l&&n.containerId){if(nt(l)){let t=B.getBoundTextElementPosition(l,n,o);e=t.x,c=t.y}let t=d(n,m),r;if(t?r=mo(l.id,l.height):(r=Qi[l.id],r||=mo(l.id,l.height)),h=yr(l,n),g=nn(l,n),!nt(l)&&p>g){let e=Nt(p,l.type);s.scene.mutateElement(l,{height:e}),be(l,s.scene);return}else if(!nt(l)&&l.height>r.height&&p<g){let e=Nt(p,l.type);s.scene.mutateElement(l,{height:e}),be(l,s.scene)}else{let{x:t,y:r}=Es(l,n,o);e=t,c=r}}let[_,v]=r(e,c);l?f+=.5:(h=(t.width-8-_)/t.zoom.value,f=Math.min(f,h)),p*=1.05;let y=ao(n),b=te(n,l),x=(t.height-v)/t.zoom.value;Object.assign(m.style,{font:y,lineHeight:n.lineHeight,width:`${f}px`,height:`${p}px`,left:`${_}px`,top:`${v}px`,transform:eM(f,p,b,t,h,x),textAlign:i,verticalAlign:a,color:t.theme===R.DARK?$n(n.strokeColor):n.strokeColor,opacity:n.opacity/100,maxHeight:`${x}px`}),u={angle:b,font:y,height:n.height,lineHeightPx:gn(n.fontSize,n.lineHeight),textAlign:i,width:n.width,x:e,y:c},m.scrollTop=0,Ro()&&(m.style.fontFamily=ra(n)),s.scene.mutateElement(n,{x:e,y:c})}},m=document.createElement(`textarea`);m.dir=`auto`,m.tabIndex=0,m.dataset.type=`wysiwyg`,m.wrap=`off`,m.classList.add(`excalidraw-wysiwyg`);let h=`pre`,g=`normal`;(Ra(i)||!i.autoResize)&&(h=`pre-wrap`,g=`break-word`),Object.assign(m.style,{position:`absolute`,display:`inline-block`,minHeight:`1em`,backfaceVisibility:`hidden`,margin:0,padding:0,border:0,outline:0,resize:`none`,background:`transparent`,overflow:`hidden`,zIndex:`var(--zIndex-wysiwyg)`,wordBreak:g,whiteSpace:h,overflowWrap:`break-word`,boxSizing:`content-box`}),m.value=i.originalText,p();let _=()=>{if(!l||!u)return null;let e=u,t=N(e.x+e.width/2,e.y+e.height/2),[n,r]=z(N(l.x,l.y),t,-e.angle),i=n-e.x,a=r-e.y,o=ws(m.value,e.font,h===`pre-wrap`?e.width:1/0),s=o[Math.max(0,Math.min(o.length-1,Math.floor(a/e.lineHeightPx)))],c=tM(m.value,s.start),d=Pi(s.text,e.font),f=i-(e.textAlign===`center`?(e.width-d)/2:e.textAlign===`right`?e.width-d:0);if(!s.text)return s.start;let p=rM({text:s.text,font:e.font,lineHeightPx:e.lineHeightPx,direction:c,targetX:f});return s.start+(p||0)},v=(()=>{let e=_();return e===null?null:{start:e,end:e}})();t&&(m.onpaste=async e=>{let t=CT(e),n=null;if(t.has(Vs.excalidrawClipboard)||t.has(Vs.excalidraw)){e.preventDefault(),n=await wT(e);try{let e=await TT(n);if(e.elements){let t=bi(e.elements);if(t){let{selectionStart:e,selectionEnd:n,value:r}=m;m.value=r.slice(0,e)+t+r.slice(n),m.selectionStart=m.selectionEnd=e+t.length,m.dispatchEvent(new Event(`input`))}}return}catch{console.warn(`failed to parse excalidraw clipboard data`)}}n||=await wT(e);let r=n.findByType(Vs.text);if(!r)return;let a=Ea(r.value);if(!a)return;let o=Xa(i,s.scene.getNonDeletedElementsMap()),c=ao({fontSize:s.state.currentItemFontSize,fontFamily:s.state.currentItemFontFamily});if(o){let e=bn(o,s.scene.getNonDeletedElementsMap()),t=dn(Sa(`${m.value}${a}`,c,yr(o,e)),c);m.style.width=`${t}px`}},m.oninput=()=>{let e=Ea(m.value);if(m.value!==e){let t=m.selectionStart;m.value=e,m.selectionStart=t,m.selectionEnd=t}t(m.value)}),m.onkeydown=e=>{if(!e.shiftKey&&qw.keyTest(e))e.preventDefault(),s.actionManager.executeAction(qw),p();else if(!e.shiftKey&&Jw.keyTest(e))e.preventDefault(),s.actionManager.executeAction(Jw),p();else if(!e.shiftKey&&Yw.keyTest(e))e.preventDefault(),s.actionManager.executeAction(Yw),p();else if(Dw.keyTest(e))s.actionManager.executeAction(Dw);else if(Ow.keyTest(e))s.actionManager.executeAction(Ow);else if(e.key===L.ESCAPE)e.preventDefault(),T=!0,E();else if(VT.keyTest(e))e.preventDefault(),E(),s.actionManager.executeAction(VT);else if(e.key===L.ENTER&&e[L.CTRL_OR_CMD]){if(e.preventDefault(),e.isComposing||e.keyCode===229)return;T=!0,E()}else if(e.key===L.TAB||e[L.CTRL_OR_CMD]&&(e.code===Ye.BRACKET_LEFT||e.code===Ye.BRACKET_RIGHT)){if(e.preventDefault(),e.isComposing)return;e.shiftKey||e.code===Ye.BRACKET_LEFT?S():x(),m.dispatchEvent(new Event(`input`))}};let y=` `.repeat(4),b=RegExp(`^ {1,4}`),x=()=>{let{selectionStart:e,selectionEnd:t}=m,n=C(),r=m.value;n.forEach(e=>{r=`${r.slice(0,e)}${y}${r.slice(e)}`}),m.value=r,m.selectionStart=e+4,m.selectionEnd=t+4*n.length},S=()=>{let{selectionStart:e,selectionEnd:t}=m,n=C(),r=[],i=m.value;n.forEach(e=>{let t=i.slice(e,e+4).match(b);t&&(i=`${i.slice(0,e)}${i.slice(e+t[0].length)}`,r.push(e))}),m.value=i,r.length&&(e>r[r.length-1]?m.selectionStart=Math.max(e-4,r[r.length-1]):m.selectionStart=e,m.selectionEnd=Math.max(m.selectionStart,t-4*r.length))},C=()=>{let{selectionStart:e,selectionEnd:t,value:n}=m,r=n.slice(0,e).match(/[^\n]*$/)[0].length;return e-=r,n.slice(e,t).split(`
56
- `).reduce((t,n,r,i)=>t.concat(r?t[r-1]+i[r-1].length+1:e),[]).reverse()},w=e=>{e.target instanceof HTMLCanvasElement&&(e.preventDefault(),e.stopPropagation())},T=!1,E=()=>{if(ae)return;ae=!0,D();let e=s.scene.getElement(i.id);if(!e)return;let t=Xa(e,s.scene.getNonDeletedElementsMap());if(t){if(m.value.trim()){let e=Fo(t);!e||e!==i.id?s.scene.mutateElement(t,{boundElements:(t.boundElements||[]).concat({type:`text`,id:i.id})}):nt(t)&&Ki(t)}else s.scene.mutateElement(t,{boundElements:t.boundElements?.filter(e=>!M(e))});Gr(e,t,s.scene)}n({viaKeyboard:T,nextOriginalText:m.value})},D=()=>{m.onblur=null,m.oninput=null,m.onkeydown=null,oe&&oe.disconnect(),window.removeEventListener(`resize`,p),window.removeEventListener(`wheel`,w,!0),window.removeEventListener(`pointerdown`,ee),window.removeEventListener(`pointerup`,O),window.removeEventListener(`blur`,E),window.removeEventListener(`beforeunload`,E),re(),ne(),ie(),m.remove()},O=e=>{window.removeEventListener(`pointerup`,O);let t=e?.target,n=t instanceof HTMLElement&&t.classList.contains(`properties-trigger`),r=(t instanceof HTMLElement||t instanceof SVGElement)&&!!t.closest(`.properties-content`),i=(t instanceof HTMLElement||t instanceof SVGElement)&&(!!t.closest(`.${Po.SHAPE_ACTIONS_MENU}`)||!!t.closest(`.compact-shape-actions-island`));setTimeout(()=>{i||n||r||(m.onblur=E,m.focus(),v&&=(m.setSelectionRange(v.start,v.end),null))})},k=()=>{m.onblur=null,window.addEventListener(`pointerup`,O),window.addEventListener(`blur`,E)},ee=e=>{let t=e?.target;if(e.button===Mt.WHEEL){t instanceof HTMLTextAreaElement&&(e.preventDefault(),s.handleCanvasPanUsingWheelOrSpaceDrag(e)),k();return}let n=t instanceof HTMLElement&&t.classList.contains(`properties-trigger`),r=(t instanceof HTMLElement||t instanceof SVGElement)&&!!t.closest(`.properties-content`);(e.target instanceof HTMLElement||e.target instanceof SVGElement)&&(e.target.closest(`.${Po.SHAPE_ACTIONS_MENU}, .${Po.ZOOM_ACTIONS}`)||e.target.closest(`.compact-shape-actions-island`))&&!pi(e.target)||n||r?k():e.target instanceof HTMLCanvasElement&&!Ro()&&requestAnimationFrame(()=>{E()})},ne=s.onChangeEmitter.on(e=>{s.state.theme!==f&&p()}),re=s.scene.onUpdate(()=>{p(),document.activeElement?.closest(`.properties-content`)||m.focus()}),ie=s.onScrollChangeEmitter.on(()=>{p()}),ae=!1;c&&!v&&m.select(),O();let oe=null;return a&&`ResizeObserver`in window?(oe=new window.ResizeObserver(()=>{p()}),oe.observe(a)):window.addEventListener(`resize`,p),m.onpointerdown=e=>e.stopPropagation(),requestAnimationFrame(()=>{window.addEventListener(`pointerdown`,ee,{capture:!0})}),window.addEventListener(`beforeunload`,E),o?.querySelector(`.excalidraw-textEditorContainer`).appendChild(m),E},aM=4,oM=6,sM=`rgba(0,0,0,0.3)`,cM=(e,t,n,r)=>{if(!e.size)return{horizontal:null,vertical:null};let[i,a,o,s]=Rn(e),c=t/r.zoom.value,l=n/r.zoom.value,u={top:parseInt(no(`sat`))||0,bottom:parseInt(no(`sab`))||0,left:parseInt(no(`sal`))||0,right:parseInt(no(`sar`))||0},d=Ey().rtl,f=-r.scrollX+u.left,p=-r.scrollY+u.top,m=f+c-u.right,h=p+l-u.bottom,g=Math.min(i,f),_=Math.min(a,p),v=Math.max(o,m),y=Math.max(s,h),b=o-i,x=s-a,S=v-g,C=y-_,w=Math.max(aM*2,u.left+u.right)+oM*2,T=c/S*t-w,E=Math.max(aM*2,u.top+u.bottom)+oM*2,D=l/C*n-E,O=S>b?S*r.zoom.value/(T+w):t/(T+w),k=C>x?C*r.zoom.value/(D+E):n/(D+E);return{horizontal:f===g&&m===v?null:{x:Math.max(u.left,aM)+oM+(f-g)/S*t,y:n-oM-Math.max(aM,u.bottom),width:T,height:oM,deltaMultiplier:O},vertical:p===_&&h===y?null:{x:d?Math.max(u.left,aM):t-oM-Math.max(u.right,aM),y:Math.max(u.top,aM)+oM+(p-_)/C*n,width:oM,height:D,deltaMultiplier:k}}},lM=(e,t,n)=>{let[r,i]=[e.horizontal,e.vertical].map(e=>e!=null&&e.x<=t&&t<=e.x+e.width&&e.y<=n&&n<=e.y+e.height);return{isOverEither:r||i,isOverHorizontal:r,isOverVertical:i}},uM=e=>RegExp(`^(?:%%{.*?}%%[\\s\\n]*)?\\b(?:${[`flowchart`,`graph`,`sequenceDiagram`,`classDiagram`,`stateDiagram`,`stateDiagram-v2`,`erDiagram`,`journey`,`gantt`,`pie`,`quadrantChart`,`requirementDiagram`,`gitGraph`,`C4Context`,`mindmap`,`timeline`,`zenuml`,`sankey`,`xychart`,`block`].map(e=>`\\s*${e}(-beta)?`).join(`|`)})\\b`).test(e.trim()),dM=e=>{let{lassoPath:t,elements:n,elementsMap:r,elementsSegments:i,intersectedElements:a,enclosedElements:o,simplifyDistance:s}=e,c=t;s&&(c=Sv(t,s));let l=n.filter(e=>!e.locked);o.clear(),a.clear();let u=t.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[0]),Math.max(e[3],t[1])],[1/0,1/0,-1/0,-1/0]);for(let e of l)Ur(u,yn(e,r))&&!a.has(e.id)&&!o.has(e.id)&&(fM(c,e,i)?o.add(e.id):pM(c,e,r)&&a.add(e.id));return{selectedElementIds:[...a,...o]}},fM=(e,t,n)=>{let r=Xe(e),i=n.get(t.id);return i?i.some(e=>e.some(e=>bt(e,r))):!1},pM=(e,t,n)=>{let r=e.slice(1).map((t,n)=>In(e[n],t)).concat([In(e[e.length-1],e[0])]),i=bn(t,n);return r.some(e=>Na(t,n,e,0,!0).length>0||!!i&&Na({...i,...Es(t,i,n)},n,e,0,!0).length>0)},mM=class extends Vj{constructor(e,t){super(e,t,{animateTrail:!0,streamline:.4,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/(1/0)),n=(5e3-Math.min(5e3,e.totalLength-e.currentIndex))/5e3;return Math.min(En(n),En(t))},fill:()=>`rgba(105,101,219,0.05)`,stroke:()=>`rgba(105,101,219)`}),i(this,`intersectedElements`,new Set),i(this,`enclosedElements`,new Set),i(this,`elementsSegments`,null),i(this,`canvasTranslate`,null),i(this,`keepPreviousSelection`,!1),i(this,`selectElementsFromIds`,e=>{this.app.setState(t=>{let n=e.reduce((e,t)=>(e[t]=!0,e),{});if(this.keepPreviousSelection)for(let e of Object.keys(t.selectedElementIds))n[e]=!0;for(let[e]of Object.entries(n)){let t=this.app.scene.getNonDeletedElement(e);if(t&&M(t)){let e=Xa(t,this.app.scene.getNonDeletedElementsMap());e&&(n[e.id]=!0,delete n[t.id])}}for(let[e]of Object.entries(n)){let t=this.app.scene.getNonDeletedElement(e);if(t&&I(t)){let e=Jo(this.app.scene.getNonDeletedElementsMap(),t.id);for(let t of e)delete n[t.id]}}let r=jr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.app.scene.getNonDeletedElements(),t,this.app),i=[...Object.keys(r.selectedElementIds)],a=[...Object.keys(r.selectedGroupIds)];return{selectedElementIds:r.selectedElementIds,selectedGroupIds:r.selectedGroupIds,selectedLinearElement:i.length===1&&!a.length&&Bo(this.app.scene.getNonDeletedElement(i[0]))?new B(this.app.scene.getNonDeletedElement(i[0]),this.app.scene.getNonDeletedElementsMap()):null}})}),i(this,`addPointToPath`,(e,t,n=!1)=>{super.addPointToPath(e,t),this.keepPreviousSelection=n,this.updateSelection()}),i(this,`updateSelection`,()=>{let e=super.getCurrentTrail()?.originalPoints?.map(e=>N(e[0],e[1])),t={scrollX:this.app.state.scrollX,scrollY:this.app.state.scrollY,zoom:this.app.state.zoom.value};if(!this.elementsSegments||!Uo(t,this.canvasTranslate??{})){this.canvasTranslate=t,this.elementsSegments=new Map;let e=ko(this.app.visibleElements);for(let t of this.app.visibleElements){let n=fs(t,e);this.elementsSegments.set(t.id,n)}}if(e){let{selectedElementIds:t}=dM({lassoPath:e,elements:this.app.visibleElements,elementsMap:this.app.scene.getNonDeletedElementsMap(),elementsSegments:this.elementsSegments,intersectedElements:this.intersectedElements,enclosedElements:this.enclosedElements,simplifyDistance:5/this.app.state.zoom.value});this.selectElementsFromIds(t)}})}startPath(e,t,n=!1){this.endPath(),super.startPath(e,t),this.intersectedElements.clear(),this.enclosedElements.clear(),this.keepPreviousSelection=n,this.keepPreviousSelection||this.app.setState({selectedElementIds:{},selectedGroupIds:{},selectedLinearElement:null})}endPath(){super.endPath(),super.clearTrails(),this.intersectedElements.clear(),this.enclosedElements.clear(),this.elementsSegments=null}},hM=class extends Vj{constructor(e,t){super(e,t,{streamline:.2,size:5,keepHead:!0,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/200),n=(10-Math.min(10,e.totalLength-e.currentIndex))/10;return Math.min(En(n),En(t))},fill:()=>t.state.theme===R.LIGHT?`rgba(0, 0, 0, 0.2)`:`rgba(255, 255, 255, 0.2)`}),i(this,`elementsToErase`,new Set),i(this,`groupsToErase`,new Set)}startPath(e,t){this.endPath(),super.startPath(e,t),this.elementsToErase.clear()}addPointToPath(e,t,n=!1){return super.addPointToPath(e,t),this.updateElementsToBeErased(n)}updateElementsToBeErased(e){let t=super.getCurrentTrail()?.originalPoints?.map(e=>N(e[0],e[1]))||[];if(t.length<2)return[];let n=In(t[t.length-1],t[t.length-2]),r=this.app.visibleElements.filter(e=>!e.locked),i=ko(r);for(let t of r)if(e&&this.elementsToErase.has(t.id)){if(gM(n,t,i,this.app.state.zoom.value)){let e=t.groupIds.at(-1);if(this.groupsToErase.has(e)){let t=mr(this.app.scene.getNonDeletedElementsMap(),e);for(let e of t)this.elementsToErase.delete(e.id);this.groupsToErase.delete(e)}if(Ra(t)&&this.elementsToErase.delete(t.containerId),ys(t)){let e=Fo(t);e&&this.elementsToErase.delete(e)}this.elementsToErase.delete(t.id)}}else if(!e&&!this.elementsToErase.has(t.id)&&gM(n,t,i,this.app.state.zoom.value)){let e=t.groupIds.at(-1);if(!this.groupsToErase.has(e)){let t=mr(this.app.scene.getNonDeletedElementsMap(),e);for(let e of t)this.elementsToErase.add(e.id);this.groupsToErase.add(e)}if(ys(t)){let e=Fo(t);e&&this.elementsToErase.add(e)}Ra(t)&&this.elementsToErase.add(t.containerId),this.elementsToErase.add(t.id)}return Array.from(this.elementsToErase)}endPath(){super.endPath(),super.clearTrails(),this.elementsToErase.clear(),this.groupsToErase.clear()}},gM=(e,t,n,r)=>{let i=e[1],a=Ht(t)?15:t.strokeWidth/2,o=[Math.min(e[0][0],e[1][0])-a,Math.min(e[0][1],e[1][1])-a,Math.max(e[0][0],e[1][0])+a,Math.max(e[0][1],e[1][1])+a],s=yn(t,n);if(!Ur(o,[s[0]-a,s[1]-a,s[2]+a,s[3]+a]))return!1;if(Bt(t)&&ur(i,t,n))return!0;if(Ht(t)){let i=hs(t),a=wa(t,i,n),o=Math.max(2.25,5/r);for(let t of a)if(v(t,e)<=o)return!0;let s=er(...i.map(([e,n])=>N(t.x+e,t.y+n)));return!!bt(e[0],s)}let c=bn(t,n);if(nt(t)||ks(t)&&!t.polygon){let i=Math.max(t.strokeWidth,t.strokeWidth*2/r),a=fs(t,n);for(let t of a)if(v(t,e)<=i)return!0;return!1}return Na(t,n,e,0,!0).length>0||!!c&&Na({...c,...Es(t,c,n)},n,e,0,!0).length>0},_M=44,vM=22,yM=66,bM=48,xM=14,SM=304,CM=320,wM=5.87,TM=28,EM=4,DM=2,OM=10,kM=10,AM=8,jM=12,MM=256,NM=10,PM=4,FM=jM*2,IM=jM*2,LM=100,RM=140,zM=.35,BM=jM/2,VM=20,HM=jM*2,UM=jM,WM={fillStyle:`hachure`,fontFamily:wi,fontSize:20,opacity:100,roughness:1,strokeColor:Mi.black,roundness:null,strokeStyle:`solid`,strokeWidth:1,verticalAlign:ns.MIDDLE,locked:!1},GM=ms(4),KM=e=>e.labels?.length??e.series[0]?.values.length??0,qM=(e,t)=>{if(!e)return!1;let n=KM(e);return n<2?!1:t===`radar`?n>=3:!0},JM=(e,t)=>e+(t<=1?0:Math.min(yM,(t-1)*vM)),YM=(e,t)=>{if(e===`line`){let e=JM(bM,t);return{slotWidth:e,gap:xM,chartHeight:CM,xLabelMaxWidth:e+xM*3+OM}}let n=JM(_M,t);return{slotWidth:n,gap:xM,chartHeight:SM,xLabelMaxWidth:n+xM*3+OM}},XM=(e,t)=>({chartWidth:(t.slotWidth+t.gap)*e.series[0].values.length+t.gap,chartHeight:t.chartHeight+t.gap*2}),ZM=()=>({chartWidth:MM+IM*2,chartHeight:MM+IM*2}),QM=(e,t,n)=>{let r=Math.abs(e-t);return Math.min(r,n-r)},$M=(e,t)=>{if(e<=0||GM.length===0)return[];let n=GM.length,r=(t%n+n)%n,i=[r],a=Math.min(e,n),o=new Set(Array.from({length:n},(e,t)=>t).filter(e=>e!==r));for(;i.length<a;){let e=-1,t=-1,r=-1;for(let a of o){let o=i.map(e=>QM(a,e,n)),s=Math.min(...o),c=o.reduce((e,t)=>e+t,0)/o.length;(s>t||s===t&&c>r)&&(e=a,t=s,r=c)}i.push(e),o.delete(e)}return Array.from({length:e},(e,t)=>GM[i[t%i.length]])},eN=e=>{if(GM.length===0)return 0;if(typeof e!=`number`||!Number.isFinite(e))return Math.floor(Math.random()*GM.length);let t=e.toString(),n=0;for(let e=0;e<t.length;e++)n=n*31+t.charCodeAt(e)|0;return Math.abs(n)%GM.length},tN=e=>GM[e],nN=(e,t)=>{let n=e.flatMap(e=>e.values.map(e=>Math.max(0,e))),r=n.filter(e=>e>0),i=Math.max(1,...n),a=r.length>0?Math.min(...r):1,o=e.length===1&&a>0&&i/a>=LM;return{renderSteps:!1,normalize:(e,t)=>{let n=Math.max(0,e);return o?Math.log10(n+1)/Math.log10(i+1):n/i}}},rN=e=>/\s/.test(e.trim()),iN=(e,t,n)=>rN(e)?Sa(e,t,n):e,aN=(e,t,n,r,i,a)=>{let o=oi.Excalifont,s=Eo.sm,c=hn(o),l=ao({fontFamily:o,fontSize:s}),u=Math.min(RM,i*(e.length>8?.56:.72)),d=p(l,c),f=e.map((e,f)=>{let p=t[f],m=Math.max(0,...e.trim().split(/\s+/).filter(Boolean).map(e=>zi(e,l,c).width)),h=iN(e,l,Math.max(d,u,m)),g=zi(h,l,c),_=Math.cos(p),v=Math.sin(p),y=_>zM?`left`:_<-zM?`right`:`center`,b=y===`center`?g.width/2:0,x=FM+(Math.abs(_)*b+Math.abs(v)*(g.height/2))+BM,S=n+_*(i+x),C=r+v*(i+x),w=v>zM?jM/3:v<-zM?-jM/3:0;return qe({backgroundColor:a,...WM,text:h,originalText:e,x:S,y:C+w,fontFamily:o,fontSize:s,lineHeight:c,textAlign:y,verticalAlign:`middle`})});return{axisLabels:f,axisLabelTopY:Math.min(...f.map(e=>e.y)),axisLabelBottomY:Math.max(...f.map(e=>e.y+e.height))}},oN=(e,t,n,r,i,a)=>{if(e.length<=1)return[];let o=oi[`Lilita One`],s=Eo.lg,c=hn(o),l=ao({fontFamily:o,fontSize:s}),u=e.map((e,n)=>{let r=e.title?.trim()||`Series ${n+1}`,i=iN(r,l,MM),a=zi(i,l,c),o=VM+UM+a.width;return{label:r,displayLabel:i,color:t[n],width:o,height:a.height}}),d=Math.max(VM/2,...u.map(e=>e.height/2)),f=Math.max(i,r+d+FM),p=HM,m=VM*.6,h=u.reduce((e,t)=>e+t.width,0)+HM*Math.max(0,u.length-1),g=h+p*2,v=d*2+m*2,y=[];y.push(_({...WM,backgroundColor:`transparent`,type:`rectangle`,fillStyle:`solid`,strokeColor:Mi.black,x:n-g/2,y:f-v/2,width:g,height:v,roughness:qi.architect,roundness:{type:fo.PROPORTIONAL_RADIUS}}));let b=n-h/2;return u.forEach(e=>{y.push(_({...WM,backgroundColor:e.color,type:`rectangle`,x:b,y:f-VM/2,width:VM,height:VM,fillStyle:`solid`,strokeColor:e.color,roughness:qi.architect,roundness:{type:fo.PROPORTIONAL_RADIUS}})),y.push(qe({...WM,text:e.displayLabel,originalText:e.label,autoResize:!1,x:b+VM+UM,y:f,fontFamily:o,fontSize:s,lineHeight:c,textAlign:`left`,verticalAlign:`middle`})),b+=e.width+HM}),y},sN=(e,t,n,r)=>{if(zi(e,n,r).width<=t)return e;let i=e.length;for(;i>1;){let a=`${e.slice(0,i)}...`;if(zi(a,n,r).width<=t)return a;i--}return e[0]?`${e[0]}...`:e},cN=(e,t,n,r)=>{if(zi(e,n,r).width<=t)return{wrapped:!1,text:e};let i=e.trim().split(/\s+/).filter(Boolean);return i.length>1&&!i.some(e=>zi(e,n,r).width>t)&&t>=p(n,r)?{wrapped:!0,text:Sa(e,n,t)}:{wrapped:!1,text:sN(e,t,n,r)}},lN=(e,t,n)=>{let r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n));return{width:e*r+t*i,height:e*i+t*r}},uN=e=>e.includes(`...`),dN=(e,t,n,r,i)=>{let a=Math.max(TM,Math.ceil(p(r,i))),o=Math.max(a,Math.floor(t)),s=[];for(let e=o;e>=a;e-=4)s.push(e);s[s.length-1]!==a&&s.push(a);let c=e=>({ellipsified:uN(e.text),visibleChars:e.text.replace(/\.\.\./g,``).replace(/\n/g,``).length,lineCount:e.text.split(`
57
- `).length}),l=(e,t)=>{let n=c(e),r=c(t);return n.ellipsified===r.ellipsified?n.visibleChars===r.visibleChars?n.lineCount===r.lineCount?e.rotatedHeight<t.rotatedHeight:n.lineCount<r.lineCount:n.visibleChars>r.visibleChars:!n.ellipsified},u=null,d=null,f=null;for(let t of s){let{wrapped:a,text:o}=cN(e,t,r,i),s=zi(o,r,i),c=lN(s.width,s.height,wM),p={originalText:e,text:o,metrics:s,rotatedWidth:c.width,rotatedHeight:c.height,wrapped:a},m=c.width-n;if(m<=0){(!u||l(p,u))&&(u=p);continue}(!d||m<d.overflow||m===d.overflow&&l(p,d.spec))&&(d={overflow:m,spec:p}),!uN(p.text)&&(!f||m<f.overflow||m===f.overflow&&l(p,f.spec))&&(f={overflow:m,spec:p})}return u||(f&&d&&f.overflow<=d.overflow+AM?f.spec:d.spec)},fN=e=>{if(e.type!==`text`)return e.y+e.height;let t=lN(e.width,e.height,e.angle);return e.y+e.height/2+t.height/2},pN=(e,t,n,r,i)=>{let a=WM.fontFamily,o=Eo.sm,s=hn(a),c=ao({fontFamily:a,fontSize:o}),l=Math.max(1,i.slotWidth+i.gap-EM*2+kM),u=n;return e.labels?.map((e,n)=>{let a=dN(e,i.xLabelMaxWidth,l,c,s),d=t+n*(i.slotWidth+i.gap)+i.gap+i.slotWidth/2,f=u+DM+(a.rotatedHeight-a.metrics.height)/2;return qe({backgroundColor:r,...WM,text:a.text,originalText:a.wrapped?e:a.text,autoResize:!a.wrapped,x:d,y:f,angle:wM,fontSize:o,lineHeight:s,textAlign:`center`,verticalAlign:`top`})})||[]},mN=(e,t,n,r,i,a=Math.max(...e.series[0].values))=>{let o=qe({backgroundColor:r,...WM,x:t-i.gap,y:n-i.gap,text:`0`,textAlign:`right`});return[o,qe({backgroundColor:r,...WM,x:t-i.gap,y:n-i.chartHeight-o.height/2,text:a.toLocaleString(),textAlign:`right`})]},hN=(e,t,n,r,i)=>{let{chartWidth:a,chartHeight:o}=XM(e,i);return[Te({backgroundColor:r,...WM,type:`line`,x:t,y:n,width:a,points:[N(0,0),N(a,0)]}),Te({backgroundColor:r,...WM,type:`line`,x:t,y:n,height:o,points:[N(0,0),N(0,-o)]}),Te({backgroundColor:r,...WM,type:`line`,x:t,y:n-i.chartHeight-i.gap,strokeStyle:`dotted`,width:a,opacity:NM,points:[N(0,0),N(a,0)]})]},gN=(e,t,n,r,i,a=Math.max(...e.series[0].values),o)=>{let{chartWidth:s,chartHeight:c}=XM(e,i),l=e.title?qe({backgroundColor:r,...WM,text:e.title,x:t+s/2,y:n-i.chartHeight-i.gap*2-20,roundness:null,textAlign:`center`,fontSize:Eo.xl,fontFamily:oi[`Lilita One`]}):null,u=o?_({backgroundColor:r,...WM,type:`rectangle`,x:t,y:n-c,width:s,height:c,strokeColor:Mi.black,fillStyle:`solid`,opacity:6}):null;return[...u?[u]:[],...l?[l]:[],...pN(e,t,n,r,i),...mN(e,t,n,r,i,a),...hN(e,t,n,r,i)]},_N=(e,t,n,r)=>{let i=e.series,a=YM(`bar`,i.length),o=Math.max(1,...i.flatMap(e=>e.values.map(e=>Math.max(0,e)))),s=eN(r),c=tN(s),l=$M(i.length,s),u=i.length>1?Math.max(1,Math.floor(a.gap/(i.length+1))):0,d=i.length>1?Math.max(2,(a.slotWidth-u*(i.length-1))/i.length):a.slotWidth,f=i.length*d+u*(i.length-1),p=(a.slotWidth-f)/2,m=i[0].values.flatMap((e,r)=>i.map((e,s)=>{let f=Math.max(0,e.values[r]??0)/o*a.chartHeight,m=i.length>1?l[s]:c;return _({backgroundColor:m,...WM,type:`rectangle`,fillStyle:i.length>1?`solid`:WM.fillStyle,strokeColor:i.length>1?m:WM.strokeColor,x:t+r*(a.slotWidth+a.gap)+a.gap+p+s*(d+u),y:n-f-a.gap,width:d,height:f})})),h=gN(e,t,n,c,a,o,it()),g=pN(e,t,n,c,a),v=Math.max(n+a.gap/2,...g.map(e=>fN(e))),{chartWidth:y}=XM(e,a),b=oN(i,l,t+y/2,v,n+a.gap*5,c);return[...h,...m,...b]},vN=(e,t,n,r)=>{let i=e.series,a=YM(`line`,i.length),o=Math.max(1,...i.flatMap(e=>e.values)),s=eN(r),c=tN(s),l=$M(i.length,s),u=i.map((e,r)=>{let i=e.values.map((e,t)=>N(t*(a.slotWidth+a.gap),-(e/o)*a.chartHeight)),s=Math.max(...i.map(e=>e[0])),c=Math.max(...i.map(e=>e[1])),u=Math.min(...i.map(e=>e[0])),d=Math.min(...i.map(e=>e[1]));return Te({backgroundColor:`transparent`,...WM,type:`line`,x:t+a.gap+a.slotWidth/2,y:n-a.gap,height:c-d,width:s-u,strokeColor:l[r],strokeWidth:2,points:i})}),d=i.flatMap((e,r)=>e.values.map((e,i)=>{let s=i*(a.slotWidth+a.gap)+a.gap/2,c=-(e/o)*a.chartHeight+a.gap/2;return _({backgroundColor:l[r],...WM,fillStyle:`solid`,strokeColor:l[r],strokeWidth:2,type:`ellipse`,x:t+s+a.slotWidth/2,y:n+c-a.gap*2,width:a.gap,height:a.gap})})),f=i[0].values.map((e,t)=>Math.max(0,...i.map(e=>e.values[t]??0))).map((e,r)=>{let i=r*(a.slotWidth+a.gap)+a.gap/2,s=e/o*a.chartHeight+a.gap/2+a.gap;return Te({backgroundColor:c,...WM,type:`line`,x:t+i+a.slotWidth/2+a.gap/2,y:n-s,height:s,strokeStyle:`dotted`,opacity:NM,points:[N(0,0),N(0,s)]})}),p=gN(e,t,n,c,a,o,it()),m=pN(e,t,n,c,a),h=Math.max(n+a.gap/2,...m.map(e=>fN(e))),{chartWidth:g}=XM(e,a),v=oN(i,l,t+g/2,h,n+a.gap*5,c);return[...p,...u,...f,...d,...v]},yN=e=>{let t=/^([-+]?)[$\u20AC\u00A3\u00A5\u20A9]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,``)):null},bN=(e,t)=>e.slice(1).every(e=>yN(e[t])!==null),xN=e=>{let t=e[0].length;if(t>2){let n=e[0].every(e=>yN(e)===null),r=n?e.slice(1):e;if(r.length<1)return{ok:!1,reason:`No data rows`};if(r.some(e=>e.slice(1).some(e=>yN(e)===null)))return{ok:!1,reason:`Value is not numeric`};if(t-1>r.length){let t=n?e[0].slice(1).map(e=>e.trim()):null,i=r.map(e=>({title:e[0]?.trim()||null,values:e.slice(1).map(e=>yN(e))}));return{ok:!0,data:{title:i.length===1?i[0].title:n&&e[0][0].trim()||null,labels:t,series:i}}}let i=e[0].slice(1).map((e,t)=>{let i=t+1,a=`Series ${i}`;return{title:n&&e.trim()||a,values:r.map(e=>yN(e[i]))}});return{ok:!0,data:{title:n&&e[0][0].trim()||null,labels:r.map(e=>e[0]),series:i}}}if(t===1){if(!bN(e,0))return{ok:!1,reason:`Value is not numeric`};let t=yN(e[0][0])===null,n=t?e[0][0]:null,r=(t?e.slice(1):e).map(e=>yN(e[0]));return r.length<2?{ok:!1,reason:`Less than two rows`}:{ok:!0,data:{title:n,labels:null,series:[{title:n,values:r}]}}}let n=yN(e[0][1])===null,r=n?e.slice(1):e;if(r.length<2)return{ok:!1,reason:`Less than 2 rows`};if(r.some(e=>yN(e[1])===null))return{ok:!1,reason:`Value is not numeric`};let i=n?e[0][1]:null;return{ok:!0,data:{title:i,labels:r.map(e=>e[0]),series:[{title:i,values:r.map(e=>yN(e[1]))}]}}},SN=e=>{let t=t=>e.replace(/\r\n?/g,`
58
- `).split(`
59
- `).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)?xN(r):{ok:!1,reason:`All rows don't have same number of columns`}},CN=(e,t,n,r)=>{if(!qM(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}=nN(a,i.length),c=eN(r),l=tN(c),u=$M(a.length,c),{chartWidth:d,chartHeight:f}=ZM(),p=t+d/2,m=n-f/2,h=MM/2,g=i.map((e,t)=>-Math.PI/2+Math.PI*2*t/i.length),{axisLabels:_,axisLabelTopY:v,axisLabelBottomY:y}=aN(i,g,p,m,h,l),b=oi[`Lilita One`],x=Eo.xl,S=hn(b),C=ao({fontFamily:b,fontSize:x}),w=e.title?iN(e.title,C,d+FM*2):null,T=w?zi(w,C,S):null,E=w?qe({backgroundColor:l,...WM,text:w,originalText:e.title??w,x:t+d/2,y:v-FM-T.height/2,fontFamily:b,fontSize:x,lineHeight:S,textAlign:`center`}):null,D=s?Array.from({length:PM},(e,t)=>{let n=h*((t+1)/PM),r=g.map(e=>N(Math.cos(e)*n,Math.sin(e)*n));return r.push(N(r[0][0],r[0][1])),Te({backgroundColor:`transparent`,...WM,type:`line`,x:p,y:m,width:n*2,height:n*2,strokeStyle:`solid`,roughness:qi.architect,opacity:NM,polygon:!0,points:r})}):[],O=g.map(e=>{let t=Math.cos(e)*h,n=Math.sin(e)*h;return Te({backgroundColor:`transparent`,...WM,type:`line`,x:p,y:m,width:Math.abs(t),height:Math.abs(n),strokeStyle:`solid`,roughness:qi.architect,opacity:NM,points:[N(0,0),N(t,n)]})}),k=a.map((e,t)=>{let n=g.map((t,n)=>{let r=o(e.values[n]??0,n)*h;return N(Math.cos(t)*r,Math.sin(t)*r)});return n.push(N(n[0][0],n[0][1])),Te({backgroundColor:`transparent`,...WM,type:`line`,x:p,y:m,width:h*2,height:h*2,strokeColor:u[t],strokeWidth:2,polygon:!0,points:n})}),ee=oN(a,u,p,y,n+jM*5,l);return[...E?[E]:[],..._,...D,...O,...k,...ee]},wN=(e,t,n,r,i)=>e===`line`?vN(t,n,r,i):e===`radar`?CN(t,n,r,i):_N(t,n,r,i),TN=()=>(0,H.jsxs)(`div`,{"data-testid":`brave-measure-text-error`,children:[(0,H.jsx)(`p`,{children:(0,H.jsx)(uO,{i18nKey:`errors.brave_measure_text_error.line1`,bold:e=>(0,H.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,H.jsx)(`p`,{children:(0,H.jsx)(uO,{i18nKey:`errors.brave_measure_text_error.line2`,bold:e=>(0,H.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,H.jsx)(`p`,{children:(0,H.jsx)(uO,{i18nKey:`errors.brave_measure_text_error.line3`,link:e=>(0,H.jsx)(`a`,{href:`http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser`,children:e})})}),(0,H.jsx)(`p`,{children:(0,H.jsx)(uO,{i18nKey:`errors.brave_measure_text_error.line4`,issueLink:e=>(0,H.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw/issues/new`,children:e}),discordLink:e=>(0,H.jsxs)(`a`,{href:`https://discord.gg/UexuTaE`,children:[e,`.`]})})})]}),EN=({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,V.useRef)(null);(0,V.useEffect)(()=>{let e=u.current;if(!e)return;e.contains(document.activeElement)||e.focus();let t=t=>{if(t.key===L.TAB){let n=wo(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,V.useRef)(null);return(0,V.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,V.useEffect)(()=>{if(r){let e=e=>{u.current?.contains(e.target)||(0,lc.unstable_batchedUpdates)(()=>r(e))};return document.addEventListener(`pointerdown`,e,!1),()=>document.removeEventListener(`pointerdown`,e,!1)}},[r]),(0,H.jsx)(`div`,{className:U(`popover`,l),ref:u,tabIndex:-1,children:e})},DN=`separator`,ON=V.memo(({actionManager:e,items:t,top:n,left:r,onClose:i})=>{let a=_z(),o=gz(),s=t.reduce((t,n)=>(n&&(n===DN||!n.predicate||n.predicate(o,a,e.app.props,e.app))&&t.push(n),t),[]);return(0,H.jsx)(EN,{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,H.jsx)(`ul`,{className:`context-menu`,onContextMenu:e=>e.preventDefault(),children:s.map((t,n)=>{if(t===DN)return!s[n-1]||s[n-1]===DN?null:(0,H.jsx)(`hr`,{className:`context-menu-item-separator`},n);let r=t.name,c=``;return t.label&&(c=typeof t.label==`function`?G(t.label(o,a,e.app)):G(t.label)),(0,H.jsx)(`li`,{"data-testid":r,onClick:()=>{i(()=>{e.executeAction(t,`contextMenu`)})},children:(0,H.jsxs)(`button`,{type:`button`,className:U(`context-menu-item`,{dangerous:r===`deleteSelectedElements`,checkmark:t.checked?.(a)}),children:[(0,H.jsx)(`div`,{className:`context-menu-item__label`,children:c}),(0,H.jsx)(`kbd`,{className:`context-menu-item__shortcut`,children:r?AD(r):``})]})},n)})})})}),kN=({height:e,width:t,userToFollow:n,onDisconnect:r})=>(0,H.jsx)(`div`,{className:`follow-mode`,style:{width:t,height:e},children:(0,H.jsxs)(`div`,{className:`follow-mode__badge`,children:[(0,H.jsxs)(`div`,{className:`follow-mode__badge__label`,children:[`Following`,` `,(0,H.jsx)(`span`,{className:`follow-mode__badge__username`,title:n.username,children:n.username})]}),(0,H.jsx)(`button`,{type:`button`,onClick:r,className:`follow-mode__disconnect-btn`,children:Xb})]})}),AN=({delay:e,theme:t})=>{let[n,r]=(0,V.useState)(!!e);return(0,V.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{r(!1)},e);return()=>clearTimeout(t)},[e]),n?null:(0,H.jsxs)(`div`,{className:U(`LoadingMessage`,{"LoadingMessage--dark":t===R.DARK}),children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(qS,{})}),(0,H.jsx)(`div`,{className:`LoadingMessage-text`,children:G(`labels.loadingScene`)})]})},jN=`medium`,MN={CHECKED:By,UNCHECKED:zy},NN=e=>(0,H.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__lock`,`ToolIcon_size_${jN}`,{"is-mobile":e.isMobile}),title:`${e.title} \u2014 Q`,children:[(0,H.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,H.jsx)(`div`,{className:`ToolIcon__icon`,children:e.checked?MN.CHECKED:MN.UNCHECKED})]}),PN=e=>(0,H.jsx)(Y,{className:U(`Shape`,{fillable:!1,active:e.checked}),type:`radio`,icon:Gx,name:`editor-current-shape`,checked:e.checked,title:`${e.title} \u2014 H`,keyBindingLabel:e.isMobile?void 0:L.H.toLocaleUpperCase(),"aria-label":`${e.title} \u2014 H`,"aria-keyshortcuts":L.H,"data-testid":`toolbar-hand`,onChange:()=>e.onChange?.()}),FN=[{type:`rectangle`,icon:qy,title:Be(G(`toolBar.rectangle`))},{type:`diamond`,icon:Jy,title:Be(G(`toolBar.diamond`))},{type:`ellipse`,icon:Yy,title:Be(G(`toolBar.ellipse`))}],IN=[{type:`selection`,icon:Gy,title:Be(G(`toolBar.selection`))},{type:`lasso`,icon:Ky,title:Be(G(`toolBar.lasso`))}],LN=[{type:`arrow`,icon:Xy,title:Be(G(`toolBar.arrow`))},{type:`line`,icon:Zy,title:Be(G(`toolBar.line`))}],RN=({app:e,onHandToolToggle:t,setAppState:n})=>{let r=e.state.activeTool,[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(`rectangle`),[c,l]=(0,V.useState)(`arrow`);(0,V.useEffect)(()=>{(r.type===`rectangle`||r.type===`diamond`||r.type===`ellipse`)&&s(r.type)},[r.type]),(0,V.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}=fk(),m=(t,n)=>{e.state.activeTool.type!==t&&aC(`toolbar`,t,`ui`),t===`selection`?e.state.activeTool.type===`selection`||e.setActiveTool({type:`selection`}):e.setActiveTool({type:t})},[h,g]=(0,V.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`?eb:r.type===`image`?nb:r.type===`frame`?eS:r.type===`embeddable`?cb:r.type===`laser`?aS:r.type===`magicframe`?oS:$x:$x;return(0,H.jsxs)(`div`,{className:`mobile-toolbar`,ref:e=>{e&&g(e.getBoundingClientRect().width)},children:[(0,H.jsx)(PN,{checked:Us(e.state),onChange:t,title:G(`toolBar.hand`),isMobile:!0}),(0,H.jsx)(gk,{app:e,options:IN,activeTool:r,defaultOption:e.state.preferredSelectionTool.type,namePrefix:`selectionType`,title:Be(G(`toolBar.selection`)),"data-testid":`toolbar-selection`,onToolChange:t=>{(t===`selection`||t===`lasso`)&&(e.setActiveTool({type:t}),n({preferredSelectionTool:{type:t,initialized:!0}}))},displayedOption:IN.find(t=>t.type===e.state.preferredSelectionTool.type)||IN[0]}),(0,H.jsx)(Y,{className:U({active:r.type===`freedraw`}),type:`radio`,icon:$y,checked:r.type===`freedraw`,name:`editor-current-shape`,title:`${Be(G(`toolBar.freedraw`))}`,"aria-label":Be(G(`toolBar.freedraw`)),"data-testid":`toolbar-freedraw`,onChange:()=>m(`freedraw`)}),(0,H.jsx)(Y,{className:U({active:r.type===`eraser`}),type:`radio`,icon:rb,checked:r.type===`eraser`,name:`editor-current-shape`,title:`${Be(G(`toolBar.eraser`))}`,"aria-label":Be(G(`toolBar.eraser`)),"data-testid":`toolbar-eraser`,onChange:()=>m(`eraser`)}),(0,H.jsx)(gk,{app:e,options:FN,activeTool:r,defaultOption:o,namePrefix:`shapeType`,title:Be(G(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:FN.find(e=>e.type===o)||FN[0]}),(0,H.jsx)(gk,{app:e,options:LN,activeTool:r,defaultOption:c,namePrefix:`linearElementType`,title:Be(G(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:LN.find(e=>e.type===c)||LN[0]}),_&&(0,H.jsx)(Y,{className:U({active:r.type===`text`}),type:`radio`,icon:eb,checked:r.type===`text`,name:`editor-current-shape`,title:`${Be(G(`toolBar.text`))}`,"aria-label":Be(G(`toolBar.text`)),"data-testid":`toolbar-text`,onChange:()=>m(`text`)}),v&&(0,H.jsx)(Y,{className:U({active:r.type===`image`}),type:`radio`,icon:nb,checked:r.type===`image`,name:`editor-current-shape`,title:`${Be(G(`toolBar.image`))}`,"aria-label":Be(G(`toolBar.image`)),"data-testid":`toolbar-image`,onChange:()=>m(`image`)}),y&&(0,H.jsx)(Y,{className:U({active:u}),type:`radio`,icon:eS,checked:u,name:`editor-current-shape`,title:`${Be(G(`toolBar.frame`))}`,"aria-label":Be(G(`toolBar.frame`)),"data-testid":`toolbar-frame`,onChange:()=>m(`frame`)}),(0,H.jsxs)(Q,{open:i,children:[(0,H.jsx)(Q.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:G(`toolBar.extraTools`),style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`},children:x}),(0,H.jsxs)(Q.Content,{onClickOutside:()=>a(!1),onSelect:()=>a(!1),className:`App-toolbar__extra-tools-dropdown`,align:`start`,children:[!_&&(0,H.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`text`}),icon:eb,shortcut:L.T.toLocaleUpperCase(),"data-testid":`toolbar-text`,selected:r.type===`text`,children:G(`toolBar.text`)}),!v&&(0,H.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`image`}),icon:nb,"data-testid":`toolbar-image`,selected:r.type===`image`,children:G(`toolBar.image`)}),!y&&(0,H.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`frame`}),icon:eS,shortcut:L.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:u,children:G(`toolBar.frame`)}),(0,H.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`embeddable`}),icon:cb,"data-testid":`toolbar-embeddable`,selected:f,children:G(`toolBar.embeddable`)}),(0,H.jsx)(Q.Item,{onSelect:()=>e.setActiveTool({type:`laser`}),icon:aS,"data-testid":`toolbar-laser`,selected:d,shortcut:L.K.toLocaleUpperCase(),children:G(`toolBar.laser`)}),(0,H.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),e.props.aiEnabled!==!1&&(0,H.jsx)(p.Out,{}),(0,H.jsx)(Q.Item,{onSelect:()=>e.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:tS,"data-testid":`toolbar-embeddable`,children:G(`toolBar.mermaidToExcalidraw`)}),e.props.aiEnabled!==!1&&e.plugins.diagramToCode&&(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(Q.Item,{onSelect:()=>e.onMagicframeToolSelect(),icon:oS,"data-testid":`toolbar-magicframe`,badge:(0,H.jsx)(Q.Item.Badge,{children:`AI`}),children:G(`toolBar.magicframe`)})})]})]})]})},zN=({children:e,side:t,className:n})=>(0,H.jsx)(`div`,{className:U(`FixedSideContainer`,`FixedSideContainer_side_${t}`,n),children:e}),BN=`medium`,VN=e=>e.penDetected?(0,H.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__penMode`,`ToolIcon_size_${BN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,H.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,H.jsx)(`div`,{className:`ToolIcon__icon`,children:Qy})]}):null,HN=({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}=fk();return(0,H.jsxs)(H.Fragment,{children:[s(),(0,H.jsx)(`div`,{className:`App-welcome-screen`,children:c&&(0,H.jsx)(f.Out,{})}),!e.viewModeEnabled&&(0,H.jsxs)(`div`,{className:`App-bottom-bar`,style:{marginBottom:oM+aM},children:[(0,H.jsx)(Dk,{appState:e,elementsMap:u.scene.getNonDeletedElementsMap(),renderAction:n.renderAction,app:u,setAppState:r}),(0,H.jsxs)(gC,{className:`App-toolbar`,children:[!e.viewModeEnabled&&e.openDialog?.name!==`elementLinkSelector`&&(0,H.jsx)(RN,{app:u,onHandToolToggle:i,setAppState:r}),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&(0,H.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...Pn(t,e)}))},children:G(`buttons.scrollBackToContent`)})]})]}),(0,H.jsx)(zN,{side:`top`,className:`App-top-bar`,children:(()=>{if(e.openDialog?.name===`elementLinkSelector`)return null;let t=(0,H.jsxs)(`div`,{className:`excalidraw-ui-top-right`,children:[o?.(!0,e)??(!e.viewModeEnabled&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(VN,{checked:e.penMode,onChange:()=>d(null),title:G(`toolBar.penMode`),isMobile:!0,penDetected:e.penDetected}),(0,H.jsx)(m.Out,{})]})),e.viewModeEnabled&&(0,H.jsx)(Mk,{actionManager:n})]});return(0,H.jsxs)(`div`,{className:`App-toolbar-content`,style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{className:`excalidraw-ui-top-left`,children:[a?.(!0,e),(0,H.jsx)(p.Out,{})]}),t]})})()})]})},UN=e=>{switch(e){case`bar`:return G(`labels.chartType_bar`);case`line`:return G(`labels.chartType_line`);case`radar`:return G(`labels.chartType_radar`);default:return e}},WN=e=>{let t=(0,V.useRef)(null),[n,r]=(0,V.useState)(null),{theme:i}=uC();(0,V.useLayoutEffect)(()=>{if(!e.spreadsheet){r(null);return}let n=wN(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 xe(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=UN(e.chartType);return(0,H.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":a,onClick:()=>{n&&e.onClick(e.chartType,n)},children:[(0,H.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,H.jsx)(`div`,{className:`ChartPreview__label`,children:a})]})},GN=e=>{let t=(0,V.useRef)(null),{theme:n}=uC();return(0,V.useLayoutEffect)(()=>{if(!e.rawText)return;let r=qe({text:e.rawText,x:0,y:0}),i=t.current;return(async()=>{let e=await xe([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,H.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":G(`labels.chartType_plaintext`),onClick:()=>{e.onClick(e.rawText)},children:[(0,H.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,H.jsx)(`div`,{className:`ChartPreview__label`,children:G(`labels.chartType_plaintext`)})]})},KN=({data:e,rawText:t,onClose:n})=>{let{onInsertElements:r,focusContainer:i}=dz(),[a,o]=(0,V.useState)(Math.random()),s=V.useCallback(()=>{o(Math.random())},[]),c=V.useCallback(()=>{n&&n()},[n]),l=(e,t)=>{r(t),aC(`paste`,`chart`,e),n(),i()};return(0,H.jsx)(sk,{size:`regular`,onCloseRequest:c,title:(0,H.jsxs)(`div`,{className:`PasteChartDialog__title`,children:[(0,H.jsx)(`div`,{className:`PasteChartDialog__titleText`,children:G(`labels.pasteCharts`)}),(0,H.jsx)(`div`,{className:`PasteChartDialog__reshuffleBtn`,onClick:s,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},children:Tb})]}),className:`PasteChartDialog`,autofocus:!1,children:(0,H.jsxs)(`div`,{className:`container`,children:[[`bar`,`line`,`radar`].map(t=>qM(e,t)?(0,H.jsx)(WN,{chartType:t,spreadsheet:e,colorSeed:a,onClick:l},t):null),t&&(0,H.jsx)(GN,{rawText:t,onClick:e=>{r([qe({text:e,x:0,y:0})]),aC(`paste`,`chart`,`plaintext`),n(),i()}})]})})},qN=({heading:e,children:t,...n})=>{let{id:r}=hz(),i=(0,H.jsx)(`h2`,{className:`visually-hidden`,id:`${r}-${e}-title`,children:G(`headings.${e}`)});return(0,H.jsx)(`section`,{...n,"aria-labelledby":`${r}-${e}-title`,children:typeof t==`function`?t(i):(0,H.jsxs)(H.Fragment,{children:[i,t]})})},JN=4,YN=8,XN=({shouldWrap:e,children:t,username:n})=>e?(0,H.jsx)(Nw,{label:n||`Unknown user`,children:t}):(0,H.jsx)(H.Fragment,{children:t}),ZN=({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,H.jsx)(XN,{username:t.username,shouldWrap:i,children:s},n)},QN=[`avatarUrl`,`id`,`socketId`,`username`,`isInCall`,`isSpeaking`,`isMuted`],$N=V.memo(({className:e,mobile:t,collaborators:n,userToFollow:r})=>{let i=yz(),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]=V.useState(``),l=o.filter(e=>e.username?.toLowerCase().includes(s)),u=V.useRef(null);(0,V.useLayoutEffect)(()=>{if(u.current){let e=e=>{f(Math.max(1,Math.min(8,Math.floor(e/38))))};if(e(u.current.clientWidth),!Fr)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]=V.useState(JN),p=o.slice(0,d-1).map(e=>ZN({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}));return t?(0,H.jsx)(`div`,{className:U(`UserList UserList_mobile`,e),children:o.map(e=>ZN({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}))}):(0,H.jsx)(`div`,{className:`UserList__wrapper`,ref:u,children:(0,H.jsxs)(`div`,{className:U(`UserList`,e),style:{"--max-avatars":d},children:[p,o.length>d-1&&(0,H.jsxs)(F_,{children:[(0,H.jsxs)(I_,{className:`UserList__more`,children:[`+`,o.length-d+1]}),(0,H.jsx)(R_,{style:{zIndex:2,width:`15rem`,textAlign:`left`},align:`end`,sideOffset:10,children:(0,H.jsxs)(gC,{padding:2,children:[o.length>=YN&&(0,H.jsx)(UC,{placeholder:G(`quickSearch.placeholder`),onChange:c}),(0,H.jsx)(WC,{className:`dropdown-menu UserList__collaborators`,placeholder:G(`userList.empty`),children:l.length>0?[(0,H.jsx)(`div`,{className:`hint`,children:G(`userList.hint.text`)}),l.map(e=>ZN({actionManager:i,collaborator:e,socketId:e.socketId,withName:!0,isBeingFollowed:e.socketId===r}))]:[]}),(0,H.jsx)(z_,{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||!Uo(i,e,QN))return!1}return!0}),eP=e=>(0,H.jsx)(`button`,{className:`help-icon`,onClick:e.onClick,type:`button`,title:`${G(`helpDialog.title`)} \u2014 ?`,"aria-label":G(`helpDialog.title`),children:mb}),tP=({appState:e,actionManager:t,showExitZenModeBtn:n,renderWelcomeScreen:r})=>{let{FooterCenterTunnel:i,WelcomeScreenHelpHintTunnel:a}=fk();return(0,H.jsxs)(`footer`,{role:`contentinfo`,className:`layer-ui__wrapper__footer App-menu App-menu_bottom`,children:[(0,H.jsx)(`div`,{className:U(`layer-ui__wrapper__footer-left zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:(0,H.jsx)(mO.Col,{gap:2,children:(0,H.jsxs)(qN,{heading:`canvasActions`,children:[(0,H.jsx)(kk,{renderAction:t.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&(0,H.jsx)(Ak,{renderAction:t.renderAction,className:U(`zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})})]})})}),(0,H.jsx)(i.Out,{}),(0,H.jsx)(`div`,{className:U(`layer-ui__wrapper__footer-right zen-mode-transition`,{"transition-right":e.zenModeEnabled}),children:(0,H.jsxs)(`div`,{style:{position:`relative`},children:[r&&(0,H.jsx)(a.Out,{}),(0,H.jsx)(eP,{onClick:()=>t.executeAction(JT)})]})}),(0,H.jsx)(jk,{actionManager:t,showExitZenModeBtn:n})]})},nP=tP;tP.displayName=`Footer`;var rP=V.createContext({}),iP=({children:e,className:t})=>{let n=pz(),r=(0,V.useContext)(rP),i=!!(n.canFitSidebar&&r.shouldRenderDockButton);return(0,H.jsxs)(`div`,{className:U(`sidebar__header`,t),"data-testid":`sidebar-header`,children:[e,(0,H.jsxs)(`div`,{className:`sidebar__header__buttons`,children:[i&&(0,H.jsx)(Nw,{label:G(`labels.sidebarLock`),children:(0,H.jsx)(JO,{onSelect:()=>r.onDock?.(!r.docked),selected:!!r.docked,className:`sidebar__dock`,"data-testid":`sidebar-dock`,"aria-label":G(`labels.sidebarLock`),children:Ly})}),(0,H.jsx)(JO,{"data-testid":`sidebar-close`,className:`sidebar__close`,onSelect:r.onCloseRequest,"aria-label":G(`buttons.close`),children:Xb})]})]})};iP.displayName=`SidebarHeader`;var aP=({children:e,tab:t,onSelect:n,...r})=>(0,H.jsx)(rv,{value:t,asChild:!0,onSelect:n,children:(0,H.jsx)(`button`,{type:`button`,className:`excalidraw-button sidebar-tab-trigger`,...r,children:e})});aP.displayName=`SidebarTabTrigger`;var oP=({children:e,...t})=>(0,H.jsx)(nv,{className:`sidebar-triggers`,...t,children:e});oP.displayName=`SidebarTabTriggers`;var sP=({name:e,tab:t,icon:n,title:r,children:i,onToggle:a,className:o,style:s})=>{let c=vz();return(0,H.jsxs)(`label`,{title:r,className:`sidebar-trigger__label-element`,children:[(0,H.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:uC().openSidebar?.name===e,"aria-label":r,"aria-keyshortcuts":`0`}),(0,H.jsxs)(`div`,{className:U(`sidebar-trigger`,o),style:s,children:[n&&(0,H.jsx)(`div`,{children:n}),i&&(0,H.jsx)(`div`,{className:`sidebar-trigger__label`,children:i})]})]})};sP.displayName=`SidebarTrigger`;var cP=({children:e,...t})=>{let n=uC(),r=vz();if(!n.openSidebar)return null;let{name:i}=n.openSidebar;return(0,H.jsx)(tv,{className:`sidebar-tabs-root`,value:n.openSidebar.tab,onValueChange:e=>r(t=>({...t,openSidebar:{...t.openSidebar,name:i,tab:e}})),...t,children:e})};cP.displayName=`SidebarTabs`;var lP=({tab:e,children:t,...n})=>(0,H.jsx)(iv,{...n,value:e,"data-testid":e,children:t});lP.displayName=`SidebarTab`;var uP=pc(!1),dP=(0,V.forwardRef)(({name:e,children:t,onDock:n,docked:r,className:i,...a},o)=>{it()&&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=vz(),c=py(uP);(0,V.useLayoutEffect)(()=>(c(!!r),()=>{c(!1)}),[c,r]);let l=(0,V.useRef)({});l.current.onCloseRequest=()=>{s({openSidebar:null})},l.current.onDock=e=>n?.(e),l.current=za(l.current,{docked:r,shouldRenderDockButton:!!n&&r!=null});let u=(0,V.useRef)(null);(0,V.useImperativeHandle)(o,()=>u.current);let d=pz(),f=(0,V.useCallback)(()=>{document.querySelector(`.Dialog`)||s({openSidebar:null})},[s]);return fC(u,(0,V.useCallback)(e=>{e.target.closest(`.sidebar-trigger`)||(!r||!d.canFitSidebar)&&f()},[f,r,d.canFitSidebar])),(0,V.useEffect)(()=>{let e=e=>{e.key===L.ESCAPE&&(!r||!d.canFitSidebar)&&f()};return document.addEventListener(j.KEYDOWN,e),()=>{document.removeEventListener(j.KEYDOWN,e)}},[f,r,d.canFitSidebar]),(0,H.jsx)(gC,{...a,className:U(Po.SIDEBAR,{"sidebar--docked":r},i),ref:u,children:(0,H.jsx)(rP.Provider,{value:l.current,children:t})})});dP.displayName=`SidebarInner`;var fP=Object.assign((0,V.forwardRef)((e,t)=>{let n=uC(),{onStateChange:r}=e,i=(0,V.useRef)(n.openSidebar);(0,V.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,V.useState)(!1);return(0,V.useLayoutEffect)(()=>(o(!0),()=>o(!1)),[]),a&&n.openSidebar?.name===e.name?(0,V.createElement)(dP,{...e,ref:t,key:e.name}):null}),{Header:iP,TabTriggers:oP,TabTrigger:aP,Tabs:cP,Tab:lP,Trigger:sP});fP.displayName=`Sidebar`;var pP=(e,t)=>{let n=pc(0),r=e=>{let{tunnelsJotai:{useAtom:r}}=fk(),[,i]=r(n),a=(0,V.useRef)({preferHost:!1,counter:0});return(0,V.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,H.jsx)(t,{...e})};return r.displayName=e,r},mP={};o(mP,{ChangeCanvasBackground:()=>OP,ClearCanvas:()=>EP,CommandPalette:()=>CP,Export:()=>kP,Help:()=>TP,LiveCollaborationTrigger:()=>jP,LoadScene:()=>bP,Preferences:()=>VP,PreferencesToggleGridModeItem:()=>LP,PreferencesToggleZenModeItem:()=>RP,SaveAsImage:()=>SP,SaveToActiveFile:()=>xP,SearchMenu:()=>wP,Socials:()=>AP,ToggleTheme:()=>DP});var hP=pc({active:!1});async function gP({title:e,description:t,actionLabel:n,color:r}){return new Promise(i=>{_y.set(hP,{active:!0,onConfirm:()=>i(!0),onClose:()=>i(!1),onReject:()=>i(!1),title:e,description:t,actionLabel:n,color:r})})}var _P=function({onChange:e,value:t,choices:n,name:r}){return(0,H.jsx)(`div`,{className:`RadioGroup`,children:n.map(n=>(0,H.jsxs)(`div`,{className:U(`RadioGroup__choice`,{active:n.value===t}),title:n.ariaLabel,children:[(0,H.jsx)(`input`,{name:r,type:`radio`,checked:n.value===t,onChange:()=>e(n.value),"aria-label":n.ariaLabel}),n.label]},String(n.value)))})},vP=({value:e,shortcut:t,onChange:n,choices:r,children:i,name:a,icon:o})=>{let s=pz();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`dropdown-menu-item-base dropdown-menu-item-bare`,children:[o&&(0,H.jsx)(`div`,{className:`dropdown-menu-item__icon`,children:o}),(0,H.jsx)(`label`,{className:`dropdown-menu-item__text`,children:(0,H.jsx)(XC,{children:i})}),(0,H.jsx)(_P,{name:a,value:e,onChange:n,choices:r})]}),t&&s.formFactor!==`phone`&&(0,H.jsx)(`div`,{className:`dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned`,children:t})]})};vP.displayName=`DropdownMenuItemContentRadio`;var yP=vP,bP=()=>{let{t:e}=ky(),t=yz(),n=gz();return t.isActionEnabled(UT)?(0,H.jsx)(tw,{icon:wb,onSelect:async()=>{(!n.length||await gP({title:e(`overwriteConfirm.modal.loadFromFile.title`),actionLabel:e(`overwriteConfirm.modal.loadFromFile.button`),color:`warning`,description:(0,H.jsx)(uO,{i18nKey:`overwriteConfirm.modal.loadFromFile.description`,bold:e=>(0,H.jsx)(`strong`,{children:e}),br:()=>(0,H.jsx)(`br`,{})})}))&&t.executeAction(UT)},"data-testid":`load-button`,shortcut:AD(`loadScene`),"aria-label":e(`buttons.load`),children:e(`buttons.load`)}):null};bP.displayName=`LoadScene`;var xP=()=>{let{t:e}=ky(),t=yz();return t.isActionEnabled(VT)?(0,H.jsx)(tw,{shortcut:AD(`saveScene`),"data-testid":`save-button`,onSelect:()=>t.executeAction(VT),icon:Sb,"aria-label":`${e(`buttons.save`)}`,children:`${e(`buttons.save`)}`}):null};xP.displayName=`SaveToActiveFile`;var SP=()=>{let e=vz(),{t}=ky();return(0,H.jsx)(tw,{icon:Db,"data-testid":`image-export-button`,onSelect:()=>e({openDialog:{name:`imageExport`}}),shortcut:AD(`imageExport`),"aria-label":t(`buttons.exportImage`),children:t(`buttons.exportImage`)})};SP.displayName=`SaveAsImage`;var CP=e=>{let t=vz(),{t:n}=ky();return(0,H.jsx)(tw,{icon:_S,"data-testid":`command-palette-button`,onSelect:()=>{aC(`command_palette`,`open`,`menu`),t({openDialog:{name:`commandPalette`}})},shortcut:AD(`commandPalette`),"aria-label":n(`commandPalette.title`),className:e?.className,children:n(`commandPalette.title`)})};CP.displayName=`CommandPalette`;var wP=e=>{let{t}=ky(),n=yz();return(0,H.jsx)(tw,{icon:fS,"data-testid":`search-menu-button`,onSelect:()=>{n.executeAction(qA)},shortcut:AD(`searchMenu`),"aria-label":t(`search.title`),className:e?.className,children:t(`search.title`)})};wP.displayName=`SearchMenu`;var TP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(tw,{"data-testid":`help-menu-item`,icon:mb,onSelect:()=>t.executeAction(JT),shortcut:`?`,"aria-label":e(`helpDialog.title`),children:e(`helpDialog.title`)})};TP.displayName=`Help`;var EP=()=>{let{t:e}=ky(),t=py(Pk);return yz().isActionEnabled(Kw)?(0,H.jsx)(tw,{icon:sb,onSelect:()=>t(`clearCanvas`),"data-testid":`clear-canvas-button`,"aria-label":e(`buttons.clearReset`),children:e(`buttons.clearReset`)}):null};EP.displayName=`ClearCanvas`;var DP=e=>{let{t}=ky(),n=uC(),r=yz(),i=AD(`toggleTheme`);return r.isActionEnabled($w)?e?.allowSystemTheme?(0,H.jsx)(yP,{name:`theme`,value:e.theme,onChange:t=>e.onSelect(t),choices:[{value:R.LIGHT,label:db,ariaLabel:`${t(`buttons.lightMode`)} - ${i}`},{value:R.DARK,label:ub,ariaLabel:`${t(`buttons.darkMode`)} - ${i}`},{value:`system`,label:OS,ariaLabel:t(`buttons.systemMode`)}],children:t(`labels.theme`)}):(0,H.jsx)(tw,{onSelect:t=>{if(t.preventDefault(),e?.onSelect)e.onSelect(n.theme===R.DARK?R.LIGHT:R.DARK);else return r.executeAction($w)},icon:n.theme===R.DARK?db:ub,"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};DP.displayName=`ToggleTheme`;var OP=()=>{let{t:e}=ky(),t=uC(),n=yz(),r=fz();return t.viewModeEnabled||!r.UIOptions.canvasActions.changeViewBackgroundColor?null:(0,H.jsxs)(`div`,{style:{marginTop:`0.75rem`},children:[(0,H.jsx)(`div`,{"data-testid":`canvas-background-label`,style:{fontSize:`0.875rem`,marginBottom:`0.25rem`,marginLeft:`0.5rem`},children:e(`labels.canvasBackground`)}),(0,H.jsx)(`div`,{style:{padding:`0 0.625rem`},children:n.renderAction(`changeViewBackgroundColor`)})]})};OP.displayName=`ChangeCanvasBackground`;var kP=()=>{let{t:e}=ky(),t=vz();return(0,H.jsx)(tw,{icon:pb,onSelect:()=>{t({openDialog:{name:`jsonExport`}})},"data-testid":`json-export-button`,"aria-label":e(`buttons.export`),children:e(`buttons.export`)})};kP.displayName=`Export`;var AP=()=>{let{t:e}=ky();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(yO,{icon:_b,href:`https://github.com/excalidraw/excalidraw`,"aria-label":`GitHub`,children:`GitHub`}),(0,H.jsx)(yO,{icon:yb,href:`https://x.com/excalidraw`,"aria-label":`X`,children:e(`labels.followUs`)}),(0,H.jsx)(yO,{icon:vb,href:`https://discord.gg/UexuTaE`,"aria-label":`Discord`,children:e(`labels.discordChat`)})]})};AP.displayName=`Socials`;var jP=({onSelect:e,isCollaborating:t})=>{let{t:n}=ky();return(0,H.jsx)(tw,{"data-testid":`collab-button`,icon:Jb,className:U({"active-collab":t}),onSelect:e,children:n(`labels.liveCollaboration`)})};jP.displayName=`LiveCollaborationTrigger`;var MP=()=>{let{t:e}=ky(),t=dz();return(0,H.jsx)(LO,{checked:uC().activeTool.locked,shortcut:AD(`toolLock`),onSelect:e=>{t.toggleLock(),e.preventDefault()},children:e(`labels.preferences_toolLock`)})},NP=()=>{let{t:e}=ky(),t=uC(),n=vz();return(0,H.jsx)(yP,{name:`boxSelectionMode`,icon:WS,value:t.boxSelectionMode,onChange:e=>{n({boxSelectionMode:e})},choices:[{value:`contain`,label:e(`labels.boxSelectionContain`),ariaLabel:e(`labels.boxSelectionContain`)},{value:`overlap`,label:e(`labels.boxSelectionOverlap`),ariaLabel:e(`labels.boxSelectionOverlap`)}],children:e(`labels.boxSelectionMode`)})},PP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(LO,{checked:uC().objectsSnapModeEnabled,shortcut:AD(`objectsSnapMode`),onSelect:e=>{t.executeAction(SE),e.preventDefault()},children:e(`buttons.objectsSnapMode`)})},FP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(LO,{checked:uC().bindingPreference===`enabled`,onSelect:e=>{t.executeAction(CE),e.preventDefault()},children:e(`labels.arrowBinding`)})},IP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(LO,{checked:uC().isMidpointSnappingEnabled,onSelect:e=>{t.executeAction(wE),e.preventDefault()},children:e(`labels.midpointSnapping`)})},LP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(LO,{checked:uC().gridModeEnabled,shortcut:AD(`gridMode`),onSelect:e=>{t.executeAction(bE),e.preventDefault()},children:e(`labels.toggleGrid`)})},RP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(LO,{checked:uC().zenModeEnabled,shortcut:AD(`zenMode`),onSelect:e=>{t.executeAction(xE),e.preventDefault()},children:e(`buttons.zenMode`)})},zP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(LO,{checked:uC().viewModeEnabled,shortcut:AD(`viewMode`),onSelect:e=>{t.executeAction(hk),e.preventDefault()},children:e(`labels.viewMode`)})},BP=()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(LO,{checked:uC().stats.open,shortcut:AD(`stats`),onSelect:e=>{t.executeAction(TE),e.preventDefault()},children:e(`stats.fullTitle`)})},VP=({children:e,additionalItems:t})=>{let{t:n}=ky();return(0,H.jsxs)(PO,{children:[(0,H.jsx)(PO.Trigger,{icon:KS,children:n(`labels.preferences`)}),(0,H.jsxs)(PO.Content,{className:`excalidraw-main-menu-preferences-submenu`,children:[e||(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(NP,{}),(0,H.jsx)(MP,{}),(0,H.jsx)(PP,{}),(0,H.jsx)(LP,{}),(0,H.jsx)(RP,{}),(0,H.jsx)(zP,{}),(0,H.jsx)(BP,{}),(0,H.jsx)(FP,{}),(0,H.jsx)(IP,{})]}),t]})]})};VP.ToggleToolLock=MP,VP.BoxSelectionMode=NP,VP.ToggleSnapMode=PP,VP.ToggleArrowBinding=FP,VP.ToggleMidpointSnapping=IP,VP.ToggleGridMode=LP,VP.ToggleZenMode=RP,VP.ToggleViewMode=zP,VP.ToggleElementProperties=BP,VP.displayName=`Preferences`;var HP=Object.assign(pP(`MainMenu`,({children:e,onSelect:t})=>{let{MainMenuTunnel:n}=fk(),r=pz(),i=uC(),a=vz();return(0,H.jsx)(n.In,{children:(0,H.jsxs)(Q,{open:i.openMenu===`canvas`,children:[(0,H.jsx)(Q.Trigger,{onToggle:()=>{a({openMenu:i.openMenu===`canvas`?null:`canvas`,openPopup:null,openDialog:null})},"data-testid":`main-menu-trigger`,className:`main-menu-trigger`,children:fb}),(0,H.jsxs)(Q.Content,{onClickOutside:()=>a({openMenu:null}),onSelect:zs(t,()=>{a({openMenu:null})}),className:`main-menu`,align:`start`,children:[e,r.formFactor===`phone`&&i.collaborators.size>0&&(0,H.jsxs)(`fieldset`,{className:`UserList-Wrapper`,children:[(0,H.jsx)(`legend`,{children:G(`labels.collaborators`)}),(0,H.jsx)($N,{mobile:!0,collaborators:i.collaborators,userToFollow:i.userToFollow?.socketId||null})]})]})]})})}),{Trigger:Q.Trigger,Item:Q.Item,ItemLink:Q.ItemLink,ItemCustom:Q.ItemCustom,Group:Q.Group,Separator:Q.Separator,Sub:PO,DefaultItems:mP}),UP=(0,V.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,V.useState)(!1),m=async e=>{let t=n?.(e);if(x(t)){let e=window.setTimeout(()=>{p(!0)},50);try{await t}catch(e){if(e instanceof T)console.warn(e);else throw e}finally{clearTimeout(e),p(!1)}}},h=f?`loading`:l;return a=h===`success`?`success`:a,(0,H.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,H.jsxs)(`div`,{className:`ExcButton__contents`,children:[h===`loading`?(0,H.jsx)(qS,{className:`ExcButton__statusIcon`}):h===`success`&&(0,H.jsx)(`div`,{className:`ExcButton__statusIcon`,children:Xx}),t&&(0,H.jsx)(`div`,{className:`ExcButton__icon`,"aria-hidden":!0,children:t}),i!==`icon`&&(e??r)]})})}),WP=({title:e,children:t,actionLabel:n,onClick:r})=>(0,H.jsxs)(`div`,{className:`OverwriteConfirm__Actions__Action`,children:[(0,H.jsx)(`h4`,{children:e}),(0,H.jsx)(`div`,{className:`OverwriteConfirm__Actions__Action__content`,children:t}),(0,H.jsx)(UP,{variant:`outlined`,color:`muted`,label:n,size:`large`,fullWidth:!0,onClick:r})]}),GP=Object.assign(({children:e})=>(0,H.jsx)(`div`,{className:`OverwriteConfirm__Actions`,children:e}),{ExportToImage:()=>{let{t:e}=ky(),t=yz(),n=vz();return(0,H.jsx)(WP,{title:e(`overwriteConfirm.action.exportToImage.title`),actionLabel:e(`overwriteConfirm.action.exportToImage.button`),onClick:()=>{t.executeAction(IT,`ui`,!0),n({openDialog:{name:`imageExport`}})},children:e(`overwriteConfirm.action.exportToImage.description`)})},SaveToDisk:()=>{let{t:e}=ky(),t=yz();return(0,H.jsx)(WP,{title:e(`overwriteConfirm.action.saveToDisk.title`),actionLabel:e(`overwriteConfirm.action.saveToDisk.button`),onClick:()=>{t.executeAction(HT,`ui`)},children:e(`overwriteConfirm.action.saveToDisk.description`)})}}),KP=Object.assign(pP(`OverwriteConfirmDialog`,({children:e})=>{let{OverwriteConfirmDialogTunnel:t}=fk(),[n,r]=fy(hP);return n.active?(0,H.jsx)(t.In,{children:(0,H.jsx)(sk,{onCloseRequest:()=>{n.onClose(),r(e=>({...e,active:!1}))},title:!1,size:916,children:(0,H.jsxs)(`div`,{className:`OverwriteConfirm`,children:[(0,H.jsx)(`h3`,{children:n.title}),(0,H.jsxs)(`div`,{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${n.color}`,children:[(0,H.jsx)(`div`,{className:`OverwriteConfirm__Description__icon`,children:Zx}),(0,H.jsx)(`div`,{children:n.description}),(0,H.jsx)(`div`,{className:`OverwriteConfirm__Description__spacer`}),(0,H.jsx)(UP,{color:n.color,size:`large`,label:n.actionLabel,onClick:()=>{n.onConfirm(),r(e=>({...e,active:!1}))}})]}),(0,H.jsx)(GP,{children:e})]})})}):null}),{Actions:GP,Action:WP}),qP=pc(``),JP=pc(null),YP=350,XP=()=>{let e=dz(),t=vz(),n=(0,V.useRef)(null),[r,i]=fy(qP),a=r.trim(),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)({nonce:null,items:[]}),u=(0,V.useRef)(null),d=(0,V.useRef)(void 0),[f,p]=fy(JP);(0,V.useEffect)(()=>{o||(a!==u.current||e.scene.getSceneNonce()!==d.current)&&(u.current=null,iF(a,e,(n,r)=>{l({nonce:Ee(),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,V.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,V.useEffect)(()=>{if(c.items.length>0&&f!==null){let t=c.items[f];if(t){let n=e.state.zoom.value,r=qe({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:I(t.element)?pr.nameFontSize:t.element.fontSize,fontFamily:I(t.element)?oi.Assistant:t.element.fontFamily}),i=r.fontSize,a=i*n<14;if(!ga([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:at(14/i,1)}:{fitToContent:!0},e.scrollToContent(r,{animate:!0,duration:300,...t,canvasOffsets:e.getEditorUIOffsets()})}}}},[f,c,e]),(0,V.useEffect)(()=>()=>{p(null),u.current=null,d.current=void 0,t({searchMatches:null}),s(!1)},[t,p]);let g=pC({goToNextItem:m,goToPreviousItem:h,searchMatches:c});(0,V.useEffect)(()=>Xt(window,j.KEYDOWN,r=>{if(r.key===L.ESCAPE&&!e.state.openDialog&&!e.state.openPopup){r.preventDefault(),r.stopPropagation(),t({openSidebar:null});return}if(r[L.CTRL_OR_CMD]&&r.key===L.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===L.ENTER&&(r.stopPropagation(),g.goToNextItem()),r.key===L.ARROW_UP?(r.stopPropagation(),g.goToPreviousItem()):r.key===L.ARROW_DOWN&&(r.stopPropagation(),g.goToNextItem()))},{capture:!0,passive:!1}),[t,g,e]);let _=`${c.items.length} ${c.items.length===1?G(`search.singleResult`):G(`search.multipleResults`)}`;return(0,H.jsxs)(`div`,{className:`layer-ui__search`,children:[(0,H.jsx)(`div`,{className:`layer-ui__search-header`,children:(0,H.jsx)(YO,{className:Po.SEARCH_MENU_INPUT_WRAPPER,value:r,ref:n,placeholder:G(`search.placeholder`),icon:fS,onChange:n=>{i(n),s(!0);let r=n.trim();iF(r,e,(n,i)=>{l({nonce:Ee(),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,H.jsxs)(`div`,{className:`layer-ui__search-count`,children:[c.items.length>0&&(0,H.jsxs)(H.Fragment,{children:[f!==null&&f>-1?(0,H.jsxs)(`div`,{children:[f+1,` / `,_]}):(0,H.jsx)(`div`,{children:_}),(0,H.jsxs)(`div`,{className:`result-nav`,children:[(0,H.jsx)(JO,{onSelect:()=>{m()},className:`result-nav-btn`,children:FS}),(0,H.jsx)(JO,{onSelect:()=>{h()},className:`result-nav-btn`,children:LS})]})]}),c.items.length===0&&a&&u.current&&(0,H.jsx)(`div`,{style:{margin:`1rem auto`},children:G(`search.noMatch`)})]}),(0,H.jsx)(QP,{matches:c,onItemClick:p,focusIndex:f,searchQuery:a})]})},ZP=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,H.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,H.jsx)(`div`,{className:`preview-text`,children:t.flatMap((e,t)=>(0,H.jsx)(V.Fragment,{children:t===2?(0,H.jsx)(`b`,{children:e}):e},t))})})},QP=(0,V.memo)(e=>{let t=(0,V.useMemo)(()=>e.matches.items.filter(e=>I(e.element)),[e.matches]),n=(0,V.useMemo)(()=>e.matches.items.filter(e=>M(e.element)),[e.matches]);return(0,H.jsxs)(`div`,{children:[t.length>0&&(0,H.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,H.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,H.jsx)(`div`,{className:`title-icon`,children:eS}),(0,H.jsx)(`div`,{children:G(`search.frames`)})]}),t.map((t,n)=>(0,H.jsx)(ZP,{searchQuery:e.searchQuery,preview:t.preview,highlighted:n===e.focusIndex,onClick:()=>e.onItemClick(n)},t.element.id+t.index)),n.length>0&&(0,H.jsx)(`div`,{className:`layer-ui__divider`})]}),n.length>0&&(0,H.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,H.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,H.jsx)(`div`,{className:`title-icon`,children:eb}),(0,H.jsx)(`div`,{children:G(`search.texts`)})]}),n.map((n,r)=>(0,H.jsx)(ZP,{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),$P=(e,t,n)=>{let r=e.slice(0,t),i=r.split(/\s+/),a=r.endsWith(` `),o=i.length-2-1-!a,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}},eF=(e,t)=>{let n=e.split(`
60
- `),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(`
61
- `)},tF=(e,t,n)=>{let r=eF(e.text,e.originalText).split(`
62
- `),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=zi(r,ao(e),e.lineHeight);if(r===``&&(a.width=0),e.textAlign!==`left`&&t.line.length>0){let n=zi(t.line,ao(e),e.lineHeight),r=e.textAlign===`center`?(e.width-n.width)/2:e.width-n.width;a.width+=r}let{width:o,height:u}=zi(i,ao(e),e.lineHeight),d=a.width,f=t.lineNumber*a.height;l.push({offsetX:d,offsetY:f,width:o,height:u,showOnCanvas:!0}),s+=n}}return l},nF=(e,t,n,r)=>{let i=e.name??nr(e),a=i.slice(n,n+t.length),o=i.slice(0,n),s=ao({fontSize:pr.nameFontSize,fontFamily:oi.Assistant}),c=hn(oi.Assistant),l=zi(o,s,c);o===``&&(l.width=0);let u=zi(a,s,c),d=l.width,f=-l.height-pr.strokeWidth,p=u.width;return[{offsetX:d,offsetY:f,width:p,height:u.height,showOnCanvas:d+p<=e.width*r}]},rF=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,`\\$&`),iF=(0,uy.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=>I(e));i.sort((e,t)=>e.y-t.y),a.sort((e,t)=>e.y-t.y);let o=[],s=new RegExp(rF(e),`gi`);for(let t of i){let n=null,r=t.originalText;for(;(n=s.exec(r))!==null;){let i=$P(r,n.index,e),a=tF(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??nr(n);for(;(r=s.exec(i))!==null;){let a=$P(i,r.index,e),o=nF(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)},YP),aF=pP(`DefaultSidebarTrigger`,e=>{let{DefaultSidebarTriggerTunnel:t}=fk();return(0,H.jsx)(t.In,{children:(0,H.jsx)(fP.Trigger,{...e,className:`default-sidebar-trigger`,name:ne.name})})});aF.displayName=`DefaultSidebarTrigger`;var oF=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:t}=fk();return(0,H.jsx)(t.In,{children:e})};oF.displayName=`DefaultTabTriggers`;var sF=Object.assign(pP(`DefaultSidebar`,({children:e,className:t,onDock:n,docked:r,...i})=>{let a=uC(),o=vz(),{DefaultSidebarTabTriggersTunnel:s}=fk(),c=a.openSidebar?.tab===Xn;return(0,V.createElement)(fP,{...i,name:`default`,key:`default`,className:U(`default-sidebar`,t),docked:c||(r??a.defaultSidebarDockedPreference),onDock:c||n===!1||!n&&r!=null?void 0:zs(n,e=>{o({defaultSidebarDockedPreference:e})})},(0,H.jsxs)(fP.Tabs,{children:[(0,H.jsx)(fP.Header,{children:(0,H.jsxs)(fP.TabTriggers,{children:[(0,H.jsx)(fP.TabTrigger,{tab:Xn,children:fS}),(0,H.jsx)(fP.TabTrigger,{tab:dr,children:Ny}),(0,H.jsx)(s.Out,{})]})}),(0,H.jsx)(fP.Tab,{tab:dr,children:(0,H.jsx)(ik,{})}),(0,H.jsx)(fP.Tab,{tab:Xn,children:(0,H.jsx)(XP,{})}),e]}))}),{Trigger:aF,TabTriggers:oF}),cF=300,lF=({input:e,placeholder:t,onChange:r,onKeyboardSubmit:i,errorLine:a})=>{let o=(0,V.useRef)(null),s=(0,V.useRef)(i);s.current=i;let[c,l]=(0,V.useState)({type:`loading`}),[u,d]=(0,V.useState)(!1),{theme:f}=uC();if((0,V.useEffect)(()=>{let e=!1,t=setTimeout(()=>{e||d(!0)},cF);return n(()=>import(`./CodeMirrorEditor-UCMRAMCV-75Zi8U_A.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,V.useEffect)(()=>{if(c.type!==`fallback`||!s.current)return;let e=o.current;if(e){let t=e=>{e[L.CTRL_OR_CMD]&&e.key===L.ENTER&&(e.preventDefault(),s.current?.())};return e.focus(),e.addEventListener(j.KEYDOWN,t),()=>{e.removeEventListener(j.KEYDOWN,t)}}},[c.type]),c.type===`ready`){let n=c.component;return(0,H.jsx)(n,{value:e,onChange:r,onKeyboardSubmit:i,placeholder:t,theme:f,errorLine:a})}return c.type===`fallback`?(0,H.jsx)(`textarea`,{className:`ttd-dialog-input`,onChange:e=>r(e.target.value),value:e,placeholder:t,ref:o}):u?(0,H.jsx)(`div`,{className:`ttd-dialog-input ttd-dialog-input--loading`,children:(0,H.jsx)(qS,{})}):null},uF=/(?:Parse|Lexical) error on line (\d+)[.:]/i,dF=/Trying to inactivate an inactive participant \((.+)\)/i,fF=/^\s*-+\^\s*$/,pF=e=>uF.test(e),mF=e=>pF(e)||dF.test(e),hF=e=>fF.test(e),gF=e=>{let t=e.match(dF);return t?.[1]?t[1].trim():null},_F=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),vF=(e,t)=>{let n=gF(e);if(!n)return null;let r=RegExp(`^\\s*deactivate\\s+${_F(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},yF=(e,t)=>{let n=e.match(uF);return n?Number.parseInt(n[1],10):t?vF(e,t):null},bF=(e,t)=>(e.match(t)||[]).length,xF=(e,t)=>{if(!pF(e))return null;let n=yF(e,t),r=n?`Syntax error near line ${n}.`:`Syntax error in Mermaid diagram.`,i=[];return t&&(bF(t,/\[/g)!==bF(t,/\]/g)&&i.push(`Unbalanced square brackets in a node label.`),bF(t,/\(/g)!==bF(t,/\)/g)&&i.push(`Unbalanced parentheses in a node shape.`),bF(t,/\{/g)!==bF(t,/\}/g)&&i.push(`Unbalanced braces in a decision node.`),bF(t,/^\s*subgraph\b/gm)>bF(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)]}},SF=e=>pF(e)?e.replace(/\n\s*Expecting[\s\S]*$/,``).trimEnd():e,CF=({error:e,canvasRef:t,loaded:n,hideErrorDetails:r,sourceText:i,autoFixAvailable:a,onApplyAutoFix:o})=>{let s=e?r?G(`chat.errors.mermaidParseError`):SF(e.message):null,c=e&&!r?xF(e.message,i):null,l=!!a&&!!o&&!r,u=s?.split(/\r?\n/)??[];return(0,H.jsxs)(`div`,{className:`ttd-dialog-output-wrapper ${e?`ttd-dialog-output-wrapper--error`:``}`,children:[e&&(0,H.jsx)(`div`,{"data-testid":`ttd-dialog-output-error`,className:`ttd-dialog-output-error`,children:(0,H.jsxs)(`div`,{className:`ttd-dialog-output-error-content`,children:[(0,H.jsx)(`div`,{className:`ttd-dialog-output-error-icon`,children:Zx}),c&&(0,H.jsxs)(`div`,{className:`ttd-dialog-output-error-summary`,children:[(0,H.jsx)(`div`,{className:`ttd-dialog-output-error-summary__headline`,children:c.summary}),(0,H.jsx)(`div`,{className:`ttd-dialog-output-error-summary__label`,children:`Likely causes:`}),(0,H.jsx)(`ul`,{className:`ttd-dialog-output-error-summary__causes`,children:c.likelyCauses.map(e=>(0,H.jsx)(`li`,{children:e},e))})]}),(0,H.jsx)(`div`,{className:`ttd-dialog-output-error-message`,children:u.map((e,t)=>(0,H.jsxs)(`span`,{className:hF(e)?`ttd-dialog-output-error-message__caret`:void 0,children:[e,t<u.length-1?`
63
- `:``]},`error-line-${t}`))}),!r&&(0,H.jsx)(`div`,{className:`ttd-dialog-output-error-autofix-slot`,children:l?(0,H.jsx)(JO,{className:`ttd-dialog-panel-button ttd-dialog-output-error-autofix`,onSelect:o,children:G(`mermaid.autoFixAvailable`)}):null})]})},`error`),n?(0,H.jsx)(`div`,{className:U(`ttd-dialog-output-canvas-container`,{invisible:!!e}),children:(0,H.jsx)(`div`,{ref:t,className:`ttd-dialog-output-canvas-content`})},`canvas`):(0,H.jsx)(qS,{size:`2rem`})]})},wF=({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,H.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,H.jsx)(`span`,{className:`ttd-dialog-panel-action-link__icon`,children:e.icon})]});if(e?.variant===`button`)return(0,H.jsxs)(JO,{className:U(`ttd-dialog-panel-button`,e.className),onSelect:e.action?e.action:()=>{},disabled:e?.disabled||r,children:[(0,H.jsxs)(`div`,{className:U({invisible:r}),children:[e?.label,e?.icon&&(0,H.jsx)(`span`,{children:e.icon})]}),r&&(0,H.jsx)(qS,{})]});if(e?.variant===`rateLimit`)return(0,H.jsx)(`div`,{className:U(`ttd-dialog-panel__rate-limit`,e.className),children:e.label})};return(0,H.jsxs)(`div`,{className:U(`ttd-dialog-panel`,o),children:[(e||i)&&(0,H.jsxs)(`div`,{className:`ttd-dialog-panel__header`,children:[typeof e==`string`?(0,H.jsx)(`label`,{children:e}):e,i?.()]}),t,(0,H.jsxs)(`div`,{className:U(`ttd-dialog-panel-button-container`,{invisible:!n.length}),style:{justifyContent:s},children:[n.filter(Boolean).map(e=>(0,H.jsx)(V.Fragment,{children:c(e)},e.label)),!r&&a?.()]})]})},TF=({children:e})=>(0,H.jsx)(`div`,{className:`ttd-dialog-panels`,children:e}),EF=()=>(0,H.jsxs)(`div`,{className:`ttd-dialog-submit-shortcut`,children:[(0,H.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Z(`CtrlOrCmd`)}),(0,H.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Z(`Enter`)})]}),DF=(e,t)=>{let n=yF(e,t);return n==null?null:n-1},OF=(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(`
64
- `)},kF=e=>{let t=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([A-Za-z]+)\s*$/);if(t)return t[1];let n=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([,;:])\s*$/);return n?n[1]:e},AF=e=>e.replace(/(\|[^|\n]+\|)\s*>\s*(?=[A-Za-z0-9_("[{'`])/g,`$1 `),jF=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),MF=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${jF(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(`
65
- `);return null},NF=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${jF(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(`
66
- `):null},PF=e=>{let t=(e.match(/^\s*subgraph\b/gm)||[]).length-(e.match(/^\s*end\s*$/gm)||[]).length;if(t<=0)return null;let n=Array.from({length:t},()=>`end`).join(`
67
- `);return`${e.trimEnd()}
68
- ${n}`},FF=e=>e.replace(/[“”]/g,`"`).replace(/[‘’]/g,`'`),IF=(e,t)=>{if(!mF(t)||!e.trim())return[];let n=[],r=new Set,i=t=>{!t||t===e||r.has(t)||(r.add(t),n.push(t))},a=gF(t);if(a&&(i(MF(e,a)),i(NF(e,a))),pF(t)){let n=e.split(/\r?\n/),r=DF(t,e),a=r==null?[]:[r,r-1,r+1];for(let e of a)i(OF(n,e,e=>kF(e))),i(OF(n,e,e=>AF(e)));i(AF(e)),i(PF(e));let o=FF(e);i(o===e?null:o)}return n},LF=({canvasRef:e,setError:t})=>{let n=e.current;if(!n)return;let r=n.parentElement;r&&(r.style.background=``,t(null),n.replaceChildren())},RF=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:n,setError:r,data:i,theme:a})=>{let o=e.current,s=o?.parentElement;if(!o||!s)return{success:!1};if(!n)return LF({canvasRef:e,setError:r}),{success:!1};let c;try{let e=await t.api;try{c=await e.parseMermaidToExcalidraw(n)}catch(t){let r=t;if(!n.includes(`"`))return{success:!1,error:r};try{c=await e.parseMermaidToExcalidraw(n.replace(/"/g,`'`))}catch{return{success:!1,error:r}}}let{elements:l,files:u={}}=c;r(null),i.current={elements:na(l,{regenerateIds:!0}),files:u};let d=await ID({elements:i.current.elements,files:i.current.files,exportPadding:10,maxWidthOrHeight:Math.max(s.offsetWidth,s.offsetHeight)*window.devicePixelRatio,appState:{exportWithDarkMode:a===R.DARK}});return s.style.background=`var(--default-bg-color)`,o.replaceChildren(d),{success:!0}}catch(e){return s.style.background=`var(--default-bg-color)`,n&&r(e),{success:!1,error:e}}},zF=e=>{iO.set(Qo.MERMAID_TO_EXCALIDRAW,e)},BF=({app:e,data:t,text:n,shouldSaveMermaidDataToStorage:r})=>{let{elements:i,files:a}=t.current;i.length&&(e.addElementsFromPasteOrLibrary({elements:i,files:a,position:`center`,fitToContent:!0}),e.setOpenDialog(null),r&&n&&zF(n))},VF=`flowchart TD
69
- A[Christmas] -->|Get money| B(Go shopping)
70
- B --> C{Let me think}
71
- C -->|One| D[Laptop]
72
- C -->|Two| E[iPhone]
73
- C -->|Three| F[Car]`,HF=E(zF,300),UF=500,WF=4,GF=30,KF=e=>e instanceof Error?e.message:typeof e==`string`?e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`?e.message:``,qF=({mermaidToExcalidrawLib:e,isActive:t})=>{let[n,r]=(0,V.useState)(()=>iO.get(Qo.MERMAID_TO_EXCALIDRAW)||VF),i=(0,V.useDeferredValue)(n),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(null),l=a?.message?yF(a.message,i):null,u=(0,V.useRef)(null),d=(0,V.useRef)({elements:[],files:null}),f=dz(),{theme:p}=uC();(0,V.useEffect)(()=>{t&&((async()=>{try{if(!i.trim()){LF({canvasRef:u,setError:o});return}let t=await RF({canvasRef:u,data:d,mermaidToExcalidrawLib:e,setError:o,mermaidDefinition:i,theme:p});t.success||o(t.error??Error(`Invalid mermaid definition`))}catch(e){it()&&console.error(`Failed to parse mermaid definition`,e)}})(),HF(i))},[i,e,t,p]),(0,V.useEffect)(()=>()=>{HF.flush()},[]),(0,V.useEffect)(()=>{let n=a?.message??``,r=i;if(!(t&&mF(n)&&r.trim()&&e.loaded)){c(null);return}let o=IF(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<GF;){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>=WF)continue;let r=KF(t);if(!r)continue;let a=IF(e.text,r);for(let t of a)n.has(t)||i.push({text:t,depth:e.depth+1})}}}}catch{}s||c(null)},UF);return()=>{s=!0,clearTimeout(l)}},[i,a?.message,t,e]);let m=()=>{BF({app:f,data:d,text:n,shouldSaveMermaidDataToStorage:!0})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`ttd-dialog-desc`,children:(0,H.jsx)(uO,{i18nKey:`mermaid.description`,flowchartLink:e=>(0,H.jsx)(`a`,{href:`https://mermaid.js.org/syntax/flowchart.html`,target:`_blank`,rel:`noreferrer`,children:e}),sequenceLink:e=>(0,H.jsx)(`a`,{href:`https://mermaid.js.org/syntax/sequenceDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),classLink:e=>(0,H.jsx)(`a`,{href:`https://mermaid.js.org/syntax/classDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),erdLink:e=>(0,H.jsx)(`a`,{href:`https://mermaid.js.org/syntax/entityRelationshipDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e})})}),(0,H.jsxs)(TF,{children:[(0,H.jsx)(wF,{children:(0,H.jsx)(lF,{input:n,placeholder:G(`mermaid.inputPlaceholder`),onChange:e=>r(e),errorLine:l,onKeyboardSubmit:()=>{m()}})}),(0,H.jsx)(wF,{panelActions:[{action:()=>{m()},label:G(`mermaid.button`),icon:iS,variant:`button`}],renderSubmitShortcut:()=>(0,H.jsx)(EF,{}),children:(0,H.jsx)(CF,{canvasRef:u,loaded:e.loaded,error:a,sourceText:n,autoFixAvailable:!!s,onApplyAutoFix:()=>{s&&r(s)}})})]})]})},JF=()=>(0,H.jsxs)(`div`,{className:`chat-interface__welcome-screen__welcome-message`,children:[(0,H.jsx)(`h3`,{children:G(`chat.placeholder.title`)}),(0,H.jsx)(`p`,{children:G(`chat.placeholder.description`)}),(0,H.jsx)(`p`,{children:G(`chat.placeholder.hint`)})]}),YF=({message:e,onMermaidTabClick:t,onAiRepairClick:n,onDeleteMessage:i,onInsertMessage:a,onRetry:o,rateLimitRemaining:s,isLastMessage:c,renderWarning:l,allowFixingParseError:u})=>{let[d,f]=(0,V.useState)(!1);(0,V.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,H.jsx)(`div`,{className:`chat-message chat-message--system`,children:(0,H.jsxs)(`div`,{className:`chat-message__content`,children:[(0,H.jsxs)(`div`,{className:`chat-message__header`,children:[(0,H.jsx)(`span`,{className:`chat-message__role`,children:G(`chat.role.system`)}),(0,H.jsx)(`span`,{className:`chat-message__timestamp`,children:p(e.timestamp)})]}),(0,H.jsx)(`div`,{className:`chat-message__body`,children:(0,H.jsx)(`div`,{className:`chat-message__text`,children:t||(e.warningType===`messageLimitExceeded`?(0,H.jsxs)(H.Fragment,{children:[G(`chat.rateLimit.messageLimit`),(0,H.jsx)(`div`,{style:{marginTop:`10px`},children:(0,H.jsx)(UP,{onClick:()=>{window.open(`${r.VITE_APP_PLUS_LP}/plus?utm_source=excalidraw&utm_medium=app&utm_content=ttdChatBanner#excalidraw-redirect`,`_blank`,`noopener`)},children:G(`chat.upsellBtnLabel`)})})]}):G(`chat.rateLimit.generalRateLimit`))})})]})})}return(0,H.jsxs)(`div`,{className:`chat-message chat-message--${e.type}`,children:[(0,H.jsxs)(`div`,{className:`chat-message__content`,children:[(0,H.jsxs)(`div`,{className:`chat-message__header`,children:[(0,H.jsx)(`span`,{className:`chat-message__role`,children:e.type===`user`?G(`chat.role.user`):G(`chat.role.assistant`)}),(0,H.jsx)(`span`,{className:`chat-message__timestamp`,children:p(e.timestamp)})]}),(0,H.jsx)(`div`,{className:`chat-message__body`,children:e.error?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`chat-message__error`,children:e.content}),e.errorType!==`parse`&&(0,H.jsxs)(`div`,{className:`chat-message__error_message`,children:[`Error: `,e.error||G(`chat.errors.generationFailed`)]}),e.errorType===`parse`&&u&&(0,H.jsxs)(`div`,{className:`chat-message__error_message`,children:[(0,H.jsx)(`p`,{children:G(`chat.errors.invalidDiagram`)}),(0,H.jsxs)(`div`,{className:`chat-message__error-actions`,children:[t&&(0,H.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>t(e),type:`button`,children:G(`chat.errors.fixInMermaid`)}),n&&(0,H.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>n(e),disabled:s===0,type:`button`,children:G(`chat.errors.aiRepair`)})]})]})]}):(0,H.jsxs)(`div`,{className:`chat-message__text`,children:[e.content,e.isGenerating&&(0,H.jsx)(`span`,{className:`chat-message__cursor`,children:`▋`})]})})]}),e.type===`assistant`&&!e.isGenerating&&(0,H.jsxs)(`div`,{className:`chat-message__actions`,children:[!e.error&&a&&(0,H.jsx)(`button`,{className:`chat-message__action`,onClick:()=>a(e),type:`button`,"aria-label":G(`chat.insert`),title:G(`chat.insert`),children:rS}),t&&e.content&&(0,H.jsx)(`button`,{className:`chat-message__action`,onClick:()=>t(e),type:`button`,"aria-label":G(`chat.viewAsMermaid`),title:G(`chat.viewAsMermaid`),children:Fx}),i&&e.errorType!==`network`&&(0,H.jsx)(`button`,{className:`chat-message__action chat-message__action--danger`,onClick:()=>i(e.id),type:`button`,"aria-label":G(`chat.deleteMessage`),title:G(`chat.deleteMessage`),children:sb}),e.errorType===`network`&&o&&c&&(0,H.jsx)(`button`,{className:U(`chat-message__action`,{invisible:!d}),onClick:()=>o(e),type:`button`,"aria-label":G(`chat.retry`),title:G(`chat.retry`),children:nS})]})]})},XF=({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,V.useRef)(null),g=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>{h.current?.scrollIntoView()},[t]),(0,V.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===L.ENTER&&!e.shiftKey&&(e.preventDefault(),a||v())},b=n.trim().length>3&&!a&&(o?.rateLimitRemaining??1)>0,x=a&&!!s;return(0,H.jsxs)(`div`,{className:`chat-interface`,children:[(0,H.jsxs)(`div`,{className:`chat-interface__messages`,children:[t.length===0?(0,H.jsx)(`div`,{className:`chat-interface__welcome-screen`,children:p?p({rateLimits:o??null}):(0,H.jsx)(JF,{})}):t.map((e,n)=>(0,H.jsx)(YF,{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,H.jsx)(`div`,{ref:h,id:`messages-end`})]}),(0,H.jsx)(`div`,{className:`chat-interface__input-container`,children:(0,H.jsx)(`div`,{className:`chat-interface__input-outer`,children:(0,H.jsxs)(`div`,{className:`chat-interface__input-wrapper`,style:{borderColor:a?`var(--dialog-border-color)`:void 0},children:[(0,H.jsx)(`textarea`,{ref:g,autoFocus:!0,className:`chat-interface__input`,value:n,onChange:_,onKeyDown:y,placeholder:a?G(`chat.generating`):o?.rateLimitRemaining===0?G(`chat.rateLimit.messageLimitInputPlaceholder`):t.length>0?G(`chat.inputPlaceholderWithMessages`):G(`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,H.jsx)(`button`,{className:`chat-interface__send-button`,onClick:v,disabled:!b&&!x,type:`button`,children:(0,H.jsx)(lw,{size:`1.5em`,icon:a?Yb:iS})})]})})})]})},ZF=pc(null),QF=pc(!1),$F=pc(null),eI=pc({id:da(),messages:[],currentPrompt:``}),tI=(e,t)=>{let{messages:n}=e,r=ss(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}},nI=e=>{let{messages:t}=e;return t[ss(t,e=>e.type===`assistant`)]},rI=(e,t)=>{let n=t.map(e=>({...e,id:da(),timestamp:new Date}));return{...e,messages:[...e.messages,...n]}},iI=e=>{let t=ss(e.messages??[],e=>e.type===`assistant`);return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}},aI=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},oI=()=>{let[e,t]=fy(eI);return{addUserMessage:e=>{t(t=>rI(t,[{type:`user`,content:e}]))},addAssistantMessage:()=>{t(e=>rI(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=>tI(t,{isGenerating:!1,error:e,errorType:n,errorDetails:i}))},chatHistory:e,setChatHistory:t,setLastRetryAttempt:()=>{t(e=>tI(e,{lastAttemptAt:Date.now()}))}}},sI=e=>{let t=e.trim();return t.length<=50?t:`${t.substring(0,47)}...`},cI=pc([]),lI=pc(!1),uI=pc(!1),dI=({persistenceAdapter:e})=>{let[t]=fy(eI),[n,r]=fy(cI),[i,a]=fy(lI),[o,s]=fy(uI),c=(0,V.useRef)(n);c.current=n;let l=t?.messages[t?.messages.length-1],u=(0,V.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,V.useEffect)(()=>{u()},[]);let d=(0,V.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=sI(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,V.useEffect)(()=>{l?.isGenerating||d()},[t.messages?.length,l?.id,l?.isGenerating]),{savedChats:n,saveCurrentChat:d,deleteChat:(0,V.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,V.useCallback)(e=>e,[]),createNewChatId:(0,V.useCallback)(async()=>(await d(),da()),[d])}},fI=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(`
74
- `).pop()?.trim()||``;return![/-->$/,/--$/,/-\.$/,/==>$/,/==$/,/~~$/,/::$/,/:$/,/\|$/,/&$/].some(e=>e.test(c))},pI=300,mI=3e3,hI=100,gI=100,_I=({mermaidToExcalidrawLib:e,canvasRef:t})=>{let[n]=fy(eI),[,r]=fy($F),[i,a]=fy(QF),o=(0,V.useRef)(!1),s=(0,V.useMemo)(()=>nI(n),[n]),c=(0,V.useRef)(s);(0,V.useEffect)(()=>{c.current=s},[s]);let l=(0,V.useRef)({elements:[],files:null}),u=(0,V.useRef)(0),d=(0,V.useRef)(null),f=(0,V.useRef)(!1),p=(0,V.useRef)(pI),{theme:m}=uC(),h=(0,V.useCallback)(async n=>{if(!n.trim()||!e.loaded||o.current)return!1;o.current=!0;let i=performance.now(),a=await RF({canvasRef:t,data:l,mermaidToExcalidrawLib:e,setError:r,mermaidDefinition:n,theme:m});return performance.now()-i<hI?p.current=pI:p.current=mI,o.current=!1,a.success},[t,e,r,m]),g=(0,V.useMemo)(()=>{let e=async e=>{let t=Date.now(),n=t-u.current,r=p.current;if(!fI(e)){f.current||=(u.current=Math.max(u.current,t-r+gI),!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+gI,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,V.useCallback)(()=>{u.current=0,d.current=null,f.current=!1,p.current=pI},[]);return(0,V.useEffect)(()=>{s?.content&&s?.isGenerating?g(s.content):s?.isGenerating||(g.flush(),_(),s?.content&&g(s.content))},[_,g,s?.isGenerating,s?.content]),(0,V.useEffect)(()=>{let e=c.current;!e?.content||e.error||i&&h(e.content)},[n?.id,h,i]),(0,V.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}},vI=3,yI=1e4,bI=({onTextSubmit:e})=>{let[,t]=fy($F),[n,r]=fy(ZF),[i,a]=fy(eI),{addUserMessage:o,addAssistantMessage:s,setAssistantError:c}=oI(),l=(0,V.useRef)(null),u=e=>e.length>yI||e.length<vI||n?.rateLimitRemaining===0?(e.length<vI&&t(Error(G(`chat.errors.promptTooShort`,{min:vI}))),e.length>yI&&t(Error(G(`chat.errors.promptTooLong`,{max:yI}))),!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=>tI(e,{isGenerating:!0,content:``,error:void 0,errorType:void 0,errorDetails:void 0})):(o(n),s());try{aC(`ai`,`generate`,`ttd`);let{generatedResponse:o,error:s,rateLimit:l,rateLimitRemaining:u}=await e({messages:[...aI(i).slice(-3),{role:`user`,content:n}],onStreamCreated:()=>{d&&a(e=>tI(e,{content:``,error:``,isGenerating:!0}))},onChunk:e=>{a(t=>tI(t,{content:nI(t).content+e}))},signal:f.signal});if(a(e=>tI(e,{isGenerating:!1})),oe(l)&&oe(u)&&r({rateLimit:l,rateLimitRemaining:u}),(s?.status===429||u===0)&&a(e=>(s?.status===429&&(e=iI(e)),e={...e,messages:e.messages.filter(e=>e.type!==`warning`||e.warningType===`rateLimitExceeded`||e.warningType===`messageLimitExceeded`)},rI(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||G(`chat.errors.requestFailed`));s.status!==429&&c(e.message,`network`),t(e);return}try{await oc(o??``),aC(`ai`,`mermaid parse success`,`ttd`)}catch(e){aC(`ai`,`mermaid parse failed`,`ttd`);let n=Error(e.message||G(`chat.errors.mermaidParseError`));c(n.message,`parse`),t(n)}}catch(e){let n=Error(e.message||G(`chat.errors.generationFailed`));c(n.message,`other`),t(n)}finally{l.current=null}},handleAbort:()=>{l.current&&l.current.abort()}}},xI=({persistenceAdapter:e})=>{let t=py($F),[n,r]=fy(eI),[i,a]=(0,V.useState)(!1),{restoreChat:o,deleteChat:s,createNewChatId:c}=dI({persistenceAdapter:e}),l=(0,V.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=nI(i);t(a?.error?Error(a?.error):null),r(i)},[t,r]),u=(0,V.useCallback)(async()=>{r({id:await c(),messages:[],currentPrompt:``}),t(null)},[c,r,t]);return{isMenuOpen:i,onRestoreChat:(0,V.useCallback)(e=>{l(o(e)),a(!1)},[o,l]),handleDeleteChat:(0,V.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,V.useCallback)(async()=>{await u(),a(!1)},[u]),handleMenuToggle:(0,V.useCallback)(()=>{a(e=>!e)},[]),handleMenuClose:(0,V.useCallback)(()=>{a(!1)},[])}},SI=({isOpen:e,onToggle:t,onClose:n,onNewChat:r,onRestoreChat:i,onDeleteChat:a,isNewChatBtnVisible:o,savedChats:s,activeSessionId:c,disabled:l})=>(0,H.jsxs)(`div`,{className:`ttd-chat-history-menu`,children:[o&&(0,H.jsx)(UP,{onClick:r,disabled:l,children:G(`chat.newChat`)}),s.length>0&&(0,H.jsx)(`div`,{className:`ttd-dialog-panel__menu-wrapper`,children:(0,H.jsxs)(Q,{open:e,children:[(0,H.jsx)(Q.Trigger,{onToggle:t,className:`ttd-dialog-menu-trigger`,disabled:l,title:G(`chat.menu`),"aria-label":G(`chat.menu`),children:mS}),(0,H.jsx)(Q.Content,{onClickOutside:n,onSelect:n,children:(0,H.jsx)(H.Fragment,{children:s.map(e=>(0,H.jsxs)(Q.ItemCustom,{className:U(`ttd-chat-menu-item`,{"ttd-chat-menu-item--active":e.id===c}),onClick:()=>{i(e)},children:[(0,H.jsx)(`span`,{className:`ttd-chat-menu-item__title`,children:e.title}),(0,H.jsx)(`button`,{className:`ttd-chat-menu-item__delete`,onClick:t=>a(e.id,t),title:G(`chat.deleteChat`),"aria-label":G(`chat.deleteChat`),type:`button`,children:sb})]},e.id))})})]})})]}),CI=({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]=fy(ZF),T=(()=>{let e=[];return w&&e.push({label:G(`chat.rateLimitRemaining`,{count:w.rateLimitRemaining}),variant:`rateLimit`,className:w.rateLimitRemaining<5?`ttd-dialog-panel__rate-limit--danger`:``}),o&&e.push({action:x,label:G(`chat.viewAsMermaid`),icon:(0,H.jsx)(lw,{icon:iS}),variant:`link`}),e})();return(0,H.jsx)(wF,{label:(0,H.jsxs)(`div`,{className:`ttd-dialog-panel__label-wrapper`,children:[(0,H.jsx)(`div`,{className:`ttd-dialog-panel__label-group`}),(0,H.jsx)(`div`,{className:`ttd-dialog-panel__header-right`,children:(0,H.jsx)(SI,{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,H.jsx)(XF,{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})})},wI=({canvasRef:e,error:t,loaded:n,onInsert:r,hideErrorDetails:i})=>(0,H.jsx)(wF,{panelActionJustifyContent:`flex-end`,panelActions:[{action:r,label:G(`chat.insert`),icon:iS,variant:`button`}],className:`ttd-dialog-preview-panel`,children:(0,H.jsx)(CF,{canvasRef:e,error:t,loaded:n,hideErrorDetails:i})}),TI=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>{let a=dz(),o=vz(),s=(0,V.useRef)(null),[c,l]=fy($F),[u,d]=fy(eI),f=my(QF),{savedChats:p}=dI({persistenceAdapter:i}),m=nI(u),{setLastRetryAttempt:h}=oI(),{data:g}=_I({canvasRef:s,mermaidToExcalidrawLib:e}),{onGenerate:_,handleAbort:v}=bI({onTextSubmit:t}),{isMenuOpen:y,onRestoreChat:b,handleDeleteChat:x,handleNewChat:S,handleMenuToggle:C,handleMenuClose:w}=xI({persistenceAdapter:i});return(0,H.jsxs)(`div`,{className:`ttd-dialog-layout ${f?`ttd-dialog-layout--split`:`ttd-dialog-layout--chat-only`}`,children:[(0,H.jsx)(CI,{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&&(zF(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:
75
-
76
- \`\`\`mermaid
77
- ${t}
78
- \`\`\`
79
-
80
- The exception/error is: ${n}
81
-
82
- 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 RF({canvasRef:s,data:r,mermaidToExcalidrawLib:e,setError:l,mermaidDefinition:n,theme:a.state.theme})).success&&BF({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`&&(zF(m.content),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},renderWarning:r,renderWelcomeScreen:n}),f&&(0,H.jsx)(wI,{canvasRef:s,hideErrorDetails:m?.errorType===`parse`,error:c,loaded:e.loaded,onInsert:()=>{BF({app:a,data:g})}})]})},EI=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>(0,H.jsx)(TI,{mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i}),DI=e=>{let t=vz(),n=(0,V.useRef)(null),r=(0,V.useRef)(0);return(0,H.jsx)(tv,{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`&&sr([`text-to-diagram`,`mermaid`],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})};DI.displayName=`TTDDialogTabs`;var OI=DI,kI=({children:e,...t})=>(0,H.jsx)(nv,{className:`ttd-dialog-triggers`,...t,children:e});kI.displayName=`TTDDialogTabTriggers`;var AI=({children:e,tab:t,onSelect:n,...r})=>(0,H.jsx)(rv,{value:t,asChild:!0,onSelect:n,children:(0,H.jsx)(`button`,{type:`button`,className:`ttd-dialog-tab-trigger`,...r,children:e})});AI.displayName=`TTDDialogTabTrigger`;var jI=({tab:e,children:t,...n})=>(0,H.jsx)(iv,{...n,value:e,children:t});jI.displayName=`TTDDialogTab`;var MI=e=>{let t=uC();return t.openDialog?.name===`ttd`?(0,H.jsx)(NI,{...e,tab:t.openDialog.tab}):null};MI.WelcomeMessage=JF;var NI=pP(`TTDDialogBase`,({tab:e,...t})=>{let r=dz(),[i,a]=(0,V.useState)({loaded:!1,api:n(()=>import(`./excalidraw-mermaid-stub-Df0Q2qkW.js`),__vite__mapDeps([70,71]),import.meta.url)});return(0,V.useEffect)(()=>{(async()=>{await i.api,a(e=>({...e,loaded:!0}))})()},[i.api]),(0,H.jsx)(sk,{className:`ttd-dialog`,onCloseRequest:()=>{r.setOpenDialog(null)},size:1520,title:!1,...t,autofocus:!1,children:(0,H.jsxs)(OI,{dialog:`ttd`,tab:e,children:[`__fallback`in t&&t.__fallback?(0,H.jsx)(`p`,{className:`dialog-mermaid-title`,children:G(`mermaid.title`)}):(0,H.jsxs)(kI,{children:[(0,H.jsx)(AI,{tab:`text-to-diagram`,children:(0,H.jsxs)(`div`,{className:`ttd-dialog-tab-trigger__content`,children:[G(`labels.textToDiagram`),(0,H.jsx)(`div`,{className:`ttd-dialog-tab-trigger__badge`,children:G(`chat.aiBeta`)})]})}),(0,H.jsx)(AI,{tab:`mermaid`,children:G(`mermaid.label`)})]}),!(`__fallback`in t)&&(0,H.jsx)(jI,{className:`ttd-dialog-content`,tab:`text-to-diagram`,children:(0,H.jsx)(EI,{mermaidToExcalidrawLib:i,onTextSubmit:t.onTextSubmit,renderWelcomeScreen:t.renderWelcomeScreen,renderWarning:t.renderWarning,persistenceAdapter:t.persistenceAdapter})}),(0,H.jsx)(jI,{className:`ttd-dialog-content`,tab:`mermaid`,children:(0,H.jsx)(qF,{mermaidToExcalidrawLib:i,isActive:e===`mermaid`})})]})})}),PI=.01,FI=10,II=(e,t)=>!(t===`angle`&&I(e)),LI=(e,t)=>{let n=e+t/2;return n-n%t},RI=(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),zI=(e,t,n,r,i,a,o=!0)=>{if(Xi(n)&&(n.startBinding||n.endBinding)){if(Math.abs(e-n.x)<10&&Math.abs(t-n.y)<10)return;bo(n,`start`,r),bo(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]=z(N(n.x,n.y),N(l,u),n.angle),p=e-d,m=t-f,[h,g]=z(N(e,t),N(l+p,u+m),-n.angle);r.mutateElement(c,{x:h,y:g},{informMutation:o,isDragging:!1}),mn(c,r,i);let _=bn(n,a);if(_){let e=s.get(_.id);e&&r.mutateElement(e,{x:_.x+p,y:_.y+m},{informMutation:o,isDragging:!1})}if(I(n)){let e=Jo(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]=z(N(t.x,t.y),N(a,c),t.angle),[d,f]=z(N(Math.round(l+p),Math.round(u+m)),N(a+p,c+m),-t.angle);r.mutateElement(n,{x:d,y:f},{informMutation:o,isDragging:!1}),mn(n,r,i,{simultaneouslyUpdated:e})})}},BI=(e,t)=>{let n=we(t).map(t=>mr(e,t).reduce((e,t)=>(e[t.id]=!0,e),{}));return e.filter(e=>!gt(e)).forEach(e=>{n.push({[e.id]:!0})}),n},VI=({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=dz(),p=vz(),m=(0,V.useRef)(null),h=(0,V.useRef)(null),[g,_]=(0,V.useState)(r.toString()),v=(0,V.useRef)(null);v.current||={originalAppState:As(l),originalElements:i,lastUpdatedValue:g,updatePending:!1},(0,V.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)>=PI)&&(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:F.IMMEDIATELY}))},b=(0,V.useRef)({});return b.current.handleInputValue=y,(0,V.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(j.POINTER_MOVE,t.onPointerMove,!1),window.removeEventListener(j.POINTER_UP,t.onPointerUp,!1)}},[a]),a?(0,H.jsxs)(`div`,{className:U(`drag-input-container`,!a&&`disabled`),"data-testid":e,children:[(0,H.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,w(t)),e),new Map),a=i.map(e=>r.get(e.id)),h=As(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(j.POINTER_MOVE,y,!1),f.syncActionResult({captureUpdate:F.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(j.POINTER_UP,x,!1)};b.current.onPointerMove=y,b.current.onPointerUp=x,window.addEventListener(j.POINTER_MOVE,y,!1),window.addEventListener(j.POINTER_UP,x,!1)}},onPointerEnter:()=>{h.current&&(h.current.style.cursor=`ew-resize`)},children:t?(0,H.jsx)(lw,{icon:t}):e}),(0,H.jsx)(`input`,{className:`drag-input`,autoComplete:`off`,spellCheck:`false`,onKeyDown:e=>{if(a){let t=e.target;t instanceof HTMLInputElement&&e.key===L.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=As(l)},onBlur:e=>{g?a&&y(e.target.value,v.current.originalElements,v.current.originalAppState):_(r.toString())},disabled:!a})]}):null},HI=15,UI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i,app:a})=>{let o=i.getNonDeletedElementsMap(),s=t[0];if(s&&!Tr(s)){let t=o.get(s.id);if(!t)return;if(r!==void 0){let e=Me(r);i.mutateElement(t,{angle:e}),mn(t,i,a.state);let n=bn(t,o);n&&!nt(t)&&i.mutateElement(n,{angle:e});return}let c=(Math.round(un(s.angle)*100)/100+Math.round(e))%360;n&&(c=LI(c,HI)),c=c<0?c+360:c;let l=Me(c);i.mutateElement(t,{angle:l}),mn(t,i,a.state);let u=bn(t,o);u&&!nt(t)&&i.mutateElement(u,{angle:l})}},WI=({element:e,scene:t,appState:n,property:r})=>(0,H.jsx)(VI,{label:`A`,icon:Ux,value:Math.round(un(e.angle)%360*100)/100,elements:[e],dragInputCallback:UI,editable:II(e,`angle`),scene:t,appState:n,property:r}),GI=5,KI=({property:e,scene:t,appState:n,setAppState:r})=>(0,H.jsx)(VI,{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?LI(r.gridStep+GI*Math.sign(t),GI):r.gridStep+t),a?(a=l(a),i(a),{gridStep:a}):(i(r.gridStep),null)})},scene:t,value:n.gridStep,property:e,appState:n}),qI=10,JI=e=>e.type===`image`,YI=({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||JI(p),h=p.width/p.height;if(s.croppingElementId===p.id){let e=f.get(p.id);if(!e||!Pa(e)||!e.crop)return;let t=e.crop,n={...t},r=e.scale[0]===-1,i=e.scale[1]===-1,{width:s,height:u}=Or(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=Ce(a*d,_,h);n={...n,width:e,x:r?t.x+t.width-e:t.x}}else if(o===`height`){let e=Ce(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=Ce(t.width+y,_,h),S=Ce(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(Rt(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}),I(m)){let e=fa(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap()),t=re(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?LI(c,qI):Math.round(c));let u=Math.max(0,p.height+a);o===`height`&&(u=i?LI(u,qI):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),Rt(c,u,m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),I(m)&&d({elementsToHighlight:fa(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap())})}}},XI=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&I(o)){let n=fa(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=re(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},ZI=({property:e,element:t,scene:n,appState:r})=>{let i=at(e===`width`?t.width:t.height,2);if(r.croppingElementId&&r.croppingElementId===t.id&&Pa(t)&&t.crop){let{width:n,height:r}=Or(t);if(e===`width`){let e=n/t.crop.naturalWidth;i=at(t.crop.width*e,2)}if(e===`height`){let e=r/t.crop.naturalHeight;i=at(t.crop.height*e,2)}}return(0,H.jsx)(VI,{label:e===`width`?`W`:`H`,elements:[t],dragInputCallback:YI,value:i,editable:II(t,e),scene:n,appState:r,property:e,dragFinishedCallback:XI})},QI=4,$I=4,eL=({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),QI);else if(o.type===`text`){let t=Math.round(o.fontSize);s=Math.max(t+Math.round(e),QI),n&&(s=LI(s,$I))}s&&(i.mutateElement(t,{fontSize:s}),Gr(t,i.getContainerElement(t),i))}},tL=({element:e,scene:t,appState:n,property:r})=>{let i=M(e)?e:ys(e)?bn(e,t.getNonDeletedElementsMap()):null;return i?(0,H.jsx)(VI,{label:`F`,value:Math.round(i.fontSize*10)/10,elements:[i],dragInputCallback:eL,icon:Mx,appState:n,scene:t,property:r}):null},nL=15,rL=({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&&!gt(e)&&II(e,i)),c=t.filter(e=>!gt(e)&&II(e,i));if(r!==void 0){let e=Me(r);for(let t of s){if(!t)continue;a.mutateElement(t,{angle:e});let n=bn(t,o);n&&!nt(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(un(i.angle)*100)/100+Math.round(e))%360;n&&(l=LI(l,nL)),l=l<0?l+360:l;let u=Me(l);a.mutateElement(r,{angle:u});let d=bn(r,o);d&&!nt(r)&&a.mutateElement(d,{angle:u})}a.triggerUpdate()},iL=({elements:e,scene:t,appState:n,property:r})=>{let i=e.filter(e=>!gt(e)&&II(e,`angle`)),a=i.map(e=>Math.round(un(e.angle)%360*100)/100);return(0,H.jsx)(VI,{label:`A`,icon:Ux,value:new Set(a).size===1?a[0]:`Mixed`,elements:e,dragInputCallback:rL,editable:i.some(e=>II(e,`angle`)),appState:n,scene:t,property:r})},aL=10,oL=(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,...Cs(r,o,s,!1),...M(r)?{fontSize:r.fontSize*n}:{}}},sL=(e,t,n,r,i,a,o,s)=>{let c=s.getNonDeletedElementsMap(),l=oL(e,t,r,a);s.mutateElement(i,l);let u=bn(a,o);if(u){let e=u.fontSize*r;be(i,s);let t=c.get(u.id);t&&M(t)&&(s.mutateElement(t,{fontSize:e}),ce(i,s,n===`width`?`e`:`s`,!0))}},cL=(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];sL(i[0],i[1],a,u,n,t,c,l)}},lL=({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=BI(t,r);if(a!==void 0){for(let e of d){let t=RI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[i,c,l,u]=Rn(r),d=l-i,f=u-c,p=d/f;cL(Math.max(1,s===`width`?Math.max(0,a):d),Math.max(1,s===`height`?Math.max(0,a):f),f,p,N(i,c),s,e,r,n,o)}else{let[e]=t,c=e?.latest,u=e?.original;if(c&&u&&II(c,s)){let e=s===`width`?Math.max(0,a):c.width;s===`width`&&(e=i?LI(e,aL):Math.round(e));let t=s===`height`?Math.max(0,a):c.height;if(s===`height`&&(t=i?LI(t,aL):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),Rt(e,t,c,u,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),I(c)){let e=fa(o.getElementsIncludingDeleted(),c,r,o.getNonDeletedElementsMap()),t=re(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=RI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[a,c,l,u]=Rn(r),d=l-a,m=u-c,h=d/m,g=Math.max(0,d+f);s===`width`&&(g=i?LI(g,aL):Math.round(g));let _=Math.max(0,m+p);s===`height`&&(_=i?LI(_,aL):Math.round(_)),g=Math.max(1,g),_=Math.max(1,_),cL(g,_,m,h,N(a,c),s,e,r,n,o)}else{let[e]=t,a=e?.latest,c=e?.original;if(a&&c&&II(a,s)){let e=Math.max(0,c.width+f);s===`width`&&(e=i?LI(e,aL):Math.round(e));let t=Math.max(0,c.height+p);if(s===`height`&&(t=i?LI(t,aL):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),Rt(e,t,a,c,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),I(a)){let e=fa(o.getElementsIncludingDeleted(),a,r,o.getNonDeletedElementsMap());m.push(...e)}}}}c({elementsToHighlight:m}),o.triggerUpdate()},uL=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&I(o)){let n=fa(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=re(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},dL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,V.useMemo)(()=>r.map(t=>{let r=RI(t,n);if(r.length>1){let[t,n,i,a]=Rn(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,H.jsx)(VI,{label:e===`width`?`W`:`H`,elements:t,dragInputCallback:lL,value:s,editable:c,appState:a,property:e,scene:i,dragFinishedCallback:uL})},fL=4,pL=4,mL=(e,t)=>e.reduce((e,n)=>{if(!n||gt(n))return e;if(M(n))return e.push(n),e;if(ys(n)){let r=bn(n,t);if(r)return e.push(r),e}return e},[]),hL=({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),fL);for(let e of o)i.mutateElement(e,{fontSize:s}),Gr(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),fL);n&&(l=LI(l,pL)),i.mutateElement(a,{fontSize:l}),Gr(a,i.getContainerElement(a),i)}i.triggerUpdate()}},gL=({elements:e,scene:t,appState:n,property:r,elementsMap:i})=>{let a=mL(e,i);if(!a.length)return null;let o=a.map(e=>Math.round(e.fontSize*10)/10);return(0,H.jsx)(VI,{label:`F`,icon:Mx,elements:a,dragInputCallback:hL,value:new Set(o).size===1?o[0]:`Mixed`,editable:o.length>0,scene:t,property:r,appState:n})},_L=(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]=z(N(c.x,c.y),N(l,u),c.angle);zI(e===`x`?Math.round(d+t):d,e===`y`?Math.round(f+n):f,c,a,o,i,!1)}},vL=(e,t,n,r,i,a)=>{let o=i.getNonDeletedElementsMap(),[s,c,,]=Rn(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]=z(N(s.x,s.y),N(e,n),s.angle);zI(o+l,c+u,t,i,a,r,!1)}}},yL=({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 BI(t,s)){let t=RI(e,l,n);if(t.length>1){let[e,r,,]=Rn(t.map(e=>e.latest));vL(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&&II(r,a)){let[t,r]=[e.x+e.width/2,e.y+e.height/2],[s,l]=z(N(e.x,e.y),N(t,r),e.angle);zI(a===`x`?i:s,a===`y`?i:l,e,o,c.state,n,!1)}}}o.triggerUpdate();return}let u=r?LI(e,FI):e;_L(a,a===`x`?u:0,a===`y`?u:0,t,n,o,c.state),o.triggerUpdate()},bL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,V.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]=Rn(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]=z(N(i.x,i.y),N(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,H.jsx)(VI,{label:e===`x`?`X`:`Y`,elements:t,dragInputCallback:yL,value:s,property:e,scene:i,appState:a})},xL=({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]=z(N(d.x,d.y),N(f,p),d.angle);if(c.croppingElementId===d.id){let e=u.get(d.id);if(!e||!Pa(e)||!e.crop)return;let n=e.crop,r=n,i=e.scale[0]===-1,c=e.scale[1]===-1,{width:l,height:f}=Or(e);if(a!==void 0){if(o===`x`){let e=a*(n.naturalWidth/l);r=i?{...n,x:Ce(n.naturalWidth-e-n.width,0,n.naturalWidth-n.width)}:{...n,x:Ce(a*(n.naturalWidth/l),0,n.naturalWidth-n.width)}}o===`y`&&(r={...n,y:Ce(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:Ce(n.x+p,0,n.naturalWidth-n.width),y:Ce(n.y+m,0,n.naturalHeight-n.height)},s.mutateElement(e,{crop:r});return}if(a!==void 0){zI(o===`x`?a:m,o===`y`?a:h,d,s,l.state,r);return}let g=o===`x`?e:0,_=o===`y`?e:0;zI(o===`x`?Math.round(i?LI(d.x+g,FI):m+g):m,o===`y`?Math.round(i?LI(d.y+_,FI):h+_):h,d,s,l.state,r)},SL=({property:e,element:t,elementsMap:n,scene:r,appState:i})=>{let[a,o]=z(N(t.x,t.y),N(t.x+t.width/2,t.y+t.height/2),t.angle),s=at(e===`x`?a:o,2);if(i.croppingElementId===t.id&&Pa(t)&&t.crop){let n=Re(t);n&&(s=at(e===`x`?n.x:n.y,2))}return(0,H.jsx)(VI,{label:e===`x`?`X`:`Y`,elements:[t],dragInputCallback:xL,scene:r,value:s,property:e,appState:i})},CL=50,wL=e=>{let t=_z(),n=e.app.scene.getSceneNonce()||1,r=e.app.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}),i=vj(e.app);return(0,H.jsx)(DL,{...e,appState:t,sceneNonce:n,selectedElements:r,gridModeEnabled:i})},TL=({children:e,columns:t=1,heading:n,style:r,...i})=>(0,H.jsx)(`div`,{className:U(`exc-stats__row`,{"exc-stats__row--heading":n}),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,...r},...i,children:e});TL.displayName=`StatsRow`;var EL=({children:e,order:t,style:n,...r})=>(0,H.jsx)(`div`,{className:`exc-stats__rows`,style:{order:t,...n},...r,children:e});EL.displayName=`StatsRows`,wL.StatsRow=TL,wL.StatsRows=EL;var DL=(0,V.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=vz(),d=r.length===1?r[0]:null,f=r.length>1?r:null,p=i.croppingElementId&&Pa(d),m=p?Or(d):null,[h,g]=(0,V.useState)({width:0,height:0}),_=(0,V.useMemo)(()=>(0,dc.default)(e=>{let t=Rn(e);g({width:Math.round(t[2])-Math.round(t[0]),height:Math.round(t[3])-Math.round(t[1])})},CL),[]);(0,V.useEffect)(()=>{_(c)},[a,c,_]),(0,V.useEffect)(()=>()=>_.cancel(),[_]);let v=(0,V.useMemo)(()=>BI(r,i),[r,i]),y=(0,V.useMemo)(()=>Jr(r),[r]);return(0,H.jsx)(`div`,{className:`exc-stats`,children:(0,H.jsxs)(gC,{padding:3,children:[(0,H.jsxs)(`div`,{className:`title`,children:[(0,H.jsx)(`h2`,{children:G(`stats.title`)}),(0,H.jsx)(`div`,{className:`close`,onClick:t,children:Xb})]}),(0,H.jsxs)(uw,{label:(0,H.jsx)(`h3`,{children:G(`stats.generalStats`)}),open:!!(i.stats.panels&Bi.generalStats),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Bi.generalStats}})),children:[(0,H.jsxs)(EL,{children:[(0,H.jsx)(TL,{heading:!0,children:G(`stats.scene`)}),(0,H.jsxs)(TL,{columns:2,children:[(0,H.jsx)(`div`,{children:G(`stats.shapes`)}),(0,H.jsx)(`div`,{children:c.length})]}),(0,H.jsxs)(TL,{columns:2,children:[(0,H.jsx)(`div`,{children:G(`stats.width`)}),(0,H.jsx)(`div`,{children:h.width})]}),(0,H.jsxs)(TL,{columns:2,children:[(0,H.jsx)(`div`,{children:G(`stats.height`)}),(0,H.jsx)(`div`,{children:h.height})]}),o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(TL,{heading:!0,children:`Canvas`}),(0,H.jsx)(TL,{children:(0,H.jsx)(KI,{property:`gridStep`,scene:s,appState:i,setAppState:u})})]})]}),n?.(c,i)]}),!y&&r.length>0&&(0,H.jsx)(`div`,{id:`elementStats`,style:{marginTop:12},children:(0,H.jsx)(uw,{label:(0,H.jsx)(`h3`,{children:G(`stats.elementProperties`)}),open:!!(i.stats.panels&Bi.elementProperties),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Bi.elementProperties}})),children:(0,H.jsxs)(EL,{children:[d&&(0,H.jsxs)(H.Fragment,{children:[p&&(0,H.jsx)(TL,{heading:!0,children:G(`labels.unCroppedDimension`)}),i.croppingElementId&&Pa(d)&&m&&(0,H.jsxs)(TL,{columns:2,children:[(0,H.jsx)(`div`,{children:G(`stats.width`)}),(0,H.jsx)(`div`,{children:at(m.width,2)})]}),i.croppingElementId&&Pa(d)&&m&&(0,H.jsxs)(TL,{columns:2,children:[(0,H.jsx)(`div`,{children:G(`stats.height`)}),(0,H.jsx)(`div`,{children:at(m.height,2)})]}),(0,H.jsx)(TL,{heading:!0,"data-testid":`stats-element-type`,style:{margin:`0.3125rem 0`},children:i.croppingElementId?G(`labels.imageCropping`):G(`element.${d.type}`)}),(0,H.jsx)(TL,{children:(0,H.jsx)(SL,{element:d,property:`x`,elementsMap:l,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(SL,{element:d,property:`y`,elementsMap:l,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(ZI,{property:`width`,element:d,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(ZI,{property:`height`,element:d,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(WI,{property:`angle`,element:d,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(tL,{property:`fontSize`,element:d,scene:s,appState:i})})]}),f&&(0,H.jsxs)(H.Fragment,{children:[Kn(f)&&(0,H.jsx)(TL,{heading:!0,children:G(`element.group`)}),(0,H.jsxs)(TL,{columns:2,style:{margin:`0.3125rem 0`},children:[(0,H.jsx)(`div`,{children:G(`stats.shapes`)}),(0,H.jsx)(`div`,{children:r.length})]}),(0,H.jsx)(TL,{children:(0,H.jsx)(bL,{property:`x`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(bL,{property:`y`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(dL,{property:`width`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(dL,{property:`height`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(iL,{property:`angle`,elements:f,scene:s,appState:i})}),(0,H.jsx)(TL,{children:(0,H.jsx)(gL,{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),OL=({sourceElementId:e,onClose:t,appState:n,scene:r,generateLinkForSelection:i=xt})=>{let a=r.getNonDeletedElementsMap(),o=a.get(e)?.link??null,[s,c]=(0,V.useState)(o),[l,u]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let e=A(a,n),t=o;if(e.length>0&&i){let r=Ui(e,n);r&&(t=Vn(i(r.id,r.type)))}c(t)},[a,n,n.selectedElementIds,o,i]);let d=(0,V.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,V.useEffect)(()=>{let e=e=>{n.openDialog?.name===`elementLinkSelector`&&e.key===L.ENTER&&d(),n.openDialog?.name===`elementLinkSelector`&&e.key===L.ESCAPE&&t?.()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n,t,d]),(0,H.jsxs)(`div`,{className:`ElementLinkDialog`,children:[(0,H.jsxs)(`div`,{className:`ElementLinkDialog__header`,children:[(0,H.jsx)(`h2`,{children:G(`elementLink.title`)}),(0,H.jsx)(`p`,{children:G(`elementLink.desc`)})]}),(0,H.jsxs)(`div`,{className:`ElementLinkDialog__input`,children:[(0,H.jsx)(YO,{value:s??``,onChange:e=>{l||u(!0),c(e)},onKeyDown:e=>{e.key===L.ENTER&&d()},className:`ElementLinkDialog__input-field`,selectOnRender:!0}),o&&s&&(0,H.jsx)(Y,{type:`button`,title:G(`buttons.remove`),"aria-label":G(`buttons.remove`),label:G(`buttons.remove`),onClick:()=>{c(null),u(!0)},className:`ElementLinkDialog__remove`,icon:sb})]}),(0,H.jsxs)(`div`,{className:`ElementLinkDialog__actions`,children:[(0,H.jsx)(nO,{label:G(`buttons.cancel`),onClick:()=>{t?.()},style:{marginRight:10}}),(0,H.jsx)(nO,{label:G(`buttons.confirm`),onClick:d,actionType:`primary`})]})]})},kL=({children:e,onClose:t})=>{let[n,r]=(0,V.useState)(!!e),{container:i}=hz(),a=V.useCallback(()=>{r(!1),t&&t(),i?.focus()},[t,i]);return(0,H.jsx)(H.Fragment,{children:n&&(0,H.jsx)(sk,{size:`small`,onCloseRequest:a,title:G(`errorDialog.title`),children:(0,H.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:e})})})},AL=()=>(0,H.jsxs)(`div`,{className:`HelpDialog__header`,children:[(0,H.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://docs.excalidraw.com`,target:`_blank`,rel:`noopener`,children:[(0,H.jsx)(`div`,{className:`HelpDialog__link-icon`,children:gb}),G(`helpDialog.documentation`)]}),(0,H.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://plus.excalidraw.com/blog`,target:`_blank`,rel:`noopener`,children:[(0,H.jsx)(`div`,{className:`HelpDialog__link-icon`,children:gb}),G(`helpDialog.blog`)]}),(0,H.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://github.com/excalidraw/excalidraw/issues`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,H.jsx)(`div`,{className:`HelpDialog__link-icon`,children:_b}),G(`helpDialog.github`)]}),(0,H.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://youtube.com/@excalidraw`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,H.jsx)(`div`,{className:`HelpDialog__link-icon`,children:kS}),`YouTube`]})]}),jL=e=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{children:e.title}),(0,H.jsx)(`div`,{className:`HelpDialog__islands-container`,children:e.children})]}),ML=e=>(0,H.jsxs)(`div`,{className:`HelpDialog__island ${e.className}`,children:[(0,H.jsx)(`h4`,{className:`HelpDialog__island-title`,children:e.caption}),(0,H.jsx)(`div`,{className:`HelpDialog__island-content`,children:e.children})]});function*NL(e,t){let n=!0;for(let r of e)n||(yield t),n=!1,yield r}var PL=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,H.jsx)(FL,{children:PL(e)},e)));return(0,H.jsxs)(`div`,{className:`HelpDialog__shortcut`,children:[(0,H.jsx)(`div`,{children:e}),(0,H.jsx)(`div`,{className:`HelpDialog__key-container`,children:[...NL(r,n?G(`helpDialog.or`):null)]})]})},FL=e=>(0,H.jsx)(`kbd`,{className:`HelpDialog__key`,...e}),IL=({onClose:e})=>(0,H.jsx)(H.Fragment,{children:(0,H.jsxs)(sk,{onCloseRequest:V.useCallback(()=>{e&&e()},[e]),title:G(`helpDialog.title`),className:`HelpDialog`,children:[(0,H.jsx)(AL,{}),(0,H.jsxs)(jL,{title:G(`helpDialog.shortcuts`),children:[(0,H.jsxs)(ML,{className:`HelpDialog__island--tools`,caption:G(`helpDialog.tools`),children:[(0,H.jsx)($,{label:G(`toolBar.hand`),shortcuts:[L.H]}),(0,H.jsx)($,{label:G(`toolBar.selection`),shortcuts:[L.V,L[1]]}),(0,H.jsx)($,{label:G(`toolBar.rectangle`),shortcuts:[L.R,L[2]]}),(0,H.jsx)($,{label:G(`toolBar.diamond`),shortcuts:[L.D,L[3]]}),(0,H.jsx)($,{label:G(`toolBar.ellipse`),shortcuts:[L.O,L[4]]}),(0,H.jsx)($,{label:G(`toolBar.arrow`),shortcuts:[L.A,L[5]]}),(0,H.jsx)($,{label:G(`toolBar.line`),shortcuts:[L.L,L[6]]}),(0,H.jsx)($,{label:G(`toolBar.freedraw`),shortcuts:[L.P,L[7]]}),(0,H.jsx)($,{label:G(`toolBar.text`),shortcuts:[L.T,L[8]]}),(0,H.jsx)($,{label:G(`toolBar.image`),shortcuts:[L[9]]}),(0,H.jsx)($,{label:G(`toolBar.eraser`),shortcuts:[L.E,L[0]]}),(0,H.jsx)($,{label:G(`toolBar.frame`),shortcuts:[L.F]}),(0,H.jsx)($,{label:G(`toolBar.laser`),shortcuts:[L.K]}),(0,H.jsx)($,{label:G(`labels.eyeDropper`),shortcuts:[L.I,`Shift+S`,`Shift+G`]}),(0,H.jsx)($,{label:G(`helpDialog.editLineArrowPoints`),shortcuts:[Z(`CtrlOrCmd+Enter`)]}),(0,H.jsx)($,{label:G(`helpDialog.editText`),shortcuts:[Z(`Enter`)]}),(0,H.jsx)($,{label:G(`helpDialog.textNewLine`),shortcuts:[Z(`Enter`),Z(`Shift+Enter`)]}),(0,H.jsx)($,{label:G(`helpDialog.textFinish`),shortcuts:[Z(`Esc`),Z(`CtrlOrCmd+Enter`)]}),(0,H.jsx)($,{label:G(`helpDialog.curvedArrow`),shortcuts:[`A`,G(`helpDialog.click`),G(`helpDialog.click`),G(`helpDialog.click`)],isOr:!1}),(0,H.jsx)($,{label:G(`helpDialog.curvedLine`),shortcuts:[`L`,G(`helpDialog.click`),G(`helpDialog.click`),G(`helpDialog.click`)],isOr:!1}),(0,H.jsx)($,{label:G(`helpDialog.cropStart`),shortcuts:[G(`helpDialog.doubleClick`),Z(`Enter`)],isOr:!0}),(0,H.jsx)($,{label:G(`helpDialog.cropFinish`),shortcuts:[Z(`Enter`),Z(`Escape`)],isOr:!0}),(0,H.jsx)($,{label:G(`toolBar.lock`),shortcuts:[L.Q]}),(0,H.jsx)($,{label:G(`helpDialog.preventBinding`),shortcuts:[Z(`CtrlOrCmd`)]}),(0,H.jsx)($,{label:G(`toolBar.link`),shortcuts:[Z(`CtrlOrCmd+K`)]}),(0,H.jsx)($,{label:G(`toolBar.convertElementType`),shortcuts:[`Tab`,`Shift+Tab`],isOr:!0})]}),(0,H.jsxs)(ML,{className:`HelpDialog__island--view`,caption:G(`helpDialog.view`),children:[(0,H.jsx)($,{label:G(`buttons.zoomIn`),shortcuts:[Z(`CtrlOrCmd++`)]}),(0,H.jsx)($,{label:G(`buttons.zoomOut`),shortcuts:[Z(`CtrlOrCmd+-`)]}),(0,H.jsx)($,{label:G(`buttons.resetZoom`),shortcuts:[Z(`CtrlOrCmd+0`)]}),(0,H.jsx)($,{label:G(`helpDialog.zoomToFit`),shortcuts:[`Shift+1`]}),(0,H.jsx)($,{label:G(`helpDialog.zoomToSelection`),shortcuts:[`Shift+2`]}),(0,H.jsx)($,{label:G(`helpDialog.movePageUpDown`),shortcuts:[`PgUp/PgDn`]}),(0,H.jsx)($,{label:G(`helpDialog.movePageLeftRight`),shortcuts:[`Shift+PgUp/PgDn`]}),(0,H.jsx)($,{label:G(`buttons.zenMode`),shortcuts:[Z(`Alt+Z`)]}),(0,H.jsx)($,{label:G(`buttons.objectsSnapMode`),shortcuts:[Z(`Alt+S`)]}),(0,H.jsx)($,{label:G(`labels.toggleGrid`),shortcuts:[Z(`CtrlOrCmd+'`)]}),(0,H.jsx)($,{label:G(`labels.viewMode`),shortcuts:[Z(`Alt+R`)]}),(0,H.jsx)($,{label:G(`labels.toggleTheme`),shortcuts:[Z(`Alt+Shift+D`)]}),(0,H.jsx)($,{label:G(`stats.fullTitle`),shortcuts:[Z(`Alt+/`)]}),(0,H.jsx)($,{label:G(`search.title`),shortcuts:[AD(`searchMenu`)]}),(0,H.jsx)($,{label:G(`commandPalette.title`),shortcuts:Dr?[AD(`commandPalette`)]:[AD(`commandPalette`),AD(`commandPalette`,1)]})]}),(0,H.jsxs)(ML,{className:`HelpDialog__island--editor`,caption:G(`helpDialog.editor`),children:[(0,H.jsx)($,{label:G(`helpDialog.createFlowchart`),shortcuts:[Z(`CtrlOrCmd+Arrow Key`)],isOr:!0}),(0,H.jsx)($,{label:G(`helpDialog.navigateFlowchart`),shortcuts:[Z(`Alt+Arrow Key`)],isOr:!0}),(0,H.jsx)($,{label:G(`labels.moveCanvas`),shortcuts:[Z(`Space+${G(`helpDialog.drag`)}`),Z(`Wheel+${G(`helpDialog.drag`)}`)],isOr:!0}),(0,H.jsx)($,{label:G(`buttons.clearReset`),shortcuts:[Z(`CtrlOrCmd+Delete`)]}),(0,H.jsx)($,{label:G(`labels.delete`),shortcuts:[Z(`Delete`)]}),(0,H.jsx)($,{label:G(`labels.cut`),shortcuts:[Z(`CtrlOrCmd+X`)]}),(0,H.jsx)($,{label:G(`labels.copy`),shortcuts:[Z(`CtrlOrCmd+C`)]}),(0,H.jsx)($,{label:G(`labels.paste`),shortcuts:[Z(`CtrlOrCmd+V`)]}),(0,H.jsx)($,{label:G(`labels.pasteAsPlaintext`),shortcuts:[Z(`CtrlOrCmd+Shift+V`)]}),(0,H.jsx)($,{label:G(`labels.selectAll`),shortcuts:[Z(`CtrlOrCmd+A`)]}),(0,H.jsx)($,{label:G(`labels.multiSelect`),shortcuts:[Z(`Shift+${G(`helpDialog.click`)}`)]}),(0,H.jsx)($,{label:G(`helpDialog.deepSelect`),shortcuts:[Z(`CtrlOrCmd+${G(`helpDialog.click`)}`)]}),(0,H.jsx)($,{label:G(`helpDialog.deepBoxSelect`),shortcuts:[Z(`CtrlOrCmd+${G(`helpDialog.drag`)}`)]}),(dT||Dr)&&(0,H.jsx)($,{label:G(`labels.copyAsPng`),shortcuts:[Z(`Shift+Alt+C`)]}),(0,H.jsx)($,{label:G(`labels.copyStyles`),shortcuts:[Z(`CtrlOrCmd+Alt+C`)]}),(0,H.jsx)($,{label:G(`labels.pasteStyles`),shortcuts:[Z(`CtrlOrCmd+Alt+V`)]}),(0,H.jsx)($,{label:G(`labels.sendToBack`),shortcuts:[Z(Wi?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)]}),(0,H.jsx)($,{label:G(`labels.bringToFront`),shortcuts:[Z(Wi?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)]}),(0,H.jsx)($,{label:G(`labels.sendBackward`),shortcuts:[Z(`CtrlOrCmd+[`)]}),(0,H.jsx)($,{label:G(`labels.bringForward`),shortcuts:[Z(`CtrlOrCmd+]`)]}),(0,H.jsx)($,{label:G(`labels.alignTop`),shortcuts:[Z(`CtrlOrCmd+Shift+Up`)]}),(0,H.jsx)($,{label:G(`labels.alignBottom`),shortcuts:[Z(`CtrlOrCmd+Shift+Down`)]}),(0,H.jsx)($,{label:G(`labels.alignLeft`),shortcuts:[Z(`CtrlOrCmd+Shift+Left`)]}),(0,H.jsx)($,{label:G(`labels.alignRight`),shortcuts:[Z(`CtrlOrCmd+Shift+Right`)]}),(0,H.jsx)($,{label:G(`labels.duplicateSelection`),shortcuts:[Z(`CtrlOrCmd+D`),Z(`Alt+${G(`helpDialog.drag`)}`)]}),(0,H.jsx)($,{label:G(`helpDialog.toggleElementLock`),shortcuts:[Z(`CtrlOrCmd+Shift+L`)]}),(0,H.jsx)($,{label:G(`buttons.undo`),shortcuts:[Z(`CtrlOrCmd+Z`)]}),(0,H.jsx)($,{label:G(`buttons.redo`),shortcuts:Da?[Z(`CtrlOrCmd+Y`),Z(`CtrlOrCmd+Shift+Z`)]:[Z(`CtrlOrCmd+Shift+Z`)]}),(0,H.jsx)($,{label:G(`labels.group`),shortcuts:[Z(`CtrlOrCmd+G`)]}),(0,H.jsx)($,{label:G(`labels.ungroup`),shortcuts:[Z(`CtrlOrCmd+Shift+G`)]}),(0,H.jsx)($,{label:G(`labels.flipHorizontal`),shortcuts:[Z(`Shift+H`)]}),(0,H.jsx)($,{label:G(`labels.flipVertical`),shortcuts:[Z(`Shift+V`)]}),(0,H.jsx)($,{label:G(`labels.showStroke`),shortcuts:[Z(`S`)]}),(0,H.jsx)($,{label:G(`labels.showBackground`),shortcuts:[Z(`G`)]}),(0,H.jsx)($,{label:G(`labels.showFonts`),shortcuts:[Z(`Shift+F`)]}),(0,H.jsx)($,{label:G(`labels.decreaseFontSize`),shortcuts:[Z(`CtrlOrCmd+Shift+<`)]}),(0,H.jsx)($,{label:G(`labels.increaseFontSize`),shortcuts:[Z(`CtrlOrCmd+Shift+>`)]})]})]})]})}),LL=e=>Array.isArray(e)?`<kbd>${e.map(Z).join(` + `)}</kbd>`:`<kbd>${Z(e)}</kbd>`,RL=({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===ne.name&&e.openSidebar.tab===`search`&&e.searchMatches?.matches.length)return G(`hints.dismissSearch`,{shortcut:LL(`Escape`)});if(e.openSidebar&&!n.canFitSidebar)return null;if(Wr(e))return G(`hints.eraserRevert`,{shortcut:LL(`Alt`)});let l=r.scene.getSelectedElements(e);if(e.selectedLinearElement?.isDragging&&l[0]?.type===`arrow`)return G(`hints.arrowBindModifiers`,{shortcut_1:LL(`Ctrl`),shortcut_2:LL(`Alt`)});if(i.type===`arrow`||i.type===`line`)return c?G(`hints.linearElementMulti`,{shortcut_1:LL(`Escape`),shortcut_2:LL(`Enter`)}):i.type===`arrow`?G(`hints.arrowTool`,{shortcut:LL(`A`)}):G(`hints.linearElement`);if(i.type===`freedraw`)return G(`hints.freeDraw`);if(i.type===`text`)return G(`hints.text`);if(i.type===`embeddable`)return G(`hints.embeddable`);if(a&&s===`mouse`&&l.length===1){let e=l[0];return Bo(e)&&e.points.length===2?G(`hints.lockAngle`,{shortcut:LL(`Shift`)}):Pa(e)?G(`hints.resizeImage`,{shortcut_1:LL(`Shift`),shortcut_2:LL(`Alt`)}):G(`hints.resize`,{shortcut_1:LL(`Shift`),shortcut_2:LL(`Alt`)})}if(o&&s===`mouse`)return G(`hints.rotate`,{shortcut:LL(`Shift`)});if(l.length===1&&M(l[0]))return G(`hints.text_selected`,{shortcut:LL(`Enter`)});if(e.editingTextElement)return G(`hints.text_editing`,{shortcut_1:LL(`Escape`),shortcut_2:LL([`CtrlOrCmd`,`Enter`])});if(e.croppingElementId)return G(`hints.leaveCropEditor`,{shortcut_1:LL(`Enter`),shortcut_2:LL(`Escape`)});if(l.length===1&&Pa(l[0]))return G(`hints.enterCropEditor`,{shortcut:LL(`Enter`)});if(i.type===`selection`){if(e.selectionElement&&!l.length&&!e.editingTextElement&&!e.selectedLinearElement?.isEditing)return G(`hints.deepBoxSelect`,{shortcut:LL(`CtrlOrCmd`)});if(vj(r)&&e.selectedElementsAreBeingDragged)return G(`hints.disableSnapping`,{shortcut:LL(`CtrlOrCmd`)});if(!l.length&&!t)return G(`hints.canvasPanning`,{shortcut_1:LL(G(`keys.mmb`)),shortcut_2:LL(`Space`)});if(l.length===1){if(Bo(l[0]))return e.selectedLinearElement?.isEditing?e.selectedLinearElement.selectedPointsIndices?G(`hints.lineEditor_pointSelected`,{shortcut_1:LL(`Delete`),shortcut_2:LL([`CtrlOrCmd`,`D`])}):G(`hints.lineEditor_nothingSelected`,{shortcut_1:LL(`Shift`),shortcut_2:LL(`Alt`)}):ks(l[0])?G(`hints.lineEditor_line_info`,{shortcut:LL(`Enter`)}):G(`hints.lineEditor_info`,{shortcut_1:LL(`CtrlOrCmd`),shortcut_2:LL([`CtrlOrCmd`,`Enter`])});if(!e.newElement&&!e.selectedElementsAreBeingDragged&&O(l[0])){let e=G(`hints.bindTextToElement`,{shortcut:LL(`Enter`)}),t=G(`hints.createFlowchart`,{shortcut:LL([`CtrlOrCmd`,`↑↓`])});return _r(l[0])?(rs(l[0],r.scene.getNonDeletedElementsMap()),[e,t]):e}}}return null},zL=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let i=RL({appState:e,isMobile:t,editorInterface:n,app:r});return i?(0,H.jsx)(`div`,{className:`HintViewer`,children:(0,H.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,H.jsx)(`kbd`,{children:n?n[1]:e},t)}return e})})}):null},BL=2e3,VL=()=>{let[e,t]=(0,V.useState)(null),n=(0,V.useRef)(0);return{copyStatus:e,resetCopyStatus:(0,V.useCallback)(()=>{t(null)},[]),onCopy:()=>{clearTimeout(n.current),t(`success`),n.current=window.setTimeout(()=>{t(null)},BL)}}},HL=({title:e,name:t,checked:n,onChange:r,disabled:i=!1})=>(0,H.jsx)(`div`,{className:U(`Switch`,{toggled:n,disabled:i}),children:(0,H.jsx)(`input`,{name:t,id:t,title:e,type:`checkbox`,checked:n,disabled:i,onChange:()=>r(!n),onKeyDown:e=>{e.key===` `&&r(!n)}})}),UL=()=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{children:G(`canvasError.cannotShowPreview`)}),(0,H.jsx)(`p`,{children:(0,H.jsx)(`span`,{children:G(`canvasError.canvasTooBig`)})}),(0,H.jsxs)(`em`,{children:[`(`,G(`canvasError.canvasTooBigTip`),`)`]})]}),WL=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:r,onExportImage:i,name:a,exportWithDarkMode:o})=>{let s=Ge(t,e),[c,l]=(0,V.useState)(a),[u,d]=(0,V.useState)(s),[f,p]=(0,V.useState)(e.exportBackground),[m,h]=(0,V.useState)(e.exportEmbedScene),[g,_]=(0,V.useState)(e.exportScale),v=(0,V.useRef)(null),y=(0,V.useRef)(0),[b,x]=(0,V.useState)(null),{onCopy:S,copyStatus:C,resetCopyStatus:w}=VL();(0,V.useEffect)(()=>{w()},[c,f,o,g,m,w]);let{exportedElements:T,exportingFrame:E}=AT(t,e,u);return(0,V.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 ID({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 or(e)}catch(e){throw e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(G(`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,H.jsxs)(`div`,{className:`ImageExportModal`,children:[(0,H.jsx)(`h3`,{children:G(`imageExportDialog.header`)}),(0,H.jsxs)(`div`,{className:`ImageExportModal__preview`,children:[(0,H.jsx)(`div`,{className:`ImageExportModal__preview__canvas`,ref:v,children:b&&(0,H.jsx)(UL,{})}),(0,H.jsx)(`div`,{className:`ImageExportModal__preview__filename`,children:!co&&(0,H.jsx)(`input`,{type:`text`,className:`TextInput`,value:c,style:{width:`30ch`},onChange:e=>{l(e.target.value),r.executeAction(NT,`ui`,e.target.value)}})})]}),(0,H.jsxs)(`div`,{className:`ImageExportModal__settings`,children:[(0,H.jsx)(`h3`,{children:G(`imageExportDialog.header`)}),s&&(0,H.jsx)(GL,{label:G(`imageExportDialog.label.onlySelected`),name:`exportOnlySelected`,children:(0,H.jsx)(HL,{name:`exportOnlySelected`,checked:u,onChange:e=>{d(e)}})}),(0,H.jsx)(GL,{label:G(`imageExportDialog.label.withBackground`),name:`exportBackgroundSwitch`,children:(0,H.jsx)(HL,{name:`exportBackgroundSwitch`,checked:f,onChange:e=>{p(e),r.executeAction(FT,`ui`,e)}})}),(0,H.jsx)(GL,{label:G(`imageExportDialog.label.darkMode`),name:`exportDarkModeSwitch`,children:(0,H.jsx)(HL,{name:`exportDarkModeSwitch`,checked:o,onChange:e=>{r.executeAction(WT,`ui`,e)}})}),(0,H.jsx)(GL,{label:G(`imageExportDialog.label.embedScene`),tooltip:G(`imageExportDialog.tooltip.embedScene`),name:`exportEmbedSwitch`,children:(0,H.jsx)(HL,{name:`exportEmbedSwitch`,checked:m,onChange:e=>{h(e),r.executeAction(IT,`ui`,e)}})}),(0,H.jsx)(GL,{label:G(`imageExportDialog.label.scale`),name:`exportScale`,children:(0,H.jsx)(_P,{name:`exportScale`,value:g,onChange:e=>{_(e),r.executeAction(PT,`ui`,e)},choices:ui.map(e=>({value:e,label:`${e}\xD7`}))})}),(0,H.jsxs)(`div`,{className:`ImageExportModal__settings__buttons`,children:[(0,H.jsx)(UP,{className:`ImageExportModal__settings__buttons__button`,label:G(`imageExportDialog.title.exportToPng`),onClick:()=>i(le.png,T,{exportingFrame:E}),icon:Kx,children:G(`imageExportDialog.button.exportToPng`)}),(0,H.jsx)(UP,{className:`ImageExportModal__settings__buttons__button`,label:G(`imageExportDialog.title.exportToSvg`),onClick:()=>i(le.svg,T,{exportingFrame:E}),icon:Kx,children:G(`imageExportDialog.button.exportToSvg`)}),(dT||Dr)&&(0,H.jsx)(UP,{className:`ImageExportModal__settings__buttons__button`,label:G(`imageExportDialog.title.copyPngToClipboard`),status:C,onClick:async()=>{await i(le.clipboard,T,{exportingFrame:E}),S()},icon:qx,children:G(`imageExportDialog.button.copyPngToClipboard`)})]})]})]})},GL=({label:e,children:t,tooltip:n,name:r})=>(0,H.jsxs)(`div`,{className:`ImageExportModal__settings__setting`,title:e,children:[(0,H.jsxs)(`label`,{htmlFor:r,className:`ImageExportModal__settings__setting__label`,children:[e,n&&(0,H.jsx)(Nw,{label:n,long:!0,children:Yx})]}),(0,H.jsx)(`div`,{className:`ImageExportModal__settings__setting__content`,children:t})]}),KL=({elements:e,appState:t,files:n,actionManager:r,onExportImage:i,onCloseRequest:a,name:o})=>{let[{appStateSnapshot:s,elementsSnapshot:c}]=(0,V.useState)(()=>({appStateSnapshot:As(t),elementsSnapshot:As(e)}));return(0,H.jsx)(sk,{onCloseRequest:a,size:`wide`,title:!1,children:(0,H.jsx)(WL,{elementsSnapshot:c,appStateSnapshot:s,files:n,actionManager:r,onExportImage:i,name:o,exportWithDarkMode:t.exportWithDarkMode})})},qL={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`}},JL=({children:e,color:t})=>(0,H.jsx)(`div`,{className:`Card`,style:{"--card-color":qL[t].base,"--card-color-darker":qL[t].darker,"--card-color-darkest":qL[t].darkest},children:e}),YL=({elements:e,appState:t,setAppState:n,files:r,actionManager:i,exportOpts:a,canvas:o,onCloseRequest:s})=>{let{onExportToBackend:c}=a;return(0,H.jsx)(`div`,{className:`ExportDialog ExportDialog--json`,children:(0,H.jsxs)(`div`,{className:`ExportDialog-cards`,children:[a.saveFileToDisk&&(0,H.jsxs)(JL,{color:`lime`,children:[(0,H.jsx)(`div`,{className:`Card-icon`,children:Ob}),(0,H.jsx)(`h2`,{children:G(`exportDialog.disk_title`)}),(0,H.jsxs)(`div`,{className:`Card-details`,children:[G(`exportDialog.disk_details`),!co&&i.renderAction(`changeProjectName`)]}),(0,H.jsx)(Y,{className:`Card-button`,type:`button`,title:G(`exportDialog.disk_button`),"aria-label":G(`exportDialog.disk_button`),showAriaLabel:!0,onClick:()=>{i.executeAction(HT,`ui`)}})]}),c&&(0,H.jsxs)(JL,{color:`pink`,children:[(0,H.jsx)(`div`,{className:`Card-icon`,children:xb}),(0,H.jsx)(`h2`,{children:G(`exportDialog.link_title`)}),(0,H.jsx)(`div`,{className:`Card-details`,children:G(`exportDialog.link_details`)}),(0,H.jsx)(Y,{className:`Card-button`,type:`button`,title:G(`exportDialog.link_button`),"aria-label":G(`exportDialog.link_button`),showAriaLabel:!0,onClick:async()=>{try{aC(`export`,`link`,`ui (${Fi()})`),await c(e,t,r),s()}catch(e){n({errorMessage:e.message})}}})]}),a.renderCustomUI&&a.renderCustomUI(e,t,r,o)]})})},XL=({elements:e,appState:t,files:n,actionManager:r,exportOpts:i,canvas:a,setAppState:o})=>{let s=V.useCallback(()=>{o({openDialog:null})},[o]);return(0,H.jsx)(H.Fragment,{children:t.openDialog?.name===`jsonExport`&&(0,H.jsx)(sk,{onCloseRequest:s,title:G(`buttons.export`),children:(0,H.jsx)(YL,{elements:e,appState:t,setAppState:o,files:n,actionManager:r,onCloseRequest:s,exportOpts:i,canvas:a})})})},ZL=`small`,QL=e=>(0,H.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__LaserPointer`,`ToolIcon_size_${ZL}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,H.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,H.jsx)(`div`,{className:`ToolIcon__icon`,children:aS})]}),$L=({UIOptions:e})=>(0,H.jsxs)(HP,{__fallback:!0,children:[(0,H.jsx)(HP.DefaultItems.LoadScene,{}),(0,H.jsx)(HP.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,H.jsx)(HP.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,H.jsx)(HP.DefaultItems.SaveAsImage,{}),(0,H.jsx)(HP.DefaultItems.SearchMenu,{}),(0,H.jsx)(HP.DefaultItems.Help,{}),(0,H.jsx)(HP.DefaultItems.ClearCanvas,{}),(0,H.jsx)(HP.Separator,{}),(0,H.jsx)(HP.Group,{title:`Excalidraw links`,children:(0,H.jsx)(HP.DefaultItems.Socials,{})}),(0,H.jsx)(HP.Separator,{}),(0,H.jsx)(HP.DefaultItems.ToggleTheme,{}),(0,H.jsx)(HP.DefaultItems.ChangeCanvasBackground,{})]}),eR=()=>(0,H.jsxs)(KP,{__fallback:!0,children:[(0,H.jsx)(KP.Actions.SaveToDisk,{}),(0,H.jsx)(KP.Actions.ExportToImage,{})]}),tR=({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=pz(),x=mz()===`compact`,S=mk(),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]=fy(mC),D=()=>p.canvasActions.export?(0,H.jsx)(XL,{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,H.jsx)(KL,{elements:i,appState:t,files:n,actionManager:e,onExportImage:m,onCloseRequest:()=>r({openDialog:null}),name:_.getName()}),k=()=>(0,H.jsxs)(`div`,{style:{position:`relative`},children:[(0,H.jsx)(S.MainMenuTunnel.Out,{}),h&&(0,H.jsx)(S.WelcomeScreenMenuHintTunnel.Out,{})]}),ee=()=>{let n=x;return(0,H.jsx)(qN,{heading:`selectedShapeActions`,className:U(`selected-shape-actions zen-mode-transition`,{"transition-left":t.zenModeEnabled}),children:n?(0,H.jsx)(gC,{className:U(`compact-shape-actions-island`),padding:0,style:{maxHeight:`${t.height-166}px`},children:(0,H.jsx)(Ek,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_,setAppState:r})}):(0,H.jsx)(gC,{className:Po.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:(0,H.jsx)(bk,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_})})})},te=()=>{let n=bs(t,i),a=t.stats.open&&!t.zenModeEnabled&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`;return(0,H.jsx)(zN,{side:`top`,children:(0,H.jsxs)(`div`,{className:`App-menu App-menu_top`,children:[(0,H.jsxs)(mO.Col,{gap:C.menuTopGap,className:U(`App-menu_top__left`),children:[k(),(0,H.jsx)(`div`,{className:U(`selected-shape-actions-container`,{"selected-shape-actions-container--compact":x}),children:n&&ee()})]}),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(0,H.jsx)(qN,{heading:`shapes`,className:`shapes-section`,children:e=>(0,H.jsxs)(`div`,{style:{position:`relative`},children:[h&&(0,H.jsx)(S.WelcomeScreenToolbarHintTunnel.Out,{}),(0,H.jsx)(mO.Col,{gap:C.toolbarColGap,align:`start`,children:(0,H.jsxs)(mO.Row,{gap:C.toolbarRowGap,className:U(`App-toolbar-container`,{"zen-mode":t.zenModeEnabled}),children:[(0,H.jsxs)(gC,{padding:C.islandPadding,className:U(`App-toolbar`,{"zen-mode":t.zenModeEnabled,"App-toolbar--compact":x}),children:[(0,H.jsx)(zL,{appState:t,isMobile:b.formFactor===`phone`,editorInterface:b,app:_}),e,(0,H.jsxs)(mO.Row,{gap:C.toolbarInnerRowGap,children:[(0,H.jsx)(VN,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>c(null),title:G(`toolBar.penMode`),penDetected:t.penDetected}),(0,H.jsx)(NN,{checked:t.activeTool.locked,onChange:o,title:G(`toolBar.lock`)}),(0,H.jsx)(`div`,{className:`App-toolbar__divider`}),(0,H.jsx)(Ok,{setAppState:r,activeTool:t.activeTool,UIOptions:p,app:_})]})]}),v&&(0,H.jsx)(gC,{style:{marginLeft:C.collabMarginLeft,alignSelf:`center`,height:`fit-content`},children:(0,H.jsx)(QL,{title:G(`toolBar.laser`),checked:t.activeTool.type===pn.laser,onChange:()=>_.setActiveTool({type:pn.laser}),isMobile:!0})})]})})]})}),(0,H.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,H.jsx)($N,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),d?.(b.formFactor===`phone`,t),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(!ie||t.openSidebar?.name!==ne.name)&&(0,H.jsx)(S.DefaultSidebarTriggerTunnel.Out,{}),a&&(0,H.jsx)(wL,{app:_,onClose:()=>{e.executeAction(TE)},renderCustomStats:f})]})]})})},re=()=>(0,H.jsx)(sF,{__fallback:!0,onDock:e=>{aC(`sidebar`,`toggleDock (${e?`dock`:`undock`})`,`(${b.formFactor===`phone`?`mobile`:`desktop`})`)}}),ie=my(uP),ae=(0,H.jsxs)(H.Fragment,{children:[g,(0,H.jsx)($L,{UIOptions:p}),(0,H.jsx)(sF.Trigger,{__fallback:!0,icon:US,title:Be(G(`toolBar.library`)),onToggle:e=>{e&&aC(`sidebar`,`${ne.name} (open)`,`button (${b.formFactor===`phone`?`mobile`:`desktop`})`)},tab:ne.defaultTab}),(0,H.jsx)(eR,{}),t.openDialog?.name===`ttd`&&(0,H.jsx)(MI,{__fallback:!0}),t.isLoading&&(0,H.jsx)(AN,{delay:250}),t.errorMessage&&(0,H.jsx)(kL,{onClose:()=>r({errorMessage:null}),children:t.errorMessage}),T&&b.formFactor!==`phone`&&(0,H.jsx)(hC,{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)ge(r,ko(i),{[a&&T.swapPreviewOnAlt?e===`elementBackground`?`strokeColor`:`backgroundColor`:e===`elementBackground`?`backgroundColor`:`strokeColor`]:t}),Yo.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,H.jsx)(IL,{onClose:()=>{r({openDialog:null})}}),(0,H.jsx)(Fk,{}),t.openDialog?.name===`elementLinkSelector`&&(0,H.jsx)(OL,{sourceElementId:t.openDialog.sourceElementId,onClose:()=>{r({openDialog:null})},scene:_.scene,appState:t,generateLinkForSelection:y}),(0,H.jsx)(S.OverwriteConfirmDialogTunnel.Out,{}),O(),D(),t.openDialog?.name===`charts`&&(0,H.jsx)(KN,{data:t.openDialog.data,rawText:t.openDialog.rawText,onClose:()=>r({openDialog:null})}),b.formFactor===`phone`&&(0,H.jsx)(HN,{app:_,appState:t,elements:i,actionManager:e,renderJSONExportDialog:D,renderImageExportDialog:O,setAppState:r,onHandToolToggle:s,onPenModeToggle:c,renderTopLeftUI:u,renderTopRightUI:d,renderSidebars:re,renderWelcomeScreen:h,UIOptions:p}),b.formFactor!==`phone`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`layer-ui__wrapper`,style:t.openSidebar&&ie&&b.canFitSidebar?{width:`calc(100% - var(--right-sidebar-width))`}:{},children:[h&&(0,H.jsx)(S.WelcomeScreenCenterTunnel.Out,{}),te(),(0,H.jsx)(nP,{appState:t,actionManager:e,showExitZenModeBtn:l,renderWelcomeScreen:h}),(t.toast||t.scrolledOutside)&&(0,H.jsxs)(`div`,{className:`floating-status-stack`,children:[t.toast&&(0,H.jsx)(lT,{message:t.toast.message,onClose:()=>r({toast:null}),duration:t.toast.duration,closable:t.toast.closable}),!t.toast&&t.scrolledOutside&&(0,H.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...Pn(i,e)}))},children:G(`buttons.scrollBackToContent`)})]})]}),re()]})]});return(0,H.jsx)(lC.Provider,{value:t,children:(0,H.jsx)(w,{children:(0,H.jsx)(dk.Provider,{value:S,children:ae})})})},nR=e=>{let{startBoundElement:t,cursorButton:n,scrollX:r,scrollY:i,...a}=e;return a},rR=V.memo(tR,(e,t)=>{if(e.children!==t.children)return!1;let{canvas:n,appState:r,...i}=e,{canvas:a,appState:o,...s}=t;return Uo(nR(r),nR(o),{selectedElementIds:Uo,selectedGroupIds:Uo})&&Uo(i,s)}),iR=`small`,aR=e=>(0,H.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__MagicButton`,`ToolIcon_size_${iR}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,H.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,H.jsx)(`div`,{className:`ToolIcon__icon`,children:e.icon})]}),oR=({trails:e})=>{let t=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(t.current)for(let n of e)n.start(t.current);return()=>{for(let t of e)t.stop()}},e),(0,H.jsx)(`div`,{className:`SVGLayer`,children:(0,H.jsx)(`svg`,{ref:t})})},sR=`#ff6b6b`,cR=`#ff0000`,lR=1,uR=2,dR=(e,t)=>{if(!t.snapLines.length)return;let n=t.theme===R.LIGHT||t.zenModeEnabled?sR:cR,r=(t.zenModeEnabled?lR*1.5:lR)/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,pR(i,e,t)):i.type===`gap`?(e.lineWidth=r,e.strokeStyle=n,gR(i.points[0],i.points[1],i.direction,t,e)):i.type===`points`&&(e.lineWidth=r,e.strokeStyle=n,fR(i,e,t));e.restore()},fR=(e,t,n)=>{if(!n.zenModeEnabled){let n=e.points[0],r=e.points[e.points.length-1];hR(n,r,t)}for(let r of e.points)mR(r,n,t)},pR=(e,t,n)=>{mR(e.points[0],n,t),n.zenModeEnabled||hR(e.points[0],e.points[1],t)},mR=([e,t],n,r)=>{r.save();let i=(n.zenModeEnabled?uR*1.5:uR)/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()},hR=(e,t,n)=>{n.beginPath(),n.lineTo(e[0],e[1]),n.lineTo(t[0],t[1]),n.stroke()},gR=(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||hR(N(e[0],e[1]-a),N(e[0],e[1]+a),i),hR(N(n[0]-s,n[1]-o),N(n[0]-s,n[1]+o),i),hR(N(n[0]+s,n[1]-o),N(n[0]+s,n[1]+o),i),r.zenModeEnabled||(hR(N(t[0],t[1]-a),N(t[0],t[1]+a),i),hR(e,t,i))}else{let n=[e[0],(e[1]+t[1])/2];r.zenModeEnabled||hR(N(e[0]-a,e[1]),N(e[0]+a,e[1]),i),hR(N(n[0]-o,n[1]-s),N(n[0]+o,n[1]-s),i),hR(N(n[0]-o,n[1]+s),N(n[0]+o,n[1]+s),i),r.zenModeEnabled||(hR(N(t[0]-a,t[1]),N(t[0]+a,t[1]),i),hR(e,t,i))}},_R=(e,t)=>{Ar(t.selectedLinearElement,`selectedLinearElement is null`);let{segmentMidPointHoveredCoords:n}=t.selectedLinearElement;Ar(n,`midPointCoords is null`),e.save(),e.translate(t.scrollX,t.scrollY),yR(n,e,t),e.restore()},vR=(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=B.getElement(r,n);if(!a)return;let o=B.getPointAtIndexGlobalCoordinates(a,i,n);e.save(),e.translate(t.scrollX,t.scrollY),yR(o,e,t),e.restore()},yR=(e,t,n)=>{t.fillStyle=`rgba(105, 101, 219, 0.4)`,Ae(t,e[0],e[1],B.POINT_HANDLE_SIZE/n.zoom.value,!1)},bR=(e,t,n)=>{e.save(),e.translate(t.scrollX,t.scrollY),yR(n,e,t),e.restore()},xR=(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)`),Ae(e,n[0],n[1],(o?r*(t.selectedLinearElement?.isEditing?1.5:2):r)/t.zoom.value,!a,!o||i)},SR=(e,t,n,r,i)=>{let a=t.element.frameId&&n.get(t.element.frameId);switch(a&&I(a)&&(e.translate(a.x,a.y),e.beginPath(),pr.radius&&e.roundRect?e.roundRect(-1,-1,a.width+1,a.height+1,pr.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=pr.strokeWidth/r.zoom.value,e.strokeStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,pr.radius&&e.roundRect?(e.beginPath(),e.roundRect(0,0,t.element.width,t.element.height,pr.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=Lt(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=Ce(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]=lr(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]=ot(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&&(I(t.element)||fr(t.element))){let a=r.selectedLinearElement,o=a?.elementId&&B.getElement(a?.elementId,n),s=i&&Yt({point:i,element:t.element,elementsMap:n,threshold:0,overrideShouldTestInside:!0}),c=o&&Tr(o)||r.activeTool.type===`arrow`&&r.currentItemArrowType===`elbow`;if(!s||c){e.save();let a=Lt(t.element,n),o;if(t.element.type===`diamond`){let e=Lt(t.element,n);o=Xr(t.element).map(n=>{let r=z(Gn(n,.5),e,t.element.angle);return N(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=z(N(e.x+t.element.x,e.y+t.element.y),a,t.element.angle);return N(n[0],n[1])});let l=i&&o.reduce((e,t,n)=>{let r=ja(t,i);return n===-1||r<e.distance?{idx:n,distance:r}:e},{idx:-1,distance:1/0}),u=4/r.zoom.value,d=Er(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()}}},CR=(e,t,n,r,i,a,o)=>{let s=e.state.bindMode===`orbit`&&e.bindModeHandler!==null,c=700-(o?.runtime??(s?0:700)),l=Ce(1/700*c,1e-4,1),u=n.strokeWidth/2,d=n.frameId&&r.get(n.frameId);switch(d&&I(d)&&(t.translate(d.x,d.y),t.beginPath(),pr.radius&&t.roundRect?t.roundRect(-1,-1,d.width+1,d.height+1,pr.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=pr.strokeWidth/i.zoom.value,t.strokeStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l})`:`rgba(106, 189, 252, ${l})`,pr.radius&&t.roundRect?(t.beginPath(),t.roundRect(0,0,n.width,n.height,pr.radius/i.zoom.value),t.stroke(),t.closePath()):t.strokeRect(0,0,n.width,n.height),t.restore();break;default:t.save();let e=Lt(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=Ce(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]=lr(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]=ot(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(!I(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]=lr(n),t=Lt(n,r);o=e.map(e=>{let r=z(Gn(e,.5),t,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}else{let e=Lt(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=z(N(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}},wR=(e,t,n,r,i,a,o)=>{if(n!==null){if($e(`COMPLEX_BINDINGS`))return CR(e,t,n.element,r,i,a,o);t.save(),t.translate(i.scrollX,i.scrollY),SR(t,n,r,i,e.lastPointerMoveCoords?N(e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y):null),t.restore()}},TR=(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,Hi(e,i-h,a-h,p+h*2,m+h*2,l,u,r);e.restore()},ER=(e,t,n,r)=>{let[i,a,o,s]=si(n,r),c=o-i,l=s-a;e.strokeStyle=`rgb(0,118,255)`,e.lineWidth=pr.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),Hi(e,i,a,c,l,i+c/2,a+l/2,n.angle,!1,pr.radius/t.zoom.value),e.restore()},DR=(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]=Rn(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(mr(n,e));Object.entries(Rr(s,t)).filter(([e,t])=>t).map(([e,t])=>e).map(e=>l(e)).concat(o.map(e=>c([e]))).forEach(n=>TR(e,t,n))},OR=(e,t,n,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let i=B.getPointsGlobalCoordinates(n,r),{POINT_HANDLE_SIZE:a}=B,o=t.selectedLinearElement?.isEditing?a:a/2,s=Tr(n),c=ks(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)&&cr(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),xR(e,t,r,o,u,!1,l)}),Tr(n)){let o=n.fixedSegments?.map(e=>e.index)||[];i.slice(0,-1).forEach((s,c)=>{B.isSegmentTooShort(n,i[c+1],i[c],c,t.zoom,r)||xR(e,t,N((s[0]+i[c+1][0])/2,(s[1]+i[c+1][1])/2),a/2,!1,!o.includes(c+1),!1)})}else B.getEditorMidPoints(n,r,t).filter((e,t,r)=>e!==null&&!(Tr(n)&&(t===0||t===r.length-1))).forEach(n=>{(t.selectedLinearElement?.isEditing||i.length===2)&&xR(e,t,n,a/2,!1,!0,!1)});e.restore()},kR=(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()},AR=(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)`,Ae(e,n[0],n[1],r/t.zoom.value,!0,!0),e.restore()},jR=({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||!fr(o)||o.isDeleted)return;let s=ec(a.fixedPoint,o,i);if(!On(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&&bR(r,t,s),!(d&&l)){let s=ec(a.fixedPoint,o,i),l=c?.hoveredFocusPointBinding===n;kR(r,t,B.getPointAtIndexGlobalCoordinates(e,u,i),s),AR(r,t,s,Ia/1.5,l)}},MR=(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`?Ae(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()):Hi(e,r,s,c,l,r+c/2,s+l/2,i,!0),e.restore()}})},NR=(e,t,n,r,i)=>{let[a,o,,,s,c]=si(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()},PR=(e,t,n,r)=>{t.save();let i=Zj(n.zoom.value),a=e.width+i*2,o=e.height+i*2,s=e.x+e.width/2,c=e.y+e.height/2,l=-(e.width/2+i),u=-(e.height/2+i);t.translate(s+n.scrollX,c+n.scrollY),t.rotate(e.angle),t.lineWidth=1/n.zoom.value,t.strokeStyle=r,t.globalAlpha=.5,t.setLineDash([6/n.zoom.value,4/n.zoom.value]),t.strokeRect(l,u,a,o),t.restore()},FR=(e,t,n,r,i)=>{let a=Qj(e,n.zoom.value,i);a&&(t.save(),t.globalAlpha=.5,t.lineWidth=1.5/n.zoom.value,t.lineCap=`round`,t.strokeStyle=r,t.beginPath(),t.moveTo(a.start[0]+n.scrollX,a.start[1]+n.scrollY),t.lineTo(a.end[0]+n.scrollX,a.end[1]+n.scrollY),t.stroke(),t.restore())},IR=({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]=g(t,o),m=u,h=yt({canvas:t,scale:o,normalizedWidth:f,normalizedHeight:p});h.save(),h.scale(s.zoom.value,s.zoom.value);let _;if(r.forEach(e=>{s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===e.id&&e&&(_=e)}),_&&OR(h,s,_,n),s.selectionElement&&!s.isCropping)try{Vr(s.selectionElement,h,s,c.selectionColor)}catch(e){console.error(e)}let v=tn(i,s);if(v&&!v.autoResize&&FR(v,h,s,c.selectionColor,l.formFactor),s.editingTextElement){let e=a.get(s.editingTextElement.id);e&&!e.autoResize&&PR(e,h,s,c.selectionColor)}if(m=s.isBindingEnabled&&s.suggestedBinding?{...u,bindingHighlight:wR(e,h,s.suggestedBinding,a,s,d,u?.bindingHighlight)}:{...u,bindingHighlight:void 0},s.frameToHighlight&&ER(h,s,s.frameToHighlight,n),s.elementsToHighlight&&DR(h,s,s.elementsToHighlight),s.activeLockedId){let e=a.get(s.activeLockedId);DR(h,s,e?[e]:mr(a,s.activeLockedId),{colors:[`#ced4da`],dashed:!0})}let y=i.some(e=>I(e));i.length===1&&s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===i[0].id&&OR(h,s,i[0],n);let b=s.selectedLinearElement,x=b&&B.getElement(b.elementId,a);if(x&&(s.selectedLinearElement.isDragging||(b.segmentMidPointHoveredCoords?_R(h,s):(Tr(x)?b.hoverPointIndex===0||b.hoverPointIndex===x.points.length-1:b.hoverPointIndex>=0)&&vR(h,s,n)),nt(x)&&(jR({arrow:x,elementsMap:a,appState:s,context:h,type:`start`}),jR({arrow:x,elementsMap:a,appState:s,context:h,type:`end`}))),!s.multiElement&&!s.newElement&&!s.selectedLinearElement?.isEditing){let e=Fs(i,s,l),t=i.length===1&&Bo(i[0]);t&&s.selectedLinearElement?.elementId===i[0].id&&!i[0].locked&&OR(h,s,i[0],n);let r=c.selectionColor||`#000`;if(e){let e=ko(i),a=[];for(let i of n.values()){let o=[],l=c.remoteSelectedElementIds.get(i.id);if(t&&Tr(i)&&(i.startBinding||i.endBinding)||(e.has(i.id)&&!De(s,i)&&o.push(r),l&&o.push(...l.map(e=>tE(e,s.collaborators.get(e))))),o.length){let[e,t,r,c,u,d]=si(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||Pa(i)?0:void 0})}}let o=e=>{let t=mr(n,e),[r,i,o,s]=Rn(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 we(s))o(e);s.editingGroupId&&o(s.editingGroupId),a.forEach(e=>TR(h,s,e))}if(h.save(),h.translate(s.scrollX,s.scrollY),i.length===1){h.fillStyle=`#fff`;let t=Ii(i[0],s.zoom,n,`mouse`,st(l));if(!s.viewModeEnabled&&e&&!M(s.editingTextElement)&&!s.croppingElementId&&MR(h,c,s,t,i[0].angle),s.croppingElementId&&!s.isCropping){let e=n.get(s.croppingElementId);e&&Pa(e)&&NR(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]=Rn(i,n),d=h.getLineDash();h.setLineDash([2/s.zoom.value]);let f=h.lineWidth;h.lineWidth=1/s.zoom.value,h.strokeStyle=r,Hi(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=io([t,a,o,u,(t+o)/2,(a+u)/2],0,s.zoom,`mouse`,y?{...st(l),rotation:!0}:st(l));i.some(e=>!e.locked)&&MR(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]=si(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=I(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()}}),dR(h,s),h.restore(),rE({context:h,renderConfig:c,appState:s,normalizedWidth:f,normalizedHeight:p});let S;return c.renderScrollbars&&(S=cM(n,f,p,s),h.save(),h.fillStyle=sM,h.strokeStyle=`rgba(255,255,255,0.8)`,[S.horizontal,S.vertical].forEach(e=>{e&&$T(h,e.x,e.y,e.width,e.height,oM/2)}),h.restore()),{scrollBars:S,atLeastOneVisibleElement:r.length>0,elementsMap:n,animationState:m}},LR=e=>{let t=IR(e);return e.callback(t),t},RR=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,Gj()?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}}Gj()?requestAnimationFrame(e.tick):setTimeout(e.tick,0)}}static running(t){return e.animations.has(t)}static cancel(t){e.animations.delete(t)}};i(RR,`isRunning`,!1),i(RR,`animations`,new Map);var zR=RR,BR=`animateInteractiveScene`,VR=e=>{let t=(0,V.useRef)(!1),n=(0,V.useRef)(null);return(0,V.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,Qa({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},zR.running(BR)||zR.start(BR,({deltaTime:e,state:t})=>{let r=LR({...n.current,deltaTime:e,animationState:t}).animationState;if(r){for(let e in r)if(r[e]!==void 0)return r}})}),(0,H.jsx)(`canvas`,{className:`excalidraw__canvas interactive`,style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled&&e.appState.activeTool.type!==`laser`?on.GRAB:on.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onClick:e.onClick,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:G(`labels.drawingCanvas`)})},HR=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}),UR=V.memo(VR,(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:Uo(HR(e.appState),HR(t.appState))),WR=e=>{let t=(0,V.useRef)(null),n=(0,V.useRef)(!1);return(0,V.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,V.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`)),Je({canvas:i,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},Gj())}),(0,H.jsx)(`div`,{className:`excalidraw__canvas-wrapper`,ref:t})},GR=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}),KR=V.memo(WR,(e,t)=>e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:Uo(GR(e.appState),GR(t.appState))&&Uo(e.renderConfig,t.renderConfig)),qR=({canvas:e,rc:t,newElement:n,elementsMap:r,allElementsMap:i,scale:a,appState:o,renderConfig:s})=>{if(e){let[c,l]=g(e,a),u=yt({canvas:e,scale:a,normalizedWidth:c,normalizedHeight:l});if(u.save(),u.scale(o.zoom.value,o.zoom.value),n&&n.type!==`selection`){if(Aa(n))return;if((n.frameId||o.frameToHighlight?.id)&&o.frameRendering.enabled&&o.frameRendering.clip){let e=ae(n,r,o);e&&qr(n,e,o,r)&&Zs(e,u,s,o)}ts(n,r,i,t,u,s,o)}else u.clearRect(0,0,c,l);u.restore()}},JR=Ai(e=>{qR(e)}),YR=(e,t)=>{if(t){JR(e);return}qR(e)},XR=e=>{let t=(0,V.useRef)(null);return(0,V.useEffect)(()=>{t.current&&YR({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},Gj())}),(0,H.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})},ZR=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=[]}},QR=({app:e,activeLockedId:t})=>{let n=e.scene.getElement(t),r=n?[n]:mr(e.scene.getNonDeletedElementsMap(),t);if(r.length===0)return null;let[i,a]=Rn(r),{x:o,y:s}=Qa({sceneX:i,sceneY:a},e.state);return(0,H.jsx)(`div`,{className:`UnlockPopup`,style:{bottom:`${e.state.height+12-s+e.state.offsetTop}px`,left:`${o-e.state.offsetLeft}px`},onClick:()=>{(0,lc.flushSync)(()=>{let t=Rr(r,e.state);e.setState({selectedElementIds:r.reduce((e,t)=>({...e,[t.id]:!0}),{}),selectedGroupIds:t,activeLockedId:null})}),e.actionManager.executeAction(JE)},title:G(`labels.elementLock.unlock`),children:Vy})},$R=V.createContext(null),ez=V.createContext(null),tz={formFactor:`desktop`,desktopUIMode:`full`,userAgent:ti(typeof navigator<`u`?navigator.userAgent:``),isTouchScreen:!1,canFitSidebar:!1,isLandscape:!0},nz=V.createContext(tz);nz.displayName=`EditorInterfaceContext`;var rz={"editor:mount":{cardinality:`once`,replay:`last`},"editor:initialize":{cardinality:`once`,replay:`last`},"editor:unmount":{cardinality:`once`,replay:`last`}},iz=V.createContext({container:null,id:null});iz.displayName=`ExcalidrawContainerContext`;var az=V.createContext([]);az.displayName=`ExcalidrawElementsContext`;var oz=V.createContext({...vs(),width:0,height:0,offsetLeft:0,offsetTop:0});oz.displayName=`ExcalidrawAppStateContext`;var sz=V.createContext(()=>{console.warn(`Uninitialized ExcalidrawSetAppStateContext context!`)});sz.displayName=`ExcalidrawSetAppStateContext`;var cz=V.createContext(null);cz.displayName=`ExcalidrawActionManagerContext`;var lz=V.createContext(null);lz.displayName=`ExcalidrawAPIContext`;var uz=V.createContext(null);uz.displayName=`ExcalidrawAPISetContext`;var dz=()=>(0,V.useContext)($R),fz=()=>(0,V.useContext)(ez),pz=()=>(0,V.useContext)(nz),mz=()=>Zr(pz()),hz=()=>(0,V.useContext)(iz),gz=()=>(0,V.useContext)(az),_z=()=>(0,V.useContext)(oz),vz=()=>(0,V.useContext)(sz),yz=()=>(0,V.useContext)(cz),bz=!1,xz=0,Sz=null,Cz=!1,wz=!1,Tz=!1,Ez={horizontal:null,vertical:null},Dz=0,Oz=!1,kz=new Map,Az=!1,jz=0,Mz=!1,Nz=null,Pz={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},Fz=class e extends V.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`,tz),i(this,`stylesPanelMode`,Zr(tz)),i(this,`excalidrawContainerRef`,V.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 C(rz)),i(this,`onEvent`,this.editorLifecycleEvents.on.bind(this.editorLifecycleEvents)),i(this,`appStateObserver`,new ZR(()=>this.state)),i(this,`onStateChange`,this.appStateObserver.onStateChange),i(this,`flowChartCreator`,new Hs),i(this,`flowChartNavigator`,new ps),i(this,`bindModeHandler`,null),i(this,`hitLinkElement`),i(this,`lastPointerDownEvent`,null),i(this,`lastPointerUpEvent`,null),i(this,`lastPointerUpIsDoubleClick`,!1),i(this,`lastPointerMoveEvent`,null),i(this,`lastPointerMoveCoords`,null),i(this,`lastCompletedCanvasClicks`,[]),i(this,`previousPointerMoveCoords`,null),i(this,`lastViewportPosition`,{x:0,y:0}),i(this,`animationFrameHandler`,new lj),i(this,`laserTrails`,new Hj(this.animationFrameHandler,this)),i(this,`eraserTrail`,new hM(this.animationFrameHandler,this)),i(this,`lassoTrail`,new mM(this.animationFrameHandler,this)),i(this,`onChangeEmitter`,new ht),i(this,`onPointerDownEmitter`,new ht),i(this,`onPointerUpEmitter`,new ht),i(this,`onUserFollowEmitter`,new ht),i(this,`onScrollChangeEmitter`,new ht),i(this,`missingPointerEventCleanupEmitter`,new ht),i(this,`onRemoveEventListenersEmitter`,new ht),i(this,`api`),i(this,`updateEditorAtom`,(e,...t)=>{let n=_y.set(e,...t);return this.triggerRender(),n}),i(this,`previousHoveredBindableElement`,null),i(this,`getEffectiveGridSize`,()=>vj(this)?this.state.gridSize:null),i(this,`getTextCreationGridPoint`,(e,t)=>{let n=this.getEffectiveGridSize();if(n===null)return null;let r=e=>Math.floor(e/n)*n;return{x:r(e),y:r(t)}}),i(this,`handleIframeLikeElementHover`,({hitElement:e,scenePointer:t,moveEvent:n})=>e&&rr(e)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(e,n,t.x,t.y))?(Bw(this.interactiveCanvas,on.POINTER),this.setState({activeEmbeddable:{element:e,state:`hover`}}),!0):(this.state.activeEmbeddable?.state===`hover`&&this.setState({activeEmbeddable:null}),!1)),i(this,`isDoubleClick`,(e,t)=>e!=null&&t.timeStamp-e.timeStamp<=300),i(this,`updateEmbedValidationStatus`,(e,t)=>{this.embedsValidationStatus.set(e.id,t),Yo.delete(e)}),i(this,`updateEmbeddables`,()=>{let e=new Set,t=!1;this.scene.getNonDeletedElements().filter(n=>{if(qs(n)){if(e.add(n.id),!this.embedsValidationStatus.has(n.id)){t=!0;let e=h(n.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(n,e)}}else he(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=Xo({clientX:r.x,clientY:r.y},this.state),a=Xo({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&&I(this.scene.getElement(this.state.searchMatches.focusedId))?this.state.searchMatches.matches.find(e=>e.focus):null;return t.map(t=>{if(!gr(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}=Qa({sceneX:t.x,sceneY:t.y},this.state),a,o=dt(t);if(t.id===this.state.editingFrame){let n=o;a=(0,H.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===L.ESCAPE||e.key===L.ENTER)&&this.resetEditingFrame(t)},style:{background:e?$n(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:`${pr.nameFontSize}px`,transform:`translate(-6px, 6px)`,color:e?pr.nameColorDarkTheme:pr.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,H.jsx)(`div`,{id:this.getFrameNameDOMId(t),className:Po.FRAME_NAME,style:{position:`absolute`,bottom:`${this.state.height+pr.nameOffsetY-i+this.state.offsetTop}px`,left:`${r-this.state.offsetLeft}px`,zIndex:2,fontSize:pr.nameFontSize,color:e?pr.nameColorDarkTheme:pr.nameColorLightTheme,lineHeight:pr.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:on.MOVE,pointerEvents:this.state.viewModeEnabled?Wa.disabled:Wa.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)=>{aC(`export`,e,`ui`);let r=await jT(e,t,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:n.exportingFrame}).catch(br).catch(e=>{console.error(e),this.setState({errorMessage:e.message})});this.state.exportEmbedScene&&r&&_i(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:pn.magicframe}),aC(`ai`,`tool-select (empty-selection)`,`d2c`);else{let t=e.length===1&&$t(e[0])&&e[0];if(!t&&e.some(e=>I(e)||e.frameId)){this.setActiveTool({type:pn.magicframe});return}aC(`ai`,`tool-select (existing selection)`,`d2c`);let n;if(t)n=t;else{let[t,r,i,a]=Rn(e);n=an({...pr,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(mC,{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:F.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:t},captureUpdate:F.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(e=>this.state.selectedElementIds[e.id]?P(e,{[r?`strokeColor`:`backgroundColor`]:t}):e),captureUpdate:F.IMMEDIATELY})},keepOpenOnAlt:!1})}),i(this,`dismissLinearEditor`,()=>{setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isEditing:!1}})})}),i(this,`syncActionResult`,Uj(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&&vi(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`,Uj(()=>{Cz=!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`,Uj(e=>{this.scene.replaceAllElements([]),this.setState(t=>({...vs(),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=ka(e?.elements,null,{repairBindings:!0,deleteInvisibleElements:!0}),n=Sr(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,...Pn(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:F.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(e=>{this.fonts.onLoaded(e)}),ke(window.location.href)&&this.scrollToContent(window.location.href,{animate:!1})}),i(this,`getFormFactor`,(e,t)=>this.props.UIOptions.getFormFactor?.(e,t)??ii(e,t)),i(this,`refreshEditorInterface`,()=>{let e=this.excalidrawContainerRef.current;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect(),r=ir(),i=ti(typeof navigator<`u`?navigator.userAgent:``),a=this.props.UIOptions.dockedSidebarBreakpoint==null?Gs:this.props.UIOptions.dockedSidebarBreakpoint,o=za(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=Zr(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=m(e);this.editorInterface=za(this.editorInterface,{desktopUIMode:t}),this.reconcileStylesPanelMode(this.editorInterface)}),i(this,`onResize`,Uj(()=>{this.scene.getElementsIncludingDeleted().forEach(e=>Yo.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&&(Ez=t);let r=this.state.editingTextElement?!1:!e&&n.size>0;this.state.scrolledOutside!==r&&this.setState({scrolledOutside:r}),this.scheduleImageRefresh()}),i(this,`onScroll`,E(()=>{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`,Uj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||pi(e.target)||(this.actionManager.executeAction(gE,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onCopy`,Uj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||pi(e.target)||(this.actionManager.executeAction(mE,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onTouchStart`,t=>{if(_a&&t.preventDefault(),!bz){bz=!0,t.touches.length===1&&(Sz={x:t.touches[0].clientX,y:t.touches[0].clientY}),clearTimeout(xz),xz=window.setTimeout(e.resetTapTwice,300);return}if(bz&&t.touches.length===1&&Sz){let e=t.touches[0];ja(N(e.clientX,e.clientY),N(Sz.x,Sz.y))<=35&&(this.lassoTrail.endPath(),this.deselectElements(),this.handleCanvasDoubleClick({clientX:e.clientX,clientY:e.clientY,type:`touch`,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1})),bz=!1,clearTimeout(xz)}t.touches.length===2&&this.setState({selectedElementIds:us({},this.state),activeEmbeddable:null})}),i(this,`onTouchEnd`,e=>{this.resetContextMenuTimer(),e.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:us(this.state.previousSelectedElementIds,this.state)}):Pz.pointers.clear()}),i(this,`pasteFromClipboard`,Uj(async e=>{let t=!!Az,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)||pi(n)))return;let a=await wT(e),o=a.getFiles(),s=await TT(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=ka(e.elements,null,{deleteInvisibleElements:!0}),[n,r,i,a]=Rn(t),o=Mo(n,i)/2,s=Mo(r,a)/2,{x:c,y:l}=Xo({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]=Fe(c-o,l-s,this.getEffectiveGridSize()),{duplicatedElements:f}=li({type:`everything`,elements:t.map(e=>P(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,xr(m,ko(f));let h=this.getTopLayerFrameAtSceneCoords({x:c,y:l});if(h){let e=gi(f,h);oa(m,e,h,this.state)}this.scene.replaceAllElements(m),f.forEach(e=>{M(e)&&Ra(e)&&Gr(e,Xa(e,this.scene.getElementsMapIncludingDeleted()),this.scene)}),xn&&fe.loadElementsFonts(f).then(e=>{this.fonts.onLoaded(e)}),e.files&&this.addMissingFiles(e.files);let g=zo(f);this.store.scheduleCapture(),this.setState({...this.state,openSidebar:this.state.openSidebar&&this.editorInterface.canFitSidebar&&_y.get(uP)?this.state.openSidebar:null,...jr({editingGroupId:null,selectedElementIds:g.reduce((e,t)=>(Ra(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=>{Dz&&this.resetContextMenuTimer(),Pz.pointers.delete(e.pointerId)}),i(this,`toggleLock`,(e=`ui`)=>{this.state.activeTool.locked||aC(`toolbar`,`toggleLock`,`${e} (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),this.setState(e=>({activeTool:{...e.activeTool,...Vt(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(eT)}),i(this,`zoomCanvas`,e=>{this.setState({...Gw({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:ls(e)},this.state)})}),i(this,`cancelInProgressAnimation`,null),i(this,`scrollToContent`,(e=this.scene.getNonDeletedElements(),t)=>{if(typeof e==`string`){let n;if(n=ke(e)?Qr(e):e,n){let r=this.scene.getElementsFromId(n);r?.length?this.scrollToContent(r,{fitToContent:t?.fitToContent??!0,animate:t?.animate??!0}):ke(e)&&this.setState({toast:{message:G(`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}=Qw({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=Pn(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=ee({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)**+En(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,Br,window.location.pathname)}}catch(e){this.setState({errorMessage:e.message})}}),i(this,`addFiles`,Uj(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===Vs.svg))try{let t=cs(Ci(Qn(e.dataURL)),Vs.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`,Uj(e=>{let{elements:t,appState:n,collaborators:r,captureUpdate:i}=e;if(i){let e=t||void 0,r=n?Li({...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=de.squash(...e),r={...this.state},i=new Map(this.scene.getElementsMapIncludingDeleted());return de.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`,Uj(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 Ey().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`,Uj(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}})),!Si(e.target)){if((e.key===L.ESCAPE||e.key===L.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}let t=A(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&Pa(t[0])&&e.key===L.ENTER){this.startImageCropping(t[0]);return}if(e.key===L.ESCAPE)this.updateEditorAtom(iD,null);else if(e.key===L.TAB&&(document.activeElement===this.excalidrawContainerRef?.current||document.activeElement?.classList.contains(Po.CONVERT_ELEMENT_TYPE_POPUP))){e.preventDefault();let n=dD(t);_y.get(iD)?.type===`panel`&&uD(this,{conversionType:n,direction:e.shiftKey?`left`:`right`})&&this.store.scheduleCapture(),n&&this.updateEditorAtom(iD,{type:`panel`})}if(e.key===L.ESCAPE&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.clear(),this.triggerRender(!0);return}let n=Mn(e.key);if(e[L.CTRL_OR_CMD]&&n&&!e.shiftKey){e.preventDefault();let t=A(this.scene.getNonDeletedElementsMap(),this.state);t.length===1&&_r(t[0])&&this.flowChartCreator.createNodes(t[0],this.state,Ze(e.key),this.scene),this.flowChartCreator.pendingNodes?.length&&!ga(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=A(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&n){e.preventDefault();let n=this.flowChartNavigator.exploreByDirection(t[0],this.scene.getNonDeletedElementsMap(),Ze(e.key));if(n){this.setState(e=>({selectedElementIds:us({[n]:!0},e)}));let e=this.scene.getNonDeletedElementsMap().get(n);e&&!ga([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[L.CTRL_OR_CMD]&&e.key===L.P&&!e.shiftKey&&!e.altKey){this.setToast({message:G(`commandPalette.shortcutHint`,{shortcut:AD(`commandPalette`)})}),e.preventDefault();return}if(e[L.CTRL_OR_CMD]&&e.key.toLowerCase()===L.V&&(Az=e.shiftKey,clearTimeout(jz),jz=window.setTimeout(()=>{Az=!1},100)),e[L.CTRL_OR_CMD]&&pi(e.target)&&(e.code===Ye.MINUS||e.code===Ye.EQUAL)){e.preventDefault();return}if(pi(e.target)&&e.key!==L.ESCAPE||Mn(e.key)&&Si(e.target))return;if(e.key===L.QUESTION_MARK){this.setState({openDialog:{name:`help`}});return}else if(e.key.toLowerCase()===L.E&&e.shiftKey&&e[L.CTRL_OR_CMD]){e.preventDefault(),this.setState({openDialog:{name:`imageExport`}});return}if(e.key===L.PAGE_UP||e.key===L.PAGE_DOWN){let t=(e.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;e.key===L.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===L.ALT&&($e(`COMPLEX_BINDINGS`)?this.handleSkipBindMode():Sn({app:this,event:e})),this.actionManager.handleKeyDown(e)))return;let t=this.props.viewModeEnabled===!0;if(!t&&this.state.viewModeEnabled&&e.key===L.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=uk(e.key,this);if(this.state.viewModeEnabled&&!Wt(t,[`laser`,`hand`]))return;if(t){this.state.activeTool.type!==t&&aC(`toolbar`,t,`keyboard (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),t===`arrow`&&this.state.activeTool.type===`arrow`&&this.setState(e=>({currentItemArrowType:e.currentItemArrowType===Ja.sharp?Ja.round:e.currentItemArrowType===Ja.round?Ja.elbow:Ja.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===L.Q){this.toggleLock(`keyboard`),e.stopPropagation();return}}if(this.state.viewModeEnabled)return;if(e[L.CTRL_OR_CMD]&&!e.repeat&&($e(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),(0,lc.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),Sn({app:this,event:e})),Mn(e.key)){let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),n=new Set;t.filter(e=>Xi(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===L.ARROW_LEFT?i=-r:e.key===L.ARROW_RIGHT?i=r:e.key===L.ARROW_UP?a=-r:e.key===L.ARROW_DOWN&&(a=r),t.forEach(e=>{this.scene.mutateElement(e,{x:e.x+i,y:e.y+a},{informMutation:!1,isDragging:!1}),be(e,this.scene,{simultaneouslyUpdated:t})}),this.scene.triggerUpdate(),e.preventDefault()}else if(e.key===L.ENTER){let t=this.scene.getSelectedElements(this.state);if(t.length===1){let n=t[0];if(e[L.CTRL_OR_CMD]||ks(n))Bo(n)&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==n.id)&&(this.store.scheduleCapture(),Tr(n)||this.actionManager.executeAction(KA));else if(M(n)||ro(n)){let t;M(n)||(t=n);let r=No(n,this.state,this.scene.getNonDeletedElementsMap()),i=r.x,a=r.y;this.startTextEditing({sceneX:i,sceneY:a,container:t}),e.preventDefault();return}else I(n)&&this.setState({editingFrame:n.id})}}if(e.key===L.SPACE&&Pz.pointers.size===0&&(Cz=!0,Bw(this.interactiveCanvas,on.GRAB),e.preventDefault()),(e.key===L.G||e.key===L.S)&&!e.altKey&&!e[L.CTRL_OR_CMD]){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;e.key===L.G&&(mt(this.state.activeTool.type)||t.some(e=>mt(e.type)))&&(this.setState({openPopup:`elementBackground`}),e.stopPropagation()),e.key===L.S&&(this.setState({openPopup:`elementStroke`}),e.stopPropagation())}if(!e[L.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===L.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)||bn(e,this.scene.getNonDeletedElementsMap())))&&(e.preventDefault(),this.setState({openPopup:`fontFamily`}))}e[L.CTRL_OR_CMD]&&(e.key===L.BACKSPACE||e.key===L.DELETE)&&this.updateEditorAtom(Pk,`clearCanvas`);let n=e.key.toLocaleLowerCase(),r=n===L.S&&e.shiftKey&&!e[L.CTRL_OR_CMD],i=e.key===L.I||n===L.G&&e.shiftKey;(r||i)&&this.openEyeDropper({type:r?`stroke`:`background`})})),i(this,`onKeyUp`,Uj(e=>{if(e.key===L.SPACE&&(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`||this.state.openDialog?.name===`elementLinkSelector`?Bw(this.interactiveCanvas,on.GRAB):Is(this.state.activeTool.type)?zw(this.interactiveCanvas):(Ww(this.interactiveCanvas,this.state),this.setState({selectedElementIds:us({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),Cz=!1),e.key===L.ALT&&Sn({app:this,event:e}),(e.key===L.ALT&&this.state.bindMode===`skip`||!e[L.CTRL_OR_CMD]&&!Do(this.state))&&(this.setState({bindMode:`orbit`}),this.lastPointerMoveEvent&&$e(`COMPLEX_BINDINGS`))){let e=Xo({clientX:this.lastPointerMoveEvent.clientX,clientY:this.lastPointerMoveEvent.clientY},this.state),t=ue(N(e.x,e.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(this.state.selectedLinearElement){let e=B.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());Xi(e)&&this.handleDelayedBindModeChange(e,t)}}if(!e[L.CTRL_OR_CMD]){let t=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==t&&(0,lc.flushSync)(()=>{this.setState({isBindingEnabled:t})}),Sn({app:this,event:e})}if(Mn(e.key)){Ws(this.scene.getSelectedElements(this.state).filter(nt),this.scene,this.state);let e=this.scene.getNonDeletedElementsMap();this.scene.getSelectedElements(this.state).filter(Wn).forEach(t=>{t.startBinding&&this.scene.mutateElement(t,{startBinding:{...t.startBinding,...os(t,e.get(t.startBinding.elementId),`start`,e)}}),t.endBinding&&this.scene.mutateElement(t,{endBinding:{...t.endBinding,...os(t,e.get(t.endBinding.elementId),`end`,e)}})}),this.setState({suggestedBinding:null})}if(e.altKey||this.flowChartNavigator.isExploring&&(this.flowChartNavigator.clear(),this.syncActionResult({captureUpdate:F.IMMEDIATELY})),!e[L.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:us({[e.id]:!0},t)})),ga([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:F.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=Vt(this.state,e);n.type===`hand`?Bw(this.interactiveCanvas,on.GRAB):Cz||Ww(this.interactiveCanvas,{...this.state,activeTool:n}),Le(document.activeElement)&&this.focusContainer(),Ne(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:Is(n.type)?e.selectedLinearElement:null};return n.type===`freedraw`&&this.store.scheduleCapture(),n.type===`lasso`?{...e,...r,activeTool:n,...t?{}:{selectedElementIds:us({},e),selectedGroupIds:us({},e),editingGroupId:null,multiElement:null}}:n.type===`selection`?{...e,...r,activeTool:n}:{...e,...r,activeTool:n,selectedElementIds:us({},e),selectedGroupIds:us({},e),editingGroupId:null,multiElement:null}})}),i(this,`setOpenDialog`,e=>{this.setState({openDialog:e})}),i(this,`setCursor`,e=>{Bw(this.interactiveCanvas,e)}),i(this,`resetCursor`,()=>{zw(this.interactiveCanvas)}),i(this,`isTouchScreenMultiTouchGesture`,()=>Pz.pointers.size>=2),i(this,`getName`,()=>this.state.name||this.props.name||`${G(`labels.untitled`)}-${Jn()}`),i(this,`onGestureStart`,Uj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:us({},this.state),activeEmbeddable:null}),Pz.initialScale=this.state.zoom.value})),i(this,`onGestureChange`,Uj(e=>{if(e.preventDefault(),this.isTouchScreenMultiTouchGesture())return;let t=Pz.initialScale;t&&this.setState(n=>({...Gw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:ls(t*e.scale)},n)}))})),i(this,`onGestureEnd`,Uj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:us(this.state.previousSelectedElementIds,this.state)}),Pz.initialScale=null})),i(this,`isHittingTextAutoResizeHandle`,(e,t)=>{let n=tn(e,this.state);return!!(n&&!n.isDeleted&&!n.autoResize&&$j(t,n,this.state.zoom.value,this.editorInterface.formFactor))}),i(this,`handleTextAutoResizeHandlePointerDown`,(e,t)=>{let n=tn(e,this.state);return!n||!this.isHittingTextAutoResizeHandle(e,t)?!1:(this.actionManager.executeAction(oj,`ui`,n),this.resetCursor(),!0)}),i(this,`startTextEditing`,({sceneX:e,sceneY:t,insertAtParentCenter:n=!0,container:r,autoEdit:i=!0,initialCaretSceneCoords:a})=>{let o=!1,s=n&&this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r);r&&s&&(bn(r,this.scene.getNonDeletedElementsMap())||(o=!0));let c=this.getSelectedTextElement(r)||this.getTextElementAtPosition(e,t),l=c?.fontFamily||this.state.currentItemFontFamily,u=c?.lineHeight||hn(l),d=this.state.currentItemFontSize;if(!c&&o&&r&&!nt(r)){let n=p(ao({fontSize:d,fontFamily:l}),u),i=pa(d,u),a=Math.max(r.height,i),o=Math.max(r.width,n);this.scene.mutateElement(r,{height:a,width:o}),e=r.x+o/2,t=r.y+a/2,s&&=this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r)}let f=this.getTopLayerFrameAtSceneCoords({x:e,y:t}),m=this.getTextCreationGridPoint(e,t),h=s?{x:s.elementCenterX,y:s.elementCenterY}:c?{x:e,y:t}:{x:m?.x??e,y:m===null?t-gn(d,u)/2:m.y},g=c||qe({x:h.x,y:h.y,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:d,fontFamily:l,textAlign:s?`center`:this.state.currentItemTextAlign,verticalAlign:s?ns.MIDDLE:`top`,containerId:o?r?.id:void 0,groupIds:r?.groupIds??[],lineHeight:u,angle:r?nt(r)?0:r.angle:0,frameId:f?f.id:null});if(!c&&o&&r&&this.scene.mutateElement(r,{boundElements:(r.boundElements||[]).concat({type:`text`,id:g.id})}),this.setState({editingTextElement:g}),!c)if(r&&o){let e=this.scene.getElementIndex(r.id);this.scene.insertElementAtIndex(g,e+1)}else this.scene.insertElement(g);i||c||r?this.handleTextWysiwyg(g,{isExistingElement:!!c,initialCaretSceneCoords:c?a:null}):this.setState({newElement:g,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,`shouldHandleBrowserCanvasDoubleClick`,e=>{if(e===`touch`||this.lastCompletedCanvasClicks.length===0)return!0;if(this.lastCompletedCanvasClicks.length<2)return!1;let[t,n]=this.lastCompletedCanvasClicks;return ja(N(t.x,t.y),N(n.x,n.y))<=35}),i(this,`handleCanvasDoubleClick`,e=>{if(this.state.editingTextElement||!this.shouldHandleBrowserCanvasDoubleClick(e.type)||this.state.multiElement||this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let t=this.scene.getSelectedElements(this.state),{x:n,y:r}=Xo(e,this.state);if(t.length===1&&Bo(t[0])){let i=t[0];if((e[L.CTRL_OR_CMD]&&Wn(i)||ks(i))&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==i.id)){this.actionManager.executeAction(KA);return}else if(this.state.selectedLinearElement&&Tr(t[0])){let e=B.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),i=e?B.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,e,this.scene.getNonDeletedElementsMap()):-1;if(i&&i>-1){this.store.scheduleCapture(),B.deleteFixedSegment(t[0],this.scene,i);let a=B.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),o=a?B.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&&ks(i))return}if(t.length===1&&Pa(t[0])){this.startImageCropping(t[0]);return}if(zw(this.interactiveCanvas),we(this.state).length>0){let e=this.getElementAtPosition(n,r),t=e&&et(e,this.state.selectedGroupIds);if(t){this.store.scheduleCapture(),this.setState(n=>({...n,...jr({editingGroupId:t,selectedElementIds:{[e.id]:!0}},this.scene.getNonDeletedElements(),n,this)}));return}}if(zw(this.interactiveCanvas),!e[L.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let t=this.getElementAtPosition(n,r);if(rr(t)){this.setState({activeEmbeddable:{element:t,state:`active`}});return}if(!this.state.selectedLinearElement?.isEditing){let t=this.getTextBindableContainerAtPosition(n,r);if(t&&(ys(t)||!_o(t.backgroundColor)||Yt({point:N(n,r),element:t,elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(t)}))){let e=No(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,`handleCanvasClick`,e=>{if(e.button!==Mt.MAIN){this.lastCompletedCanvasClicks=[];return}this.lastCompletedCanvasClicks=[...this.lastCompletedCanvasClicks.slice(-1),{x:e.clientX,y:e.clientY}]}),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&&_n(a,this.scene.getNonDeletedElementsMap(),this.state,N(e.x,e.y),this.editorInterface.formFactor===`phone`))return a}}),i(this,`handleElementLinkClick`,e=>{let t=ja(N(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),N(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||t>10)return;let n=Xo(this.lastPointerDownEvent,this.state),r=this.scene.getNonDeletedElementsMap(),i=_n(this.hitLinkElement,r,this.state,N(n.x,n.y),this.editorInterface.formFactor===`phone`),a=Xo(this.lastPointerUpEvent,this.state),o=_n(this.hitLinkElement,r,this.state,N(a.x,a.y),this.editorInterface.formFactor===`phone`);if(i&&o){WE();let t=this.hitLinkElement.link;if(t){t=Vn(t);let n;if(this.props.onLinkOpen&&(n=$i(j.EXCALIDRAW_LINK,e.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:t},n)),!n?.defaultPrevented){let e=so(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&&_s(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=Xo(e,this.state),{x:n,y:r}=t;this.lastPointerMoveCoords={x:n,y:r},Pz.pointers.has(e.pointerId)&&Pz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});let i=Pz.initialScale;if(Pz.pointers.size===2&&Pz.lastCenter&&i&&Pz.initialDistance){let e=uj(Pz.pointers),t=e.x-Pz.lastCenter.x,n=e.y-Pz.lastCenter.y;Pz.lastCenter=e;let r=dj(Array.from(Pz.pointers.values())),a=this.state.activeTool.type===`freedraw`&&this.state.penMode?1:r/Pz.initialDistance,o=a?ls(i*a):this.state.zoom.value;this.setState(r=>{let i=Gw({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 Pz.lastCenter=Pz.initialDistance=Pz.initialScale=null;if(Cz||wz||Tz||Us(this.state))return;let a=lM(Ez,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?zw(this.interactiveCanvas):Ww(this.interactiveCanvas,this.state)),!this.state.newElement&&Ij(this.state.activeTool.type)){let{originOffset:t,snapLines:i}=Fj(this.scene.getNonDeletedElements(),this,{x:n,y:r},e,this.scene.getNonDeletedElementsMap());this.setState(e=>{let n=hr(e.snapLines,i),r=e.originSnapOffset?hr(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:B.handlePointerMoveInEditMode(e,n,r,this);t&&t!==this.state.selectedLinearElement&&(0,lc.flushSync)(()=>{this.setState({selectedLinearElement:t})})}if(So(this.state.activeTool.type)){let{newElement:e}=this.state;if(!e&&Do(this.state)){let e=N(n,r),t=this.scene.getNonDeletedElementsMap(),i=ue(e,this.scene.getNonDeletedElements(),t,Er(this.state.zoom));i?this.setState({suggestedBinding:{element:i,midPoint:ha(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(Ww(this.interactiveCanvas,this.state),c===l)nt(this.state.newElement)&&Do(this.state)&&ue(N(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),Er(this.state.zoom))?(this.actionManager.executeAction(tT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n,y:r}}),this.setState({suggestedBinding:null,startBoundElement:null}),this.state.activeTool.locked||(zw(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:Vt(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:us({...e.selectedElementIds,[t.id]:!0},e),selectedLinearElement:new B(t,this.scene.getNonDeletedElementsMap())})))):ja(N(n-a,r-o),c)>=8?(this.scene.mutateElement(t,{points:[...s,N(n-a,r-o)]},{informMutation:!1,isDragging:!1}),Ar(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}}})):Bw(this.interactiveCanvas,on.POINTER);else if(s.length>2&&l&&ja(N(n-a,r-o),l)<8){Bw(this.interactiveCanvas,on.POINTER),this.scene.mutateElement(t,{points:s.slice(0,-1)},{informMutation:!1,isDragging:!1});let e=t.points.length-1;this.setState({selectedLinearElement:{...i,selectedPointsIndices:i.selectedPointsIndices?[...new Set(i.selectedPointsIndices.map(t=>Math.min(t,e)))]:i.selectedPointsIndices,lastCommittedPoint:t.points[e],initialState:{...i.initialState,lastClickedPoint:e}}})}else{Hn(s,this.state.zoom.value)&&Bw(this.interactiveCanvas,on.POINTER);let i=this.scene.getNonDeletedElementsMap();if(Wn(t)){let e=ue(N(n,r),this.scene.getNonDeletedElements(),i);$e(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(t,e)}Ar(this.state.selectedLinearElement,`Expected selectedLinearElement to be set to operate on a linear element`);let a=B.handlePointerMove(e.nativeEvent,this,n,r,this.state.selectedLinearElement);a&&this.setState(a)}return}if(this.state.activeTool.type===`arrow`){let e=ue(N(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),Er(this.state.zoom)),t=N(n,r),i=this.scene.getNonDeletedElementsMap();e&&!ur(t,e,i)&&this.setState({suggestedBinding:{element:e,midPoint:ha(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(this.isHittingTextAutoResizeHandle(l,t)){Bw(this.interactiveCanvas,on.POINTER);return}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&&Tr(l[0]))&&!(Bo(l[0])&&(this.editorInterface.userAgent.isMobileDevice||l[0].points.length===2))){let t=Zn(c,this.state,n,r,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);if(t&&t.transformHandleType){Bw(this.interactiveCanvas,Va(t));return}}}else if(l.length>1&&!a&&this.state.openDialog?.name!==`elementLinkSelector`){let t=ia(Rn(l),n,r,this.state.zoom,e.pointerType,this.editorInterface);if(t){Bw(this.interactiveCanvas,Va({transformHandleType:t}));return}}if(Wr(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])Bw(this.interactiveCanvas,on.POINTER),HE(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap());else{if(WE(),s)return;d&&(d.link||qs(d))&&this.state.selectedElementIds[d.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:`info`}):this.state.activeTool.type===`text`?Bw(this.interactiveCanvas,M(d)?on.TEXT:on.CROSSHAIR):!e[L.CTRL_OR_CMD]&&this.isHittingCommonBoundingBoxOfSelectedElements(t,l)?Bw(this.interactiveCanvas,on.MOVE):this.state.viewModeEnabled?Bw(this.interactiveCanvas,on.GRAB):this.state.openDialog?.name===`elementLinkSelector`||a?Bw(this.interactiveCanvas,on.AUTO):!e[L.CTRL_OR_CMD]&&d?.id!==this.state.editingTextElement?.id?(d||this.isHittingCommonBoundingBoxOfSelectedElements(t,l))&&!d?.locked&&(!d||!Tr(d)||!(d.startBinding||d.endBinding))&&(this.state.activeTool.type!==`lasso`||l.length>0)&&Bw(this.interactiveCanvas,on.MOVE):Bw(this.interactiveCanvas,on.AUTO),this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r)}this.state.openDialog?.name===`elementLinkSelector`&&d?this.setState(e=>({hoveredElementIds:hr(e.hoveredElementIds,jr({editingGroupId:e.editingGroupId,selectedElementIds:{[d.id]:!0}},this.scene.getNonDeletedElements(),e,this).selectedElementIds)})):this.state.openDialog?.name===`elementLinkSelector`&&!d&&this.setState(e=>({hoveredElementIds:hr(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=>{Oz=!0}),i(this,`handleCanvasPointerDown`,e=>{let t=this.scene.getSelectedElements(this.state);if(!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let{x:n,y:r}=Xo(e,this.state);this.lastPointerMoveCoords={x:n,y:r};let i=e.target;if(i.setPointerCapture&&i.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(JP,null)),_y.get(iD)&&this.updateEditorAtom(iD,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:us(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`?F.EVENTUALLY:F.NEVER});return}let a=document.getSelection();if(a?.anchorNode&&a.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=za(this.editorInterface,{isTouchScreen:!0})),wz||(this.lastPointerDownEvent=e,this.handleCanvasPanUsingWheelOrSpaceDrag(e)))return;if(this.setState({lastPointerDownWith:e.pointerType,cursorButton:`down`}),this.savePointer(e.clientX,e.clientY,`down`),e.button===Mt.ERASER&&this.state.activeTool.type!==pn.eraser){this.setState({activeTool:Vt(this.state,{type:pn.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(e);let t=()=>{n(),r?.(),Wr(this.state)&&this.setState({activeTool:Vt(this.state,{...this.state.activeTool.lastActiveTool||{type:pn.selection},lastActiveToolBeforeEraser:null})})},n=Xt(window,j.POINTER_UP,t,{once:!0}),r;requestAnimationFrame(()=>{r=this.missingPointerEventCleanupEmitter.once(t)})});return}if(e.button!==Mt.MAIN&&e.button!==Mt.TOUCH&&e.button!==Mt.ERASER||Pz.pointers.size>1)return;let o=this.initialPointerDownState(e);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleTextAutoResizeHandlePointerDown(t,o.origin)||this.handleDraggingScrollBar(e,o)||(this.clearSelectionIfNotUsingSelection(),this.handleSelectionOnPointerDown(e,o))||!(!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=o.hit.element&&this.isASelectedElement(o.hit.element);(e.altKey&&e[L.CTRL_OR_CMD]&&!o.resize.handleType||!o.hit.hasHitCommonBoundingBoxOfSelectedElements&&!o.resize.handleType&&!t)&&(this.lassoTrail.hasCurrentTrail||this.lassoTrail.startPath(o.origin.x,o.origin.y,e.shiftKey),o.drag.blockDragging=this.editorInterface.formFactor===`desktop`),this.editorInterface.formFactor!==`desktop`&&o.hit.element&&!t&&(this.setState(e=>{let t={...e.selectedElementIds,[o.hit.element.id]:!0},n=[];Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)});let r=o.hit.element;if(I(r))Jo(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=>mr(this.scene.getNonDeletedElements(),e)).filter(e=>I(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=>mr(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return{...jr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:r.link||qs(r)?`info`:!1}}),o.hit.wasAddedToSelection=!0)}else this.state.activeTool.type===`text`?this.handleTextOnPointerDown(e,o):this.state.activeTool.type===`arrow`||this.state.activeTool.type===`line`?this.handleLinearElementOnPointerDown(e,this.state.activeTool.type,o):this.state.activeTool.type===`freedraw`?this.handleFreeDrawElementOnPointerDown(e,this.state.activeTool.type,o):this.state.activeTool.type===`custom`?Ww(this.interactiveCanvas,this.state):this.state.activeTool.type===pn.frame||this.state.activeTool.type===pn.magicframe?this.createFrameElementOnPointerDown(o,this.state.activeTool.type):this.state.activeTool.type===`laser`?this.laserTrails.startPath(o.lastCoords.x,o.lastCoords.y):this.state.activeTool.type!==`eraser`&&this.state.activeTool.type!==`hand`&&this.state.activeTool.type!==`image`&&this.createGenericElementOnPointerDown(this.state.activeTool.type,o);this.props?.onPointerDown?.(this.state.activeTool,o),this.onPointerDownEmitter.trigger(this.state.activeTool,o,e),this.state.activeTool.type===`eraser`&&this.eraserTrail.startPath(o.lastCoords.x,o.lastCoords.y);let s=this.onPointerMoveFromPointerDownHandler(o),c=this.onPointerUpFromPointerDownHandler(o),l=this.onKeyDownFromPointerDownHandler(o),u=this.onKeyUpFromPointerDownHandler(o);this.missingPointerEventCleanupEmitter.once(t=>c(t||e.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type===`laser`)&&(window.addEventListener(j.POINTER_MOVE,s),window.addEventListener(j.POINTER_UP,c),window.addEventListener(j.KEYDOWN,l),window.addEventListener(j.KEYUP,u),o.eventListeners.onMove=s,o.eventListeners.onUp=c,o.eventListeners.onKeyUp=u,o.eventListeners.onKeyDown=l)}),i(this,`handleCanvasPointerUp`,e=>{if($e(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.removePointer(e),this.lastPointerUpIsDoubleClick=this.isDoubleClick(this.lastPointerUpEvent,e),this.lastPointerUpEvent=e,!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let t=Xo({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`&&(Oz=!1,Dz?Oz=!0:Dz=window.setTimeout(()=>{Dz=0,Oz||this.handleCanvasContextMenu(e)},500))}),i(this,`resetContextMenuTimer`,()=>{clearTimeout(Dz),Dz=0,Oz=!1}),i(this,`maybeCleanupAfterMissingPointerUp`,e=>{Nz?.(),this.missingPointerEventCleanupEmitter.trigger(e).clear()}),i(this,`handleCanvasPanUsingWheelOrSpaceDrag`,e=>{if(!(Pz.pointers.size<=1&&(e.button===Mt.WHEEL||e.button===Mt.MAIN&&Cz||Us(this.state)||this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`)))return!1;wz=!0,this.focusContainer(),this.state.editingTextElement||e.preventDefault();let t=!1,n=/Linux/.test(window.navigator.platform);Bw(this.interactiveCanvas,on.GRABBING);let{clientX:r,clientY:i}=e,a=Wj(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(j.PASTE,e),t.stopPropagation()},n=()=>{setTimeout(()=>{document.body.removeEventListener(j.PASTE,e),window.removeEventListener(j.POINTER_UP,n)},100)};document.body.addEventListener(j.PASTE,e),window.addEventListener(j.POINTER_UP,n)}this.translateCanvas({scrollX:this.state.scrollX-a/this.state.zoom.value,scrollY:this.state.scrollY-o/this.state.zoom.value})}),o=Uj(Nz=()=>{Nz=null,wz=!1,Cz||(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`?Bw(this.interactiveCanvas,on.GRAB):Ww(this.interactiveCanvas,this.state)),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(j.POINTER_MOVE,a),window.removeEventListener(j.POINTER_UP,o),window.removeEventListener(j.BLUR,o),a.flush()});return window.addEventListener(j.BLUR,o),window.addEventListener(j.POINTER_MOVE,a,{passive:!0}),window.addEventListener(j.POINTER_UP,o),!0}),i(this,`clearSelectionIfNotUsingSelection`,()=>{Is(this.state.activeTool.type)||this.setState({selectedElementIds:us({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}),i(this,`handleSelectionOnPointerDown`,(e,t)=>{if(Is(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&&!Tr(i[0])&&!(Bo(i[0])&&(this.editorInterface.userAgent.isMobileDevice||i[0].points.length===2))&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let r=Zn(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=ia(Rn(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=Cn(uo(t.resize.handleType,i,r,t.origin.x,t.origin.y)),i.length===1&&Bo(i[0])&&i[0].points.length===2&&(t.resize.arrowDirection=Ma(t.resize.handleType,i[0]));else{if(this.state.selectedLinearElement){let n=this.state.selectedLinearElement,r=B.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=B.getElement(n.elementId,i);if(a&&Xi(a)){let{hitFocusPoint:e,pointerOffset:r}=kn(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?us({[e.selectedLinearElement.elementId]:!0},this.state):us({},e)}));else if(a!=null){if(e[L.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=>({...ji(e,a),previousSelectedElementIds:this.state.selectedElementIds})),!1);this.state.selectedElementIds[a.id]||(this.state.editingGroupId&&!Pr(a,this.state.editingGroupId)&&this.setState({selectedElementIds:us({},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)}),I(a))Jo(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=>mr(this.scene.getNonDeletedElements(),e)).filter(e=>I(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=>mr(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})),{...jr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:a.link||qs(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);ys(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,initialCaretSceneCoords:{x:n,y:r}}),zw(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:Vt(this.state,{type:this.state.preferredSelectionTool.type})})}),i(this,`handleFreeDrawElementOnPointerDown`,(e,t,n)=>{let[r,i]=Fe(n.origin.x,n.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),o=e.pressure===.5,s=va({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:[N(0,0)],pressures:o?[]:[e.pressure]});this.scene.insertElement(s),this.setState(e=>{let t={...e.selectedElementIds};return delete t[s.id],{selectedElementIds:us(t,e)}});let c=ue(N(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]=Fe(e,t,this.lastPointerDownEvent?.[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=Bs({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]=Fe(e,t,this.lastPointerDownEvent?.[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=Ao(n);if(!a)return;a.error instanceof URIError&&this.setToast({message:G(`toast.unrecognizedLinkFormat`),closable:!0});let o=ar({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]=Fe(e,t,this.lastPointerDownEvent?.[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=n?this.getTopLayerFrameAtSceneCoords({x:r,y:i}):null,o=100/this.state.zoom.value;return vt({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,lc.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),this.state.multiElement){let{multiElement:t,selectedLinearElement:r}=this.state;if(Ar(r,`selectedLinearElement is expected to be set`),t.type===`line`&&Hn(t.points,this.state.zoom.value)){(0,lc.flushSync)(()=>{this.setState({selectedLinearElement:{...r,lastCommittedPoint:t.points[t.points.length-1],initialState:{...r.initialState,lastClickedPoint:-1}}})}),this.actionManager.executeAction(tT);return}if(Tr(t)&&t.points.length>1){this.actionManager.executeAction(tT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}let{x:i,y:a}=t,{lastCommittedPoint:o}=r,s=Do(this.state)&&ue(N(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(Xi(t)&&s||t.points.length>1&&o&&ja(N(n.origin.x-i,n.origin.y-a),o)<8){this.actionManager.executeAction(tT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}this.setState(e=>({selectedElementIds:us({...e.selectedElementIds,[t.id]:!0},e)})),Bw(this.interactiveCanvas,on.POINTER)}else{let[r,i]=Fe(n.origin.x,n.origin.y,e[L.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`?is({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===Ja.round?{type:fo.PROPORTIONAL_RADIUS}:null,startArrowhead:c,endArrowhead:l,locked:!1,frameId:a?a.id:null,elbowed:this.state.currentItemArrowType===Ja.elbow,fixedSegments:this.state.currentItemArrowType===Ja.elbow?[]:null}):Te({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:fo.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:a?a.id:null}),d=N(n.origin.x,n.origin.y),f=this.scene.getNonDeletedElementsMap(),p=Do(this.state)?ue(d,this.scene.getNonDeletedElements(),f):null;this.scene.mutateElement(u,{points:[N(0,0),N(0,0)]}),this.scene.insertElement(u),Xi(u)&&Ls(u,new Map([[0,{point:N(0,0),isDragging:!1}]]),d[0],d[1],this.scene,this.state,{newArrow:!0,altKey:e.altKey,initialBinding:!0,angleLocked:_t(e.nativeEvent)}),(0,lc.flushSync)(()=>{this.setState(t=>{let r=null,i=t.selectedElementIds;if(Bo(u)){r=new B(u,this.scene.getNonDeletedElementsMap());let t=u.points.length-1;r={...r,selectedPointsIndices:[t],initialState:{...r.initialState,arrowStartIsInside:e.altKey,lastClickedPoint:t,origin:N(n.origin.x,n.origin.y)}}}return i=this.state.activeTool.locked?t.selectedElementIds:us({[u.id]:!0},t),{...t,bindMode:`orbit`,newElement:u,startBoundElement:p,suggestedBinding:p&&Xi(u)?{element:p,midPoint:ha(d,p,f,this.state.zoom)}:null,selectedElementIds:i,selectedLinearElement:r}})}),Xi(u)&&$e(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(u,p)}}),i(this,`createGenericElementOnPointerDown`,(e,t)=>{let[n,r]=Fe(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[L.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`?ar({type:`embeddable`,...a}):_({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]=Fe(e.origin.x,e.origin.y,this.lastPointerDownEvent?.[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i={x:n,y:r,opacity:this.state.currentItemOpacity,locked:!1,...pr},a=t===pn.magicframe?an(i):qa(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(Xi(t)){if(t.startBinding){let e=this.scene.getElement(t.startBinding.elementId);ge(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}if(t.endBinding){let e=this.scene.getElement(t.endBinding.elementId);ge(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}}else fr(t)&&t.boundElements?.forEach(e=>{if(e.type===`arrow`){let n=this.scene.getElement(e.id);n?.startBinding?.elementId===t.id&&ge(n,this.scene.getElementsMapIncludingDeleted(),{startBinding:null}),n?.endBinding?.elementId===t.id&&ge(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)||Ra(t)&&this.elementsPendingErasure.has(t.containerId)?(e=!0,P(t,{isDeleted:!0})):t);this.elementsPendingErasure=new Set,e&&(this.store.scheduleCapture(),this.scene.replaceAllElements(t))}),i(this,`initializeImage`,async(e,t)=>{if(!Oo(t))throw Error(G(`errors.unsupportedFileType`));let n=t.type;if(Bw(this.interactiveCanvas,`wait`),n===Vs.svg)try{t=aa(Ci(await t.text()),t.name)}catch(e){throw console.warn(e),Error(G(`errors.svgImageInsertError`))}let r=await(this.props.generateIdForFile?.(t)||Tn(t));if(!r)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),Error(G(`errors.imageInsertError`));if(!this.files[r]?.dataURL){try{t=await Ut(t,{maxWidthOrHeight:Hr})}catch(e){console.error(`Error trying to resizing image file on insertion`,e)}if(t.size>4194304)throw Error(G(`errors.fileTooBig`,{maxSize:`${Math.trunc(f/1024/1024)}MB`}))}let i=this.files[r]?.dataURL||await Io(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(G(`errors.imageInsertError`)))}})}),i(this,`getLatestInitializedImageElement`,(e,t)=>P(this.scene.getElement(e.id)??e,{fileId:t})),i(this,`onImageToolbarButtonClick`,async()=>{try{let{x:e,y:t}=Xo({clientX:this.state.width/2+this.state.offsetLeft,clientY:this.state.height/2+this.state.offsetTop},this.state),n=await es({description:`Image`,extensions:Object.keys(zt),multiple:!0});this.insertImages(n,e,t)}catch(e){e.name===`AbortError`?console.warn(e):console.error(e),this.setState({newElement:null,activeTool:Vt(this.state,{type:this.state.preferredSelectionTool.type})},()=>{this.actionManager.executeAction(tT)})}}),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 ca({imageCache:this.imageCache,fileIds:e.map(e=>e.fileId),files:t});return r.size&&(this.store.scheduleAction(F.NEVER),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(e=>Xs(e)&&r.has(e.fileId)?P(e,{status:`error`}):e))),{updatedFiles:n,erroredFiles:r}}),i(this,`addNewImagesToImageCache`,async(e=Ji(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)&&Yo.delete(t);e.size&&this.scene.triggerUpdate()}}),i(this,`scheduleImageRefresh`,(0,dc.default)(()=>{this.addNewImagesToImageCache()},500)),i(this,`handleInteractiveCanvasRef`,e=>{e===null?(this.interactiveCanvas?.removeEventListener(j.TOUCH_START,this.onTouchStart),this.interactiveCanvas?.removeEventListener(j.TOUCH_END,this.onTouchEnd)):(this.interactiveCanvas=e,this.interactiveCanvas.addEventListener(j.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(j.TOUCH_END,this.onTouchEnd))}),i(this,`insertImages`,async(e,t,n)=>{let r=50/this.state.zoom.value,i=ri(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 yo(e[n]))}catch(e){return this.setState({errorMessage:e.message||G(`errors.imageInsertError`)}),P(t,{isDeleted:!0})}})),o=ko(a),s=ri(a.filter(e=>!e.isDeleted),t,n,r),c=ko(s),l=this.scene.getElementsIncludingDeleted().map(e=>c.get(e.id)??o.get(e.id)??e);this.updateScene({appState:{selectedElementIds:us(Object.fromEntries(s.map(e=>[e.id,!0])),this.state)},elements:l,captureUpdate:F.IMMEDIATELY}),this.setState({},()=>{this.actionManager.executeAction(tT)})}),i(this,`handleAppOnDrop`,async e=>{let{x:t,y:n}=Xo(e,this.state),r=await wT(e),i=r.getFiles();if(i.length===1){let{file:e,fileHandle:t}=i[0];if(e&&(e.type===Vs.png||e.type===Vs.svg))try{let n=await La(e,this.state,this.scene.getElementsIncludingDeleted(),t);this.syncActionResult({...n,appState:{...n.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:F.IMMEDIATELY});return}catch(e){if(e.name!==`EncodingError`)throw Error(G(`alerts.couldNotLoadInvalidFile`))}}let a=i.map(e=>e.file).filter(e=>Oo(e));if(a.length>0&&this.isToolSupported(`image`))return this.insertImages(a,t,n);let o=r.getData(Vs.excalidrawlibIds),s=r.getData(Vs.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=Go(s));t?.length&&(t=t.map(e=>({...e,elements:li({type:`everything`,elements:e.elements,randomizeSeed:!0}).duplicatedElements})),this.addElementsFromPasteOrLibrary({elements:YD(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(Vs.text);if(c){let e=c.value;if(e&&h(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||Ao(e)?.type===`video`)){let r=this.insertEmbeddableElement({sceneX:t,sceneY:n,link:Vn(e)});r&&(this.store.scheduleCapture(),this.setState({selectedElementIds:{[r.id]:!0}}))}}}),i(this,`loadFileToCanvas`,async(e,t)=>{e=await yo(e);try{let n=this.scene.getElementsIncludingDeleted(),r;try{r=await Ps(e,this.state,n,t)}catch(e){let t=e instanceof cn;if(t&&e.code===`IMAGE_NOT_CONTAINS_SCENE_DATA`&&!this.isToolSupported(`image`)){this.setState({isLoading:!1,errorMessage:G(`errors.imageToolNotSupported`)});return}let n=G(t?`alerts.cannotRestoreFromImage`:`alerts.couldNotLoadInvalidFile`);this.setState({isLoading:!1,errorMessage:n})}if(!r)return;r.type===Vs.excalidraw?(Ln(n.concat(r.data.elements)),this.store.scheduleMicroAction({action:F.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:F.IMMEDIATELY})):r.type===Vs.excalidrawlib&&await this.library.updateLibrary({libraryItems:e,merge:!0,openLibraryMenu:!0}).catch(e=>{console.error(e),this.setState({errorMessage:G(`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!==Mt.SECONDARY)&&this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let{x:t,y:n}=Xo(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;aC(`contextMenu`,`openContextMenu`,o),this.setState({...r&&!this.state.selectedElementIds[r.id]?{...this.state,...jr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[r.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:Bo(r)?new B(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`){qn({newElement:r,elementType:this.state.activeTool.type,originX:e.origin.x,originY:e.origin.y,x:i.x,y:i.y,width:Mo(e.origin.x,i.x),height:Mo(e.origin.y,i.y),shouldMaintainAspectRatio:yi(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]=Fe(i.x,i.y,t[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=Xs(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:d}=Pj(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:d}),Xi(a)||qn({newElement:a,elementType:this.state.activeTool.type,originX:e.originInGrid.x,originY:e.originInGrid.y,x:o,y:s,width:Mo(e.originInGrid.x,o),height:Mo(e.originInGrid.y,s),shouldMaintainAspectRatio:Pa(a)?!yi(t):yi(t),shouldResizeFromCenter:gs(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===pn.frame||this.state.activeTool.type===pn.magicframe)&&this.setState({elementsToHighlight:fa(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]=Fe(r.x-e.resize.offset.x,r.y-e.resize.offset.y,t[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(n&&o&&Pa(o)){let s=e.originalElements.get(o.id),c=Xs(o)&&this.imageCache.get(o.fileId)?.image;if(s&&Pa(s)&&c&&!(c instanceof Promise)){let[l,u]=Fe(r.x,r.y,t[L.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}=Nj([o],[s],this,t,d,n);this.scene.mutateElement(o,ki(o,this.scene.getNonDeletedElementsMap(),n,c.naturalWidth,c.naturalHeight,i+f.x,a+f.y,t.shiftKey?s.width/s.height:void 0)),be(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=>I(e)),i=e.resize.handleType;if(r.length>0&&i===`rotation`||n.length===1&&Tr(n[0])||this.state.croppingElementId)return!1;this.setState({isResizing:i&&i!==`rotation`,isRotating:i===`rotation`,activeEmbeddable:null});let a=e.lastCoords,[o,s]=Fe(a.x-e.resize.offset.x,a.y-e.resize.offset.y,t[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=new Map;if(r.forEach(e=>{Jo(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]=Fe(a.x,a.y,t[L.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}=Nj(n,A(u,this.state),this,t,l,i);o+=d.x,s+=d.y,this.setState({snapLines:f})}if(jt(e.originalElements,i,n,this.scene,_t(t),gs(t),n.some(e=>Pa(e))?!yi(t):yi(t),o,s,e.resize.center.x,e.resize.center.y)){let e=new Set;return r.forEach(t=>{fa(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(vE,_E),e===`canvas`)return this.state.viewModeEnabled?[...t,bE,xE,hk,TE]:[hE,DN,vE,_E,yE,DN,nC,YE,DN,bE,SE,CE,wE,xE,hk,TE];if(t.push(yE),this.state.viewModeEnabled)return[mE,...t];let n=this.editorInterface.formFactor===`desktop`?[DN,QS,$S,eC,tC]:[];return[DN,gE,mE,hE,DN,XA,ZA,QA,DN,JA,DN,...t,DN,KT,qT,DN,ZT,oj,EE,DE,AE,QT,DN,aE,...n,DN,uE,dE,DN,KA,DN,KE,DD,DN,rC,JE,DN,ZS]}),i(this,`handleWheel`,Uj(e=>{if(!(e.target instanceof HTMLCanvasElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLIFrameElement||e.target instanceof HTMLElement&&e.target.classList.contains(Po.FRAME_NAME))){e[L.CTRL_OR_CMD]&&e.preventDefault();return}if(e.preventDefault(),wz)return;let{deltaX:t,deltaY:n}=e;if(e.metaKey||e.ctrlKey){let e=Math.sign(n),t=Js*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=>({...Gw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:ls(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}=Xo({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:Pz.pointers})}),i(this,`resetShouldCacheIgnoreZoomDebounced`,E(()=>{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=vs(),{viewModeEnabled:r=!1,zenModeEnabled:a=!1,gridModeEnabled:o=!1,objectsSnapModeEnabled:s=!1,theme:c=n.theme,name:l=`${G(`labels.untitled`)}-${Jn()}`}=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=Zr(this.editorInterface),this.id=Ft(),this.library=new JD(this),this.actionManager=new cj(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new Kt,this.canvas=document.createElement(`canvas`),this.rc=Wo.canvas(this.canvas),this.renderer=new Lj(this.scene),this.visibleElements=[],this.store=new go(this),this.history=new tj(this.store),this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new fe(this.scene),this.history=new tj(this.store),this.actionManager.registerAll(JS),this.actionManager.registerAction(ij(this.history)),this.actionManager.registerAction(aj(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(qo).includes(n)&&kz.set(e,n)}break}}handleSkipBindMode(){if(this.state.selectedLinearElement?.initialState&&!this.state.selectedLinearElement.initialState.arrowStartIsInside){Ar(this.lastPointerMoveCoords,`Missing last pointer move coords when changing bind skip mode for arrow start`);let e=this.scene.getNonDeletedElementsMap(),t=ue(N(this.lastPointerMoveCoords.x,this.lastPointerMoveCoords.y),this.scene.getNonDeletedElements(),e),n=B.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,lc.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;Ar(n,`Last event must exist`);let r=e-this.state.selectedLinearElement.pointerOffset.x,i=t-this.state.selectedLinearElement.pointerOffset.y,a=this.state.multiElement?B.handlePointerMove(n,this,r,i,this.state.selectedLinearElement):B.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||Tr(e))return;let n=()=>{if(this.bindModeHandler=null,Ar(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=ue(N(t,n),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(r&&this.state.bindMode!==`skip`){Ar(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,lc.flushSync)(()=>{Ar(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;Ar(a,`Last event must exist`);let o=t-this.state.selectedLinearElement.pointerOffset.x,s=n-this.state.selectedLinearElement.pointerOffset.y,c=this.state.multiElement?B.handlePointerMove(a,this,o,s,this.state.selectedLinearElement):B.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&&yn(o,n),l=s&&yn(s,n);r=!!(c&&l&&o.id!==s.id&&Ur(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,lc.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!==Mt.MAIN||Cz||!Wt(this.state.activeTool.type,[`laser`,`selection`,`lasso`]))return!1;let e=N(Xo({clientX:this.lastPointerDownEvent.clientX,clientY:this.lastPointerDownEvent.clientY},this.state)),t=N(Xo({clientX:this.lastPointerUpEvent.clientX,clientY:this.lastPointerUpEvent.clientY},this.state));if(ja(e,t)>10)return!1;let n=this.getElementAtPosition(e[0],e[1]);if(!(n&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<=300&&Pz.pointers.size<2&&rr(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),he(r)))return!0;let i=this.getHTMLIFrameElement(r);if(!i?.contentWindow)return!0;if(i.src.includes(`youtube`)){let e=kz.get(r.id);switch(e||(kz.set(r.id,qo.UNSTARTED),i.contentWindow.postMessage(JSON.stringify({event:`listening`,id:r.id}),`*`)),e){case qo.PLAYING:case qo.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,H.jsx)(H.Fragment,{children:this.scene.getNonDeletedElements().filter(e=>qs(e)&&this.embedsValidationStatus.get(e.id)===!0||he(e)).map(r=>{let{x:i,y:a}=Qa({sceneX:r.x,sceneY:r.y},this.state),o=gr(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(he(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:()=>wt(`
83
- <style>
84
- html, body {
85
- width: 100%;
86
- height: 100%;
87
- color: ${this.state.theme===R.DARK?`white`:`black`};
88
- }
89
- body {
90
- display: flex;
91
- align-items: center;
92
- justify-content: center;
93
- flex-direction: column;
94
- gap: 1rem;
95
- }
96
-
97
- .Spinner {
98
- display: flex;
99
- align-items: center;
100
- justify-content: center;
101
- margin-left: auto;
102
- margin-right: auto;
103
- }
104
-
105
- .Spinner svg {
106
- animation: rotate 1.6s linear infinite;
107
- transform-origin: center center;
108
- width: 40px;
109
- height: 40px;
110
- }
111
-
112
- .Spinner circle {
113
- stroke: currentColor;
114
- animation: dash 1.6s linear 0s infinite;
115
- stroke-linecap: round;
116
- }
117
-
118
- @keyframes rotate {
119
- 100% {
120
- transform: rotate(360deg);
121
- }
122
- }
123
-
124
- @keyframes dash {
125
- 0% {
126
- stroke-dasharray: 1, 300;
127
- stroke-dashoffset: 0;
128
- }
129
- 50% {
130
- stroke-dasharray: 150, 300;
131
- stroke-dashoffset: -200;
132
- }
133
- 100% {
134
- stroke-dasharray: 1, 300;
135
- stroke-dashoffset: -280;
136
- }
137
- }
138
- </style>
139
- <div class="Spinner">
140
- <svg
141
- viewBox="0 0 100 100"
142
- >
143
- <circle
144
- cx="50"
145
- cy="50"
146
- r="46"
147
- stroke-width="8"
148
- fill="none"
149
- stroke-miter-limit="10"
150
- />
151
- </svg>
152
- </div>
153
- <div>Generating...</div>
154
- `)};else{let t;t=e.code===`ERR_GENERATION_INTERRUPTED`?`Generation was interrupted...`:e.message||`Generation failed`,c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>wt(`
155
- <style>
156
- html, body {
157
- height: 100%;
158
- }
159
- body {
160
- display: flex;
161
- flex-direction: column;
162
- align-items: center;
163
- justify-content: center;
164
- color: ${Mi.red[3]};
165
- }
166
- h1, h3 {
167
- margin-top: 0;
168
- margin-bottom: 0.5rem;
169
- }
170
- </style>
171
- <h1>Error!</h1>
172
- <h3>${t}</h3>
173
- `)}}}else c=Ao(ye(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,H.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:di(r,To(r,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure,null,this.state.openDialog?.name===`elementLinkSelector`?Kr:1),"--embeddable-radius":`${Nn(Math.min(r.width,r.height),r)}px`},children:(0,H.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?Wa.enabled:Wa.disabled},children:[u&&(0,H.jsx)(`div`,{className:`excalidraw__embeddable-hint`,children:G(`buttons.embeddableInteractionButton`)}),(0,H.jsx)(`div`,{className:`excalidraw__embeddable__outer`,style:{padding:`${r.strokeWidth}px`},children:(qs(r)?this.props.renderEmbeddable?.(r,this.state):null)??(0,H.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=_y.get(iD)?.type===`panel`;return(0,H.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?Wa.disabled:Wa.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,H.jsx)(lz.Provider,{value:this.api,children:(0,H.jsx)($R.Provider,{value:this,children:(0,H.jsx)(ez.Provider,{value:this.props,children:(0,H.jsx)(iz.Provider,{value:this.excalidrawContainerValue,children:(0,H.jsx)(nz.Provider,{value:this.editorInterface,children:(0,H.jsx)(sz.Provider,{value:this.setAppState,children:(0,H.jsx)(oz.Provider,{value:this.state,children:(0,H.jsxs)(az.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,H.jsxs)(cz.Provider,{value:this.actionManager,children:[(0,H.jsx)(rR,{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:Ey().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,H.jsx)(`div`,{className:`excalidraw-textEditorContainer`}),(0,H.jsx)(`div`,{className:`excalidraw-contextMenuContainer`}),(0,H.jsx)(`div`,{className:`excalidraw-eye-dropper-container`}),(0,H.jsx)(oR,{trails:[this.laserTrails,this.lassoTrail,this.eraserTrail]}),e.length===1&&this.state.openDialog?.name!==`elementLinkSelector`&&this.state.showHyperlinkPopup&&(0,H.jsx)(RE,{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&&$t(l)&&(0,H.jsx)(Bj,{element:l,elementsMap:a,children:(0,H.jsx)(aR,{title:G(`labels.convertToCode`),icon:oS,checked:!1,onChange:()=>this.onMagicFrameGenerate(l,`button`)})}),e.length===1&&he(l)&&l.customData?.generationData?.status===`done`&&(0,H.jsxs)(Bj,{element:l,elementsMap:a,children:[(0,H.jsx)(aR,{title:G(`labels.copySource`),icon:qx,checked:!1,onChange:()=>this.onIframeSrcCopy(l)}),(0,H.jsx)(aR,{title:`Enter fullscreen`,icon:sS,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,H.jsx)(ON,{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,H.jsx)(KR,{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:vj(this),canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:this.flowChartCreator.pendingNodes,theme:this.state.theme}}),this.state.newElement&&(0,H.jsx)(XR,{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,H.jsx)(UR,{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,onClick:this.handleCanvasClick,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,H.jsx)(kN,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames(),this.state.activeLockedId&&(0,H.jsx)(QR,{app:this,activeLockedId:this.state.activeLockedId}),u&&(0,H.jsx)(TD,{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=kt(this.scene.getNonDeletedElements(),e,this.scene.getNonDeletedElementsMap()).filter(e=>!$t(e));if(!r.length){t===`button`?(this.setState({errorMessage:`Cannot generate from an empty frame`}),aC(`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}}),aC(`ai`,`generate (start)`,`d2c`);try{let{html:t}=await n({frame:e,children:r});if(aC(`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){aC(`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`&&(DT(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=>{Xs(e)&&t[e.fileId]&&(this.imageCache.delete(e.fileId),Yo.delete(e))})}async componentDidMount(){this.unmounted=!1,this.api=this.createExcalidrawAPI(),this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,(Ro()||it())&&(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(),Fr&&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),_e()&&!Za()&&this.setState({errorMessage:(0,H.jsx)(TN,{})});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 Kt,this.fonts=new fe(this.scene),this.renderer=new Lj(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(),Yo.destroy(),_j.destroy(),clearTimeout(Dz),Ge.clearCache(),jr.clearCache(),Dz=0,document.documentElement.style.overscrollBehaviorX=``}removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(Xt(document,j.KEYDOWN,this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(Xt(this.excalidrawContainerRef.current,j.WHEEL,this.handleWheel,{passive:!1}),Xt(window,j.MESSAGE,this.onWindowMessage,!1),Xt(document,j.POINTER_UP,this.removePointer,{passive:!1}),Xt(document,j.COPY,this.onCopy,{passive:!1}),Xt(document,j.KEYUP,this.onKeyUp,{passive:!0}),Xt(document,j.POINTER_MOVE,this.updateCurrentCursorPosition,{passive:!1}),Xt(document.fonts,`loadingdone`,e=>{let t=e.fontfaces;this.fonts.onLoaded(t)},{passive:!1}),Xt(document,j.GESTURE_START,this.onGestureStart,!1),Xt(document,j.GESTURE_CHANGE,this.onGestureChange,!1),Xt(document,j.GESTURE_END,this.onGestureEnd,!1),Xt(window,j.FOCUS,()=>{this.maybeCleanupAfterMissingPointerUp(null),this.triggerRender(!0)},{passive:!1})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(Xt(document,j.FULLSCREENCHANGE,this.onFullscreenChange,{passive:!1}),Xt(document,j.PASTE,this.pasteFromClipboard,{passive:!1}),Xt(document,j.CUT,this.onCut,{passive:!1}),Xt(window,j.RESIZE,this.onResize,!1),Xt(window,j.UNLOAD,this.onUnload,!1),Xt(window,j.BLUR,this.onBlur,!1),Xt(this.excalidrawContainerRef.current,j.WHEEL,this.handleWheel,{passive:!1}),Xt(this.excalidrawContainerRef.current,j.DRAG_OVER,this.disableEvent,!1),Xt(this.excalidrawContainerRef.current,j.DROP,this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(Xt(Ke(this.excalidrawContainerRef.current),j.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&&Wr(this.state)&&this.setState({activeTool:Vt(this.state,{type:`selection`})}),this.state.activeTool.type===`eraser`&&t.theme!==this.state.theme&&Uw(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(),Wr(t)&&!Wr(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(tT)}),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(){bz=!1,Sz=null}async insertClipboardContent(e,t,r){let{x:i,y:a}=Xo({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=SN(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(aa(t))}if(o.length>0){this.isToolSupported(`image`)?await this.insertImages(o,i,a):this.setState({errorMessage:G(`errors.imageToolNotSupported`)});return}if(e.elements){let t=e.programmaticAPI?na(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&&uM(e.text)){let t=await n(()=>import(`./excalidraw-mermaid-stub-Df0Q2qkW.js`),__vite__mapDeps([70,71]),import.meta.url);try{let{elements:n,files:r={}}=await t.parseMermaidToExcalidraw(e.text),i=na(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=Yr(e.text).split(/\n+/).map(e=>e.trim()).filter(Boolean),c=s.map(e=>qt(e)).filter(e=>h(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||Ao(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:Vn(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 eo(e)}}catch(e){let t=e.message;return e.cause===`FETCH_ERROR`?t=G(`errors.failedToFetchImage`):e.cause===`UNSUPPORTED`&&(t=G(`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(`
174
-
175
- `),t)}}addTextFromPaste(e,t=!1){let{x:n,y:r}=Xo({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:Ms,verticalAlign:`top`,locked:!1},a=ao({fontSize:i.fontSize,fontFamily:i.fontFamily}),o=hn(i.fontFamily),[s,,c]=Ho(this.state),l=Math.max(Math.min((c-s)*.5,800),200),u=r,d=t?[e]:e.split(`
176
- `),f=d.reduce((e,t,r)=>{let s=Ea(t).trim();if(s.length){let t=this.getTopLayerFrameAtSceneCoords({x:n,y:u}),r=zi(s,a,o),c=r.width>l,d=c?Sa(s,a,l):s;r=c?zi(d,a,o):r;let f=n-r.width/2,p=u-r.height/2,m=qe({...i,x:f,y:p,text:d,originalText:s,lineHeight:o,autoResize:!c,frameId:t?t.id:null});e.push(m),u+=m.height+10}else d[r-1]?.trim()&&(u+=gn(i.fontSize,o)+10);return e},[]);f.length!==0&&(this.scene.insertElements(f),this.store.scheduleCapture(),this.setState({selectedElementIds:us(Object.fromEntries(f.map(e=>[e.id,!0])),this.state)}),!t&&f.length>1&&Mz===!1&&this.editorInterface.formFactor!==`phone`&&(this.setToast({message:G(`toast.pasteAsSingleElement`,{shortcut:Z(`CtrlOrCmd+Shift+V`)}),duration:5e3}),Mz=!0))}handleTextWysiwyg(e,{isExistingElement:t=!1,initialCaretSceneCoords:n=null}){let r=this.scene.getElementsMapIncludingDeleted(),i=(t,n)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(i=>i.id===e.id&&M(i)?P(i,{originalText:t,isDeleted:n??i.isDeleted,...zr(i,Xa(i,r),r,t)}):i)])};iM({id:e.id,canvas:this.canvas,getViewportCoords:(e,t)=>{let{x:n,y:r}=Qa({sceneX:e,sceneY:t},this.state);return[n-this.state.offsetLeft,r-this.state.offsetTop]},onChange:Uj(t=>{i(t,!1),vi(e)&&be(e,this.scene)}),onSubmit:Uj(({viaKeyboard:n,nextOriginalText:r})=>{let a=!r.trim();i(r,a);let o=n?e.containerId||(a?null:e.id):null;o&&(0,lc.flushSync)(()=>{this.setState(e=>({selectedElementIds:us({...e.selectedElementIds,[o]:!0},e)}))}),a&&Se(this.scene.getNonDeletedElements(),[e]),(!a||t)&&this.store.scheduleCapture(),(0,lc.flushSync)(()=>{this.setState({newElement:null,editingTextElement:null})}),this.state.activeTool.locked&&Ww(this.interactiveCanvas,this.state),this.focusContainer()}),element:e,excalidrawContainer:this.excalidrawContainerRef.current,app:this,initialCaretSceneCoords:n,autoSelect:!this.editorInterface.isTouchScreen}),this.deselectElements(),i(e.originalText,!1)}deselectElements(){this.setState({selectedElementIds:us({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getSelectedTextElement(e){let t=this.scene.getSelectedElements(this.state);if(t.length!==1)return null;let n=t[0];return M(n)?n:e?bn(n,this.scene.getNonDeletedElementsMap()):null}getSelectedTextEditingContainerAtPosition(e,t){let n=this.scene.getSelectedElements(this.state);if(n.length!==1||!e||e.id!==n[0].id)return null;let r=n[0];if(M(r))return null;if(!ro(r))return;let i=this.getSelectedTextElement(r),a=this.getTextElementAtPosition(t.x,t.y);if(!(!i||a?.id!==i.id))return r}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 Yt({point:N(e,t),element:i,threshold:this.getElementHitThreshold(i)/2,elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:I(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=To(n,i);return r&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?_s({x:e,y:t},r,i):!0}).filter(e=>he(e)?(r.push(e),!1):!0).concat(r)}getElementHitThreshold(e){return Math.max(e.strokeWidth/2+.1,.85*(Et/this.state.zoom.value))}hitElement(e,t,n,r=!0){return r&&this.state.selectedElementIds[n.id]&&Fs([n],this.state,this.editorInterface)&&Ot(N(e,t),n,this.scene.getNonDeletedElementsMap(),this.getElementHitThreshold(n))||Ya(N(e,t),n,this.scene.getNonDeletedElementsMap())?!0:Yt({point:N(e,t),element:n,threshold:this.getElementHitThreshold(n),elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:I(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 O(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]=si(n[r],this.scene.getNonDeletedElementsMap());if(nt(n[r])&&Yt({point:N(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 O(i,!1)?i:null}handleHoverSelectedLinearElement(e,t,n){let r=this.scene.getNonDeletedElementsMap(),i=B.getElement(e.elementId,r);if(i)if(this.state.selectedLinearElement){let a=-1,o=null;Yt({point:N(t,n),element:i,elementsMap:r,threshold:this.getElementHitThreshold(i)})?(a=B.getPointIndexUnderCursor(i,r,this.state.zoom,t,n),o=B.getSegmentMidpointHitCoords(e,{x:t,y:n},this.state,this.scene.getNonDeletedElementsMap()),(Tr(i)?a===0||a===i.points.length-1:a>=0)||o?Bw(this.interactiveCanvas,on.POINTER):this.hitElement(t,n,i)&&(!Tr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Bw(this.interactiveCanvas,on.MOVE)):this.hitElement(t,n,i)&&(!Tr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Bw(this.interactiveCanvas,on.MOVE),this.state.selectedLinearElement.hoverPointIndex!==a&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:a}}),B.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,o)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:o}});let s=null,c=i;(c.startBinding||c.endBinding)&&(s=pe(i,t,n,this.scene,this.state)),this.state.selectedLinearElement.hoveredFocusPointBinding!==s&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1,hoveredFocusPointBinding:s}}),s&&Bw(this.interactiveCanvas,on.POINTER)}else Bw(this.interactiveCanvas,on.AUTO)}updateGestureOnPointerDown(e){Pz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),Pz.pointers.size===2&&(Pz.lastCenter=uj(Pz.pointers),Pz.initialScale=this.state.zoom.value,Pz.initialDistance=dj(Array.from(Pz.pointers.values())))}initialPointerDownState(e){let t=Xo(e,this.state),n=this.scene.getSelectedElements(this.state),[r,i,a,o]=Rn(n),s=n.findIndex(Tr)===0;return{origin:t,withCmdOrCtrl:e[L.CTRL_OR_CMD],originInGrid:Cn(Fe(t.x,t.y,e[L.CTRL_OR_CMD]||s?null:this.getEffectiveGridSize())),scrollbars:lM(Ez,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop),lastCoords:{...t},originalElements:this.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,w(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;Tz=!0,t.lastCoords.x=e.clientX,t.lastCoords.y=e.clientY;let n=Wj(e=>{e.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(e,t)}),r=Uj(()=>{Nz=null,Tz=!1,Ww(this.interactiveCanvas,this.state),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(j.POINTER_MOVE,n),window.removeEventListener(j.POINTER_UP,r),n.flush()});return Nz=r,window.addEventListener(j.POINTER_MOVE,n),window.addEventListener(j.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(Et/this.state.zoom.value,1),r=4/this.state.zoom.value,[i,a,o,s]=Rn(t);return e.x>i-r-n&&e.x<o+r+n&&e.y>a-r-n&&e.y<s+r+n}getCurrentItemRoundness(e){return this.state.currentItemRoundness===`round`?{type:Bn(e)?fo.ADAPTIVE_RADIUS:fo.PROPORTIONAL_RADIUS}:null}maybeCacheReferenceSnapPoints(e,t,n=!1){yj({event:e,app:this,selectedElements:t})&&(n||!_j.getReferenceSnapPoints())&&_j.setReferenceSnapPoints(Tj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(e,t,n=!1){yj({event:e,app:this,selectedElements:t})&&(n||!_j.getVisibleGaps())&&_j.setVisibleGaps(Cj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(e){return Uj(t=>{this.maybeHandleResize(e,t)||this.maybeDragNewGenericElement(e,t)})}onKeyUpFromPointerDownHandler(e){return Uj(t=>{t.key===L.ALT&&t.preventDefault(),!this.maybeHandleResize(e,t)&&this.maybeDragNewGenericElement(e,t)})}onPointerMoveFromPointerDownHandler(e){return Wj(t=>{if(this.state.openDialog?.name===`elementLinkSelector`)return;let n=Xo(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]=Fe(n.x,n.y,t[L.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.state.selectedLinearElement.initialState.segmentMidpoint.index;if(i<0){let t=B.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:e,y:r},this.state,this.scene.getNonDeletedElementsMap());i=t?B.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,t,this.scene.getNonDeletedElementsMap()):-1}let a=B.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=Cn(Fn(this.scene.getSelectedElements(this.state),e.origin.x,e.origin.y))),!(t.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(t,e))return;if(Wr(this.state)){this.handleEraser(t,n);return}this.state.activeTool.type===`laser`&&this.laserTrails.addPointToPath(n.x,n.y);let[i,a]=Fe(n.x,n.y,t[L.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){Ua(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(B.shouldAddMidpoint(this.state.selectedLinearElement,n,this.state,o)){let e=B.addMidpoint(this.state.selectedLinearElement,n,this,!t[L.CTRL_OR_CMD],this.scene);if(!e)return;(0,lc.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=B.getElement(r.elementId,o);if(i?.isDeleted)return;if(Xi(i)){let e=ue(N(n.x,n.y),this.scene.getNonDeletedElements(),o);$e(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(i,e)}if(t.altKey&&!this.state.selectedLinearElement?.initialState?.arrowStartIsInside&&$e(`COMPLEX_BINDINGS`)&&this.handleSkipBindMode(),r.initialState.lastClickedPoint===-1)return;let a=B.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||!Uo(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=>I(e)),s=this.getTopLayerFrameAtSceneCoords(n),c=s&&!a?s:null;if(this.state.frameToHighlight!==c&&(0,lc.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&&Pa(t)&&t.crop!==null&&e.hit.element===t){let e=t.crop,i=Xs(t)&&this.imageCache.get(t.fileId)?.image;if(i&&!(i instanceof Promise)){let a=Or(t),s=Ve(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]=si(t,o),m=Dt(z(N(c,l),N(f,p),t.angle)),h=Dt(z(N(u,l),N(f,p),t.angle)),g=Dt(z(N(c,d),N(f,p),t.angle)),_=Ca(Gt(h,m)),v=Ca(Gt(g,m)),y=Ve(me(s,_),me(s,v)),b={...e,x:Ce(e.x-y[0]*Math.sign(t.scale[0]),0,i.naturalWidth-e.width),y:Ce(e.y-y[1]*Math.sign(t.scale[1]),0,i.naturalHeight-e.height)};this.scene.mutateElement(t,{crop:b});return}}}this.maybeCacheVisibleGaps(t,i),this.maybeCacheReferenceSnapPoints(t,i);let{snapOffset:l,snapLines:u}=Dj(s,a,this,t,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:u}),this.state.editingFrame||ve(e,i,a,this.scene,l,t[L.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}=li({type:`in-place`,elements:n,appState:this.state,randomizeSeed:!0,idsOfElementsToDuplicate:a,overrides:({duplicateElement:e,origElement:t})=>({frameId:e.frameId??t.frameId,seed:Ee()})});o.forEach(t=>{e.originalElements.set(t.id,w(t))});let u=c.map(t=>{if(a.has(t.id)){let n=e.originalElements.get(t.id);if(n)return P(t,{x:n.x,y:n.y})}return t}),d=this.props.onDuplicate?.(u,n),f=xr(d||u,ko(o));(0,lc.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=Xo(t,this.state),this.setState(e=>({...ei(o,this.scene.getNonDeletedElements(),e)})),this.scene.replaceAllElements(f),i.forEach(e=>{fr(e)&&e.boundElements?.some(e=>e.type===`arrow`)&&be(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,N(i,a)],pressures:n},{informMutation:!1,isDragging:!1}),this.setState({newElement:r})}}else if(Bo(r)&&!r.isDeleted){e.drag.hasOccurred=!0;let n=r.points;Ar(n.length>1,`Do not create linear elements with less than 2 points`);let o=this.state.selectedLinearElement;o||=(o=new B(r,this.scene.getNonDeletedElementsMap()),{...o,selectedPointsIndices:[1],initialState:{...o.initialState,lastClickedPoint:1}}),this.setState({newElement:r,...B.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)B.handleBoxSelection(t,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let r=!0;!t.shiftKey&&Ge(n,this.state)&&(e.withCmdOrCtrl&&e.hit.element?this.setState(t=>jr({...t,selectedElementIds:{[e.hit.element.id]:!0}},this.scene.getNonDeletedElements(),t,this)):r=!1);let i=this.state.selectionElement?He(n,this.state.selectionElement,this.scene.getNonDeletedElementsMap(),!1,this.state.boxSelectionMode):[];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},{...jr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.scene.getNonDeletedElements(),t,this),selectedLinearElement:i.length===1&&Bo(i[0])?new B(i[0],this.scene.getNonDeletedElementsMap()):null,showHyperlinkPopup:i.length===1&&(i[0].link||qs(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*(Ez.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*(Ez.vertical?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.y=n,!0}return!1}onPointerUpFromPointerDownHandler(e){return Uj(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:u}=this.state;this.setState(e=>({isResizing:!1,isRotating:!1,isCropping:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:`up`,snapLines:hr(e.snapLines,[]),originSnapOffset:null})),this.lassoTrail.endPath(),this.previousPointerMoveCoords=null,_j.setReferenceSnapPoints(null),_j.setVisibleGaps(null),this.savePointer(t.clientX,t.clientY,`up`);let d=e.hit.allHitElements,f=Xo({clientX:t.clientX,clientY:t.clientY},this.state);if(this.state.activeTool.type===`selection`&&!e.boxSelection.hasOccurred&&!e.resize.isResizing&&!d.some(e=>this.state.selectedElementIds[e.id])){let e=this.getElementAtPosition(f.x,f.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($e(`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);fr(t)&&t.boundElements?.filter(e=>e.type===`arrow`).map(e=>n.get(e.id)).filter(e=>Tr(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(tT);else{let e=B.handlePointerUp(t,this.state.selectedLinearElement,this.state,this.scene);this.actionManager.executeAction(tT,`ui`,{event:t,sceneCoords:f}),e!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:e,suggestedBinding:null})}else if(this.state.selectedLinearElement){if(this.state.selectedLinearElement.elbowed){let e=B.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());e&&this.scene.mutateElement(e,{})}if(this.state.selectedLinearElement.draggedFocusPointBinding?(xs(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(tT,`ui`,{event:t,sceneCoords:f})):this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null}),this.state.newElement&&this.state.multiElement&&Bo(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(j.POINTER_MOVE,e.eventListeners.onMove),window.removeEventListener(j.POINTER_UP,e.eventListeners.onUp),window.removeEventListener(j.KEYDOWN,e.eventListeners.onKeyDown),window.removeEventListener(j.KEYUP,e.eventListeners.onKeyUp),this.props?.onPointerUp?.(s,e),this.onPointerUpEmitter.trigger(this.state.activeTool,e,t),r?.type===`freedraw`){let e=Xo(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,N(i,a)],pressures:o}),this.actionManager.executeAction(tT);return}if(Bo(r)){r.points.length>1&&r.points[1][0]!==0&&r.points[1][1]!==0&&this.store.scheduleCapture();let n=Xo(t,this.state),i=ja(N(n.x,n.y),N(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:[N(0,0),N(e,0)]},{informMutation:!1,isDragging:!1}),this.actionManager.executeAction(tT)}else{let e=n.x-r.x,t=n.y-r.y;this.scene.mutateElement(r,{points:[r.points[0],N(e,t)]},{informMutation:!1,isDragging:!1}),this.setState({multiElement:r,newElement:r})}else e.drag.hasOccurred&&!o&&(Bo(r)&&this.actionManager.executeAction(tT,`ui`,{event:t,sceneCoords:f}),this.setState({suggestedBinding:null,startBoundElement:null}),s.locked?this.setState(e=>({newElement:null})):(zw(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:Vt(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:us({...e.selectedElementIds,[r.id]:!0},e),selectedLinearElement:new B(r,this.scene.getNonDeletedElementsMap())}))),this.scene.triggerUpdate());return}if(M(r)){let e=Ba(ao({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&&Aa(r)){this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==r.id),appState:{newElement:null},captureUpdate:F.NEVER});return}if(I(r)){let e=xi(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(oa(this.scene.getElementsMapIncludingDeleted(),e,r,this.state))}if(r&&(this.scene.mutateElement(r,Ta(r),{informMutation:!1,isDragging:!1}),this.scene.triggerUpdate()),e.drag.hasOccurred){let e=Xo(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=To(e,n);t&&e&&(Zt(e,t,this.scene.getNonDeletedElementsMap())||(this.scene.mutateElement(e,{groupIds:[]}),Oa([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&&mr(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&&ni(e,r,this.state));this.state.editingGroupId&&i(e),r=oa(r,e,t,this.state)}else !t&&this.state.editingGroupId&&i(n.filter(e=>e.frameId&&!ni(e,r,this.state)));r=Rs(r,this.state,this),this.scene.replaceAllElements(r)}}if(i&&this.store.scheduleCapture(),i&&Aa(i)&&this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==i.id),captureUpdate:F.NEVER}),e.resize.isResizing){let e=Rs(this.scene.getElementsIncludingDeleted(),this.state,this),t=this.scene.getSelectedElements(this.state).filter(e=>I(e));for(let r of t)e=re(e,fa(this.scene.getElementsIncludingDeleted(),r,this.state,n),r,this);this.scene.replaceAllElements(e)}let p=e.hit.element;this.state.selectedLinearElement?.elementId!==p?.id&&Bo(p)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new B(p,this.scene.getNonDeletedElementsMap())}),(!a||a&&(!p&&!u||p&&p.id!==a))&&this.finishImageCropping();let m=this.lastPointerDownEvent,h=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(Wr(this.state)&&m&&h){if(this.eraserTrail.endPath(),ja(N(m.clientX,m.clientY),N(h.clientX,h.clientY))===0){let e=Xo({clientX:h.clientX,clientY:h.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(p&&!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[p.id]?De(this.state,p)?this.setState(e=>{let t={...e.selectedElementIds};for(let e of p.groupIds.flatMap(e=>mr(this.scene.getNonDeletedElements(),e)))delete t[e.id];return{selectedGroupIds:{...e.selectedElementIds,...p.groupIds.map(e=>({[e]:!1})).reduce((e,t)=>({...e,...t}),{})},selectedElementIds:us(t,e)}}):this.state.selectedLinearElement?.isDragging||this.setState(e=>{let t={...e.selectedElementIds};delete t[p.id];let n=A(this.scene.getNonDeletedElements(),{selectedElementIds:t});return{...jr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:n.length===1&&Bo(n[0])?new B(n[0],this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}}):p.frameId&&this.state.selectedElementIds[p.frameId]?this.setState(e=>{let t={...e.selectedElementIds,[p.id]:!0};return delete t[p.frameId],(this.scene.getElement(p.frameId)?.groupIds??[]).flatMap(e=>mr(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}),{...jr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:p.link||qs(p)?`info`:!1}}):this.setState(e=>({selectedElementIds:us({...e.selectedElementIds,[p.id]:!0},e)})):this.setState(e=>({...jr({editingGroupId:e.editingGroupId,selectedElementIds:{[p.id]:!0}},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:Bo(p)&&e.selectedLinearElement?.elementId!==p.id?new B(p,this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}))),this.state.activeTool.type!==`lasso`&&!(p&&Tr(p))&&!e.drag.hasOccurred&&!this.state.isResizing&&(p&&Ks({point:N(e.origin.x,e.origin.y),element:p,elementsMap:n,threshold:this.getElementHitThreshold(p),frameNameBound:I(p)?this.frameNameBoundsCache.get(p):null},n)||!p&&e.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.selectedLinearElement?.isEditing?this.actionManager.executeAction(KA):this.setState({selectedElementIds:us({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),Bw(this.interactiveCanvas,on.AUTO);return}let g=this.getSelectedTextEditingContainerAtPosition(p,f);if(s.type===this.state.preferredSelectionTool.type&&!this.state.editingTextElement&&!e.drag.hasOccurred&&!e.hit.wasAddedToSelection&&!t.shiftKey&&!t[L.CTRL_OR_CMD]&&!t.altKey&&t.pointerType!==`touch`&&p&&(M(p)&&this.state.selectedElementIds[p.id]&&this.scene.getSelectedElements(this.state).length===1||g)){this.startTextEditing({sceneX:f.x,sceneY:f.y,container:g,initialCaretSceneCoords:this.lastPointerUpIsDoubleClick?void 0:f});return}if(!s.locked&&s.type!==`freedraw`&&r&&this.setState(e=>({selectedElementIds:us({...e.selectedElementIds,[r.id]:!0},e),showHyperlinkPopup:qs(r)&&!r.link?`editor`:e.showHyperlinkPopup})),(s.type!==`selection`||Ge(this.scene.getNonDeletedElements(),this.state)||!Uo(this.state.previousSelectedElementIds,this.state.selectedElementIds))&&this.store.scheduleCapture(),(e.drag.hasOccurred&&!this.state.selectedLinearElement||c||l||u)&&Ws(this.scene.getSelectedElements(this.state).filter(nt),this.scene,this.state),s.type===`laser`){this.laserTrails.endPath();return}!s.locked&&s.type!==`freedraw`&&(s.type!==`lasso`||s.type===`lasso`&&s.fromSelection)?(zw(this.interactiveCanvas),this.setState({newElement:null,suggestedBinding:null,activeTool:Vt(this.state,{type:this.state.preferredSelectionTool.type})})):this.setState({newElement:null,suggestedBinding:null})})}clearSelection(e){this.setState(t=>({selectedElementIds:us({},t),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:t.editingGroupId&&e!=null&&Pr(e,t.editingGroupId)?t.editingGroupId:null})),this.setState({selectedElementIds:us({},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=No(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}=Qa({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 Ty(xy.find(e=>e.code===this.props.langCode)||by),this.setAppState({})}};(Ro()||it())&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(Ln(e))}},scene:{configurable:!0,get(){return this.app?.scene}}}));var Iz=Fz,Lz=e=>{let[t,n]=(0,V.useState)(!0);return(0,V.useEffect)(()=>{let t=async()=>{await Ty(r),n(!1)},r=xy.find(t=>t.code===e.langCode)||by;t()},[e.langCode]),t?(0,H.jsx)(AN,{theme:e.theme}):e.children},Rz=({children:e})=>{let{FooterCenterTunnel:t}=fk(),n=uC();return(0,H.jsx)(t.In,{children:(0,H.jsx)(`div`,{className:U(`footer-center zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})};Rz.displayName=`FooterCenter`;var zz=({isCollaborating:e,onSelect:t,editorInterface:n,...r})=>{let i=uC(),a=n?.formFactor!==`desktop`||i.width<1440;return(0,H.jsxs)(JO,{...r,className:U(`collab-button`,{active:e}),type:`button`,onSelect:t,style:{position:`relative`,width:a?void 0:`auto`},title:G(`labels.liveCollaboration`),children:[a?Nb:G(`labels.share`),i.collaborators.size>0&&(0,H.jsx)(`div`,{className:`CollabButton-collaborators`,children:i.collaborators.size})]})};zz.displayName=`LiveCollaborationTrigger`;var Bz=()=>(0,H.jsx)(`svg`,{viewBox:`0 0 40 40`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`ExcalidrawLogo-icon`,children:(0,H.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`})}),Vz=()=>(0,H.jsxs)(`svg`,{viewBox:`0 0 450 55`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,className:`ExcalidrawLogo-text`,children:[(0,H.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,H.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,H.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,H.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)`})]}),Hz=({style:e,size:t=`small`,withText:n})=>(0,H.jsxs)(`div`,{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,H.jsx)(Bz,{}),n&&(0,H.jsx)(Vz,{})]}),Uz=({icon:e,shortcut:t,children:n})=>{let r=pz();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`welcome-screen-menu-item__icon`,children:e}),(0,H.jsx)(`div`,{className:`welcome-screen-menu-item__text`,children:n}),t&&r.formFactor!==`phone`&&(0,H.jsx)(`div`,{className:`welcome-screen-menu-item__shortcut`,children:t})]})};Uz.displayName=`WelcomeScreenMenuItemContent`;var Wz=({onSelect:e,children:t,icon:n,shortcut:r,className:i=``,...a})=>(0,H.jsx)(`button`,{...a,type:`button`,className:`welcome-screen-menu-item ${i}`,onClick:e,children:(0,H.jsx)(Uz,{icon:n,shortcut:r,children:t})});Wz.displayName=`WelcomeScreenMenuItem`;var Gz=({children:e,href:t,icon:n,shortcut:r,className:i=``,...a})=>(0,H.jsx)(`a`,{...a,className:`welcome-screen-menu-item ${i}`,href:t,target:`_blank`,rel:`noopener`,children:(0,H.jsx)(Uz,{icon:n,shortcut:r,children:e})});Gz.displayName=`WelcomeScreenMenuItemLink`;var Kz=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=fk();return(0,H.jsx)(t.In,{children:(0,H.jsx)(`div`,{className:`welcome-screen-center`,children:e||(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(qz,{}),(0,H.jsx)(Jz,{children:G(`welcomeScreen.defaults.center_heading`)}),(0,H.jsxs)(Yz,{children:[(0,H.jsx)(Zz,{}),(0,H.jsx)(Xz,{})]})]})})})};Kz.displayName=`Center`;var qz=({children:e})=>(0,H.jsx)(`div`,{className:`welcome-screen-center__logo excalifont welcome-screen-decor`,children:e||(0,H.jsx)(Hz,{withText:!0})});qz.displayName=`Logo`;var Jz=({children:e})=>(0,H.jsx)(`div`,{className:`welcome-screen-center__heading welcome-screen-decor excalifont`,children:e});Jz.displayName=`Heading`;var Yz=({children:e})=>(0,H.jsx)(`div`,{className:`welcome-screen-menu`,children:e});Yz.displayName=`Menu`;var Xz=()=>{let e=yz();return(0,H.jsx)(Wz,{onSelect:()=>e.executeAction(JT),shortcut:`?`,icon:mb,children:G(`helpDialog.title`)})};Xz.displayName=`MenuItemHelp`;var Zz=()=>{let e=uC(),t=yz();return e.viewModeEnabled?null:(0,H.jsx)(Wz,{onSelect:()=>t.executeAction(UT),shortcut:AD(`loadScene`),icon:wb,children:G(`buttons.load`)})};Zz.displayName=`MenuItemLoadScene`;var Qz=({onSelect:e})=>{let{t}=ky();return(0,H.jsx)(Wz,{shortcut:null,onSelect:e,icon:Jb,children:t(`labels.liveCollaboration`)})};Qz.displayName=`MenuItemLiveCollaborationTrigger`,Kz.Logo=qz,Kz.Heading=Jz,Kz.Menu=Yz,Kz.MenuItem=Wz,Kz.MenuItemLink=Gz,Kz.MenuItemHelp=Xz,Kz.MenuItemLoadScene=Zz,Kz.MenuItemLiveCollaborationTrigger=Qz;var $z=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=fk();return(0,H.jsx)(t.In,{children:(0,H.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu`,children:[Hy,(0,H.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||G(`welcomeScreen.defaults.menuHint`)})]})})};$z.displayName=`MenuHint`;var eB=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=fk();return(0,H.jsx)(t.In,{children:(0,H.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar`,children:[(0,H.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||G(`welcomeScreen.defaults.toolbarHint`)}),Wy]})})};eB.displayName=`ToolbarHint`;var tB=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=fk();return(0,H.jsx)(t.In,{children:(0,H.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help`,children:[(0,H.jsx)(`div`,{children:e||G(`welcomeScreen.defaults.helpHint`)}),Uy]})})};tB.displayName=`HelpHint`;var nB=e=>(0,H.jsx)(H.Fragment,{children:e.children||(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Kz,{}),(0,H.jsx)($z,{}),(0,H.jsx)(eB,{}),(0,H.jsx)(tB,{})]})});nB.displayName=`WelcomeScreen`,nB.Center=Kz,nB.Hints={MenuHint:$z,ToolbarHint:eB,HelpHint:tB};var rB=()=>{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)})},iB=(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)),aB=(0,dc.default)((e,t,n)=>{(it()||Ro()||window?.DEBUG_FRACTIONAL_INDICES)&&sn(Ln(e.map(e=>({...e}))),{shouldThrow:Ro()||it(),includeBoundTextValidation:!0,reconciliationContext:{localElements:t,remoteElements:n}})},1e3*60,{leading:!0,trailing:!1}),oB=(e,t,n)=>{let r=ko(e),i=[],a=new Set;for(let e of t)if(!a.has(e.id)){let t=r.get(e.id),o=iB(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=to(i);return aB(o,e,t),Ln(o),o},sB=({children:e,icon:t})=>{let{t:n}=ky(),{TTDDialogTriggerTunnel:r}=fk(),i=vz();return(0,H.jsx)(r.In,{children:(0,H.jsx)(Q.Item,{onSelect:()=>{aC(`ai`,`dialog open`,`ttd`),i({openDialog:{name:`ttd`,tab:`text-to-diagram`}})},icon:t??uS,badge:(0,H.jsx)(Q.Item.Badge,{children:`AI`}),children:e??n(`labels.textToDiagram`)})})};sB.displayName=`TTDDialogTrigger`,rB();var cB=V.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=by.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:ee,onPointerUp:te,onScrollChange:ne,onDuplicate:re,children:ie,validateEmbeddable:ae,renderEmbeddable:oe,aiEnabled:se,showDeprecatedFonts:ce,renderScrollbars:le}=e,ue=e.UIOptions?.canvasActions,de={...e.UIOptions,canvasActions:{...je.canvasActions,...ue},tools:{image:e.UIOptions?.tools?.image??!0}};ue?.export&&(de.canvasActions.export.saveFileToDisk=ue.export?.saveFileToDisk??je.canvasActions.export.saveFileToDisk),de.canvasActions.toggleTheme===null&&typeof y>`u`&&(de.canvasActions.toggleTheme=!0);let fe=(0,V.useContext)(uz),pe=(0,V.useRef)(o);pe.current=o;let me=(0,V.useCallback)(e=>{fe?.(e),pe.current?.(e)},[fe]);return(0,V.useEffect)(()=>{(async()=>{await n(()=>import(`./roundRect-BzEouiv_.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,H.jsx)(gy,{store:_y,children:(0,H.jsx)(Lz,{langCode:m,theme:y,children:(0,H.jsx)(Iz,{onExport:t,onChange:r,onIncrement:i,initialData:a,onExcalidrawAPI:me,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:de,onPaste:S,detectScroll:C,handleKeyboardGlobally:w,onLibraryChange:T,autoFocus:E,generateIdForFile:D,onLinkOpen:O,generateLinkForSelection:k,onPointerDown:ee,onPointerUp:te,onScrollChange:ne,onDuplicate:re,validateEmbeddable:ae,renderEmbeddable:oe,aiEnabled:se!==!1,showDeprecatedFonts:ce,renderScrollbars:le,children:ie})})})},(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])&&Uo(i,s):!1});cB.displayName=`Excalidraw`;function lB(e){let t=String(e||``).trim().replace(/\s+/g,` `);return t?t.slice(0,24):null}function uB(){return{type:`excalidraw`,version:2,source:`collabmd`,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function dB(e){return!e||typeof e!=`object`?uB():{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 fB(e){return pB(e)||uB()}function pB(e){if(!e)return null;try{return dB(JSON.parse(e))}catch{return null}}function mB(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 hB(e,t,n){return dB({elements:Array.isArray(e)?e:[],appState:{gridSize:t?.gridSize??null,viewBackgroundColor:t?.viewBackgroundColor??`#ffffff`},files:n||{}})}export{fB as a,oB as c,cc as d,lB as i,LD as l,uB as n,mB as o,dB as r,pB as s,hB as t,cB as u};