@dwelle/excalidraw 0.5.0-ca754ef → 0.5.0-cbb5d6b

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 (324) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/dist/browser/dev/excalidraw-assets-dev/{blockDiagram-91b80b7a-QSJ4HNO7.js → blockDiagram-91b80b7a-IRJTK6Z5.js} +6 -6
  3. package/dist/browser/dev/excalidraw-assets-dev/{c4Diagram-b2a90758-4MYCZKG5.js → c4Diagram-b2a90758-CCPPXFPY.js} +4 -4
  4. package/dist/browser/dev/excalidraw-assets-dev/{chunk-BECDVD6R.js → chunk-32FQKC5U.js} +7 -7
  5. package/dist/browser/dev/excalidraw-assets-dev/{chunk-POWCA5QF.js → chunk-4RQWU7MH.js} +3 -3
  6. package/dist/browser/dev/excalidraw-assets-dev/{chunk-Q7SIL7GF.js → chunk-4XTDAI34.js} +3 -3
  7. package/dist/browser/dev/excalidraw-assets-dev/{chunk-U6PMUKRO.js → chunk-645MDRFH.js} +6570 -4548
  8. package/dist/browser/dev/excalidraw-assets-dev/chunk-645MDRFH.js.map +7 -0
  9. package/dist/browser/dev/excalidraw-assets-dev/{chunk-J5HRUYQR.js → chunk-AKQDHN2W.js} +2 -2
  10. package/dist/browser/dev/excalidraw-assets-dev/chunk-AKQDHN2W.js.map +7 -0
  11. package/dist/browser/dev/excalidraw-assets-dev/{chunk-FR3IAB6U.js → chunk-CH3VL6LE.js} +3 -3
  12. package/dist/browser/dev/excalidraw-assets-dev/{chunk-EPAK72CK.js → chunk-DAUKRODV.js} +3 -3
  13. package/dist/browser/dev/excalidraw-assets-dev/{chunk-U4Z6B5JW.js → chunk-GHBR42PD.js} +4 -4
  14. package/dist/browser/dev/excalidraw-assets-dev/{chunk-FRL7WYV2.js → chunk-I6APBPLG.js} +3 -3
  15. package/dist/browser/dev/excalidraw-assets-dev/{chunk-J4UG2B64.js → chunk-JT5FK676.js} +2 -2
  16. package/dist/browser/dev/excalidraw-assets-dev/{chunk-QZ4FGBZF.js → chunk-LHXEX6AX.js} +28 -28
  17. package/dist/browser/dev/excalidraw-assets-dev/chunk-LHXEX6AX.js.map +7 -0
  18. package/dist/browser/dev/excalidraw-assets-dev/{chunk-OH2FVCZF.js → chunk-MTN3FT3I.js} +4 -4
  19. package/dist/browser/dev/excalidraw-assets-dev/{chunk-IE752YUC.js → chunk-PTGAFHDE.js} +5 -5
  20. package/dist/browser/dev/excalidraw-assets-dev/{chunk-4LATYPUZ.js → chunk-TT3CLKL2.js} +3 -3
  21. package/dist/browser/dev/excalidraw-assets-dev/{chunk-EAK3FBDE.js → chunk-VTLDDAKT.js} +3 -3
  22. package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-30eddba6-43KRVI2R.js → classDiagram-30eddba6-EYEUBSFK.js} +6 -6
  23. package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-v2-f2df5561-NDH5IIX2.js → classDiagram-v2-f2df5561-2Q4N2YXH.js} +9 -9
  24. package/dist/browser/dev/excalidraw-assets-dev/{directory-open-01563666-WIGO3PHP.js → directory-open-01563666-JI732I6L.js} +2 -2
  25. package/dist/browser/dev/excalidraw-assets-dev/{directory-open-4ed118d0-CXEHOJKC.js → directory-open-4ed118d0-FCSLGWX4.js} +2 -2
  26. package/dist/browser/dev/excalidraw-assets-dev/dist-Y7YU7LF5.js +10 -0
  27. package/dist/browser/dev/excalidraw-assets-dev/{en-UW5C5KGW.js → en-PSBMWL4S.js} +2 -2
  28. package/dist/browser/dev/excalidraw-assets-dev/{erDiagram-47591fe2-LXI3RBHB.js → erDiagram-47591fe2-YW6WXPKB.js} +5 -5
  29. package/dist/browser/dev/excalidraw-assets-dev/{file-open-002ab408-ZLYQ5POM.js → file-open-002ab408-VGLBX2SD.js} +2 -2
  30. package/dist/browser/dev/excalidraw-assets-dev/{file-open-7c801643-YEWKTXUK.js → file-open-7c801643-HOSRJESM.js} +2 -2
  31. package/dist/browser/dev/excalidraw-assets-dev/{file-save-3189631c-ZRB6VRMQ.js → file-save-3189631c-7UVDDLND.js} +2 -2
  32. package/dist/browser/dev/excalidraw-assets-dev/{file-save-745eba88-6AE2F2MK.js → file-save-745eba88-R4WI6C5N.js} +2 -2
  33. package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-5540d9b9-MHX5LMLF.js → flowDiagram-5540d9b9-HMMVJLFR.js} +10 -10
  34. package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-v2-3b53844e-HXZO64MP.js → flowDiagram-v2-3b53844e-MAKR536R.js} +10 -10
  35. package/dist/browser/dev/excalidraw-assets-dev/{flowchart-elk-definition-5fe447d6-QJSM73VB.js → flowchart-elk-definition-5fe447d6-K5ZCVETB.js} +6 -6
  36. package/dist/browser/dev/excalidraw-assets-dev/{ganttDiagram-9a3bba1f-DIBF4MAD.js → ganttDiagram-9a3bba1f-2ZVU3FTZ.js} +3 -3
  37. package/dist/browser/dev/excalidraw-assets-dev/{gitGraphDiagram-96e6b4ee-AJVGQM3V.js → gitGraphDiagram-96e6b4ee-FZ6FANLP.js} +3 -3
  38. package/dist/browser/dev/excalidraw-assets-dev/{image-ZNQQXS62.css → image-FDQLNM24.css} +39 -16
  39. package/dist/browser/dev/excalidraw-assets-dev/image-FDQLNM24.css.map +7 -0
  40. package/dist/browser/dev/excalidraw-assets-dev/{image-GU4Q2RBL.js → image-SS5TMYT4.js} +6 -6
  41. package/dist/browser/dev/excalidraw-assets-dev/{image-blob-reduce.esm-FERKXLKH.js → image-blob-reduce.esm-YXLX3RLK.js} +2 -2
  42. package/dist/browser/dev/excalidraw-assets-dev/{infoDiagram-bcd20f53-M4VT2O6X.js → infoDiagram-bcd20f53-COYAHIVY.js} +3 -3
  43. package/dist/browser/dev/excalidraw-assets-dev/{journeyDiagram-4fe6b3dc-RBUJMJGB.js → journeyDiagram-4fe6b3dc-RFNSHLY7.js} +4 -4
  44. package/dist/browser/dev/excalidraw-assets-dev/{katex-U3KW6RMN.js → katex-E3UYSNFK.js} +2 -2
  45. package/dist/browser/dev/excalidraw-assets-dev/{mindmap-definition-f354de21-G75STLDF.js → mindmap-definition-f354de21-PLB66GYC.js} +4 -4
  46. package/dist/browser/dev/excalidraw-assets-dev/{pica-QCDDJ4FA.js → pica-FL6WHKHD.js} +2 -2
  47. package/dist/browser/dev/excalidraw-assets-dev/{pieDiagram-79897490-EYD6GWN6.js → pieDiagram-79897490-UZ3VDZDT.js} +3 -3
  48. package/dist/browser/dev/excalidraw-assets-dev/{quadrantDiagram-62f64e94-VCULRDXW.js → quadrantDiagram-62f64e94-T5FLQQ62.js} +3 -3
  49. package/dist/browser/dev/excalidraw-assets-dev/{requirementDiagram-05bf5f74-TASTTHUI.js → requirementDiagram-05bf5f74-VEHQOUFO.js} +5 -5
  50. package/dist/browser/dev/excalidraw-assets-dev/{roundRect-5GJOYZ3N.js → roundRect-K6N73LBJ.js} +2 -2
  51. package/dist/browser/dev/excalidraw-assets-dev/{sankeyDiagram-97764748-2YQACLIX.js → sankeyDiagram-97764748-KLJ7HONA.js} +3 -3
  52. package/dist/browser/dev/excalidraw-assets-dev/{sequenceDiagram-acc0e65c-AQAXFV3S.js → sequenceDiagram-acc0e65c-L4ZWSX22.js} +4 -4
  53. package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-0ff1cf1a-EI62FLQG.js → stateDiagram-0ff1cf1a-JZUDOEAH.js} +6 -6
  54. package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-v2-9a9d610d-MTSH7UNC.js → stateDiagram-v2-9a9d610d-WHNU7SI7.js} +9 -9
  55. package/dist/browser/dev/excalidraw-assets-dev/{timeline-definition-fea2a41d-VQ2VZEWC.js → timeline-definition-fea2a41d-SLLH6X7S.js} +3 -3
  56. package/dist/browser/dev/excalidraw-assets-dev/{xychartDiagram-ab372869-VTFIYULE.js → xychartDiagram-ab372869-A7EDAO5Q.js} +4 -4
  57. package/dist/browser/dev/index.css +38 -15
  58. package/dist/browser/dev/index.css.map +2 -2
  59. package/dist/browser/dev/index.js +9 -5
  60. package/dist/browser/prod/excalidraw-assets/{blockDiagram-91b80b7a-DMU5Q74G.js → blockDiagram-91b80b7a-PRCOUPIS.js} +1 -1
  61. package/dist/browser/prod/excalidraw-assets/{c4Diagram-b2a90758-3XHOZTJB.js → c4Diagram-b2a90758-3DCO4J7M.js} +1 -1
  62. package/dist/browser/prod/excalidraw-assets/{chunk-4YLH7JLJ.js → chunk-ANOBCW22.js} +1 -1
  63. package/dist/browser/prod/excalidraw-assets/{chunk-Y2INGLO2.js → chunk-BJTCWAK5.js} +1 -1
  64. package/dist/browser/prod/excalidraw-assets/{chunk-LAEP4ITC.js → chunk-CFRW7BG7.js} +1 -1
  65. package/dist/browser/prod/excalidraw-assets/{chunk-3V3WOPNJ.js → chunk-GTPHSP2D.js} +1 -1
  66. package/dist/browser/prod/excalidraw-assets/{chunk-QGPVJN7J.js → chunk-H2YFA6TU.js} +1 -1
  67. package/dist/browser/prod/excalidraw-assets/{chunk-TMKJR56I.js → chunk-KCFOWMVC.js} +1 -1
  68. package/dist/browser/prod/excalidraw-assets/{chunk-C565KYGG.js → chunk-KVQMCXCA.js} +1 -1
  69. package/dist/browser/prod/excalidraw-assets/{chunk-CDMNCDGS.js → chunk-LGOYMPVW.js} +21 -21
  70. package/dist/browser/prod/excalidraw-assets/{chunk-RFOEVHBG.js → chunk-O4ONYAI6.js} +1 -1
  71. package/dist/browser/prod/excalidraw-assets/{chunk-EXNSCTNY.js → chunk-OKMPIZ5M.js} +1 -1
  72. package/dist/browser/prod/excalidraw-assets/{chunk-QLNFR4AJ.js → chunk-Q6QP4TRB.js} +1 -1
  73. package/dist/browser/prod/excalidraw-assets/{chunk-HIWCQBFA.js → chunk-QR6QYEOB.js} +1 -1
  74. package/dist/browser/prod/excalidraw-assets/chunk-QYNK5IRK.js +335 -0
  75. package/dist/browser/prod/excalidraw-assets/{chunk-PDOOBCPS.js → chunk-SBL22DUJ.js} +1 -1
  76. package/dist/browser/prod/excalidraw-assets/{chunk-2XMXKWJG.js → chunk-V5EOW4RQ.js} +1 -1
  77. package/dist/browser/prod/excalidraw-assets/{chunk-526DVAV4.js → chunk-W7MPDLSH.js} +1 -1
  78. package/dist/browser/prod/excalidraw-assets/{classDiagram-30eddba6-JWGA2TGA.js → classDiagram-30eddba6-WNQ24D2Y.js} +1 -1
  79. package/dist/browser/prod/excalidraw-assets/{classDiagram-v2-f2df5561-LUELACE2.js → classDiagram-v2-f2df5561-DWS457AE.js} +1 -1
  80. package/dist/browser/prod/excalidraw-assets/{directory-open-01563666-LVSEORCY.js → directory-open-01563666-NXKZ4VWO.js} +1 -1
  81. package/dist/browser/prod/excalidraw-assets/{directory-open-4ed118d0-RFY2TAQG.js → directory-open-4ed118d0-2CQFSTKO.js} +1 -1
  82. package/dist/browser/prod/excalidraw-assets/dist-M4EC2RVT.js +1 -0
  83. package/dist/browser/prod/excalidraw-assets/{en-CPU3UVKT.js → en-MPFDZHEH.js} +1 -1
  84. package/dist/browser/prod/excalidraw-assets/{en-R7FEFJGC-UHMLUFK3.js → en-Q552WR7L-QAV42NF3.js} +1 -1
  85. package/dist/browser/prod/excalidraw-assets/{erDiagram-47591fe2-GYXIXW26.js → erDiagram-47591fe2-GEZEODOI.js} +1 -1
  86. package/dist/browser/prod/excalidraw-assets/{file-open-002ab408-INFZI63D.js → file-open-002ab408-UXKZOBOC.js} +1 -1
  87. package/dist/browser/prod/excalidraw-assets/{file-open-7c801643-GKUCIQCX.js → file-open-7c801643-SERMWI2Z.js} +1 -1
  88. package/dist/browser/prod/excalidraw-assets/{file-save-3189631c-ANETLLLV.js → file-save-3189631c-7FEUIB5M.js} +1 -1
  89. package/dist/browser/prod/excalidraw-assets/{file-save-745eba88-Y5LQRZDO.js → file-save-745eba88-QB3HQPRU.js} +1 -1
  90. package/dist/browser/prod/excalidraw-assets/{flowDiagram-5540d9b9-3CJJJFXX.js → flowDiagram-5540d9b9-EWDI4FWB.js} +1 -1
  91. package/dist/browser/prod/excalidraw-assets/flowDiagram-v2-3b53844e-CSN53VTR.js +1 -0
  92. package/dist/browser/prod/excalidraw-assets/{flowchart-elk-definition-5fe447d6-PDXCITK5.js → flowchart-elk-definition-5fe447d6-EPCYY7UZ.js} +1 -1
  93. package/dist/browser/prod/excalidraw-assets/{ganttDiagram-9a3bba1f-6H5RBJF2.js → ganttDiagram-9a3bba1f-5SFDQQ5Y.js} +1 -1
  94. package/dist/browser/prod/excalidraw-assets/{gitGraphDiagram-96e6b4ee-23XJXNXL.js → gitGraphDiagram-96e6b4ee-IK47LK43.js} +1 -1
  95. package/dist/browser/prod/excalidraw-assets/image-LI7WETXC.js +1 -0
  96. package/dist/browser/prod/excalidraw-assets/{image-blob-reduce.esm-47YEP2D2.js → image-blob-reduce.esm-44FOF6QQ.js} +1 -1
  97. package/dist/browser/prod/excalidraw-assets/{infoDiagram-bcd20f53-T57DUB27.js → infoDiagram-bcd20f53-2DLI3AEB.js} +1 -1
  98. package/dist/browser/prod/excalidraw-assets/{journeyDiagram-4fe6b3dc-V65HNLRJ.js → journeyDiagram-4fe6b3dc-MADFQ4OF.js} +1 -1
  99. package/dist/browser/prod/excalidraw-assets/{katex-GT3FOCX5.js → katex-24OYZMXR.js} +1 -1
  100. package/dist/browser/prod/excalidraw-assets/{mindmap-definition-f354de21-M6IDU4JG.js → mindmap-definition-f354de21-NFTFT2XB.js} +1 -1
  101. package/dist/browser/prod/excalidraw-assets/{pica-ORBFBYLP.js → pica-5IJTZHHE.js} +1 -1
  102. package/dist/browser/prod/excalidraw-assets/{pieDiagram-79897490-JMLERKYB.js → pieDiagram-79897490-AWYHG5OT.js} +1 -1
  103. package/dist/browser/prod/excalidraw-assets/{quadrantDiagram-62f64e94-M2UOBSKJ.js → quadrantDiagram-62f64e94-7R3WNOLE.js} +1 -1
  104. package/dist/browser/prod/excalidraw-assets/{requirementDiagram-05bf5f74-JGVLF3LK.js → requirementDiagram-05bf5f74-WVV4CACM.js} +1 -1
  105. package/dist/browser/prod/excalidraw-assets/{roundRect-B4P3NWN6.js → roundRect-Q7M7LXZP.js} +1 -1
  106. package/dist/browser/prod/excalidraw-assets/{sankeyDiagram-97764748-VRTAW4W2.js → sankeyDiagram-97764748-PGSJS2WP.js} +1 -1
  107. package/dist/browser/prod/excalidraw-assets/{sequenceDiagram-acc0e65c-M4OKLHBU.js → sequenceDiagram-acc0e65c-MVSXHT56.js} +1 -1
  108. package/dist/browser/prod/excalidraw-assets/{stateDiagram-0ff1cf1a-3CPFAEL2.js → stateDiagram-0ff1cf1a-PQJ344ML.js} +1 -1
  109. package/dist/browser/prod/excalidraw-assets/{stateDiagram-v2-9a9d610d-VLI5D4N6.js → stateDiagram-v2-9a9d610d-IKUMEGLC.js} +1 -1
  110. package/dist/browser/prod/excalidraw-assets/{timeline-definition-fea2a41d-MIOJHT22.js → timeline-definition-fea2a41d-4WBSWL7X.js} +1 -1
  111. package/dist/browser/prod/excalidraw-assets/{xychartDiagram-ab372869-SXWWQSYE.js → xychartDiagram-ab372869-RYRNQ54R.js} +1 -1
  112. package/dist/browser/prod/index.css +1 -1
  113. package/dist/browser/prod/index.js +15 -15
  114. package/dist/dev/{en-R7FEFJGC.json → en-Q552WR7L.json} +1 -1
  115. package/dist/dev/index.css +38 -15
  116. package/dist/dev/index.css.map +2 -2
  117. package/dist/dev/index.js +4553 -2591
  118. package/dist/dev/index.js.map +4 -4
  119. package/dist/excalidraw/actions/actionAddToLibrary.d.ts +4 -4
  120. package/dist/excalidraw/actions/actionAddToLibrary.js +4 -3
  121. package/dist/excalidraw/actions/actionAlign.d.ts +20 -20
  122. package/dist/excalidraw/actions/actionAlign.js +7 -6
  123. package/dist/excalidraw/actions/actionBoundText.d.ts +7 -7
  124. package/dist/excalidraw/actions/actionBoundText.js +8 -4
  125. package/dist/excalidraw/actions/actionCanvas.d.ts +49 -49
  126. package/dist/excalidraw/actions/actionCanvas.js +16 -13
  127. package/dist/excalidraw/actions/actionClipboard.d.ts +24 -24
  128. package/dist/excalidraw/actions/actionClipboard.js +14 -13
  129. package/dist/excalidraw/actions/actionDeleteSelected.d.ts +8 -8
  130. package/dist/excalidraw/actions/actionDeleteSelected.js +6 -3
  131. package/dist/excalidraw/actions/actionDistribute.d.ts +8 -8
  132. package/dist/excalidraw/actions/actionDistribute.js +3 -2
  133. package/dist/excalidraw/actions/actionDuplicateSelection.d.ts +5 -6
  134. package/dist/excalidraw/actions/actionDuplicateSelection.js +7 -3
  135. package/dist/excalidraw/actions/actionElementLock.d.ts +8 -8
  136. package/dist/excalidraw/actions/actionElementLock.js +3 -2
  137. package/dist/excalidraw/actions/actionExport.d.ts +36 -36
  138. package/dist/excalidraw/actions/actionExport.js +15 -11
  139. package/dist/excalidraw/actions/actionFinalize.d.ts +8 -8
  140. package/dist/excalidraw/actions/actionFinalize.js +9 -5
  141. package/dist/excalidraw/actions/actionFlip.d.ts +9 -9
  142. package/dist/excalidraw/actions/actionFlip.js +12 -12
  143. package/dist/excalidraw/actions/actionFrame.d.ts +14 -169
  144. package/dist/excalidraw/actions/actionFrame.js +7 -6
  145. package/dist/excalidraw/actions/actionGroup.d.ts +11 -321
  146. package/dist/excalidraw/actions/actionGroup.js +9 -11
  147. package/dist/excalidraw/actions/actionHistory.d.ts +3 -2
  148. package/dist/excalidraw/actions/actionHistory.js +27 -28
  149. package/dist/excalidraw/actions/actionLinearEditor.d.ts +2 -2
  150. package/dist/excalidraw/actions/actionLinearEditor.js +2 -1
  151. package/dist/excalidraw/actions/actionLink.d.ts +5 -5
  152. package/dist/excalidraw/actions/actionLink.js +2 -1
  153. package/dist/excalidraw/actions/actionMenu.d.ts +8 -8
  154. package/dist/excalidraw/actions/actionMenu.js +4 -3
  155. package/dist/excalidraw/actions/actionNavigate.d.ts +3 -3
  156. package/dist/excalidraw/actions/actionNavigate.js +3 -2
  157. package/dist/excalidraw/actions/actionProperties.d.ts +32 -32
  158. package/dist/excalidraw/actions/actionProperties.js +18 -13
  159. package/dist/excalidraw/actions/actionSelectAll.d.ts +4 -4
  160. package/dist/excalidraw/actions/actionSelectAll.js +2 -1
  161. package/dist/excalidraw/actions/actionStyles.d.ts +9 -12
  162. package/dist/excalidraw/actions/actionStyles.js +4 -3
  163. package/dist/excalidraw/actions/actionToggleGridMode.d.ts +6 -4
  164. package/dist/excalidraw/actions/actionToggleGridMode.js +6 -2
  165. package/dist/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
  166. package/dist/excalidraw/actions/actionToggleObjectsSnapMode.js +2 -1
  167. package/dist/excalidraw/actions/actionToggleStats.d.ts +4 -4
  168. package/dist/excalidraw/actions/actionToggleStats.js +2 -1
  169. package/dist/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
  170. package/dist/excalidraw/actions/actionToggleViewMode.js +2 -1
  171. package/dist/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
  172. package/dist/excalidraw/actions/actionToggleZenMode.js +2 -1
  173. package/dist/excalidraw/actions/actionZindex.d.ts +19 -19
  174. package/dist/excalidraw/actions/actionZindex.js +5 -4
  175. package/dist/excalidraw/actions/manager.d.ts +3 -3
  176. package/dist/excalidraw/actions/types.d.ts +4 -4
  177. package/dist/excalidraw/appState.d.ts +5 -5
  178. package/dist/excalidraw/change.d.ts +191 -0
  179. package/dist/excalidraw/change.js +894 -0
  180. package/dist/excalidraw/components/App.d.ts +22 -8
  181. package/dist/excalidraw/components/App.js +353 -147
  182. package/dist/excalidraw/components/CommandPalette/CommandPalette.js +1 -0
  183. package/dist/excalidraw/components/HelpDialog.js +1 -1
  184. package/dist/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
  185. package/dist/excalidraw/components/Stack.d.ts +2 -2
  186. package/dist/excalidraw/components/ToolButton.d.ts +1 -0
  187. package/dist/excalidraw/components/ToolButton.js +1 -1
  188. package/dist/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -1
  189. package/dist/excalidraw/components/canvases/InteractiveCanvas.js +1 -0
  190. package/dist/excalidraw/components/hyperlink/Hyperlink.js +3 -3
  191. package/dist/excalidraw/components/hyperlink/helpers.js +2 -3
  192. package/dist/excalidraw/components/icons.d.ts +1 -0
  193. package/dist/excalidraw/components/icons.js +1 -0
  194. package/dist/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  195. package/dist/excalidraw/constants.d.ts +3 -3
  196. package/dist/excalidraw/constants.js +6 -3
  197. package/dist/excalidraw/data/reconcile.d.ts +6 -0
  198. package/dist/excalidraw/data/reconcile.js +49 -0
  199. package/dist/excalidraw/data/restore.d.ts +3 -3
  200. package/dist/excalidraw/data/restore.js +6 -7
  201. package/dist/excalidraw/data/transform.d.ts +1 -1
  202. package/dist/excalidraw/data/transform.js +4 -3
  203. package/dist/excalidraw/element/binding.d.ts +50 -9
  204. package/dist/excalidraw/element/binding.js +712 -155
  205. package/dist/excalidraw/element/bounds.d.ts +0 -1
  206. package/dist/excalidraw/element/bounds.js +0 -3
  207. package/dist/excalidraw/element/collision.d.ts +14 -19
  208. package/dist/excalidraw/element/collision.js +36 -713
  209. package/dist/excalidraw/element/embeddable.d.ts +7 -4
  210. package/dist/excalidraw/element/embeddable.js +72 -18
  211. package/dist/excalidraw/element/index.d.ts +0 -1
  212. package/dist/excalidraw/element/index.js +0 -1
  213. package/dist/excalidraw/element/linearElementEditor.d.ts +11 -11
  214. package/dist/excalidraw/element/linearElementEditor.js +7 -5
  215. package/dist/excalidraw/element/mutateElement.d.ts +1 -2
  216. package/dist/excalidraw/element/newElement.d.ts +1 -1
  217. package/dist/excalidraw/element/newElement.js +2 -1
  218. package/dist/excalidraw/element/resizeElements.d.ts +1 -1
  219. package/dist/excalidraw/element/resizeElements.js +110 -86
  220. package/dist/excalidraw/element/resizeTest.d.ts +4 -4
  221. package/dist/excalidraw/element/resizeTest.js +55 -8
  222. package/dist/excalidraw/element/sizeHelpers.js +3 -0
  223. package/dist/excalidraw/element/textElement.d.ts +1 -2
  224. package/dist/excalidraw/element/textElement.js +5 -34
  225. package/dist/excalidraw/element/transformHandles.d.ts +22 -4
  226. package/dist/excalidraw/element/transformHandles.js +24 -3
  227. package/dist/excalidraw/element/typeChecks.d.ts +2 -2
  228. package/dist/excalidraw/element/types.d.ts +19 -6
  229. package/dist/excalidraw/errors.d.ts +3 -0
  230. package/dist/excalidraw/errors.js +3 -0
  231. package/dist/excalidraw/fractionalIndex.d.ts +40 -0
  232. package/dist/excalidraw/fractionalIndex.js +241 -0
  233. package/dist/excalidraw/frame.d.ts +1 -1
  234. package/dist/excalidraw/groups.d.ts +2 -0
  235. package/dist/excalidraw/groups.js +17 -0
  236. package/dist/excalidraw/history.d.ts +34 -46
  237. package/dist/excalidraw/history.js +100 -167
  238. package/dist/excalidraw/hooks/useEmitter.d.ts +2 -0
  239. package/dist/excalidraw/hooks/useEmitter.js +13 -0
  240. package/dist/excalidraw/index.d.ts +2 -0
  241. package/dist/excalidraw/index.js +2 -0
  242. package/dist/excalidraw/locales/en.json +1 -1
  243. package/dist/excalidraw/renderer/interactiveScene.d.ts +1 -1
  244. package/dist/excalidraw/renderer/interactiveScene.js +8 -7
  245. package/dist/excalidraw/renderer/staticScene.js +14 -3
  246. package/dist/excalidraw/renderer/staticSvgScene.js +10 -0
  247. package/dist/excalidraw/scene/Scene.d.ts +7 -6
  248. package/dist/excalidraw/scene/Scene.js +31 -16
  249. package/dist/excalidraw/scene/export.js +2 -1
  250. package/dist/excalidraw/scene/types.d.ts +2 -1
  251. package/dist/excalidraw/store.d.ts +99 -0
  252. package/dist/excalidraw/store.js +269 -0
  253. package/dist/excalidraw/types.d.ts +18 -4
  254. package/dist/excalidraw/utils.d.ts +6 -0
  255. package/dist/excalidraw/utils.js +7 -0
  256. package/dist/excalidraw/zindex.d.ts +2 -2
  257. package/dist/excalidraw/zindex.js +9 -13
  258. package/dist/prod/{en-R7FEFJGC.json → en-Q552WR7L.json} +1 -1
  259. package/dist/prod/index.css +1 -1
  260. package/dist/prod/index.js +44 -44
  261. package/dist/utils/collision.d.ts +4 -0
  262. package/dist/utils/collision.js +48 -0
  263. package/dist/utils/geometry/geometry.d.ts +71 -0
  264. package/dist/utils/geometry/geometry.js +674 -0
  265. package/dist/utils/geometry/shape.d.ts +56 -0
  266. package/dist/utils/geometry/shape.js +168 -0
  267. package/history.ts +161 -216
  268. package/package.json +2 -1
  269. package/dist/browser/dev/excalidraw-assets-dev/chunk-J5HRUYQR.js.map +0 -7
  270. package/dist/browser/dev/excalidraw-assets-dev/chunk-QZ4FGBZF.js.map +0 -7
  271. package/dist/browser/dev/excalidraw-assets-dev/chunk-U6PMUKRO.js.map +0 -7
  272. package/dist/browser/dev/excalidraw-assets-dev/dist-KCKKSNUY.js +0 -10
  273. package/dist/browser/dev/excalidraw-assets-dev/image-ZNQQXS62.css.map +0 -7
  274. package/dist/browser/prod/excalidraw-assets/chunk-46SP2WMF.js +0 -335
  275. package/dist/browser/prod/excalidraw-assets/dist-F2IUHSJR.js +0 -1
  276. package/dist/browser/prod/excalidraw-assets/flowDiagram-v2-3b53844e-ETRR4SD3.js +0 -1
  277. package/dist/browser/prod/excalidraw-assets/image-5SBTIZPN.js +0 -1
  278. /package/dist/browser/dev/excalidraw-assets-dev/{blockDiagram-91b80b7a-QSJ4HNO7.js.map → blockDiagram-91b80b7a-IRJTK6Z5.js.map} +0 -0
  279. /package/dist/browser/dev/excalidraw-assets-dev/{c4Diagram-b2a90758-4MYCZKG5.js.map → c4Diagram-b2a90758-CCPPXFPY.js.map} +0 -0
  280. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-BECDVD6R.js.map → chunk-32FQKC5U.js.map} +0 -0
  281. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-POWCA5QF.js.map → chunk-4RQWU7MH.js.map} +0 -0
  282. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-Q7SIL7GF.js.map → chunk-4XTDAI34.js.map} +0 -0
  283. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-FR3IAB6U.js.map → chunk-CH3VL6LE.js.map} +0 -0
  284. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-EPAK72CK.js.map → chunk-DAUKRODV.js.map} +0 -0
  285. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-U4Z6B5JW.js.map → chunk-GHBR42PD.js.map} +0 -0
  286. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-FRL7WYV2.js.map → chunk-I6APBPLG.js.map} +0 -0
  287. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-J4UG2B64.js.map → chunk-JT5FK676.js.map} +0 -0
  288. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-OH2FVCZF.js.map → chunk-MTN3FT3I.js.map} +0 -0
  289. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-IE752YUC.js.map → chunk-PTGAFHDE.js.map} +0 -0
  290. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-4LATYPUZ.js.map → chunk-TT3CLKL2.js.map} +0 -0
  291. /package/dist/browser/dev/excalidraw-assets-dev/{chunk-EAK3FBDE.js.map → chunk-VTLDDAKT.js.map} +0 -0
  292. /package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-30eddba6-43KRVI2R.js.map → classDiagram-30eddba6-EYEUBSFK.js.map} +0 -0
  293. /package/dist/browser/dev/excalidraw-assets-dev/{classDiagram-v2-f2df5561-NDH5IIX2.js.map → classDiagram-v2-f2df5561-2Q4N2YXH.js.map} +0 -0
  294. /package/dist/browser/dev/excalidraw-assets-dev/{directory-open-01563666-WIGO3PHP.js.map → directory-open-01563666-JI732I6L.js.map} +0 -0
  295. /package/dist/browser/dev/excalidraw-assets-dev/{directory-open-4ed118d0-CXEHOJKC.js.map → directory-open-4ed118d0-FCSLGWX4.js.map} +0 -0
  296. /package/dist/browser/dev/excalidraw-assets-dev/{dist-KCKKSNUY.js.map → dist-Y7YU7LF5.js.map} +0 -0
  297. /package/dist/browser/dev/excalidraw-assets-dev/{en-UW5C5KGW.js.map → en-PSBMWL4S.js.map} +0 -0
  298. /package/dist/browser/dev/excalidraw-assets-dev/{erDiagram-47591fe2-LXI3RBHB.js.map → erDiagram-47591fe2-YW6WXPKB.js.map} +0 -0
  299. /package/dist/browser/dev/excalidraw-assets-dev/{file-open-002ab408-ZLYQ5POM.js.map → file-open-002ab408-VGLBX2SD.js.map} +0 -0
  300. /package/dist/browser/dev/excalidraw-assets-dev/{file-open-7c801643-YEWKTXUK.js.map → file-open-7c801643-HOSRJESM.js.map} +0 -0
  301. /package/dist/browser/dev/excalidraw-assets-dev/{file-save-3189631c-ZRB6VRMQ.js.map → file-save-3189631c-7UVDDLND.js.map} +0 -0
  302. /package/dist/browser/dev/excalidraw-assets-dev/{file-save-745eba88-6AE2F2MK.js.map → file-save-745eba88-R4WI6C5N.js.map} +0 -0
  303. /package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-5540d9b9-MHX5LMLF.js.map → flowDiagram-5540d9b9-HMMVJLFR.js.map} +0 -0
  304. /package/dist/browser/dev/excalidraw-assets-dev/{flowDiagram-v2-3b53844e-HXZO64MP.js.map → flowDiagram-v2-3b53844e-MAKR536R.js.map} +0 -0
  305. /package/dist/browser/dev/excalidraw-assets-dev/{flowchart-elk-definition-5fe447d6-QJSM73VB.js.map → flowchart-elk-definition-5fe447d6-K5ZCVETB.js.map} +0 -0
  306. /package/dist/browser/dev/excalidraw-assets-dev/{ganttDiagram-9a3bba1f-DIBF4MAD.js.map → ganttDiagram-9a3bba1f-2ZVU3FTZ.js.map} +0 -0
  307. /package/dist/browser/dev/excalidraw-assets-dev/{gitGraphDiagram-96e6b4ee-AJVGQM3V.js.map → gitGraphDiagram-96e6b4ee-FZ6FANLP.js.map} +0 -0
  308. /package/dist/browser/dev/excalidraw-assets-dev/{image-GU4Q2RBL.js.map → image-SS5TMYT4.js.map} +0 -0
  309. /package/dist/browser/dev/excalidraw-assets-dev/{image-blob-reduce.esm-FERKXLKH.js.map → image-blob-reduce.esm-YXLX3RLK.js.map} +0 -0
  310. /package/dist/browser/dev/excalidraw-assets-dev/{infoDiagram-bcd20f53-M4VT2O6X.js.map → infoDiagram-bcd20f53-COYAHIVY.js.map} +0 -0
  311. /package/dist/browser/dev/excalidraw-assets-dev/{journeyDiagram-4fe6b3dc-RBUJMJGB.js.map → journeyDiagram-4fe6b3dc-RFNSHLY7.js.map} +0 -0
  312. /package/dist/browser/dev/excalidraw-assets-dev/{katex-U3KW6RMN.js.map → katex-E3UYSNFK.js.map} +0 -0
  313. /package/dist/browser/dev/excalidraw-assets-dev/{mindmap-definition-f354de21-G75STLDF.js.map → mindmap-definition-f354de21-PLB66GYC.js.map} +0 -0
  314. /package/dist/browser/dev/excalidraw-assets-dev/{pica-QCDDJ4FA.js.map → pica-FL6WHKHD.js.map} +0 -0
  315. /package/dist/browser/dev/excalidraw-assets-dev/{pieDiagram-79897490-EYD6GWN6.js.map → pieDiagram-79897490-UZ3VDZDT.js.map} +0 -0
  316. /package/dist/browser/dev/excalidraw-assets-dev/{quadrantDiagram-62f64e94-VCULRDXW.js.map → quadrantDiagram-62f64e94-T5FLQQ62.js.map} +0 -0
  317. /package/dist/browser/dev/excalidraw-assets-dev/{requirementDiagram-05bf5f74-TASTTHUI.js.map → requirementDiagram-05bf5f74-VEHQOUFO.js.map} +0 -0
  318. /package/dist/browser/dev/excalidraw-assets-dev/{roundRect-5GJOYZ3N.js.map → roundRect-K6N73LBJ.js.map} +0 -0
  319. /package/dist/browser/dev/excalidraw-assets-dev/{sankeyDiagram-97764748-2YQACLIX.js.map → sankeyDiagram-97764748-KLJ7HONA.js.map} +0 -0
  320. /package/dist/browser/dev/excalidraw-assets-dev/{sequenceDiagram-acc0e65c-AQAXFV3S.js.map → sequenceDiagram-acc0e65c-L4ZWSX22.js.map} +0 -0
  321. /package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-0ff1cf1a-EI62FLQG.js.map → stateDiagram-0ff1cf1a-JZUDOEAH.js.map} +0 -0
  322. /package/dist/browser/dev/excalidraw-assets-dev/{stateDiagram-v2-9a9d610d-MTSH7UNC.js.map → stateDiagram-v2-9a9d610d-WHNU7SI7.js.map} +0 -0
  323. /package/dist/browser/dev/excalidraw-assets-dev/{timeline-definition-fea2a41d-VQ2VZEWC.js.map → timeline-definition-fea2a41d-SLLH6X7S.js.map} +0 -0
  324. /package/dist/browser/dev/excalidraw-assets-dev/{xychartDiagram-ab372869-VTFIYULE.js.map → xychartDiagram-ab372869-A7EDAO5Q.js.map} +0 -0
@@ -1,335 +0,0 @@
1
- import{E as Dy}from"./chunk-Y2INGLO2.js";import{aa as KI}from"./chunk-SJBOQTFA.js";import{a as S,b as N}from"./chunk-526DVAV4.js";import{d as Qe,f as L}from"./chunk-SXMPUQ6M.js";var Ry=Qe(Ly=>{S();var qI;(function(e){typeof DO_NOT_EXPORT_CRC>"u"?typeof Ly=="object"?e(Ly):typeof define=="function"&&define.amd?define(function(){var t={};return e(t),t}):e(qI={}):e(qI={})})(function(e){e.version="0.3.0";function t(){for(var l=0,c=new Array(256),d=0;d!=256;++d)l=d,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,l=l&1?-306674912^l>>>1:l>>>1,c[d]=l;return typeof Int32Array<"u"?new Int32Array(c):c}var n=t(),r=typeof Buffer<"u";function i(l){if(l.length>32768&&r)return a(new Buffer(l));for(var c=-1,d=l.length-1,u=0;u<d;)c=n[(c^l.charCodeAt(u++))&255]^c>>>8,c=n[(c^l.charCodeAt(u++))&255]^c>>>8;return u===d&&(c=c>>>8^n[(c^l.charCodeAt(u))&255]),c^-1}function o(l){if(l.length>1e4)return a(l);for(var c=-1,d=0,u=l.length-3;d<u;)c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255];for(;d<u+3;)c=c>>>8^n[(c^l[d++])&255];return c^-1}function a(l){for(var c=-1,d=0,u=l.length-7;d<u;)c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255],c=c>>>8^n[(c^l[d++])&255];for(;d<u+7;)c=c>>>8^n[(c^l[d++])&255];return c^-1}function s(l){for(var c=-1,d=0,u=l.length,h,m;d<u;)h=l.charCodeAt(d++),h<128?c=c>>>8^n[(c^h)&255]:h<2048?(c=c>>>8^n[(c^(192|h>>6&31))&255],c=c>>>8^n[(c^(128|h&63))&255]):h>=55296&&h<57344?(h=(h&1023)+64,m=l.charCodeAt(d++)&1023,c=c>>>8^n[(c^(240|h>>8&7))&255],c=c>>>8^n[(c^(128|h>>2&63))&255],c=c>>>8^n[(c^(128|m>>6&15|h&3))&255],c=c>>>8^n[(c^(128|m&63))&255]):(c=c>>>8^n[(c^(224|h>>12&15))&255],c=c>>>8^n[(c^(128|h>>6&63))&255],c=c>>>8^n[(c^(128|h&63))&255]);return c^-1}e.table=n,e.bstr=i,e.buf=o,e.str=s})});var Oy=Qe((yie,QI)=>{S();var lU=Ry();QI.exports=uU;var Ao=new Uint8Array(4),cU=new Int32Array(Ao.buffer),dU=new Uint32Array(Ao.buffer);function uU(e){if(e[0]!==137)throw new Error("Invalid .png file header");if(e[1]!==80)throw new Error("Invalid .png file header");if(e[2]!==78)throw new Error("Invalid .png file header");if(e[3]!==71)throw new Error("Invalid .png file header");if(e[4]!==13)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[5]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[6]!==26)throw new Error("Invalid .png file header");if(e[7]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");for(var t=!1,n=[],r=8;r<e.length;){Ao[3]=e[r++],Ao[2]=e[r++],Ao[1]=e[r++],Ao[0]=e[r++];var i=dU[0]+4,o=new Uint8Array(i);o[0]=e[r++],o[1]=e[r++],o[2]=e[r++],o[3]=e[r++];var a=String.fromCharCode(o[0])+String.fromCharCode(o[1])+String.fromCharCode(o[2])+String.fromCharCode(o[3]);if(!n.length&&a!=="IHDR")throw new Error("IHDR header missing");if(a==="IEND"){t=!0,n.push({name:a,data:new Uint8Array(0)});break}for(var s=4;s<i;s++)o[s]=e[r++];Ao[3]=e[r++],Ao[2]=e[r++],Ao[1]=e[r++],Ao[0]=e[r++];var l=cU[0],c=lU.buf(o);if(c!==l)throw new Error("CRC values for "+a+" header do not match, PNG file is likely corrupted");var d=new Uint8Array(o.buffer.slice(4));n.push({name:a,data:d})}if(!t)throw new Error(".png file ended prematurely: no IEND header was found");return n}});var e8=Qe((xie,JI)=>{S();JI.exports=hU;function hU(e,t){if(e=String(e),t=String(t),!/^[\x00-\xFF]+$/.test(e)||!/^[\x00-\xFF]+$/.test(t))throw new Error("Only Latin-1 characters are permitted in PNG tEXt chunks. You might want to consider base64 encoding and/or zEXt compression");if(e.length>=80)throw new Error('Keyword "'+e+'" is longer than the 79-character limit imposed by the PNG specification');for(var n=e.length+t.length+1,r=new Uint8Array(n),i=0,o,a=0;a<e.length;a++){if(!(o=e.charCodeAt(a)))throw new Error("0x00 character is not permitted in tEXt keywords");r[i++]=o}r[i++]=0;for(var s=0;s<t.length;s++){if(!(o=t.charCodeAt(s)))throw new Error("0x00 character is not permitted in tEXt content");r[i++]=o}return{name:"tEXt",data:r}}});var n8=Qe((Sie,t8)=>{S();t8.exports=mU;function mU(e){e.data&&e.name&&(e=e.data);for(var t=!0,n="",r="",i=0;i<e.length;i++){var o=e[i];if(t)o?r+=String.fromCharCode(o):t=!1;else if(o)n+=String.fromCharCode(o);else throw new Error("Invalid NULL character found. 0x00 character is not permitted in tEXt content")}return{keyword:r,text:n}}});var $y=Qe(Ny=>{S();Ny.encode=e8();Ny.decode=n8()});var i8=Qe((Iie,r8)=>{S();r8.exports=function(e,t,n){var r=[],i=e.length;if(i===0)return r;var o=t<0?Math.max(0,t+i):t||0;for(n!==void 0&&(i=n<0?n+i:n);i-- >o;)r[i-o]=e[i];return r}});var Fy=Qe((Aie,o8)=>{S();var pU=i8(),fU=Ry();o8.exports=bU;var _o=new Uint8Array(4),gU=new Int32Array(_o.buffer),EU=new Uint32Array(_o.buffer);function bU(e){var t=8,n=t,r;for(r=0;r<e.length;r++)t+=e[r].data.length,t+=12;var i=new Uint8Array(t);for(i[0]=137,i[1]=80,i[2]=78,i[3]=71,i[4]=13,i[5]=10,i[6]=26,i[7]=10,r=0;r<e.length;r++){var o=e[r],a=o.name,s=o.data,l=s.length,c=[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)];EU[0]=l,i[n++]=_o[3],i[n++]=_o[2],i[n++]=_o[1],i[n++]=_o[0],i[n++]=c[0],i[n++]=c[1],i[n++]=c[2],i[n++]=c[3];for(var d=0;d<l;)i[n++]=s[d++];var u=c.concat(pU(s)),h=fU.buf(u);gU[0]=h,i[n++]=_o[3],i[n++]=_o[2],i[n++]=_o[1],i[n++]=_o[0]}return i}});var ha=Qe(hr=>{"use strict";S();var yU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function vU(e,t){return Object.prototype.hasOwnProperty.call(e,t)}hr.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)vU(n,r)&&(e[r]=n[r])}}return e};hr.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var xU={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+r),i);return}for(var o=0;o<r;o++)e[i+o]=t[n+o]},flattenChunks:function(e){var t,n,r,i,o,a;for(r=0,t=0,n=e.length;t<n;t++)r+=e[t].length;for(a=new Uint8Array(r),i=0,t=0,n=e.length;t<n;t++)o=e[t],a.set(o,i),i+=o.length;return a}},wU={arraySet:function(e,t,n,r,i){for(var o=0;o<r;o++)e[i+o]=t[n+o]},flattenChunks:function(e){return[].concat.apply([],e)}};hr.setTyped=function(e){e?(hr.Buf8=Uint8Array,hr.Buf16=Uint16Array,hr.Buf32=Int32Array,hr.assign(hr,xU)):(hr.Buf8=Array,hr.Buf16=Array,hr.Buf32=Array,hr.assign(hr,wU))};hr.setTyped(yU)});var k8=Qe(rd=>{"use strict";S();var SU=ha(),TU=4,a8=0,s8=1,CU=2;function nd(e){for(var t=e.length;--t>=0;)e[t]=0}var MU=0,m8=1,IU=2,kU=3,AU=258,Uy=29,Ch=256,xh=Ch+1+Uy,td=30,Vy=19,p8=2*xh+1,Ll=15,By=16,_U=7,Yy=256,f8=16,g8=17,E8=18,Wy=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Qf=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],PU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],b8=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DU=512,ma=new Array((xh+2)*2);nd(ma);var vh=new Array(td*2);nd(vh);var wh=new Array(DU);nd(wh);var Sh=new Array(AU-kU+1);nd(Sh);var Zy=new Array(Uy);nd(Zy);var Jf=new Array(td);nd(Jf);function zy(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var y8,v8,x8;function Hy(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function w8(e){return e<256?wh[e]:wh[256+(e>>>7)]}function Th(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Cr(e,t,n){e.bi_valid>By-n?(e.bi_buf|=t<<e.bi_valid&65535,Th(e,e.bi_buf),e.bi_buf=t>>By-e.bi_valid,e.bi_valid+=n-By):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function Po(e,t,n){Cr(e,n[t*2],n[t*2+1])}function S8(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function LU(e){e.bi_valid===16?(Th(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function RU(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,d,u,h,m,p,f=0;for(h=0;h<=Ll;h++)e.bl_count[h]=0;for(n[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<p8;c++)d=e.heap[c],h=n[n[d*2+1]*2+1]+1,h>l&&(h=l,f++),n[d*2+1]=h,!(d>r)&&(e.bl_count[h]++,m=0,d>=s&&(m=a[d-s]),p=n[d*2],e.opt_len+=p*(h+m),o&&(e.static_len+=p*(i[d*2+1]+m)));if(f!==0){do{for(h=l-1;e.bl_count[h]===0;)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(h=l;h!==0;h--)for(d=e.bl_count[h];d!==0;)u=e.heap[--c],!(u>r)&&(n[u*2+1]!==h&&(e.opt_len+=(h-n[u*2+1])*n[u*2],n[u*2+1]=h),d--)}}function T8(e,t,n){var r=new Array(Ll+1),i=0,o,a;for(o=1;o<=Ll;o++)r[o]=i=i+n[o-1]<<1;for(a=0;a<=t;a++){var s=e[a*2+1];s!==0&&(e[a*2]=S8(r[s]++,s))}}function OU(){var e,t,n,r,i,o=new Array(Ll+1);for(n=0,r=0;r<Uy-1;r++)for(Zy[r]=n,e=0;e<1<<Wy[r];e++)Sh[n++]=r;for(Sh[n-1]=r,i=0,r=0;r<16;r++)for(Jf[r]=i,e=0;e<1<<Qf[r];e++)wh[i++]=r;for(i>>=7;r<td;r++)for(Jf[r]=i<<7,e=0;e<1<<Qf[r]-7;e++)wh[256+i++]=r;for(t=0;t<=Ll;t++)o[t]=0;for(e=0;e<=143;)ma[e*2+1]=8,e++,o[8]++;for(;e<=255;)ma[e*2+1]=9,e++,o[9]++;for(;e<=279;)ma[e*2+1]=7,e++,o[7]++;for(;e<=287;)ma[e*2+1]=8,e++,o[8]++;for(T8(ma,xh+1,o),e=0;e<td;e++)vh[e*2+1]=5,vh[e*2]=S8(e,5);y8=new zy(ma,Wy,Ch+1,xh,Ll),v8=new zy(vh,Qf,0,td,Ll),x8=new zy(new Array(0),PU,0,Vy,_U)}function C8(e){var t;for(t=0;t<xh;t++)e.dyn_ltree[t*2]=0;for(t=0;t<td;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Vy;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Yy*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function M8(e){e.bi_valid>8?Th(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function NU(e,t,n,r){M8(e),r&&(Th(e,n),Th(e,~n)),SU.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function l8(e,t,n,r){var i=t*2,o=n*2;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]}function Gy(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&l8(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!l8(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function c8(e,t,n){var r,i,o=0,a,s;if(e.last_lit!==0)do r=e.pending_buf[e.d_buf+o*2]<<8|e.pending_buf[e.d_buf+o*2+1],i=e.pending_buf[e.l_buf+o],o++,r===0?Po(e,i,t):(a=Sh[i],Po(e,a+Ch+1,t),s=Wy[a],s!==0&&(i-=Zy[a],Cr(e,i,s)),r--,a=w8(r),Po(e,a,n),s=Qf[a],s!==0&&(r-=Jf[a],Cr(e,r,s)));while(o<e.last_lit);Po(e,Yy,t)}function jy(e,t){var n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems,a,s,l=-1,c;for(e.heap_len=0,e.heap_max=p8,a=0;a<o;a++)n[a*2]!==0?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):n[a*2+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,n[c*2]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=r[c*2+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)Gy(e,n,a);c=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Gy(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[c*2]=n[a*2]+n[s*2],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=c,e.heap[1]=c++,Gy(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],RU(e,t),T8(n,l,e.bl_count)}function d8(e,t,n){var r,i=-1,o,a=t[0*2+1],s=0,l=7,c=4;for(a===0&&(l=138,c=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s<l&&o===a)&&(s<c?e.bl_tree[o*2]+=s:o!==0?(o!==i&&e.bl_tree[o*2]++,e.bl_tree[f8*2]++):s<=10?e.bl_tree[g8*2]++:e.bl_tree[E8*2]++,s=0,i=o,a===0?(l=138,c=3):o===a?(l=6,c=3):(l=7,c=4))}function u8(e,t,n){var r,i=-1,o,a=t[0*2+1],s=0,l=7,c=4;for(a===0&&(l=138,c=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s<l&&o===a)){if(s<c)do Po(e,o,e.bl_tree);while(--s!==0);else o!==0?(o!==i&&(Po(e,o,e.bl_tree),s--),Po(e,f8,e.bl_tree),Cr(e,s-3,2)):s<=10?(Po(e,g8,e.bl_tree),Cr(e,s-3,3)):(Po(e,E8,e.bl_tree),Cr(e,s-11,7));s=0,i=o,a===0?(l=138,c=3):o===a?(l=6,c=3):(l=7,c=4)}}function $U(e){var t;for(d8(e,e.dyn_ltree,e.l_desc.max_code),d8(e,e.dyn_dtree,e.d_desc.max_code),jy(e,e.bl_desc),t=Vy-1;t>=3&&e.bl_tree[b8[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function FU(e,t,n,r){var i;for(Cr(e,t-257,5),Cr(e,n-1,5),Cr(e,r-4,4),i=0;i<r;i++)Cr(e,e.bl_tree[b8[i]*2+1],3);u8(e,e.dyn_ltree,t-1),u8(e,e.dyn_dtree,n-1)}function BU(e){var t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return a8;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return s8;for(n=32;n<Ch;n++)if(e.dyn_ltree[n*2]!==0)return s8;return a8}var h8=!1;function zU(e){h8||(OU(),h8=!0),e.l_desc=new Hy(e.dyn_ltree,y8),e.d_desc=new Hy(e.dyn_dtree,v8),e.bl_desc=new Hy(e.bl_tree,x8),e.bi_buf=0,e.bi_valid=0,C8(e)}function I8(e,t,n,r){Cr(e,(MU<<1)+(r?1:0),3),NU(e,t,n,!0)}function HU(e){Cr(e,m8<<1,3),Po(e,Yy,ma),LU(e)}function GU(e,t,n,r){var i,o,a=0;e.level>0?(e.strm.data_type===CU&&(e.strm.data_type=BU(e)),jy(e,e.l_desc),jy(e,e.d_desc),a=$U(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?I8(e,t,n,r):e.strategy===TU||o===i?(Cr(e,(m8<<1)+(r?1:0),3),c8(e,ma,vh)):(Cr(e,(IU<<1)+(r?1:0),3),FU(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),c8(e,e.dyn_ltree,e.dyn_dtree)),C8(e),r&&M8(e)}function WU(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Sh[n]+Ch+1)*2]++,e.dyn_dtree[w8(t)*2]++),e.last_lit===e.lit_bufsize-1}rd._tr_init=zU;rd._tr_stored_block=I8;rd._tr_flush_block=GU;rd._tr_tally=WU;rd._tr_align=HU});var Xy=Qe((Oie,A8)=>{"use strict";S();function jU(e,t,n,r){for(var i=e&65535|0,o=e>>>16&65535|0,a=0;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0}A8.exports=jU});var Ky=Qe(($ie,_8)=>{"use strict";S();function UU(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var VU=UU();function YU(e,t,n,r){var i=VU,o=r+n;e^=-1;for(var a=r;a<o;a++)e=e>>>8^i[(e^t[a])&255];return e^-1}_8.exports=YU});var e1=Qe((Bie,P8)=>{"use strict";S();P8.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var z8=Qe(Ro=>{"use strict";S();var mr=ha(),di=k8(),O8=Xy(),hs=Ky(),ZU=e1(),$l=0,XU=1,KU=3,Es=4,D8=5,Lo=0,L8=1,ui=-2,qU=-3,qy=-5,QU=-1,JU=1,t1=2,eV=3,tV=4,nV=0,rV=2,o1=8,iV=9,oV=15,aV=8,sV=29,lV=256,Jy=lV+1+sV,cV=30,dV=19,uV=2*Jy+1,hV=15,Ke=3,fs=258,Gi=fs+Ke+1,mV=32,a1=42,ev=69,n1=73,r1=91,i1=103,Rl=113,Ih=666,Tn=1,kh=2,Ol=3,ad=4,pV=3;function gs(e,t){return e.msg=ZU[t],t}function R8(e){return(e<<1)-(e>4?9:0)}function ps(e){for(var t=e.length;--t>=0;)e[t]=0}function ms(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(mr.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function jn(e,t){di._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ms(e.strm)}function nt(e,t){e.pending_buf[e.pending++]=t}function Mh(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function fV(e,t,n,r){var i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,mr.arraySet(t,e.input,e.next_in,i,n),e.state.wrap===1?e.adler=O8(e.adler,t,i,n):e.state.wrap===2&&(e.adler=hs(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)}function N8(e,t){var n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-Gi?e.strstart-(e.w_size-Gi):0,c=e.window,d=e.w_mask,u=e.prev,h=e.strstart+fs,m=c[r+a-1],p=c[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(c[i+a]!==p||c[i+a-1]!==m||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<h);if(o=fs-(h-r),r=h-fs,o>a){if(e.match_start=t,a=o,o>=s)break;m=c[r+a-1],p=c[r+a]}}while((t=u[t&d])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead}function Nl(e){var t=e.w_size,n,r,i,o,a;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Gi)){mr.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,r=e.hash_size,n=r;do i=e.head[--n],e.head[n]=i>=t?i-t:0;while(--r);r=t,n=r;do i=e.prev[--n],e.prev[n]=i>=t?i-t:0;while(--r);o+=t}if(e.strm.avail_in===0)break;if(r=fV(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=r,e.lookahead+e.insert>=Ke)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+Ke-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<Ke)););}while(e.lookahead<Gi&&e.strm.avail_in!==0)}function gV(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Nl(e),e.lookahead===0&&t===$l)return Tn;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,jn(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Gi&&(jn(e,!1),e.strm.avail_out===0))return Tn}return e.insert=0,t===Es?(jn(e,!0),e.strm.avail_out===0?Ol:ad):(e.strstart>e.block_start&&(jn(e,!1),e.strm.avail_out===0),Tn)}function Qy(e,t){for(var n,r;;){if(e.lookahead<Gi){if(Nl(e),e.lookahead<Gi&&t===$l)return Tn;if(e.lookahead===0)break}if(n=0,e.lookahead>=Ke&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ke-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Gi&&(e.match_length=N8(e,n)),e.match_length>=Ke)if(r=di._tr_tally(e,e.strstart-e.match_start,e.match_length-Ke),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Ke){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ke-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=di._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(jn(e,!1),e.strm.avail_out===0))return Tn}return e.insert=e.strstart<Ke-1?e.strstart:Ke-1,t===Es?(jn(e,!0),e.strm.avail_out===0?Ol:ad):e.last_lit&&(jn(e,!1),e.strm.avail_out===0)?Tn:kh}function id(e,t){for(var n,r,i;;){if(e.lookahead<Gi){if(Nl(e),e.lookahead<Gi&&t===$l)return Tn;if(e.lookahead===0)break}if(n=0,e.lookahead>=Ke&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ke-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Ke-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Gi&&(e.match_length=N8(e,n),e.match_length<=5&&(e.strategy===JU||e.match_length===Ke&&e.strstart-e.match_start>4096)&&(e.match_length=Ke-1)),e.prev_length>=Ke&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Ke,r=di._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-Ke),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ke-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Ke-1,e.strstart++,r&&(jn(e,!1),e.strm.avail_out===0))return Tn}else if(e.match_available){if(r=di._tr_tally(e,0,e.window[e.strstart-1]),r&&jn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Tn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=di._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Ke-1?e.strstart:Ke-1,t===Es?(jn(e,!0),e.strm.avail_out===0?Ol:ad):e.last_lit&&(jn(e,!1),e.strm.avail_out===0)?Tn:kh}function EV(e,t){for(var n,r,i,o,a=e.window;;){if(e.lookahead<=fs){if(Nl(e),e.lookahead<=fs&&t===$l)return Tn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Ke&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+fs;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);e.match_length=fs-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Ke?(n=di._tr_tally(e,1,e.match_length-Ke),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=di._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(jn(e,!1),e.strm.avail_out===0))return Tn}return e.insert=0,t===Es?(jn(e,!0),e.strm.avail_out===0?Ol:ad):e.last_lit&&(jn(e,!1),e.strm.avail_out===0)?Tn:kh}function bV(e,t){for(var n;;){if(e.lookahead===0&&(Nl(e),e.lookahead===0)){if(t===$l)return Tn;break}if(e.match_length=0,n=di._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(jn(e,!1),e.strm.avail_out===0))return Tn}return e.insert=0,t===Es?(jn(e,!0),e.strm.avail_out===0?Ol:ad):e.last_lit&&(jn(e,!1),e.strm.avail_out===0)?Tn:kh}function Do(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var od;od=[new Do(0,0,0,0,gV),new Do(4,4,8,4,Qy),new Do(4,5,16,8,Qy),new Do(4,6,32,32,Qy),new Do(4,4,16,16,id),new Do(8,16,32,32,id),new Do(8,16,128,128,id),new Do(8,32,128,256,id),new Do(32,128,258,1024,id),new Do(32,258,258,4096,id)];function yV(e){e.window_size=2*e.w_size,ps(e.head),e.max_lazy_match=od[e.level].max_lazy,e.good_match=od[e.level].good_length,e.nice_match=od[e.level].nice_length,e.max_chain_length=od[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Ke-1,e.match_available=0,e.ins_h=0}function vV(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=o1,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new mr.Buf16(uV*2),this.dyn_dtree=new mr.Buf16((2*cV+1)*2),this.bl_tree=new mr.Buf16((2*dV+1)*2),ps(this.dyn_ltree),ps(this.dyn_dtree),ps(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new mr.Buf16(hV+1),this.heap=new mr.Buf16(2*Jy+1),ps(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new mr.Buf16(2*Jy+1),ps(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function $8(e){var t;return!e||!e.state?gs(e,ui):(e.total_in=e.total_out=0,e.data_type=rV,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?a1:Rl,e.adler=t.wrap===2?0:1,t.last_flush=$l,di._tr_init(t),Lo)}function F8(e){var t=$8(e);return t===Lo&&yV(e.state),t}function xV(e,t){return!e||!e.state||e.state.wrap!==2?ui:(e.state.gzhead=t,Lo)}function B8(e,t,n,r,i,o){if(!e)return ui;var a=1;if(t===QU&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>iV||n!==o1||r<8||r>15||t<0||t>9||o<0||o>tV)return gs(e,ui);r===8&&(r=9);var s=new vV;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+Ke-1)/Ke),s.window=new mr.Buf8(s.w_size*2),s.head=new mr.Buf16(s.hash_size),s.prev=new mr.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new mr.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=n,F8(e)}function wV(e,t){return B8(e,t,o1,oV,aV,nV)}function SV(e,t){var n,r,i,o;if(!e||!e.state||t>D8||t<0)return e?gs(e,ui):ui;if(r=e.state,!e.output||!e.input&&e.avail_in!==0||r.status===Ih&&t!==Es)return gs(e,e.avail_out===0?qy:ui);if(r.strm=e,n=r.last_flush,r.last_flush=t,r.status===a1)if(r.wrap===2)e.adler=0,nt(r,31),nt(r,139),nt(r,8),r.gzhead?(nt(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),nt(r,r.gzhead.time&255),nt(r,r.gzhead.time>>8&255),nt(r,r.gzhead.time>>16&255),nt(r,r.gzhead.time>>24&255),nt(r,r.level===9?2:r.strategy>=t1||r.level<2?4:0),nt(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(nt(r,r.gzhead.extra.length&255),nt(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=hs(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=ev):(nt(r,0),nt(r,0),nt(r,0),nt(r,0),nt(r,0),nt(r,r.level===9?2:r.strategy>=t1||r.level<2?4:0),nt(r,pV),r.status=Rl);else{var a=o1+(r.w_bits-8<<4)<<8,s=-1;r.strategy>=t1||r.level<2?s=0:r.level<6?s=1:r.level===6?s=2:s=3,a|=s<<6,r.strstart!==0&&(a|=mV),a+=31-a%31,r.status=Rl,Mh(r,a),r.strstart!==0&&(Mh(r,e.adler>>>16),Mh(r,e.adler&65535)),e.adler=1}if(r.status===ev)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=hs(e.adler,r.pending_buf,r.pending-i,i)),ms(e),i=r.pending,r.pending===r.pending_buf_size));)nt(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=hs(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=n1)}else r.status=n1;if(r.status===n1)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=hs(e.adler,r.pending_buf,r.pending-i,i)),ms(e),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}r.gzindex<r.gzhead.name.length?o=r.gzhead.name.charCodeAt(r.gzindex++)&255:o=0,nt(r,o)}while(o!==0);r.gzhead.hcrc&&r.pending>i&&(e.adler=hs(e.adler,r.pending_buf,r.pending-i,i)),o===0&&(r.gzindex=0,r.status=r1)}else r.status=r1;if(r.status===r1)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=hs(e.adler,r.pending_buf,r.pending-i,i)),ms(e),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}r.gzindex<r.gzhead.comment.length?o=r.gzhead.comment.charCodeAt(r.gzindex++)&255:o=0,nt(r,o)}while(o!==0);r.gzhead.hcrc&&r.pending>i&&(e.adler=hs(e.adler,r.pending_buf,r.pending-i,i)),o===0&&(r.status=i1)}else r.status=i1;if(r.status===i1&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&ms(e),r.pending+2<=r.pending_buf_size&&(nt(r,e.adler&255),nt(r,e.adler>>8&255),e.adler=0,r.status=Rl)):r.status=Rl),r.pending!==0){if(ms(e),e.avail_out===0)return r.last_flush=-1,Lo}else if(e.avail_in===0&&R8(t)<=R8(n)&&t!==Es)return gs(e,qy);if(r.status===Ih&&e.avail_in!==0)return gs(e,qy);if(e.avail_in!==0||r.lookahead!==0||t!==$l&&r.status!==Ih){var l=r.strategy===t1?bV(r,t):r.strategy===eV?EV(r,t):od[r.level].func(r,t);if((l===Ol||l===ad)&&(r.status=Ih),l===Tn||l===Ol)return e.avail_out===0&&(r.last_flush=-1),Lo;if(l===kh&&(t===XU?di._tr_align(r):t!==D8&&(di._tr_stored_block(r,0,0,!1),t===KU&&(ps(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),ms(e),e.avail_out===0))return r.last_flush=-1,Lo}return t!==Es?Lo:r.wrap<=0?L8:(r.wrap===2?(nt(r,e.adler&255),nt(r,e.adler>>8&255),nt(r,e.adler>>16&255),nt(r,e.adler>>24&255),nt(r,e.total_in&255),nt(r,e.total_in>>8&255),nt(r,e.total_in>>16&255),nt(r,e.total_in>>24&255)):(Mh(r,e.adler>>>16),Mh(r,e.adler&65535)),ms(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Lo:L8)}function TV(e){var t;return!e||!e.state?ui:(t=e.state.status,t!==a1&&t!==ev&&t!==n1&&t!==r1&&t!==i1&&t!==Rl&&t!==Ih?gs(e,ui):(e.state=null,t===Rl?gs(e,qU):Lo))}function CV(e,t){var n=t.length,r,i,o,a,s,l,c,d;if(!e||!e.state||(r=e.state,a=r.wrap,a===2||a===1&&r.status!==a1||r.lookahead))return ui;for(a===1&&(e.adler=O8(e.adler,t,n,0)),r.wrap=0,n>=r.w_size&&(a===0&&(ps(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new mr.Buf8(r.w_size),mr.arraySet(d,t,n-r.w_size,r.w_size,0),t=d,n=r.w_size),s=e.avail_in,l=e.next_in,c=e.input,e.avail_in=n,e.next_in=0,e.input=t,Nl(r);r.lookahead>=Ke;){i=r.strstart,o=r.lookahead-(Ke-1);do r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+Ke-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++;while(--o);r.strstart=i,r.lookahead=Ke-1,Nl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Ke-1,r.match_available=0,e.next_in=l,e.input=c,e.avail_in=s,r.wrap=a,Lo}Ro.deflateInit=wV;Ro.deflateInit2=B8;Ro.deflateReset=F8;Ro.deflateResetKeep=$8;Ro.deflateSetHeader=xV;Ro.deflate=SV;Ro.deflateEnd=TV;Ro.deflateSetDictionary=CV;Ro.deflateInfo="pako deflate (from Nodeca project)"});var tv=Qe(sd=>{"use strict";S();var s1=ha(),H8=!0,G8=!0;try{String.fromCharCode.apply(null,[0])}catch{H8=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{G8=!1}var Ah=new s1.Buf8(256);for(pa=0;pa<256;pa++)Ah[pa]=pa>=252?6:pa>=248?5:pa>=240?4:pa>=224?3:pa>=192?2:1;var pa;Ah[254]=Ah[254]=1;sd.string2buf=function(e){var t,n,r,i,o,a=e.length,s=0;for(i=0;i<a;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<a&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new s1.Buf8(s),o=0,i=0;o<s;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<a&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};function W8(e,t){if(t<65534&&(e.subarray&&G8||!e.subarray&&H8))return String.fromCharCode.apply(null,s1.shrinkBuf(e,t));for(var n="",r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n}sd.buf2binstring=function(e){return W8(e,e.length)};sd.binstring2buf=function(e){for(var t=new s1.Buf8(e.length),n=0,r=t.length;n<r;n++)t[n]=e.charCodeAt(n);return t};sd.buf2string=function(e,t){var n,r,i,o,a=t||e.length,s=new Array(a*2);for(r=0,n=0;n<a;){if(i=e[n++],i<128){s[r++]=i;continue}if(o=Ah[i],o>4){s[r++]=65533,n+=o-1;continue}for(i&=o===2?31:o===3?15:7;o>1&&n<a;)i=i<<6|e[n++]&63,o--;if(o>1){s[r++]=65533;continue}i<65536?s[r++]=i:(i-=65536,s[r++]=55296|i>>10&1023,s[r++]=56320|i&1023)}return W8(s,r)};sd.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+Ah[e[n]]>t?n:t}});var nv=Qe((Uie,j8)=>{"use strict";S();function MV(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}j8.exports=MV});var Z8=Qe(Dh=>{"use strict";S();var _h=z8(),Ph=ha(),iv=tv(),ov=e1(),IV=nv(),Y8=Object.prototype.toString,kV=0,rv=4,ld=0,U8=1,V8=2,AV=-1,_V=0,PV=8;function Fl(e){if(!(this instanceof Fl))return new Fl(e);this.options=Ph.assign({level:AV,method:PV,chunkSize:16384,windowBits:15,memLevel:8,strategy:_V,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new IV,this.strm.avail_out=0;var n=_h.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==ld)throw new Error(ov[n]);if(t.header&&_h.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(typeof t.dictionary=="string"?r=iv.string2buf(t.dictionary):Y8.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=_h.deflateSetDictionary(this.strm,r),n!==ld)throw new Error(ov[n]);this._dict_set=!0}}Fl.prototype.push=function(e,t){var n=this.strm,r=this.options.chunkSize,i,o;if(this.ended)return!1;o=t===~~t?t:t===!0?rv:kV,typeof e=="string"?n.input=iv.string2buf(e):Y8.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Ph.Buf8(r),n.next_out=0,n.avail_out=r),i=_h.deflate(n,o),i!==U8&&i!==ld)return this.onEnd(i),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(o===rv||o===V8))&&(this.options.to==="string"?this.onData(iv.buf2binstring(Ph.shrinkBuf(n.output,n.next_out))):this.onData(Ph.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&i!==U8);return o===rv?(i=_h.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ld):(o===V8&&(this.onEnd(ld),n.avail_out=0),!0)};Fl.prototype.onData=function(e){this.chunks.push(e)};Fl.prototype.onEnd=function(e){e===ld&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ph.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function av(e,t){var n=new Fl(t);if(n.push(e,!0),n.err)throw n.msg||ov[n.err];return n.result}function DV(e,t){return t=t||{},t.raw=!0,av(e,t)}function LV(e,t){return t=t||{},t.gzip=!0,av(e,t)}Dh.Deflate=Fl;Dh.deflate=av;Dh.deflateRaw=DV;Dh.gzip=LV});var K8=Qe((Xie,X8)=>{"use strict";S();var l1=30,RV=12;X8.exports=function(t,n){var r,i,o,a,s,l,c,d,u,h,m,p,f,g,b,v,y,w,T,k,M,C,P,R,A;r=t.state,i=t.next_in,R=t.input,o=i+(t.avail_in-5),a=t.next_out,A=t.output,s=a-(n-t.avail_out),l=a+(t.avail_out-257),c=r.dmax,d=r.wsize,u=r.whave,h=r.wnext,m=r.window,p=r.hold,f=r.bits,g=r.lencode,b=r.distcode,v=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),w=g[p&v];t:for(;;){if(T=w>>>24,p>>>=T,f-=T,T=w>>>16&255,T===0)A[a++]=w&65535;else if(T&16){k=w&65535,T&=15,T&&(f<T&&(p+=R[i++]<<f,f+=8),k+=p&(1<<T)-1,p>>>=T,f-=T),f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),w=b[p&y];n:for(;;){if(T=w>>>24,p>>>=T,f-=T,T=w>>>16&255,T&16){if(M=w&65535,T&=15,f<T&&(p+=R[i++]<<f,f+=8,f<T&&(p+=R[i++]<<f,f+=8)),M+=p&(1<<T)-1,M>c){t.msg="invalid distance too far back",r.mode=l1;break e}if(p>>>=T,f-=T,T=a-s,M>T){if(T=M-T,T>u&&r.sane){t.msg="invalid distance too far back",r.mode=l1;break e}if(C=0,P=m,h===0){if(C+=d-T,T<k){k-=T;do A[a++]=m[C++];while(--T);C=a-M,P=A}}else if(h<T){if(C+=d+h-T,T-=h,T<k){k-=T;do A[a++]=m[C++];while(--T);if(C=0,h<k){T=h,k-=T;do A[a++]=m[C++];while(--T);C=a-M,P=A}}}else if(C+=h-T,T<k){k-=T;do A[a++]=m[C++];while(--T);C=a-M,P=A}for(;k>2;)A[a++]=P[C++],A[a++]=P[C++],A[a++]=P[C++],k-=3;k&&(A[a++]=P[C++],k>1&&(A[a++]=P[C++]))}else{C=a-M;do A[a++]=A[C++],A[a++]=A[C++],A[a++]=A[C++],k-=3;while(k>2);k&&(A[a++]=A[C++],k>1&&(A[a++]=A[C++]))}}else if(T&64){t.msg="invalid distance code",r.mode=l1;break e}else{w=b[(w&65535)+(p&(1<<T)-1)];continue n}break}}else if(T&64)if(T&32){r.mode=RV;break e}else{t.msg="invalid literal/length code",r.mode=l1;break e}else{w=g[(w&65535)+(p&(1<<T)-1)];continue t}break}}while(i<o&&a<l);k=f>>3,i-=k,f-=k<<3,p&=(1<<f)-1,t.next_in=i,t.next_out=a,t.avail_in=i<o?5+(o-i):5-(i-o),t.avail_out=a<l?257+(l-a):257-(a-l),r.hold=p,r.bits=f}});var rk=Qe((qie,nk)=>{"use strict";S();var q8=ha(),cd=15,Q8=852,J8=592,ek=0,sv=1,tk=2,OV=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],NV=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],$V=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],FV=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];nk.exports=function(t,n,r,i,o,a,s,l){var c=l.bits,d=0,u=0,h=0,m=0,p=0,f=0,g=0,b=0,v=0,y=0,w,T,k,M,C,P=null,R=0,A,_=new q8.Buf16(cd+1),$=new q8.Buf16(cd+1),W=null,H=0,K,Q,ie;for(d=0;d<=cd;d++)_[d]=0;for(u=0;u<i;u++)_[n[r+u]]++;for(p=c,m=cd;m>=1&&_[m]===0;m--);if(p>m&&(p=m),m===0)return o[a++]=1<<24|64<<16|0,o[a++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h<m&&_[h]===0;h++);for(p<h&&(p=h),b=1,d=1;d<=cd;d++)if(b<<=1,b-=_[d],b<0)return-1;if(b>0&&(t===ek||m!==1))return-1;for($[1]=0,d=1;d<cd;d++)$[d+1]=$[d]+_[d];for(u=0;u<i;u++)n[r+u]!==0&&(s[$[n[r+u]]++]=u);if(t===ek?(P=W=s,A=19):t===sv?(P=OV,R-=257,W=NV,H-=257,A=256):(P=$V,W=FV,A=-1),y=0,u=0,d=h,C=a,f=p,g=0,k=-1,v=1<<p,M=v-1,t===sv&&v>Q8||t===tk&&v>J8)return 1;for(;;){K=d-g,s[u]<A?(Q=0,ie=s[u]):s[u]>A?(Q=W[H+s[u]],ie=P[R+s[u]]):(Q=96,ie=0),w=1<<d-g,T=1<<f,h=T;do T-=w,o[C+(y>>g)+T]=K<<24|Q<<16|ie|0;while(T!==0);for(w=1<<d-1;y&w;)w>>=1;if(w!==0?(y&=w-1,y+=w):y=0,u++,--_[d]===0){if(d===m)break;d=n[r+s[u]]}if(d>p&&(y&M)!==k){for(g===0&&(g=p),C+=h,f=d-g,b=1<<f;f+g<m&&(b-=_[f+g],!(b<=0));)f++,b<<=1;if(v+=1<<f,t===sv&&v>Q8||t===tk&&v>J8)return 1;k=y&M,o[k]=p<<24|f<<16|C-a|0}}return y!==0&&(o[C+y]=d-g<<24|64<<16|0),l.bits=p,0}});var Fk=Qe(Wi=>{"use strict";S();var Br=ha(),mv=Xy(),Oo=Ky(),BV=K8(),Lh=rk(),zV=0,Ak=1,_k=2,ik=4,HV=5,c1=6,Bl=0,GV=1,WV=2,hi=-2,Pk=-3,pv=-4,jV=-5,ok=8,Dk=1,ak=2,sk=3,lk=4,ck=5,dk=6,uk=7,hk=8,mk=9,pk=10,h1=11,fa=12,lv=13,fk=14,cv=15,gk=16,Ek=17,bk=18,yk=19,d1=20,u1=21,vk=22,xk=23,wk=24,Sk=25,Tk=26,dv=27,Ck=28,Mk=29,Ut=30,fv=31,UV=32,VV=852,YV=592,ZV=15,XV=ZV;function Ik(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function KV(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Br.Buf16(320),this.work=new Br.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Lk(e){var t;return!e||!e.state?hi:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Dk,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Br.Buf32(VV),t.distcode=t.distdyn=new Br.Buf32(YV),t.sane=1,t.back=-1,Bl)}function Rk(e){var t;return!e||!e.state?hi:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Lk(e))}function Ok(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?hi:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Rk(e))}function Nk(e,t){var n,r;return e?(r=new KV,e.state=r,r.window=null,n=Ok(e,t),n!==Bl&&(e.state=null),n):hi}function qV(e){return Nk(e,XV)}var kk=!0,uv,hv;function QV(e){if(kk){var t;for(uv=new Br.Buf32(512),hv=new Br.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Lh(Ak,e.lens,0,288,uv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Lh(_k,e.lens,0,32,hv,0,e.work,{bits:5}),kk=!1}e.lencode=uv,e.lenbits=9,e.distcode=hv,e.distbits=5}function $k(e,t,n,r){var i,o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Br.Buf8(o.wsize)),r>=o.wsize?(Br.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),Br.arraySet(o.window,t,n-r,i,o.wnext),r-=i,r?(Br.arraySet(o.window,t,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}function JV(e,t){var n,r,i,o,a,s,l,c,d,u,h,m,p,f,g=0,b,v,y,w,T,k,M,C,P=new Br.Buf8(4),R,A,_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return hi;n=e.state,n.mode===fa&&(n.mode=lv),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,c=n.hold,d=n.bits,u=s,h=l,C=Bl;e:for(;;)switch(n.mode){case Dk:if(n.wrap===0){n.mode=lv;break}for(;d<16;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(n.wrap&2&&c===35615){n.check=0,P[0]=c&255,P[1]=c>>>8&255,n.check=Oo(n.check,P,2,0),c=0,d=0,n.mode=ak;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Ut;break}if((c&15)!==ok){e.msg="unknown compression method",n.mode=Ut;break}if(c>>>=4,d-=4,M=(c&15)+8,n.wbits===0)n.wbits=M;else if(M>n.wbits){e.msg="invalid window size",n.mode=Ut;break}n.dmax=1<<M,e.adler=n.check=1,n.mode=c&512?pk:fa,c=0,d=0;break;case ak:for(;d<16;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(n.flags=c,(n.flags&255)!==ok){e.msg="unknown compression method",n.mode=Ut;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Ut;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&(P[0]=c&255,P[1]=c>>>8&255,n.check=Oo(n.check,P,2,0)),c=0,d=0,n.mode=sk;case sk:for(;d<32;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}n.head&&(n.head.time=c),n.flags&512&&(P[0]=c&255,P[1]=c>>>8&255,P[2]=c>>>16&255,P[3]=c>>>24&255,n.check=Oo(n.check,P,4,0)),c=0,d=0,n.mode=lk;case lk:for(;d<16;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&(P[0]=c&255,P[1]=c>>>8&255,n.check=Oo(n.check,P,2,0)),c=0,d=0,n.mode=ck;case ck:if(n.flags&1024){for(;d<16;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&(P[0]=c&255,P[1]=c>>>8&255,n.check=Oo(n.check,P,2,0)),c=0,d=0}else n.head&&(n.head.extra=null);n.mode=dk;case dk:if(n.flags&1024&&(m=n.length,m>s&&(m=s),m&&(n.head&&(M=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Br.arraySet(n.head.extra,r,o,m,M)),n.flags&512&&(n.check=Oo(n.check,r,m,o)),s-=m,o+=m,n.length-=m),n.length))break e;n.length=0,n.mode=uk;case uk:if(n.flags&2048){if(s===0)break e;m=0;do M=r[o+m++],n.head&&M&&n.length<65536&&(n.head.name+=String.fromCharCode(M));while(M&&m<s);if(n.flags&512&&(n.check=Oo(n.check,r,m,o)),s-=m,o+=m,M)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=hk;case hk:if(n.flags&4096){if(s===0)break e;m=0;do M=r[o+m++],n.head&&M&&n.length<65536&&(n.head.comment+=String.fromCharCode(M));while(M&&m<s);if(n.flags&512&&(n.check=Oo(n.check,r,m,o)),s-=m,o+=m,M)break e}else n.head&&(n.head.comment=null);n.mode=mk;case mk:if(n.flags&512){for(;d<16;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(c!==(n.check&65535)){e.msg="header crc mismatch",n.mode=Ut;break}c=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=fa;break;case pk:for(;d<32;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}e.adler=n.check=Ik(c),c=0,d=0,n.mode=h1;case h1:if(n.havedict===0)return e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=c,n.bits=d,WV;e.adler=n.check=1,n.mode=fa;case fa:if(t===HV||t===c1)break e;case lv:if(n.last){c>>>=d&7,d-=d&7,n.mode=dv;break}for(;d<3;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}switch(n.last=c&1,c>>>=1,d-=1,c&3){case 0:n.mode=fk;break;case 1:if(QV(n),n.mode=d1,t===c1){c>>>=2,d-=2;break e}break;case 2:n.mode=Ek;break;case 3:e.msg="invalid block type",n.mode=Ut}c>>>=2,d-=2;break;case fk:for(c>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Ut;break}if(n.length=c&65535,c=0,d=0,n.mode=cv,t===c1)break e;case cv:n.mode=gk;case gk:if(m=n.length,m){if(m>s&&(m=s),m>l&&(m=l),m===0)break e;Br.arraySet(i,r,o,m,a),s-=m,o+=m,l-=m,a+=m,n.length-=m;break}n.mode=fa;break;case Ek:for(;d<14;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(n.nlen=(c&31)+257,c>>>=5,d-=5,n.ndist=(c&31)+1,c>>>=5,d-=5,n.ncode=(c&15)+4,c>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Ut;break}n.have=0,n.mode=bk;case bk:for(;n.have<n.ncode;){for(;d<3;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}n.lens[_[n.have++]]=c&7,c>>>=3,d-=3}for(;n.have<19;)n.lens[_[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,R={bits:n.lenbits},C=Lh(zV,n.lens,0,19,n.lencode,0,n.work,R),n.lenbits=R.bits,C){e.msg="invalid code lengths set",n.mode=Ut;break}n.have=0,n.mode=yk;case yk:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[c&(1<<n.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(y<16)c>>>=b,d-=b,n.lens[n.have++]=y;else{if(y===16){for(A=b+2;d<A;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(c>>>=b,d-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=Ut;break}M=n.lens[n.have-1],m=3+(c&3),c>>>=2,d-=2}else if(y===17){for(A=b+3;d<A;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}c>>>=b,d-=b,M=0,m=3+(c&7),c>>>=3,d-=3}else{for(A=b+7;d<A;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}c>>>=b,d-=b,M=0,m=11+(c&127),c>>>=7,d-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Ut;break}for(;m--;)n.lens[n.have++]=M}}if(n.mode===Ut)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Ut;break}if(n.lenbits=9,R={bits:n.lenbits},C=Lh(Ak,n.lens,0,n.nlen,n.lencode,0,n.work,R),n.lenbits=R.bits,C){e.msg="invalid literal/lengths set",n.mode=Ut;break}if(n.distbits=6,n.distcode=n.distdyn,R={bits:n.distbits},C=Lh(_k,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,R),n.distbits=R.bits,C){e.msg="invalid distances set",n.mode=Ut;break}if(n.mode=d1,t===c1)break e;case d1:n.mode=u1;case u1:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=c,n.bits=d,BV(e,h),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,c=n.hold,d=n.bits,n.mode===fa&&(n.back=-1);break}for(n.back=0;g=n.lencode[c&(1<<n.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(v&&!(v&240)){for(w=b,T=v,k=y;g=n.lencode[k+((c&(1<<w+T)-1)>>w)],b=g>>>24,v=g>>>16&255,y=g&65535,!(w+b<=d);){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}c>>>=w,d-=w,n.back+=w}if(c>>>=b,d-=b,n.back+=b,n.length=y,v===0){n.mode=Tk;break}if(v&32){n.back=-1,n.mode=fa;break}if(v&64){e.msg="invalid literal/length code",n.mode=Ut;break}n.extra=v&15,n.mode=vk;case vk:if(n.extra){for(A=n.extra;d<A;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=xk;case xk:for(;g=n.distcode[c&(1<<n.distbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(!(v&240)){for(w=b,T=v,k=y;g=n.distcode[k+((c&(1<<w+T)-1)>>w)],b=g>>>24,v=g>>>16&255,y=g&65535,!(w+b<=d);){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}c>>>=w,d-=w,n.back+=w}if(c>>>=b,d-=b,n.back+=b,v&64){e.msg="invalid distance code",n.mode=Ut;break}n.offset=y,n.extra=v&15,n.mode=wk;case wk:if(n.extra){for(A=n.extra;d<A;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Ut;break}n.mode=Sk;case Sk:if(l===0)break e;if(m=h-l,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Ut;break}m>n.wnext?(m-=n.wnext,p=n.wsize-m):p=n.wnext-m,m>n.length&&(m=n.length),f=n.window}else f=i,p=a-n.offset,m=n.length;m>l&&(m=l),l-=m,n.length-=m;do i[a++]=f[p++];while(--m);n.length===0&&(n.mode=u1);break;case Tk:if(l===0)break e;i[a++]=n.length,l--,n.mode=u1;break;case dv:if(n.wrap){for(;d<32;){if(s===0)break e;s--,c|=r[o++]<<d,d+=8}if(h-=l,e.total_out+=h,n.total+=h,h&&(e.adler=n.check=n.flags?Oo(n.check,i,h,a-h):mv(n.check,i,h,a-h)),h=l,(n.flags?c:Ik(c))!==n.check){e.msg="incorrect data check",n.mode=Ut;break}c=0,d=0}n.mode=Ck;case Ck:if(n.wrap&&n.flags){for(;d<32;){if(s===0)break e;s--,c+=r[o++]<<d,d+=8}if(c!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=Ut;break}c=0,d=0}n.mode=Mk;case Mk:C=GV;break e;case Ut:C=Pk;break e;case fv:return pv;case UV:default:return hi}return e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=c,n.bits=d,(n.wsize||h!==e.avail_out&&n.mode<Ut&&(n.mode<dv||t!==ik))&&$k(e,e.output,e.next_out,h-e.avail_out)?(n.mode=fv,pv):(u-=e.avail_in,h-=e.avail_out,e.total_in+=u,e.total_out+=h,n.total+=h,n.wrap&&h&&(e.adler=n.check=n.flags?Oo(n.check,i,h,e.next_out-h):mv(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===fa?128:0)+(n.mode===d1||n.mode===cv?256:0),(u===0&&h===0||t===ik)&&C===Bl&&(C=jV),C)}function eY(e){if(!e||!e.state)return hi;var t=e.state;return t.window&&(t.window=null),e.state=null,Bl}function tY(e,t){var n;return!e||!e.state||(n=e.state,!(n.wrap&2))?hi:(n.head=t,t.done=!1,Bl)}function nY(e,t){var n=t.length,r,i,o;return!e||!e.state||(r=e.state,r.wrap!==0&&r.mode!==h1)?hi:r.mode===h1&&(i=1,i=mv(i,t,n,0),i!==r.check)?Pk:(o=$k(e,t,n,n),o?(r.mode=fv,pv):(r.havedict=1,Bl))}Wi.inflateReset=Rk;Wi.inflateReset2=Ok;Wi.inflateResetKeep=Lk;Wi.inflateInit=qV;Wi.inflateInit2=Nk;Wi.inflate=JV;Wi.inflateEnd=eY;Wi.inflateGetHeader=tY;Wi.inflateSetDictionary=nY;Wi.inflateInfo="pako inflate (from Nodeca project)"});var gv=Qe((toe,Bk)=>{"use strict";S();Bk.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Hk=Qe((roe,zk)=>{"use strict";S();function rY(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}zk.exports=rY});var Wk=Qe(Oh=>{"use strict";S();var dd=Fk(),Rh=ha(),m1=tv(),an=gv(),Ev=e1(),iY=nv(),oY=Hk(),Gk=Object.prototype.toString;function zl(e){if(!(this instanceof zl))return new zl(e);this.options=Rh.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new iY,this.strm.avail_out=0;var n=dd.inflateInit2(this.strm,t.windowBits);if(n!==an.Z_OK)throw new Error(Ev[n]);if(this.header=new oY,dd.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=m1.string2buf(t.dictionary):Gk.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=dd.inflateSetDictionary(this.strm,t.dictionary),n!==an.Z_OK)))throw new Error(Ev[n])}zl.prototype.push=function(e,t){var n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,o,a,s,l,c,d=!1;if(this.ended)return!1;a=t===~~t?t:t===!0?an.Z_FINISH:an.Z_NO_FLUSH,typeof e=="string"?n.input=m1.binstring2buf(e):Gk.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Rh.Buf8(r),n.next_out=0,n.avail_out=r),o=dd.inflate(n,an.Z_NO_FLUSH),o===an.Z_NEED_DICT&&i&&(o=dd.inflateSetDictionary(this.strm,i)),o===an.Z_BUF_ERROR&&d===!0&&(o=an.Z_OK,d=!1),o!==an.Z_STREAM_END&&o!==an.Z_OK)return this.onEnd(o),this.ended=!0,!1;n.next_out&&(n.avail_out===0||o===an.Z_STREAM_END||n.avail_in===0&&(a===an.Z_FINISH||a===an.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=m1.utf8border(n.output,n.next_out),l=n.next_out-s,c=m1.buf2string(n.output,s),n.next_out=l,n.avail_out=r-l,l&&Rh.arraySet(n.output,n.output,s,l,0),this.onData(c)):this.onData(Rh.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(d=!0)}while((n.avail_in>0||n.avail_out===0)&&o!==an.Z_STREAM_END);return o===an.Z_STREAM_END&&(a=an.Z_FINISH),a===an.Z_FINISH?(o=dd.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===an.Z_OK):(a===an.Z_SYNC_FLUSH&&(this.onEnd(an.Z_OK),n.avail_out=0),!0)};zl.prototype.onData=function(e){this.chunks.push(e)};zl.prototype.onEnd=function(e){e===an.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Rh.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function bv(e,t){var n=new zl(t);if(n.push(e,!0),n.err)throw n.msg||Ev[n.err];return n.result}function aY(e,t){return t=t||{},t.raw=!0,bv(e,t)}Oh.Inflate=zl;Oh.inflate=bv;Oh.inflateRaw=aY;Oh.ungzip=bv});var yv=Qe((soe,Uk)=>{"use strict";S();var sY=ha().assign,lY=Z8(),cY=Wk(),dY=gv(),jk={};sY(jk,lY,cY,dY);Uk.exports=jk});var Lx=Qe(E0=>{"use strict";S();Object.defineProperty(E0,"__esModule",{value:!0});E0.sanitizeUrl=void 0;var pX=/^([^\w]*)(javascript|data|vbscript)/im,fX=/&#(\w+)(^\w|;)?/g,gX=/&(newline|tab);/gi,EX=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,bX=/^.+(:|&colon;)/gim,yX=[".","/"];function vX(e){return yX.indexOf(e[0])>-1}function xX(e){return e.replace(fX,function(t,n){return String.fromCharCode(n)})}function wX(e){var t=xX(e||"").replace(gX,"").replace(EX,"").trim();if(!t)return"about:blank";if(vX(t))return t;var n=t.match(bX);if(!n)return t;var r=n[0];return pX.test(r)?"about:blank":t}E0.sanitizeUrl=wX});var q=Qe((bfe,X_)=>{S();X_.exports=React});var nP=Qe(F0=>{"use strict";S();var IK=q(),kK=Symbol.for("react.element"),AK=Symbol.for("react.fragment"),_K=Object.prototype.hasOwnProperty,PK=IK.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,DK={key:!0,ref:!0,__self:!0,__source:!0};function tP(e,t,n){var r,i={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)_K.call(t,r)&&!DK.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:kK,type:e,key:o,ref:a,props:i,_owner:PK.current}}F0.Fragment=AK;F0.jsx=tP;F0.jsxs=tP});var j=Qe((Ife,rP)=>{"use strict";S();rP.exports=nP()});var jo=Qe((Pfe,oP)=>{S();oP.exports=ReactDOM});var Nw=Qe((d2e,HD)=>{S();var zD="Expected a function",FD=NaN,oQ="[object Symbol]",aQ=/^\s+|\s+$/g,sQ=/^[-+]0x[0-9a-f]+$/i,lQ=/^0b[01]+$/i,cQ=/^0o[0-7]+$/i,dQ=parseInt,uQ=typeof global=="object"&&global&&global.Object===Object&&global,hQ=typeof self=="object"&&self&&self.Object===Object&&self,mQ=uQ||hQ||Function("return this")(),pQ=Object.prototype,fQ=pQ.toString,gQ=Math.max,EQ=Math.min,Ow=function(){return mQ.Date.now()};function bQ(e,t,n){var r,i,o,a,s,l,c=0,d=!1,u=!1,h=!0;if(typeof e!="function")throw new TypeError(zD);t=BD(t)||0,ag(n)&&(d=!!n.leading,u="maxWait"in n,o=u?gQ(BD(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h);function m(k){var M=r,C=i;return r=i=void 0,c=k,a=e.apply(C,M),a}function p(k){return c=k,s=setTimeout(b,t),d?m(k):a}function f(k){var M=k-l,C=k-c,P=t-M;return u?EQ(P,o-C):P}function g(k){var M=k-l,C=k-c;return l===void 0||M>=t||M<0||u&&C>=o}function b(){var k=Ow();if(g(k))return v(k);s=setTimeout(b,f(k))}function v(k){return s=void 0,h&&r?m(k):(r=i=void 0,a)}function y(){s!==void 0&&clearTimeout(s),c=0,r=l=i=s=void 0}function w(){return s===void 0?a:v(Ow())}function T(){var k=Ow(),M=g(k);if(r=arguments,i=this,l=k,M){if(s===void 0)return p(l);if(u)return s=setTimeout(b,t),m(l)}return s===void 0&&(s=setTimeout(b,t)),a}return T.cancel=y,T.flush=w,T}function yQ(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(zD);return ag(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),bQ(e,t,{leading:r,maxWait:t,trailing:i})}function ag(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function vQ(e){return!!e&&typeof e=="object"}function xQ(e){return typeof e=="symbol"||vQ(e)&&fQ.call(e)==oQ}function BD(e){if(typeof e=="number")return e;if(xQ(e))return FD;if(ag(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ag(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(aQ,"");var n=lQ.test(e);return n||cQ.test(e)?dQ(e.slice(2),n?2:8):sQ.test(e)?FD:+e}HD.exports=yQ});var UD=Qe(jD=>{"use strict";S();var zd=q();function wQ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var SQ=typeof Object.is=="function"?Object.is:wQ,TQ=zd.useState,CQ=zd.useEffect,MQ=zd.useLayoutEffect,IQ=zd.useDebugValue;function kQ(e,t){var n=t(),r=TQ({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return MQ(function(){i.value=n,i.getSnapshot=t,$w(i)&&o({inst:i})},[e,n,t]),CQ(function(){return $w(i)&&o({inst:i}),e(function(){$w(i)&&o({inst:i})})},[e]),IQ(n),n}function $w(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!SQ(e,n)}catch{return!0}}function AQ(e,t){return t()}var _Q=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?AQ:kQ;jD.useSyncExternalStore=zd.useSyncExternalStore!==void 0?zd.useSyncExternalStore:_Q});var YD=Qe((g2e,VD)=>{"use strict";S();VD.exports=UD()});var XD=Qe(ZD=>{"use strict";S();var sg=q(),PQ=YD();function DQ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var LQ=typeof Object.is=="function"?Object.is:DQ,RQ=PQ.useSyncExternalStore,OQ=sg.useRef,NQ=sg.useEffect,$Q=sg.useMemo,FQ=sg.useDebugValue;ZD.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=OQ(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=$Q(function(){function l(m){if(!c){if(c=!0,d=m,m=r(m),i!==void 0&&a.hasValue){var p=a.value;if(i(p,m))return u=p}return u=m}if(p=u,LQ(d,m))return p;var f=r(m);return i!==void 0&&i(p,f)?p:(d=m,u=f)}var c=!1,d,u,h=n===void 0?null:n;return[function(){return l(t())},h===null?void 0:function(){return l(h())}]},[t,n,r,i]);var s=RQ(e,o[0],o[1]);return NQ(function(){a.hasValue=!0,a.value=s},[s]),FQ(s),s}});var qD=Qe((v2e,KD)=>{"use strict";S();KD.exports=XD()});var l9=Qe((a9,s9)=>{S();(function(){var e=this,t={};typeof a9<"u"?s9.exports=t:e.fuzzy=t,t.simpleFilter=function(n,r){return r.filter(function(i){return t.test(n,i)})},t.test=function(n,r){return t.match(n,r)!==null},t.match=function(n,r,i){i=i||{};var o=0,a=[],s=r.length,l=0,c=0,d=i.pre||"",u=i.post||"",h=i.caseSensitive&&r||r.toLowerCase(),m;n=i.caseSensitive&&n||n.toLowerCase();for(var p=0;p<s;p++)m=r[p],h[p]===n[o]?(m=d+m+u,o+=1,c+=1+c):c=0,l+=c,a[a.length]=m;return o===n.length?(l=h===n?1/0:l,{rendered:a.join(""),score:l}):null},t.filter=function(n,r,i){return!r||r.length===0?[]:typeof n!="string"?r:(i=i||{},r.reduce(function(o,a,s,l){var c=a;i.extract&&(c=i.extract(a));var d=t.match(n,c,i);return d!=null&&(o[o.length]={string:d.rendered,score:d.score,index:s,original:a}),o},[]).sort(function(o,a){var s=a.score-o.score;return s||o.index-a.index}))}})()});S();var YI=L(Oy(),1),ZI=L($y(),1),oU=L(Fy(),1);S();var Py=L(yv(),1);S();S();var p1=/Mac|iPod|iPhone|iPad/.test(navigator.platform),coe=/^Win/.test(navigator.platform),doe=/\b(android)\b/i.test(navigator.userAgent),uoe="netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,uY=navigator.userAgent.indexOf("Chrome")!==-1,hoe=!uY&&navigator.userAgent.indexOf("Safari")!==-1,moe=/iPad|iPhone/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,poe=()=>navigator.brave?.isBrave?.name==="isBrave",foe=typeof window<"u"&&"ResizeObserver"in window,goe="Excalidraw",Vk=10,Yk=8,Eoe=5,boe=1,yoe=30,No=Math.PI/12,voe="red",f1={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},xoe={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},woe={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"};var Soe={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},Toe={TEST:"test"},Coe={SHAPE_ACTIONS_MENU:"App-menu__left"},Cn={Virgil:1,Helvetica:2,Cascadia:3,Assistant:4},zr={LIGHT:"light",DARK:"dark"},Nn={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},vv="Segoe UI Emoji",g1=1,$o=20,ji=Cn.Virgil,ud="left",E1="top";var b1=2,y1=1,bs="#ffffff",hd="#1e1e1e",Nh="transparent",Moe="#a2f1a6";var Ioe=20,xv={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},Zk=["text/plain","text/html"],we={json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawlib:"application/vnd.excalidrawlib+json","excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...xv},koe={png:"png",svg:"svg",clipboard:"clipboard"},Mr={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},wv=window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,Aoe=500,_oe=300,Poe=500;var Doe=100,Loe=.1,Xk=.1,Roe=300;var v1="invert(93%) hue-rotate(180deg)",Ooe={addLibrary:"addLibrary"},Noe={addLibrary:"addLibrary"},$oe={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},Foe=800,Boe=1e3,zoe=500,Hoe=1229,Goe=302,md=2,Kk=[1,2,3],qk=10,Woe=1440,joe=2*1024*1024,ft="http://www.w3.org/2000/svg";var Sv={excalidraw:2,excalidrawLibrary:2},Mn=5,Qk=.7,Jk=11,ga={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},Tv={LEFT:"left",CENTER:"center",RIGHT:"right"},e7=20,x1=.25,t7=32,Hr={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},w1="__precedingElement__",Cv={architect:0,artist:1,cartoonist:2},Uoe={thin:1,bold:2,extraBold:4},Dt={strokeColor:hd,backgroundColor:Nh,fillStyle:"solid",strokeWidth:2,strokeStyle:"solid",roughness:Cv.artist,opacity:100,locked:!1},hY="library",n7={name:"default",defaultTab:hY},Voe=new Set(["iframe","embeddable","image"]),Yoe={selection:"selection",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser"},Zoe={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},r7="Untitled";S();S();S();var Fo=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");S();var mY=Kk.includes(devicePixelRatio)?devicePixelRatio:1,pd=()=>({showWelcomeScreen:!1,theme:zr.LIGHT,collaborators:new Map,currentChartType:"bar",currentItemBackgroundColor:Dt.backgroundColor,currentItemEndArrowhead:"arrow",currentItemFillStyle:Dt.fillStyle,currentItemFontFamily:ji,currentItemFontSize:$o,currentItemOpacity:Dt.opacity,currentItemRoughness:Dt.roughness,currentItemStartArrowhead:null,currentItemStrokeColor:Dt.strokeColor,currentItemRoundness:"round",currentItemStrokeStyle:Dt.strokeStyle,currentItemStrokeWidth:Dt.strokeWidth,currentItemTextAlign:ud,cursorButton:"up",activeEmbeddable:null,draggingElement:null,editingElement:null,editingGroupId:null,editingLinearElement:null,activeTool:{type:"selection",customType:null,locked:Dt.locked,lastActiveTool:null},penMode:!1,penDetected:!1,errorMessage:null,exportBackground:!0,exportScale:mY,exportEmbedScene:!1,exportWithDarkMode:!1,fileHandle:null,gridSize:null,isBindingEnabled:!0,defaultSidebarDockedPreference:!1,isLoading:!1,isResizing:!1,isRotating:!1,lastPointerDownWith:"mouse",multiElement:null,name:null,contextMenu:null,openMenu:null,openPopup:null,openSidebar:null,openDialog:null,pasteDialog:{shown:!1,data:null},previousSelectedElementIds:{},resizingElement:null,scrolledOutside:!1,scrollX:0,scrollY:0,selectedElementIds:{},selectedGroupIds:{},selectedElementsAreBeingDragged:!1,selectionElement:null,shouldCacheIgnoreZoom:!1,showStats:!1,startBoundElement:null,suggestedBindings:[],frameRendering:{enabled:!0,clip:!0,name:!0,outline:!0},frameToHighlight:null,editingFrame:null,elementsToHighlight:null,toast:null,viewBackgroundColor:bs,zenModeEnabled:!1,zoom:{value:y1},viewModeEnabled:!1,pendingImageElementId:null,showHyperlinkPopup:!1,selectedLinearElement:null,snapLines:[],originSnapOffset:{x:0,y:0},objectsSnapModeEnabled:!1,userToFollow:null,followedBy:new Set}),pY=(e=>e)({showWelcomeScreen:{browser:!0,export:!1,server:!1},theme:{browser:!0,export:!1,server:!1},collaborators:{browser:!1,export:!1,server:!1},currentChartType:{browser:!0,export:!1,server:!1},currentItemBackgroundColor:{browser:!0,export:!1,server:!1},currentItemEndArrowhead:{browser:!0,export:!1,server:!1},currentItemFillStyle:{browser:!0,export:!1,server:!1},currentItemFontFamily:{browser:!0,export:!1,server:!1},currentItemFontSize:{browser:!0,export:!1,server:!1},currentItemRoundness:{browser:!0,export:!1,server:!1},currentItemOpacity:{browser:!0,export:!1,server:!1},currentItemRoughness:{browser:!0,export:!1,server:!1},currentItemStartArrowhead:{browser:!0,export:!1,server:!1},currentItemStrokeColor:{browser:!0,export:!1,server:!1},currentItemStrokeStyle:{browser:!0,export:!1,server:!1},currentItemStrokeWidth:{browser:!0,export:!1,server:!1},currentItemTextAlign:{browser:!0,export:!1,server:!1},cursorButton:{browser:!0,export:!1,server:!1},activeEmbeddable:{browser:!1,export:!1,server:!1},draggingElement:{browser:!1,export:!1,server:!1},editingElement:{browser:!1,export:!1,server:!1},editingGroupId:{browser:!0,export:!1,server:!1},editingLinearElement:{browser:!1,export:!1,server:!1},activeTool:{browser:!0,export:!1,server:!1},penMode:{browser:!0,export:!1,server:!1},penDetected:{browser:!0,export:!1,server:!1},errorMessage:{browser:!1,export:!1,server:!1},exportBackground:{browser:!0,export:!1,server:!1},exportEmbedScene:{browser:!0,export:!1,server:!1},exportScale:{browser:!0,export:!1,server:!1},exportWithDarkMode:{browser:!0,export:!1,server:!1},fileHandle:{browser:!1,export:!1,server:!1},gridSize:{browser:!0,export:!0,server:!0},height:{browser:!1,export:!1,server:!1},isBindingEnabled:{browser:!1,export:!1,server:!1},defaultSidebarDockedPreference:{browser:!0,export:!1,server:!1},isLoading:{browser:!1,export:!1,server:!1},isResizing:{browser:!1,export:!1,server:!1},isRotating:{browser:!1,export:!1,server:!1},lastPointerDownWith:{browser:!0,export:!1,server:!1},multiElement:{browser:!1,export:!1,server:!1},name:{browser:!0,export:!1,server:!1},offsetLeft:{browser:!1,export:!1,server:!1},offsetTop:{browser:!1,export:!1,server:!1},contextMenu:{browser:!1,export:!1,server:!1},openMenu:{browser:!0,export:!1,server:!1},openPopup:{browser:!1,export:!1,server:!1},openSidebar:{browser:!0,export:!1,server:!1},openDialog:{browser:!1,export:!1,server:!1},pasteDialog:{browser:!1,export:!1,server:!1},previousSelectedElementIds:{browser:!0,export:!1,server:!1},resizingElement:{browser:!1,export:!1,server:!1},scrolledOutside:{browser:!0,export:!1,server:!1},scrollX:{browser:!0,export:!1,server:!1},scrollY:{browser:!0,export:!1,server:!1},selectedElementIds:{browser:!0,export:!1,server:!1},selectedGroupIds:{browser:!0,export:!1,server:!1},selectedElementsAreBeingDragged:{browser:!1,export:!1,server:!1},selectionElement:{browser:!1,export:!1,server:!1},shouldCacheIgnoreZoom:{browser:!0,export:!1,server:!1},showStats:{browser:!0,export:!1,server:!1},startBoundElement:{browser:!1,export:!1,server:!1},suggestedBindings:{browser:!1,export:!1,server:!1},frameRendering:{browser:!1,export:!1,server:!1},frameToHighlight:{browser:!1,export:!1,server:!1},editingFrame:{browser:!1,export:!1,server:!1},elementsToHighlight:{browser:!1,export:!1,server:!1},toast:{browser:!1,export:!1,server:!1},viewBackgroundColor:{browser:!0,export:!0,server:!0},width:{browser:!1,export:!1,server:!1},zenModeEnabled:{browser:!0,export:!1,server:!1},zoom:{browser:!0,export:!1,server:!1},viewModeEnabled:{browser:!1,export:!1,server:!1},pendingImageElementId:{browser:!1,export:!1,server:!1},showHyperlinkPopup:{browser:!1,export:!1,server:!1},selectedLinearElement:{browser:!0,export:!1,server:!1},snapLines:{browser:!1,export:!1,server:!1},originSnapOffset:{browser:!1,export:!1,server:!1},objectsSnapModeEnabled:{browser:!0,export:!1,server:!1},userToFollow:{browser:!1,export:!1,server:!1},followedBy:{browser:!1,export:!1,server:!1}}),Mv=(e,t)=>{let n={};for(let r of Object.keys(e))if(pY[r]?.[t]){let o=e[r];n[r]=o}return n},iae=e=>Mv(e,"browser"),S1=e=>Mv(e,"export"),i7=e=>Mv(e,"server"),o7=({activeTool:e})=>e.type==="eraser",a7=({activeTool:e})=>e.type==="hand";S();S();S();S();S();S();var s7=null;var dae=()=>{if(s7)return s7;let e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0"),i=`${e.getHours()}`.padStart(2,"0"),o=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}-${i}${o}`},uae=e=>e.charAt(0).toUpperCase()+e.slice(1),hae=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),fY=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,mae=e=>fY(e)||e instanceof Element&&!!e.closest("label, button"),pae=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"),Iv=({fontFamily:e})=>{for(let[t,n]of Object.entries(Cn))if(n===e)return`${t}, ${vv}`;return vv},In=({fontSize:e,fontFamily:t})=>`${e}px ${Iv({fontFamily:t})}`,d7=(e,t)=>{let n=0,r=null,i=(...o)=>{r=o,clearTimeout(n),n=window.setTimeout(()=>{r=null,e(...o)},t)};return i.flush=()=>{if(clearTimeout(n),r){let o=r;r=null,e(...o)}},i.cancel=()=>{r=null,clearTimeout(n)},i},u7=(e,t)=>{let n=null,r=null,i=null,o=s=>{n=window.requestAnimationFrame(()=>{n=null,e(...s),r=null,i&&(r=i,i=null,o(r))})},a=(...s)=>{if(N.MODE==="test"){e(...s);return}r=s,n===null?o(r):t?.trailing&&(i=s)};return a.flush=()=>{n!==null&&(cancelAnimationFrame(n),n=null),r&&(e(...i||r),r=i=null)},a.cancel=()=>{r=i=null,n!==null&&(cancelAnimationFrame(n),n=null)},a},h7=e=>1-Math.pow(1-e,4),l7=(e,t,n)=>(t-e)*h7(n)+e,fae=({fromValues:e,toValues:t,onStep:n,duration:r=250,interpolateValue:i,onStart:o,onEnd:a,onCancel:s})=>{let l=!1,c=0,d;function u(h){if(l)return;d===void 0&&(d=h,o?.());let m=Math.min(h-d,r),p=h7(m/r),f={};if(Object.keys(e).forEach(g=>{let b=g,v=(t[b]-e[b])*p+e[b];f[b]=v}),n(f),m<r){let g=m/r,b={};Object.keys(e).forEach(v=>{let y=v,w=e[y],T=t[y],k;k=i?i(w,T,g,y):l7(w,T,g),k==null&&(k=l7(w,T,g)),b[y]=k}),n(b),c=window.requestAnimationFrame(u)}else n(t),a?.()}return c=window.requestAnimationFrame(u),()=>{s?.(),l=!0,window.cancelAnimationFrame(c)}},gae=(e,t)=>{if(!e.length||t<1)return[];let n=0,r=0,i=Array(Math.ceil(e.length/t));for(;n<e.length;)i[r++]=e.slice(n,n+=t);return i};var mi=(e,t)=>Math.abs(e-t),$h=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked};var Eae=e=>(e=e.replace(/\bAlt\b/i,"Alt").replace(/\bShift\b/i,"Shift").replace(/\b(Enter|Return)\b/i,"Enter"),p1?e.replace(/\bCtrlOrCmd\b/gi,"Cmd").replace(/\bAlt\b/i,"Option"):e.replace(/\bCtrlOrCmd\b/gi,"Ctrl")),Fh=({clientX:e,clientY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:a})=>{let s=(e-r)/n.value-o,l=(t-i)/n.value-a;return{x:s,y:l}},kv=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:a})=>{let s=(e+o)*n.value+r,l=(t+a)*n.value+i;return{x:s,y:l}},bae=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),gY="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF",EY="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",bY=new RegExp(`^[^${gY}]*[${EY}]`),C1=e=>bY.test(e),fd=e=>{let[t,n]=e;return{x:t,y:n}},yae=e=>{if(e?.name==="AbortError"){console.warn(e);return}throw e},vae=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let r=n-1;for(;++r<e.length;)if(t(e[r],r,e))return r;return-1},xae=(e,t,n=e.length-1)=>{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let r=n+1;for(;--r>-1;)if(t(e[r],r,e))return r;return-1},ys=e=>{let t=e.length===5&&e.substr(4,1)==="0",n=e.length===9&&e.substr(7,2)==="00";return t||n||e===Nh},wae=()=>{let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n};var Sae=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;let{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},Tae=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},Cae=e=>{e.preventDefault(),e.returnValue=""},m7=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),Ea=()=>ba()?1:Date.now(),St=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),Mae=e=>e.reduce((t,n,r)=>(t.set(n.id,[n,r]),t),new Map),ba=()=>N.MODE==="test",Iae=()=>N.MODE==="development",kae=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),Aae=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t}:e};var _ae=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}};var M1=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,Pae=e=>{let t=e?.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},c7=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,Av=(e,t,n,r=!1)=>{let i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return r&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(let a of n)if(!(e[a]===t[a]||c7(e[a],t[a])))return r&&console.warn(`%cisShallowEqual: ${a} not equal ->`,"color: #8B4000",e[a],t[a]),!1;return!0}return i.every(a=>{let s=n?.[a],l=s?s(e[a],t[a]):e[a]===t[a]||c7(e[a],t[a]);return!l&&r&&console.warn(`%cisShallowEqual: ${a} not equal ->`,"color: #8B4000",e[a],t[a]),l})},Dae=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(i){if(e?.(i),!n||!i?.defaultPrevented)return t?.(i)},I1=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)},Lae=e=>{let t,n,r=function(i){let o=Object.entries(i);if(t){let s=!0;for(let[l,c]of o)if(t.get(l)!==c){s=!1;break}if(s)return n}let a=e(i);return t=new Map(o),n=a,a};return r.clear=()=>{t=void 0,n=void 0},r},p7=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),Rae=e=>JSON.parse(JSON.stringify(e)),Oae=e=>typeof e=="number"&&Number.isFinite(e),Nae=(e,t)=>Av(e,t)?e:t;function $ae(e,t,n,r){return e?(e?.addEventListener?.(t,n,r),()=>{e?.removeEventListener?.(t,n,r)}):()=>{}}var T1=(e,t)=>(e+t)/2;function Fae(e,t=!0){let n=e.length;if(n<4)return"";let r=e[0],i=e[1],o=e[2],a=`M${r[0].toFixed(2)},${r[1].toFixed(2)} Q${i[0].toFixed(2)},${i[1].toFixed(2)} ${T1(i[0],o[0]).toFixed(2)},${T1(i[1],o[1]).toFixed(2)} T`;for(let s=2,l=n-1;s<l;s++)r=e[s],i=e[s+1],a+=`${T1(r[0],i[0]).toFixed(2)},${T1(r[1],i[1]).toFixed(2)} `;return t&&(a+="Z"),a}var f7=e=>e.replace(/\r?\n|\r/g,`
2
- `),Hl=e=>e,Bae=async(e,...t)=>new Promise(n=>{n(e(...t))}),g7=(e,t)=>t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{});var Bo=e=>!!e&&e.type==="image"&&!!e.fileId,k1=e=>!!e&&e.type==="image",A1=e=>!!e&&e.type==="embeddable",gd=e=>!!e&&e.type==="iframe",Ui=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),ct=e=>e!=null&&e.type==="text",Bh=e=>e!=null&&e.type==="frame",E7=e=>e!=null&&e.type==="magicframe",ht=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),kn=e=>e!=null&&yY(e.type),yY=e=>e==="freedraw",Tt=e=>e!=null&&_v(e.type),gt=e=>e!=null&&e.type==="arrow",_v=e=>e==="arrow"||e==="line",Vi=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&vY(e.type),vY=e=>e==="arrow",Ed=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),_1=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||gt(e)),Pv=e=>{let t=e?.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return I1(t,null),!1}},P1=e=>_1(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),pi=e=>e!==null&&"containerId"in e&&e.containerId!==null&&ct(e),D1=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",b7=e=>e==="line"||e==="arrow"||e==="diamond",jae=(e,t)=>!!((e===Hr.ADAPTIVE_RADIUS||e===Hr.LEGACY)&&D1(t.type)||e===Hr.PROPORTIONAL_RADIUS&&b7(t.type)),Uae=e=>b7(e.type)?{type:Hr.PROPORTIONAL_RADIUS}:D1(e.type)?{type:Hr.ADAPTIVE_RADIUS}:null;S();S();S();S();S();S();S();S();S();S();S();S();function Dv(e,t,n){if(e&&e.length){let[r,i]=t,o=Math.PI/180*n,a=Math.cos(o),s=Math.sin(o);for(let l of e){let[c,d]=l;l[0]=(c-r)*a-(d-i)*s+r,l[1]=(c-r)*s+(d-i)*a+i}}}function xY(e,t,n){let r=[];e.forEach(i=>r.push(...i)),Dv(r,t,n)}function wY(e,t){return e[0]===t[0]&&e[1]===t[1]}function y7(e,t,n,r=1){let i=n,o=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(i)for(let c of a)Dv(c,s,i);let l=SY(a,o,r);if(i){for(let c of a)Dv(c,s,-i);xY(l,s,-i)}return l}function SY(e,t,n){let r=[];for(let c of e){let d=[...c];wY(d[0],d[d.length-1])||d.push([d[0][0],d[0][1]]),d.length>2&&r.push(d)}let i=[];t=Math.max(t,.1);let o=[];for(let c of r)for(let d=0;d<c.length-1;d++){let u=c[d],h=c[d+1];if(u[1]!==h[1]){let m=Math.min(u[1],h[1]);o.push({ymin:m,ymax:Math.max(u[1],h[1]),x:m===u[1]?u[0]:h[0],islope:(h[0]-u[0])/(h[1]-u[1])})}}if(o.sort((c,d)=>c.ymin<d.ymin?-1:c.ymin>d.ymin?1:c.x<d.x?-1:c.x>d.x?1:c.ymax===d.ymax?0:(c.ymax-d.ymax)/Math.abs(c.ymax-d.ymax)),!o.length)return i;let a=[],s=o[0].ymin,l=0;for(;a.length||o.length;){if(o.length){let c=-1;for(let u=0;u<o.length&&!(o[u].ymin>s);u++)c=u;o.splice(0,c+1).forEach(u=>{a.push({s,edge:u})})}if(a=a.filter(c=>!(c.edge.ymax<=s)),a.sort((c,d)=>c.edge.x===d.edge.x?0:(c.edge.x-d.edge.x)/Math.abs(c.edge.x-d.edge.x)),(n!==1||l%t===0)&&a.length>1)for(let c=0;c<a.length;c=c+2){let d=c+1;if(d>=a.length)break;let u=a[c].edge,h=a[d].edge;i.push([[Math.round(u.x),s],[Math.round(h.x),s]])}s+=n,a.forEach(c=>{c.edge.x=c.edge.x+n*c.edge.islope}),l++}return i}function zo(e,t){var n;let r=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=t.strokeWidth*4),i=Math.max(i,.1);let o=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(o=i),y7(e,i,r,o||1)}var vs=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let r=zo(t,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(t,n){let r=[];for(let i of t)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return r}};S();S();function xs(e){let t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}var L1=class extends vs{fillPolygons(t,n){let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);let i=Object.assign({},n,{hachureGap:r}),o=zo(t,i),a=Math.PI/180*n.hachureAngle,s=[],l=r*.5*Math.cos(a),c=r*.5*Math.sin(a);for(let[u,h]of o)xs([u,h])&&s.push([[u[0]-l,u[1]+c],[...h]],[[u[0]+l,u[1]-c],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,n)}}};S();var R1=class extends vs{fillPolygons(t,n){let r=this._fillPolygons(t,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),o=this._fillPolygons(t,i);return r.ops=r.ops.concat(o.ops),r}};S();var O1=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let r=zo(t,n);return this.dotsOnLines(r,n)}dotsOnLines(t,n){let r=[],i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let o=n.fillWeight;o<0&&(o=n.strokeWidth/2);let a=i/4;for(let s of t){let l=xs(s),c=l/i,d=Math.ceil(c)-1,u=l-d*i,h=(s[0][0]+s[1][0])/2-i/4,m=Math.min(s[0][1],s[1][1]);for(let p=0;p<d;p++){let f=m+u+p*i,g=h-a+Math.random()*2*a,b=f-a+Math.random()*2*a,v=this.helper.ellipse(g,b,o,o,n);r.push(...v.ops)}}return{type:"fillSketch",ops:r}}};S();var N1=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=zo(t,n);return{type:"fillSketch",ops:this.dashedLine(r,n)}}dashedLine(t,n){let r=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,i=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,o=[];return t.forEach(a=>{let s=xs(a),l=Math.floor(s/(r+i)),c=(s+i-l*(r+i))/2,d=a[0],u=a[1];d[0]>u[0]&&(d=a[1],u=a[0]);let h=Math.atan((u[1]-d[1])/(u[0]-d[0]));for(let m=0;m<l;m++){let p=m*(r+i),f=p+r,g=[d[0]+p*Math.cos(h)+c*Math.cos(h),d[1]+p*Math.sin(h)+c*Math.sin(h)],b=[d[0]+f*Math.cos(h)+c*Math.cos(h),d[1]+f*Math.sin(h)+c*Math.sin(h)];o.push(...this.helper.doubleLineOps(g[0],g[1],b[0],b[1],n))}}),o}};S();var $1=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,i=n.zigzagOffset<0?r:n.zigzagOffset;n=Object.assign({},n,{hachureGap:r+i});let o=zo(t,n);return{type:"fillSketch",ops:this.zigzagLines(o,i,n)}}zigzagLines(t,n,r){let i=[];return t.forEach(o=>{let a=xs(o),s=Math.round(a/(2*n)),l=o[0],c=o[1];l[0]>c[0]&&(l=o[1],c=o[0]);let d=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let u=0;u<s;u++){let h=u*2*n,m=(u+1)*2*n,p=Math.sqrt(2*Math.pow(n,2)),f=[l[0]+h*Math.cos(d),l[1]+h*Math.sin(d)],g=[l[0]+m*Math.cos(d),l[1]+m*Math.sin(d)],b=[f[0]+p*Math.cos(d+Math.PI/4),f[1]+p*Math.sin(d+Math.PI/4)];i.push(...this.helper.doubleLineOps(f[0],f[1],b[0],b[1],r),...this.helper.doubleLineOps(b[0],b[1],g[0],g[1],r))}}),i}};var Ir={};function v7(e,t){let n=e.fillStyle||"hachure";if(!Ir[n])switch(n){case"zigzag":Ir[n]||(Ir[n]=new L1(t));break;case"cross-hatch":Ir[n]||(Ir[n]=new R1(t));break;case"dots":Ir[n]||(Ir[n]=new O1(t));break;case"dashed":Ir[n]||(Ir[n]=new N1(t));break;case"zigzag-line":Ir[n]||(Ir[n]=new $1(t));break;case"hachure":default:n="hachure",Ir[n]||(Ir[n]=new vs(t));break}return Ir[n]}S();function x7(){return Math.floor(Math.random()*2**31)}var ws=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};S();S();var F1={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function TY(e){let t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:2,text:""},t}function Lv(e,t){return e.type===t}function bd(e){let t=[],n=TY(e),r="BOD",i=0,o=n[i];for(;!Lv(o,2);){let a=0,s=[];if(r==="BOD")if(o.text==="M"||o.text==="m")i++,a=F1[o.text],r=o.text;else return bd("M0,0"+e);else Lv(o,1)?a=F1[r]:(i++,a=F1[o.text],r=o.text);if(i+a<n.length){for(let l=i;l<i+a;l++){let c=n[l];if(Lv(c,1))s[s.length]=+c.text;else throw new Error("Param not a number: "+r+","+c.text)}if(typeof F1[r]=="number"){let l={key:r,data:s};t.push(l),i+=a,o=n[i],r==="M"&&(r="L"),r==="m"&&(r="l")}else throw new Error("Bad segment: "+r)}else throw new Error("Path data ended short")}return t}S();function zh(e){let t=0,n=0,r=0,i=0,o=[];for(let{key:a,data:s}of e)switch(a){case"M":o.push({key:"M",data:[...s]}),[t,n]=s,[r,i]=s;break;case"m":t+=s[0],n+=s[1],o.push({key:"M",data:[t,n]}),r=t,i=n;break;case"L":o.push({key:"L",data:[...s]}),[t,n]=s;break;case"l":t+=s[0],n+=s[1],o.push({key:"L",data:[t,n]});break;case"C":o.push({key:"C",data:[...s]}),t=s[4],n=s[5];break;case"c":{let l=s.map((c,d)=>d%2?c+n:c+t);o.push({key:"C",data:l}),t=l[4],n=l[5];break}case"Q":o.push({key:"Q",data:[...s]}),t=s[2],n=s[3];break;case"q":{let l=s.map((c,d)=>d%2?c+n:c+t);o.push({key:"Q",data:l}),t=l[2],n=l[3];break}case"A":o.push({key:"A",data:[...s]}),t=s[5],n=s[6];break;case"a":t+=s[5],n+=s[6],o.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case"H":o.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...s]}),n=s[0];break;case"v":n+=s[0],o.push({key:"V",data:[n]});break;case"S":o.push({key:"S",data:[...s]}),t=s[2],n=s[3];break;case"s":{let l=s.map((c,d)=>d%2?c+n:c+t);o.push({key:"S",data:l}),t=l[2],n=l[3];break}case"T":o.push({key:"T",data:[...s]}),t=s[0],n=s[1];break;case"t":t+=s[0],n+=s[1],o.push({key:"T",data:[t,n]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=r,n=i;break}return o}S();function Gh(e){let t=[],n="",r=0,i=0,o=0,a=0,s=0,l=0;for(let{key:c,data:d}of e){switch(c){case"M":t.push({key:"M",data:[...d]}),[r,i]=d,[o,a]=d;break;case"C":t.push({key:"C",data:[...d]}),r=d[4],i=d[5],s=d[2],l=d[3];break;case"L":t.push({key:"L",data:[...d]}),[r,i]=d;break;case"H":r=d[0],t.push({key:"L",data:[r,i]});break;case"V":i=d[0],t.push({key:"L",data:[r,i]});break;case"S":{let u=0,h=0;n==="C"||n==="S"?(u=r+(r-s),h=i+(i-l)):(u=r,h=i),t.push({key:"C",data:[u,h,...d]}),s=d[0],l=d[1],r=d[2],i=d[3];break}case"T":{let[u,h]=d,m=0,p=0;n==="Q"||n==="T"?(m=r+(r-s),p=i+(i-l)):(m=r,p=i);let f=r+2*(m-r)/3,g=i+2*(p-i)/3,b=u+2*(m-u)/3,v=h+2*(p-h)/3;t.push({key:"C",data:[f,g,b,v,u,h]}),s=m,l=p,r=u,i=h;break}case"Q":{let[u,h,m,p]=d,f=r+2*(u-r)/3,g=i+2*(h-i)/3,b=m+2*(u-m)/3,v=p+2*(h-p)/3;t.push({key:"C",data:[f,g,b,v,m,p]}),s=u,l=h,r=m,i=p;break}case"A":{let u=Math.abs(d[0]),h=Math.abs(d[1]),m=d[2],p=d[3],f=d[4],g=d[5],b=d[6];u===0||h===0?(t.push({key:"C",data:[r,i,g,b,g,b]}),r=g,i=b):(r!==g||i!==b)&&(w7(r,i,g,b,u,h,m,p,f).forEach(function(y){t.push({key:"C",data:y})}),r=g,i=b);break}case"Z":t.push({key:"Z",data:[]}),r=o,i=a;break}n=c}return t}function CY(e){return Math.PI*e/180}function Hh(e,t,n){let r=e*Math.cos(n)-t*Math.sin(n),i=e*Math.sin(n)+t*Math.cos(n);return[r,i]}function w7(e,t,n,r,i,o,a,s,l,c){let d=CY(a),u=[],h=0,m=0,p=0,f=0;if(c)[h,m,p,f]=c;else{[e,t]=Hh(e,t,-d),[n,r]=Hh(n,r,-d);let _=(e-n)/2,$=(t-r)/2,W=_*_/(i*i)+$*$/(o*o);W>1&&(W=Math.sqrt(W),i=W*i,o=W*o);let H=s===l?-1:1,K=i*i,Q=o*o,ie=K*Q-K*$*$-Q*_*_,X=K*$*$+Q*_*_,F=H*Math.sqrt(Math.abs(ie/X));p=F*i*$/o+(e+n)/2,f=F*-o*_/i+(t+r)/2,h=Math.asin(parseFloat(((t-f)/o).toFixed(9))),m=Math.asin(parseFloat(((r-f)/o).toFixed(9))),e<p&&(h=Math.PI-h),n<p&&(m=Math.PI-m),h<0&&(h=Math.PI*2+h),m<0&&(m=Math.PI*2+m),l&&h>m&&(h=h-Math.PI*2),!l&&m>h&&(m=m-Math.PI*2)}let g=m-h;if(Math.abs(g)>Math.PI*120/180){let _=m,$=n,W=r;l&&m>h?m=h+Math.PI*120/180*1:m=h+Math.PI*120/180*-1,n=p+i*Math.cos(m),r=f+o*Math.sin(m),u=w7(n,r,$,W,i,o,a,0,l,[m,_,p,f])}g=m-h;let b=Math.cos(h),v=Math.sin(h),y=Math.cos(m),w=Math.sin(m),T=Math.tan(g/4),k=4/3*i*T,M=4/3*o*T,C=[e,t],P=[e+k*v,t-M*b],R=[n+k*w,r-M*y],A=[n,r];if(P[0]=2*C[0]-P[0],P[1]=2*C[1]-P[1],c)return[P,R,A].concat(u);{u=[P,R,A].concat(u);let _=[];for(let $=0;$<u.length;$+=3){let W=Hh(u[$][0],u[$][1],d),H=Hh(u[$+1][0],u[$+1][1],d),K=Hh(u[$+2][0],u[$+2][1],d);_.push([W[0],W[1],H[0],H[1],K[0],K[1]])}return _}}var MY={randOffset:AY,randOffsetWithRange:_Y,ellipse:kY,doubleLineOps:PY};function Rv(e,t,n,r,i){return{type:"path",ops:ya(e,t,n,r,i)}}function Wh(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let o=0;o<r-1;o++)i.push(...ya(e[o][0],e[o][1],e[o+1][0],e[o+1][1],n));return t&&i.push(...ya(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(r===2)return Rv(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function IY(e,t){return Wh(e,!0,t)}function I7(e,t,n,r,i){let o=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];return IY(o,i)}function Ov(e,t){let n=T7(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){let r=T7(e,1.5*(1+t.roughness*.22),DY(t));n=n.concat(r)}return{type:"path",ops:n}}function kY(e,t,n,r,i){let o=Nv(n,r,i);return H1(e,t,i,o).opset}function Nv(e,t,n){let r=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),o=Math.PI*2/i,a=Math.abs(e/2),s=Math.abs(t/2),l=1-n.curveFitting;return a+=Se(a*l,n),s+=Se(s*l,n),{increment:o,rx:a,ry:s}}function H1(e,t,n,r){let[i,o]=C7(r.increment,e,t,r.rx,r.ry,1,r.increment*B1(.1,B1(.4,1,n),n),n),a=z1(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[s]=C7(r.increment,e,t,r.rx,r.ry,1.5,0,n),l=z1(s,null,n);a=a.concat(l)}return{estimatedPoints:o,opset:{type:"path",ops:a}}}function $v(e,t,n,r,i,o,a,s,l){let c=e,d=t,u=Math.abs(n/2),h=Math.abs(r/2);u+=Se(u*.01,l),h+=Se(h*.01,l);let m=i,p=o;for(;m<0;)m+=Math.PI*2,p+=Math.PI*2;p-m>Math.PI*2&&(m=0,p=Math.PI*2);let f=Math.PI*2/l.curveStepCount,g=Math.min(f/2,(p-m)/2),b=M7(g,c,d,u,h,m,p,1,l);if(!l.disableMultiStroke){let v=M7(g,c,d,u,h,m,p,1.5,l);b.push(...v)}return a&&(s?b.push(...ya(c,d,c+u*Math.cos(m),d+h*Math.sin(m),l),...ya(c,d,c+u*Math.cos(p),d+h*Math.sin(p),l)):b.push({op:"lineTo",data:[c,d]},{op:"lineTo",data:[c+u*Math.cos(m),d+h*Math.sin(m)]})),{type:"path",ops:b}}function Fv(e,t){let n=Gh(zh(bd(e))),r=[],i=[0,0],o=[0,0];for(let{key:a,data:s}of n)switch(a){case"M":{o=[s[0],s[1]],i=[s[0],s[1]];break}case"L":r.push(...ya(o[0],o[1],s[0],s[1],t)),o=[s[0],s[1]];break;case"C":{let[l,c,d,u,h,m]=s;r.push(...LY(l,c,d,u,h,m,o,t)),o=[h,m];break}case"Z":r.push(...ya(o[0],o[1],i[0],i[1],t)),o=[i[0],i[1]];break}return{type:"path",ops:r}}function G1(e,t){let n=[];for(let r of e)if(r.length){let i=t.maxRandomnessOffset||0,o=r.length;if(o>2){n.push({op:"move",data:[r[0][0]+Se(i,t),r[0][1]+Se(i,t)]});for(let a=1;a<o;a++)n.push({op:"lineTo",data:[r[a][0]+Se(i,t),r[a][1]+Se(i,t)]})}}return{type:"fillPath",ops:n}}function Gl(e,t){return v7(t,MY).fillPolygons(e,t)}function k7(e,t,n,r,i,o,a){let s=e,l=t,c=Math.abs(n/2),d=Math.abs(r/2);c+=Se(c*.01,a),d+=Se(d*.01,a);let u=i,h=o;for(;u<0;)u+=Math.PI*2,h+=Math.PI*2;h-u>Math.PI*2&&(u=0,h=Math.PI*2);let m=(h-u)/a.curveStepCount,p=[];for(let f=u;f<=h;f=f+m)p.push([s+c*Math.cos(f),l+d*Math.sin(f)]);return p.push([s+c*Math.cos(h),l+d*Math.sin(h)]),p.push([s,l]),Gl([p],a)}function AY(e,t){return Se(e,t)}function _Y(e,t,n){return B1(e,t,n)}function PY(e,t,n,r,i){return ya(e,t,n,r,i,!0)}function DY(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function A7(e){return e.randomizer||(e.randomizer=new ws(e.seed||0)),e.randomizer.next()}function B1(e,t,n,r=1){return n.roughness*r*(A7(n)*(t-e)+e)}function Se(e,t,n=1){return B1(-e,e,t,n)}function ya(e,t,n,r,i,o=!1){let a=o?i.disableMultiStrokeFill:i.disableMultiStroke,s=S7(e,t,n,r,i,!0,!1);if(a)return s;let l=S7(e,t,n,r,i,!0,!0);return s.concat(l)}function S7(e,t,n,r,i,o,a){let s=Math.pow(e-n,2)+Math.pow(t-r,2),l=Math.sqrt(s),c=1;l<200?c=1:l>500?c=.4:c=-.0016668*l+1.233334;let d=i.maxRandomnessOffset||0;d*d*100>s&&(d=l/10);let u=d/2,h=.2+A7(i)*.2,m=i.bowing*i.maxRandomnessOffset*(r-t)/200,p=i.bowing*i.maxRandomnessOffset*(e-n)/200;m=Se(m,i,c),p=Se(p,i,c);let f=[],g=()=>Se(u,i,c),b=()=>Se(d,i,c),v=i.preserveVertices;return o&&(a?f.push({op:"move",data:[e+(v?0:g()),t+(v?0:g())]}):f.push({op:"move",data:[e+(v?0:Se(d,i,c)),t+(v?0:Se(d,i,c))]})),a?f.push({op:"bcurveTo",data:[m+e+(n-e)*h+g(),p+t+(r-t)*h+g(),m+e+2*(n-e)*h+g(),p+t+2*(r-t)*h+g(),n+(v?0:g()),r+(v?0:g())]}):f.push({op:"bcurveTo",data:[m+e+(n-e)*h+b(),p+t+(r-t)*h+b(),m+e+2*(n-e)*h+b(),p+t+2*(r-t)*h+b(),n+(v?0:b()),r+(v?0:b())]}),f}function T7(e,t,n){let r=[];r.push([e[0][0]+Se(t,n),e[0][1]+Se(t,n)]),r.push([e[0][0]+Se(t,n),e[0][1]+Se(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+Se(t,n),e[i][1]+Se(t,n)]),i===e.length-1&&r.push([e[i][0]+Se(t,n),e[i][1]+Se(t,n)]);return z1(r,null,n)}function z1(e,t,n){let r=e.length,i=[];if(r>3){let o=[],a=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<r;s++){let l=e[s];o[0]=[l[0],l[1]],o[1]=[l[0]+(a*e[s+1][0]-a*e[s-1][0])/6,l[1]+(a*e[s+1][1]-a*e[s-1][1])/6],o[2]=[e[s+1][0]+(a*e[s][0]-a*e[s+2][0])/6,e[s+1][1]+(a*e[s][1]-a*e[s+2][1])/6],o[3]=[e[s+1][0],e[s+1][1]],i.push({op:"bcurveTo",data:[o[1][0],o[1][1],o[2][0],o[2][1],o[3][0],o[3][1]]})}if(t&&t.length===2){let s=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+Se(s,n),t[1]+Se(s,n)]})}}else r===3?(i.push({op:"move",data:[e[1][0],e[1][1]]}),i.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...ya(e[0][0],e[0][1],e[1][0],e[1][1],n));return i}function C7(e,t,n,r,i,o,a,s){let l=s.roughness===0,c=[],d=[];if(l){e=e/4,d.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let u=0;u<=Math.PI*2;u=u+e){let h=[t+r*Math.cos(u),n+i*Math.sin(u)];c.push(h),d.push(h)}d.push([t+r*Math.cos(0),n+i*Math.sin(0)]),d.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let u=Se(.5,s)-Math.PI/2;d.push([Se(o,s)+t+.9*r*Math.cos(u-e),Se(o,s)+n+.9*i*Math.sin(u-e)]);let h=Math.PI*2+u-.01;for(let m=u;m<h;m=m+e){let p=[Se(o,s)+t+r*Math.cos(m),Se(o,s)+n+i*Math.sin(m)];c.push(p),d.push(p)}d.push([Se(o,s)+t+r*Math.cos(u+Math.PI*2+a*.5),Se(o,s)+n+i*Math.sin(u+Math.PI*2+a*.5)]),d.push([Se(o,s)+t+.98*r*Math.cos(u+a),Se(o,s)+n+.98*i*Math.sin(u+a)]),d.push([Se(o,s)+t+.9*r*Math.cos(u+a*.5),Se(o,s)+n+.9*i*Math.sin(u+a*.5)])}return[d,c]}function M7(e,t,n,r,i,o,a,s,l){let c=o+Se(.1,l),d=[];d.push([Se(s,l)+t+.9*r*Math.cos(c-e),Se(s,l)+n+.9*i*Math.sin(c-e)]);for(let u=c;u<=a;u=u+e)d.push([Se(s,l)+t+r*Math.cos(u),Se(s,l)+n+i*Math.sin(u)]);return d.push([t+r*Math.cos(a),n+i*Math.sin(a)]),d.push([t+r*Math.cos(a),n+i*Math.sin(a)]),z1(d,null,l)}function LY(e,t,n,r,i,o,a,s){let l=[],c=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],d=[0,0],u=s.disableMultiStroke?1:2,h=s.preserveVertices;for(let m=0;m<u;m++)m===0?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(h?0:Se(c[0],s)),a[1]+(h?0:Se(c[0],s))]}),d=h?[i,o]:[i+Se(c[m],s),o+Se(c[m],s)],l.push({op:"bcurveTo",data:[e+Se(c[m],s),t+Se(c[m],s),n+Se(c[m],s),r+Se(c[m],s),d[0],d[1]]});return l}S();function jh(e){return[...e]}function _7(e,t=0){let n=e.length;if(n<3)throw new Error("A curve must have at least three points.");let r=[];if(n===3)r.push(jh(e[0]),jh(e[1]),jh(e[2]),jh(e[2]));else{let i=[];i.push(e[0],e[0]);for(let s=1;s<e.length;s++)i.push(e[s]),s===e.length-1&&i.push(e[s]);let o=[],a=1-t;r.push(jh(i[0]));for(let s=1;s+2<i.length;s++){let l=i[s];o[0]=[l[0],l[1]],o[1]=[l[0]+(a*i[s+1][0]-a*i[s-1][0])/6,l[1]+(a*i[s+1][1]-a*i[s-1][1])/6],o[2]=[i[s+1][0]+(a*i[s][0]-a*i[s+2][0])/6,i[s+1][1]+(a*i[s][1]-a*i[s+2][1])/6],o[3]=[i[s+1][0],i[s+1][1]],r.push(o[1],o[2],o[3])}}return r}S();function RY(e,t){return Math.sqrt(W1(e,t))}function W1(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function OY(e,t,n){let r=W1(t,n);if(r===0)return W1(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)),W1(e,Wl(t,n,i))}function Wl(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function NY(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],o=e[t+3],a=3*r[0]-2*n[0]-o[0];a*=a;let s=3*r[1]-2*n[1]-o[1];s*=s;let l=3*i[0]-2*o[0]-n[0];l*=l;let c=3*i[1]-2*o[1]-n[1];return c*=c,a<l&&(a=l),s<c&&(s=c),a+s}function Bv(e,t,n,r){let i=r||[];if(NY(e,t)<n){let o=e[t+0];i.length?RY(i[i.length-1],o)>1&&i.push(o):i.push(o),i.push(e[t+3])}else{let a=e[t+0],s=e[t+1],l=e[t+2],c=e[t+3],d=Wl(a,s,.5),u=Wl(s,l,.5),h=Wl(l,c,.5),m=Wl(d,u,.5),p=Wl(u,h,.5),f=Wl(m,p,.5);Bv([a,d,m,f],0,n,i),Bv([f,p,h,c],0,n,i)}return i}function P7(e,t){return j1(e,0,e.length,t)}function j1(e,t,n,r,i){let o=i||[],a=e[t],s=e[n-1],l=0,c=1;for(let d=t+1;d<n-1;++d){let u=OY(e[d],a,s);u>l&&(l=u,c=d)}return Math.sqrt(l)>r?(j1(e,t,c+1,r,o),j1(e,c,n,r,o)):(o.length||o.push(a),o.push(s)),o}function U1(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let o=0;o<i;o++){let a=o*3;Bv(e,a,t,r)}return n&&n>0?j1(r,0,r.length,n):r}S();function D7(e,t,n){let r=bd(e),i=Gh(zh(r)),o=[],a=[],s=[0,0],l=[],c=()=>{l.length>=4&&a.push(...U1(l,t)),l=[]},d=()=>{c(),a.length&&(o.push(a),a=[])};for(let{key:h,data:m}of i)switch(h){case"M":d(),s=[m[0],m[1]],a.push(s);break;case"L":c(),a.push([m[0],m[1]]);break;case"C":if(!l.length){let p=a.length?a[a.length-1]:s;l.push([p[0],p[1]])}l.push([m[0],m[1]]),l.push([m[2],m[3]]),l.push([m[4],m[5]]);break;case"Z":c(),a.push([s[0],s[1]]);break}if(d(),!n)return o;let u=[];for(let h of o){let m=P7(h,n);m.length&&u.push(m)}return u}var Gr="none",Wr=class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return x7()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,r){return{shape:t,sets:n||[],options:r||this.defaultOptions}}line(t,n,r,i,o){let a=this._o(o);return this._d("line",[Rv(t,n,r,i,a)],a)}rectangle(t,n,r,i,o){let a=this._o(o),s=[],l=I7(t,n,r,i,a);if(a.fill){let c=[[t,n],[t+r,n],[t+r,n+i],[t,n+i]];a.fillStyle==="solid"?s.push(G1([c],a)):s.push(Gl([c],a))}return a.stroke!==Gr&&s.push(l),this._d("rectangle",s,a)}ellipse(t,n,r,i,o){let a=this._o(o),s=[],l=Nv(r,i,a),c=H1(t,n,a,l);if(a.fill)if(a.fillStyle==="solid"){let d=H1(t,n,a,l).opset;d.type="fillPath",s.push(d)}else s.push(Gl([c.estimatedPoints],a));return a.stroke!==Gr&&s.push(c.opset),this._d("ellipse",s,a)}circle(t,n,r,i){let o=this.ellipse(t,n,r,r,i);return o.shape="circle",o}linearPath(t,n){let r=this._o(n);return this._d("linearPath",[Wh(t,!1,r)],r)}arc(t,n,r,i,o,a,s=!1,l){let c=this._o(l),d=[],u=$v(t,n,r,i,o,a,s,!0,c);if(s&&c.fill)if(c.fillStyle==="solid"){let h=Object.assign({},c);h.disableMultiStroke=!0;let m=$v(t,n,r,i,o,a,!0,!1,h);m.type="fillPath",d.push(m)}else d.push(k7(t,n,r,i,o,a,c));return c.stroke!==Gr&&d.push(u),this._d("arc",d,c)}curve(t,n){let r=this._o(n),i=[],o=Ov(t,r);if(r.fill&&r.fill!==Gr&&t.length>=3)if(r.fillStyle==="solid"){let a=Ov(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{let a=_7(t),s=U1(a,10,(1+r.roughness)/2);i.push(Gl([s],r))}return r.stroke!==Gr&&i.push(o),this._d("curve",i,r)}polygon(t,n){let r=this._o(n),i=[],o=Wh(t,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(G1([t],r)):i.push(Gl([t],r))),r.stroke!==Gr&&i.push(o),this._d("polygon",i,r)}path(t,n){let r=this._o(n),i=[];if(!t)return this._d("path",i,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let o=r.fill&&r.fill!=="transparent"&&r.fill!==Gr,a=r.stroke!==Gr,s=!!(r.simplification&&r.simplification<1),l=s?4-4*(r.simplification||1):(1+r.roughness)/2,c=D7(t,1,l),d=Fv(t,r);if(o)if(r.fillStyle==="solid")if(c.length===1){let u=Fv(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else i.push(G1(c,r));else i.push(Gl(c,r));return a&&(s?c.forEach(u=>{i.push(Wh(u,!1,r))}):i.push(d)),this._d("path",i,r)}opsToPath(t,n){let r="";for(let i of t.ops){let o=typeof n=="number"&&n>=0?i.data.map(a=>+a.toFixed(n)):i.data;switch(i.op){case"move":r+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":r+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":r+=`L${o[0]} ${o[1]} `;break}}return r.trim()}toPaths(t){let n=t.sets||[],r=t.options||this.defaultOptions,i=[];for(let o of n){let a=null;switch(o.type){case"path":a={d:this.opsToPath(o),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:Gr};break;case"fillPath":a={d:this.opsToPath(o),stroke:Gr,strokeWidth:0,fill:r.fill||Gr};break;case"fillSketch":a=this.fillSketch(o,r);break}a&&i.push(a)}return i}fillSketch(t,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||Gr,strokeWidth:r,fill:Gr}}_mergedShape(t){return t.filter((n,r)=>r===0?!0:n.op!=="move")}};var V1=class{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new Wr(n)}draw(t){let n=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(let a of n)switch(a.type){case"path":i.save(),i.strokeStyle=r.stroke==="none"?"transparent":r.stroke,i.lineWidth=r.strokeWidth,r.strokeLineDash&&i.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(i.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(i,a,o),i.restore();break;case"fillPath":{i.save(),i.fillStyle=r.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,a,o,s),i.restore();break}case"fillSketch":this.fillSketch(i,a,r);break}}fillSketch(t,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=i,this._drawToContext(t,n,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,r,i="nonzero"){t.beginPath();for(let o of n.ops){let a=typeof r=="number"&&r>=0?o.data.map(s=>+s.toFixed(r)):o.data;switch(o.op){case"move":t.moveTo(a[0],a[1]);break;case"bcurveTo":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":t.lineTo(a[0],a[1]);break}}n.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,r,i,o){let a=this.gen.line(t,n,r,i,o);return this.draw(a),a}rectangle(t,n,r,i,o){let a=this.gen.rectangle(t,n,r,i,o);return this.draw(a),a}ellipse(t,n,r,i,o){let a=this.gen.ellipse(t,n,r,i,o);return this.draw(a),a}circle(t,n,r,i){let o=this.gen.circle(t,n,r,i);return this.draw(o),o}linearPath(t,n){let r=this.gen.linearPath(t,n);return this.draw(r),r}polygon(t,n){let r=this.gen.polygon(t,n);return this.draw(r),r}arc(t,n,r,i,o,a,s=!1,l){let c=this.gen.arc(t,n,r,i,o,a,s,l);return this.draw(c),c}curve(t,n){let r=this.gen.curve(t,n);return this.draw(r),r}path(t,n){let r=this.gen.path(t,n);return this.draw(r),r}};S();S();var Uh="http://www.w3.org/2000/svg";var Y1=class{constructor(t,n){this.svg=t,this.gen=new Wr(n)}draw(t){let n=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,o=i.createElementNS(Uh,"g"),a=t.options.fixedDecimalPlaceDigits;for(let s of n){let l=null;switch(s.type){case"path":{l=i.createElementNS(Uh,"path"),l.setAttribute("d",this.opsToPath(s,a)),l.setAttribute("stroke",r.stroke),l.setAttribute("stroke-width",r.strokeWidth+""),l.setAttribute("fill","none"),r.strokeLineDash&&l.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break}case"fillPath":{l=i.createElementNS(Uh,"path"),l.setAttribute("d",this.opsToPath(s,a)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",r.fill||""),(t.shape==="curve"||t.shape==="polygon")&&l.setAttribute("fill-rule","evenodd");break}case"fillSketch":{l=this.fillSketch(i,s,r);break}}l&&o.appendChild(l)}return o}fillSketch(t,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);let o=t.createElementNS(Uh,"path");return o.setAttribute("d",this.opsToPath(n,r.fixedDecimalPlaceDigits)),o.setAttribute("stroke",r.fill||""),o.setAttribute("stroke-width",i+""),o.setAttribute("fill","none"),r.fillLineDash&&o.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,r,i,o){let a=this.gen.line(t,n,r,i,o);return this.draw(a)}rectangle(t,n,r,i,o){let a=this.gen.rectangle(t,n,r,i,o);return this.draw(a)}ellipse(t,n,r,i,o){let a=this.gen.ellipse(t,n,r,i,o);return this.draw(a)}circle(t,n,r,i){let o=this.gen.circle(t,n,r,i);return this.draw(o)}linearPath(t,n){let r=this.gen.linearPath(t,n);return this.draw(r)}polygon(t,n){let r=this.gen.polygon(t,n);return this.draw(r)}arc(t,n,r,i,o,a,s=!1,l){let c=this.gen.arc(t,n,r,i,o,a,s,l);return this.draw(c)}curve(t,n){let r=this.gen.curve(t,n);return this.draw(r)}path(t,n){let r=this.gen.path(t,n);return this.draw(r)}};var qt={canvas(e,t){return new V1(e,t)},svg(e,t){return new Y1(e,t)},generator(e){return new Wr(e)},newSeed(){return Wr.newSeed()}};S();S();S();function L7(e,t,n,r=i=>i){return e*r(.5-t*(.5-n))}function $Y(e){return[-e[0],-e[1]]}function Zi(e,t){return[e[0]+t[0],e[1]+t[1]]}function fi(e,t){return[e[0]-t[0],e[1]-t[1]]}function Yi(e,t){return[e[0]*t,e[1]*t]}function FY(e,t){return[e[0]/t,e[1]/t]}function Vh(e){return[e[1],-e[0]]}function R7(e,t){return e[0]*t[0]+e[1]*t[1]}function BY(e,t){return e[0]===t[0]&&e[1]===t[1]}function zY(e){return Math.hypot(e[0],e[1])}function HY(e){return e[0]*e[0]+e[1]*e[1]}function O7(e,t){return HY(fi(e,t))}function F7(e){return FY(e,zY(e))}function GY(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Yh(e,t,n){let r=Math.sin(n),i=Math.cos(n),o=e[0]-t[0],a=e[1]-t[1],s=o*i-a*r,l=o*r+a*i;return[s+t[0],l+t[1]]}function zv(e,t,n){return Zi(e,Yi(fi(t,e),n))}function N7(e,t,n){return Zi(e,Yi(t,n))}var{min:yd,PI:WY}=Math,$7=.275,Zh=WY+1e-4;function jY(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:o=!0,easing:a=Q=>Q,start:s={},end:l={},last:c=!1}=t,{cap:d=!0,easing:u=Q=>Q*(2-Q)}=s,{cap:h=!0,easing:m=Q=>--Q*Q*Q+1}=l;if(e.length===0||n<=0)return[];let p=e[e.length-1].runningLength,f=s.taper===!1?0:s.taper===!0?Math.max(n,p):s.taper,g=l.taper===!1?0:l.taper===!0?Math.max(n,p):l.taper,b=Math.pow(n*r,2),v=[],y=[],w=e.slice(0,10).reduce((Q,ie)=>{let X=ie.pressure;if(o){let F=yd(1,ie.distance/n),B=yd(1,1-F);X=yd(1,Q+(B-Q)*(F*$7))}return(Q+X)/2},e[0].pressure),T=L7(n,i,e[e.length-1].pressure,a),k,M=e[0].vector,C=e[0].point,P=C,R=C,A=P,_=!1;for(let Q=0;Q<e.length;Q++){let{pressure:ie}=e[Q],{point:X,vector:F,distance:B,runningLength:U}=e[Q];if(Q<e.length-1&&p-U<3)continue;if(i){if(o){let Me=yd(1,B/n),Be=yd(1,1-Me);ie=yd(1,w+(Be-w)*(Me*$7))}T=L7(n,i,ie,a)}else T=n/2;k===void 0&&(k=T);let G=U<f?u(U/f):1,Z=p-U<g?m((p-U)/g):1;T=Math.max(.01,T*Math.min(G,Z));let ee=(Q<e.length-1?e[Q+1]:e[Q]).vector,te=Q<e.length-1?R7(F,ee):1,de=R7(F,M)<0&&!_,qe=te!==null&&te<0;if(de||qe){let Me=Yi(Vh(M),T);for(let Be=1/13,Oe=0;Oe<=1;Oe+=Be)R=Yh(fi(X,Me),X,Zh*Oe),v.push(R),A=Yh(Zi(X,Me),X,Zh*-Oe),y.push(A);C=R,P=A,qe&&(_=!0);continue}if(_=!1,Q===e.length-1){let Me=Yi(Vh(F),T);v.push(fi(X,Me)),y.push(Zi(X,Me));continue}let Ye=Yi(Vh(zv(ee,F,te)),T);R=fi(X,Ye),(Q<=1||O7(C,R)>b)&&(v.push(R),C=R),A=Zi(X,Ye),(Q<=1||O7(P,A)>b)&&(y.push(A),P=A),w=ie,M=F}let $=e[0].point.slice(0,2),W=e.length>1?e[e.length-1].point.slice(0,2):Zi(e[0].point,[1,1]),H=[],K=[];if(e.length===1){if(!(f||g)||c){let Q=N7($,F7(Vh(fi($,W))),-(k||T)),ie=[];for(let X=1/13,F=X;F<=1;F+=X)ie.push(Yh(Q,$,Zh*2*F));return ie}}else{if(!(f||g&&e.length===1))if(d)for(let ie=1/13,X=ie;X<=1;X+=ie){let F=Yh(y[0],$,Zh*X);H.push(F)}else{let ie=fi(v[0],y[0]),X=Yi(ie,.5),F=Yi(ie,.51);H.push(fi($,X),fi($,F),Zi($,F),Zi($,X))}let Q=Vh($Y(e[e.length-1].vector));if(g||f&&e.length===1)K.push(W);else if(h){let ie=N7(W,Q,T);for(let X=1/29,F=X;F<1;F+=X)K.push(Yh(ie,W,Zh*3*F))}else K.push(Zi(W,Yi(Q,T)),Zi(W,Yi(Q,T*.99)),fi(W,Yi(Q,T*.99)),fi(W,Yi(Q,T)))}return v.concat(K,y.reverse(),H)}function UY(e,t={}){var n;let{streamline:r=.5,size:i=16,last:o=!1}=t;if(e.length===0)return[];let a=.15+(1-r)*.85,s=Array.isArray(e[0])?e:e.map(({x:m,y:p,pressure:f=.5})=>[m,p,f]);if(s.length===2){let m=s[1];s=s.slice(0,-1);for(let p=1;p<5;p++)s.push(zv(s[0],m,p/4))}s.length===1&&(s=[...s,[...Zi(s[0],[1,1]),...s[0].slice(2)]]);let l=[{point:[s[0][0],s[0][1]],pressure:s[0][2]>=0?s[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,d=0,u=l[0],h=s.length-1;for(let m=1;m<s.length;m++){let p=o&&m===h?s[m].slice(0,2):zv(u.point,s[m],a);if(BY(u.point,p))continue;let f=GY(p,u.point);if(d+=f,m<h&&!c){if(d<i)continue;c=!0}u={point:p,pressure:s[m][2]>=0?s[m][2]:.5,vector:F7(fi(u.point,p)),distance:f,runningLength:d},l.push(u)}return l[0].vector=((n=l[1])==null?void 0:n.vector)||[0,0],l}function Z1(e,t={}){return jY(UY(e,t),t)}S();S();S();S();S();var VY=(e,t)=>{let[n,r,i,o]=t,{x:a,y:s}=kv({sceneX:n,sceneY:r},e),{x:l,y:c}=kv({sceneX:i,sceneY:o},e);return l-a>e.width||c-s>e.height},YY=({scenePoint:e,viewportDimensions:t,zoom:n})=>({scrollX:t.width/2/n.value-e.x,scrollY:t.height/2/n.value-e.y}),Gv=(e,t)=>{if(e=B7(e),!e.length)return{scrollX:0,scrollY:0};let[n,r,i,o]=kr(e);VY(t,[n,r,i,o])&&([n,r,i,o]=Hv(e,Fh({clientX:t.scrollX,clientY:t.scrollY},t)));let a=(n+i)/2,s=(r+o)/2;return YY({scenePoint:{x:a,y:s},viewportDimensions:{width:t.width,height:t.height},zoom:t.zoom})};S();var ZY=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",Lle=e=>e!=="image"&&e!=="frame"&&e!=="magicframe",XY=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",KY=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",Wv=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="arrow"||e==="line"||e==="diamond"||e==="image",qY=e=>e==="arrow",jv=(e,t)=>{let n=null;for(let r=e.length-1;r>=0;--r){let i=e[r];if(!i.isDeleted&&t(i)){n=i;break}}return n},QY=(e,t)=>{let n=[];return e.filter(i=>!i.isDeleted&&t(i)?gd(i)?(n.push(i),!1):!0:!1).concat(n)};S();var JY=e=>Math.max(Xk,Math.min(e,30)),$le=({viewportX:e,viewportY:t,nextZoom:n},r)=>{let i=e-r.offsetLeft,o=t-r.offsetTop,a=r.zoom.value,s=r.scrollX+(i-i/a),l=r.scrollY+(o-o/a),c=-(i-i/n),d=-(o-o/n);return{scrollX:s+c,scrollY:l+d,zoom:{value:n}}};S();S();var qn=(e,t)=>[0,0,0,0,t,e,1,0];var Uv=(e,t)=>[0,0,0,0,t,e,0,0];var jl=(e=0,t=0)=>{let n=[0,0,0,0,0,0,0,0];if(t<0||t>7)throw new Error(`Expected \`index\` between 0 and 7, got \`${t}\``);return e!==0&&(n[t]=e),n};var vd=e=>[e[0],e[1],e[2],e[3],-e[4],-e[5],-e[6],-e[7]];var z7=(e,t)=>Xv(t)?[e[0]+t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]+t[0],e[1]+t[1],e[2]+t[2],e[3]+t[3],e[4]+t[4],e[5]+t[5],e[6]+t[6],e[7]+t[7]],Xh=(e,t)=>Xv(t)?[e[0]-t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3],e[4]-t[4],e[5]-t[5],e[6]-t[6],e[7]-t[7]],Ss=(e,t)=>Xv(t)?[e[0]*t,e[1]*t,e[2]*t,e[3]*t,e[4]*t,e[5]*t,e[6]*t,e[7]*t]:[rZ(e,t),t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[7]*e[3]+t[0]*e[4]+t[6]*e[5]-t[5]*e[6]+t[3]*e[7],t[5]*e[0]-t[3]*e[1]+t[7]*e[2]+t[1]*e[3]-t[6]*e[4]+t[0]*e[5]+t[4]*e[6]+t[2]*e[7],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]+t[0]*e[7]],rZ=(e,t)=>t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],Vv=(e,t)=>[t[0]*e[0],t[1]*e[0]+t[0]*e[1],t[2]*e[0]+t[0]*e[2],t[3]*e[0]+t[0]*e[3],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[0]*e[4],t[5]*e[0]-t[3]*e[1]+t[1]*e[3]+t[0]*e[5],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]],K1=(e,t)=>[Yv(e,t),e[1]*t[7]+e[4]*t[5]-e[5]*t[4]+e[7]*t[1],e[2]*t[7]-e[4]*t[6]+e[6]*t[4]+e[7]*t[2],e[3]*t[7]+e[5]*t[6]-e[6]*t[5]+e[7]*t[3],e[4]*t[7]+e[7]*t[4],e[5]*t[7]+e[7]*t[5],e[6]*t[7]+e[7]*t[6],e[7]*t[7]],Yv=(e,t)=>e[0]*t[7]+e[1]*t[6]+e[2]*t[5]+e[3]*t[4]+e[4]*t[3]+e[5]*t[2]+e[6]*t[1]+e[7]*t[0],H7=(e,t)=>[t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[7]*e[3]+t[0]*e[4]+t[3]*e[7],t[5]*e[0]+t[7]*e[2]+t[0]*e[5]+t[2]*e[7],t[6]*e[0]+t[0]*e[6],t[7]*e[0]+t[0]*e[7]],Zv=e=>Math.sqrt(Math.abs(e[0]*e[0]-e[2]*e[2]-e[3]*e[3]+e[6]*e[6])),G7=e=>Math.sqrt(Math.abs(e[7]*e[7]-e[5]*e[5]-e[4]*e[4]+e[1]*e[1])),Ul=e=>{let t=Zv(e);if(t===0||t===1)return e;let n=e[6]<0?-1:1;return Ss(e,n/t)},W7=e=>{let t=G7(e);return t===0||t===1?e:Ss(e,1/t)},Xv=e=>typeof e=="number",Vle=jl(1,1),Yle=jl(1,2),Zle=jl(1,3),Xle=jl(1,4),Kle=jl(1,5),qle=jl(1,6),Qle=jl(1,7);S();S();var Ts=(e,t,n)=>Ul([0,n,e,t,0,0,0,0]),xd=(e,t)=>Ul(K1(t,e)),j7=(e,t)=>H7(e,t),U7=(e,t)=>j7(xd(e,t),t);var V7=e=>Math.sign(e[1]);var Cs=([e,t])=>[0,0,0,0,t,e,1,0],Ms=e=>[e[5],e[4]],Kv=e=>[0,0,0,0,Math.abs(e[4]),Math.abs(e[5]),1,0],Z7=(e,t)=>Ul(Vv(e,t));var qv=(e,t)=>Zv(K1(e,t)),gi=(e,t)=>Yv(e,t);S();var q1=e=>[0,0,0,0,e[4],e[5],0,0],X7=(e,t)=>W7([0,0,0,0,t[4]-e[4],t[5]-e[5],0,0]);S();var Q1=(e,t)=>z7(Ss(e,Math.sin(t/2)),Math.cos(t/2)),q7=e=>[1,0,0,0,-(.5*e[5]),.5*e[4],0,0],Q7=(e,t)=>{let n=.5*t;return[1,0,0,0,n*e[4],n*e[5],0,0]};var J7=(e,t)=>Ss(t,e),Ei=(e,t)=>Ul(Ss(Ss(e,t),vd(e)));S();function aZ(e,t){return Math.sqrt(J1(e,t))}function J1(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function sZ(e,t,n){let r=J1(t,n);if(r===0)return J1(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)),J1(e,Vl(t,n,i))}function Vl(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function lZ(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],o=e[t+3],a=3*r[0]-2*n[0]-o[0];a*=a;let s=3*r[1]-2*n[1]-o[1];s*=s;let l=3*i[0]-2*o[0]-n[0];l*=l;let c=3*i[1]-2*o[1]-n[1];return c*=c,a<l&&(a=l),s<c&&(s=c),a+s}function Qv(e,t,n,r){let i=r||[];if(lZ(e,t)<n){let o=e[t+0];i.length?aZ(i[i.length-1],o)>1&&i.push(o):i.push(o),i.push(e[t+3])}else{let a=e[t+0],s=e[t+1],l=e[t+2],c=e[t+3],d=Vl(a,s,.5),u=Vl(s,l,.5),h=Vl(l,c,.5),m=Vl(d,u,.5),p=Vl(u,h,.5),f=Vl(m,p,.5);Qv([a,d,m,f],0,n,i),Qv([f,p,h,c],0,n,i)}return i}function t0(e,t){return e0(e,0,e.length,t)}function e0(e,t,n,r,i){let o=i||[],a=e[t],s=e[n-1],l=0,c=1;for(let d=t+1;d<n-1;++d){let u=sZ(e[d],a,s);u>l&&(l=u,c=d)}return Math.sqrt(l)>r?(e0(e,t,c+1,r,o),e0(e,c,n,r,o)):(o.length||o.push(a),o.push(s)),o}function n0(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let o=0;o<i;o++){let a=o*3;Qv(e,a,t,r)}return n&&n>0?e0(r,0,r.length,n):r}S();var eA={mouse:8,pen:16,touch:28},cZ=16,ex={e:!0,s:!0,n:!0,w:!0},Ece={e:!0,s:!0,n:!0,w:!0,rotation:!0},dZ={e:!0,s:!0,n:!0,w:!0},tA={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},Jv={e:!0,s:!0,n:!0,w:!0},va=(e,t,n,r,i,o,a)=>{let[s,l]=De(e+n/2,t+r/2,i,o,a);return[s-n/2,l-r/2,n,r]},r0=([e,t,n,r,i,o],a,s,l,c={},d=4)=>{let u=eA[l],h=u/s.value,m=u/s.value,p=u/s.value,f=u/s.value,g=n-e,b=r-t,v=d/s.value,y=(u-b1*2)/(2*s.value),w={nw:c.nw?void 0:va(e-v-p+y,t-v-f+y,h,m,i,o,a),ne:c.ne?void 0:va(n+v-y,t-v-f+y,h,m,i,o,a),sw:c.sw?void 0:va(e-v-p+y,r+v-y,h,m,i,o,a),se:c.se?void 0:va(n+v-y,r+v-y,h,m,i,o,a),rotation:c.rotation?void 0:va(e+g/2-h/2,t-v-f+y-cZ/s.value,h,m,i,o,a)},T=5*eA.mouse/s.value;return Math.abs(g)>T&&(c.n||(w.n=va(e+g/2-h/2,t-v-f+y,h,m,i,o,a)),c.s||(w.s=va(e+g/2-h/2,r+v-y,h,m,i,o,a))),Math.abs(b)>T&&(c.w||(w.w=va(e-v-p+y,t+b/2-m/2,h,m,i,o,a)),c.e||(w.e=va(n+v-y,t+b/2-m/2,h,m,i,o,a))),w},tx=(e,t,n,r="mouse")=>{if(e.locked)return{};let i={};if(e.type==="freedraw"||Tt(e)){if(e.points.length===2){let[,a]=e.points;a[0]===0||a[1]===0?i=Jv:a[0]>0&&a[1]<0?i=tA:a[0]>0&&a[1]>0?i=Jv:a[0]<0&&a[1]>0?i=tA:a[0]<0&&a[1]<0&&(i=Jv)}}else ct(e)?i=dZ:ht(e)&&(i={rotation:!0});let o=Tt(e)?b1+8:b1;return r0(Te(e,n,!0),e.angle,t,r,i,o)},nA=(e,t)=>{if(t.editingLinearElement)return!1;if(e.length>1)return!0;let n=e[0];return Tt(n)?n.points.length>2:!0};S();S();var Ct={white:"#ffffff",black:"#000000",gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};var Tce=5,Cce=5,rA=4,i0=4,o0=1,Xi=[0,2,4,6,8];var Ki=(e,t)=>t.map(n=>Ct[e][n]),Je={transparent:Nh,charcoal:hd,white:bs,gray:Ki("gray",Xi),red:Ki("red",Xi),pink:Ki("pink",Xi),grape:Ki("grape",Xi),violet:Ki("violet",Xi),blue:Ki("blue",Xi),cyan:Ki("cyan",Xi),teal:Ki("teal",Xi),green:Ki("green",Xi),yellow:Ki("yellow",Xi),orange:Ki("orange",Xi),bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},iA=g7(Je,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),Mce=[Je.charcoal,Je.red[i0],Je.green[i0],Je.blue[i0],Je.yellow[i0]],Ice=[Je.transparent,Je.red[o0],Je.green[o0],Je.blue[o0],Je.yellow[o0]],kce=[Je.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],Ace={transparent:Je.transparent,white:Je.white,gray:Je.gray,charcoal:Je.charcoal,bronze:Je.bronze,...iA},_ce={transparent:Je.transparent,white:Je.white,gray:Je.gray,charcoal:Je.charcoal,bronze:Je.bronze,...iA},oA=e=>[Je.cyan[e],Je.blue[e],Je.violet[e],Je.grape[e],Je.pink[e],Je.green[e],Je.teal[e],Je.yellow[e],Je.orange[e],Je.red[e]],Pce=(e,t,n)=>`#${((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}`;var Lt=class e{static rg=new Wr;static cache=new WeakMap;static get=t=>e.cache.get(t);static set=(t,n)=>e.cache.set(t,n);static delete=t=>e.cache.delete(t);static destroy=()=>{e.cache=new WeakMap};static generateElementShape=(t,n)=>{let r=n?.isExporting?void 0:e.get(t);if(r!==void 0)return r;qh.delete(t);let i=aA(t,e.rg,n||{isExporting:!1,canvasBackgroundColor:Je.white,embedsValidationStatus:null});return e.cache.set(t,i),i}};var hZ=e=>{if(e.type==="arrow")return!1;if(e.type==="freedraw")return!0;let t=!ys(e.backgroundColor)||P1(e)||Ui(e);return e.type==="line"?t&&xa(e.points):t||k1(e)},rx=(e,t,n,r,i,o)=>{let a=10/t.zoom.value,s=[r,i];if(pZ(t,e)&&nA([e],t))return l0(e,o,s,a,n);let l=dt(e,o);return l&&rx(l,t,n,r,i,o)?!0:s0(e,t,n,s,o)},mZ=(e,t,n,r,i,o)=>{let a=10/t.zoom.value,s=dt(e,o);return s&&rx(s,t,n,r,i,o)?!1:!s0(e,t,n,[r,i],o)&&l0(e,o,[r,i],a,n)},s0=(e,t,n,r,i)=>{let o=10/t.zoom.value,a=ct(e)?fZ:hZ(e)?Qh:gZ;return ax({element:e,elementsMap:i,point:r,threshold:o,check:a,frameNameBoundsCache:n})},pZ=(e,t)=>e.selectedElementIds[t.id],l0=(e,t,[n,r],i,o)=>{if(ht(e))return ax({element:e,elementsMap:t,point:[n,r],threshold:i,check:Qh,frameNameBoundsCache:o});let[a,s,l,c]=Te(e,t),d=(a+l)/2,u=(s+c)/2,[h,m]=De(n,r,d,u,-e.angle);return h>a-i&&h<l+i&&m>s-i&&m<c+i},ix=(e,{x:t,y:n},r)=>{let i=ox(e,e.width,e.height);return ax({element:e,elementsMap:r,point:[t,n],threshold:i,check:EZ,frameNameBoundsCache:null})},ox=(e,t,n)=>{let i=(e.type==="diamond"?1/Math.sqrt(2):1)*Math.min(t,n);return Math.max(16,Math.min(.25*i,32))},ax=e=>{switch(e.element.type){case"rectangle":case"iframe":case"embeddable":case"image":case"text":case"diamond":case"ellipse":let t=a0(e.element,e.point,e.elementsMap);return e.check(t,e.threshold);case"freedraw":return e.check(sA(e.element,e.point,e.elementsMap),e.threshold)?wZ(e.element,e.point,e.threshold,e.elementsMap):!1;case"arrow":case"line":return SZ(e);case"selection":return console.warn("This should not happen, we need to investigate why it does."),!1;case"frame":case"magicframe":{if(e.check(a0(e.element,e.point,e.elementsMap),e.threshold))return!0;let n=e.frameNameBoundsCache?.get(e.element);return n?e.check(bZ(n,e.point),e.threshold):!1}}},a0=(e,t,n)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return sA(e,t,n);case"diamond":return yZ(e,t,n);case"ellipse":return vZ(e,t,n)}},fZ=(e,t)=>e<0,Qh=(e,t)=>e<t,gZ=(e,t)=>Math.abs(e)<t,EZ=(e,t)=>0<=e&&e<t,sA=(e,t,n)=>{let[,r,i,o]=c0(e,t,n);return Math.max(gi(r,Ts(0,1,-o)),gi(r,Ts(1,0,-i)))},bZ=(e,t)=>{let[,n,r,i]=TZ(t,e);return Math.max(gi(n,Ts(0,1,-i)),gi(n,Ts(1,0,-r)))},yZ=(e,t,n)=>{let[,r,i,o]=c0(e,t,n),a=Ts(o,i,-o*i);return gi(r,a)},vZ=(e,t,n)=>{let[r,i]=xZ(e,t,n);return-V7(i)*gi(r,i)},xZ=(e,t,n)=>{let[,r,i,o]=c0(e,t,n),[a,s]=Ms(r),l=.707,c=.707,d=i,u=o;[0,1,2,3].forEach(p=>{let f=d*l,g=u*c,b=(d*d-u*u)*l**3/d,v=(u*u-d*d)*c**3/u,y=f-b,w=g-v,T=a-b,k=s-v,M=Math.hypot(w,y),C=Math.hypot(k,T);l=Math.min(1,Math.max(0,(T*M/C+b)/d)),c=Math.min(1,Math.max(0,(k*M/C+v)/u));let P=Math.hypot(c,l);l/=P,c/=P});let h=qn(d*l,u*c),m=U7(r,h);return[r,m]},wZ=(e,t,n,r)=>{let i,o;if(e.angle===0)i=t[0]-e.x,o=t[1]-e.y;else{let[d,u,h,m]=Te(e,r),p=sn(t,[d+(h-d)/2,u+(m-u)/2],-e.angle);i=p[0]-e.x,o=p[1]-e.y}let[a,s]=e.points,l;if(Qn(a[0],a[1],i,o)<n||Qn(s[0],s[1],i,o)<n)return!0;for(let d=0;d<e.points.length;d++){let u=[s[0]-a[0],s[1]-a[1]],h=Math.hypot(u[1],u[0]),m=[u[0]/h,u[1]/h],p=[i-a[0],o-a[1]],f=(p[0]*m[0]+p[1]*m[1])/Math.hypot(m[1],m[0]);l=[a[0]+m[0]*f,a[1]+m[1]*f];let g=Qn(l[0],l[1],a[0],a[1]),b=Qn(l[0],l[1],s[0],s[1]);if(l=b<g&&g>h?s:g<b&&b>h?a:l,Math.hypot(o-l[1],i-l[0])<n)return!0;a=s,s=e.points[d+1]}let c=Lt.get(e);return c&&c.sets.length?e.fillStyle==="solid"?lx(c,i,o,"round"):hA(c,i,o,n):!1},SZ=e=>{let{element:t,threshold:n}=e;if(!Lt.get(t))return!1;let[r,i,o,a]=c0(e.element,e.point,e.elementsMap),s=Ts(0,1,-a),l=Ts(1,0,-o);if(!Qh(gi(i,s),n)||!Qh(gi(i,l),n))return!1;let[c,d]=Ms(r),u=Lt.get(t);return u?e.check===Qh&&u.some(m=>lx(m,c,d,t.roundness?"round":"sharp"))?!0:u.some(h=>hA(h,c,d,n)):!1},c0=(e,t,n)=>{let r=Cs(t),[i,o,a,s]=Te(e,n),l=d0(i,o,a,s),c=Q1(l,e.angle),d=Ei(c,r),u=Xh(d,q1(l)),h=Kv(u),m=Uv(e.x,e.y),p=Xh(d,m),f=(a-i)/2,g=(s-o)/2;return[p,h,f,g]},TZ=(e,t)=>{let n=Cs(e),[r,i,o,a]=mA(t),s=d0(r,i,o,a),l=Q1(s,t.angle),c=Ei(l,n),d=Xh(c,q1(s)),u=Kv(d),h=Uv(t.x,t.y),m=Xh(c,h),p=(o-r)/2,f=(a-i)/2;return[m,u,p,f]};var sx=(e,t)=>{let[n,r,i,o]=Te(e,t),a=d0(n,r,i,o),s=Q1(a,e.angle),l=vd(q7(q1(a)));return J7(s,l)},d0=(e,t,n,r)=>qn((e+n)/2,(t+r)/2),lA=(e,t,n,r)=>{let i=sx(e,r),o=Ei(i,Cs(t)),a=Ei(i,Cs(n)),s=xd(o,a),l=e.height/e.width,c=e.width/2,d=e.height/2,u=s[2],h=s[3],m=s[1],p=Math.abs(h),f=Math.abs(u),g;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":g=m/(c*(f+l*p));break;case"diamond":g=p<f?m/(f*c):m/(p*d);break;case"ellipse":g=m/(c*Math.sqrt(u**2+l**2*h**2));break}return g||0},cA=(e,t,n,r)=>{if(t===0){let[l,c,d,u]=Te(e,r),h=d0(l,c,d,u);return Ms(h)}let i=sx(e,r),o=Ei(i,Cs(n)),a=vd(i),s;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":s=PZ(e,t,o);break;case"ellipse":s=_Z(e,t,o);break}return Ms(Ei(a,s))},dA=(e,t,n,r=0,i)=>{let o=sx(e,i),a=Ei(o,Cs(t)),s=Ei(o,Cs(n)),l=xd(a,s),c=vd(o);return CZ(e,l,a,r).map(u=>Ms(Ei(c,u)))},CZ=(e,t,n,r=0)=>{let i;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":let a=uA(e);i=a.flatMap((s,l)=>{let c=[s,a[(l+1)%4]];return MZ(t,IZ(c,r))}).concat(a.flatMap(s=>AZ(s,r,t)));break;case"ellipse":i=kZ(e,r,t);break}if(i.length<2)return[];let o=i.sort((a,s)=>qv(a,n)-qv(s,n));return[o[0],o[o.length-1]]},uA=(e,t=1)=>{let n=t*e.width/2,r=t*e.height/2;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return[qn(n,r),qn(n,-r),qn(-n,-r),qn(-n,r)];case"diamond":return[qn(0,r),qn(n,0),qn(0,-r),qn(-n,0)]}},MZ=(e,t)=>{let[n,r]=t,i=gi(n,e),o=gi(r,e);return i*o>=0?[]:[Z7(e,xd(n,r))]},IZ=(e,t)=>{let[n,r]=e,i=Q7(X7(n,r),t);return[Ei(i,n),Ei(i,r)]},kZ=(e,t,n)=>{let r=e.width/2+t,i=e.height/2+t,o=n[2],a=n[3],s=n[1],l=r*r*o*o+i*i*a*a,c=l-s*s;if(l===0||c<=0)return[];let d=Math.sqrt(c),u=-r*r*o*s,h=-i*i*a*s;return[qn((u+r*i*a*d)/l,(h-r*i*o*d)/l),qn((u-r*i*a*d)/l,(h+r*i*o*d)/l)]},AZ=(e,t,n)=>{if(t===0)return gi(n,e)===0?[e]:[];let r=n[2],i=n[3],o=n[1],[a,s]=Ms(e),l=t,c=r*r+i*i,d=l*l*c-(r*a+i*s+o)**2;if(c===0||d<=0)return[];let u=Math.sqrt(d),h=a*i*i-s*r*i-r*o,m=s*r*r-a*r*i-i*o;return[qn((h+i*u)/c,(m-r*u)/c),qn((h-i*u)/c,(m+r*u)/c)]},_Z=(e,t,n)=>{let r=Math.abs(t),i=e.width*r/2,o=e.height*r/2,a=Math.sign(t),[s,l]=Ms(n),c=l===0?1e-4:l,d=s**2*o**2+c**2*i**2,u=(-s*o**2+a*c*Math.sqrt(Math.max(0,d-i**2*o**2)))/d,h=(-u*s-1)/c;h===0&&(h=(Object.is(h,-0)?-1:1)*.01);let m=-(i**2*u)/(h**2*o**2+u**2*i**2);return qn(m,(-u*m-1)/h)},PZ=(e,t,n)=>{let r=Math.abs(t),i=Math.sign(t),o=uA(e,r),a=0,s=null;return o.forEach(l=>{let c=i*xd(n,l)[1];c>a&&(a=c,s=l)}),s},DZ=(e,t,n,r,[i,o],a)=>{let s=(c,d)=>Math.pow(1-c,3)*r[d]+3*c*Math.pow(1-c,2)*n[d]+3*Math.pow(c,2)*(1-c)*t[d]+e[d]*Math.pow(c,3),l=0;for(;l<=1;){let c=s(l,0),d=s(l,1);if(Math.sqrt(Math.pow(c-i,2)+Math.pow(d-o,2))<a)return!0;l+=.01}return!1},lx=(e,t,n,r)=>{let i=qi(e),o=[],a=!1;for(let s of i)s.op==="move"?(a=!a,a&&o.push([s.data[0],s.data[1]])):s.op==="bcurveTo"?a&&(o.push([s.data[0],s.data[1]]),o.push([s.data[2],s.data[3]]),o.push([s.data[4],s.data[5]])):s.op==="lineTo"&&a&&o.push([s.data[0],s.data[1]]);if(o.length>=4){if(r==="sharp")return nx(o,t,n);let s=n0(o,10,5);return nx(s,t,n)}return!1},hA=(e,t,n,r)=>{let i=qi(e),o=[0,0];return i.some(({op:a,data:s},l)=>{if(a==="move")o=s;else if(a==="bcurveTo"){let c=[s[0],s[1]],d=[s[2],s[3]],u=[s[4],s[5]],h=o;return o=u,DZ(h,c,d,u,[t,n],r)}else{if(a==="lineTo")return lx(e,t,n,"sharp");a==="qcurveTo"&&console.warn("qcurveTo is not implemented yet")}return!1})};S();var Jce={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",R:"KeyR",S:"KeyS"},Ur={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:p1?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",SLASH:"/",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},ede=e=>e===Ur.ARROW_LEFT||e===Ur.ARROW_RIGHT||e===Ur.ARROW_DOWN||e===Ur.ARROW_UP,tde=e=>e.altKey,nde=e=>e.shiftKey,cx=e=>e.shiftKey;var pde=e=>!e[Ur.CTRL_OR_CMD],ux=e=>e.isBindingEnabled,vA=(e,t)=>{let n=[];return t.forEach(r=>{let i=e.getNonDeletedElement(r);i!=null&&n.push(i)}),n},Jh=(e,t,n,r)=>{let i=new Set,o=new Set;pA(e,t,n,"start",i,o,r),pA(e,n,t,"end",i,o,r);let a=Array.from(o).filter(s=>!i.has(s));vA(Qi.getScene(e),a).forEach(s=>{Ie(s,{boundElements:s.boundElements?.filter(l=>l.type!=="arrow"||l.id!==e.id)})})},pA=(e,t,n,r,i,o,a)=>{if(t!=="keep")if(t!=null)(n==null||(n==="keep"?!hx(e,t,r):r==="start"||n.id!==t.id))&&(dx(e,t,r,a),i.add(t.id));else{let s=OZ(e,r);s!=null&&o.add(s)}},fde=(e,t,n)=>{e.forEach(r=>{Vi(r)?Jh(r,u0(r,"start",t,n),u0(r,"end",t,n),n):Ed(r)&&LZ(r,n)})},LZ=(e,t)=>{wA(e,t).forEach(([n,r])=>Jh(n,r==="end"?"keep":e,r==="start"?"keep":e,t))},gde=(e,t,n,r,i)=>{t.startBoundElement!=null&&dx(e,t.startBoundElement,"start",i);let o=em(r,n.getNonDeletedElements(),i);o!=null&&!hx(e,o,"end")&&dx(e,o,"end",i)},dx=(e,t,n,r)=>{Ie(e,{[n==="start"?"startBinding":"endBinding"]:{elementId:t.id,...NZ(e,t,n,r)}}),St(t.boundElements||[]).has(e.id)||Ie(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},hx=(e,t,n)=>{let r=e[n==="start"?"endBinding":"startBinding"];return RZ(e,r?.elementId,t)},RZ=(e,t,n)=>t===n.id&&e.points.length<3,Ede=(e,t)=>{e.forEach(n=>{Vi(n)&&Jh(n,null,null,t)})},OZ=(e,t)=>{let n=t==="start"?"startBinding":"endBinding",r=e[n];return r==null?null:(Ie(e,{[n]:null}),r.elementId)},em=(e,t,n)=>jv(t,i=>Ed(i,!1)&&ix(i,e,n)),NZ=(e,t,n,r)=>{let i=n==="start"?-1:1,o=i===-1?0:e.points.length-1,a=o-i,s=Et.getPointAtIndexGlobalCoordinates(e,o,r),l=Et.getPointAtIndexGlobalCoordinates(e,a,r);return{focus:lA(t,l,s,r),gap:Math.max(1,a0(t,s,r))}},Is=(e,t,n)=>{let r=(e.boundElements??[]).filter(l=>l.type==="arrow");if(r.length===0)return;let{newSize:i,simultaneouslyUpdated:o}=n??{},a=FZ(o),s=Qi.getScene(e);vA(s,r.map(l=>l.id)).forEach(l=>{if(!Tt(l))return;let c=e;if(!$Z(l,c))return;let d=gA(c,l.startBinding,i),u=gA(c,l.endBinding,i);if(a.has(l.id)){Ie(l,{startBinding:d,endBinding:u});return}fA(l,"start",d,e,t),fA(l,"end",u,e,t),dt(l,s.getNonDeletedElementsMap())&&Yl(l,s.getNonDeletedElementsMap(),!1)})},$Z=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,FZ=e=>new Set((e||[]).map(t=>t.id)),fA=(e,t,n,r,i)=>{if(n==null||n.elementId!==r.id&&e.points.length>2)return;let o=Qi.getScene(e).getElement(n.elementId);if(o==null)return;let a=t==="start"?-1:1,s=a===-1?0:e.points.length-1,l=s-a,c=Et.getPointAtIndexGlobalCoordinates(e,l,i),d=cA(o,n.focus,c,i),u;if(n.gap===0)u=d;else{let h=dA(o,c,d,n.gap,i);h.length===0?u=d:u=h[0]}Et.movePoints(e,[{index:s,point:Et.pointFromAbsoluteCoords(e,u,i)}],{[t==="start"?"startBinding":"endBinding"]:n})},gA=(e,t,n)=>{if(t==null||n==null)return t;let{gap:r,focus:i,elementId:o}=t,{width:a,height:s}=n,{width:l,height:c}=e,d=Math.max(1,Math.min(ox(e,a,s),r*(a<s?a/l:s/c)));return{elementId:o,gap:d,focus:i}},bde=(e,t,n)=>{let r=new Set(e.map(({id:i})=>i));return e.flatMap(i=>Vi(i,!1)?BZ(i,t,n).filter(o=>!r.has(o.id)):Ed(i,!1)?wA(i,n).filter(o=>!r.has(o[0].id)):[])},BZ=(e,t,n)=>[u0(e,"start",t,n),u0(e,"end",t,n)].filter(r=>r!=null),u0=(e,t,n,r)=>em(xA(e,t,r),n,r),xA=(e,t,n)=>{let r=t==="start"?0:-1;return fd(Et.getPointAtIndexGlobalCoordinates(e,r,n))},wA=(e,t)=>Qi.getScene(e).getNonDeletedElements().map(r=>{if(!Vi(r,!1))return null;let i=EA(r,"start",e,t),o=EA(r,"end",e,t);return!i&&!o?null:[r,i&&o?"both":i?"start":"end",e]}).filter(r=>r!=null),EA=(e,t,n,r)=>e[t==="start"?"startBinding":"endBinding"]==null&&!hx(e,n,t)&&ix(n,xA(e,t,r),r),yde=(e,t,n,r)=>{let i=new Set,o=new Set,a=r==="duplicatesServeAsOld";t.forEach(s=>{let{boundElements:l}=s;if(l!=null&&l.length>0&&(l.forEach(c=>{a&&!n.has(c.id)&&i.add(c.id)}),o.add(n.get(s.id))),Vi(s)){if(s.startBinding!=null){let{elementId:c}=s.startBinding;a&&!n.has(c)&&o.add(c)}if(s.endBinding!=null){let{elementId:c}=s.endBinding;a&&!n.has(c)&&o.add(c)}(s.startBinding!=null||s.endBinding!=null)&&i.add(n.get(s.id))}}),e.filter(({id:s})=>i.has(s)).forEach(s=>{let{startBinding:l,endBinding:c}=s;Ie(s,{startBinding:bA(l,n),endBinding:bA(c,n)})}),e.filter(({id:s})=>o.has(s)).forEach(s=>{let{boundElements:l}=s;l!=null&&l.length>0&&Ie(s,{boundElements:l.map(c=>n.has(c.id)?{id:n.get(c.id),type:c.type}:c)})})},bA=(e,t)=>{if(e==null)return null;let{elementId:n,focus:r,gap:i}=e;return{focus:r,gap:i,elementId:t.get(n)??n}},vde=(e,t)=>{let n=new Set(t.map(i=>i.id)),r=new Set;t.forEach(i=>{Ed(i)?i.boundElements?.forEach(o=>{n.has(o.id)||r.add(o.id)}):Vi(i)&&(i.startBinding&&r.add(i.startBinding.elementId),i.endBinding&&r.add(i.endBinding.elementId))}),e.filter(({id:i})=>r.has(i)).forEach(i=>{Ed(i)?Ie(i,{boundElements:zZ(i.boundElements,n)}):Vi(i)&&Ie(i,{startBinding:yA(i.startBinding,n),endBinding:yA(i.endBinding,n)})})},yA=(e,t)=>e==null||t.has(e.elementId)?null:e,zZ=(e,t)=>e?e.filter(n=>!t.has(n.id)):null;var wa={version:null,points:[],zoom:null},Et=class e{elementId;selectedPointsIndices;pointerDownState;isDragging;lastUncommittedPoint;pointerOffset;startBindingElement;endBindingElement;hoverPointIndex;segmentMidPointHoveredCoords;constructor(t){this.elementId=t.id,e.normalizePoints(t),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.startBindingElement="keep",this.endBindingElement="keep",this.pointerDownState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1}},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null}static POINT_HANDLE_SIZE=10;static getElement(t,n){let r=n.get(t);return r||null}static handleBoxSelection(t,n,r,i){if(!n.editingLinearElement||n.draggingElement?.type!=="selection")return!1;let{editingLinearElement:o}=n,{selectedPointsIndices:a,elementId:s}=o,l=e.getElement(s,i);if(!l)return!1;let[c,d,u,h]=Te(n.draggingElement,i),p=e.getPointsGlobalCoordinates(l,i).reduce((f,g,b)=>((g[0]>=c&&g[0]<=u&&g[1]>=d&&g[1]<=h||t.shiftKey&&a?.includes(b))&&f.push(b),f),[]);r({editingLinearElement:{...o,selectedPointsIndices:p.length?p:null}})}static handlePointDragging(t,n,r,i,o,a,s){if(!a)return!1;let{selectedPointsIndices:l,elementId:c}=a,d=e.getElement(c,s);if(!d)return!1;let u=d.points[a.pointerDownState.lastClickedPoint];if(l&&u){if(cx(t)&&l.length===1&&d.points.length>1){let m=l[0],p=d.points[m===0?1:m-1],[f,g]=e._getShiftLockedDelta(d,s,p,[r,i],t[Ur.CTRL_OR_CMD]?null:n.gridSize);e.movePoints(d,[{index:m,point:[f+p[0],g+p[1]],isDragging:m===a.pointerDownState.lastClickedPoint}])}else{let m=e.createPointAt(d,s,r-a.pointerOffset.x,i-a.pointerOffset.y,t[Ur.CTRL_OR_CMD]?null:n.gridSize),p=m[0]-u[0],f=m[1]-u[1];e.movePoints(d,l.map(g=>{let b=g===a.pointerDownState.lastClickedPoint?e.createPointAt(d,s,r-a.pointerOffset.x,i-a.pointerOffset.y,t[Ur.CTRL_OR_CMD]?null:n.gridSize):[d.points[g][0]+p,d.points[g][1]+f];return{index:g,point:b,isDragging:g===a.pointerDownState.lastClickedPoint}}))}if(dt(d,s)&&Yl(d,s,!1),Vi(d,!1)){let m=[];l[0]===0&&m.push(fd(e.getPointGlobalCoordinates(d,d.points[0],s)));let f=l[l.length-1];f===d.points.length-1&&m.push(fd(e.getPointGlobalCoordinates(d,d.points[f],s))),m.length&&o(d,m)}return!0}return!1}static handlePointerUp(t,n,r,i,o){let{elementId:a,selectedPointsIndices:s,isDragging:l,pointerDownState:c}=n,d=e.getElement(a,o);if(!d)return n;let u={};if(l&&s){for(let h of s)if(h===0||h===d.points.length-1){xa(d.points,r.zoom.value)&&e.movePoints(d,[{index:h,point:h===0?d.points[d.points.length-1]:d.points[0]}]);let m=ux(r)?em(fd(e.getPointAtIndexGlobalCoordinates(d,h,o)),i,o):null;u[h===0?"startBindingElement":"endBindingElement"]=m}}return{...n,...u,selectedPointsIndices:l||t.shiftKey?!l&&t.shiftKey&&c.prevSelectedPointsIndices?.includes(c.lastClickedPoint)?s&&s.filter(h=>h!==c.lastClickedPoint):s:s?.includes(c.lastClickedPoint)?[c.lastClickedPoint]:s,isDragging:!1,pointerOffset:{x:0,y:0}}}static getEditorMidPoints=(t,n,r)=>{let i=dt(t,n);return!r.editingLinearElement&&t.points.length>2&&!i?[]:(wa.version===t.version&&wa.zoom===r.zoom.value||e.updateEditorMidPointsCache(t,n,r),wa.points)};static updateEditorMidPointsCache=(t,n,r)=>{let i=e.getPointsGlobalCoordinates(t,n),o=0,a=[];for(;o<i.length-1;){if(e.isSegmentTooShort(t,t.points[o],t.points[o+1],r.zoom)){a.push(null),o++;continue}let s=e.getSegmentMidPoint(t,i[o],i[o+1],o+1,n);a.push(s),o++}wa.points=a,wa.version=t.version,wa.zoom=r.zoom.value};static getSegmentMidpointHitCoords=(t,n,r,i)=>{let{elementId:o}=t,a=e.getElement(o,i);if(!a||e.getPointIndexUnderCursor(a,i,r.zoom,n.x,n.y)>=0||e.getPointsGlobalCoordinates(a,i).length>=3&&!r.editingLinearElement)return null;let c=e.POINT_HANDLE_SIZE/r.zoom.value,d=t.segmentMidPointHoveredCoords;if(d&&Qn(d[0],d[1],n.x,n.y)<=c)return d;let u=0,h=e.getEditorMidPoints(a,i,r);for(;u<h.length;){if(h[u]!==null&&Qn(h[u][0],h[u][1],n.x,n.y)<=c)return h[u];u++}return null};static isSegmentTooShort(t,n,r,i){let o=Qn(n[0],n[1],r[0],r[1]);return t.points.length>2&&t.roundness&&(o=SA(t,r)),o*i.value<e.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,r,i,o){let a=tm(n,r);if(t.points.length>2&&t.roundness){let s=mx(t,t.points[i]);if(s){let l=TA(t,t.points[i],.5),[c,d]=px(s[0],s[1],s[2],s[3],l);a=e.getPointGlobalCoordinates(t,[c,d],o)}}return a}static getSegmentMidPointIndex(t,n,r,i){let o=e.getElement(t.elementId,i);if(!o)return-1;let a=e.getEditorMidPoints(o,i,n),s=0;for(;s<a.length;){if(e.arePointsEqual(r,a[s]))return s+1;s++}return-1}static handlePointerDown(t,n,r,i,o,a,s){let l={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!o)return l;let{elementId:c}=o,d=e.getElement(c,s);if(!d)return l;let u=e.getSegmentMidpointHitCoords(o,i,n,s),h=null;if(u&&(h=e.getSegmentMidPointIndex(o,n,u,s)),t.altKey&&n.editingLinearElement)return o.lastUncommittedPoint==null&&(Ie(d,{points:[...d.points,e.createPointAt(d,s,i.x,i.y,t[Ur.CTRL_OR_CMD]?null:n.gridSize)]}),l.didAddPoint=!0),r.resumeRecording(),l.linearElementEditor={...o,pointerDownState:{prevSelectedPointsIndices:o.selectedPointsIndices,lastClickedPoint:-1,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:[d.points.length-1],lastUncommittedPoint:null,endBindingElement:em(i,a,s)},l.didAddPoint=!0,l;let m=e.getPointIndexUnderCursor(d,s,n.zoom,i.x,i.y);if(m>=0||u)l.hitElement=d;else{let{startBindingElement:k,endBindingElement:M}=o;ux(n)&&Vi(d)&&Jh(d,k,M,s)}let[p,f,g,b]=Te(d,s),v=(p+g)/2,y=(f+b)/2,w=m>-1&&De(d.x+d.points[m][0],d.y+d.points[m][1],v,y,d.angle),T=m>-1||t.shiftKey?t.shiftKey||o.selectedPointsIndices?.includes(m)?HZ([...o.selectedPointsIndices||[],m]):[m]:null;return l.linearElementEditor={...o,pointerDownState:{prevSelectedPointsIndices:o.selectedPointsIndices,lastClickedPoint:m,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:T,pointerOffset:w?{x:i.x-w[0],y:i.y-w[1]}:{x:0,y:0}},l}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:fx(t,n)}static handlePointerMove(t,n,r,i,o){if(!i.editingLinearElement)return null;let{elementId:a,lastUncommittedPoint:s}=i.editingLinearElement,l=e.getElement(a,o);if(!l)return i.editingLinearElement;let{points:c}=l,d=c[c.length-1];if(!t.altKey)return d===s&&e.deletePoints(l,[c.length-1]),{...i.editingLinearElement,lastUncommittedPoint:null};let u;if(cx(t)&&c.length>=2){let h=c[c.length-2],[m,p]=e._getShiftLockedDelta(l,o,h,[n,r],t[Ur.CTRL_OR_CMD]?null:i.gridSize);u=[m+h[0],p+h[1]]}else u=e.createPointAt(l,o,n-i.editingLinearElement.pointerOffset.x,r-i.editingLinearElement.pointerOffset.y,t[Ur.CTRL_OR_CMD]?null:i.gridSize);return d===s?e.movePoints(l,[{index:l.points.length-1,point:u}]):e.addPoints(l,i,[{point:u}]),{...i.editingLinearElement,lastUncommittedPoint:l.points[l.points.length-1]}}static getPointGlobalCoordinates(t,n,r){let[i,o,a,s]=Te(t,r),l=(i+a)/2,c=(o+s)/2,{x:d,y:u}=t;return[d,u]=De(d+n[0],u+n[1],l,c,t.angle),[d,u]}static getPointsGlobalCoordinates(t,n){let[r,i,o,a]=Te(t,n),s=(r+o)/2,l=(i+a)/2;return t.points.map(c=>{let{x:d,y:u}=t;return[d,u]=De(d+c[0],u+c[1],s,l,t.angle),[d,u]})}static getPointAtIndexGlobalCoordinates(t,n,r){let i=n<0?t.points.length+n:n,[o,a,s,l]=Te(t,r),c=(o+s)/2,d=(a+l)/2,u=t.points[i],{x:h,y:m}=t;return u?De(h+u[0],m+u[1],c,d,t.angle):De(h,m,c,d,t.angle)}static pointFromAbsoluteCoords(t,n,r){let[i,o,a,s]=Te(t,r),l=(i+a)/2,c=(o+s)/2,[d,u]=De(n[0],n[1],l,c,-t.angle);return[d-t.x,u-t.y]}static getPointIndexUnderCursor(t,n,r,i,o){let a=e.getPointsGlobalCoordinates(t,n),s=a.length;for(;--s>-1;){let l=a[s];if(Qn(i,o,l[0],l[1])*r.value<e.POINT_HANDLE_SIZE+1)return s}return-1}static createPointAt(t,n,r,i,o){let a=nm(r,i,o),[s,l,c,d]=Te(t,n),u=(s+c)/2,h=(l+d)/2,[m,p]=De(a[0],a[1],u,h,-t.angle);return[m-t.x,p-t.y]}static getNormalizedPoints(t){let{points:n}=t,r=n[0][0],i=n[0][1];return{points:n.map((o,a)=>[o[0]-r,o[1]-i]),x:t.x+r,y:t.y+i}}static normalizePoints(t){Ie(t,e.getNormalizedPoints(t))}static duplicateSelectedPoints(t,n){if(!t.editingLinearElement)return!1;let{selectedPointsIndices:r,elementId:i}=t.editingLinearElement,o=e.getElement(i,n);if(!o||r===null)return!1;let{points:a}=o,s=[],l=!1,c=-1,d=a.reduce((u,h,m)=>{if(++c,u.push(h),r.includes(m)){let f=a[m+1];f||(l=!0),u.push(f?[(h[0]+f[0])/2,(h[1]+f[1])/2]:[h[0],h[1]]),s.push(c+1),++c}return u},[]);if(Ie(o,{points:d}),l){let u=o.points[o.points.length-1];e.movePoints(o,[{index:o.points.length-1,point:[u[0]+30,u[1]+30]}])}return{appState:{...t,editingLinearElement:{...t.editingLinearElement,selectedPointsIndices:s}}}}static deletePoints(t,n){let r=0,i=0;if(n.includes(0)){let s=t.points.find((l,c)=>!n.includes(c));s&&(r=s[0],i=s[1])}let a=t.points.reduce((s,l,c)=>(n.includes(c)||s.push(s.length?[l[0]-r,l[1]-i]:[0,0]),s),[]);e._updatePoints(t,a,r,i)}static addPoints(t,n,r){let a=[...t.points,...r.map(s=>s.point)];e._updatePoints(t,a,0,0)}static movePoints(t,n,r){let{points:i}=t,o=0,a=0,s=n.find(({index:c})=>c===0);s&&(o=s.point[0]+i[s.index][0],a=s.point[1]+i[s.index][1]);let l=i.map((c,d)=>{let u=n.find(h=>h.index===d);if(u){if(s)return c;let h=u.point[0]-i[u.index][0],m=u.point[1]-i[u.index][1];return[c[0]+h,c[1]+m]}return o||a?[c[0]-o,c[1]-a]:c});e._updatePoints(t,l,o,a,r)}static shouldAddMidpoint(t,n,r,i){if(!e.getElement(t.elementId,i))return!1;let{segmentMidpoint:a}=t.pointerDownState;if(a.added||a.value===null||a.index===null||t.pointerDownState.origin===null)return!1;let s=t.pointerDownState.origin,l=Qn(s.x,s.y,n.x,n.y);return!(!r.editingLinearElement&&l<Vk/r.zoom.value)}static addMidpoint(t,n,r,i,o){let a=e.getElement(t.elementId,o);if(!a)return;let{segmentMidpoint:s}=t.pointerDownState,l={pointerDownState:t.pointerDownState,selectedPointsIndices:t.selectedPointsIndices},c=e.createPointAt(a,o,n.x,n.y,i?r.gridSize:null),d=[...a.points.slice(0,s.index),c,...a.points.slice(s.index)];return Ie(a,{points:d}),l.pointerDownState={...t.pointerDownState,segmentMidpoint:{...t.pointerDownState.segmentMidpoint,added:!0},lastClickedPoint:s.index},l.selectedPointsIndices=[s.index],l}static _updatePoints(t,n,r,i,o){let a=wd(t,n),s=wd(t,t.points),l=(a[0]+a[2])/2,c=(a[1]+a[3])/2,d=(s[0]+s[2])/2,u=(s[1]+s[3])/2,h=d-l,m=u-c,p=De(r,i,h,m,t.angle);Ie(t,{...o,points:n,x:t.x+p[0],y:t.y+p[1]})}static _getShiftLockedDelta(t,n,r,i,o){let a=e.getPointGlobalCoordinates(t,r,n),[s,l]=nm(i[0],i[1],o),{width:c,height:d}=gx(a[0],a[1],s,l);return sn([c,d],[0,0],-t.angle)}static getBoundTextElementPosition=(t,n,r)=>{let i=e.getPointsGlobalCoordinates(t,r);i.length<2&&Ie(n,{isDeleted:!0});let o=0,a=0;if(t.points.length%2===1){let s=Math.floor(t.points.length/2),l=e.getPointGlobalCoordinates(t,t.points[s],r);o=l[0]-n.width/2,a=l[1]-n.height/2}else{let s=t.points.length/2-1,l=wa.points[s];t.points.length===2&&(l=tm(i[0],i[1])),(!l||wa.version!==t.version)&&(l=e.getSegmentMidPoint(t,i[s],i[s+1],s+1,r)),o=l[0]-n.width/2,a=l[1]-n.height/2}return{x:o,y:a}};static getMinMaxXYWithBoundText=(t,n,r,i)=>{let[o,a,s,l]=r,c=(o+s)/2,d=(a+l)/2,{x:u,y:h}=e.getBoundTextElementPosition(t,i,n),m=u+i.width,p=h+i.height,f=sn([o,a],[c,d],t.angle),g=sn([s,a],[c,d],t.angle),b=sn([u,h],[c,d],-t.angle),v=sn([m,h],[c,d],-t.angle),y=sn([u,p],[c,d],-t.angle),w=sn([m,p],[c,d],-t.angle);return f[0]<g[0]&&f[1]>=g[1]?(o=Math.min(o,y[0]),s=Math.max(s,Math.max(v[0],w[0])),a=Math.min(a,b[1]),l=Math.max(l,w[1])):f[0]>=g[0]&&f[1]>g[1]?(o=Math.min(o,w[0]),s=Math.max(s,Math.max(b[0],v[0])),a=Math.min(a,y[1]),l=Math.max(l,v[1])):f[0]>=g[0]?(o=Math.min(o,v[0]),s=Math.max(s,y[0]),a=Math.min(a,w[1]),l=Math.max(l,b[1])):f[1]<=g[1]&&(o=Math.min(o,Math.min(v[0],b[0])),s=Math.max(s,w[0]),a=Math.min(a,v[1]),l=Math.max(l,y[1])),[o,a,s,l,c,d]};static getElementAbsoluteCoords=(t,n,r=!1)=>{let i,o,a,s,l;if(t.points.length<2||!Lt.get(t)){let{minX:h,minY:m,maxX:p,maxY:f}=t.points.reduce((g,[b,v])=>(g.minY=Math.min(g.minY,v),g.minX=Math.min(g.minX,b),g.maxX=Math.max(g.maxX,b),g.maxY=Math.max(g.maxY,v),g),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});o=h+t.x,a=m+t.y,s=p+t.x,l=f+t.y}else{let h=Lt.generateElementShape(t,null),m=qi(h[0]),[p,f,g,b]=rm(m);o=p+t.x,a=f+t.y,s=g+t.x,l=b+t.y}let c=(o+s)/2,d=(a+l)/2;if(i=[o,a,s,l,c,d],!r)return i;let u=dt(t,n);return u&&(i=e.getMinMaxXYWithBoundText(t,n,[o,a,s,l],u)),i}},HZ=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,r)=>n-r),t.length?t:null};S();var im={},CA=(e,t)=>{let n=im[e]||(im[e]={height:t});return n.height=t,n},MA=e=>{im[e]&&delete im[e]},$de=e=>im[e]?.height??null;var vx=e=>f7(e).replace(/\t/g," "),xx=e=>vx(e).split(`
3
- `),GZ=(e,t,n)=>{let r,i={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height};i.text=e.text,t&&(r=Ji(t,e),i.text=Td(e.originalText,In(e),r));let o=Zl(i.text,In(e),e.lineHeight);if(i.width=o.width,i.height=o.height,t){let a=am(t,e),s=Ji(t,e);if(!gt(t)&&o.height>a){let u=yx(o.height,t.type);Ie(t,{height:u}),CA(t.id,u)}if(o.width>s){let u=yx(o.width,t.type);Ie(t,{width:u})}let l={...e,...i},{x:c,y:d}=kA(t,l,n);i.x=c,i.y=d}Ie(e,i)},qde=(e,t,n)=>{let r=St(e);t.forEach(i=>{let o=n.get(i.id),a=Xl(i);if(a){let s=n.get(a);if(s){let l=r.get(o);l&&Ie(l,{boundElements:(i.boundElements||[]).filter(d=>d.id!==s&&d.id!==a).concat({type:"text",id:s})});let c=r.get(s);c&&ct(c)&&Ie(c,{containerId:l?o:null})}}})},Yl=(e,t,n,r=!1)=>{if(!Xl(e))return;MA(e.id);let o=dt(e,t);if(o&&o.text){if(!e)return;let a=o.text,s=o.height,l=o.width,c=Ji(e,o),d=am(e,o),u=e.height;if(r||n!=="n"&&n!=="s"){a&&(a=Td(o.originalText,In(o),c));let h=Zl(a,In(o),o.lineHeight);s=h.height,l=h.width}if(s>d){u=yx(s,e.type);let h=u-e.height,m=!gt(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-h:e.y;Ie(e,{height:u,y:m})}Ie(o,{text:a,width:l,height:s}),gt(e)||Ie(o,kA(e,o,t))}},kA=(e,t,n)=>{if(gt(e))return Et.getBoundTextElementPosition(e,t,n);let r=Sx(e),i=am(e,t),o=Ji(e,t),a,s;return t.verticalAlign===ga.TOP?s=r.y:t.verticalAlign===ga.BOTTOM?s=r.y+(i-t.height):s=r.y+(i/2-t.height/2),t.textAlign===Tv.LEFT?a=r.x:t.textAlign===Tv.RIGHT?a=r.x+(o-t.width):a=r.x+(o/2-t.width/2),{x:a,y:s}},Zl=(e,t,n)=>{e=e.split(`
4
- `).map(a=>a||" ").join(`
5
- `);let r=parseFloat(t),i=WZ(e,r,n);return{width:wx(e,t),height:i}},AA=e=>{let t=xx(e.text).length;return e.height/t/e.fontSize},Sd=(e,t)=>e*t,h0=(e,t,n)=>{let{unitsPerEm:r,ascender:i,descender:o}=IA[e]||IA[Cn.Helvetica],a=t/r,s=n-a*i+a*o;return a*i+s},_A=(e,t)=>Sd(e,t)+Mn*2,Ex,om=(e,t)=>{Ex||(Ex=document.createElement("canvas"));let n=Ex.getContext("2d");n.font=t;let r=n.measureText(e).width;return ba()?r*10:r},wx=(e,t)=>{let n=xx(e),r=0;return n.forEach(i=>{r=Math.max(r,om(i,t))}),r},WZ=(e,t,n)=>{let r=xx(e).length;return Sd(t,n)*r},jZ=e=>{let t=e.split("-");return t.length>1&&t.forEach((n,r)=>{r!==t.length-1&&(t[r]=n+="-")}),t.join(" ").split(" ")},Td=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return e;let r=[],i=e.split(`
6
- `),o=om(" ",t),a="",s=0,l=d=>{d.trim()&&r.push(d)},c=()=>{a="",s=0};return i.forEach(d=>{if(wx(d,t)<=n){r.push(d);return}let h=jZ(d);c();let m=0;for(;m<h.length;){let p=om(h[m],t);if(p===n)l(h[m]),m++;else if(p>n){for(l(a),c();h[m].length>0;){let f=String.fromCodePoint(h[m].codePointAt(0)),g=PA.calculate(f,t);s+=g,h[m]=h[m].slice(f.length),s>=n?(l(a),a=f,s=g):a+=f}s+o>=n?(l(a),c()):a.endsWith("-")||(a+=" ",s+=o),m++}else for(;s<n&&m<h.length;){let f=h[m];if(s=om(a+f,t),s>n){l(a),c();break}m++;let g=!f.endsWith("-");if(a+=f,g&&(a+=" "),s+o>=n){g?r.push(a.slice(0,-1)):r.push(a),c();break}}}a.slice(-1)===" "&&(a=a.slice(0,-1),l(a))}),r.join(`
7
- `)},PA=(()=>{let e={};return{calculate:(r,i)=>{let o=r.charCodeAt(0);if(e[i]||(e[i]=[]),!e[i][o]){let a=om(r,i);e[i][o]=a}return e[i][o]},getCache:r=>e[r]}})(),DA="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),LA=(e,t)=>{let n=UZ(e);return n===0?Zl(DA.split("").join(`
8
- `),e,t).width+Mn*2:n+Mn*2};var UZ=e=>{let t=PA.getCache(e);if(!t)return 0;let n=t.filter(r=>r!==void 0);return Math.max(...n)};var Xl=e=>e?.boundElements?.length&&e?.boundElements?.filter(t=>t.type==="text")[0]?.id||null,dt=(e,t)=>{if(!e)return null;let n=Xl(e);return n&&t.get(n)||null},pr=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,Qde=(e,t,n)=>{if(!gt(e))return{x:e.x+e.width/2,y:e.y+e.height/2};let r=Et.getPointsGlobalCoordinates(e,n);if(r.length%2===1){let a=Math.floor(e.points.length/2),s=Et.getPointGlobalCoordinates(e,e.points[a],n);return{x:s[0],y:s[1]}}let i=e.points.length/2-1,o=Et.getEditorMidPoints(e,n,t)[i];return o||(o=Et.getSegmentMidPoint(e,r[i],r[i+1],i+1,n)),{x:o[0],y:o[1]}},Sx=e=>{let t=Mn,n=Mn;return e.type==="ellipse"&&(t+=e.width/2*(1-Math.sqrt(2)/2),n+=e.height/2*(1-Math.sqrt(2)/2)),e.type==="diamond"&&(t+=e.width/4,n+=e.height/4),{x:e.x+t,y:e.y+n}},Jde=(e,t)=>!t||gt(t)?e.angle:t.angle;var eue=(e,t)=>e.some(n=>{if(pi(n)){let r=pr(n,t);return!gt(r)}return!1}),tue=(e,t)=>e.some(n=>{if(pi(n)){let r=pr(n,t);return!gt(r)}return ct(n)}),nue=(e,t,n,r,i)=>{let o=jr(e,t);if(o.length===1)return _1(o[0],!1)?o[0]:null;let a=null;for(let s=e.length-1;s>=0;--s){if(e[s].isDeleted)continue;let[l,c,d,u]=Te(e[s],i);if(gt(e[s])&&s0(e[s],t,null,[n,r],i)){a=e[s];break}else if(l<n&&n<d&&c<r&&r<u){a=e[s];break}}return _1(a,!1)?a:null},VZ=new Set(["rectangle","ellipse","diamond","arrow"]),rue=e=>VZ.has(e.type),yx=(e,t)=>{e=Math.ceil(e);let n=Mn*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},Ji=(e,t)=>{let{width:n}=e;if(gt(e)){let r=(t?.fontSize??$o)*Jk;return Math.max(Qk*n,r)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Mn*2:e.type==="diamond"?Math.round(n/2)-Mn*2:n-Mn*2},am=(e,t)=>{let{height:n}=e;return gt(e)?n-Mn*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Mn*2:e.type==="diamond"?Math.round(n/2)-Mn*2:n-Mn*2},iue=()=>wx(DA,In({fontSize:$o,fontFamily:ji}))>0,bx={[Cn.Virgil]:1.25,[Cn.Helvetica]:1.15,[Cn.Cascadia]:1.2},IA={[Cn.Virgil]:{unitsPerEm:1e3,ascender:886,descender:-374},[Cn.Helvetica]:{unitsPerEm:2048,ascender:1577,descender:-471},[Cn.Cascadia]:{unitsPerEm:2048,ascender:1977,descender:-480},[Cn.Assistant]:{unitsPerEm:1e3,ascender:1021,descender:-287}},m0=e=>e in bx?bx[e]:bx[ji];var Tx="invert(100%) hue-rotate(180deg) saturate(1.25)",YZ=pd(),FA=(e,t)=>Bo(e)&&!t.imageCache.has(e.fileId),BA=(e,t,n)=>n.theme===zr.DARK&&Bo(e)&&!FA(e,t)&&t.imageCache.get(e.fileId)?.mimeType!==we.svg,f0=e=>e.type==="freedraw"?e.strokeWidth*12:20,ZZ=(e,t,n)=>{let r=(t?.opacity??100)*e.opacity/1e4;return(n.has(e.id)||t&&n.has(t.id))&&(r*=e7/100),r},XZ=(e,t,n)=>{let o=f0(e),[a,s,l,c]=Te(e,t),d=Tt(e)||kn(e)?mi(a,l):e.width,u=Tt(e)||kn(e)?mi(s,c):e.height,h=d*window.devicePixelRatio+o*2,m=u*window.devicePixelRatio+o*2,p=n.value;return(h*p>32767||m*p>32767)&&(p=Math.min(32767/h,32767/m)),h*m*p*p>16777216&&(p=Math.sqrt(16777216/(h*m))),h=Math.floor(h*p),m=Math.floor(m*p),{width:h,height:m,scale:p}},KZ=(e,t,n,r,i)=>{let o=document.createElement("canvas"),a=o.getContext("2d"),s=f0(e),{width:l,height:c,scale:d}=XZ(e,t,n);o.width=l,o.height=c;let u=0,h=0;if(Tt(e)||kn(e)){let[p,f]=Te(e,t);u=e.x>p?mi(e.x,p)*window.devicePixelRatio*d:0,h=e.y>f?mi(e.y,f)*window.devicePixelRatio*d:0,a.translate(u,h)}a.save(),a.translate(s*d,s*d),a.scale(window.devicePixelRatio*d,window.devicePixelRatio*d);let m=qt.canvas(o);return BA(e,r,i)&&(a.filter=Tx),p0(e,m,a,r,i),a.restore(),{element:e,canvas:o,theme:i.theme,scale:d,zoomValue:n.value,canvasOffsetX:u,canvasOffsetY:h,boundTextElementVersion:dt(e,t)?.version||null,containingFrameOpacity:Ar(e,t)?.opacity||100}},zA=14,HA=document.createElement("img");HA.src=`data:${we.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`;var GA=document.createElement("img");GA.src=`data:${we.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`;var qZ=(e,t,n)=>{t.fillStyle="#E7E7E7",t.fillRect(0,0,e.width,e.height);let r=Math.min(e.width,e.height),i=Math.min(r,Math.min(r*.4,100));t.drawImage(e.status==="error"?GA:HA,e.width/2-i/2,e.height/2-i/2,i,i)},p0=(e,t,n,r,i)=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{n.lineJoin="round",n.lineCap="round",t.draw(Lt.get(e));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",Lt.get(e).forEach(o=>{t.draw(o)});break}case"freedraw":{n.save(),n.fillStyle=e.strokeColor;let o=QZ(e),a=Lt.get(e);a&&t.draw(a),n.fillStyle=e.strokeColor,n.fill(o),n.restore();break}case"image":{let o=Bo(e)?r.imageCache.get(e.fileId)?.image:void 0;o!=null&&!(o instanceof Promise)?(e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,Sa(Math.min(e.width,e.height),e)),n.clip()),n.drawImage(o,0,0,e.width,e.height)):qZ(e,n,i.zoom.value);break}default:if(ct(e)){let o=C1(e.text),a=o&&!n.canvas.isConnected;a&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",o?"rtl":"ltr"),n.save(),n.font=In(e),n.fillStyle=e.strokeColor,n.textAlign=e.textAlign;let s=e.text.replace(/\r\n?/g,`
9
- `).split(`
10
- `),l=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,c=Sd(e.fontSize,e.lineHeight),d=h0(e.fontFamily,e.fontSize,c);for(let u=0;u<s.length;u++)n.fillText(s[u],l,u*c+d);n.restore(),a&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},qh=new WeakMap,vue=()=>{qh=new WeakMap,Cx=new WeakMap},RA=(e,t,n,r)=>{let i=n?r.zoom:YZ.zoom,o=qh.get(e),a=o&&o.zoomValue!==i.value&&!r?.shouldCacheIgnoreZoom,s=dt(e,t)?.version||null,l=Ar(e,t)?.opacity||100;if(!o||a||o.theme!==r.theme||o.boundTextElementVersion!==s||o.containingFrameOpacity!==l){let c=KZ(e,t,i,n,r);return qh.set(e,c),c}return o},OA=(e,t,n,r,i)=>{let o=e.element,a=f0(o),s=e.scale,[l,c,d,u]=Te(o,i);kn(o)&&(l=Math.floor(l),d=Math.ceil(d),c=Math.floor(c),u=Math.ceil(u));let h=((l+d)/2+r.scrollX)*window.devicePixelRatio,m=((c+u)/2+r.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let p=dt(o,i);if(gt(o)&&p){let f=document.createElement("canvas"),g=f.getContext("2d"),b=Math.max(mi(l,d),mi(c,u));f.width=b*window.devicePixelRatio*s+a*e.scale*10,f.height=b*window.devicePixelRatio*s+a*e.scale*10;let v=(f.width-e.canvas.width)/2,y=(f.height-e.canvas.height)/2;g.translate(f.width/2,f.height/2),g.rotate(o.angle),g.drawImage(e.canvas,-e.canvas.width/2,-e.canvas.height/2,e.canvas.width,e.canvas.height);let[,,,,w,T]=Te(p,i);g.rotate(-o.angle);let k=f.width/2-(w-l)*window.devicePixelRatio*s-v-a*s,M=f.height/2-(T-c)*window.devicePixelRatio*s-y-a*s;g.translate(-k,-M),g.clearRect(-(p.width/2+Mn)*window.devicePixelRatio*s,-(p.height/2+Mn)*window.devicePixelRatio*s,(p.width+Mn*2)*window.devicePixelRatio*s,(p.height+Mn*2)*window.devicePixelRatio*s),t.translate(h,m),t.drawImage(f,-(d-l)/2*window.devicePixelRatio-v/s-a,-(u-c)/2*window.devicePixelRatio-y/s-a,f.width/s,f.height/s)}else if(t.translate(h,m),t.rotate(o.angle),"scale"in e.element&&!FA(o,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-h,-m),t.drawImage(e.canvas,(l+r.scrollX)*window.devicePixelRatio-a*e.scale/e.scale,(c+r.scrollY)*window.devicePixelRatio-a*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),N.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&P1(o)){let f=dt(o,i),g=Sx(o);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((g.x+r.scrollX)*window.devicePixelRatio,(g.y+r.scrollY)*window.devicePixelRatio,Ji(o,f)*window.devicePixelRatio,am(o,f)*window.devicePixelRatio)}t.restore()},xue=(e,t,n)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let r=.5/n.zoom.value;t.fillRect(r,r,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=" rgb(105, 101, 219)",t.strokeRect(r,r,e.width,e.height),t.restore()},sm=(e,t,n,r,i,o,a)=>{switch(i.globalAlpha=ZZ(e,Ar(e,t),o.elementsPendingErasure),e.type){case"magicframe":case"frame":{a.frameRendering.enabled&&a.frameRendering.outline&&(i.save(),i.translate(e.x+a.scrollX,e.y+a.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=Nn.strokeWidth/a.zoom.value,i.strokeStyle=Nn.strokeColor,E7(e)&&(i.strokeStyle=a.theme===zr.LIGHT?"#7affd7":"#1d8264"),Nn.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,Nn.radius/a.zoom.value),i.stroke(),i.closePath()):i.strokeRect(0,0,e.width,e.height),i.restore());break}case"freedraw":{if(Lt.generateElementShape(e,null),o.isExporting){let[s,l,c,d]=Te(e,t),u=(s+c)/2+a.scrollX,h=(l+d)/2+a.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);i.save(),i.translate(u,h),i.rotate(e.angle),i.translate(-m,-p),p0(e,r,i,o,a),i.restore()}else{let s=RA(e,t,o,a);OA(s,i,o,a,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(Lt.generateElementShape(e,o),o.isExporting){let[s,l,c,d]=Te(e,t),u=(s+c)/2+a.scrollX,h=(l+d)/2+a.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);if(ct(e)){let g=pr(e,t);if(gt(g)){let b=Et.getBoundTextElementPosition(g,e,t);m=(c-s)/2-(b.x-s),p=(d-l)/2-(b.y-l)}}i.save(),i.translate(u,h),BA(e,o,a)&&(i.filter="none");let f=dt(e,t);if(gt(e)&&f){let g=document.createElement("canvas"),b=g.getContext("2d"),v=Math.max(mi(s,c),mi(l,d)),y=f0(e);g.width=v*a.exportScale+y*10*a.exportScale,g.height=v*a.exportScale+y*10*a.exportScale,b.translate(g.width/2,g.height/2),b.scale(a.exportScale,a.exportScale),m=e.width/2-(e.x-s),p=e.height/2-(e.y-l),b.rotate(e.angle);let w=qt.canvas(g);b.translate(-m,-p),p0(e,w,b,o,a),b.translate(m,p),b.rotate(-e.angle);let[,,,,T,k]=Te(f,t),M=(s+c)/2-T,C=(l+d)/2-k;b.translate(-M,-C),b.clearRect(-f.width/2,-f.height/2,f.width,f.height),i.scale(1/a.exportScale,1/a.exportScale),i.drawImage(g,-g.width/2,-g.height/2,g.width,g.height)}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-m,-p),p0(e,r,i,o,a);i.restore()}else{let s=RA(e,t,o,a),l=i.imageSmoothingEnabled;!a?.shouldCacheIgnoreZoom&&(!e.angle||$A(e.angle))&&(i.imageSmoothingEnabled=!1),OA(s,i,o,a,n),i.imageSmoothingEnabled=l}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1},Cx=new WeakMap([]);function WA(e){let t=Mx(e),n=new Path2D(t);return Cx.set(e,n),n}function QZ(e){return Cx.get(e)}function Mx(e){let t=e.simulatePressure?e.points:e.points.length?e.points.map(([r,i],o)=>[r,i,e.pressures[o]]):[[0,0,.5]],n={simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:r=>Math.sin(r*Math.PI/2),last:!!e.lastCommittedPoint};return eX(Z1(t,n))}function NA(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var JZ=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g;function eX(e){if(!e.length)return"";let t=e.length-1;return e.reduce((n,r,i,o)=>(i===t?n.push(r,NA(r,o[0]),"L",o[0],"Z"):n.push(r,NA(r,o[i+1])),n),["M",e[0],"Q"]).join(" ").replace(JZ,"$1")}var tX=e=>[8,8+e],VA=e=>[1.5,6+e];function nX(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&&Wv(e.type)||Tt(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var Vr=(e,t=!1)=>{let n={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?tX(e.strokeWidth):e.strokeStyle==="dotted"?VA(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:nX(e),stroke:e.strokeColor,preserveVertices:t||e.roughness<Cv.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return n.fillStyle=e.fillStyle,n.fill=ys(e.backgroundColor)?void 0:e.backgroundColor,e.type==="ellipse"&&(n.curveFitting=1),n;case"line":case"freedraw":return xa(e.points)&&(n.fillStyle=e.fillStyle,n.fill=e.backgroundColor==="transparent"?void 0:e.backgroundColor),n;case"arrow":return n;default:throw new Error(`Unimplemented type ${e.type}`)}},jA=(e,t,n)=>Ui(e)&&(t||A1(e)&&n?.get(e.id)!==!0)&&ys(e.backgroundColor)&&ys(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:gd(e)?{...e,strokeColor:ys(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:ys(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,UA=(e,t,n,r,i,o,a)=>{a=a||"transparent";let s=kx(e,t,n,r);if(s===null)return[];switch(r){case"dot":case"circle":case"circle_outline":{let[l,c,d]=s;return delete o.strokeLineDash,[i.circle(l,c,d,{...o,fill:r==="circle_outline"?a:e.strokeColor,fillStyle:"solid",stroke:e.strokeColor,roughness:Math.min(.5,o.roughness||0)})]}case"triangle":case"triangle_outline":{let[l,c,d,u,h,m]=s;return delete o.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[l,c]],{...o,fill:r==="triangle_outline"?a:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,o.roughness||0)})]}case"diamond":case"diamond_outline":{let[l,c,d,u,h,m,p,f]=s;return delete o.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[p,f],[l,c]],{...o,fill:r==="diamond_outline"?a:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,o.roughness||0)})]}case"bar":case"arrow":default:{let[l,c,d,u,h,m]=s;if(e.strokeStyle==="dotted"){let p=VA(e.strokeWidth-1);o.strokeLineDash=[p[0],p[1]-1]}else delete o.strokeLineDash;return o.roughness=Math.min(1,o.roughness||0),[i.line(d,u,l,c,o),i.line(h,m,l,c,o)]}}},aA=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i})=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":{let o;if(e.roundness){let a=e.width,s=e.height,l=Sa(Math.min(a,s),e);o=t.path(`M ${l} 0 L ${a-l} 0 Q ${a} 0, ${a} ${l} L ${a} ${s-l} Q ${a} ${s}, ${a-l} ${s} L ${l} ${s} Q 0 ${s}, 0 ${s-l} L 0 ${l} Q 0 0, ${l} 0`,Vr(jA(e,n,i),!0))}else o=t.rectangle(0,0,e.width,e.height,Vr(jA(e,n,i),!1));return o}case"diamond":{let o,[a,s,l,c,d,u,h,m]=Ix(e);if(e.roundness){let p=Sa(Math.abs(a-h),e),f=Sa(Math.abs(c-s),e);o=t.path(`M ${a+p} ${s+f} L ${l-p} ${c-f}
11
- C ${l} ${c}, ${l} ${c}, ${l-p} ${c+f}
12
- L ${d+p} ${u-f}
13
- C ${d} ${u}, ${d} ${u}, ${d-p} ${u-f}
14
- L ${h+p} ${m+f}
15
- C ${h} ${m}, ${h} ${m}, ${h+p} ${m-f}
16
- L ${a-p} ${s+f}
17
- C ${a} ${s}, ${a} ${s}, ${a+p} ${s+f}`,Vr(e,!0))}else o=t.polygon([[a,s],[l,c],[d,u],[h,m]],Vr(e));return o}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,Vr(e));case"line":case"arrow":{let o,a=Vr(e),s=e.points.length?e.points:[[0,0]];if(e.roundness?o=[t.curve(s,a)]:a.fill?o=[t.polygon(s,a)]:o=[t.linearPath(s,a)],e.type==="arrow"){let{startArrowhead:l=null,endArrowhead:c="arrow"}=e;if(l!==null){let d=UA(e,o,"start",l,t,a,r);o.push(...d)}if(c!==null){let d=UA(e,o,"end",c,t,a,r);o.push(...d)}}return o}case"freedraw":{let o;if(WA(e),xa(e.points)){let a=t0(e.points,.75);o=t.curve(a,{...Vr(e),stroke:"none"})}else o=null;return o}case"frame":case"magicframe":case"text":case"image":return null;default:return I1(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}};S();var YA=e=>{let t=e.map(r=>r[0]),n=e.map(r=>r[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},ks=(e,t,n,r)=>{let i=n.map(m=>m[e]),o=Math.max(...i),a=Math.min(...i),s=o-a,l=s===0?1:t/s,c=1/0,d=n.map(m=>{let p=m[e]*l,f=[...m];return f[e]=p,p<c&&(c=p),f});if(!r||d.length===2)return d;let u=a-c;return d.map(m=>m.map((p,f)=>f===e?p+u:p))};var Ax=class e{static boundsCache=new WeakMap;static getBounds(t,n){let r=e.boundsCache.get(t);if(r?.version&&r.version===t.version&&!pi(t))return r.bounds;let i=e.calculateBounds(t,n);return e.boundsCache.set(t,{version:t.version,bounds:i}),i}static calculateBounds(t,n){let r,[i,o,a,s,l,c]=Te(t,n);if(kn(t)){let[d,u,h,m]=Px(t.points.map(([p,f])=>De(p,f,l-t.x,c-t.y,t.angle)));return[d+t.x,u+t.y,h+t.x,m+t.y]}else if(Tt(t))r=lX(t,l,c,n);else if(t.type==="diamond"){let[d,u]=De(l,o,l,c,t.angle),[h,m]=De(l,s,l,c,t.angle),[p,f]=De(i,c,l,c,t.angle),[g,b]=De(a,c,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),T=Math.max(u,m,f,b);r=[v,y,w,T]}else if(t.type==="ellipse"){let d=(a-i)/2,u=(s-o)/2,h=Math.cos(t.angle),m=Math.sin(t.angle),p=Math.hypot(d*h,u*m),f=Math.hypot(u*h,d*m);r=[l-p,c-f,l+p,c+f]}else{let[d,u]=De(i,o,l,c,t.angle),[h,m]=De(i,s,l,c,t.angle),[p,f]=De(a,s,l,c,t.angle),[g,b]=De(a,o,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),T=Math.max(u,m,f,b);r=[v,y,w,T]}return r}},Te=(e,t,n=!1)=>{if(kn(e))return iX(e);if(Tt(e))return Et.getElementAbsoluteCoords(e,t,n);if(ct(e)){let r=t?pr(e,t):null;if(gt(r)){let i=Et.getBoundTextElementPosition(r,e,t);return[i.x,i.y,i.x+e.width,i.y+e.height,i.x+e.width/2,i.y+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},_x=(e,t)=>{let[n,r,i,o,a,s]=Te(e,t),l=[a,s];if(Tt(e)||kn(e)){let b=[],v=0;for(;v<e.points.length-1;)b.push([sn([e.points[v][0]+e.x,e.points[v][1]+e.y],l,e.angle),sn([e.points[v+1][0]+e.x,e.points[v+1][1]+e.y],l,e.angle)]),v++;return b}let[c,d,u,h,m,p,f,g]=[[n,r],[i,r],[n,o],[i,o],[a,r],[a,o],[n,s],[i,s]].map(b=>sn(b,l,e.angle));return e.type==="diamond"?[[m,f],[m,g],[p,f],[p,g]]:e.type==="ellipse"?[[m,f],[m,g],[p,f],[p,g],[m,f],[m,g],[p,f],[p,g]]:[[c,d],[u,h],[c,u],[d,h],[c,g],[u,g],[d,f],[h,f]]},mA=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2];var Ix=e=>{let t=Math.floor(e.width/2)+1,n=0,r=e.width,i=Math.floor(e.height/2)+1,o=t,a=e.height;return[t,n,r,i,o,a,0,i]},qi=e=>{for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},ZA=(e,t,n,r,i)=>{let o=1-e;return Math.pow(o,3)*t+3*Math.pow(o,2)*e*n+3*o*Math.pow(e,2)*r+Math.pow(e,3)*i},XA=(e,t,n,r)=>{let i=t-e,o=n-t,a=r-n,s=3*i-6*o+3*a,l=6*o-6*i,c=3*i,d=l*l-4*s*c;if(!(d>=0))return!1;let h=null,m=null,p=1/0,f=1/0;return s===0?p=f=-c/l:(p=(-l+Math.sqrt(d))/(2*s),f=(-l-Math.sqrt(d))/(2*s)),p>=0&&p<=1&&(h=ZA(p,e,t,n,r)),f>=0&&f<=1&&(m=ZA(f,e,t,n,r)),[h,m]},rX=(e,t,n,r)=>{let i=XA(e[0],t[0],n[0],r[0]),o=XA(e[1],t[1],n[1],r[1]),a=Math.min(e[0],r[0]),s=Math.max(e[0],r[0]);if(i){let d=i.filter(u=>u!==null);a=Math.min(a,...d),s=Math.max(s,...d)}let l=Math.min(e[1],r[1]),c=Math.max(e[1],r[1]);if(o){let d=o.filter(u=>u!==null);l=Math.min(l,...d),c=Math.max(c,...d)}return[a,l,s,c]},rm=(e,t)=>{let n=[0,0],{minX:r,minY:i,maxX:o,maxY:a}=e.reduce((s,{op:l,data:c})=>{if(l==="move")n=c;else if(l==="bcurveTo"){let d=[c[0],c[1]],u=[c[2],c[3]],h=[c[4],c[5]],m=t?t(...d):d,p=t?t(...u):u,f=t?t(...h):h,g=t?t(...n):n;n=h;let[b,v,y,w]=rX(g,m,p,f);s.minX=Math.min(s.minX,b),s.minY=Math.min(s.minY,v),s.maxX=Math.max(s.maxX,y),s.maxY=Math.max(s.maxY,w)}return s},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[r,i,o,a]},Px=e=>{let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),i=Math.max(i,a);return[t,n,r,i]},iX=e=>{let[t,n,r,i]=Px(e.points),o=t+e.x,a=n+e.y,s=r+e.x,l=i+e.y;return[o,a,s,l,(o+s)/2,(a+l)/2]},oX=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;default:return 15}},aX=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},kx=(e,t,n,r)=>{let i=qi(t[0]);if(i.length<1)return null;let o=n==="start"?1:i.length-1,a=i[o].data,s=[a[4],a[5]],l=[a[2],a[3]],c=[a[0],a[1]],d=i[o-1],u=[0,0];d.op==="move"?u=d.data:d.op==="bcurveTo"&&(u=[d.data[4],d.data[5]]);let h=(H,K)=>Math.pow(1-H,3)*s[K]+3*H*Math.pow(1-H,2)*l[K]+3*Math.pow(H,2)*(1-H)*c[K]+u[K]*Math.pow(H,3),[m,p]=n==="start"?u:s,[f,g]=[h(.3,0),h(.3,1)],b=Math.hypot(m-f,p-g),v=(m-f)/b,y=(p-g)/b,w=oX(r),T=0;{let[H,K]=n==="end"?e.points[e.points.length-1]:e.points[0],[Q,ie]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];T=Math.hypot(H-Q,K-ie)}let M=Math.min(w,T*(r==="diamond"||r==="diamond_outline"?.25:.5)),C=m-v*M,P=p-y*M;if(r==="dot"||r==="circle"||r==="circle_outline"){let H=Math.hypot(P-p,C-m)+e.strokeWidth-2;return[m,p,H]}let R=aX(r),[A,_]=De(C,P,m,p,-R*Math.PI/180),[$,W]=De(C,P,m,p,R*Math.PI/180);if(r==="diamond"||r==="diamond_outline"){let H,K;if(n==="start"){let[Q,ie]=e.points.length>1?e.points[1]:[0,0];[H,K]=De(m+M*2,p,m,p,Math.atan2(ie-p,Q-m))}else{let[Q,ie]=e.points.length>1?e.points[e.points.length-2]:[0,0];[H,K]=De(m-M*2,p,m,p,Math.atan2(p-ie,m-Q))}return[m,p,A,_,H,K,$,W]}return[m,p,A,_,$,W]},sX=e=>{let t=qt.generator(),n=Vr(e),r=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[r](e.points,n)},lX=(e,t,n,r)=>{let i=dt(e,r);if(e.points.length<2){let[u,h]=e.points[0],[m,p]=De(e.x+u,e.y+h,t,n,e.angle),f=[m,p,m,p];if(i){let g=Et.getMinMaxXYWithBoundText(e,r,[m,p,m,p],i);f=[g[0],g[1],g[2],g[3]]}return f}let a=Lt.get(e)?.[0]??sX(e),s=qi(a),c=rm(s,(u,h)=>De(e.x+u,e.y+h,t,n,e.angle)),d=[c[0],c[1],c[2],c[3]];if(i){let u=Et.getMinMaxXYWithBoundText(e,r,d,i);d=[u[0],u[1],u[2],u[3]]}return d},eo=(e,t)=>Ax.getBounds(e,t),kr=e=>{if(!e.length)return[0,0,0,0];let t=1/0,n=-1/0,r=1/0,i=-1/0,o=St(e);return e.forEach(a=>{let[s,l,c,d]=eo(a,o);t=Math.min(t,s),r=Math.min(r,l),n=Math.max(n,c),i=Math.max(i,d)}),[t,r,n,i]},Uue=(e,t)=>{let[n,r,i,o]=kr(e);return[n+t.x,r+t.y,i+t.x,o+t.y]},Kl=(e,t,n,r)=>{if(!(Tt(e)||kn(e)))return[e.x,e.y,e.x+t,e.y+n];let i=ks(0,t,ks(1,n,e.points,r),r),o;if(kn(e))o=Px(i);else{let d=qt.generator(),u=e.roundness?d.curve(i,Vr(e)):d.linearPath(i,Vr(e)),h=qi(u);o=rm(h)}let[a,s,l,c]=o;return[a+e.x,s+e.y,l+e.x,c+e.y]},wd=(e,t)=>{let n=qt.generator(),r=e.roundness==null?n.linearPath(t,Vr(e)):n.curve(t,Vr(e)),i=qi(r),[o,a,s,l]=rm(i);return[o+e.x,a+e.y,s+e.x,l+e.y]},Hv=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,r=e[0],i=St(e);return e.forEach(o=>{let[a,s,l,c]=eo(o,i),d=Qn((a+l)/2,(s+c)/2,t.x,t.y);d<n&&(n=d,r=o)}),eo(r,i)},KA=e=>{let[t,n,r,i]=kr(e);return{minX:t,minY:n,maxX:r,maxY:i,width:r-t,height:i-n,midX:(t+r)/2,midY:(n+i)/2}},Vue=({scrollX:e,scrollY:t,width:n,height:r,zoom:i})=>[-e,-t,-e+n/i.value,-t+r/i.value];var De=(e,t,n,r,i)=>[(e-n)*Math.cos(i)-(t-r)*Math.sin(i)+n,(e-n)*Math.sin(i)+(t-r)*Math.cos(i)+r],sn=(e,t,n)=>De(e[0],e[1],t[0],t[1],n),g0=(e,t,n,r,i,o,a,s)=>{let l=Math.cos(r),c=Math.sin(r);return e.e&&e.w?t+=i+a:e.e?(t+=i*(1+l),n+=i*c,t+=a*(1-l),n+=a*-c):e.w&&(t+=i*(1-l),n+=i*-c,t+=a*(1+l),n+=a*c),e.n&&e.s?n+=o+s:e.n?(t+=o*c,n+=o*(1-l),t+=s*-c,n+=s*(1+l)):e.s&&(t+=o*-c,n+=o*(1+l),t+=s*c,n+=s*(1-l)),[t,n]};var Qn=(e,t,n,r)=>{let i=n-e,o=r-t;return Math.hypot(i,o)},tm=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],xa=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return Qn(n[0],n[1],r[0],r[1])<=Yk/t}return!1},nx=(e,t,n)=>{let r=e.length;if(r<3)return!1;let i=[Number.MAX_SAFE_INTEGER,n],o=[t,n],a=0;for(let s=0;s<r;s++){let l=e[s],c=e[(s+1)%r];if(cX(l,c,o,i)){if(lm(l,o,c)===0)return ql(l,o,c);a++}}return a%2===1},ql=(e,t,n)=>t[0]<=Math.max(e[0],n[0])&&t[0]>=Math.min(e[0],n[0])&&t[1]<=Math.max(e[1],n[1])&&t[1]>=Math.min(e[1],n[1]),lm=(e,t,n)=>{let r=(t[1]-e[1])*(n[0]-t[0])-(t[0]-e[0])*(n[1]-t[1]);return r===0?0:r>0?1:2},cX=(e,t,n,r)=>{let i=lm(e,t,n),o=lm(e,t,r),a=lm(n,r,e),s=lm(n,r,t);return!!(i!==o&&a!==s||i===0&&ql(e,n,t)||o===0&&ql(e,r,t)||a===0&&ql(n,e,r)||s===0&&ql(n,t,r))},nm=(e,t,n)=>n?[Math.round(e/n)*n,Math.round(t/n)*n]:[e,t],Sa=(e,t)=>{if(t.roundness?.type===Hr.PROPORTIONAL_RADIUS||t.roundness?.type===Hr.LEGACY)return e*x1;if(t.roundness?.type===Hr.ADAPTIVE_RADIUS){let n=t.roundness?.value??t7,r=n/x1;return e<=r?e*x1:n}return 0},mx=(e,t)=>{let n=Lt.generateElementShape(e,null);if(!n)return null;let r=qi(n[0]),i=[0,0],o=0,a=1/0,s=null;for(;o<r.length;){let{op:l,data:c}=r[o];if(l==="move"&&(i=c),l==="bcurveTo"){let d=i,u=[c[0],c[1]],h=[c[2],c[3]],m=[c[4],c[5]],p=Qn(m[0],m[1],t[0],t[1]);p<a&&(a=p,s=[d,u,h,m]),i=m}o++}return s},px=(e,t,n,r,i)=>{let o=(l,c)=>Math.pow(1-l,3)*r[c]+3*l*Math.pow(1-l,2)*n[c]+3*Math.pow(l,2)*(1-l)*t[c]+e[c]*Math.pow(l,3),a=o(i,0),s=o(i,1);return[a,s]},dX=(e,t)=>{let n=mx(e,t);if(!n)return[];let r=[],i=1;for(;i>0;){let o=px(n[0],n[1],n[2],n[3],i);r.push([o[0],o[1]]),i-=.05}return r.length&&fx(r.at(-1),t)&&r.push([t[0],t[1]]),r},qA=(e,t)=>{let n=[];n[0]=0;let r=dX(e,t),i=0,o=0;for(;i<r.length-1;){let a=Qn(r[i][0],r[i][1],r[i+1][0],r[i+1][1]);o+=a,n.push(o),i++}return n},SA=(e,t)=>qA(e,t).at(-1),TA=(e,t,n)=>{let r=qA(e,t),i=r.length-1,o=r.at(-1),a=n*o,s=0,l=i,c=0;for(;s<l;)c=Math.floor(s+(l-s)/2),r[c]<a?s=c+1:l=c;return r[c]>a&&c--,r[c]===a?c/i:1-(c+(a-r[c])/(r[c+1]-r[c]))/i},fx=(e,t)=>e[0]===t[0]&&e[1]===t[1],$A=e=>Math.round(e/Math.PI*1e4)%5e3===0,Que=([e,t],[n,r])=>e<=n?t>=n:e>=n?r>=e:!1,Jue=(e,t)=>{let n=Math.max(e[0],t[0]),r=Math.min(e[1],t[1]);return n<=r?[n,r]:null},cm=(e,t,n)=>e>=t&&e<=n;S();var uX=(e,t,n)=>{let r=n.reduce((i,o)=>(o.groupIds.includes(e)&&(i[o.id]=!0),i),{});return Object.keys(r).length<2?t.selectedGroupIds[e]||t.editingGroupId===e?{selectedElementIds:t.selectedElementIds,selectedGroupIds:{...t.selectedGroupIds,[e]:!1},editingGroupId:null}:t:{editingGroupId:t.editingGroupId,selectedGroupIds:{...t.selectedGroupIds,[e]:!0},selectedElementIds:{...t.selectedElementIds,...r}}},ohe=function(){let e=null,t=null,n=null,r=(o,a,s,l)=>{if(n!==void 0&&a===t&&o===e&&s.editingGroupId===n?.editingGroupId)return n;let c={};for(let h of o){let m=h.groupIds;if(s.editingGroupId){let p=m.indexOf(s.editingGroupId);p>-1&&(m=m.slice(0,p))}if(m.length>0){let p=m[m.length-1];c[p]=!0}}let d={},u=a.reduce((h,m)=>{let p=m.groupIds.find(f=>c[f]);return p&&(h[m.id]=!0,Array.isArray(d[p])?d[p].push(m.id):d[p]=[m.id]),h},{});for(let h of Object.keys(d))d[h].length<2&&c[h]&&(c[h]=!1);return t=a,e=o,n={editingGroupId:s.editingGroupId,selectedGroupIds:c,selectedElementIds:Dx({...s.selectedElementIds,...u},l)},n},i=(o,a,s,l)=>{let c=l?l.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,elements:a}):jr(a,o);return c.length?r(c,a,o,s):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:Dx(o.selectedElementIds,s)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),ahe=(e,t)=>hX(e,t)!=null,hX=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),she=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),QA=(e,t)=>{let n={...t,selectedGroupIds:{}};for(let r of e){let i=r.groupIds;if(t.editingGroupId){let o=i.indexOf(t.editingGroupId);o>-1&&(i=i.slice(0,o))}if(i.length>0){let o=i[i.length-1];n={...n,...uX(o,n,e)}}}return n.selectedGroupIds},lhe=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),mX=(e,t)=>e.groupIds.includes(t),Cd=(e,t)=>{let n=[];for(let r of e.values())mX(r,t)&&n.push(r);return n},che=(e,t)=>e.groupIds.find(n=>t[n]),JA=(e,t,n)=>{let r=[...e],i=t?e.indexOf(t):-1,o=i>-1?i:e.length;for(let a=0;a<o;a++)r[a]=n(r[a]);return r},dhe=(e,t,n)=>{let r=[...e],i=n?r.indexOf(n):-1,o=i>-1?i:r.length;return r.splice(o,0,t),r},uhe=(e,t)=>e.filter(n=>!t[n]),hhe=(e,t)=>{let n=new Map;return e.forEach(r=>{let i=r.groupIds.length===0?r.id:r.groupIds[r.groupIds.length-1],o=n.get(i)||[],a=dt(r,t);a&&o.push(a),n.set(i,[...o,r])}),Array.from(n.values())};S();S();S();S();S();var e_=L(Lx(),1),b0=e=>e.replace(/"/g,"&quot;"),Md=e=>(e=e.trim(),e&&(0,e_.sanitizeUrl)(b0(e))),Ehe=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),t_=e=>{if(e=Md(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e};S();S();var n_=[],r_=e=>(n_=n_.concat(e),e);S();var o_='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',SX='<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"/>',a_='<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"/>',TX=`data:${we.svg},${encodeURIComponent(`${o_}${a_}</svg>`)}`,CX=`data:${we.svg},${encodeURIComponent(`${o_}${SX}${a_}</svg>`)}`,MX=e=>{e&&(e.style.cursor="")},IX=(e,t)=>{e&&(e.style.cursor=t)},Ho,i_,kX=(e,t)=>{let r=()=>{let i=t===zr.DARK;Ho=document.createElement("canvas"),Ho.theme=t,Ho.height=20,Ho.width=20;let o=Ho.getContext("2d");o.lineWidth=1,o.beginPath(),o.arc(Ho.width/2,Ho.height/2,5,0,2*Math.PI),o.fillStyle=i?Ct.black:Ct.white,o.fill(),o.strokeStyle=i?Ct.white:Ct.black,o.stroke(),i_=Ho.toDataURL(we.svg)};(!Ho||Ho.theme!==t)&&r(),IX(e,`url(${i_}) ${20/2} ${20/2}, auto`)},s_=(e,t)=>{if(e)if(t.activeTool.type==="selection")MX(e);else if(a7(t))e.style.cursor=f1.GRAB;else if(o7(t))kX(e,t.theme);else if(t.activeTool.type==="laser"){let n=t.theme===zr.LIGHT?TX:CX;e.style.cursor=`url(${n}), auto`}else if(!["image","custom"].includes(t.activeTool.type))e.style.cursor=f1.CROSSHAIR;else if(t.activeTool.type==="custom"&&t.activeTool.customType==="comment"){let n=`data:${we.svg},${encodeURIComponent(`
18
- <svg
19
- width="24"
20
- height="24"
21
- viewBox="0 0 24 24"
22
- xmlns="http://www.w3.org/2000/svg"
23
- >
24
- <path
25
- d="M5.25 18A3.25 3.25 0 0 1 2 14.75v-8.5A3.25 3.25 0 0 1 5.25 3h13.5A3.25 3.25 0 0 1 22 6.25v8.5A3.25 3.25 0 0 1 18.75 18h-5.738L8 21.75a1.25 1.25 0 0 1-1.999-1V18h-.75Zm7.264-1.5h6.236a1.75 1.75 0 0 0 1.75-1.75v-8.5a1.75 1.75 0 0 0-1.75-1.75H5.25A1.75 1.75 0 0 0 3.5 6.25v8.5c0 .966.784 1.75 1.75 1.75h2.249v3.75l5.015-3.75Z"
26
- fill="${t.theme===zr.LIGHT?"#000":"#fff"}"
27
- />
28
- </svg>
29
- `)}`;e.style.cursor=`url(${n}) 5 20, auto`}else t.activeTool.type!=="image"&&(e.style.cursor=f1.AUTO)};S();S();var AX=new ws(Date.now()),_X=0,Go=()=>Math.floor(AX.next()*2**31);var to=()=>ba()?`id${_X++}`:Fo();var Ta=(e,{x:t,y:n,strokeColor:r=Dt.strokeColor,backgroundColor:i=Dt.backgroundColor,fillStyle:o=Dt.fillStyle,strokeWidth:a=Dt.strokeWidth,strokeStyle:s=Dt.strokeStyle,roughness:l=Dt.roughness,opacity:c=Dt.opacity,width:d=0,height:u=0,angle:h=0,groupIds:m=[],frameId:p=null,roundness:f=null,boundElements:g=null,link:b=null,locked:v=Dt.locked,...y})=>({id:y.id||to(),type:e,x:t,y:n,width:d,height:u,angle:h,strokeColor:r,backgroundColor:i,fillStyle:o,strokeWidth:a,strokeStyle:s,roughness:l,opacity:c,groupIds:m,frameId:p,roundness:f,seed:y.seed??Go(),version:y.version||1,versionNonce:y.versionNonce??0,isDeleted:!1,boundElements:g,updated:Ea(),link:b,locked:v,customData:y.customData}),dm=e=>Ta(e.type,e),Hhe=e=>Ta("embeddable",e),Ghe=e=>({...Ta("iframe",e)}),Whe=e=>Jl({...Ta("frame",e),type:"frame",name:e?.name||null},{}),jhe=e=>Jl({...Ta("magicframe",e),type:"magicframe",name:e?.name||null},{}),l_=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),Wo=e=>{let t=e.fontFamily||ji,n=e.fontSize||$o,r=e.lineHeight||m0(t),i=vx(e.text),o=Zl(i,In({fontFamily:t,fontSize:n}),r),a=e.textAlign||ud,s=e.verticalAlign||E1,l=l_({textAlign:a,verticalAlign:s},o);return Jl({...Ta("text",e),text:i,fontSize:n,fontFamily:t,textAlign:a,verticalAlign:s,x:e.x-l.x,y:e.y-l.y,width:o.width,height:o.height,containerId:e.containerId||null,originalText:i,lineHeight:r},{})},PX=(e,t,n)=>{let{width:r,height:i}=Zl(n,In(e),e.lineHeight),{textAlign:o,verticalAlign:a}=e,s,l;if(o==="center"&&a===ga.MIDDLE&&!e.containerId){let c=Zl(e.text,In(e),e.lineHeight),d=l_(e,{width:r-c.width,height:i-c.height});s=e.x-d.x,l=e.y-d.y}else{let[c,d,u,h]=Te(e,t),[m,p,f,g]=Kl(e,r,i,!1),b=(c-m)/2,v=(d-p)/2,y=(u-f)/2,w=(h-g)/2;[s,l]=g0({s:!0,e:o==="center"||o==="left",w:o==="center"||o==="right"},e.x,e.y,e.angle,b,v,y,w)}return{width:r,height:i,x:Number.isFinite(s)?s:e.x,y:Number.isFinite(l)?l:e.y}},x0=(e,t,n,r=e.text)=>{if(e.isDeleted)return;t&&(r=Td(r,In(e),Ji(t,e)));let i=PX(e,n,r);return{text:r,...i}},DX=(e,t,n,{text:r,isDeleted:i,originalText:o})=>Jl(e,{originalText:o,isDeleted:i??e.isDeleted,...x0(e,t,n,o)}),Uhe=e=>({...Ta(e.type,e),points:e.points||[],pressures:[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),Ql=e=>({...Ta(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null}),LX=e=>({...Ta("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,scale:e.scale??[1,1]}),y0=(e,t=0)=>{if(e==null||typeof e!="object")return e;let n=Object.prototype.toString.call(e);if(n==="[object Object]"){let r=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(let i in e)if(e.hasOwnProperty(i)){if(t===0&&(i==="shape"||i==="canvas"))continue;r[i]=y0(e[i],t+1)}return r}if(Array.isArray(e)){let r=e.length,i=new Array(r);for(;r--;)i[r]=y0(e[r],t+1);return i}return N.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},Rx=e=>y0(e),v0=e=>{if(ba()&&e){let t=`${e}_copy`;return window.h?.app?.getSceneElementsIncludingDeleted().find(n=>n.id===t)&&(t+="_copy"),t}return to()},RX=(e,t,n,r)=>{let i=Rx(n);return i.id=v0(i.id),i.boundElements=null,i.updated=Ea(),i.seed=Go(),i.groupIds=JA(i.groupIds,e,o=>(t.has(o)||t.set(o,v0(o)),t.get(o))),r&&(i=Object.assign(i,r)),i},Vhe=(e,t)=>{let n=[],r=St(e),i=new Map,o=s=>{if(i.has(s))return i.get(s);if(r.has(s)){let l=v0(s);return i.set(s,l),l}return null},a=new Map;for(let s of e){let l=y0(s);if(l.id=o(s.id),t?.randomizeSeed&&(l.seed=Go(),um(l)),l.groupIds&&(l.groupIds=l.groupIds.map(c=>(a.has(c)||a.set(c,v0(c)),a.get(c)))),"containerId"in l&&l.containerId){let c=o(l.containerId);l.containerId=c}if("boundElements"in l&&l.boundElements&&(l.boundElements=l.boundElements.reduce((c,d)=>{let u=o(d.id);return u&&c.push({...d,id:u}),c},[])),"endBinding"in l&&l.endBinding){let c=o(l.endBinding.elementId);l.endBinding=c?{...l.endBinding,elementId:c}:null}if("startBinding"in l&&l.startBinding){let c=o(l.startBinding.elementId);l.startBinding=c?{...l.startBinding,elementId:c}:null}l.frameId&&(l.frameId=o(l.frameId)),n.push(l)}return n};var Ca=new Map,OX=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/,NX=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,$X=/^https:\/\/(?:www\.)?figma\.com/,c_=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,FX=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,d_=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,BX=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,zX=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,HX=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,u_=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,Ox=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com","dddice.com"]),h_=e=>`<html><body>${e}</body></html>`,p_=e=>{if(!e)return null;if(Ca.has(e))return Ca.get(e);let t=e,n="generic",r={w:560,h:840},i=e.match(OX);if(i?.[2]){let l=i[3]?`&start=${i[3]}`:"",c=e.includes("shorts");switch(n="video",i[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${i[2]}?enablejsapi=1${l}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${i[2]}&enablejsapi=1${l}`;break;default:e=`https://www.youtube.com/embed/${i[2]}?enablejsapi=1${l}`;break}return r=c?{w:315,h:560}:{w:560,h:315},Ca.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n}}let o=e.match(NX);if(o?.[1]){let l=o?.[1],c=/^\d+$/.test(l)?void 0:new URIError("Invalid embed link format");return n="video",e=`https://player.vimeo.com/video/${l}?api=1`,r={w:560,h:315},Ca.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n,error:c}}if(e.match($X))return n="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,r={w:550,h:550},Ca.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n};let s=e.match(zX);if(s)return e=s[1]==="embed"?s[0]:s[0].replace("/v","/embed"),Ca.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n};if(d_.test(e)){let l=e.match(d_)[1],c=b0(`https://twitter.com/x/status/${l}`),d={type:"document",srcdoc:u=>h_(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${u}"><a href="${c}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:!0}};return Ca.set(t,d),d}if(c_.test(e)){let[,l,c]=e.match(c_),d=b0(`https://gist.github.com/${l}/${c}`),u={type:"document",srcdoc:()=>h_(`
30
- <script src="${d}.js"><\/script>
31
- <style type="text/css">
32
- * { margin: 0px; }
33
- table, .gist { height: 100%; }
34
- .gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
35
- </style>
36
- `),intrinsicSize:{w:550,h:720}};return Ca.set(e,u),u}return Ca.set(e,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n}},w0=e=>{let t;gd(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),r=Cn.Helvetica,i=In({fontSize:n,fontFamily:r});return Wo({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:r,fontSize:n,text:Td(t,i,e.width-20),textAlign:"center",verticalAlign:ga.MIDDLE,angle:e.angle??0})},rme=r_({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,t,n,r)=>{let i=$h(t,{type:"embeddable"});return s_(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:$h(t,{type:"embeddable"})},commitToHistory:!1}}}),m_=(e,t)=>{try{let{hostname:n}=new URL(e),r=n.replace(/^www\./,""),i=r.replace(/^([^.]+)/,"*");if(t instanceof Set)return Ox.has(r)||Ox.has(i);if(r===t.replace(/^www\./,""))return!0}catch{}return!1},ime=e=>{let t=e.match(BX);if(t&&t.length===2)return t[1];let n=e.match(FX);if(n&&n.length===2)return n[1];if(u_.test(e))return`https://giphy.com/embed/${u_.exec(e)[1]}`;let r=e.match(HX);return r&&r.length===2?r[1]:e},ome=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(m_(e,n))return!0;return!1}}return m_(e,Ox)};var hm=(e,t,n)=>{if(typeof n>"u")return e.draw(t);let r={sets:t.sets,shape:t.shape,options:{...t.options,fixedDecimalPlaceDigits:n}};return e.draw(r)},mm=(e,t,n,r,i)=>{if(!r.enabled||!r.clip)return null;let o=Ar(e,i);if(o){let a=t.ownerDocument.createElementNS(ft,"g");return a.setAttributeNS(ft,"clip-path",`url(#${o.id})`),n.forEach(s=>a.appendChild(s)),a}return null},Nx=(e,t,n,r,i,o,a,s)=>{let l={x:o,y:a},[c,d,u,h]=Te(e,t),m=(u-c)/2-(e.x-c),p=(h-d)/2-(e.y-d);if(ct(e)){let y=pr(e,t);if(gt(y)){let[w,T,k,M]=Te(y,t),C=Et.getBoundTextElementPosition(y,e,t);m=(k-w)/2-(C.x-w),p=(M-T)/2-(C.y-T),o=o+C.x-e.x,a=a+C.y-e.y}}let f=180*e.angle/Math.PI,g=r;if(e.link){let y=r.ownerDocument.createElementNS(ft,"a");y.setAttribute("href",Md(e.link)),g.appendChild(y),g=y}let b=(y,w)=>{ba()&&y.setAttribute("data-id",w.id),g.appendChild(y)},v=(Ar(e,t)?.opacity??100)*e.opacity/1e4;switch(e.type){case"selection":throw new Error("Selection rendering is not supported for SVG");case"rectangle":case"diamond":case"ellipse":{let y=Lt.generateElementShape(e,null),w=hm(n,y,md);v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`);let T=mm(e,g,[w],s.frameRendering,t);b(T||w,e);break}case"iframe":case"embeddable":{let y=Lt.generateElementShape(e,s),w=hm(n,y,md),T=e.opacity/100;T!==1&&(w.setAttribute("stroke-opacity",`${T}`),w.setAttribute("fill-opacity",`${T}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),b(w,e);let k=w0(e);Nx(k,t,n,g,i,k.x+l.x-e.x,k.y+l.y-e.y,s);let M=hm(n,y,md);for(M.setAttribute("stroke-linecap","round"),M.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`);M.firstChild;)M.removeChild(M.firstChild);let C=Sa(Math.min(e.width,e.height),e),P=p_(t_(e.link||""));if(s.renderEmbeddables===!1||P?.type==="document"){let R=r.ownerDocument.createElementNS(ft,"a");R.setAttribute("href",Md(e.link||"")),R.setAttribute("target","_blank"),R.setAttribute("rel","noopener noreferrer"),R.style.borderRadius=`${C}px`,M.appendChild(R)}else{let R=r.ownerDocument.createElementNS(ft,"foreignObject");R.style.width=`${e.width}px`,R.style.height=`${e.height}px`,R.style.border="none";let A=R.ownerDocument.createElementNS(ft,"div");A.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),A.style.width="100%",A.style.height="100%";let _=A.ownerDocument.createElement("iframe");_.src=P?.link??"",_.style.width="100%",_.style.height="100%",_.style.border="none",_.style.borderRadius=`${C}px`,_.style.top="0",_.style.left="0",_.allowFullscreen=!0,A.appendChild(_),R.appendChild(A),M.appendChild(R)}b(M,e);break}case"line":case"arrow":{let y=dt(e,t),w=r.ownerDocument.createElementNS(ft,"mask");if(y){w.setAttribute("id",`mask-${e.id}`);let C=r.ownerDocument.createElementNS(ft,"rect");o=o||0,a=a||0,C.setAttribute("x","0"),C.setAttribute("y","0"),C.setAttribute("fill","#fff"),C.setAttribute("width",`${e.width+100+o}`),C.setAttribute("height",`${e.height+100+a}`),w.appendChild(C);let P=r.ownerDocument.createElementNS(ft,"rect"),R=Et.getBoundTextElementPosition(e,y,t),A=o+R.x-e.x,_=a+R.y-e.y;P.setAttribute("x",A.toString()),P.setAttribute("y",_.toString()),P.setAttribute("fill","#000"),P.setAttribute("width",`${y.width}`),P.setAttribute("height",`${y.height}`),P.setAttribute("opacity","1"),w.appendChild(P)}let T=r.ownerDocument.createElementNS(ft,"g");y&&T.setAttribute("mask",`url(#mask-${e.id})`),T.setAttribute("stroke-linecap","round"),Lt.generateElementShape(e,s).forEach(C=>{let P=hm(n,C,md);v!==1&&(P.setAttribute("stroke-opacity",`${v}`),P.setAttribute("fill-opacity",`${v}`)),P.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),e.type==="line"&&xa(e.points)&&e.backgroundColor!=="transparent"&&P.setAttribute("fill-rule","evenodd"),T.appendChild(P)});let M=mm(e,g,[T,w],s.frameRendering,t);M?(b(M,e),g.appendChild(M)):(b(T,e),g.append(w));break}case"freedraw":{let y=Lt.generateElementShape(e,s),w=y?hm(n,y,md):r.ownerDocument.createElementNS(ft,"g");v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),w.setAttribute("stroke","none");let T=r.ownerDocument.createElementNS(ft,"path");T.setAttribute("fill",e.strokeColor),T.setAttribute("d",Mx(e)),w.appendChild(T);let k=mm(e,g,[w],s.frameRendering,t);b(k||w,e);break}case"image":{let y=Math.round(e.width),w=Math.round(e.height),T=Bo(e)&&i[e.fileId];if(T){let k=`image-${T.id}`,M=r.querySelector(`#${k}`);if(!M){M=r.ownerDocument.createElementNS(ft,"symbol"),M.id=k;let A=r.ownerDocument.createElementNS(ft,"image");A.setAttribute("width","100%"),A.setAttribute("height","100%"),A.setAttribute("href",T.dataURL),M.appendChild(A),g.prepend(M)}let C=r.ownerDocument.createElementNS(ft,"use");if(C.setAttribute("href",`#${k}`),s.exportWithDarkMode&&T.mimeType!==we.svg&&C.setAttribute("filter",Tx),C.setAttribute("width",`${y}`),C.setAttribute("height",`${w}`),C.setAttribute("opacity",`${v}`),e.scale[0]!==1||e.scale[1]!==1){let A=e.scale[0]!==1?-y:0,_=e.scale[1]!==1?-w:0;C.setAttribute("transform",`scale(${e.scale[0]}, ${e.scale[1]}) translate(${A} ${_})`)}let P=r.ownerDocument.createElementNS(ft,"g");if(P.appendChild(C),P.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),e.roundness){let A=r.ownerDocument.createElementNS(ft,"clipPath");A.id=`image-clipPath-${e.id}`;let _=r.ownerDocument.createElementNS(ft,"rect"),$=Sa(Math.min(e.width,e.height),e);_.setAttribute("width",`${e.width}`),_.setAttribute("height",`${e.height}`),_.setAttribute("rx",`${$}`),_.setAttribute("ry",`${$}`),A.appendChild(_),b(A,e),P.setAttributeNS(ft,"clip-path",`url(#${A.id})`)}let R=mm(e,g,[P],s.frameRendering,t);b(R||P,e)}break}case"frame":case"magicframe":{if(s.frameRendering.enabled&&s.frameRendering.outline){let y=document.createElementNS(ft,"rect");y.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),y.setAttribute("width",`${e.width}px`),y.setAttribute("height",`${e.height}px`),y.setAttribute("rx",Nn.radius.toString()),y.setAttribute("ry",Nn.radius.toString()),y.setAttribute("fill","none"),y.setAttribute("stroke",Nn.strokeColor),y.setAttribute("stroke-width",Nn.strokeWidth.toString()),b(y,e)}break}default:if(ct(e)){let y=r.ownerDocument.createElementNS(ft,"g");v!==1&&(y.setAttribute("stroke-opacity",`${v}`),y.setAttribute("fill-opacity",`${v}`)),y.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`);let w=e.text.replace(/\r\n?/g,`
37
- `).split(`
38
- `),T=Sd(e.fontSize,e.lineHeight),k=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,M=h0(e.fontFamily,e.fontSize,T),C=C1(e.text)?"rtl":"ltr",P=e.textAlign==="center"?"middle":e.textAlign==="right"||C==="rtl"?"end":"start";for(let A=0;A<w.length;A++){let _=r.ownerDocument.createElementNS(ft,"text");_.textContent=w[A],_.setAttribute("x",`${k}`),_.setAttribute("y",`${A*T+M}`),_.setAttribute("font-family",Iv(e)),_.setAttribute("font-size",`${e.fontSize}px`),_.setAttribute("fill",e.strokeColor),_.setAttribute("text-anchor",P),_.setAttribute("style","white-space: pre;"),_.setAttribute("direction",C),_.setAttribute("dominant-baseline","alphabetic"),y.appendChild(_)}let R=mm(e,g,[y],s.frameRendering,t);b(R||y,e)}else throw new Error(`Unimplemented type ${e.type}`)}},f_=(e,t,n,r,i,o)=>{r&&(e.filter(a=>!Ui(a)).forEach(a=>{if(!a.isDeleted)try{Nx(a,t,n,r,i,a.x+o.offsetX,a.y+o.offsetY,o)}catch(s){console.error(s)}}),e.filter(a=>Ui(a)).forEach(a=>{if(!a.isDeleted)try{Nx(a,t,n,r,i,a.x+o.offsetX,a.y+o.offsetY,o)}catch(s){console.error(s)}}))};S();S();S();var no=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{}catch{return!1}else if("showOpenFilePicker"in self)return"showOpenFilePicker";return!1})(),GX=no?import("./file-open-002ab408-INFZI63D.js"):import("./file-open-7c801643-GKUCIQCX.js");async function S0(...e){return(await GX).default(...e)}var wme=no?import("./directory-open-4ed118d0-RFY2TAQG.js"):import("./directory-open-01563666-LVSEORCY.js");var WX=no?import("./file-save-745eba88-Y5LQRZDO.js"):import("./file-save-3189631c-ANETLLLV.js");async function T0(...e){return(await WX).default(...e)}S();var C0=class extends Error{constructor(t="Couldn't export canvas.",n="CANVAS_ERROR"){super(),this.name=n,this.message=t}},M0=class extends DOMException{constructor(t="Request Aborted"){super(t,"AbortError")}},Ma=class extends Error{code;constructor(t="Image Scene Data Error",n="IMAGE_SCENE_DATA_ERROR"){super(t),this.name="EncodingError",this.code=n}};var g_=500,E_=e=>{let t=e.extensions?.reduce((r,i)=>(r.push(we[i]),r),[]),n=e.extensions?.reduce((r,i)=>i==="jpg"?r.concat(".jpg",".jpeg"):r.concat(`.${i}`),[]);return S0({description:e.description,extensions:n,mimeTypes:t,multiple:e.multiple??!1,legacySetup:(r,i,o)=>{let a=d7(i,g_),s=()=>{l(),document.addEventListener("keyup",a),document.addEventListener("pointerup",a),a()},l=()=>{if(o.files?.length){let d=e.multiple?[...o.files]:o.files[0];r(d)}};requestAnimationFrame(()=>{window.addEventListener("focus",s)});let c=window.setInterval(()=>{l()},g_);return d=>{clearInterval(c),a.cancel(),window.removeEventListener("focus",s),document.removeEventListener("keyup",a),document.removeEventListener("pointerup",a),d&&(console.warn("Opening the file was canceled (legacy-fs)."),d(new M0))}}})},$x=(e,t)=>T0(e,{fileName:`${t.name}.${t.extension}`,description:t.description,extensions:[`.${t.extension}`]},t.fileHandle);var jX=(e,t)=>{let n={};for(let r of e)!r.isDeleted&&"fileId"in r&&r.fileId&&t[r.fileId]&&(n[r.fileId]=t[r.fileId]);return n},pm=(e,t,n,r)=>{let i={type:Mr.excalidraw,version:Sv.excalidraw,source:wv,elements:r==="local"?I0(e):x_(e),appState:r==="local"?S1(t):i7(t),files:r==="local"?jX(e,n):void 0};return JSON.stringify(i,null,2)},zme=async(e,t,n,r=t.name||r7)=>{let i=pm(e,t,n,"local"),o=new Blob([i],{type:we.excalidraw});return{fileHandle:await $x(o,{name:r,extension:"excalidraw",description:"Excalidraw file",fileHandle:b_(t.fileHandle)?null:t.fileHandle})}},Hme=async(e,t)=>{let n=await E_({description:"Excalidraw files"});return y_(await Fx(n),e,t,n.handle)},v_=e=>e?.type===Mr.excalidraw&&(!e.elements||Array.isArray(e.elements)&&(!e.appState||typeof e.appState=="object")),Bx=e=>typeof e=="object"&&e&&e.type===Mr.excalidrawLibrary&&(e.version===1||e.version===2),UX=e=>{let t={type:Mr.excalidrawLibrary,version:Sv.excalidrawLibrary,source:wv,libraryItems:e};return JSON.stringify(t,null,2)},Gme=async e=>{let t=UX(e);await $x(new Blob([t],{type:we.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"})};S();var VX=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{t(r)},r.onerror=i=>{n(i)},r.src=e}),w_=async({fileIds:e,files:t,imageCache:n})=>{let r=new Map,i=new Map;return await Promise.all(e.reduce((o,a)=>{let s=t[a];return s&&!r.has(a)?(r.set(a,!0),o.concat((async()=>{try{if(s.mimeType===we.binary)throw new Error("Only images can be added to ImageCache");let l=VX(s.dataURL),c={image:l,mimeType:s.mimeType};n.set(a,c);let d=await l;n.set(a,{...c,image:d})}catch{i.set(a,!0)}})())):o},[])),{imageCache:n,updatedFiles:r,erroredFiles:i}},S_=e=>e.filter(t=>Bo(t)),YX=e=>e?.nodeName.toLowerCase()==="svg",Yme=async e=>{let t=new DOMParser().parseFromString(e,we.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!YX(n))throw new Error("Invalid SVG");if(n.hasAttribute("xmlns")||n.setAttribute("xmlns",ft),!n.hasAttribute("width")||!n.hasAttribute("height")){let i=n.getAttribute("viewBox"),o=n.getAttribute("width")||"50",a=n.getAttribute("height")||"50";if(i){let s=i.match(/\d+ +\d+ +(\d+) +(\d+)/);s&&([,o,a]=s)}n.setAttribute("width",o),n.setAttribute("height",a)}return n.outerHTML};S();var ZX={selection:!0,text:!0,rectangle:!0,diamond:!0,ellipse:!0,line:!0,image:!0,arrow:!0,freedraw:!0,eraser:!1,custom:!0,frame:!0,embeddable:!0,hand:!0,laser:!1,magicframe:!1},XX=e=>Object.keys(Cn).includes(e)?Cn[e]:ji,T_=e=>e?{...e,focus:e.focus||0}:null,Id=(e,t)=>{let n={type:t.type||e.type,version:e.version||1,versionNonce:e.versionNonce??0,isDeleted:e.isDeleted??!1,id:e.id||to(),fillStyle:e.fillStyle||Dt.fillStyle,strokeWidth:e.strokeWidth||Dt.strokeWidth,strokeStyle:e.strokeStyle??Dt.strokeStyle,roughness:e.roughness??Dt.roughness,opacity:e.opacity==null?Dt.opacity:e.opacity,angle:e.angle||0,x:t.x??e.x??0,y:t.y??e.y??0,strokeColor:e.strokeColor||Dt.strokeColor,backgroundColor:e.backgroundColor||Dt.backgroundColor,width:e.width||0,height:e.height||0,seed:e.seed??1,groupIds:e.groupIds??[],frameId:e.frameId??null,roundness:e.roundness?e.roundness:e.strokeSharpness==="round"?{type:D1(e.type)?Hr.LEGACY:Hr.PROPORTIONAL_RADIUS}:null,boundElements:e.boundElementIds?e.boundElementIds.map(r=>({type:"arrow",id:r})):e.boundElements??[],updated:e.updated??Ea(),link:e.link?Md(e.link):null,locked:e.locked??!1};return("customData"in e||"customData"in t)&&(n.customData="customData"in t?t.customData:e.customData),w1 in e&&(n[w1]=e[w1]),{...n,...Hx(n),...t}},KX=e=>{switch(e.type){case"text":let t=e.fontSize,n=e.fontFamily;if("font"in e){let[o,a]=e.font.split(" ");t=parseFloat(o),n=XX(a)}let r=typeof e.text=="string"&&e.text||"",i=e.lineHeight||(e.height?AA(e):m0(e.fontFamily));return e=Id(e,{fontSize:t,fontFamily:n,text:r,textAlign:e.textAlign||ud,verticalAlign:e.verticalAlign||E1,containerId:e.containerId??null,originalText:e.originalText||r,lineHeight:i}),!r&&!e.isDeleted&&(e={...e,originalText:r,isDeleted:!0},e=um(e)),e;case"freedraw":return Id(e,{points:e.points,lastCommittedPoint:null,simulatePressure:e.simulatePressure,pressures:e.pressures});case"image":return Id(e,{status:e.status||"pending",fileId:e.fileId,scale:e.scale||[1,1]});case"line":case"draw":case"arrow":{let{startArrowhead:o=null,endArrowhead:a=e.type==="arrow"?"arrow":null}=e,s=e.x,l=e.y,c=!Array.isArray(e.points)||e.points.length<2?[[0,0],[e.width,e.height]]:e.points;return(c[0][0]!==0||c[0][1]!==0)&&({points:c,x:s,y:l}=Et.getNormalizedPoints(e)),Id(e,{type:e.type==="draw"?"line":e.type,startBinding:T_(e.startBinding),endBinding:T_(e.endBinding),lastCommittedPoint:null,startArrowhead:o,endArrowhead:a,points:c,x:s,y:l})}case"ellipse":case"rectangle":case"diamond":case"iframe":case"embeddable":return Id(e,{});case"magicframe":case"frame":return Id(e,{name:e.name??null})}return null},qX=(e,t)=>{if(e.boundElements){let n=e.boundElements.slice(),r=new Set;e.boundElements=n.reduce((i,o)=>{let a=t.get(o.id);if(a&&!r.has(o.id)){if(r.add(o.id),a.isDeleted)return i;i.push(o),ct(a)&&!a.containerId&&(a.containerId=e.id)}return i},[])}},QX=(e,t)=>{let n=e.containerId?t.get(e.containerId):null;if(!n){e.containerId=null;return}if(!e.isDeleted&&n.boundElements&&!n.boundElements.find(r=>r.id===e.id)){let r=(n.boundElements||(n.boundElements=[])).slice();r.push({type:"text",id:e.id}),n.boundElements=r}},JX=(e,t)=>{e.frameId&&(t.get(e.frameId)||(e.frameId=null))},I_=(e,t,n)=>{let r=new Set,i=t?St(t):null,o=(e||[]).reduce((s,l)=>{if(l.type!=="selection"&&!fm(l)){let c=KX(l);if(c){let d=i?.get(l.id);d&&d.version>c.version&&(c=um(c,d.version)),r.has(c.id)&&(c={...c,id:to()}),r.add(c.id),s.push(c)}}return s},[]);if(!n?.repairBindings)return o;let a=St(o);for(let s of o)s.frameId&&JX(s,a),ct(s)&&s.containerId?QX(s,a):s.boundElements&&qX(s,a),n.refreshDimensions&&ct(s)&&Object.assign(s,x0(s,pr(s,a),a));return o},eK=(e,t,n)=>{let r=t[e];return r!==void 0?r:n[e]},C_={isSidebarDocked:(e,t)=>["defaultSidebarDockedPreference",e.isSidebarDocked??eK("defaultSidebarDockedPreference",e,t)]},zx=(e,t)=>{e=e||{};let n=pd(),r={};for(let i of Object.keys(C_))if(i in e){let[o,a]=C_[i](e,n);r[o]=a}for(let[i,o]of Object.entries(n)){let a=e[i],s=t?t[i]:void 0;r[i]=a!==void 0?a:s!==void 0?s:o}return{...r,cursorButton:t?.cursorButton||"up",penDetected:t?.penDetected??(e.penMode?e.penDetected??!1:!1),activeTool:{...$h(n,r.activeTool.type&&ZX[r.activeTool.type]?r.activeTool:{type:"selection"}),lastActiveTool:null,locked:r.activeTool.locked??!1},zoom:typeof e.zoom=="number"?{value:e.zoom}:e.zoom?.value?e.zoom:n.zoom,openSidebar:typeof e.openSidebar=="string"?{name:n7.name}:r.openSidebar}},k0=(e,t,n,r)=>({elements:I_(e?.elements,n,r),appState:zx(e?.appState,t||null),files:e?.files||{}}),M_=e=>{let t=I_(Gx(e.elements),null);return t.length?{...e,elements:t}:null},k_=(e=[],t)=>{let n=[];for(let r of e)if(Array.isArray(r)){let i=M_({status:t,elements:r,id:to(),created:Date.now()});i&&n.push(i)}else{let i=r,o=M_({...i,id:i.id||to(),status:i.status||t,created:i.created||Date.now()});o&&n.push(o)}return n};S();S();var Wx=document.createElement("img");Wx.src=`data:${we.svg}, ${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1971c2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>')}`;var jx=([e,t,n,r],i,o)=>{let a=zA,s=a/o.zoom.value,l=a/o.zoom.value,c=a/o.zoom.value,d=(e+n)/2,u=(t+r)/2,h=(a-8)/(2*o.zoom.value),m=4/o.zoom.value,p=n+m-h,f=t-m-c+h,[g,b]=De(p+s/2,f+l/2,d,u,i);return[g-s/2,b-l/2,s,l]},tK=(e,t,n,[r,i])=>{let o=4/n.zoom.value,[a,s,l,c]=Te(e,t),[d,u,h,m]=jx([a,s,l,c],e.angle,n);return r>d-o&&r<d+o+h&&i>u-o&&i<u+m+o},fpe=(e,t,n,[r,i],o)=>{if(!e.link||n.selectedElementIds[e.id])return!1;let a=4/n.zoom.value;return!o&&n.viewModeEnabled&&l0(e,t,[r,i],a,null)?!0:tK(e,t,n,[r,i])};S();var ype=(e,t,n,r,i=!0)=>{e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),i&&e.stroke()},A_=(e,t)=>[e.width/t,e.height/t],__=({canvas:e,scale:t,normalizedWidth:n,normalizedHeight:r,theme:i,isExporting:o,canvasBackgroundColor:a})=>{let s=e.getContext("2d");return s.setTransform(1,0,0,1,0,0),s.scale(t,t),o&&i===zr.DARK&&(s.filter=v1),typeof a=="string"?((a==="transparent"||a.length===5||a.length===9||/(hsla|rgba)\(/.test(a))&&s.clearRect(0,0,n,r),s.save(),s.fillStyle=a,s.fillRect(0,0,n,r),s.restore()):s.clearRect(0,0,n,r),s};var nK=(e,t,n,r,i,o,a)=>{let l={Bold:"#cccccc",Regular:"#e5e5e5"},c=-Math.round(i.value/t)*t+n%t,d=-Math.round(i.value/t)*t+r%t,u=Math.min(1/i.value,1),h=1/i.value,m=[u*3,h+(u+h)];e.save(),e.lineWidth=u;for(let p=c;p<c+o+t*2;p+=t){let f=Math.round(p-n)%(5*t)===0;e.beginPath(),e.setLineDash(f?[]:m),e.strokeStyle=f?l.Bold:l.Regular,e.moveTo(p,d-t),e.lineTo(p,d+a+t*2),e.stroke()}for(let p=d;p<d+a+t*2;p+=t){let f=Math.round(p-r)%(5*t)===0;e.beginPath(),e.setLineDash(f?[]:m),e.strokeStyle=f?l.Bold:l.Regular,e.moveTo(c-t,p),e.lineTo(c+o+t*2,p),e.stroke()}e.restore()},P_=(e,t,n,r)=>{t.translate(e.x+r.scrollX,e.y+r.scrollY),t.beginPath(),t.roundRect?t.roundRect(0,0,e.width,e.height,Nn.radius/r.zoom.value):t.rect(0,0,e.width,e.height),t.clip(),t.translate(-(e.x+r.scrollX),-(e.y+r.scrollY))},Ia,D_=(e,t,n,r)=>{if(e.link&&!n.selectedElementIds[e.id]){let[i,o,a,s]=Te(e,r),[l,c,d,u]=jx([i,o,a,s],e.angle,n),h=l+d/2,m=c+u/2;if(t.save(),t.translate(n.scrollX+h,n.scrollY+m),t.rotate(e.angle),!Ia||Ia.zoom!==n.zoom.value){Ia=document.createElement("canvas"),Ia.zoom=n.zoom.value,Ia.width=d*window.devicePixelRatio*n.zoom.value,Ia.height=u*window.devicePixelRatio*n.zoom.value;let p=Ia.getContext("2d");p.scale(window.devicePixelRatio*n.zoom.value,window.devicePixelRatio*n.zoom.value),p.fillStyle="#fff",p.fillRect(0,0,d,u),p.drawImage(Wx,0,0,d,u),p.restore(),t.drawImage(Ia,l-h,c-m,d,u)}else t.drawImage(Ia,l-h,c-m,d,u);t.restore()}},L_=({canvas:e,rc:t,elementsMap:n,allElementsMap:r,visibleElements:i,scale:o,appState:a,renderConfig:s})=>{if(e===null)return;let{renderGrid:l=!0,isExporting:c}=s,[d,u]=A_(e,o),h=__({canvas:e,scale:o,normalizedWidth:d,normalizedHeight:u,theme:a.theme,isExporting:c,canvasBackgroundColor:s.canvasBackgroundColor});h.scale(a.zoom.value,a.zoom.value),l&&a.gridSize&&nK(h,a.gridSize,a.scrollX,a.scrollY,a.zoom,d/a.zoom.value,u/a.zoom.value);let m=new Set;i.forEach(p=>{p.groupIds.length>0&&a.frameToHighlight&&a.selectedElementIds[p.id]&&(As(p,a.frameToHighlight,n)||p.groupIds.find(f=>m.has(f)))&&p.groupIds.forEach(f=>m.add(f))}),i.filter(p=>!Ui(p)).forEach(p=>{try{if((p.frameId||a.frameToHighlight?.id)&&a.frameRendering.enabled&&a.frameRendering.clip){h.save();let g=A0(p,n,a);g&&_0(p,n,a)&&P_(g,h,s,a),sm(p,n,r,t,h,s,a),h.restore()}else sm(p,n,r,t,h,s,a);c||D_(p,h,a,n)}catch(f){console.error(f)}}),i.filter(p=>Ui(p)).forEach(p=>{try{let f=()=>{if(sm(p,n,r,t,h,s,a),Ui(p)&&(c||A1(p)&&s.embedsValidationStatus.get(p.id)!==!0)&&p.width&&p.height){let b=w0(p);sm(b,n,r,t,h,s,a)}c||D_(p,h,a,n)};if((p.frameId||a.frameToHighlight?.id)&&a.frameRendering.enabled&&a.frameRendering.clip){h.save();let b=A0(p,n,a);b&&_0(p,n,a)&&P_(b,h,s,a),f(),h.restore()}else f()}catch(f){console.error(f)}})},rK=u7(e=>{L_(e)},{trailing:!0}),R_=(e,t)=>{if(t){rK(e);return}L_(e)};var iK="<!-- svg-source:excalidraw -->",oK=(e,t)=>{if(e.width<=t)return e;let r=document.createElement("canvas").getContext("2d");r.font=In({fontFamily:e.fontFamily,fontSize:e.fontSize});let i=e.text;if(r.measureText(i).width>t)for(let a=i.length;a>0;a--){let s=`${i.slice(0,a)}...`;if(r.measureText(s).width<=t){i=s;break}}return Jl(e,{text:i,width:t})},aK=(e,t)=>{let n=[],r=0,i=0;for(let o of e){if(ht(o)){Bh(o)?r++:i++;let a=Wo({x:o.x,y:o.y-Nn.nameOffsetY,fontFamily:Cn.Assistant,fontSize:Nn.nameFontSize,lineHeight:Nn.nameLineHeight,strokeColor:t.exportWithDarkMode?Nn.nameColorDarkTheme:Nn.nameColorLightTheme,text:B_(o,Bh(o)?r:i)});a.y-=a.height,a=oK(a,o.width),n.push(a)}n.push(o)}return n},O_=(e,t)=>(t=t||pd().frameRendering,{enabled:e?!0:t.enabled,outline:e?!1:t.outline,name:e?!1:t.name,clip:e?!0:t.clip}),N_=({elements:e,exportingFrame:t,frameRendering:n,exportWithDarkMode:r})=>{let i;return t?i=z_(e,t):n.enabled&&n.name?i=aK(e,{exportWithDarkMode:r}):i=e,i},Ux=async({data:e,config:t})=>{let n=Object.assign({},t),{files:r}=e,{exportingFrame:i}=n,o=e.elements,a=zx(e.appState,null),s=O_(i??null,a.frameRendering??null),l=N_({elements:o,exportingFrame:i,exportWithDarkMode:a.exportWithDarkMode,frameRendering:s});i&&(n.padding=0),n.fit=n.fit??(n.width!=null||n.height!=null||n.maxWidthOrHeight!=null||n.widthOrHeight!=null?"contain":"none");let c=n.fit==="contain";(n.x!=null||n.x!=null)&&(n.fit="none"),n.fit==="cover"&&(n.padding&&!N.PROD&&console.warn("`padding` is ignored when `fit` is set to `cover`"),n.padding=0),n.padding=n.padding??0,n.scale=n.scale??1,n.origin=n.origin??"canvas",n.position=n.position??"center",n.maxWidthOrHeight!=null&&n.widthOrHeight!=null&&(N.PROD||console.warn("`maxWidthOrHeight` is ignored when `widthOrHeight` is set"),n.maxWidthOrHeight=void 0),(n.maxWidthOrHeight!=null||n.width!=null||n.height!=null)&&n.getDimensions&&(N.PROD||console.warn("`getDimensions` is ignored when `width`, `height`, or `maxWidthOrHeight` is set"),n.getDimensions=void 0);let d=1,u=F_(i?[i]:Yx(l)),[h,m,p,f]=u,[g,b,v,y]=u;if(n.width!=null?(v=n.width,n.padding&&c&&(v-=n.padding*2),n.height?(y=n.height,n.padding&&c&&(y-=n.padding*2)):y*=v/p):n.height!=null&&(y=n.height,n.padding&&c&&(y-=n.padding*2),v*=y/f),n.maxWidthOrHeight!=null||n.widthOrHeight!=null){c&&n.padding&&(n.maxWidthOrHeight!=null?n.maxWidthOrHeight-=n.padding*2:n.widthOrHeight!=null&&(n.widthOrHeight-=n.padding*2));let M=Math.max(v,y);n.widthOrHeight!=null?d=n.widthOrHeight/M:n.maxWidthOrHeight!=null&&(d=n.maxWidthOrHeight<M?n.maxWidthOrHeight/M:1),v*=d,y*=d}else if(n.getDimensions){let M=n.getDimensions(v,y);v=M.width,y=M.height,n.scale=M.scale??n.scale}else if(c&&n.padding&&n.width==null&&n.height==null){let M=v/y;v-=n.padding*2,y-=n.padding*2/M}if(n.fit==="contain"&&!n.maxWidthOrHeight||c&&n.padding)if(n.fit==="contain"){let M=v/p,C=y/f;d=Math.min(M,C)}else{let M=(v-n.padding*2)/v,C=(y-n.padding*2)/y;d=Math.min(M,C)}else if(n.fit==="cover"){let M=v/p,C=y/f;d=Math.max(M,C)}g=n.x??h,b=n.y??m,n.origin==="content"&&(n.x!=null&&(g+=h),n.y!=null&&(b+=m)),n.position==="center"&&(g-=v/d/2-(n.x==null?p:v+n.padding*2)/2,b-=y/d/2-(n.y==null?f:y+n.padding*2)/2);let w=n.createCanvas?n.createCanvas():document.createElement("canvas"),T=n.padding/d;d*=n.scale,v*=n.scale,y*=n.scale,w.width=v+n.padding*2*n.scale,w.height=y+n.padding*2*n.scale;let{imageCache:k}=await w_({imageCache:new Map,fileIds:S_(l).map(M=>M.fileId),files:r||{}});return R_({canvas:w,rc:qt.canvas(w),elementsMap:Hl(St(l)),allElementsMap:Hl(St(o)),visibleElements:l,appState:{...a,frameRendering:s,width:v,height:y,offsetLeft:0,offsetTop:0,scrollX:-g+T,scrollY:-b+T,zoom:{value:y1},shouldCacheIgnoreZoom:!1,theme:n.theme||zr.LIGHT},scale:d,renderConfig:{canvasBackgroundColor:n.canvasBackgroundColor===!1?null:n.canvasBackgroundColor||a.viewBackgroundColor||bs,imageCache:k,renderGrid:!1,isExporting:!0,embedsValidationStatus:new Map,elementsPendingErasure:new Set}}),w},$_=async({data:e,config:t})=>{let n=Object.assign({},t);n.exportingFrame=n.exportingFrame??null;let r=e.elements,i=O_(n?.exportingFrame??null,e.appState.frameRendering??null),{exportPadding:o=qk,exportWithDarkMode:a=!1,viewBackgroundColor:s,exportScale:l=1,exportEmbedScene:c}=e.appState,d=N_({elements:r,exportingFrame:n.exportingFrame,exportWithDarkMode:a,frameRendering:i});n.exportingFrame&&(o=0);let u="";if(c)try{u=await(await import("./image-5SBTIZPN.js")).encodeSvgMetadata({text:pm(r,e.appState,e.files||{},"local")})}catch(P){console.error(P)}let[h,m,p,f]=F_(n.exportingFrame?[n.exportingFrame]:Yx(d));p+=o*2,f+=o*2;let g=document.createElementNS(ft,"svg");g.setAttribute("version","1.1"),g.setAttribute("xmlns",ft),g.setAttribute("viewBox",`0 0 ${p} ${f}`),g.setAttribute("width",`${p*l}`),g.setAttribute("height",`${f*l}`),a&&g.setAttribute("filter",v1);let b="https://excalidraw.com/";N.VITE_IS_EXCALIDRAW_NPM_PACKAGE&&(b=window.EXCALIDRAW_ASSET_PATH||`https://unpkg.com/${N.VITE_PKG_NAME}@${N.PKG_VERSION}`,b?.startsWith("/")&&(b=b.replace("/",`${window.location.origin}/`)),b=`${b}/dist/excalidraw-assets/`);let v=-h+o,y=-m+o,w=Vx(r),T="",k=St(r);for(let P of w){let[R,A,_,$]=Te(P,k),W=(_-R)/2-(P.x-R),H=($-A)/2-(P.y-A);T+=`<clipPath id=${P.id}>
39
- <rect transform="translate(${P.x+v} ${P.y+y}) rotate(${P.angle} ${W} ${H})"
40
- width="${P.width}"
41
- height="${P.height}"
42
- >
43
- </rect>
44
- </clipPath>`}if(g.innerHTML=`
45
- ${iK}
46
- ${u}
47
- <defs>
48
- <style class="style-fonts">
49
- @font-face {
50
- font-family: "Virgil";
51
- src: url("https://excalidraw.com/Virgil.woff2");
52
- }
53
- @font-face {
54
- font-family: "Cascadia";
55
- src: url("https://excalidraw.com/Cascadia.woff2");
56
- }
57
- @font-face {
58
- font-family: "Assistant";
59
- src: url("${b}Assistant-Regular.woff2");
60
- }
61
- </style>
62
- ${T}
63
- </defs>
64
- `,e.appState.exportBackground&&s){let P=g.ownerDocument.createElementNS(ft,"rect");P.setAttribute("x","0"),P.setAttribute("y","0"),P.setAttribute("width",`${p}`),P.setAttribute("height",`${f}`),P.setAttribute("fill",s),g.appendChild(P)}let M=qt.svg(g),C=n.renderEmbeddables??!1;return f_(d,Hl(St(d)),M,g,e.files||{},{offsetX:v,offsetY:y,isExporting:!0,exportWithDarkMode:a,renderEmbeddables:C,frameRendering:i,canvasBackgroundColor:s,embedsValidationStatus:C?new Map(d.filter(P=>ht(P)).map(P=>[P.id,!0])):new Map}),g},F_=e=>{let[t,n,r,i]=kr(e),o=mi(t,r),a=mi(n,i);return[t,n,o,a]};S();S();var ro=32,Mt=12,_s=256,G_=50,ec="NOT_SPREADSHEET",kd="VALID_SPREADSHEET",gm=e=>{let t=/^([-+]?)[$€£¥₩]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,"")):null},Zx=(e,t)=>e.slice(1).every(n=>gm(n[t])!==null),H_=e=>{let t=e[0].length;if(t>2)return{type:ec,reason:"More than 2 columns"};if(t===1){if(!Zx(e,0))return{type:ec,reason:"Value is not numeric"};let l=gm(e[0][0])===null,c=(l?e.slice(1):e).map(d=>gm(d[0]));return c.length<2?{type:ec,reason:"Less than two rows"}:{type:kd,spreadsheet:{title:l?e[0][0]:null,labels:null,values:c}}}let n=Zx(e,0),r=Zx(e,1);if(!n&&!r)return{type:ec,reason:"Value is not numeric"};let[i,o]=r?[0,1]:[1,0],a=gm(e[0][o])===null,s=a?e.slice(1):e;return s.length<2?{type:ec,reason:"Less than 2 rows"}:{type:kd,spreadsheet:{title:a?e[0][o]:null,labels:s.map(l=>l[i]),values:s.map(l=>gm(l[o]))}}},sK=e=>{let t=[];for(let n=0;n<e[0].length;n++){let r=[];for(let i=0;i<e.length;i++)r.push(e[i][n]);t.push(r)}return t},W_=e=>{let t=e.trim().split(`
65
- `).map(o=>o.trim().split(" "));if(t.length&&t[0].length!==2&&(t=e.trim().split(`
66
- `).map(o=>o.trim().split(","))),t.length===0)return{type:ec,reason:"No values"};let n=t[0].length;if(!t.every(o=>o.length===n))return{type:ec,reason:"All rows don't have same number of columns"};let i=H_(t);if(i.type!==kd){let o=H_(sK(t));if(o.type===kd)return o}return i},P0=oA(rA),bi={fillStyle:"hachure",fontFamily:ji,fontSize:$o,opacity:100,roughness:1,strokeColor:hd,roundness:null,strokeStyle:"solid",strokeWidth:1,verticalAlign:ga.MIDDLE,locked:!1},j_=e=>{let t=(ro+Mt)*e.values.length+Mt,n=_s+Mt*2;return{chartWidth:t,chartHeight:n}},lK=(e,t,n,r,i)=>e.labels?.map((o,a)=>Wo({groupIds:[r],backgroundColor:i,...bi,text:o.length>8?`${o.slice(0,5)}...`:o,x:t+a*(ro+Mt)+Mt*2,y:n+Mt/2,width:ro,angle:5.87,fontSize:16,textAlign:"center",verticalAlign:"top"}))||[],cK=(e,t,n,r,i)=>{let o=Wo({groupIds:[r],backgroundColor:i,...bi,x:t-Mt,y:n-Mt,text:"0",textAlign:"right"}),a=Wo({groupIds:[r],backgroundColor:i,...bi,x:t-Mt,y:n-_s-o.height/2,text:Math.max(...e.values).toLocaleString(),textAlign:"right"});return[o,a]},dK=(e,t,n,r,i)=>{let{chartWidth:o,chartHeight:a}=j_(e),s=Ql({backgroundColor:i,groupIds:[r],...bi,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,width:o,points:[[0,0],[o,0]]}),l=Ql({backgroundColor:i,groupIds:[r],...bi,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,height:a,points:[[0,0],[0,-a]]}),c=Ql({backgroundColor:i,groupIds:[r],...bi,type:"line",x:t,y:n-_s-Mt,startArrowhead:null,endArrowhead:null,strokeStyle:"dotted",width:o,opacity:G_,points:[[0,0],[o,0]]});return[s,l,c]},U_=(e,t,n,r,i,o)=>{let{chartWidth:a,chartHeight:s}=j_(e),l=e.title?Wo({backgroundColor:i,groupIds:[r],...bi,text:e.title,x:t+a/2,y:n-_s-Mt*2-$o,roundness:null,textAlign:"center"}):null,c=o?dm({backgroundColor:i,groupIds:[r],...bi,type:"rectangle",x:t,y:n-s,width:a,height:s,strokeColor:hd,fillStyle:"solid",opacity:6}):null;return[...c?[c]:[],...l?[l]:[],...lK(e,t,n,r,i),...cK(e,t,n,r,i),...dK(e,t,n,r,i)]},uK=(e,t,n)=>{let r=Math.max(...e.values),i=to(),o=P0[Math.floor(Math.random()*P0.length)];return[...e.values.map((s,l)=>{let c=s/r*_s;return dm({backgroundColor:o,groupIds:[i],...bi,type:"rectangle",x:t+l*(ro+Mt)+Mt,y:n-c-Mt,width:ro,height:c})}),...U_(e,t,n,i,o,N.DEV)]},hK=(e,t,n)=>{let r=Math.max(...e.values),i=to(),o=P0[Math.floor(Math.random()*P0.length)],a=0,s=[];for(let f of e.values){let g=a*(ro+Mt),b=-(f/r)*_s;s.push([g,b]),a++}let l=Math.max(...s.map(f=>f[0])),c=Math.max(...s.map(f=>f[1])),d=Math.min(...s.map(f=>f[0])),u=Math.min(...s.map(f=>f[1])),h=Ql({backgroundColor:o,groupIds:[i],...bi,type:"line",x:t+Mt+ro/2,y:n-Mt,startArrowhead:null,endArrowhead:null,height:c-u,width:l-d,strokeWidth:2,points:s}),m=e.values.map((f,g)=>{let b=g*(ro+Mt)+Mt/2,v=-(f/r)*_s+Mt/2;return dm({backgroundColor:o,groupIds:[i],...bi,fillStyle:"solid",strokeWidth:2,type:"ellipse",x:t+b+ro/2,y:n+v-Mt*2,width:Mt,height:Mt})}),p=e.values.map((f,g)=>{let b=g*(ro+Mt)+Mt/2,v=f/r*_s+Mt/2+Mt;return Ql({backgroundColor:o,groupIds:[i],...bi,type:"line",x:t+b+ro/2+Mt/2,y:n-v,startArrowhead:null,endArrowhead:null,height:v,strokeStyle:"dotted",opacity:G_,points:[[0,0],[0,v]]})});return[...U_(e,t,n,i,o,N.DEV),h,...p,...m]},efe=(e,t,n,r)=>e==="line"?hK(t,n,r):uK(t,n,r);var ufe="clipboard"in navigator&&"readText"in navigator.clipboard,mK="clipboard"in navigator&&"writeText"in navigator.clipboard,hfe="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,pK=e=>!!([Mr.excalidraw,Mr.excalidrawClipboard,Mr.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),mfe=({types:e,files:t})=>{!e&&!t&&console.warn("createPasteEvent: no types or files provided");let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e))try{if(n.clipboardData?.setData(r,i),n.clipboardData?.getData(r)!==i)throw new Error(`Failed to set "${r}" as clipboardData item`)}catch(o){throw new Error(o.message)}if(t){let r=-1;for(let i of t){r++;try{if(n.clipboardData?.items.add(i),n.clipboardData?.files[r]!==i)throw new Error(`Failed to set file "${i.name}" as clipboardData item`)}catch(o){throw new Error(o.message)}}}return n},fK=({elements:e,files:t})=>{let n=St(e),r=new Set(e.filter(s=>ht(s))),i=!1,o=e.reduce((s,l)=>(Bo(l)&&(i=!0,t&&t[l.fileId]&&(s[l.fileId]=t[l.fileId])),s),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let a={type:Mr.excalidrawClipboard,elements:e.map(s=>{if(Ar(s,n)&&!r.has(Ar(s,n))){let l=Rx(s);return Ie(l,{frameId:null}),l}return s}),files:t?o:void 0};return JSON.stringify(a)},V_=async(e,t,n)=>{await Xx(fK({elements:e,files:t}),n)},gK=e=>{let t=W_(e);return t.type===kd?{spreadsheet:t.spreadsheet}:null};function Y_(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let r=n.textContent?.trim();r&&t.push({type:"text",value:r})}else if(n instanceof HTMLImageElement){let r=n.getAttribute("src");r&&r.startsWith("http")&&t.push({type:"imageUrl",value:r})}else t=t.concat(Y_(n));return t}var EK=e=>{let t=e.clipboardData?.getData("text/html");if(!t)return null;try{let n=new DOMParser().parseFromString(t,"text/html"),r=Y_(n.body);if(r.length)return{type:"mixedContent",value:r}}catch(n){console.error(`error in parseHTMLFromPaste: ${n.message}`)}return null},pfe=async()=>{let e={};try{if(navigator.clipboard?.readText)return{"text/plain":await navigator.clipboard?.readText()}}catch(n){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${n.message}). Failling back to navigator.clipboard.read()`);else throw n}let t;try{t=await navigator.clipboard?.read()}catch(n){if(n.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${n.message}`),e;throw n}for(let n of t)for(let r of n.types)if(p7(Zk,r))try{e[r]=await(await n.getType(r)).text()}catch(i){console.warn(`Cannot retrieve ${r} from clipboardItem: ${i.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},bK=async(e,t=!1)=>{try{let n=!t&&e&&EK(e);return n?n.value.every(i=>i.type==="text")?{type:"text",value:e.clipboardData?.getData("text/plain")||n.value.map(i=>i.value).join(`
67
- `).trim()}:n:{type:"text",value:(e.clipboardData?.getData("text/plain")||"").trim()}}catch{return{type:"text",value:""}}},ffe=async(e,t=!1)=>{let n=await bK(e,t);if(n.type==="mixedContent")return{mixedContent:n.value};try{let r=!t&&gK(n.value);if(r)return r}catch(r){console.error(r)}try{let r=JSON.parse(n.value),i=r.type===Mr.excalidrawClipboardWithAPI;if(pK(r))return{elements:r.elements,files:r.files,text:t?JSON.stringify(r.elements,null,2):void 0,programmaticAPI:i}}catch{}return{text:n.value}},Z_=async e=>{try{await navigator.clipboard.write([new window.ClipboardItem({[we.png]:e})])}catch(t){if(M1(e))await navigator.clipboard.write([new window.ClipboardItem({[we.png]:await e})]);else throw t}},Xx=async(e,t)=>{if(mK)try{await navigator.clipboard.writeText(e||"");return}catch(n){console.error(n)}try{if(t){if(t.clipboardData?.setData("text/plain",e||""),t.clipboardData?.getData("text/plain")!==e)throw new Error("Failed to setData on clipboardEvent");return}}catch(n){console.error(n)}if(!yK(e))throw new Error("Error copying to clipboard.")},yK=e=>{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(o){console.error(o)}return n.remove(),i};S();S();var ln=L(q(),1);S();var vK=0;function K_(e,t){let n=`atom${++vK}`,r={toString:()=>n};return typeof e=="function"?r.read=e:(r.init=e,r.read=i=>i(r),r.write=(i,o,a)=>o(r,typeof a=="function"?a(i(r)):a)),t&&(r.write=t),r}var Ps=Symbol(),qx=e=>!!e[Ps],D0=e=>!e[Ps].c,Em=e=>{var t;let{b:n,c:r}=e[Ps];r&&(r(),(t=wK.get(n))==null||t())},R0=(e,t)=>{let n=e[Ps].o,r=t[Ps].o;return n===r||e===r||qx(n)&&R0(n,t)},Qx=(e,t)=>{let n={b:e,o:t,c:null},r=new Promise(i=>{n.c=()=>{n.c=null,i()},t.finally(n.c)});return r[Ps]=n,r},xK=e=>Qx(e[Ps].b,e[Ps].o),wK=new WeakMap;var L0=e=>"init"in e,bm="r",O0="w",ym="c",N0="s",q_="h",SK="n",TK="l",CK="a",MK="m",Q_=e=>{let t=new WeakMap,n=new WeakMap,r=new Map,i,o;if((N&&N.MODE)!=="production"&&(i=new Set,o=new Set),e)for(let[F,B]of e){let U={v:B,r:0,y:!0,d:new Map};(N&&N.MODE)!=="production"&&(Object.freeze(U),L0(F)||console.warn("Found initial value for derived atom which can cause unexpected behavior",F)),t.set(F,U)}let a=new WeakMap,s=(F,B,U)=>{let G=a.get(B);G||(G=new Map,a.set(B,G)),U.then(()=>{G.get(F)===U&&(G.delete(F),G.size||a.delete(B))}),G.set(F,U)},l=F=>{let B=new Set,U=a.get(F);return U&&(a.delete(F),U.forEach((G,Z)=>{Em(G),B.add(Z)})),B},c=new WeakMap,d=F=>{let B=c.get(F);return B||(B=new Map,c.set(F,B)),B},u=(F,B)=>{if(F){let U=d(F),G=U.get(B);return G||(G=u(F.p,B),G&&"p"in G&&D0(G.p)&&(G=void 0),G&&U.set(B,G)),G}return t.get(B)},h=(F,B,U)=>{if((N&&N.MODE)!=="production"&&Object.freeze(U),F)d(F).set(B,U);else{let G=t.get(B);t.set(B,U),r.has(B)||r.set(B,G)}},m=(F,B=new Map,U)=>{if(!U)return B;let G=new Map,Z=!1;return U.forEach(ee=>{var te;let de=((te=u(F,ee))==null?void 0:te.r)||0;G.set(ee,de),B.get(ee)!==de&&(Z=!0)}),B.size===G.size&&!Z?B:G},p=(F,B,U,G,Z)=>{let ee=u(F,B);if(ee){if(Z&&(!("p"in ee)||!R0(ee.p,Z)))return ee;"p"in ee&&Em(ee.p)}let te={v:U,r:ee?.r||0,y:!0,d:m(F,ee?.d,G)},de=!ee?.y;return!ee||!("v"in ee)||!Object.is(ee.v,U)?(de=!0,++te.r,te.d.has(B)&&(te.d=new Map(te.d).set(B,te.r))):te.d!==ee.d&&(te.d.size!==ee.d.size||!Array.from(te.d.keys()).every(qe=>ee.d.has(qe)))&&(de=!0,Promise.resolve().then(()=>{H(F)})),ee&&!de?ee:(h(F,B,te),te)},f=(F,B,U,G,Z)=>{let ee=u(F,B);if(ee){if(Z&&(!("p"in ee)||!R0(ee.p,Z)))return ee;"p"in ee&&Em(ee.p)}let te={e:U,r:(ee?.r||0)+1,y:!0,d:m(F,ee?.d,G)};return h(F,B,te),te},g=(F,B,U,G)=>{let Z=u(F,B);if(Z&&"p"in Z){if(R0(Z.p,U)&&!D0(Z.p))return Z.y?Z:{...Z,y:!0};Em(Z.p)}s(F,B,U);let ee={p:U,r:(Z?.r||0)+1,y:!0,d:m(F,Z?.d,G)};return h(F,B,ee),ee},b=(F,B,U,G)=>{if(U instanceof Promise){let Z=Qx(U,U.then(ee=>{p(F,B,ee,G,Z)}).catch(ee=>{if(ee instanceof Promise)return qx(ee)?ee.then(()=>{y(F,B,!0)}):ee;f(F,B,ee,G,Z)}));return g(F,B,Z,G)}return p(F,B,U,G)},v=(F,B)=>{let U=u(F,B);if(U){let G={...U,y:!1};h(F,B,G)}else(N&&N.MODE)!=="production"&&console.warn("[Bug] could not invalidate non existing atom",B)},y=(F,B,U)=>{if(!U){let Z=u(F,B);if(Z){if(Z.y&&"p"in Z&&!D0(Z.p))return Z;if(Z.d.forEach((ee,te)=>{if(te!==B)if(!n.has(te))y(F,te);else{let de=u(F,te);de&&!de.y&&y(F,te)}}),Array.from(Z.d).every(([ee,te])=>{let de=u(F,ee);return de&&!("p"in de)&&de.r===te}))return Z.y?Z:{...Z,y:!0}}}let G=new Set;try{let Z=B.read(ee=>{G.add(ee);let te=ee===B?u(F,ee):y(F,ee);if(te){if("e"in te)throw te.e;if("p"in te)throw te.p;return te.v}if(L0(ee))return ee.init;throw new Error("no atom init")});return b(F,B,Z,G)}catch(Z){if(Z instanceof Promise){let ee=qx(Z)&&D0(Z)?xK(Z):Qx(Z,Z);return g(F,B,ee,G)}return f(F,B,Z,G)}},w=(F,B)=>y(B,F),T=(F,B)=>{let U=n.get(B);return U||(U=_(F,B)),U},k=(F,B)=>!B.l.size&&(!B.t.size||B.t.size===1&&B.t.has(F)),M=(F,B)=>{let U=n.get(B);U&&k(B,U)&&$(F,B)},C=(F,B)=>{let U=n.get(B);U?.t.forEach(G=>{G!==B&&(v(F,G),C(F,G))})},P=(F,B,U)=>{let G=!0,Z=(de,qe)=>{let Ye=y(F,de);if("e"in Ye)throw Ye.e;if("p"in Ye){if(qe?.unstable_promise)return Ye.p.then(()=>{let Me=u(F,de);return Me&&"p"in Me&&Me.p===Ye.p?new Promise(Be=>setTimeout(Be)).then(()=>Z(de,qe)):Z(de,qe)});throw(N&&N.MODE)!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",de),Ye.p}if("v"in Ye)return Ye.v;throw(N&&N.MODE)!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",de),new Error("no value found")},ee=(de,qe)=>{let Ye;if(de===B){if(!L0(de))throw new Error("atom not writable");l(de).forEach(us=>{us!==F&&b(us,de,qe)});let Be=u(F,de),Oe=b(F,de,qe);Be!==Oe&&C(F,de)}else Ye=P(F,de,qe);return G||H(F),Ye},te=B.write(Z,ee,U);return G=!1,te},R=(F,B,U)=>{let G=P(U,F,B);return H(U),G},A=F=>!!F.write,_=(F,B,U)=>{let G={t:new Set(U&&[U]),l:new Set};if(n.set(B,G),(N&&N.MODE)!=="production"&&o.add(B),y(void 0,B).d.forEach((ee,te)=>{let de=n.get(te);de?de.t.add(B):te!==B&&_(F,te,B)}),A(B)&&B.onMount){let ee=de=>R(B,de,F),te=B.onMount(ee);F=void 0,te&&(G.u=te)}return G},$=(F,B)=>{var U;let G=(U=n.get(B))==null?void 0:U.u;G&&G(),n.delete(B),(N&&N.MODE)!=="production"&&o.delete(B);let Z=u(F,B);Z?("p"in Z&&Em(Z.p),Z.d.forEach((ee,te)=>{if(te!==B){let de=n.get(te);de&&(de.t.delete(B),k(te,de)&&$(F,te))}})):(N&&N.MODE)!=="production"&&console.warn("[Bug] could not find atom state to unmount",B)},W=(F,B,U,G)=>{let Z=new Set(U.d.keys());G?.forEach((ee,te)=>{if(Z.has(te)){Z.delete(te);return}let de=n.get(te);de&&(de.t.delete(B),k(te,de)&&$(F,te))}),Z.forEach(ee=>{let te=n.get(ee);te?te.t.add(B):n.has(B)&&_(F,ee,B)})},H=F=>{if(F){d(F).forEach((U,G)=>{let Z=t.get(G);if(U!==Z){let ee=n.get(G);ee?.l.forEach(te=>te(F))}});return}for(;r.size;){let B=Array.from(r);r.clear(),B.forEach(([U,G])=>{let Z=u(void 0,U);if(Z&&Z.d!==G?.d&&W(void 0,U,Z,G?.d),G&&!G.y&&Z?.y)return;let ee=n.get(U);ee?.l.forEach(te=>te())})}(N&&N.MODE)!=="production"&&i.forEach(B=>B())},K=F=>{d(F).forEach((U,G)=>{let Z=t.get(G);(!Z||U.r>Z.r||U.y!==Z.y||U.r===Z.r&&U.d!==Z.d)&&(t.set(G,U),U.d!==Z?.d&&W(F,G,U,Z?.d))})},Q=(F,B)=>{B&&K(B),H(void 0)},ie=(F,B,U)=>{let Z=T(U,F).l;return Z.add(B),()=>{Z.delete(B),M(U,F)}},X=(F,B)=>{for(let[U,G]of F)L0(U)&&(b(B,U,G),C(B,U));H(B)};return(N&&N.MODE)!=="production"?{[bm]:w,[O0]:R,[ym]:Q,[N0]:ie,[q_]:X,[SK]:F=>(i.add(F),()=>{i.delete(F)}),[TK]:()=>o.values(),[CK]:F=>t.get(F),[MK]:F=>n.get(F)}:{[bm]:w,[O0]:R,[ym]:Q,[N0]:ie,[q_]:X}},J_=e=>{let t=Q_(e),n=a=>{let s=t[bm](a);if("e"in s)throw s.e;if(!("p"in s))return s.v},r=a=>new Promise((s,l)=>{let c=t[bm](a);"e"in c?l(c.e):"p"in c?s(c.p.then(()=>r(a))):s(c.v)});return{get:n,asyncGet:r,set:(a,s)=>t[O0](a,s),sub:(a,s)=>t[N0](a,s),SECRET_INTERNAL_store:t}},eP=(e,t)=>({s:t?t(e).SECRET_INTERNAL_store:Q_(e)}),Kx=new Map,Jx=e=>(Kx.has(e)||Kx.set(e,(0,ln.createContext)(eP())),Kx.get(e)),$0=({children:e,initialValues:t,scope:n,unstable_createStore:r,unstable_enableVersionedWrite:i})=>{let[o,a]=(0,ln.useState)({});(0,ln.useEffect)(()=>{let c=s.current;c.w&&(c.s[ym](null,o),delete o.p,c.v=o)},[o]);let s=(0,ln.useRef)();if(!s.current){let c=eP(t,r);if(i){let d=0;c.w=u=>{a(h=>{let m=d?h:{p:h};return u(m),m})},c.v=o,c.r=u=>{++d,u(),--d}}s.current=c}let l=Jx(n);return(0,ln.createElement)(l.Provider,{value:s.current},e)};function At(e,t){return K_(e,t)}function vm(e,t){let n=Jx(t),r=(0,ln.useContext)(n),{s:i,v:o}=r,a=h=>{let m=i[bm](e,h);if((N&&N.MODE)!=="production"&&!m.y)throw new Error("should not be invalidated");if("e"in m)throw m.e;if("p"in m)throw m.p;if("v"in m)return m.v;throw new Error("no atom value")},[[s,l,c],d]=(0,ln.useReducer)((h,m)=>{let p=a(m);return Object.is(h[1],p)&&h[2]===e?h:[m,p,e]},o,h=>{let m=a(h);return[h,m,e]}),u=l;return c!==e&&(d(s),u=a(s)),(0,ln.useEffect)(()=>{let{v:h}=r;h&&i[ym](e,h);let m=i[N0](e,d,h);return d(h),m},[i,e,r]),(0,ln.useEffect)(()=>{i[ym](e,s)}),(0,ln.useDebugValue)(u),u}function ka(e,t){let n=Jx(t),{s:r,w:i}=(0,ln.useContext)(n);return(0,ln.useCallback)(a=>{if((N&&N.MODE)!=="production"&&!("write"in e))throw new Error("not writable atom");let s=l=>r[O0](e,a,l);return i?i(s):s()},[r,i,e])}function Ve(e,t){return"scope"in e&&(console.warn("atom.scope is deprecated. Please do useAtom(atom, scope) instead."),t=e.scope),[vm(e,t),ka(e,t)]}var uEe=L(q(),1);var o$=L(q(),1),c2=L(j(),1),db=L(q(),1);S();function iP(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=iP(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Y(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=iP(t))&&(r&&(r+=" "),r+=n);return r}var wu=L(j(),1),ub=L(q(),1),A$=L(j(),1);var OF=L(Lx(),1);var vb=L(yv(),1),e4=L(Oy(),1),t4=L($y(),1),jF=L(Fy(),1);var So=L(q(),1);var Di=L(j(),1),Er=L(q(),1);var E=L(j(),1),dz=L(j(),1),mp=L(j(),1),Ez=L(j(),1);var Au=L(j(),1);var D2=L(j(),1);var xz=L(j(),1);var Hb=L(q(),1),Va=L(j(),1);var Gb=L(q(),1),_u=L(j(),1);var Wb=L(q(),1),Pu=L(j(),1),Mz=L(j(),1),yl=L(q(),1);var Jr=L(j(),1),A4=L(q(),1),lf=L(q(),1),_z=L(q(),1),Pz=L(q(),1);var Ub=L(q(),1),Dz=L(jo(),1),Lz=L(j(),1),To=L(q(),1);var ra=L(j(),1);S();S();function ze(){return ze=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},ze.apply(this,arguments)}var We=L(q());S();function gn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}S();var aP=L(q());function LK(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ew(...e){return t=>e.forEach(n=>LK(n,t))}function Un(...e){return(0,aP.useCallback)(ew(...e),e)}S();var io=L(q());function Uo(e,t=[]){let n=[];function r(o,a){let s=(0,io.createContext)(a),l=n.length;n=[...n,a];function c(u){let{scope:h,children:m,...p}=u,f=h?.[e][l]||s,g=(0,io.useMemo)(()=>p,Object.values(p));return(0,io.createElement)(f.Provider,{value:g},m)}function d(u,h){let m=h?.[e][l]||s,p=(0,io.useContext)(m);if(p)return p;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${o}\``)}return c.displayName=o+"Provider",[c,d]}let i=()=>{let o=n.map(a=>(0,io.createContext)(a));return function(s){let l=s?.[e]||o;return(0,io.useMemo)(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[r,RK(i,...t)]}function RK(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){let a=r.reduce((s,{useScope:l,scopeName:c})=>{let u=l(o)[`__scope${c}`];return{...s,...u}},{});return(0,io.useMemo)(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}S();var cn=L(q());S();var Ad=L(q()),sP=L(jo());S();var Xt=L(q());var Ds=(0,Xt.forwardRef)((e,t)=>{let{children:n,...r}=e,i=Xt.Children.toArray(n),o=i.find(NK);if(o){let a=o.props.children,s=i.map(l=>l===o?Xt.Children.count(a)>1?Xt.Children.only(null):(0,Xt.isValidElement)(a)?a.props.children:null:l);return(0,Xt.createElement)(tw,ze({},r,{ref:t}),(0,Xt.isValidElement)(a)?(0,Xt.cloneElement)(a,void 0,s):null)}return(0,Xt.createElement)(tw,ze({},r,{ref:t}),n)});Ds.displayName="Slot";var tw=(0,Xt.forwardRef)((e,t)=>{let{children:n,...r}=e;return(0,Xt.isValidElement)(n)?(0,Xt.cloneElement)(n,{...$K(r,n.props),ref:ew(t,n.ref)}):Xt.Children.count(n)>1?Xt.Children.only(null):null});tw.displayName="SlotClone";var OK=({children:e})=>(0,Xt.createElement)(Xt.Fragment,null,e);function NK(e){return(0,Xt.isValidElement)(e)&&e.type===OK}function $K(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...s)=>{o(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}var FK=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],Qt=FK.reduce((e,t)=>{let n=(0,Ad.forwardRef)((r,i)=>{let{asChild:o,...a}=r,s=o?Ds:t;return(0,Ad.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]),(0,Ad.createElement)(s,ze({},a,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function lP(e,t){e&&(0,sP.flushSync)(()=>e.dispatchEvent(t))}S();var _d=L(q());function fr(e){let t=(0,_d.useRef)(e);return(0,_d.useEffect)(()=>{t.current=e}),(0,_d.useMemo)(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}S();var cP=L(q());function dP(e,t=globalThis?.document){let n=fr(e);(0,cP.useEffect)(()=>{let r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}var nw="dismissableLayer.update",BK="dismissableLayer.pointerDownOutside",zK="dismissableLayer.focusOutside",uP,HK=(0,cn.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mP=(0,cn.forwardRef)((e,t)=>{var n;let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...c}=e,d=(0,cn.useContext)(HK),[u,h]=(0,cn.useState)(null),m=(n=u?.ownerDocument)!==null&&n!==void 0?n:globalThis?.document,[,p]=(0,cn.useState)({}),f=Un(t,C=>h(C)),g=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(b),y=u?g.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,T=y>=v,k=GK(C=>{let P=C.target,R=[...d.branches].some(A=>A.contains(P));!T||R||(o?.(C),s?.(C),C.defaultPrevented||l?.())},m),M=WK(C=>{let P=C.target;[...d.branches].some(A=>A.contains(P))||(a?.(C),s?.(C),C.defaultPrevented||l?.())},m);return dP(C=>{y===d.layers.size-1&&(i?.(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},m),(0,cn.useEffect)(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(uP=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),hP(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=uP)}},[u,m,r,d]),(0,cn.useEffect)(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),hP())},[u,d]),(0,cn.useEffect)(()=>{let C=()=>p({});return document.addEventListener(nw,C),()=>document.removeEventListener(nw,C)},[]),(0,cn.createElement)(Qt.div,ze({},c,{ref:f,style:{pointerEvents:w?T?"auto":"none":void 0,...e.style},onFocusCapture:gn(e.onFocusCapture,M.onFocusCapture),onBlurCapture:gn(e.onBlurCapture,M.onBlurCapture),onPointerDownCapture:gn(e.onPointerDownCapture,k.onPointerDownCapture)}))});function GK(e,t=globalThis?.document){let n=fr(e),r=(0,cn.useRef)(!1),i=(0,cn.useRef)(()=>{});return(0,cn.useEffect)(()=>{let o=s=>{if(s.target&&!r.current){let c=function(){pP(BK,n,l,{discrete:!0})},l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function WK(e,t=globalThis?.document){let n=fr(e),r=(0,cn.useRef)(!1);return(0,cn.useEffect)(()=>{let i=o=>{o.target&&!r.current&&pP(zK,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function hP(){let e=new CustomEvent(nw);document.dispatchEvent(e)}function pP(e,t,n,{discrete:r}){let i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?lP(i,o):i.dispatchEvent(o)}S();var gP=L(q()),rw=0;function EP(){(0,gP.useEffect)(()=>{var e,t;let n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:fP()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:fP()),rw++,()=>{rw===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),rw--}},[])}function fP(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}S();var _r=L(q());var iw="focusScope.autoFocusOnMount",ow="focusScope.autoFocusOnUnmount",bP={bubbles:!1,cancelable:!0};var wP=(0,_r.forwardRef)((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=e,[s,l]=(0,_r.useState)(null),c=fr(i),d=fr(o),u=(0,_r.useRef)(null),h=Un(t,f=>l(f)),m=(0,_r.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,_r.useEffect)(()=>{if(r){let f=function(b){if(m.paused||!s)return;let v=b.target;s.contains(v)?u.current=v:tc(u.current,{select:!0})},g=function(b){m.paused||!s||s.contains(b.relatedTarget)||tc(u.current,{select:!0})};return document.addEventListener("focusin",f),document.addEventListener("focusout",g),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",g)}}},[r,s,m.paused]),(0,_r.useEffect)(()=>{if(s){vP.add(m);let f=document.activeElement;if(!s.contains(f)){let b=new CustomEvent(iw,bP);s.addEventListener(iw,c),s.dispatchEvent(b),b.defaultPrevented||(jK(XK(SP(s)),{select:!0}),document.activeElement===f&&tc(s))}return()=>{s.removeEventListener(iw,c),setTimeout(()=>{let b=new CustomEvent(ow,bP);s.addEventListener(ow,d),s.dispatchEvent(b),b.defaultPrevented||tc(f??document.body,{select:!0}),s.removeEventListener(ow,d),vP.remove(m)},0)}}},[s,c,d,m]);let p=(0,_r.useCallback)(f=>{if(!n&&!r||m.paused)return;let g=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,b=document.activeElement;if(g&&b){let v=f.currentTarget,[y,w]=UK(v);y&&w?!f.shiftKey&&b===w?(f.preventDefault(),n&&tc(y,{select:!0})):f.shiftKey&&b===y&&(f.preventDefault(),n&&tc(w,{select:!0})):b===v&&f.preventDefault()}},[n,r,m.paused]);return(0,_r.createElement)(Qt.div,ze({tabIndex:-1},a,{ref:h,onKeyDown:p}))});function jK(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(tc(r,{select:t}),document.activeElement!==n)return}function UK(e){let t=SP(e),n=yP(t,e),r=yP(t.reverse(),e);return[n,r]}function SP(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{let i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yP(e,t){for(let n of e)if(!VK(n,{upTo:t}))return n}function VK(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 YK(e){return e instanceof HTMLInputElement&&"select"in e}function tc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&YK(e)&&t&&e.select()}}var vP=ZK();function ZK(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=xP(e,t),e.unshift(t)},remove(t){var n;e=xP(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function xP(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function XK(e){return e.filter(t=>t.tagName!=="A")}S();var B0=L(q());S();var TP=L(q()),yi=globalThis?.document?TP.useLayoutEffect:()=>{};var KK=B0.useId||(()=>{}),qK=0;function Pd(e){let[t,n]=B0.useState(KK());return yi(()=>{e||n(r=>r??String(qK++))},[e]),e||(t?`radix-${t}`:"")}S();var $t=L(q());S();S();S();function rc(e){return e.split("-")[0]}function wm(e){return e.split("-")[1]}function Ld(e){return["top","bottom"].includes(rc(e))?"x":"y"}function sw(e){return e==="y"?"height":"width"}function CP(e,t,n){let{reference:r,floating:i}=e,o=r.x+r.width/2-i.width/2,a=r.y+r.height/2-i.height/2,s=Ld(t),l=sw(s),c=r[l]/2-i[l]/2,d=s==="x",u;switch(rc(t)){case"top":u={x:o,y:r.y-i.height};break;case"bottom":u={x:o,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:a};break;case"left":u={x:r.x-i.width,y:a};break;default:u={x:r.x,y:r.y}}switch(wm(t)){case"start":u[s]-=c*(n&&d?-1:1);break;case"end":u[s]+=c*(n&&d?-1:1)}return u}var AP=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=await(a.isRTL==null?void 0:a.isRTL(t)),l=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=CP(l,r,s),u=r,h={},m=0;for(let p=0;p<o.length;p++){let{name:f,fn:g}=o[p],{x:b,y:v,data:y,reset:w}=await g({x:c,y:d,initialPlacement:r,placement:u,strategy:i,middlewareData:h,rects:l,platform:a,elements:{reference:e,floating:t}});c=b??c,d=v??d,h={...h,[f]:{...h[f],...y}},w&&m<=50&&(m++,typeof w=="object"&&(w.placement&&(u=w.placement),w.rects&&(l=w.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:c,y:d}=CP(l,u,s)),p=-1)}return{x:c,y:d,placement:u,strategy:i,middlewareData:h}};function _P(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function xm(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function Dd(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:o,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=t,p=_P(m),f=s[h?u==="floating"?"reference":"floating":u],g=xm(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(f)))==null||n?f:f.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),b=xm(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:u==="floating"?{...a.floating,x:r,y:i}:a.reference,offsetParent:await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),strategy:l}):a[u]);return{top:g.top-b.top+p.top,bottom:b.bottom-g.bottom+p.bottom,left:g.left-b.left+p.left,right:b.right-g.right+p.right}}var QK=Math.min,nc=Math.max;function aw(e,t,n){return nc(e,QK(t,n))}var H0=e=>({name:"arrow",options:e,async fn(t){let{element:n,padding:r=0}=e??{},{x:i,y:o,placement:a,rects:s,platform:l}=t;if(n==null)return{};let c=_P(r),d={x:i,y:o},u=Ld(a),h=wm(a),m=sw(u),p=await l.getDimensions(n),f=u==="y"?"top":"left",g=u==="y"?"bottom":"right",b=s.reference[m]+s.reference[u]-d[u]-s.floating[m],v=d[u]-s.reference[u],y=await(l.getOffsetParent==null?void 0:l.getOffsetParent(n)),w=y?u==="y"?y.clientHeight||0:y.clientWidth||0:0;w===0&&(w=s.floating[m]);let T=b/2-v/2,k=c[f],M=w-p[m]-c[g],C=w/2-p[m]/2+T,P=aw(k,C,M),R=(h==="start"?c[f]:c[g])>0&&C!==P&&s.reference[m]<=s.floating[m];return{[u]:d[u]-(R?C<k?k-C:M-C:0),data:{[u]:P,centerOffset:C-P}}}}),JK={left:"right",right:"left",bottom:"top",top:"bottom"};function z0(e){return e.replace(/left|right|bottom|top/g,t=>JK[t])}function eq(e,t,n){n===void 0&&(n=!1);let r=wm(e),i=Ld(e),o=sw(i),a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=z0(a)),{main:a,cross:z0(a)}}var tq={start:"end",end:"start"};function MP(e){return e.replace(/start|end/g,t=>tq[t])}var PP=["top","right","bottom","left"],x1e=PP.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);var lw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:s,elements:l}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",flipAlignment:m=!0,...p}=e,f=rc(r),g=u||(f===a||!m?[z0(a)]:function(C){let P=z0(C);return[MP(C),P,MP(P)]}(a)),b=[a,...g],v=await Dd(t,p),y=[],w=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&y.push(v[f]),d){let{main:C,cross:P}=eq(r,o,await(s.isRTL==null?void 0:s.isRTL(l.floating)));y.push(v[C],v[P])}if(w=[...w,{placement:r,overflows:y}],!y.every(C=>C<=0)){var T,k;let C=((T=(k=i.flip)==null?void 0:k.index)!=null?T:0)+1,P=b[C];if(P)return{data:{index:C,overflows:w},reset:{placement:P}};let R="bottom";switch(h){case"bestFit":{var M;let A=(M=w.map(_=>[_,_.overflows.filter($=>$>0).reduce(($,W)=>$+W,0)]).sort((_,$)=>_[1]-$[1])[0])==null?void 0:M[0].placement;A&&(R=A);break}case"initialPlacement":R=a}if(r!==R)return{reset:{placement:R}}}return{}}}};function IP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kP(e){return PP.some(t=>e[t]>=0)}var cw=function(e){let{strategy:t="referenceHidden",...n}=e===void 0?{}:e;return{name:"hide",async fn(r){let{rects:i}=r;switch(t){case"referenceHidden":{let o=IP(await Dd(r,{...n,elementContext:"reference"}),i.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:kP(o)}}}case"escaped":{let o=IP(await Dd(r,{...n,altBoundary:!0}),i.floating);return{data:{escapedOffsets:o,escaped:kP(o)}}}default:return{}}}}},dw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){let{x:n,y:r}=t,i=await async function(o,a){let{placement:s,platform:l,elements:c}=o,d=await(l.isRTL==null?void 0:l.isRTL(c.floating)),u=rc(s),h=wm(s),m=Ld(s)==="x",p=["left","top"].includes(u)?-1:1,f=d&&m?-1:1,g=typeof a=="function"?a(o):a,{mainAxis:b,crossAxis:v,alignmentAxis:y}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...g};return h&&typeof y=="number"&&(v=h==="end"?-1*y:y),m?{x:v*f,y:b*p}:{x:b*p,y:v*f}}(t,e);return{x:n+i.x,y:r+i.y,data:i}}}};function DP(e){return e==="x"?"y":"x"}var uw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:g=>{let{x:b,y:v}=g;return{x:b,y:v}}},...l}=e,c={x:n,y:r},d=await Dd(t,l),u=Ld(rc(i)),h=DP(u),m=c[u],p=c[h];if(o){let g=u==="y"?"bottom":"right";m=aw(m+d[u==="y"?"top":"left"],m,m-d[g])}if(a){let g=h==="y"?"bottom":"right";p=aw(p+d[h==="y"?"top":"left"],p,p-d[g])}let f=s.fn({...t,[u]:m,[h]:p});return{...f,data:{x:f.x-n,y:f.y-r}}}}},hw=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=e,d={x:n,y:r},u=Ld(i),h=DP(u),m=d[u],p=d[h],f=typeof s=="function"?s({...o,placement:i}):s,g=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(l){let T=u==="y"?"height":"width",k=o.reference[u]-o.floating[T]+g.mainAxis,M=o.reference[u]+o.reference[T]-g.mainAxis;m<k?m=k:m>M&&(m=M)}if(c){var b,v,y,w;let T=u==="y"?"width":"height",k=["top","left"].includes(rc(i)),M=o.reference[h]-o.floating[T]+(k&&(b=(v=a.offset)==null?void 0:v[h])!=null?b:0)+(k?0:g.crossAxis),C=o.reference[h]+o.reference[T]+(k?0:(y=(w=a.offset)==null?void 0:w[h])!=null?y:0)-(k?g.crossAxis:0);p<M?p=M:p>C&&(p=C)}return{[u]:m,[h]:p}}}},mw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:o}=t,{apply:a,...s}=e,l=await Dd(t,s),c=rc(n),d=wm(n),u,h;c==="top"||c==="bottom"?(u=c,h=d===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(h=c,u=d==="end"?"top":"bottom");let m=nc(l.left,0),p=nc(l.right,0),f=nc(l.top,0),g=nc(l.bottom,0),b={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(f!==0||g!==0?f+g:nc(l.top,l.bottom)):l[u]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(m!==0||p!==0?m+p:nc(l.left,l.right)):l[h])},v=await i.getDimensions(o.floating);a?.({...t,...b});let y=await i.getDimensions(o.floating);return v.width!==y.width||v.height!==y.height?{reset:{rects:!0}}:{}}}};function FP(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function Pa(e){if(e==null)return window;if(!FP(e)){let t=e.ownerDocument;return t&&t.defaultView||window}return e}function Tm(e){return Pa(e).getComputedStyle(e)}function Aa(e){return FP(e)?"":e?(e.nodeName||"").toLowerCase():""}function BP(){let e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(t=>t.brand+"/"+t.version).join(" "):navigator.userAgent}function Vo(e){return e instanceof Pa(e).HTMLElement}function Rs(e){return e instanceof Pa(e).Element}function fw(e){return typeof ShadowRoot>"u"?!1:e instanceof Pa(e).ShadowRoot||e instanceof ShadowRoot}function j0(e){let{overflow:t,overflowX:n,overflowY:r}=Tm(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function nq(e){return["table","td","th"].includes(Aa(e))}function LP(e){let t=/firefox/i.test(BP()),n=Tm(e);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"}function zP(){return!/^((?!chrome|android).)*safari/i.test(BP())}var RP=Math.min,Sm=Math.max,G0=Math.round;function _a(e,t,n){var r,i,o,a;t===void 0&&(t=!1),n===void 0&&(n=!1);let s=e.getBoundingClientRect(),l=1,c=1;t&&Vo(e)&&(l=e.offsetWidth>0&&G0(s.width)/e.offsetWidth||1,c=e.offsetHeight>0&&G0(s.height)/e.offsetHeight||1);let d=Rs(e)?Pa(e):window,u=!zP()&&n,h=(s.left+(u&&(r=(i=d.visualViewport)==null?void 0:i.offsetLeft)!=null?r:0))/l,m=(s.top+(u&&(o=(a=d.visualViewport)==null?void 0:a.offsetTop)!=null?o:0))/c,p=s.width/l,f=s.height/c;return{width:p,height:f,top:m,right:h+p,bottom:m+f,left:h,x:h,y:m}}function Ls(e){return(t=e,(t instanceof Pa(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function U0(e){return Rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function HP(e){return _a(Ls(e)).left+U0(e).scrollLeft}function rq(e,t,n){let r=Vo(t),i=Ls(t),o=_a(e,r&&function(l){let c=_a(l);return G0(c.width)!==l.offsetWidth||G0(c.height)!==l.offsetHeight}(t),n==="fixed"),a={scrollLeft:0,scrollTop:0},s={x:0,y:0};if(r||!r&&n!=="fixed")if((Aa(t)!=="body"||j0(i))&&(a=U0(t)),Vo(t)){let l=_a(t,!0);s.x=l.x+t.clientLeft,s.y=l.y+t.clientTop}else i&&(s.x=HP(i));return{x:o.left+a.scrollLeft-s.x,y:o.top+a.scrollTop-s.y,width:o.width,height:o.height}}function GP(e){return Aa(e)==="html"?e:e.assignedSlot||e.parentNode||(fw(e)?e.host:null)||Ls(e)}function OP(e){return Vo(e)&&getComputedStyle(e).position!=="fixed"?e.offsetParent:null}function pw(e){let t=Pa(e),n=OP(e);for(;n&&nq(n)&&getComputedStyle(n).position==="static";)n=OP(n);return n&&(Aa(n)==="html"||Aa(n)==="body"&&getComputedStyle(n).position==="static"&&!LP(n))?t:n||function(r){let i=GP(r);for(fw(i)&&(i=i.host);Vo(i)&&!["html","body"].includes(Aa(i));){if(LP(i))return i;i=i.parentNode}return null}(e)||t}function NP(e){if(Vo(e))return{width:e.offsetWidth,height:e.offsetHeight};let t=_a(e);return{width:t.width,height:t.height}}function WP(e){let t=GP(e);return["html","body","#document"].includes(Aa(t))?e.ownerDocument.body:Vo(t)&&j0(t)?t:WP(t)}function W0(e,t){var n;t===void 0&&(t=[]);let r=WP(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=Pa(r),a=i?[o].concat(o.visualViewport||[],j0(r)?r:[]):r,s=t.concat(a);return i?s:s.concat(W0(a))}function $P(e,t,n){return t==="viewport"?xm(function(r,i){let o=Pa(r),a=Ls(r),s=o.visualViewport,l=a.clientWidth,c=a.clientHeight,d=0,u=0;if(s){l=s.width,c=s.height;let h=zP();(h||!h&&i==="fixed")&&(d=s.offsetLeft,u=s.offsetTop)}return{width:l,height:c,x:d,y:u}}(e,n)):Rs(t)?function(r,i){let o=_a(r,!1,i==="fixed"),a=o.top+r.clientTop,s=o.left+r.clientLeft;return{top:a,left:s,x:s,y:a,right:s+r.clientWidth,bottom:a+r.clientHeight,width:r.clientWidth,height:r.clientHeight}}(t,n):xm(function(r){var i;let o=Ls(r),a=U0(r),s=(i=r.ownerDocument)==null?void 0:i.body,l=Sm(o.scrollWidth,o.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),c=Sm(o.scrollHeight,o.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),d=-a.scrollLeft+HP(r),u=-a.scrollTop;return Tm(s||o).direction==="rtl"&&(d+=Sm(o.clientWidth,s?s.clientWidth:0)-l),{width:l,height:c,x:d,y:u}}(Ls(e)))}function iq(e){let t=W0(e),n=["absolute","fixed"].includes(Tm(e).position)&&Vo(e)?pw(e):e;return Rs(n)?t.filter(r=>Rs(r)&&function(i,o){let a=o.getRootNode==null?void 0:o.getRootNode();if(i.contains(o))return!0;if(a&&fw(a)){let s=o;do{if(s&&i===s)return!0;s=s.parentNode||s.host}while(s)}return!1}(r,n)&&Aa(r)!=="body"):[]}var oq={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,o=[...n==="clippingAncestors"?iq(t):[].concat(n),r],a=o[0],s=o.reduce((l,c)=>{let d=$P(t,c,i);return l.top=Sm(d.top,l.top),l.right=RP(d.right,l.right),l.bottom=RP(d.bottom,l.bottom),l.left=Sm(d.left,l.left),l},$P(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e,i=Vo(n),o=Ls(n);if(n===o)return t;let a={scrollLeft:0,scrollTop:0},s={x:0,y:0};if((i||!i&&r!=="fixed")&&((Aa(n)!=="body"||j0(o))&&(a=U0(n)),Vo(n))){let l=_a(n,!0);s.x=l.x+n.clientLeft,s.y=l.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+s.x,y:t.y-a.scrollTop+s.y}},isElement:Rs,getDimensions:NP,getOffsetParent:pw,getDocumentElement:Ls,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:rq(t,pw(n),r),floating:{...NP(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>Tm(e).direction==="rtl"};function jP(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=!0,animationFrame:s=!1}=r,l=i&&!s,c=o&&!s,d=l||c?[...Rs(e)?W0(e):[],...W0(t)]:[];d.forEach(p=>{l&&p.addEventListener("scroll",n,{passive:!0}),c&&p.addEventListener("resize",n)});let u,h=null;if(a){let p=!0;h=new ResizeObserver(()=>{p||n(),p=!1}),Rs(e)&&!s&&h.observe(e),h.observe(t)}let m=s?_a(e):null;return s&&function p(){let f=_a(e);!m||f.x===m.x&&f.y===m.y&&f.width===m.width&&f.height===m.height||n(),m=f,u=requestAnimationFrame(p)}(),n(),()=>{var p;d.forEach(f=>{l&&f.removeEventListener("scroll",n),c&&f.removeEventListener("resize",n)}),(p=h)==null||p.disconnect(),h=null,s&&cancelAnimationFrame(u)}}var UP=(e,t,n)=>AP(e,t,{platform:oq,...n});var Vn=L(q()),V0=L(q()),VP=L(jo()),gw=typeof document<"u"?V0.useLayoutEffect:V0.useEffect;function Ew(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(!Ew(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(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!Ew(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function aq(e){let t=Vn.useRef(e);return gw(()=>{t.current=e}),t}function YP(e){let{middleware:t,placement:n="bottom",strategy:r="absolute",whileElementsMounted:i}=e===void 0?{}:e,o=Vn.useRef(null),a=Vn.useRef(null),s=aq(i),l=Vn.useRef(null),[c,d]=Vn.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[u,h]=Vn.useState(t);Ew(u?.map(y=>{let{options:w}=y;return w}),t?.map(y=>{let{options:w}=y;return w}))||h(t);let m=Vn.useCallback(()=>{!o.current||!a.current||UP(o.current,a.current,{middleware:u,placement:n,strategy:r}).then(y=>{p.current&&VP.flushSync(()=>{d(y)})})},[u,n,r]);gw(()=>{p.current&&m()},[m]);let p=Vn.useRef(!1);gw(()=>(p.current=!0,()=>{p.current=!1}),[]);let f=Vn.useCallback(()=>{if(typeof l.current=="function"&&(l.current(),l.current=null),o.current&&a.current)if(s.current){let y=s.current(o.current,a.current,m);l.current=y}else m()},[m,s]),g=Vn.useCallback(y=>{o.current=y,f()},[f]),b=Vn.useCallback(y=>{a.current=y,f()},[f]),v=Vn.useMemo(()=>({reference:o,floating:a}),[]);return Vn.useMemo(()=>({...c,update:m,refs:v,reference:g,floating:b}),[c,m,v,g,b])}var ZP=e=>{let{element:t,padding:n}=e;function r(i){return Object.prototype.hasOwnProperty.call(i,"current")}return{name:"arrow",options:e,fn(i){return r(t)?t.current!=null?H0({element:t.current,padding:n}).fn(i):{}:t?H0({element:t,padding:n}).fn(i):{}}}};S();var Cm=L(q());var sq=(0,Cm.forwardRef)((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,Cm.createElement)(Qt.svg,ze({},o,{ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),e.asChild?n:(0,Cm.createElement)("polygon",{points:"0,0 30,0 15,10"}))}),XP=sq;S();var KP=L(q());function qP(e){let[t,n]=(0,KP.useState)(void 0);return yi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;let o=i[0],a,s;if("borderBoxSize"in o){let l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,s=c.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var QP="Popper",[bw,yw]=Uo(QP),[lq,JP]=bw(QP),cq=e=>{let{__scopePopper:t,children:n}=e,[r,i]=(0,$t.useState)(null);return(0,$t.createElement)(lq,{scope:t,anchor:r,onAnchorChange:i},n)},dq="PopperAnchor",uq=(0,$t.forwardRef)((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,o=JP(dq,n),a=(0,$t.useRef)(null),s=Un(t,a);return(0,$t.useEffect)(()=>{o.onAnchorChange(r?.current||a.current)}),r?null:(0,$t.createElement)(Qt.div,ze({},i,{ref:s}))}),Y0="PopperContent",[hq,mq]=bw(Y0),[pq,fq]=bw(Y0,{hasParent:!1,positionUpdateFns:new Set}),gq=(0,$t.forwardRef)((e,t)=>{var n,r,i,o,a,s,l,c;let{__scopePopper:d,side:u="bottom",sideOffset:h=0,align:m="center",alignOffset:p=0,arrowPadding:f=0,collisionBoundary:g=[],collisionPadding:b=0,sticky:v="partial",hideWhenDetached:y=!1,avoidCollisions:w=!0,onPlaced:T,...k}=e,M=JP(Y0,d),[C,P]=(0,$t.useState)(null),R=Un(t,ed=>P(ed)),[A,_]=(0,$t.useState)(null),$=qP(A),W=(n=$?.width)!==null&&n!==void 0?n:0,H=(r=$?.height)!==null&&r!==void 0?r:0,K=u+(m!=="center"?"-"+m:""),Q=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},ie=Array.isArray(g)?g:[g],X=ie.length>0,F={padding:Q,boundary:ie.filter(xq),altBoundary:X},{reference:B,floating:U,strategy:G,x:Z,y:ee,placement:te,middlewareData:de,update:qe}=YP({strategy:"fixed",placement:K,whileElementsMounted:jP,middleware:[wq(),dw({mainAxis:h+H,alignmentAxis:p}),w?uw({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?hw():void 0,...F}):void 0,A?ZP({element:A,padding:f}):void 0,w?lw({...F}):void 0,mw({...F,apply:({elements:ed,availableWidth:aU,availableHeight:sU})=>{ed.floating.style.setProperty("--radix-popper-available-width",`${aU}px`),ed.floating.style.setProperty("--radix-popper-available-height",`${sU}px`)}}),Sq({arrowWidth:W,arrowHeight:H}),y?cw({strategy:"referenceHidden"}):void 0].filter(vq)});yi(()=>{B(M.anchor)},[B,M.anchor]);let Ye=Z!==null&&ee!==null,[Me,Be]=eD(te),Oe=fr(T);yi(()=>{Ye&&Oe?.()},[Ye,Oe]);let us=(i=de.arrow)===null||i===void 0?void 0:i.x,yh=(o=de.arrow)===null||o===void 0?void 0:o.y,Pl=((a=de.arrow)===null||a===void 0?void 0:a.centerOffset)!==0,[Dl,Sn]=(0,$t.useState)();yi(()=>{C&&Sn(window.getComputedStyle(C).zIndex)},[C]);let{hasParent:lt,positionUpdateFns:fn}=fq(Y0,d),on=!lt;(0,$t.useLayoutEffect)(()=>{if(!on)return fn.add(qe),()=>{fn.delete(qe)}},[on,fn,qe]),yi(()=>{on&&Ye&&Array.from(fn).reverse().forEach(ed=>requestAnimationFrame(ed))},[on,Ye,fn]);let XI={"data-side":Me,"data-align":Be,...k,ref:R,style:{...k.style,animation:Ye?void 0:"none",opacity:(s=de.hide)!==null&&s!==void 0&&s.referenceHidden?0:void 0}};return(0,$t.createElement)("div",{ref:U,"data-radix-popper-content-wrapper":"",style:{position:G,left:0,top:0,transform:Ye?`translate3d(${Math.round(Z)}px, ${Math.round(ee)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:Dl,"--radix-popper-transform-origin":[(l=de.transformOrigin)===null||l===void 0?void 0:l.x,(c=de.transformOrigin)===null||c===void 0?void 0:c.y].join(" ")},dir:e.dir},(0,$t.createElement)(hq,{scope:d,placedSide:Me,onArrowChange:_,arrowX:us,arrowY:yh,shouldHideArrow:Pl},on?(0,$t.createElement)(pq,{scope:d,hasParent:!0,positionUpdateFns:fn},(0,$t.createElement)(Qt.div,XI)):(0,$t.createElement)(Qt.div,XI)))}),Eq="PopperArrow",bq={top:"bottom",right:"left",bottom:"top",left:"right"},yq=(0,$t.forwardRef)(function(t,n){let{__scopePopper:r,...i}=t,o=mq(Eq,r),a=bq[o.placedSide];return(0,$t.createElement)("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0}},(0,$t.createElement)(XP,ze({},i,{ref:n,style:{...i.style,display:"block"}})))});function vq(e){return e!==void 0}function xq(e){return e!==null}var wq=()=>({name:"anchorCssProperties",fn(e){let{rects:t,elements:n}=e,{width:r,height:i}=t.reference;return n.floating.style.setProperty("--radix-popper-anchor-width",`${r}px`),n.floating.style.setProperty("--radix-popper-anchor-height",`${i}px`),{}}}),Sq=e=>({name:"transformOrigin",options:e,fn(t){var n,r,i,o,a;let{placement:s,rects:l,middlewareData:c}=t,u=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[p,f]=eD(s),g={start:"0%",center:"50%",end:"100%"}[f],b=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+h/2,v=((o=(a=c.arrow)===null||a===void 0?void 0:a.y)!==null&&o!==void 0?o:0)+m/2,y="",w="";return p==="bottom"?(y=u?g:`${b}px`,w=`${-m}px`):p==="top"?(y=u?g:`${b}px`,w=`${l.floating.height+m}px`):p==="right"?(y=`${-m}px`,w=u?g:`${v}px`):p==="left"&&(y=`${l.floating.width+m}px`,w=u?g:`${v}px`),{data:{x:y,y:w}}}});function eD(e){let[t,n="center"]=e.split("-");return[t,n]}var tD=cq,nD=uq,rD=gq,iD=yq;S();var Z0=L(q()),oD=L(jo());var aD=(0,Z0.forwardRef)((e,t)=>{var n;let{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=e;return r?oD.default.createPortal((0,Z0.createElement)(Qt.div,ze({},i,{ref:t})),r):null});S();var Jn=L(q()),sD=L(jo());function Tq(e,t){return(0,Jn.useReducer)((n,r)=>{let i=t[n][r];return i??n},e)}var Rd=e=>{let{present:t,children:n}=e,r=Cq(t),i=typeof n=="function"?n({present:r.isPresent}):Jn.Children.only(n),o=Un(r.ref,i.ref);return typeof n=="function"||r.isPresent?(0,Jn.cloneElement)(i,{ref:o}):null};Rd.displayName="Presence";function Cq(e){let[t,n]=(0,Jn.useState)(),r=(0,Jn.useRef)({}),i=(0,Jn.useRef)(e),o=(0,Jn.useRef)("none"),a=e?"mounted":"unmounted",[s,l]=Tq(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,Jn.useEffect)(()=>{let c=X0(r.current);o.current=s==="mounted"?c:"none"},[s]),yi(()=>{let c=r.current,d=i.current;if(d!==e){let h=o.current,m=X0(c);e?l("MOUNT"):m==="none"||c?.display==="none"?l("UNMOUNT"):l(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),yi(()=>{if(t){let c=u=>{let m=X0(r.current).includes(u.animationName);u.target===t&&m&&(0,sD.flushSync)(()=>l("ANIMATION_END"))},d=u=>{u.target===t&&(o.current=X0(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:(0,Jn.useCallback)(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function X0(e){return e?.animationName||"none"}S();var Os=L(q());function Od({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=Mq({defaultProp:t,onChange:n}),o=e!==void 0,a=o?e:r,s=fr(n),l=(0,Os.useCallback)(c=>{if(o){let u=typeof c=="function"?c(e):c;u!==e&&s(u)}else i(c)},[o,e,i,s]);return[a,l]}function Mq({defaultProp:e,onChange:t}){let n=(0,Os.useState)(e),[r]=n,i=(0,Os.useRef)(r),o=fr(t);return(0,Os.useEffect)(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}S();var Iq=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nd=new WeakMap,K0=new WeakMap,q0={},vw=0,lD=function(e){return e&&(e.host||lD(e.parentNode))},kq=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=lD(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Aq=function(e,t,n,r){var i=kq(t,Array.isArray(e)?e:[e]);q0[n]||(q0[n]=new WeakMap);var o=q0[n],a=[],s=new Set,l=new Set(i),c=function(u){!u||s.has(u)||(s.add(u),c(u.parentNode))};i.forEach(c);var d=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(h){if(s.has(h))d(h);else{var m=h.getAttribute(r),p=m!==null&&m!=="false",f=(Nd.get(h)||0)+1,g=(o.get(h)||0)+1;Nd.set(h,f),o.set(h,g),a.push(h),f===1&&p&&K0.set(h,!0),g===1&&h.setAttribute(n,"true"),p||h.setAttribute(r,"true")}})};return d(t),s.clear(),vw++,function(){a.forEach(function(u){var h=Nd.get(u)-1,m=o.get(u)-1;Nd.set(u,h),o.set(u,m),h||(K0.has(u)||u.removeAttribute(r),K0.delete(u)),m||u.removeAttribute(n)}),vw--,vw||(Nd=new WeakMap,Nd=new WeakMap,K0=new WeakMap,q0={})}},cD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||Iq(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Aq(r,i,n,"aria-hidden")):function(){return null}};S();S();S();var Yo=function(){return Yo=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Yo.apply(this,arguments)};function dD(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 uD(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var tg=L(q());S();var er=L(q());S();var ic="right-scroll-bar-position",oc="width-before-scroll-bar",xw="with-scroll-bars-hidden",ww="--removed-body-scroll-bar-size";S();S();function hD(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}S();var mD=L(q());function pD(e,t){var n=(0,mD.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}S();function Sw(e,t){return pD(t||null,function(n){return e.forEach(function(r){return hD(r,n)})})}S();S();S();var $d=function(){return $d=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},$d.apply(this,arguments)};function fD(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}S();function _q(e){return e}function Pq(e,t){t===void 0&&(t=_q);var n=[],r=!1,i={read:function(){if(r)throw new 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(o){var a=t(o,r);return n.push(a),function(){n=n.filter(function(s){return s!==a})}},assignSyncMedium:function(o){for(r=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(s){return o(s)},filter:function(){return n}}},assignMedium:function(o){r=!0;var a=[];if(n.length){var s=n;n=[],s.forEach(o),a=n}var l=function(){var d=a;a=[],d.forEach(o)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){a.push(d),c()},filter:function(d){return a=a.filter(d),n}}}};return i}function Tw(e){e===void 0&&(e={});var t=Pq(null);return t.options=$d({async:!0,ssr:!1},e),t}S();var gD=L(q()),ED=function(e){var t=e.sideCar,n=fD(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return gD.createElement(r,$d({},n))};ED.isSideCarExport=!0;function Cw(e,t){return e.useMedium(t),ED}var Q0=Tw();var Mw=function(){},Mm=er.forwardRef(function(e,t){var n=er.useRef(null),r=er.useState({onScrollCapture:Mw,onWheelCapture:Mw,onTouchMoveCapture:Mw}),i=r[0],o=r[1],a=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,d=e.enabled,u=e.shards,h=e.sideCar,m=e.noIsolation,p=e.inert,f=e.allowPinchZoom,g=e.as,b=g===void 0?"div":g,v=dD(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),y=h,w=Sw([n,t]),T=Yo(Yo({},v),i);return er.createElement(er.Fragment,null,d&&er.createElement(y,{sideCar:Q0,removeScrollBar:c,shards:u,noIsolation:m,inert:p,setCallbacks:o,allowPinchZoom:!!f,lockRef:n}),a?er.cloneElement(er.Children.only(s),Yo(Yo({},T),{ref:w})):er.createElement(b,Yo({},T,{className:l,ref:w}),s))});Mm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Mm.classNames={fullWidth:oc,zeroRight:ic};S();S();var Ft=L(q());S();S();var J0=L(q());S();S();S();var vD=L(q());S();S();var bD;var yD=function(){if(bD)return bD;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Dq(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=yD();return t&&e.setAttribute("nonce",t),e}function Lq(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rq(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Iw=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Dq())&&(Lq(t,n),Rq(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}};var kw=function(){var e=Iw();return function(t,n){vD.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};var Im=function(){var e=kw(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t};S();var Oq={left:0,top:0,right:0,gap:0},Aw=function(e){return parseInt(e||"",10)||0},Nq=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[Aw(n),Aw(r),Aw(i)]},_w=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Oq;var t=Nq(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])}};var $q=Im(),Fq=function(e,t,n,r){var i=e.left,o=e.top,a=e.right,s=e.gap;return n===void 0&&(n="margin"),`
68
- .`.concat(xw,` {
69
- overflow: hidden `).concat(r,`;
70
- padding-right: `).concat(s,"px ").concat(r,`;
71
- }
72
- body {
73
- overflow: hidden `).concat(r,`;
74
- overscroll-behavior: contain;
75
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
76
- padding-left: `.concat(i,`px;
77
- padding-top: `).concat(o,`px;
78
- padding-right: `).concat(a,`px;
79
- margin-left:0;
80
- margin-top:0;
81
- margin-right: `).concat(s,"px ").concat(r,`;
82
- `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),`
83
- }
84
-
85
- .`).concat(ic,` {
86
- right: `).concat(s,"px ").concat(r,`;
87
- }
88
-
89
- .`).concat(oc,` {
90
- margin-right: `).concat(s,"px ").concat(r,`;
91
- }
92
-
93
- .`).concat(ic," .").concat(ic,` {
94
- right: 0 `).concat(r,`;
95
- }
96
-
97
- .`).concat(oc," .").concat(oc,` {
98
- margin-right: 0 `).concat(r,`;
99
- }
100
-
101
- body {
102
- `).concat(ww,": ").concat(s,`px;
103
- }
104
- `)},Pw=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r,o=J0.useMemo(function(){return _w(i)},[i]);return J0.createElement($q,{styles:Fq(o,!t,i,n?"":"!important")})};S();var Dw=!1;if(typeof window<"u")try{km=Object.defineProperty({},"passive",{get:function(){return Dw=!0,!0}}),window.addEventListener("test",km,km),window.removeEventListener("test",km,km)}catch{Dw=!1}var km,ac=Dw?{passive:!1}:!1;S();var Bq=function(e){return e.tagName==="TEXTAREA"},xD=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Bq(e)&&n[t]==="visible")},zq=function(e){return xD(e,"overflowY")},Hq=function(e){return xD(e,"overflowX")},Lw=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=wD(e,n);if(r){var i=SD(e,n),o=i[1],a=i[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},Gq=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Wq=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},wD=function(e,t){return e==="v"?zq(t):Hq(t)},SD=function(e,t){return e==="v"?Gq(t):Wq(t)},jq=function(e,t){return e==="h"&&t==="rtl"?-1:1},TD=function(e,t,n,r,i){var o=jq(e,window.getComputedStyle(t).direction),a=o*r,s=n.target,l=t.contains(s),c=!1,d=a>0,u=0,h=0;do{var m=SD(e,s),p=m[0],f=m[1],g=m[2],b=f-g-o*p;(p||b)&&wD(e,s)&&(u+=b,h+=p),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(d&&(i&&u===0||!i&&a>u)||!d&&(i&&h===0||!i&&-a>h))&&(c=!0),c};var eg=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},CD=function(e){return[e.deltaX,e.deltaY]},MD=function(e){return e&&"current"in e?e.current:e},Uq=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Vq=function(e){return`
105
- .block-interactivity-`.concat(e,` {pointer-events: none;}
106
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
107
- `)},Yq=0,Fd=[];function ID(e){var t=Ft.useRef([]),n=Ft.useRef([0,0]),r=Ft.useRef(),i=Ft.useState(Yq++)[0],o=Ft.useState(function(){return Im()})[0],a=Ft.useRef(e);Ft.useEffect(function(){a.current=e},[e]),Ft.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var f=uD([e.lockRef.current],(e.shards||[]).map(MD),!0).filter(Boolean);return f.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),f.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=Ft.useCallback(function(f,g){if("touches"in f&&f.touches.length===2)return!a.current.allowPinchZoom;var b=eg(f),v=n.current,y="deltaX"in f?f.deltaX:v[0]-b[0],w="deltaY"in f?f.deltaY:v[1]-b[1],T,k=f.target,M=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in f&&M==="h"&&k.type==="range")return!1;var C=Lw(M,k);if(!C)return!0;if(C?T=M:(T=M==="v"?"h":"v",C=Lw(M,k)),!C)return!1;if(!r.current&&"changedTouches"in f&&(y||w)&&(r.current=T),!T)return!0;var P=r.current||T;return TD(P,g,f,P==="h"?y:w,!0)},[]),l=Ft.useCallback(function(f){var g=f;if(!(!Fd.length||Fd[Fd.length-1]!==o)){var b="deltaY"in g?CD(g):eg(g),v=t.current.filter(function(T){return T.name===g.type&&T.target===g.target&&Uq(T.delta,b)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var y=(a.current.shards||[]).map(MD).filter(Boolean).filter(function(T){return T.contains(g.target)}),w=y.length>0?s(g,y[0]):!a.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),c=Ft.useCallback(function(f,g,b,v){var y={name:f,delta:g,target:b,should:v};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),d=Ft.useCallback(function(f){n.current=eg(f),r.current=void 0},[]),u=Ft.useCallback(function(f){c(f.type,CD(f),f.target,s(f,e.lockRef.current))},[]),h=Ft.useCallback(function(f){c(f.type,eg(f),f.target,s(f,e.lockRef.current))},[]);Ft.useEffect(function(){return Fd.push(o),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",l,ac),document.addEventListener("touchmove",l,ac),document.addEventListener("touchstart",d,ac),function(){Fd=Fd.filter(function(f){return f!==o}),document.removeEventListener("wheel",l,ac),document.removeEventListener("touchmove",l,ac),document.removeEventListener("touchstart",d,ac)}},[]);var m=e.removeScrollBar,p=e.inert;return Ft.createElement(Ft.Fragment,null,p?Ft.createElement(o,{styles:Vq(i)}):null,m?Ft.createElement(Pw,{gapMode:"margin"}):null)}var kD=Cw(Q0,ID);var AD=tg.forwardRef(function(e,t){return tg.createElement(Mm,Yo({},e,{ref:t,sideCar:kD}))});AD.classNames=Mm.classNames;var Rw=AD;var _D="Popover",[PD,l2e]=Uo(_D,[yw]),ng=yw(),[Zq,Bd]=PD(_D),Xq=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:a=!1}=e,s=ng(t),l=(0,We.useRef)(null),[c,d]=(0,We.useState)(!1),[u=!1,h]=Od({prop:r,defaultProp:i,onChange:o});return(0,We.createElement)(tD,s,(0,We.createElement)(Zq,{scope:t,contentId:Pd(),triggerRef:l,open:u,onOpenChange:h,onOpenToggle:(0,We.useCallback)(()=>h(m=>!m),[h]),hasCustomAnchor:c,onCustomAnchorAdd:(0,We.useCallback)(()=>d(!0),[]),onCustomAnchorRemove:(0,We.useCallback)(()=>d(!1),[]),modal:a},n))};var Kq="PopoverTrigger",qq=(0,We.forwardRef)((e,t)=>{let{__scopePopover:n,...r}=e,i=Bd(Kq,n),o=ng(n),a=Un(t,i.triggerRef),s=(0,We.createElement)(Qt.button,ze({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":RD(i.open)},r,{ref:a,onClick:gn(e.onClick,i.onOpenToggle)}));return i.hasCustomAnchor?s:(0,We.createElement)(nD,ze({asChild:!0},o),s)}),DD="PopoverPortal",[Qq,Jq]=PD(DD,{forceMount:void 0}),eQ=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=Bd(DD,t);return(0,We.createElement)(Qq,{scope:t,forceMount:n},(0,We.createElement)(Rd,{present:n||o.open},(0,We.createElement)(aD,{asChild:!0,container:i},r)))},Am="PopoverContent",tQ=(0,We.forwardRef)((e,t)=>{let n=Jq(Am,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=Bd(Am,e.__scopePopover);return(0,We.createElement)(Rd,{present:r||o.open},o.modal?(0,We.createElement)(nQ,ze({},i,{ref:t})):(0,We.createElement)(rQ,ze({},i,{ref:t})))}),nQ=(0,We.forwardRef)((e,t)=>{let n=Bd(Am,e.__scopePopover),r=(0,We.useRef)(null),i=Un(t,r),o=(0,We.useRef)(!1);return(0,We.useEffect)(()=>{let a=r.current;if(a)return cD(a)},[]),(0,We.createElement)(Rw,{as:Ds,allowPinchZoom:!0},(0,We.createElement)(LD,ze({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gn(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),o.current||(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:gn(e.onPointerDownOutside,a=>{let s=a.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,c=s.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:gn(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})))}),rQ=(0,We.forwardRef)((e,t)=>{let n=Bd(Am,e.__scopePopover),r=(0,We.useRef)(!1);return(0,We.createElement)(LD,ze({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o;if((o=e.onCloseAutoFocus)===null||o===void 0||o.call(e,i),!i.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),i.preventDefault()}r.current=!1},onInteractOutside:i=>{var o,a;(o=e.onInteractOutside)===null||o===void 0||o.call(e,i),i.defaultPrevented||(r.current=!0);let s=i.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(s))&&i.preventDefault()}}))}),LD=(0,We.forwardRef)((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=e,h=Bd(Am,n),m=ng(n);return EP(),(0,We.createElement)(wP,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o},(0,We.createElement)(mP,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1)},(0,We.createElement)(rD,ze({"data-state":RD(h.open),role:"dialog",id:h.contentId},m,u,{ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))});var iQ=(0,We.forwardRef)((e,t)=>{let{__scopePopover:n,...r}=e,i=ng(n);return(0,We.createElement)(iD,ze({},i,r,{ref:t}))});function RD(e){return e?"open":"closed"}var rg=Xq;var ig=qq,OD=eQ,og=tQ;var ND=iQ;var Nz=L(q(),1),Bn=L(j(),1),vl=L(q(),1),Fz=L(jo(),1),Bz=L(j(),1),al=L(q(),1);var xr=L(j(),1),be=L(j(),1),Qz=L(q(),1),Jz=L(j(),1),Mc=L(j(),1),iH=L(j(),1),oH=L(q(),1),cf=L(j(),1),hu=L(j(),1);var hf=L(j(),1),Rr=L(j(),1),R4=L(j(),1),gc=L(j(),1),gH=L(q(),1);var O4=L(j(),1);var or=L(j(),1),Ec=L(j(),1),$4=L(j(),1),Mo=L(q(),1);var Ya=L(j(),1),NH=L(j(),1),Qb=L(q(),1),zH=L(q(),1);var HH=L(j(),1),GH=L(jo(),1);var WH=L(q(),1),Ef=L(j(),1);var Jb=L(q(),1);var nh=L(q(),1),G4=L(q(),1);var W4=L(j(),1),ZH=L(j(),1);var ty=L(j(),1),gp=L(q(),1);var Ic=L(j(),1);var rh=L(j(),1),oi=L(q(),1);var fe=L(j(),1);var eG=L(j(),1),ry=L(q(),1),pl=L(j(),1),L2=L(j(),1),iG=L(j(),1),iy=L(j(),1);var oy=L(q(),1),Ep=L(j(),1),U4=L(j(),1),cG=L(j(),1),bp=L(q(),1),ay=L(j(),1),Ou=L(q(),1);var bn=L(j(),1);var kl=L(q(),1),kc=L(j(),1),ly=L(q(),1),fh=L(q(),1),Ac=L(j(),1),gG=L(q(),1);var EG=L(Nw(),1),lr=L(q(),1),Gt=L(j(),1),ai=L(q(),1);var ki=L(j(),1);var uy=L(q(),1);var qs=L(j(),1);var wG=L(j(),1),da=L(q(),1);var Oc=L(j(),1),TG=L(j(),1),O2=L(q(),1);S();var _m=L(q());S();S();var GD=e=>{let t,n=new Set,r=(l,c)=>{let d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){let u=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,u))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(N?N.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(r,i,s),s},WD=e=>e?GD(e):GD;var e9=L(q(),1),t9=L(qD(),1),{useDebugValue:BQ}=e9.default,{useSyncExternalStoreWithSelector:zQ}=t9.default,QD=!1;function HQ(e,t=e.getState,n){(N?N.MODE:void 0)!=="production"&&n&&!QD&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),QD=!0);let r=zQ(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return BQ(r),r}var JD=e=>{(N?N.MODE:void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t=typeof e=="function"?WD(e):e,n=(r,i)=>HQ(t,r,i);return Object.assign(n,t),n},n9=e=>e?JD(e):JD;var r9,i9,o9=typeof window<"u"&&((r9=window.document)!=null&&r9.createElement||((i9=window.navigator)==null?void 0:i9.product)==="ReactNative")?_m.default.useLayoutEffect:_m.default.useEffect;function oo(){let e=n9(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{let n=e(i=>i.set),r=e(i=>i.version);return o9(()=>{n(i=>({version:i.version+1}))},[]),o9(()=>(n(({current:i})=>({current:[...i,t]})),()=>n(({current:i})=>({current:i.filter(o=>o!==t)}))),[t,r]),null},Out:()=>{let t=e(n=>n.current);return _m.default.createElement(_m.default.Fragment,null,t)}}}var IG=L(q(),1);var Ee=L(j(),1),DG=L(q(),1);var my=L(j(),1),Oi=L(q(),1);var NG=L(l9(),1);var _t=L(j(),1),tS=L(j(),1),GG=L(j(),1);var WG=L(q(),1),Ba=L(j(),1),fy=L(q(),1),$u=L(j(),1);var vf=L(j(),1);var aS=L(j(),1),gy=L(q(),1);var Fu=L(j(),1),Qr=L(q(),1),Ze=L(j(),1);var ZG=L(j(),1),sS=L(j(),1);var xf=L(j(),1),Vc=L(j(),1);var wf=L(j(),1),Ae=L(j(),1);var nW=L(j(),1),N2=L(j(),1),it=L(j(),1),Al=L(q(),1),Qs=L(j(),1),sW=L(q(),1),J=L(j(),1),Js=L(q(),1);var Yn=L(j(),1);var dW=L(j(),1),uW=L(q(),1),An=L(j(),1),mW=L(j(),1);var yr=L(j(),1),gW=L(q(),1);var bW=L(q(),1),$c=L(j(),1);var Fc=L(j(),1);S();var $n=L(q());S();var Rt=L(q());S();var ao=L(q());function c9(e){let t=e+"CollectionProvider",[n,r]=Uo(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=m=>{let{scope:p,children:f}=m,g=ao.default.useRef(null),b=ao.default.useRef(new Map).current;return ao.default.createElement(i,{scope:p,itemMap:b,collectionRef:g},f)},s=e+"CollectionSlot",l=ao.default.forwardRef((m,p)=>{let{scope:f,children:g}=m,b=o(s,f),v=Un(p,b.collectionRef);return ao.default.createElement(Ds,{ref:v},g)}),c=e+"CollectionItemSlot",d="data-radix-collection-item",u=ao.default.forwardRef((m,p)=>{let{scope:f,children:g,...b}=m,v=ao.default.useRef(null),y=Un(p,v),w=o(c,f);return ao.default.useEffect(()=>(w.itemMap.set(v,{ref:v,...b}),()=>void w.itemMap.delete(v))),ao.default.createElement(Ds,{[d]:"",ref:y},g)});function h(m){let p=o(e+"CollectionConsumer",m);return ao.default.useCallback(()=>{let g=p.collectionRef.current;if(!g)return[];let b=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((w,T)=>b.indexOf(w.ref.current)-b.indexOf(T.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:a,Slot:l,ItemSlot:u},h,r]}S();var Pm=L(q()),GQ=(0,Pm.createContext)(void 0);function lg(e){let t=(0,Pm.useContext)(GQ);return e||t||"ltr"}var Fw="rovingFocusGroup.onEntryFocus",WQ={bubbles:!1,cancelable:!0},zw="RovingFocusGroup",[Bw,d9,jQ]=c9(zw),[UQ,Hw]=Uo(zw,[jQ]),[VQ,YQ]=UQ(zw),ZQ=(0,Rt.forwardRef)((e,t)=>(0,Rt.createElement)(Bw.Provider,{scope:e.__scopeRovingFocusGroup},(0,Rt.createElement)(Bw.Slot,{scope:e.__scopeRovingFocusGroup},(0,Rt.createElement)(XQ,ze({},e,{ref:t}))))),XQ=(0,Rt.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,...d}=e,u=(0,Rt.useRef)(null),h=Un(t,u),m=lg(o),[p=null,f]=Od({prop:a,defaultProp:s,onChange:l}),[g,b]=(0,Rt.useState)(!1),v=fr(c),y=d9(n),w=(0,Rt.useRef)(!1),[T,k]=(0,Rt.useState)(0);return(0,Rt.useEffect)(()=>{let M=u.current;if(M)return M.addEventListener(Fw,v),()=>M.removeEventListener(Fw,v)},[v]),(0,Rt.createElement)(VQ,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:p,onItemFocus:(0,Rt.useCallback)(M=>f(M),[f]),onItemShiftTab:(0,Rt.useCallback)(()=>b(!0),[]),onFocusableItemAdd:(0,Rt.useCallback)(()=>k(M=>M+1),[]),onFocusableItemRemove:(0,Rt.useCallback)(()=>k(M=>M-1),[])},(0,Rt.createElement)(Qt.div,ze({tabIndex:g||T===0?-1:0,"data-orientation":r},d,{ref:h,style:{outline:"none",...e.style},onMouseDown:gn(e.onMouseDown,()=>{w.current=!0}),onFocus:gn(e.onFocus,M=>{let C=!w.current;if(M.target===M.currentTarget&&C&&!g){let P=new CustomEvent(Fw,WQ);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){let R=y().filter(H=>H.focusable),A=R.find(H=>H.active),_=R.find(H=>H.id===p),W=[A,_,...R].filter(Boolean).map(H=>H.ref.current);u9(W)}}w.current=!1}),onBlur:gn(e.onBlur,()=>b(!1))})))}),KQ="RovingFocusGroupItem",qQ=(0,Rt.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...a}=e,s=Pd(),l=o||s,c=YQ(KQ,n),d=c.currentTabStopId===l,u=d9(n),{onFocusableItemAdd:h,onFocusableItemRemove:m}=c;return(0,Rt.useEffect)(()=>{if(r)return h(),()=>m()},[r,h,m]),(0,Rt.createElement)(Bw.ItemSlot,{scope:n,id:l,focusable:r,active:i},(0,Rt.createElement)(Qt.span,ze({tabIndex:d?0:-1,"data-orientation":c.orientation},a,{ref:t,onMouseDown:gn(e.onMouseDown,p=>{r?c.onItemFocus(l):p.preventDefault()}),onFocus:gn(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:gn(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){c.onItemShiftTab();return}if(p.target!==p.currentTarget)return;let f=eJ(p,c.orientation,c.dir);if(f!==void 0){p.preventDefault();let b=u().filter(v=>v.focusable).map(v=>v.ref.current);if(f==="last")b.reverse();else if(f==="prev"||f==="next"){f==="prev"&&b.reverse();let v=b.indexOf(p.currentTarget);b=c.loop?tJ(b,v+1):b.slice(v+1)}setTimeout(()=>u9(b))}})})))}),QQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JQ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function eJ(e,t,n){let r=JQ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return QQ[r]}function u9(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function tJ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var h9=ZQ,m9=qQ;var p9="Tabs",[nJ,iEe]=Uo(p9,[Hw]),f9=Hw(),[rJ,Gw]=nJ(p9),iJ=(0,$n.forwardRef)((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:a="horizontal",dir:s,activationMode:l="automatic",...c}=e,d=lg(s),[u,h]=Od({prop:r,onChange:i,defaultProp:o});return(0,$n.createElement)(rJ,{scope:n,baseId:Pd(),value:u,onValueChange:h,orientation:a,dir:d,activationMode:l},(0,$n.createElement)(Qt.div,ze({dir:d,"data-orientation":a},c,{ref:t})))}),oJ="TabsList",aJ=(0,$n.forwardRef)((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,o=Gw(oJ,n),a=f9(n);return(0,$n.createElement)(h9,ze({asChild:!0},a,{orientation:o.orientation,dir:o.dir,loop:r}),(0,$n.createElement)(Qt.div,ze({role:"tablist","aria-orientation":o.orientation},i,{ref:t})))}),sJ="TabsTrigger",lJ=(0,$n.forwardRef)((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,a=Gw(sJ,n),s=f9(n),l=g9(a.baseId,r),c=E9(a.baseId,r),d=r===a.value;return(0,$n.createElement)(m9,ze({asChild:!0},s,{focusable:!i,active:d}),(0,$n.createElement)(Qt.button,ze({type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l},o,{ref:t,onMouseDown:gn(e.onMouseDown,u=>{!i&&u.button===0&&u.ctrlKey===!1?a.onValueChange(r):u.preventDefault()}),onKeyDown:gn(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&a.onValueChange(r)}),onFocus:gn(e.onFocus,()=>{let u=a.activationMode!=="manual";!d&&!i&&u&&a.onValueChange(r)})})))}),cJ="TabsContent",dJ=(0,$n.forwardRef)((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:o,...a}=e,s=Gw(cJ,n),l=g9(s.baseId,r),c=E9(s.baseId,r),d=r===s.value,u=(0,$n.useRef)(d);return(0,$n.useEffect)(()=>{let h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),(0,$n.createElement)(Rd,{present:i||d},({present:h})=>(0,$n.createElement)(Qt.div,ze({"data-state":d?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0},a,{ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0}}),h&&o))});function g9(e,t){return`${e}-trigger-${t}`}function E9(e,t){return`${e}-content-${t}`}var cg=iJ,dg=aJ,ug=lJ,hg=dJ;var yW=L(j(),1);var mS=L(j(),1);var vW=L(j(),1);var xW=L(j(),1),wn=L(q(),1);var ES=L(j(),1),wW=L(q(),1);var os=L(j(),1);var Vt=L(j(),1);var yy=L(q(),1),MW=L(j(),1),Ja=L(j(),1),za=L(j(),1);var Ai=L(j(),1);var _i=L(j(),1),kW=L(q(),1);var Sf=L(j(),1),PW=L(j(),1);var PS=L(q(),1),DW=L(j(),1);var RW=L(j(),1),DS=L(q(),1),dn=L(j(),1),FW=L(j(),1);var ta=L(j(),1),Mf=L(q(),1),HW=L(j(),1),sl=L(j(),1),If=L(j(),1),Io=L(q(),1),ar=L(j(),1);var VW=L(j(),1);var RS=L(j(),1),vo=L(q(),1);var Ht=L(j(),1);var XW=L(q(),1);var se=L(j(),1),Eh=L(q(),1),kf=L(j(),1),rr=L(j(),1),$S=L(jo(),1),dj=L(q(),1);var bh=L(q(),1),pj=L(j(),1),Yc=L(q(),1),gj=L(j(),1),xy=L(q(),1),zS=L(j(),1),yj=L(j(),1);var Af=L(j(),1),Bc=L(j(),1);S();function uJ(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var hJ={};uJ(hJ,"LaserPointer",()=>Lm);function Jt([e,t,n],[r,i,o]){return[e+r,t+i,n+o]}function Dm([e,t,n],[r,i,o]){return[e-r,t-i,n-o]}function En([e,t,n],r){return[e*r,t*r,n*r]}function Hd([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function tr([e,t,n],r){return[Math.cos(r)*e-Math.sin(r)*t,Math.sin(r)*e+Math.cos(r)*t,n]}function mJ(e,t,n){return Jt(e,En(Dm(t,e),n))}function b9(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 y9(e){return Math.atan2(Math.sin(e),Math.cos(e))}function v9([e,t]){return Math.sqrt(e**2+t**2)}function Gd([e,t],[n,r]){return Math.sqrt((n-e)**2+(r-t)**2)}function pJ(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=Gd(e[n-1],e[n]);return t+=Gd(e[e.length-2],e[e.length-1]),t}var fJ=(e,t,n)=>Math.max(t,Math.min(n,e));function gJ(e,t,n){let r=Gd(t,n);if(r===0)return Gd(e,t);let i=fJ(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r**2,0,1),o=[t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]];return Gd(o,e)}function mg(e,t){if(t===0||e.length<=2)return e;let n=e[0],r=e[e.length-1],[i,o]=e.reduce(([a,s],l,c)=>{let d=gJ(l,n,r);return d>a?[d,c]:[a,s]},[0,-1]);if(i>=t){let a=e[o];return[...mg([n,...e.slice(1,o),a],t).slice(0,-1),a,...mg([a,...e.slice(o,-1),r],t).slice(1)]}else return[n,r]}var Lm=class e{static{this.defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:"output",keepHead:!1,sizeMapping:()=>1}}static{this.constants={cornerDetectionMaxAngle:75,cornerDetectionVariance:t=>t>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=mJ(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),pJ(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase=="tail")throw new Error("Not implemented yet");this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(t,n,r,i,o){return(t??this.options.size)*this.options.sizeMapping({pressure:n,runningLength:o,currentIndex:r,totalLength:i})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase==="input"&&(n=mg(n,this.options.simplify));let r=n.length;if(r===0)return[];if(r===1){let M=n[0],C=this.getSize(t,M[2],0,r,0);if(C<.5)return[];let P=[];for(let R=0;R<=Math.PI*2;R+=Math.PI/16)P.push(Jt(M,En(tr([1,0,0],R),C)));return P.push(Jt(M,En([1,0,0],this.getSize(t,M[2],0,r,0)))),P}if(r===2){let M=n[0],C=n[1],P=this.getSize(t,M[2],0,r,0),R=this.getSize(t,C[2],0,r,0);if(P<.5||R<.5)return[];let A=[],_=b9(M,[M[0],M[1]-100,M[2]],C);for(let $=_;$<=Math.PI+_;$+=Math.PI/16)A.push(Jt(M,En(tr([1,0,0],$),P)));for(let $=Math.PI+_;$<=Math.PI*2+_;$+=Math.PI/16)A.push(Jt(C,En(tr([1,0,0],$),R)));return A.push(A[0]),A}let i=[],o=[],a=0,s=0,l=0,c=0;for(let M=1;M<r-1;M++){let C=n[M-1],P=n[M],R=n[M+1],A=P[2],_=Gd(C,P);c+=_,a=s+(_-s)*.2;let $=this.getSize(t,A,M,r,c);if($===0){l=M+1;continue}let W=Hd(Dm(C,P)),H=Hd(Dm(R,P)),K=tr(W,Math.PI/2),Q=tr(W,-Math.PI/2),ie=tr(H,Math.PI/2),X=tr(H,-Math.PI/2),F=Jt(P,En(K,$)),B=Jt(P,En(Q,$)),U=Jt(P,En(ie,$)),G=Jt(P,En(X,$)),Z=Jt(K,X),ee=Jt(Q,ie),te=Jt(P,En(v9(Z)===0?W:Hd(Z),$)),de=Jt(P,En(v9(ee)===0?H:Hd(ee),$)),qe=y9(b9(P,C,R)),Ye=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(a);if(Math.abs(qe)<Ye){let Me=Math.abs(y9(Math.PI-qe));if(Me===0)continue;if(qe<0){o.push(B,de);for(let Be=0;Be<=Me;Be+=Me/4)i.push(Jt(P,tr(En(K,$),Be)));for(let Be=Me;Be>=0;Be-=Me/4)o.push(Jt(P,tr(En(K,$),Be)));o.push(de,U)}else{i.push(F,te);for(let Be=0;Be<=Me;Be+=Me/4)o.push(Jt(P,tr(En(K,-$),-Be)));for(let Be=Me;Be>=0;Be-=Me/4)i.push(Jt(P,tr(En(K,-$),-Be)));i.push(te,G)}}else i.push(te),o.push(de);s=a}if(l>=r-2)if(this.options.keepHead){let M=n[r-1],C=[];for(let P=0;P<=Math.PI*2;P+=Math.PI/16)C.push(Jt(M,En(tr([1,0,0],P),this.options.size)));return C.push(Jt(M,En([1,0,0],this.options.size))),C}else return[];let d=n[l],u=n[l+1],h=n[r-2],m=n[r-1],p=Hd(Dm(u,d)),f=Hd(Dm(h,m)),g=tr(p,-Math.PI/2),b=tr(f,Math.PI/2),v=this.getSize(t,d[2],0,r,0),y=[],w=this.options.keepHead?this.options.size:this.getSize(t,h[2],r-2,r,c),T=[];if(v>1){for(let M=0;M<=Math.PI;M+=Math.PI/16)y.unshift(Jt(d,tr(En(g,v),-M)));y.unshift(Jt(d,En(g,-v)))}else y.push(d);for(let M=0;M<=Math.PI*3;M+=Math.PI/16)T.push(Jt(m,tr(En(b,-w),-M)));let k=[...y,...i,...T.reverse(),...o.reverse()];return y.length>0&&k.push(y[0]),this.options.simplify>0&&this.options.simplifyPhase==="output"?mg(k,this.options.simplify):k}};var vn=L(q(),1),H2=L(jo(),1);var Mj=L(Nw(),1),je=L(j(),1);var GS=L(j(),1),Pi=L(j(),1),kt=L(j(),1),ho=L(j(),1),fo=L(j(),1);var Sy=L(j(),1),_f=L(j(),1),Ty=L(q(),1);var G2=L(j(),1),EJ=Object.defineProperty,bJ=e=>t=>{var n=e[t];if(n)return n();throw new Error("Module not found in bundle: "+t)},I=(e,t)=>()=>(e&&(t=e(e=0)),t),Pf=(e,t)=>{for(var n in t)EJ(e,n,{get:t[n],enumerable:!0})},Pt,D=I(()=>{Pt={NODE_ENV:"production",VITE_APP_BACKEND_V2_GET_URL:"https://json.excalidraw.com/api/v2/",VITE_APP_BACKEND_V2_POST_URL:"https://json.excalidraw.com/api/v2/post/",VITE_APP_LIBRARY_URL:"https://libraries.excalidraw.com",VITE_APP_LIBRARY_BACKEND:"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries",VITE_APP_PLUS_LP:"https://plus.excalidraw.com",VITE_APP_PLUS_APP:"https://app.excalidraw.com",VITE_APP_AI_BACKEND:"https://oss-ai.excalidraw.com",VITE_APP_WS_SERVER_URL:"https://oss-collab.excalidraw.com",VITE_APP_FIREBASE_CONFIG:'{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}',VITE_APP_DISABLE_TRACKING:"",VITE_PKG_NAME:"@excalidraw/excalidraw",VITE_PKG_VERSION:"0.5.0-ca754ef",VITE_IS_EXCALIDRAW_NPM_PACKAGE:!0,PROD:!0}}),Gn,xo,Ln=I(()=>{"use strict";D(),Gn=Symbol(),xo=J_()}),i$,yJ=I(()=>{i$=bJ({"./locales/ar-SA.json":()=>import("./ar-SA-JA6F2FMJ-MVAFRXH2.js"),"./locales/az-AZ.json":()=>import("./az-AZ-GVIENQVH-DULWV7IG.js"),"./locales/bg-BG.json":()=>import("./bg-BG-YFNNHCEP-TOMMDX7A.js"),"./locales/bn-BD.json":()=>import("./bn-BD-LMEIWSRD-U6EPN6XJ.js"),"./locales/ca-ES.json":()=>import("./ca-ES-C2WGCLOT-4Q2376G3.js"),"./locales/cs-CZ.json":()=>import("./cs-CZ-F2NDIQMB-4NMYRMO2.js"),"./locales/da-DK.json":()=>import("./da-DK-WBEQB3CJ-6YAF4DNI.js"),"./locales/de-DE.json":()=>import("./de-DE-VEIMCP7R-NSRLPHDI.js"),"./locales/el-GR.json":()=>import("./el-GR-TKRKG5GQ-6N4GY2DI.js"),"./locales/en.json":()=>import("./en-R7FEFJGC-UHMLUFK3.js"),"./locales/es-ES.json":()=>import("./es-ES-TOLWEZNW-ODY4LX7F.js"),"./locales/eu-ES.json":()=>import("./eu-ES-7CDRJQWJ-KF3KSB2X.js"),"./locales/fa-IR.json":()=>import("./fa-IR-527E2XGU-WLLGMWYR.js"),"./locales/fi-FI.json":()=>import("./fi-FI-NLQ7RQGZ-EZLGQEWF.js"),"./locales/fr-FR.json":()=>import("./fr-FR-KUHO4FLU-2OW7FE5V.js"),"./locales/gl-ES.json":()=>import("./gl-ES-NEXX3VBB-TESFDR6O.js"),"./locales/he-IL.json":()=>import("./he-IL-MED2VGBZ-N4VYRCHF.js"),"./locales/hi-IN.json":()=>import("./hi-IN-5V633W7V-4VXVQ6GE.js"),"./locales/hu-HU.json":()=>import("./hu-HU-2FOZGVGR-7CHHZRPD.js"),"./locales/id-ID.json":()=>import("./id-ID-I6BOLXTF-ULJRGCTU.js"),"./locales/it-IT.json":()=>import("./it-IT-WKPQOK4P-C3FTW2QG.js"),"./locales/ja-JP.json":()=>import("./ja-JP-VKA4ISRU-EBXFDMUP.js"),"./locales/kaa.json":()=>import("./kaa-IKPRSBNY-URJPWZZH.js"),"./locales/kab-KAB.json":()=>import("./kab-KAB-IE4PHQTZ-OMISFOMM.js"),"./locales/kk-KZ.json":()=>import("./kk-KZ-MNJT6XSV-56OVE4EH.js"),"./locales/km-KH.json":()=>import("./km-KH-LADGDFXV-KI7V2Z5A.js"),"./locales/ko-KR.json":()=>import("./ko-KR-XD7AVF2F-EFYGITKM.js"),"./locales/ku-TR.json":()=>import("./ku-TR-4XBHKDQA-U25XLPMW.js"),"./locales/lt-LT.json":()=>import("./lt-LT-QC35R4YH-6TDSRONI.js"),"./locales/lv-LV.json":()=>import("./lv-LV-GSD5D3BA-KMXM2FQ7.js"),"./locales/mr-IN.json":()=>import("./mr-IN-KOLSWM7Y-NVYC6JCO.js"),"./locales/my-MM.json":()=>import("./my-MM-M53KMUET-A2ORJJ2D.js"),"./locales/nb-NO.json":()=>import("./nb-NO-XXC6U37A-L4O4DGCC.js"),"./locales/nl-NL.json":()=>import("./nl-NL-HCCJQEUO-7Q2LV5NM.js"),"./locales/nn-NO.json":()=>import("./nn-NO-6P7Z2PI2-TUT2PFEE.js"),"./locales/oc-FR.json":()=>import("./oc-FR-JRJKPLNT-SBQHJH7X.js"),"./locales/pa-IN.json":()=>import("./pa-IN-LZWLEPIB-7NKOXI65.js"),"./locales/percentages.json":()=>import("./percentages-UCQDHIQF-Q4IM6ZEB.js"),"./locales/pl-PL.json":()=>import("./pl-PL-3WBLCXI2-E2SMTIVM.js"),"./locales/pt-BR.json":()=>import("./pt-BR-O3ZPTUNW-RS7M7EKX.js"),"./locales/pt-PT.json":()=>import("./pt-PT-7AQTSAFO-AEANJ2UN.js"),"./locales/ro-RO.json":()=>import("./ro-RO-HJ65JYWV-35XNZ4QJ.js"),"./locales/ru-RU.json":()=>import("./ru-RU-P7ROIYNC-ERPG3GJT.js"),"./locales/si-LK.json":()=>import("./si-LK-7ZSWVION-YHKN25MU.js"),"./locales/sk-SK.json":()=>import("./sk-SK-NXVBGLYY-IKQZT26E.js"),"./locales/sl-SI.json":()=>import("./sl-SI-VFTWOYNP-UPLNMI3E.js"),"./locales/sv-SE.json":()=>import("./sv-SE-YONBLQNW-ZG4TE7PV.js"),"./locales/ta-IN.json":()=>import("./ta-IN-BSETPMLX-FC54FMQJ.js"),"./locales/th-TH.json":()=>import("./th-TH-URTRDITB-K6QQ2PRO.js"),"./locales/tr-TR.json":()=>import("./tr-TR-N5SCAVTB-HMUEG6DN.js"),"./locales/uk-UA.json":()=>import("./uk-UA-LBCYVSQZ-DEJZCNRZ.js"),"./locales/vi-VN.json":()=>import("./vi-VN-POZWLIUU-EY6QFLQV.js"),"./locales/zh-CN.json":()=>import("./zh-CN-FUF5V3SC-5UIL2T3T.js"),"./locales/zh-HK.json":()=>import("./zh-HK-OB4VW42C-3ID2CCZJ.js"),"./locales/zh-TW.json":()=>import("./zh-TW-5JPVKOM7-VUPJBABS.js")})}),x9,yc,W2,Rm,sc,Om,WS,sh,Ww,x,jw,ir,ce=I(()=>{"use strict";D(),Ln(),yJ(),x9=85,yc={code:"en",label:"English"},W2=[yc,...[{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",rtl:!0},{code:"bg-BG",label:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"},{code:"ca-ES",label:"Catal\xE0"},{code:"cs-CZ",label:"\u010Cesky"},{code:"de-DE",label:"Deutsch"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},{code:"es-ES",label:"Espa\xF1ol"},{code:"eu-ES",label:"Euskara"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",rtl:!0},{code:"fi-FI",label:"Suomi"},{code:"fr-FR",label:"Fran\xE7ais"},{code:"gl-ES",label:"Galego"},{code:"he-IL",label:"\u05E2\u05D1\u05E8\u05D9\u05EA",rtl:!0},{code:"hi-IN",label:"\u0939\u093F\u0928\u094D\u0926\u0940"},{code:"hu-HU",label:"Magyar"},{code:"id-ID",label:"Bahasa Indonesia"},{code:"it-IT",label:"Italiano"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E"},{code:"kab-KAB",label:"Taqbaylit"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4"},{code:"ku-TR",label:"Kurd\xEE"},{code:"lt-LT",label:"Lietuvi\u0173"},{code:"lv-LV",label:"Latvie\u0161u"},{code:"my-MM",label:"Burmese"},{code:"nb-NO",label:"Norsk bokm\xE5l"},{code:"nl-NL",label:"Nederlands"},{code:"nn-NO",label:"Norsk nynorsk"},{code:"oc-FR",label:"Occitan"},{code:"pa-IN",label:"\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40"},{code:"pl-PL",label:"Polski"},{code:"pt-BR",label:"Portugu\xEAs Brasileiro"},{code:"pt-PT",label:"Portugu\xEAs"},{code:"ro-RO",label:"Rom\xE2n\u0103"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"sk-SK",label:"Sloven\u010Dina"},{code:"sv-SE",label:"Svenska"},{code:"sl-SI",label:"Sloven\u0161\u010Dina"},{code:"tr-TR",label:"T\xFCrk\xE7e"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"},{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t"},{code:"mr-IN",label:"\u092E\u0930\u093E\u0920\u0940"}].filter(e=>KI[e.code]>=x9).sort((e,t)=>e.label>t.label?1:-1)],Rm="__test__",Pt.DEV&&W2.unshift({code:Rm,label:"test language"},{code:`${Rm}.rtl`,label:"\u202Atest language (rtl)\u202C",rtl:!0}),sc=yc,Om={},WS=async e=>{if(sc=e,document.documentElement.dir=sc.rtl?"rtl":"ltr",document.documentElement.lang=sc.code,e.code.startsWith(Rm))Om={};else try{Om=await i$(`./locales/${sc.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),Om=Dy}xo.set(jw,e.code)},sh=()=>sc,Ww=(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},x=(e,t,n)=>{if(sc.code.startsWith(Rm))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let r=e.split("."),i=Ww(Om,r)||Ww(Dy,r)||n;if(i===void 0){let o=`Can't find translation for ${e}`;if(Pt.PROD)return console.warn(o),"";throw new Error(o)}if(t)for(let o in t)i=i.replace(`{{${o}}}`,String(t[o]));return i},jw=At(yc.code),ir=()=>{let e=vm(jw,Gn);return{t:x,langCode:e}}}),vJ=I(()=>{}),w9,oa,wl=I(()=>{"use strict";D(),vJ(),w9=({size:e="1em",circleWidth:t=8,synchronized:n=!1})=>{let r=-(o$.default.useRef(Date.now()).current%1600);return(0,c2.jsx)("div",{className:"Spinner",children:(0,c2.jsx)("svg",{viewBox:"0 0 100 100",style:{width:e,height:e,"--spinner-delay":n?`${r}ms`:0},children:(0,c2.jsx)("circle",{cx:"50",cy:"50",r:50-t/2,strokeWidth:t,fill:"none",strokeMiterlimit:"10"})})})},oa=w9}),go,jS,xJ,Bu,S9,wJ,a$,s$,j2,U2,Us,vp,l$,y5,c$,Xa,d$,ut,zs,hc,tp,v5,US,zn,$e,Zt,x5,d2,Ni,aa,Df,Fp,xu,VS,Li,zu,V2,u$,_c,Y2,h$,ve,u2,ei,Z2,m$,p$,f$,g$,pu,YS,E$,lb,h2,m2,w5,b$,y$,v$,x$,w$,au,cb,lh,S$,S5,It,Bp,yn,T$,C$,Nr,Hu,M$,p2,I$,Pn,f2,T5,g2,Yt,X2,es,ZS,_n,ts,XS,ae=I(()=>{"use strict";D(),go=/Mac|iPod|iPhone|iPad/.test(navigator.platform),jS=/^Win/.test(navigator.platform),xJ=/\b(android)\b/i.test(navigator.userAgent),Bu="netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,S9=navigator.userAgent.indexOf("Chrome")!==-1,wJ=!S9&&navigator.userAgent.indexOf("Safari")!==-1,a$=/iPad|iPhone/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,s$=()=>navigator.brave?.isBrave?.name==="isBrave",j2=typeof window<"u"&&"ResizeObserver"in window,U2="Excalidraw",Us=10,vp=8,l$=5,y5=1,c$=30,Xa=Math.PI/12,d$="red",ut={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},zs={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},hc={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"},tp={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},v5={TEST:"test"},US={SHAPE_ACTIONS_MENU:"App-menu__left"},zn={Virgil:1,Helvetica:2,Cascadia:3,Assistant:4},$e={LIGHT:"light",DARK:"dark"},Zt={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},x5="Segoe UI Emoji",d2=1,Ni=20,aa=zn.Virgil,Df="left",Fp="top",xu=2,VS=1,Li="#ffffff",zu="#1e1e1e",V2="transparent",u$="#a2f1a6",_c=20,Y2={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},h$=["text/plain","text/html"],ve={json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawlib:"application/vnd.excalidrawlib+json","excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...Y2},u2={png:"png",svg:"svg",clipboard:"clipboard"},ei={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},Z2=window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,m$=500,p$=300,f$=500,g$=100,pu=.1,YS=.1,E$=300,lb="invert(93%) hue-rotate(180deg)",h2={addLibrary:"addLibrary"},m2={addLibrary:"addLibrary"},w5={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0},tools:{image:!0}},b$=800,y$=1e3,v$=500,x$=1229,w$=302,au=2,cb=[1,2,3],lh=10,S$=1440,S5=2*1024*1024,It="http://www.w3.org/2000/svg",Bp={excalidraw:2,excalidrawLibrary:2},yn=5,T$=.7,C$=11,Nr={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},Hu={LEFT:"left",CENTER:"center",RIGHT:"right"},M$=20,p2=.25,I$=32,Pn={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},f2="__precedingElement__",T5={architect:0,artist:1,cartoonist:2},g2={thin:1,bold:2,extraBold:4},Yt={strokeColor:zu,backgroundColor:V2,fillStyle:"solid",strokeWidth:2,strokeStyle:"solid",roughness:T5.artist,opacity:100,locked:!1},X2="library",es={name:"default",defaultTab:X2},ZS=new Set(["iframe","embeddable","image"]),_n={selection:"selection",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",arrow:"arrow",line:"line",freedraw:"freedraw",text:"text",image:"image",eraser:"eraser",hand:"hand",frame:"frame",magicframe:"magicframe",embeddable:"embeddable",laser:"laser"},ts={OAI_API_KEY:"excalidraw-oai-api-key",MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},XS="Untitled"}),KS,k$=I(()=>{"use strict";D(),ce(),wl(),ae(),KS=({delay:e,theme:t})=>{let[n,r]=(0,db.useState)(!!e);return(0,db.useEffect)(()=>{if(!e)return;let i=setTimeout(()=>{r(!1)},e);return()=>clearTimeout(i)},[e]),n?null:(0,wu.jsxs)("div",{className:Y("LoadingMessage",{"LoadingMessage--dark":t===$e.DARK}),children:[(0,wu.jsx)("div",{children:(0,wu.jsx)(oa,{})}),(0,wu.jsx)("div",{className:"LoadingMessage-text",children:x("labels.loadingScene")})]})}}),_$,SJ=I(()=>{"use strict";D(),k$(),ce(),_$=e=>{let[t,n]=(0,ub.useState)(!0);return(0,ub.useEffect)(()=>{let r=async()=>{await WS(i),n(!1)},i=W2.find(o=>o.code===e.langCode)||yc;r()},[e.langCode]),t?(0,A$.jsx)(KS,{theme:e.theme}):e.children}});function en(e,t,n,r){return e?(e?.addEventListener?.(t,n,r),()=>{e?.removeEventListener?.(t,n,r)}):()=>{}}function TJ(e,t=!0){let n=e.length;if(n<4)return"";let r=e[0],i=e[1],o=e[2],a=`M${r[0].toFixed(2)},${r[1].toFixed(2)} Q${i[0].toFixed(2)},${i[1].toFixed(2)} ${rp(i[0],o[0]).toFixed(2)},${rp(i[1],o[1]).toFixed(2)} T`;for(let s=2,l=n-1;s<l;s++)r=e[s],i=e[s+1],a+=`${rp(r[0],i[0]).toFixed(2)},${rp(r[1],i[1]).toFixed(2)} `;return t&&(a+="Z"),a}var Uw,C5,Pc,P$,M5,D$,Ha,zp,xn,Hp,hb,ll,Vw,L$,R$,Zn,nn,V,Ot,Ri,np,T9,C9,M9,qS,Ka,QS,I5,k5,mo,JS,O$,N$,$$,F$,Dc,Fe,B$,fl,z$,eT,xp,H$,ch,K2,Yw,$r,Lf,Su,G$,q2,zc,A5,E2,rp,tT,cl,Q2,W$,ne=I(()=>{"use strict";D(),ae(),Uw=null,C5=()=>{if(Uw)return Uw;let e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0"),i=`${e.getHours()}`.padStart(2,"0"),o=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}-${i}${o}`},Pc=e=>e.charAt(0).toUpperCase()+e.slice(1),P$=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),M5=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,D$=e=>M5(e)||e instanceof Element&&!!e.closest("label, button"),Ha=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"),zp=({fontFamily:e})=>{for(let[t,n]of Object.entries(zn))if(n===e)return`${t}, ${x5}`;return x5},xn=({fontSize:e,fontFamily:t})=>`${e}px ${zp({fontFamily:t})}`,Hp=(e,t)=>{let n=0,r=null,i=(...o)=>{r=o,clearTimeout(n),n=window.setTimeout(()=>{r=null,e(...o)},t)};return i.flush=()=>{if(clearTimeout(n),r){let o=r;r=null,e(...o)}},i.cancel=()=>{r=null,clearTimeout(n)},i},hb=(e,t)=>{let n=null,r=null,i=null,o=s=>{n=window.requestAnimationFrame(()=>{n=null,e(...s),r=null,i&&(r=i,i=null,o(r))})},a=(...s)=>{if(Pt.MODE==="test"){e(...s);return}r=s,n===null?o(r):t?.trailing&&(i=s)};return a.flush=()=>{n!==null&&(cancelAnimationFrame(n),n=null),r&&(e(...i||r),r=i=null)},a.cancel=()=>{r=i=null,n!==null&&(cancelAnimationFrame(n),n=null)},a},ll=e=>1-Math.pow(1-e,4),Vw=(e,t,n)=>(t-e)*ll(n)+e,L$=({fromValues:e,toValues:t,onStep:n,duration:r=250,interpolateValue:i,onStart:o,onEnd:a,onCancel:s})=>{let l=!1,c=0,d;function u(h){if(l)return;d===void 0&&(d=h,o?.());let m=Math.min(h-d,r),p=ll(m/r),f={};if(Object.keys(e).forEach(g=>{let b=g,v=(t[b]-e[b])*p+e[b];f[b]=v}),n(f),m<r){let g=m/r,b={};Object.keys(e).forEach(v=>{let y=v,w=e[y],T=t[y],k;k=i?i(w,T,g,y):Vw(w,T,g),k==null&&(k=Vw(w,T,g)),b[y]=k}),n(b),c=window.requestAnimationFrame(u)}else n(t),a?.()}return c=window.requestAnimationFrame(u),()=>{s?.(),l=!0,window.cancelAnimationFrame(c)}},R$=(e,t)=>{if(!e.length||t<1)return[];let n=0,r=0,i=Array(Math.ceil(e.length/t));for(;n<e.length;)i[r++]=e.slice(n,n+=t);return i},Zn=(e,t)=>Math.abs(e-t),nn=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked},V=e=>(e=e.replace(/\bAlt\b/i,"Alt").replace(/\bShift\b/i,"Shift").replace(/\b(Enter|Return)\b/i,"Enter"),go?e.replace(/\bCtrlOrCmd\b/gi,"Cmd").replace(/\bAlt\b/i,"Option"):e.replace(/\bCtrlOrCmd\b/gi,"Ctrl")),Ot=({clientX:e,clientY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:a})=>{let s=(e-r)/n.value-o,l=(t-i)/n.value-a;return{x:s,y:l}},Ri=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:a})=>{let s=(e+o)*n.value+r,l=(t+a)*n.value+i;return{x:s,y:l}},np=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),T9="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF",C9="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",M9=new RegExp(`^[^${T9}]*[${C9}]`),qS=e=>M9.test(e),Ka=e=>{let[t,n]=e;return{x:t,y:n}},QS=e=>{if(e?.name==="AbortError"){console.warn(e);return}throw e},I5=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let r=n-1;for(;++r<e.length;)if(t(e[r],r,e))return r;return-1},k5=(e,t,n=e.length-1)=>{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let r=n+1;for(;--r>-1;)if(t(e[r],r,e))return r;return-1},mo=e=>{let t=e.length===5&&e.substr(4,1)==="0",n=e.length===9&&e.substr(7,2)==="00";return t||n||e===V2},JS=()=>{let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},O$=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;let{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},N$=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},$$=e=>{e.preventDefault(),e.returnValue=""},F$=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),Dc=()=>fl()?1:Date.now(),Fe=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),B$=e=>e.reduce((t,n,r)=>(t.set(n.id,[n,r]),t),new Map),fl=()=>Pt.MODE==="test",z$=()=>Pt.MODE==="development",eT=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),xp=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t}:e},H$=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}},ch=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,K2=e=>{let t=e?.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},Yw=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,$r=(e,t,n,r=!1)=>{let i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return r&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(let a of n)if(!(e[a]===t[a]||Yw(e[a],t[a])))return r&&console.warn(`%cisShallowEqual: ${a} not equal ->`,"color: #8B4000",e[a],t[a]),!1;return!0}return i.every(a=>{let s=n?.[a],l=s?s(e[a],t[a]):e[a]===t[a]||Yw(e[a],t[a]);return!l&&r&&console.warn(`%cisShallowEqual: ${a} not equal ->`,"color: #8B4000",e[a],t[a]),l})},Lf=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(r){if(e?.(r),!n||!r?.defaultPrevented)return t?.(r)},Su=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)},G$=e=>{let t,n,r=function(i){let o=Object.entries(i);if(t){let s=!0;for(let[l,c]of o)if(t.get(l)!==c){s=!1;break}if(s)return n}let a=e(i);return t=new Map(o),n=a,a};return r.clear=()=>{t=void 0,n=void 0},r},q2=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),zc=e=>JSON.parse(JSON.stringify(e)),A5=e=>typeof e=="number"&&Number.isFinite(e),E2=(e,t)=>$r(e,t)?e:t,rp=(e,t)=>(e+t)/2,tT=e=>e.replace(/\r?\n|\r/g,`
108
- `),cl=e=>e,Q2=async(e,...t)=>new Promise(n=>{n(e(...t))}),W$=(e,t)=>t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}),Eo,dl,sr,Ga,ti,he,Gu,fu,ke,vr,I9,Ne,yt,J2,Xn,_5,su,ul,nT,as,pn,Lc,Zw,j$,U$,xe=I(()=>{"use strict";D(),ae(),ne(),Eo=e=>!!e&&e.type==="image"&&!!e.fileId,dl=e=>!!e&&e.type==="image",sr=e=>!!e&&e.type==="embeddable",Ga=e=>!!e&&e.type==="iframe",ti=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),he=e=>e!=null&&e.type==="text",Gu=e=>e!=null&&e.type==="frame",fu=e=>e!=null&&e.type==="magicframe",ke=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),vr=e=>e!=null&&I9(e.type),I9=e=>e==="freedraw",Ne=e=>e!=null&&J2(e.type),yt=e=>e!=null&&e.type==="arrow",J2=e=>e==="arrow"||e==="line",Xn=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&_5(e.type),_5=e=>e==="arrow",su=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),ul=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||yt(e)),nT=e=>{let t=e?.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return Su(t,null),!1}},as=e=>ul(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),pn=e=>e!==null&&"containerId"in e&&e.containerId!==null&&he(e),Lc=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",Zw=e=>e==="line"||e==="arrow"||e==="diamond",j$=(e,t)=>!!((e===Pn.ADAPTIVE_RADIUS||e===Pn.LEGACY)&&Lc(t.type)||e===Pn.PROPORTIONAL_RADIUS&&Zw(t.type)),U$=e=>Zw(e.type)?{type:Pn.PROPORTIONAL_RADIUS}:Lc(e.type)?{type:Pn.ADAPTIVE_RADIUS}:null}),k9,A9,ns,ni,sa=I(()=>{"use strict";D(),ne(),k9=new ws(Date.now()),A9=0,ns=()=>Math.floor(k9.next()*2**31),ni=()=>fl()?`id${A9++}`:Fo()}),Xw,_9,Kw,P9,Hn,Sl=I(()=>{"use strict";D(),Pe(),xe(),Kc(),sa(),ne(),Xw=e=>{let t=new Map,n=[];for(let r of e)r.isDeleted||(n.push(r),t.set(r.id,r));return{elementsMap:t,elements:n}},_9=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let r of t)n+=`${r}:${e[r]?"1":"0"}`;return n},Kw=e=>typeof e=="string",P9=class b2{static sceneMapByElement=new WeakMap;static sceneMapById=new Map;static mapElementToScene(t,n){Kw(t)?this.sceneMapById.set(t,n):(this.sceneMapByElement.set(t,n),this.sceneMapById.set(t.id,n))}static getScene(t){return Kw(t)?this.sceneMapById.get(t)||null:this.sceneMapByElement.get(t)||null}callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=cl(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=cl(new Map);selectedElementsCache={selectedElementIds:null,elements:null,cache:new Map};versionNonce;getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}getSelectedElements(t){let n=_9(t),r=t?.elements||this.nonDeletedElements;if(this.selectedElementsCache.elements===r&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){let o=this.selectedElementsCache.cache.get(n);if(o)return o}else t?.elements==null&&this.selectedElementsCache.cache.clear();let i=st(r,{selectedElementIds:t.selectedElementIds},t);return t?.elements==null&&(this.selectedElementsCache.selectedElementIds=t.selectedElementIds,this.selectedElementsCache.elements=this.nonDeletedElements,this.selectedElementsCache.cache.set(n,i)),i}getNonDeletedFramesLikes(){return this.nonDeletedFramesLikes}getElement(t){return this.elementsMap.get(t)||null}getVersionNonce(){return this.versionNonce}getNonDeletedElement(t){let n=this.getElement(t);return n&&vE(n)?n:null}mapElements(t){let n=!1,r=this.elements.map(i=>{let o=t(i);return o!==i&&(n=!0),o});return n&&this.replaceAllElements(r),n}replaceAllElements(t){this.elements=t instanceof Array?t:Array.from(t.values());let n=[];this.elementsMap.clear(),this.elements.forEach(i=>{ke(i)&&n.push(i),this.elementsMap.set(i.id,i),b2.mapElementToScene(i,this)});let r=Xw(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=n,this.nonDeletedFramesLikes=Xw(this.frames).elements,this.informMutation()}informMutation(){this.versionNonce=ns();for(let t of Array.from(this.callbacks))t()}addCallback(t){if(this.callbacks.has(t))throw new Error;return this.callbacks.add(t),()=>{if(!this.callbacks.has(t))throw new Error;this.callbacks.delete(t)}}destroy(){this.nonDeletedElements=[],this.elements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),b2.sceneMapById.forEach((t,n)=>{t===this&&b2.sceneMapById.delete(n)}),this.callbacks.clear()}insertElementAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),t,...this.elements.slice(n)];this.replaceAllElements(r)}insertElementsAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];this.replaceAllElements(r)}addNewElement=t=>{t.frameId?this.insertElementAtIndex(t,this.getElementIndex(t.frameId)):this.replaceAllElements([...this.elements,t])};getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}getContainerElement=t=>t&&t.containerId&&this.getElement(t.containerId)||null},Hn=P9}),rT,vc,mb=I(()=>{"use strict";D(),rT=e=>{let t=e.map(r=>r[0]),n=e.map(r=>r[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},vc=(e,t,n,r)=>{let i=n.map(h=>h[e]),o=Math.max(...i),a=Math.min(...i),s=o-a,l=s===0?1:t/s,c=1/0,d=n.map(h=>{let m=h[e]*l,p=[...h];return p[e]=m,m<c&&(c=m),p});if(!r||d.length===2)return d;let u=a-c;return d.map(h=>h.map((m,p)=>p===e?m+u:m))}}),Ge,Wt,iT,un,eE,ss,P5,mc,Wd,D9,Fn,hl,D5,L5,L9,qw,V$,Y$,R5,Z$,ip,op,ap,ur=I(()=>{"use strict";D(),ae(),rn(),ca(),Ge=(e,t,n,r,i)=>[(e-n)*Math.cos(i)-(t-r)*Math.sin(i)+n,(e-n)*Math.sin(i)+(t-r)*Math.cos(i)+r],Wt=(e,t,n)=>Ge(e[0],e[1],t[0],t[1],n),iT=(e,t,n,r,i,o,a,s)=>{let l=Math.cos(r),c=Math.sin(r);return e.e&&e.w?t+=i+a:e.e?(t+=i*(1+l),n+=i*c,t+=a*(1-l),n+=a*-c):e.w&&(t+=i*(1-l),n+=i*-c,t+=a*(1+l),n+=a*c),e.n&&e.s?n+=o+s:e.n?(t+=o*c,n+=o*(1-l),t+=s*-c,n+=s*(1+l)):e.s&&(t+=o*-c,n+=o*(1+l),t+=s*c,n+=s*(1-l)),[t,n]},un=(e,t,n,r)=>{let i=n-e,o=r-t;return Math.hypot(i,o)},eE=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],ss=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return un(n[0],n[1],r[0],r[1])<=vp/t}return!1},P5=(e,t,n)=>{let r=e.length;if(r<3)return!1;let i=[Number.MAX_SAFE_INTEGER,n],o=[t,n],a=0;for(let s=0;s<r;s++){let l=e[s],c=e[(s+1)%r];if(D9(l,c,o,i)){if(Wd(l,o,c)===0)return mc(l,o,c);a++}}return a%2===1},mc=(e,t,n)=>t[0]<=Math.max(e[0],n[0])&&t[0]>=Math.min(e[0],n[0])&&t[1]<=Math.max(e[1],n[1])&&t[1]>=Math.min(e[1],n[1]),Wd=(e,t,n)=>{let r=(t[1]-e[1])*(n[0]-t[0])-(t[0]-e[0])*(n[1]-t[1]);return r===0?0:r>0?1:2},D9=(e,t,n,r)=>{let i=Wd(e,t,n),o=Wd(e,t,r),a=Wd(n,r,e),s=Wd(n,r,t);return!!(i!==o&&a!==s||i===0&&mc(e,n,t)||o===0&&mc(e,r,t)||a===0&&mc(n,e,r)||s===0&&mc(n,t,r))},Fn=(e,t,n)=>n?[Math.round(e/n)*n,Math.round(t/n)*n]:[e,t],hl=(e,t)=>{if(t.roundness?.type===Pn.PROPORTIONAL_RADIUS||t.roundness?.type===Pn.LEGACY)return e*p2;if(t.roundness?.type===Pn.ADAPTIVE_RADIUS){let n=t.roundness?.value??I$,r=n/p2;return e<=r?e*p2:n}return 0},D5=(e,t)=>{let n=jt.generateElementShape(e,null);if(!n)return null;let r=ja(n[0]),i=[0,0],o=0,a=1/0,s=null;for(;o<r.length;){let{op:l,data:c}=r[o];if(l==="move"&&(i=c),l==="bcurveTo"){let d=i,u=[c[0],c[1]],h=[c[2],c[3]],m=[c[4],c[5]],p=un(m[0],m[1],t[0],t[1]);p<a&&(a=p,s=[d,u,h,m]),i=m}o++}return s},L5=(e,t,n,r,i)=>{let o=(l,c)=>Math.pow(1-l,3)*r[c]+3*l*Math.pow(1-l,2)*n[c]+3*Math.pow(l,2)*(1-l)*t[c]+e[c]*Math.pow(l,3),a=o(i,0),s=o(i,1);return[a,s]},L9=(e,t)=>{let n=D5(e,t);if(!n)return[];let r=[],i=1;for(;i>0;){let o=L5(n[0],n[1],n[2],n[3],i);r.push([o[0],o[1]]),i-=.05}return r.length&&R5(r.at(-1),t)&&r.push([t[0],t[1]]),r},qw=(e,t)=>{let n=[];n[0]=0;let r=L9(e,t),i=0,o=0;for(;i<r.length-1;){let a=un(r[i][0],r[i][1],r[i+1][0],r[i+1][1]);o+=a,n.push(o),i++}return n},V$=(e,t)=>qw(e,t).at(-1),Y$=(e,t,n)=>{let r=qw(e,t),i=r.length-1,o=r.at(-1),a=n*o,s=0,l=i,c=0;for(;s<l;)c=Math.floor(s+(l-s)/2),r[c]<a?s=c+1:l=c;return r[c]>a&&c--,r[c]===a?c/i:1-(c+(a-r[c])/(r[c+1]-r[c]))/i},R5=(e,t)=>e[0]===t[0]&&e[1]===t[1],Z$=e=>Math.round(e/Math.PI*1e4)%5e3===0,ip=([e,t],[n,r])=>e<=n?t>=n:e>=n?r>=e:!1,op=(e,t)=>{let n=Math.max(e[0],t[0]),r=Math.min(e[1],t[1]);return n<=r?[n,r]:null},ap=(e,t,n)=>e>=t&&e<=n}),xc,tE,O5,N5,nE,Gp,X$,K$,pb=I(()=>{"use strict";D(),xe(),xc=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",tE=e=>e!=="image"&&e!=="frame"&&e!=="magicframe",O5=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",N5=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",nE=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="arrow"||e==="line"||e==="diamond"||e==="image",Gp=e=>e==="arrow",X$=(e,t)=>{let n=null;for(let r=e.length-1;r>=0;--r){let i=e[r];if(!i.isDeleted&&t(i)){n=i;break}}return n},K$=(e,t)=>{let n=[];return e.filter(r=>!r.isDeleted&&t(r)?Ga(r)?(n.push(r),!1):!0:!1).concat(n)}});function CJ(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&&nE(e.type)||Ne(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var R9,Qw,qr,Jw,e3,q$,Q$=I(()=>{"use strict";D(),Pe(),ur(),ls(),ne(),ae(),xe(),pb(),R9=e=>[8,8+e],Qw=e=>[1.5,6+e],qr=(e,t=!1)=>{let n={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?R9(e.strokeWidth):e.strokeStyle==="dotted"?Qw(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:CJ(e),stroke:e.strokeColor,preserveVertices:t||e.roughness<T5.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return n.fillStyle=e.fillStyle,n.fill=mo(e.backgroundColor)?void 0:e.backgroundColor,e.type==="ellipse"&&(n.curveFitting=1),n;case"line":case"freedraw":return ss(e.points)&&(n.fillStyle=e.fillStyle,n.fill=e.backgroundColor==="transparent"?void 0:e.backgroundColor),n;case"arrow":return n;default:throw new Error(`Unimplemented type ${e.type}`)}},Jw=(e,t,n)=>ti(e)&&(t||sr(e)&&n?.get(e.id)!==!0)&&mo(e.backgroundColor)&&mo(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:Ga(e)?{...e,strokeColor:mo(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:mo(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,e3=(e,t,n,r,i,o,a)=>{a=a||"transparent";let s=IF(e,t,n,r);if(s===null)return[];switch(r){case"dot":case"circle":case"circle_outline":{let[l,c,d]=s;return delete o.strokeLineDash,[i.circle(l,c,d,{...o,fill:r==="circle_outline"?a:e.strokeColor,fillStyle:"solid",stroke:e.strokeColor,roughness:Math.min(.5,o.roughness||0)})]}case"triangle":case"triangle_outline":{let[l,c,d,u,h,m]=s;return delete o.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[l,c]],{...o,fill:r==="triangle_outline"?a:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,o.roughness||0)})]}case"diamond":case"diamond_outline":{let[l,c,d,u,h,m,p,f]=s;return delete o.strokeLineDash,[i.polygon([[l,c],[d,u],[h,m],[p,f],[l,c]],{...o,fill:r==="diamond_outline"?a:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,o.roughness||0)})]}case"bar":case"arrow":default:{let[l,c,d,u,h,m]=s;if(e.strokeStyle==="dotted"){let p=Qw(e.strokeWidth-1);o.strokeLineDash=[p[0],p[1]-1]}else delete o.strokeLineDash;return o.roughness=Math.min(1,o.roughness||0),[i.line(d,u,l,c,o),i.line(h,m,l,c,o)]}}},q$=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i})=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":{let o;if(e.roundness){let a=e.width,s=e.height,l=hl(Math.min(a,s),e);o=t.path(`M ${l} 0 L ${a-l} 0 Q ${a} 0, ${a} ${l} L ${a} ${s-l} Q ${a} ${s}, ${a-l} ${s} L ${l} ${s} Q 0 ${s}, 0 ${s-l} L 0 ${l} Q 0 0, ${l} 0`,qr(Jw(e,n,i),!0))}else o=t.rectangle(0,0,e.width,e.height,qr(Jw(e,n,i),!1));return o}case"diamond":{let o,[a,s,l,c,d,u,h,m]=MF(e);if(e.roundness){let p=hl(Math.abs(a-h),e),f=hl(Math.abs(c-s),e);o=t.path(`M ${a+p} ${s+f} L ${l-p} ${c-f}
109
- C ${l} ${c}, ${l} ${c}, ${l-p} ${c+f}
110
- L ${d+p} ${u-f}
111
- C ${d} ${u}, ${d} ${u}, ${d-p} ${u-f}
112
- L ${h+p} ${m+f}
113
- C ${h} ${m}, ${h} ${m}, ${h+p} ${m-f}
114
- L ${a-p} ${s+f}
115
- C ${a} ${s}, ${a} ${s}, ${a+p} ${s+f}`,qr(e,!0))}else o=t.polygon([[a,s],[l,c],[d,u],[h,m]],qr(e));return o}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,qr(e));case"line":case"arrow":{let o,a=qr(e),s=e.points.length?e.points:[[0,0]];if(e.roundness?o=[t.curve(s,a)]:a.fill?o=[t.polygon(s,a)]:o=[t.linearPath(s,a)],e.type==="arrow"){let{startArrowhead:l=null,endArrowhead:c="arrow"}=e;if(l!==null){let d=e3(e,o,"start",l,t,a,r);o.push(...d)}if(c!==null){let d=e3(e,o,"end",c,t,a,r);o.push(...d)}}return o}case"freedraw":{let o;if(YJ(e),ss(e.points)){let a=t0(e.points,.75);o=t.curve(a,{...qr(e),stroke:"none"})}else o=null;return o}case"frame":case"magicframe":case"text":case"image":return null;default:return Su(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}}}),nr,$5,$s,wp,J$,sp,wc,O9,eF,oT,F5,tF,B5,N9,Wp,nF,pg,MJ,IJ,kJ,AJ,_J,PJ,DJ,Wu=I(()=>{"use strict";D(),nr=(e,t)=>[0,0,0,0,t,e,1,0],$5=(e,t)=>[0,0,0,0,t,e,0,0],$s=(e=0,t=0)=>{let n=[0,0,0,0,0,0,0,0];if(t<0||t>7)throw new Error(`Expected \`index\` between 0 and 7, got \`${t}\``);return e!==0&&(n[t]=e),n},wp=e=>[e[0],e[1],e[2],e[3],-e[4],-e[5],-e[6],-e[7]],J$=(e,t)=>pg(t)?[e[0]+t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]+t[0],e[1]+t[1],e[2]+t[2],e[3]+t[3],e[4]+t[4],e[5]+t[5],e[6]+t[6],e[7]+t[7]],sp=(e,t)=>pg(t)?[e[0]-t,e[1],e[2],e[3],e[4],e[5],e[6],e[7]]:[e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3],e[4]-t[4],e[5]-t[5],e[6]-t[6],e[7]-t[7]],wc=(e,t)=>pg(t)?[e[0]*t,e[1]*t,e[2]*t,e[3]*t,e[4]*t,e[5]*t,e[6]*t,e[7]*t]:[O9(e,t),t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[7]*e[3]+t[0]*e[4]+t[6]*e[5]-t[5]*e[6]+t[3]*e[7],t[5]*e[0]-t[3]*e[1]+t[7]*e[2]+t[1]*e[3]-t[6]*e[4]+t[0]*e[5]+t[4]*e[6]+t[2]*e[7],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]+t[0]*e[7]],O9=(e,t)=>t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],eF=(e,t)=>[t[0]*e[0],t[1]*e[0]+t[0]*e[1],t[2]*e[0]+t[0]*e[2],t[3]*e[0]+t[0]*e[3],t[4]*e[0]+t[2]*e[1]-t[1]*e[2]+t[0]*e[4],t[5]*e[0]-t[3]*e[1]+t[1]*e[3]+t[0]*e[5],t[6]*e[0]+t[3]*e[2]-t[2]*e[3]+t[0]*e[6],t[7]*e[0]+t[6]*e[1]+t[5]*e[2]+t[4]*e[3]+t[3]*e[4]+t[2]*e[5]+t[1]*e[6]],oT=(e,t)=>[F5(e,t),e[1]*t[7]+e[4]*t[5]-e[5]*t[4]+e[7]*t[1],e[2]*t[7]-e[4]*t[6]+e[6]*t[4]+e[7]*t[2],e[3]*t[7]+e[5]*t[6]-e[6]*t[5]+e[7]*t[3],e[4]*t[7]+e[7]*t[4],e[5]*t[7]+e[7]*t[5],e[6]*t[7]+e[7]*t[6],e[7]*t[7]],F5=(e,t)=>e[0]*t[7]+e[1]*t[6]+e[2]*t[5]+e[3]*t[4]+e[4]*t[3]+e[5]*t[2]+e[6]*t[1]+e[7]*t[0],tF=(e,t)=>[t[0]*e[0]+t[2]*e[2]+t[3]*e[3]-t[6]*e[6],t[1]*e[0]+t[0]*e[1]-t[4]*e[2]+t[5]*e[3]+t[2]*e[4]-t[3]*e[5]-t[7]*e[6]-t[6]*e[7],t[2]*e[0]+t[0]*e[2]-t[6]*e[3]+t[3]*e[6],t[3]*e[0]+t[6]*e[2]+t[0]*e[3]-t[2]*e[6],t[4]*e[0]+t[7]*e[3]+t[0]*e[4]+t[3]*e[7],t[5]*e[0]+t[7]*e[2]+t[0]*e[5]+t[2]*e[7],t[6]*e[0]+t[0]*e[6],t[7]*e[0]+t[0]*e[7]],B5=e=>Math.sqrt(Math.abs(e[0]*e[0]-e[2]*e[2]-e[3]*e[3]+e[6]*e[6])),N9=e=>Math.sqrt(Math.abs(e[7]*e[7]-e[5]*e[5]-e[4]*e[4]+e[1]*e[1])),Wp=e=>{let t=B5(e);if(t===0||t===1)return e;let n=e[6]<0?-1:1;return wc(e,n/t)},nF=e=>{let t=N9(e);return t===0||t===1?e:wc(e,1/t)},pg=e=>typeof e=="number",MJ=$s(1,1),IJ=$s(1,2),kJ=$s(1,3),AJ=$s(1,4),_J=$s(1,5),PJ=$s(1,6),DJ=$s(1,7)}),Hs,gu,$9,rF,iF,oF=I(()=>{"use strict";D(),Wu(),Hs=(e,t,n)=>Wp([0,n,e,t,0,0,0,0]),gu=(e,t)=>Wp(oT(t,e)),$9=(e,t)=>tF(e,t),rF=(e,t)=>$9(gu(e,t),t),iF=e=>Math.sign(e[1])}),Gs,Ws,z5,aF,H5,Si,LJ=I(()=>{"use strict";D(),Wu(),oF(),Wu(),Gs=([e,t])=>[0,0,0,0,t,e,1,0],Ws=e=>[e[5],e[4]],z5=e=>[0,0,0,0,Math.abs(e[4]),Math.abs(e[5]),1,0],aF=(e,t)=>Wp(eF(e,t)),H5=(e,t)=>B5(oT(e,t)),Si=(e,t)=>F5(e,t)}),y2,sF,lF=I(()=>{"use strict";D(),Wu(),y2=e=>[0,0,0,0,e[4],e[5],0,0],sF=(e,t)=>nF([0,0,0,0,t[4]-e[4],t[5]-e[5],0,0])}),v2,cF,dF,uF,Ti,RJ=I(()=>{"use strict";D(),Wu(),lF(),v2=(e,t)=>J$(wc(e,Math.sin(t/2)),Math.cos(t/2)),cF=e=>[1,0,0,0,-(.5*e[5]),.5*e[4],0,0],dF=(e,t)=>{let n=.5*t;return[1,0,0,0,n*e[4],n*e[5],0,0]},uF=(e,t)=>wc(t,e),Ti=(e,t)=>Wp(wc(wc(e,t),wp(e)))}),t3,F9,aT,hF,B9,n3,fg,Zo,rE,sT,fb,Rf=I(()=>{"use strict";D(),rn(),ur(),Pe(),xe(),ae(),t3={mouse:8,pen:16,touch:28},F9=16,aT={e:!0,s:!0,n:!0,w:!0},hF={e:!0,s:!0,n:!0,w:!0,rotation:!0},B9={e:!0,s:!0,n:!0,w:!0},n3={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},fg={e:!0,s:!0,n:!0,w:!0},Zo=(e,t,n,r,i,o,a)=>{let[s,l]=Ge(e+n/2,t+r/2,i,o,a);return[s-n/2,l-r/2,n,r]},rE=([e,t,n,r,i,o],a,s,l,c={},d=4)=>{let u=t3[l],h=u/s.value,m=u/s.value,p=u/s.value,f=u/s.value,g=n-e,b=r-t,v=d/s.value,y=(u-xu*2)/(2*s.value),w={nw:c.nw?void 0:Zo(e-v-p+y,t-v-f+y,h,m,i,o,a),ne:c.ne?void 0:Zo(n+v-y,t-v-f+y,h,m,i,o,a),sw:c.sw?void 0:Zo(e-v-p+y,r+v-y,h,m,i,o,a),se:c.se?void 0:Zo(n+v-y,r+v-y,h,m,i,o,a),rotation:c.rotation?void 0:Zo(e+g/2-h/2,t-v-f+y-F9/s.value,h,m,i,o,a)},T=5*t3.mouse/s.value;return Math.abs(g)>T&&(c.n||(w.n=Zo(e+g/2-h/2,t-v-f+y,h,m,i,o,a)),c.s||(w.s=Zo(e+g/2-h/2,r+v-y,h,m,i,o,a))),Math.abs(b)>T&&(c.w||(w.w=Zo(e-v-p+y,t+b/2-m/2,h,m,i,o,a)),c.e||(w.e=Zo(n+v-y,t+b/2-m/2,h,m,i,o,a))),w},sT=(e,t,n,r="mouse")=>{if(e.locked)return{};let i={};if(e.type==="freedraw"||Ne(e)){if(e.points.length===2){let[,a]=e.points;a[0]===0||a[1]===0?i=fg:a[0]>0&&a[1]<0?i=n3:a[0]>0&&a[1]>0?i=fg:a[0]<0&&a[1]>0?i=n3:a[0]<0&&a[1]<0&&(i=fg)}}else he(e)?i=B9:ke(e)&&(i={rotation:!0});let o=Ne(e)?xu+8:xu;return rE(_e(e,n,!0),e.angle,t,r,i,o)},fb=(e,t)=>{if(t.editingLinearElement)return!1;if(e.length>1)return!0;let n=e[0];return Ne(n)?n.points.length>2:!0}}),z9,Sp,x2,Tu,H9,Tp,G5,jp,gg,w2,G9,jd,W9,j9,r3,U9,V9,Y9,Z9,X9,K9,Nm,q9,Eg,$m,mF,pF,fF,Q9,i3,J9,eL,tL,nL,rL,iL,oL,bg,o3,Zc=I(()=>{"use strict";D(),Wu(),LJ(),lF(),oF(),RJ(),ur(),rn(),xe(),Pe(),ne(),Rf(),Kt(),ca(),z9=e=>{if(e.type==="arrow")return!1;if(e.type==="freedraw")return!0;let t=!mo(e.backgroundColor)||as(e)||ti(e);return e.type==="line"?t&&ss(e.points):t||dl(e)},Sp=(e,t,n,r,i,o)=>{let a=10/t.zoom.value,s=[r,i];if(H9(t,e)&&fb([e],t))return Tp(e,o,s,a,n);let l=Ue(e,o);return l&&Sp(l,t,n,r,i,o)?!0:Tu(e,t,n,s,o)},x2=(e,t,n,r,i,o)=>{let a=10/t.zoom.value,s=Ue(e,o);return s&&Sp(s,t,n,r,i,o)?!1:!Tu(e,t,n,[r,i],o)&&Tp(e,o,[r,i],a,n)},Tu=(e,t,n,r,i)=>{let o=10/t.zoom.value,a=he(e)?G9:z9(e)?jd:W9;return gg({element:e,elementsMap:i,point:r,threshold:o,check:a,frameNameBoundsCache:n})},H9=(e,t)=>e.selectedElementIds[t.id],Tp=(e,t,[n,r],i,o)=>{if(ke(e))return gg({element:e,elementsMap:t,point:[n,r],threshold:i,check:jd,frameNameBoundsCache:o});let[a,s,l,c]=_e(e,t),d=(a+l)/2,u=(s+c)/2,[h,m]=Ge(n,r,d,u,-e.angle);return h>a-i&&h<l+i&&m>s-i&&m<c+i},G5=(e,{x:t,y:n},r)=>{let i=jp(e,e.width,e.height);return gg({element:e,elementsMap:r,point:[t,n],threshold:i,check:j9,frameNameBoundsCache:null})},jp=(e,t,n)=>{let r=(e.type==="diamond"?1/Math.sqrt(2):1)*Math.min(t,n);return Math.max(16,Math.min(.25*r,32))},gg=e=>{switch(e.element.type){case"rectangle":case"iframe":case"embeddable":case"image":case"text":case"diamond":case"ellipse":let t=w2(e.element,e.point,e.elementsMap);return e.check(t,e.threshold);case"freedraw":return e.check(r3(e.element,e.point,e.elementsMap),e.threshold)?X9(e.element,e.point,e.threshold,e.elementsMap):!1;case"arrow":case"line":return K9(e);case"selection":return console.warn("This should not happen, we need to investigate why it does."),!1;case"frame":case"magicframe":{if(e.check(w2(e.element,e.point,e.elementsMap),e.threshold))return!0;let n=e.frameNameBoundsCache?.get(e.element);return n?e.check(U9(n,e.point),e.threshold):!1}}},w2=(e,t,n)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return r3(e,t,n);case"diamond":return V9(e,t,n);case"ellipse":return Y9(e,t,n)}},G9=(e,t)=>e<0,jd=(e,t)=>e<t,W9=(e,t)=>Math.abs(e)<t,j9=(e,t)=>0<=e&&e<t,r3=(e,t,n)=>{let[,r,i,o]=Nm(e,t,n);return Math.max(Si(r,Hs(0,1,-o)),Si(r,Hs(1,0,-i)))},U9=(e,t)=>{let[,n,r,i]=q9(t,e);return Math.max(Si(n,Hs(0,1,-i)),Si(n,Hs(1,0,-r)))},V9=(e,t,n)=>{let[,r,i,o]=Nm(e,t,n),a=Hs(o,i,-o*i);return Si(r,a)},Y9=(e,t,n)=>{let[r,i]=Z9(e,t,n);return-iF(i)*Si(r,i)},Z9=(e,t,n)=>{let[,r,i,o]=Nm(e,t,n),[a,s]=Ws(r),l=.707,c=.707,d=i,u=o;[0,1,2,3].forEach(p=>{let f=d*l,g=u*c,b=(d*d-u*u)*l**3/d,v=(u*u-d*d)*c**3/u,y=f-b,w=g-v,T=a-b,k=s-v,M=Math.hypot(w,y),C=Math.hypot(k,T);l=Math.min(1,Math.max(0,(T*M/C+b)/d)),c=Math.min(1,Math.max(0,(k*M/C+v)/u));let P=Math.hypot(c,l);l/=P,c/=P});let h=nr(d*l,u*c),m=rF(r,h);return[r,m]},X9=(e,t,n,r)=>{let i,o;if(e.angle===0)i=t[0]-e.x,o=t[1]-e.y;else{let[d,u,h,m]=_e(e,r),p=Wt(t,[d+(h-d)/2,u+(m-u)/2],-e.angle);i=p[0]-e.x,o=p[1]-e.y}let[a,s]=e.points,l;if(un(a[0],a[1],i,o)<n||un(s[0],s[1],i,o)<n)return!0;for(let d=0;d<e.points.length;d++){let u=[s[0]-a[0],s[1]-a[1]],h=Math.hypot(u[1],u[0]),m=[u[0]/h,u[1]/h],p=[i-a[0],o-a[1]],f=(p[0]*m[0]+p[1]*m[1])/Math.hypot(m[1],m[0]);l=[a[0]+m[0]*f,a[1]+m[1]*f];let g=un(l[0],l[1],a[0],a[1]),b=un(l[0],l[1],s[0],s[1]);if(l=b<g&&g>h?s:g<b&&b>h?a:l,Math.hypot(o-l[1],i-l[0])<n)return!0;a=s,s=e.points[d+1]}let c=jt.get(e);return c&&c.sets.length?e.fillStyle==="solid"?bg(c,i,o,"round"):o3(c,i,o,n):!1},K9=e=>{let{element:t,threshold:n}=e;if(!jt.get(t))return!1;let[r,i,o,a]=Nm(e.element,e.point,e.elementsMap),s=Hs(0,1,-a),l=Hs(1,0,-o);if(!jd(Si(i,s),n)||!jd(Si(i,l),n))return!1;let[c,d]=Ws(r),u=jt.get(t);return u?e.check===jd&&u.some(h=>bg(h,c,d,t.roundness?"round":"sharp"))?!0:u.some(h=>o3(h,c,d,n)):!1},Nm=(e,t,n)=>{let r=Gs(t),[i,o,a,s]=_e(e,n),l=$m(i,o,a,s),c=v2(l,e.angle),d=Ti(c,r),u=sp(d,y2(l)),h=z5(u),m=$5(e.x,e.y),p=sp(d,m),f=(a-i)/2,g=(s-o)/2;return[p,h,f,g]},q9=(e,t)=>{let n=Gs(e),[r,i,o,a]=CF(t),s=$m(r,i,o,a),l=v2(s,t.angle),c=Ti(l,n),d=sp(c,y2(s)),u=z5(d),h=$5(t.x,t.y),m=sp(c,h),p=(o-r)/2,f=(a-i)/2;return[m,u,p,f]},Eg=(e,t)=>{let[n,r,i,o]=_e(e,t),a=$m(n,r,i,o),s=v2(a,e.angle),l=wp(cF(y2(a)));return uF(s,l)},$m=(e,t,n,r)=>nr((e+n)/2,(t+r)/2),mF=(e,t,n,r)=>{let i=Eg(e,r),o=Ti(i,Gs(t)),a=Ti(i,Gs(n)),s=gu(o,a),l=e.height/e.width,c=e.width/2,d=e.height/2,u=s[2],h=s[3],m=s[1],p=Math.abs(h),f=Math.abs(u),g;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":g=m/(c*(f+l*p));break;case"diamond":g=p<f?m/(f*c):m/(p*d);break;case"ellipse":g=m/(c*Math.sqrt(u**2+l**2*h**2));break}return g||0},pF=(e,t,n,r)=>{if(t===0){let[l,c,d,u]=_e(e,r),h=$m(l,c,d,u);return Ws(h)}let i=Eg(e,r),o=Ti(i,Gs(n)),a=wp(i),s;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":s=iL(e,t,o);break;case"ellipse":s=rL(e,t,o);break}return Ws(Ti(a,s))},fF=(e,t,n,r=0,i)=>{let o=Eg(e,i),a=Ti(o,Gs(t)),s=Ti(o,Gs(n)),l=gu(a,s),c=wp(o);return Q9(e,l,a,r).map(d=>Ws(Ti(c,d)))},Q9=(e,t,n,r=0)=>{let i;switch(e.type){case"rectangle":case"image":case"text":case"diamond":case"iframe":case"embeddable":case"frame":case"magicframe":let a=i3(e);i=a.flatMap((s,l)=>{let c=[s,a[(l+1)%4]];return J9(t,eL(c,r))}).concat(a.flatMap(s=>nL(s,r,t)));break;case"ellipse":i=tL(e,r,t);break}if(i.length<2)return[];let o=i.sort((a,s)=>H5(a,n)-H5(s,n));return[o[0],o[o.length-1]]},i3=(e,t=1)=>{let n=t*e.width/2,r=t*e.height/2;switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return[nr(n,r),nr(n,-r),nr(-n,-r),nr(-n,r)];case"diamond":return[nr(0,r),nr(n,0),nr(0,-r),nr(-n,0)]}},J9=(e,t)=>{let[n,r]=t,i=Si(n,e),o=Si(r,e);return i*o>=0?[]:[aF(e,gu(n,r))]},eL=(e,t)=>{let[n,r]=e,i=dF(sF(n,r),t);return[Ti(i,n),Ti(i,r)]},tL=(e,t,n)=>{let r=e.width/2+t,i=e.height/2+t,o=n[2],a=n[3],s=n[1],l=r*r*o*o+i*i*a*a,c=l-s*s;if(l===0||c<=0)return[];let d=Math.sqrt(c),u=-r*r*o*s,h=-i*i*a*s;return[nr((u+r*i*a*d)/l,(h-r*i*o*d)/l),nr((u-r*i*a*d)/l,(h+r*i*o*d)/l)]},nL=(e,t,n)=>{if(t===0)return Si(n,e)===0?[e]:[];let r=n[2],i=n[3],o=n[1],[a,s]=Ws(e),l=t,c=r*r+i*i,d=l*l*c-(r*a+i*s+o)**2;if(c===0||d<=0)return[];let u=Math.sqrt(d),h=a*i*i-s*r*i-r*o,m=s*r*r-a*r*i-i*o;return[nr((h+i*u)/c,(m-r*u)/c),nr((h-i*u)/c,(m+r*u)/c)]},rL=(e,t,n)=>{let r=Math.abs(t),i=e.width*r/2,o=e.height*r/2,a=Math.sign(t),[s,l]=Ws(n),c=l===0?1e-4:l,d=s**2*o**2+c**2*i**2,u=(-s*o**2+a*c*Math.sqrt(Math.max(0,d-i**2*o**2)))/d,h=(-u*s-1)/c;h===0&&(h=(Object.is(h,-0)?-1:1)*.01);let m=-(i**2*u)/(h**2*o**2+u**2*i**2);return nr(m,(-u*m-1)/h)},iL=(e,t,n)=>{let r=Math.abs(t),i=Math.sign(t),o=i3(e,r),a=0,s=null;return o.forEach(l=>{let c=i*gu(n,l)[1];c>a&&(a=c,s=l)}),s},oL=(e,t,n,r,[i,o],a)=>{let s=(c,d)=>Math.pow(1-c,3)*r[d]+3*c*Math.pow(1-c,2)*n[d]+3*Math.pow(c,2)*(1-c)*t[d]+e[d]*Math.pow(c,3),l=0;for(;l<=1;){let c=s(l,0),d=s(l,1);if(Math.sqrt(Math.pow(c-i,2)+Math.pow(d-o,2))<a)return!0;l+=.01}return!1},bg=(e,t,n,r)=>{let i=ja(e),o=[],a=!1;for(let s of i)s.op==="move"?(a=!a,a&&o.push([s.data[0],s.data[1]])):s.op==="bcurveTo"?a&&(o.push([s.data[0],s.data[1]]),o.push([s.data[2],s.data[3]]),o.push([s.data[4],s.data[5]])):s.op==="lineTo"&&a&&o.push([s.data[0],s.data[1]]);if(o.length>=4){if(r==="sharp")return P5(o,t,n);let s=n0(o,10,5);return P5(s,t,n)}return!1},o3=(e,t,n,r)=>{let i=ja(e),o=[0,0];return i.some(({op:a,data:s},l)=>{if(a==="move")o=s;else if(a==="bcurveTo"){let c=[s[0],s[1]],d=[s[2],s[3]],u=[s[4],s[5]],h=o;return o=u,oL(h,c,d,u,[t,n],r)}else{if(a==="lineTo")return bg(e,t,n,"sharp");a==="qcurveTo"&&console.warn("qcurveTo is not implemented yet")}return!1})}}),tt,O,Cp,S2,lu,Cu,Ce=I(()=>{"use strict";D(),ae(),tt={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",NINE:"Digit9",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",R:"KeyR",S:"KeyS"},O={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:go?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SUBTRACT:"-",SLASH:"/",A:"a",C:"c",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",W:"w",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},Cp=e=>e===O.ARROW_LEFT||e===O.ARROW_RIGHT||e===O.ARROW_DOWN||e===O.ARROW_UP,S2=e=>e.altKey,lu=e=>e.shiftKey,Cu=e=>e.shiftKey}),gF,el,a3,Sc,s3,iE,aL,oE,Eu,yg,W5,aE,sL,qa,lL,Wa,cL,dL,l3,c3,EF,uL,Fm,d3,u3,h3,lT,m3,gb,p3,hL,la=I(()=>{"use strict";D(),pt(),xe(),Zc(),wt(),Sl(),Tr(),ne(),Ce(),Kt(),gF=e=>!e[O.CTRL_OR_CMD],el=e=>e.isBindingEnabled,a3=(e,t)=>{let n=[];return t.forEach(r=>{let i=e.getNonDeletedElement(r);i!=null&&n.push(i)}),n},Sc=(e,t,n,r)=>{let i=new Set,o=new Set;s3(e,t,n,"start",i,o,r),s3(e,n,t,"end",i,o,r);let a=Array.from(o).filter(s=>!i.has(s));a3(Hn.getScene(e),a).forEach(s=>{re(s,{boundElements:s.boundElements?.filter(l=>l.type!=="arrow"||l.id!==e.id)})})},s3=(e,t,n,r,i,o,a)=>{if(t!=="keep")if(t!=null)(n==null||(n==="keep"?!yg(e,t,r):r==="start"||n.id!==t.id))&&(Eu(e,t,r,a),i.add(t.id));else{let s=sL(e,r);s!=null&&o.add(s)}},iE=(e,t,n)=>{e.forEach(r=>{Xn(r)?Sc(r,Fm(r,"start",t,n),Fm(r,"end",t,n),n):su(r)&&aL(r,n)})},aL=(e,t)=>{u3(e,t).forEach(([n,r])=>Sc(n,r==="end"?"keep":e,r==="start"?"keep":e,t))},oE=(e,t,n,r,i)=>{t.startBoundElement!=null&&Eu(e,t.startBoundElement,"start",i);let o=qa(r,n.getNonDeletedElements(),i);o!=null&&!yg(e,o,"end")&&Eu(e,o,"end",i)},Eu=(e,t,n,r)=>{re(e,{[n==="start"?"startBinding":"endBinding"]:{elementId:t.id,...lL(e,t,n,r)}}),Fe(t.boundElements||[]).has(e.id)||re(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},yg=(e,t,n)=>{let r=e[n==="start"?"endBinding":"startBinding"];return W5(e,r?.elementId,t)},W5=(e,t,n)=>t===n.id&&e.points.length<3,aE=(e,t)=>{e.forEach(n=>{Xn(n)&&Sc(n,null,null,t)})},sL=(e,t)=>{let n=t==="start"?"startBinding":"endBinding",r=e[n];return r==null?null:(re(e,{[n]:null}),r.elementId)},qa=(e,t,n)=>X$(t,r=>su(r,!1)&&G5(r,e,n)),lL=(e,t,n,r)=>{let i=n==="start"?-1:1,o=i===-1?0:e.points.length-1,a=o-i,s=pe.getPointAtIndexGlobalCoordinates(e,o,r),l=pe.getPointAtIndexGlobalCoordinates(e,a,r);return{focus:mF(t,l,s,r),gap:Math.max(1,w2(t,s,r))}},Wa=(e,t,n)=>{let r=(e.boundElements??[]).filter(l=>l.type==="arrow");if(r.length===0)return;let{newSize:i,simultaneouslyUpdated:o}=n??{},a=dL(o),s=Hn.getScene(e);a3(s,r.map(l=>l.id)).forEach(l=>{if(!Ne(l))return;let c=e;if(!cL(l,c))return;let d=c3(c,l.startBinding,i),u=c3(c,l.endBinding,i);if(a.has(l.id)){re(l,{startBinding:d,endBinding:u});return}l3(l,"start",d,e,t),l3(l,"end",u,e,t),Ue(l,s.getNonDeletedElementsMap())&&Vp(l,s.getNonDeletedElementsMap(),!1)})},cL=(e,t)=>e.startBinding?.elementId===t.id||e.endBinding?.elementId===t.id,dL=e=>new Set((e||[]).map(t=>t.id)),l3=(e,t,n,r,i)=>{if(n==null||n.elementId!==r.id&&e.points.length>2)return;let o=Hn.getScene(e).getElement(n.elementId);if(o==null)return;let a=t==="start"?-1:1,s=a===-1?0:e.points.length-1,l=s-a,c=pe.getPointAtIndexGlobalCoordinates(e,l,i),d=pF(o,n.focus,c,i),u;if(n.gap===0)u=d;else{let h=fF(o,c,d,n.gap,i);h.length===0?u=d:u=h[0]}pe.movePoints(e,[{index:s,point:pe.pointFromAbsoluteCoords(e,u,i)}],{[t==="start"?"startBinding":"endBinding"]:n})},c3=(e,t,n)=>{if(t==null||n==null)return t;let{gap:r,focus:i,elementId:o}=t,{width:a,height:s}=n,{width:l,height:c}=e,d=Math.max(1,Math.min(jp(e,a,s),r*(a<s?a/l:s/c)));return{elementId:o,gap:d,focus:i}},EF=(e,t,n)=>{let r=new Set(e.map(({id:i})=>i));return e.flatMap(i=>Xn(i,!1)?uL(i,t,n).filter(o=>!r.has(o.id)):su(i,!1)?u3(i,n).filter(o=>!r.has(o[0].id)):[])},uL=(e,t,n)=>[Fm(e,"start",t,n),Fm(e,"end",t,n)].filter(r=>r!=null),Fm=(e,t,n,r)=>qa(d3(e,t,r),n,r),d3=(e,t,n)=>{let r=t==="start"?0:-1;return Ka(pe.getPointAtIndexGlobalCoordinates(e,r,n))},u3=(e,t)=>Hn.getScene(e).getNonDeletedElements().map(n=>{if(!Xn(n,!1))return null;let r=h3(n,"start",e,t),i=h3(n,"end",e,t);return!r&&!i?null:[n,r&&i?"both":r?"start":"end",e]}).filter(n=>n!=null),h3=(e,t,n,r)=>e[t==="start"?"startBinding":"endBinding"]==null&&!yg(e,n,t)&&G5(n,d3(e,t,r),r),lT=(e,t,n,r)=>{let i=new Set,o=new Set,a=r==="duplicatesServeAsOld";t.forEach(s=>{let{boundElements:l}=s;if(l!=null&&l.length>0&&(l.forEach(c=>{a&&!n.has(c.id)&&i.add(c.id)}),o.add(n.get(s.id))),Xn(s)){if(s.startBinding!=null){let{elementId:c}=s.startBinding;a&&!n.has(c)&&o.add(c)}if(s.endBinding!=null){let{elementId:c}=s.endBinding;a&&!n.has(c)&&o.add(c)}(s.startBinding!=null||s.endBinding!=null)&&i.add(n.get(s.id))}}),e.filter(({id:s})=>i.has(s)).forEach(s=>{let{startBinding:l,endBinding:c}=s;re(s,{startBinding:m3(l,n),endBinding:m3(c,n)})}),e.filter(({id:s})=>o.has(s)).forEach(s=>{let{boundElements:l}=s;l!=null&&l.length>0&&re(s,{boundElements:l.map(c=>n.has(c.id)?{id:n.get(c.id),type:c.type}:c)})})},m3=(e,t)=>{if(e==null)return null;let{elementId:n,focus:r,gap:i}=e;return{focus:r,gap:i,elementId:t.get(n)??n}},gb=(e,t)=>{let n=new Set(t.map(i=>i.id)),r=new Set;t.forEach(i=>{su(i)?i.boundElements?.forEach(o=>{n.has(o.id)||r.add(o.id)}):Xn(i)&&(i.startBinding&&r.add(i.startBinding.elementId),i.endBinding&&r.add(i.endBinding.elementId))}),e.filter(({id:i})=>r.has(i)).forEach(i=>{su(i)?re(i,{boundElements:hL(i.boundElements,n)}):Xn(i)&&re(i,{startBinding:p3(i.startBinding,n),endBinding:p3(i.endBinding,n)})})},p3=(e,t)=>e==null||t.has(e.elementId)?null:e,hL=(e,t)=>e?e.filter(n=>!t.has(n.id)):null}),Da,pe,mL,Tr=I(()=>{"use strict";D(),ur(),Pe(),rn(),wt(),la(),ne(),xe(),Ce(),Kt(),ae(),ca(),Da={version:null,points:[],zoom:null},pe=class ge{elementId;selectedPointsIndices;pointerDownState;isDragging;lastUncommittedPoint;pointerOffset;startBindingElement;endBindingElement;hoverPointIndex;segmentMidPointHoveredCoords;constructor(t){this.elementId=t.id,ge.normalizePoints(t),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.startBindingElement="keep",this.endBindingElement="keep",this.pointerDownState={prevSelectedPointsIndices:null,lastClickedPoint:-1,origin:null,segmentMidpoint:{value:null,index:null,added:!1}},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null}static POINT_HANDLE_SIZE=10;static getElement(t,n){return n.get(t)||null}static handleBoxSelection(t,n,r,i){if(!n.editingLinearElement||n.draggingElement?.type!=="selection")return!1;let{editingLinearElement:o}=n,{selectedPointsIndices:a,elementId:s}=o,l=ge.getElement(s,i);if(!l)return!1;let[c,d,u,h]=_e(n.draggingElement,i),m=ge.getPointsGlobalCoordinates(l,i).reduce((p,f,g)=>((f[0]>=c&&f[0]<=u&&f[1]>=d&&f[1]<=h||t.shiftKey&&a?.includes(g))&&p.push(g),p),[]);r({editingLinearElement:{...o,selectedPointsIndices:m.length?m:null}})}static handlePointDragging(t,n,r,i,o,a,s){if(!a)return!1;let{selectedPointsIndices:l,elementId:c}=a,d=ge.getElement(c,s);if(!d)return!1;let u=d.points[a.pointerDownState.lastClickedPoint];if(l&&u){if(Cu(t)&&l.length===1&&d.points.length>1){let h=l[0],m=d.points[h===0?1:h-1],[p,f]=ge._getShiftLockedDelta(d,s,m,[r,i],t[O.CTRL_OR_CMD]?null:n.gridSize);ge.movePoints(d,[{index:h,point:[p+m[0],f+m[1]],isDragging:h===a.pointerDownState.lastClickedPoint}])}else{let h=ge.createPointAt(d,s,r-a.pointerOffset.x,i-a.pointerOffset.y,t[O.CTRL_OR_CMD]?null:n.gridSize),m=h[0]-u[0],p=h[1]-u[1];ge.movePoints(d,l.map(f=>{let g=f===a.pointerDownState.lastClickedPoint?ge.createPointAt(d,s,r-a.pointerOffset.x,i-a.pointerOffset.y,t[O.CTRL_OR_CMD]?null:n.gridSize):[d.points[f][0]+m,d.points[f][1]+p];return{index:f,point:g,isDragging:f===a.pointerDownState.lastClickedPoint}}))}if(Ue(d,s)&&Vp(d,s,!1),Xn(d,!1)){let h=[];l[0]===0&&h.push(Ka(ge.getPointGlobalCoordinates(d,d.points[0],s)));let m=l[l.length-1];m===d.points.length-1&&h.push(Ka(ge.getPointGlobalCoordinates(d,d.points[m],s))),h.length&&o(d,h)}return!0}return!1}static handlePointerUp(t,n,r,i,o){let{elementId:a,selectedPointsIndices:s,isDragging:l,pointerDownState:c}=n,d=ge.getElement(a,o);if(!d)return n;let u={};if(l&&s){for(let h of s)if(h===0||h===d.points.length-1){ss(d.points,r.zoom.value)&&ge.movePoints(d,[{index:h,point:h===0?d.points[d.points.length-1]:d.points[0]}]);let m=el(r)?qa(Ka(ge.getPointAtIndexGlobalCoordinates(d,h,o)),i,o):null;u[h===0?"startBindingElement":"endBindingElement"]=m}}return{...n,...u,selectedPointsIndices:l||t.shiftKey?!l&&t.shiftKey&&c.prevSelectedPointsIndices?.includes(c.lastClickedPoint)?s&&s.filter(h=>h!==c.lastClickedPoint):s:s?.includes(c.lastClickedPoint)?[c.lastClickedPoint]:s,isDragging:!1,pointerOffset:{x:0,y:0}}}static getEditorMidPoints=(t,n,r)=>{let i=Ue(t,n);return!r.editingLinearElement&&t.points.length>2&&!i?[]:(Da.version===t.version&&Da.zoom===r.zoom.value||ge.updateEditorMidPointsCache(t,n,r),Da.points)};static updateEditorMidPointsCache=(t,n,r)=>{let i=ge.getPointsGlobalCoordinates(t,n),o=0,a=[];for(;o<i.length-1;){if(ge.isSegmentTooShort(t,t.points[o],t.points[o+1],r.zoom)){a.push(null),o++;continue}let s=ge.getSegmentMidPoint(t,i[o],i[o+1],o+1,n);a.push(s),o++}Da.points=a,Da.version=t.version,Da.zoom=r.zoom.value};static getSegmentMidpointHitCoords=(t,n,r,i)=>{let{elementId:o}=t,a=ge.getElement(o,i);if(!a||ge.getPointIndexUnderCursor(a,i,r.zoom,n.x,n.y)>=0||ge.getPointsGlobalCoordinates(a,i).length>=3&&!r.editingLinearElement)return null;let s=ge.POINT_HANDLE_SIZE/r.zoom.value,l=t.segmentMidPointHoveredCoords;if(l&&un(l[0],l[1],n.x,n.y)<=s)return l;let c=0,d=ge.getEditorMidPoints(a,i,r);for(;c<d.length;){if(d[c]!==null&&un(d[c][0],d[c][1],n.x,n.y)<=s)return d[c];c++}return null};static isSegmentTooShort(t,n,r,i){let o=un(n[0],n[1],r[0],r[1]);return t.points.length>2&&t.roundness&&(o=V$(t,r)),o*i.value<ge.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,r,i,o){let a=eE(n,r);if(t.points.length>2&&t.roundness){let s=D5(t,t.points[i]);if(s){let l=Y$(t,t.points[i],.5),[c,d]=L5(s[0],s[1],s[2],s[3],l);a=ge.getPointGlobalCoordinates(t,[c,d],o)}}return a}static getSegmentMidPointIndex(t,n,r,i){let o=ge.getElement(t.elementId,i);if(!o)return-1;let a=ge.getEditorMidPoints(o,i,n),s=0;for(;s<a.length;){if(ge.arePointsEqual(r,a[s]))return s+1;s++}return-1}static handlePointerDown(t,n,r,i,o,a,s){let l={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!o)return l;let{elementId:c}=o,d=ge.getElement(c,s);if(!d)return l;let u=ge.getSegmentMidpointHitCoords(o,i,n,s),h=null;if(u&&(h=ge.getSegmentMidPointIndex(o,n,u,s)),t.altKey&&n.editingLinearElement)return o.lastUncommittedPoint==null&&(re(d,{points:[...d.points,ge.createPointAt(d,s,i.x,i.y,t[O.CTRL_OR_CMD]?null:n.gridSize)]}),l.didAddPoint=!0),r.resumeRecording(),l.linearElementEditor={...o,pointerDownState:{prevSelectedPointsIndices:o.selectedPointsIndices,lastClickedPoint:-1,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:[d.points.length-1],lastUncommittedPoint:null,endBindingElement:qa(i,a,s)},l.didAddPoint=!0,l;let m=ge.getPointIndexUnderCursor(d,s,n.zoom,i.x,i.y);if(m>=0||u)l.hitElement=d;else{let{startBindingElement:k,endBindingElement:M}=o;el(n)&&Xn(d)&&Sc(d,k,M,s)}let[p,f,g,b]=_e(d,s),v=(p+g)/2,y=(f+b)/2,w=m>-1&&Ge(d.x+d.points[m][0],d.y+d.points[m][1],v,y,d.angle),T=m>-1||t.shiftKey?t.shiftKey||o.selectedPointsIndices?.includes(m)?mL([...o.selectedPointsIndices||[],m]):[m]:null;return l.linearElementEditor={...o,pointerDownState:{prevSelectedPointsIndices:o.selectedPointsIndices,lastClickedPoint:m,origin:{x:i.x,y:i.y},segmentMidpoint:{value:u,index:h,added:!1}},selectedPointsIndices:T,pointerOffset:w?{x:i.x-w[0],y:i.y-w[1]}:{x:0,y:0}},l}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:R5(t,n)}static handlePointerMove(t,n,r,i,o){if(!i.editingLinearElement)return null;let{elementId:a,lastUncommittedPoint:s}=i.editingLinearElement,l=ge.getElement(a,o);if(!l)return i.editingLinearElement;let{points:c}=l,d=c[c.length-1];if(!t.altKey)return d===s&&ge.deletePoints(l,[c.length-1]),{...i.editingLinearElement,lastUncommittedPoint:null};let u;if(Cu(t)&&c.length>=2){let h=c[c.length-2],[m,p]=ge._getShiftLockedDelta(l,o,h,[n,r],t[O.CTRL_OR_CMD]?null:i.gridSize);u=[m+h[0],p+h[1]]}else u=ge.createPointAt(l,o,n-i.editingLinearElement.pointerOffset.x,r-i.editingLinearElement.pointerOffset.y,t[O.CTRL_OR_CMD]?null:i.gridSize);return d===s?ge.movePoints(l,[{index:l.points.length-1,point:u}]):ge.addPoints(l,i,[{point:u}]),{...i.editingLinearElement,lastUncommittedPoint:l.points[l.points.length-1]}}static getPointGlobalCoordinates(t,n,r){let[i,o,a,s]=_e(t,r),l=(i+a)/2,c=(o+s)/2,{x:d,y:u}=t;return[d,u]=Ge(d+n[0],u+n[1],l,c,t.angle),[d,u]}static getPointsGlobalCoordinates(t,n){let[r,i,o,a]=_e(t,n),s=(r+o)/2,l=(i+a)/2;return t.points.map(c=>{let{x:d,y:u}=t;return[d,u]=Ge(d+c[0],u+c[1],s,l,t.angle),[d,u]})}static getPointAtIndexGlobalCoordinates(t,n,r){let i=n<0?t.points.length+n:n,[o,a,s,l]=_e(t,r),c=(o+s)/2,d=(a+l)/2,u=t.points[i],{x:h,y:m}=t;return u?Ge(h+u[0],m+u[1],c,d,t.angle):Ge(h,m,c,d,t.angle)}static pointFromAbsoluteCoords(t,n,r){let[i,o,a,s]=_e(t,r),l=(i+a)/2,c=(o+s)/2,[d,u]=Ge(n[0],n[1],l,c,-t.angle);return[d-t.x,u-t.y]}static getPointIndexUnderCursor(t,n,r,i,o){let a=ge.getPointsGlobalCoordinates(t,n),s=a.length;for(;--s>-1;){let l=a[s];if(un(i,o,l[0],l[1])*r.value<ge.POINT_HANDLE_SIZE+1)return s}return-1}static createPointAt(t,n,r,i,o){let a=Fn(r,i,o),[s,l,c,d]=_e(t,n),u=(s+c)/2,h=(l+d)/2,[m,p]=Ge(a[0],a[1],u,h,-t.angle);return[m-t.x,p-t.y]}static getNormalizedPoints(t){let{points:n}=t,r=n[0][0],i=n[0][1];return{points:n.map((o,a)=>[o[0]-r,o[1]-i]),x:t.x+r,y:t.y+i}}static normalizePoints(t){re(t,ge.getNormalizedPoints(t))}static duplicateSelectedPoints(t,n){if(!t.editingLinearElement)return!1;let{selectedPointsIndices:r,elementId:i}=t.editingLinearElement,o=ge.getElement(i,n);if(!o||r===null)return!1;let{points:a}=o,s=[],l=!1,c=-1,d=a.reduce((u,h,m)=>{if(++c,u.push(h),r.includes(m)){let p=a[m+1];p||(l=!0),u.push(p?[(h[0]+p[0])/2,(h[1]+p[1])/2]:[h[0],h[1]]),s.push(c+1),++c}return u},[]);if(re(o,{points:d}),l){let u=o.points[o.points.length-1];ge.movePoints(o,[{index:o.points.length-1,point:[u[0]+30,u[1]+30]}])}return{appState:{...t,editingLinearElement:{...t.editingLinearElement,selectedPointsIndices:s}}}}static deletePoints(t,n){let r=0,i=0;if(n.includes(0)){let a=t.points.find((s,l)=>!n.includes(l));a&&(r=a[0],i=a[1])}let o=t.points.reduce((a,s,l)=>(n.includes(l)||a.push(a.length?[s[0]-r,s[1]-i]:[0,0]),a),[]);ge._updatePoints(t,o,r,i)}static addPoints(t,n,r){let i=[...t.points,...r.map(o=>o.point)];ge._updatePoints(t,i,0,0)}static movePoints(t,n,r){let{points:i}=t,o=0,a=0,s=n.find(({index:c})=>c===0);s&&(o=s.point[0]+i[s.index][0],a=s.point[1]+i[s.index][1]);let l=i.map((c,d)=>{let u=n.find(h=>h.index===d);if(u){if(s)return c;let h=u.point[0]-i[u.index][0],m=u.point[1]-i[u.index][1];return[c[0]+h,c[1]+m]}return o||a?[c[0]-o,c[1]-a]:c});ge._updatePoints(t,l,o,a,r)}static shouldAddMidpoint(t,n,r,i){if(!ge.getElement(t.elementId,i))return!1;let{segmentMidpoint:o}=t.pointerDownState;if(o.added||o.value===null||o.index===null||t.pointerDownState.origin===null)return!1;let a=t.pointerDownState.origin,s=un(a.x,a.y,n.x,n.y);return!(!r.editingLinearElement&&s<Us/r.zoom.value)}static addMidpoint(t,n,r,i,o){let a=ge.getElement(t.elementId,o);if(!a)return;let{segmentMidpoint:s}=t.pointerDownState,l={pointerDownState:t.pointerDownState,selectedPointsIndices:t.selectedPointsIndices},c=ge.createPointAt(a,o,n.x,n.y,i?r.gridSize:null),d=[...a.points.slice(0,s.index),c,...a.points.slice(s.index)];return re(a,{points:d}),l.pointerDownState={...t.pointerDownState,segmentMidpoint:{...t.pointerDownState.segmentMidpoint,added:!0},lastClickedPoint:s.index},l.selectedPointsIndices=[s.index],l}static _updatePoints(t,n,r,i,o){let a=Yp(t,n),s=Yp(t,t.points),l=(a[0]+a[2])/2,c=(a[1]+a[3])/2,d=(s[0]+s[2])/2,u=(s[1]+s[3])/2,h=d-l,m=u-c,p=Ge(r,i,h,m,t.angle);re(t,{...o,points:n,x:t.x+p[0],y:t.y+p[1]})}static _getShiftLockedDelta(t,n,r,i,o){let a=ge.getPointGlobalCoordinates(t,r,n),[s,l]=Fn(i[0],i[1],o),{width:c,height:d}=yE(a[0],a[1],s,l);return Wt([c,d],[0,0],-t.angle)}static getBoundTextElementPosition=(t,n,r)=>{let i=ge.getPointsGlobalCoordinates(t,r);i.length<2&&re(n,{isDeleted:!0});let o=0,a=0;if(t.points.length%2===1){let s=Math.floor(t.points.length/2),l=ge.getPointGlobalCoordinates(t,t.points[s],r);o=l[0]-n.width/2,a=l[1]-n.height/2}else{let s=t.points.length/2-1,l=Da.points[s];t.points.length===2&&(l=eE(i[0],i[1])),(!l||Da.version!==t.version)&&(l=ge.getSegmentMidPoint(t,i[s],i[s+1],s+1,r)),o=l[0]-n.width/2,a=l[1]-n.height/2}return{x:o,y:a}};static getMinMaxXYWithBoundText=(t,n,r,i)=>{let[o,a,s,l]=r,c=(o+s)/2,d=(a+l)/2,{x:u,y:h}=ge.getBoundTextElementPosition(t,i,n),m=u+i.width,p=h+i.height,f=Wt([o,a],[c,d],t.angle),g=Wt([s,a],[c,d],t.angle),b=Wt([u,h],[c,d],-t.angle),v=Wt([m,h],[c,d],-t.angle),y=Wt([u,p],[c,d],-t.angle),w=Wt([m,p],[c,d],-t.angle);return f[0]<g[0]&&f[1]>=g[1]?(o=Math.min(o,y[0]),s=Math.max(s,Math.max(v[0],w[0])),a=Math.min(a,b[1]),l=Math.max(l,w[1])):f[0]>=g[0]&&f[1]>g[1]?(o=Math.min(o,w[0]),s=Math.max(s,Math.max(b[0],v[0])),a=Math.min(a,y[1]),l=Math.max(l,v[1])):f[0]>=g[0]?(o=Math.min(o,v[0]),s=Math.max(s,y[0]),a=Math.min(a,w[1]),l=Math.max(l,b[1])):f[1]<=g[1]&&(o=Math.min(o,Math.min(v[0],b[0])),s=Math.max(s,w[0]),a=Math.min(a,v[1]),l=Math.max(l,y[1])),[o,a,s,l,c,d]};static getElementAbsoluteCoords=(t,n,r=!1)=>{let i,o,a,s,l;if(t.points.length<2||!jt.get(t)){let{minX:h,minY:m,maxX:p,maxY:f}=t.points.reduce((g,[b,v])=>(g.minY=Math.min(g.minY,v),g.minX=Math.min(g.minX,b),g.maxX=Math.max(g.maxX,b),g.maxY=Math.max(g.maxY,v),g),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});o=h+t.x,a=m+t.y,s=p+t.x,l=f+t.y}else{let h=jt.generateElementShape(t,null),m=ja(h[0]),[p,f,g,b]=cp(m);o=p+t.x,a=f+t.y,s=g+t.x,l=b+t.y}let c=(o+s)/2,d=(a+l)/2;if(i=[o,a,s,l,c,d],!r)return i;let u=Ue(t,n);return u&&(i=ge.getMinMaxXYWithBoundText(t,n,[o,a,s,l],u)),i}},mL=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,r)=>n-r),t.length?t:null}}),pc,Up,cT,bF,dT=I(()=>{"use strict";D(),pc={},Up=(e,t)=>{let n=pc[e]||(pc[e]={height:t});return n.height=t,n},cT=e=>{pc[e]&&delete pc[e]},bF=e=>pc[e]?.height??null}),ju,vg,bo,uT,Vp,Mp,Qa,yF,Mu,hT,mT,f3,Ud,lp,pL,fL,Iu,g3,E3,pT,gL,tl,Ue,cr,T2,j5,vF,xF,wF,U5,EL,SF,nl,po,bu,TF,xg,b3,gl,Kt=I(()=>{"use strict";D(),ne(),wt(),ae(),Pe(),xe(),Tr(),xe(),Pe(),pt(),Zc(),dT(),ju=e=>tT(e).replace(/\t/g," "),vg=e=>ju(e).split(`
116
- `),bo=(e,t,n)=>{let r,i={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height};i.text=e.text,t&&(r=po(t,e),i.text=Iu(e.originalText,xn(e),r));let o=Qa(i.text,xn(e),e.lineHeight);if(i.width=o.width,i.height=o.height,t){let a=bu(t,e),s=po(t,e);if(!yt(t)&&o.height>a){let u=nl(o.height,t.type);re(t,{height:u}),Up(t.id,u)}if(o.width>s){let u=nl(o.width,t.type);re(t,{width:u})}let l={...e,...i},{x:c,y:d}=Mp(t,l,n);i.x=c,i.y=d}re(e,i)},uT=(e,t,n)=>{let r=Fe(e);t.forEach(i=>{let o=n.get(i.id),a=tl(i);if(a){let s=n.get(a);if(s){let l=r.get(o);l&&re(l,{boundElements:(i.boundElements||[]).filter(d=>d.id!==s&&d.id!==a).concat({type:"text",id:s})});let c=r.get(s);c&&he(c)&&re(c,{containerId:l?o:null})}}})},Vp=(e,t,n,r=!1)=>{if(!tl(e))return;cT(e.id);let i=Ue(e,t);if(i&&i.text){if(!e)return;let o=i.text,a=i.height,s=i.width,l=po(e,i),c=bu(e,i),d=e.height;if(r||n!=="n"&&n!=="s"){o&&(o=Iu(i.originalText,xn(i),l));let u=Qa(o,xn(i),i.lineHeight);a=u.height,s=u.width}if(a>c){d=nl(a,e.type);let u=d-e.height,h=!yt(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-u:e.y;re(e,{height:d,y:h})}re(i,{text:o,width:s,height:a}),yt(e)||re(i,Mp(e,i,t))}},Mp=(e,t,n)=>{if(yt(e))return pe.getBoundTextElementPosition(e,t,n);let r=j5(e),i=bu(e,t),o=po(e,t),a,s;return t.verticalAlign===Nr.TOP?s=r.y:t.verticalAlign===Nr.BOTTOM?s=r.y+(i-t.height):s=r.y+(i/2-t.height/2),t.textAlign===Hu.LEFT?a=r.x:t.textAlign===Hu.RIGHT?a=r.x+(o-t.width):a=r.x+(o/2-t.width/2),{x:a,y:s}},Qa=(e,t,n)=>{e=e.split(`
117
- `).map(o=>o||" ").join(`
118
- `);let r=parseFloat(t),i=pL(e,r,n);return{width:lp(e,t),height:i}},yF=e=>{let t=vg(e.text).length;return e.height/t/e.fontSize},Mu=(e,t)=>e*t,hT=(e,t,n)=>{let{unitsPerEm:r,ascender:i,descender:o}=b3[e]||b3[zn.Helvetica],a=t/r,s=n-a*i+a*o;return a*i+s},mT=(e,t)=>Mu(e,t)+yn*2,Ud=(e,t)=>{f3||(f3=document.createElement("canvas"));let n=f3.getContext("2d");n.font=t;let r=n.measureText(e).width;return fl()?r*10:r},lp=(e,t)=>{let n=vg(e),r=0;return n.forEach(i=>{r=Math.max(r,Ud(i,t))}),r},pL=(e,t,n)=>{let r=vg(e).length;return Mu(t,n)*r},fL=e=>{let t=e.split("-");return t.length>1&&t.forEach((n,r)=>{r!==t.length-1&&(t[r]=n+="-")}),t.join(" ").split(" ")},Iu=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return e;let r=[],i=e.split(`
119
- `),o=Ud(" ",t),a="",s=0,l=d=>{d.trim()&&r.push(d)},c=()=>{a="",s=0};return i.forEach(d=>{if(lp(d,t)<=n){r.push(d);return}let u=fL(d);c();let h=0;for(;h<u.length;){let m=Ud(u[h],t);if(m===n)l(u[h]),h++;else if(m>n){for(l(a),c();u[h].length>0;){let p=String.fromCodePoint(u[h].codePointAt(0)),f=g3.calculate(p,t);s+=f,u[h]=u[h].slice(p.length),s>=n?(l(a),a=p,s=f):a+=p}s+o>=n?(l(a),c()):a.endsWith("-")||(a+=" ",s+=o),h++}else for(;s<n&&h<u.length;){let p=u[h];if(s=Ud(a+p,t),s>n){l(a),c();break}h++;let f=!p.endsWith("-");if(a+=p,f&&(a+=" "),s+o>=n){f?r.push(a.slice(0,-1)):r.push(a),c();break}}}a.slice(-1)===" "&&(a=a.slice(0,-1),l(a))}),r.join(`
120
- `)},g3=(()=>{let e={};return{calculate:(t,n)=>{let r=t.charCodeAt(0);if(e[n]||(e[n]=[]),!e[n][r]){let i=Ud(t,n);e[n][r]=i}return e[n][r]},getCache:t=>e[t]}})(),E3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),pT=(e,t)=>{let n=gL(e);return n===0?Qa(E3.split("").join(`
121
- `),e,t).width+yn*2:n+yn*2},gL=e=>{let t=g3.getCache(e);if(!t)return 0;let n=t.filter(r=>r!==void 0);return Math.max(...n)},tl=e=>e?.boundElements?.length&&e?.boundElements?.filter(t=>t.type==="text")[0]?.id||null,Ue=(e,t)=>{if(!e)return null;let n=tl(e);return n&&t.get(n)||null},cr=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,T2=(e,t,n)=>{if(!yt(e))return{x:e.x+e.width/2,y:e.y+e.height/2};let r=pe.getPointsGlobalCoordinates(e,n);if(r.length%2===1){let a=Math.floor(e.points.length/2),s=pe.getPointGlobalCoordinates(e,e.points[a],n);return{x:s[0],y:s[1]}}let i=e.points.length/2-1,o=pe.getEditorMidPoints(e,n,t)[i];return o||(o=pe.getSegmentMidPoint(e,r[i],r[i+1],i+1,n)),{x:o[0],y:o[1]}},j5=e=>{let t=yn,n=yn;return e.type==="ellipse"&&(t+=e.width/2*(1-Math.sqrt(2)/2),n+=e.height/2*(1-Math.sqrt(2)/2)),e.type==="diamond"&&(t+=e.width/4,n+=e.height/4),{x:e.x+t,y:e.y+n}},vF=(e,t)=>!t||yt(t)?e.angle:t.angle,xF=(e,t)=>e.some(n=>{if(pn(n)){let r=cr(n,t);return!yt(r)}return!1}),wF=(e,t)=>e.some(n=>{if(pn(n)){let r=cr(n,t);return!yt(r)}return he(n)}),U5=(e,t,n,r,i)=>{let o=st(e,t);if(o.length===1)return ul(o[0],!1)?o[0]:null;let a=null;for(let s=e.length-1;s>=0;--s){if(e[s].isDeleted)continue;let[l,c,d,u]=_e(e[s],i);if(yt(e[s])&&Tu(e[s],t,null,[n,r],i)){a=e[s];break}else if(l<n&&n<d&&c<r&&r<u){a=e[s];break}}return ul(a,!1)?a:null},EL=new Set(["rectangle","ellipse","diamond","arrow"]),SF=e=>EL.has(e.type),nl=(e,t)=>{e=Math.ceil(e);let n=yn*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},po=(e,t)=>{let{width:n}=e;if(yt(e)){let r=(t?.fontSize??Ni)*C$;return Math.max(T$*n,r)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-yn*2:e.type==="diamond"?Math.round(n/2)-yn*2:n-yn*2},bu=(e,t)=>{let{height:n}=e;return yt(e)?n-yn*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-yn*2:e.type==="diamond"?Math.round(n/2)-yn*2:n-yn*2},TF=()=>lp(E3,xn({fontSize:Ni,fontFamily:aa}))>0,xg={[zn.Virgil]:1.25,[zn.Helvetica]:1.15,[zn.Cascadia]:1.2},b3={[zn.Virgil]:{unitsPerEm:1e3,ascender:886,descender:-374},[zn.Helvetica]:{unitsPerEm:2048,ascender:1577,descender:-471},[zn.Cascadia]:{unitsPerEm:2048,ascender:1977,descender:-480},[zn.Assistant]:{unitsPerEm:1e3,ascender:1021,descender:-287}},gl=e=>e in xg?xg[e]:xg[aa]}),bL,_e,V5,CF,MF,ja,y3,v3,yL,cp,wg,vL,xL,wL,IF,SL,TL,rl,Nt,C2,yu,Yp,kF,ia,OJ,rn=I(()=>{"use strict";D(),ur(),Q$(),xe(),mb(),Kt(),Tr(),ca(),ne(),bL=class M2{static boundsCache=new WeakMap;static getBounds(t,n){let r=M2.boundsCache.get(t);if(r?.version&&r.version===t.version&&!pn(t))return r.bounds;let i=M2.calculateBounds(t,n);return M2.boundsCache.set(t,{version:t.version,bounds:i}),i}static calculateBounds(t,n){let r,[i,o,a,s,l,c]=_e(t,n);if(vr(t)){let[d,u,h,m]=wg(t.points.map(([p,f])=>Ge(p,f,l-t.x,c-t.y,t.angle)));return[d+t.x,u+t.y,h+t.x,m+t.y]}else if(Ne(t))r=TL(t,l,c,n);else if(t.type==="diamond"){let[d,u]=Ge(l,o,l,c,t.angle),[h,m]=Ge(l,s,l,c,t.angle),[p,f]=Ge(i,c,l,c,t.angle),[g,b]=Ge(a,c,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),T=Math.max(u,m,f,b);r=[v,y,w,T]}else if(t.type==="ellipse"){let d=(a-i)/2,u=(s-o)/2,h=Math.cos(t.angle),m=Math.sin(t.angle),p=Math.hypot(d*h,u*m),f=Math.hypot(u*h,d*m);r=[l-p,c-f,l+p,c+f]}else{let[d,u]=Ge(i,o,l,c,t.angle),[h,m]=Ge(i,s,l,c,t.angle),[p,f]=Ge(a,s,l,c,t.angle),[g,b]=Ge(a,o,l,c,t.angle),v=Math.min(d,h,p,g),y=Math.min(u,m,f,b),w=Math.max(d,h,p,g),T=Math.max(u,m,f,b);r=[v,y,w,T]}return r}},_e=(e,t,n=!1)=>{if(vr(e))return vL(e);if(Ne(e))return pe.getElementAbsoluteCoords(e,t,n);if(he(e)){let r=t?cr(e,t):null;if(yt(r)){let i=pe.getBoundTextElementPosition(r,e,t);return[i.x,i.y,i.x+e.width,i.y+e.height,i.x+e.width/2,i.y+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},V5=(e,t)=>{let[n,r,i,o,a,s]=_e(e,t),l=[a,s];if(Ne(e)||vr(e)){let b=[],v=0;for(;v<e.points.length-1;)b.push([Wt([e.points[v][0]+e.x,e.points[v][1]+e.y],l,e.angle),Wt([e.points[v+1][0]+e.x,e.points[v+1][1]+e.y],l,e.angle)]),v++;return b}let[c,d,u,h,m,p,f,g]=[[n,r],[i,r],[n,o],[i,o],[a,r],[a,o],[n,s],[i,s]].map(b=>Wt(b,l,e.angle));return e.type==="diamond"?[[m,f],[m,g],[p,f],[p,g]]:e.type==="ellipse"?[[m,f],[m,g],[p,f],[p,g],[m,f],[m,g],[p,f],[p,g]]:[[c,d],[u,h],[c,u],[d,h],[c,g],[u,g],[d,f],[h,f]]},CF=e=>[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2],MF=e=>{let t=Math.floor(e.width/2)+1,n=0,r=e.width,i=Math.floor(e.height/2)+1,o=t,a=e.height;return[t,n,r,i,o,a,0,i]},ja=e=>{for(let t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},y3=(e,t,n,r,i)=>{let o=1-e;return Math.pow(o,3)*t+3*Math.pow(o,2)*e*n+3*o*Math.pow(e,2)*r+Math.pow(e,3)*i},v3=(e,t,n,r)=>{let i=t-e,o=n-t,a=r-n,s=3*i-6*o+3*a,l=6*o-6*i,c=3*i,d=l*l-4*s*c;if(!(d>=0))return!1;let u=null,h=null,m=1/0,p=1/0;return s===0?m=p=-c/l:(m=(-l+Math.sqrt(d))/(2*s),p=(-l-Math.sqrt(d))/(2*s)),m>=0&&m<=1&&(u=y3(m,e,t,n,r)),p>=0&&p<=1&&(h=y3(p,e,t,n,r)),[u,h]},yL=(e,t,n,r)=>{let i=v3(e[0],t[0],n[0],r[0]),o=v3(e[1],t[1],n[1],r[1]),a=Math.min(e[0],r[0]),s=Math.max(e[0],r[0]);if(i){let d=i.filter(u=>u!==null);a=Math.min(a,...d),s=Math.max(s,...d)}let l=Math.min(e[1],r[1]),c=Math.max(e[1],r[1]);if(o){let d=o.filter(u=>u!==null);l=Math.min(l,...d),c=Math.max(c,...d)}return[a,l,s,c]},cp=(e,t)=>{let n=[0,0],{minX:r,minY:i,maxX:o,maxY:a}=e.reduce((s,{op:l,data:c})=>{if(l==="move")n=c;else if(l==="bcurveTo"){let d=[c[0],c[1]],u=[c[2],c[3]],h=[c[4],c[5]],m=t?t(...d):d,p=t?t(...u):u,f=t?t(...h):h,g=t?t(...n):n;n=h;let[b,v,y,w]=yL(g,m,p,f);s.minX=Math.min(s.minX,b),s.minY=Math.min(s.minY,v),s.maxX=Math.max(s.maxX,y),s.maxY=Math.max(s.maxY,w)}return s},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[r,i,o,a]},wg=e=>{let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),i=Math.max(i,a);return[t,n,r,i]},vL=e=>{let[t,n,r,i]=wg(e.points),o=t+e.x,a=n+e.y,s=r+e.x,l=i+e.y;return[o,a,s,l,(o+s)/2,(a+l)/2]},xL=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;default:return 15}},wL=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},IF=(e,t,n,r)=>{let i=ja(t[0]);if(i.length<1)return null;let o=n==="start"?1:i.length-1,a=i[o].data,s=[a[4],a[5]],l=[a[2],a[3]],c=[a[0],a[1]],d=i[o-1],u=[0,0];d.op==="move"?u=d.data:d.op==="bcurveTo"&&(u=[d.data[4],d.data[5]]);let h=(W,H)=>Math.pow(1-W,3)*s[H]+3*W*Math.pow(1-W,2)*l[H]+3*Math.pow(W,2)*(1-W)*c[H]+u[H]*Math.pow(W,3),[m,p]=n==="start"?u:s,[f,g]=[h(.3,0),h(.3,1)],b=Math.hypot(m-f,p-g),v=(m-f)/b,y=(p-g)/b,w=xL(r),T=0;{let[W,H]=n==="end"?e.points[e.points.length-1]:e.points[0],[K,Q]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];T=Math.hypot(W-K,H-Q)}let k=Math.min(w,T*(r==="diamond"||r==="diamond_outline"?.25:.5)),M=m-v*k,C=p-y*k;if(r==="dot"||r==="circle"||r==="circle_outline"){let W=Math.hypot(C-p,M-m)+e.strokeWidth-2;return[m,p,W]}let P=wL(r),[R,A]=Ge(M,C,m,p,-P*Math.PI/180),[_,$]=Ge(M,C,m,p,P*Math.PI/180);if(r==="diamond"||r==="diamond_outline"){let W,H;if(n==="start"){let[K,Q]=e.points.length>1?e.points[1]:[0,0];[W,H]=Ge(m+k*2,p,m,p,Math.atan2(Q-p,K-m))}else{let[K,Q]=e.points.length>1?e.points[e.points.length-2]:[0,0];[W,H]=Ge(m-k*2,p,m,p,Math.atan2(p-Q,m-K))}return[m,p,R,A,W,H,_,$]}return[m,p,R,A,_,$]},SL=e=>{let t=qt.generator(),n=qr(e),r=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[r](e.points,n)},TL=(e,t,n,r)=>{let i=Ue(e,r);if(e.points.length<2){let[c,d]=e.points[0],[u,h]=Ge(e.x+c,e.y+d,t,n,e.angle),m=[u,h,u,h];if(i){let p=pe.getMinMaxXYWithBoundText(e,r,[u,h,u,h],i);m=[p[0],p[1],p[2],p[3]]}return m}let o=jt.get(e)?.[0]??SL(e),a=ja(o),s=cp(a,(c,d)=>Ge(e.x+c,e.y+d,t,n,e.angle)),l=[s[0],s[1],s[2],s[3]];if(i){let c=pe.getMinMaxXYWithBoundText(e,r,l,i);l=[c[0],c[1],c[2],c[3]]}return l},rl=(e,t)=>bL.getBounds(e,t),Nt=e=>{if(!e.length)return[0,0,0,0];let t=1/0,n=-1/0,r=1/0,i=-1/0,o=Fe(e);return e.forEach(a=>{let[s,l,c,d]=rl(a,o);t=Math.min(t,s),r=Math.min(r,l),n=Math.max(n,c),i=Math.max(i,d)}),[t,r,n,i]},C2=(e,t)=>{let[n,r,i,o]=Nt(e);return[n+t.x,r+t.y,i+t.x,o+t.y]},yu=(e,t,n,r)=>{if(!(Ne(e)||vr(e)))return[e.x,e.y,e.x+t,e.y+n];let i=vc(0,t,vc(1,n,e.points,r),r),o;if(vr(e))o=wg(i);else{let d=qt.generator(),u=e.roundness?d.curve(i,qr(e)):d.linearPath(i,qr(e)),h=ja(u);o=cp(h)}let[a,s,l,c]=o;return[a+e.x,s+e.y,l+e.x,c+e.y]},Yp=(e,t)=>{let n=qt.generator(),r=e.roundness==null?n.linearPath(t,qr(e)):n.curve(t,qr(e)),i=ja(r),[o,a,s,l]=cp(i);return[o+e.x,a+e.y,s+e.x,l+e.y]},kF=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,r=e[0],i=Fe(e);return e.forEach(o=>{let[a,s,l,c]=rl(o,i),d=un((a+l)/2,(s+c)/2,t.x,t.y);d<n&&(n=d,r=o)}),rl(r,i)},ia=e=>{let[t,n,r,i]=Nt(e);return{minX:t,minY:n,maxX:r,maxY:i,width:r-t,height:i-n,midX:(t+r)/2,midY:(n+i)/2}},OJ=({scrollX:e,scrollY:t,width:n,height:r,zoom:i})=>[-e,-t,-e+n/i.value,-t+r/i.value]}),CL,ml,ML,Sg,NJ,fT,AF,uo,Hc,$i=I(()=>{"use strict";D(),ae(),CL=cb.includes(devicePixelRatio)?devicePixelRatio:1,ml=()=>({showWelcomeScreen:!1,theme:$e.LIGHT,collaborators:new Map,currentChartType:"bar",currentItemBackgroundColor:Yt.backgroundColor,currentItemEndArrowhead:"arrow",currentItemFillStyle:Yt.fillStyle,currentItemFontFamily:aa,currentItemFontSize:Ni,currentItemOpacity:Yt.opacity,currentItemRoughness:Yt.roughness,currentItemStartArrowhead:null,currentItemStrokeColor:Yt.strokeColor,currentItemRoundness:"round",currentItemStrokeStyle:Yt.strokeStyle,currentItemStrokeWidth:Yt.strokeWidth,currentItemTextAlign:Df,cursorButton:"up",activeEmbeddable:null,draggingElement:null,editingElement:null,editingGroupId:null,editingLinearElement:null,activeTool:{type:"selection",customType:null,locked:Yt.locked,lastActiveTool:null},penMode:!1,penDetected:!1,errorMessage:null,exportBackground:!0,exportScale:CL,exportEmbedScene:!1,exportWithDarkMode:!1,fileHandle:null,gridSize:null,isBindingEnabled:!0,defaultSidebarDockedPreference:!1,isLoading:!1,isResizing:!1,isRotating:!1,lastPointerDownWith:"mouse",multiElement:null,name:null,contextMenu:null,openMenu:null,openPopup:null,openSidebar:null,openDialog:null,pasteDialog:{shown:!1,data:null},previousSelectedElementIds:{},resizingElement:null,scrolledOutside:!1,scrollX:0,scrollY:0,selectedElementIds:{},selectedGroupIds:{},selectedElementsAreBeingDragged:!1,selectionElement:null,shouldCacheIgnoreZoom:!1,showStats:!1,startBoundElement:null,suggestedBindings:[],frameRendering:{enabled:!0,clip:!0,name:!0,outline:!0},frameToHighlight:null,editingFrame:null,elementsToHighlight:null,toast:null,viewBackgroundColor:Li,zenModeEnabled:!1,zoom:{value:VS},viewModeEnabled:!1,pendingImageElementId:null,showHyperlinkPopup:!1,selectedLinearElement:null,snapLines:[],originSnapOffset:{x:0,y:0},objectsSnapModeEnabled:!1,userToFollow:null,followedBy:new Set}),ML=(e=>e)({showWelcomeScreen:{browser:!0,export:!1,server:!1},theme:{browser:!0,export:!1,server:!1},collaborators:{browser:!1,export:!1,server:!1},currentChartType:{browser:!0,export:!1,server:!1},currentItemBackgroundColor:{browser:!0,export:!1,server:!1},currentItemEndArrowhead:{browser:!0,export:!1,server:!1},currentItemFillStyle:{browser:!0,export:!1,server:!1},currentItemFontFamily:{browser:!0,export:!1,server:!1},currentItemFontSize:{browser:!0,export:!1,server:!1},currentItemRoundness:{browser:!0,export:!1,server:!1},currentItemOpacity:{browser:!0,export:!1,server:!1},currentItemRoughness:{browser:!0,export:!1,server:!1},currentItemStartArrowhead:{browser:!0,export:!1,server:!1},currentItemStrokeColor:{browser:!0,export:!1,server:!1},currentItemStrokeStyle:{browser:!0,export:!1,server:!1},currentItemStrokeWidth:{browser:!0,export:!1,server:!1},currentItemTextAlign:{browser:!0,export:!1,server:!1},cursorButton:{browser:!0,export:!1,server:!1},activeEmbeddable:{browser:!1,export:!1,server:!1},draggingElement:{browser:!1,export:!1,server:!1},editingElement:{browser:!1,export:!1,server:!1},editingGroupId:{browser:!0,export:!1,server:!1},editingLinearElement:{browser:!1,export:!1,server:!1},activeTool:{browser:!0,export:!1,server:!1},penMode:{browser:!0,export:!1,server:!1},penDetected:{browser:!0,export:!1,server:!1},errorMessage:{browser:!1,export:!1,server:!1},exportBackground:{browser:!0,export:!1,server:!1},exportEmbedScene:{browser:!0,export:!1,server:!1},exportScale:{browser:!0,export:!1,server:!1},exportWithDarkMode:{browser:!0,export:!1,server:!1},fileHandle:{browser:!1,export:!1,server:!1},gridSize:{browser:!0,export:!0,server:!0},height:{browser:!1,export:!1,server:!1},isBindingEnabled:{browser:!1,export:!1,server:!1},defaultSidebarDockedPreference:{browser:!0,export:!1,server:!1},isLoading:{browser:!1,export:!1,server:!1},isResizing:{browser:!1,export:!1,server:!1},isRotating:{browser:!1,export:!1,server:!1},lastPointerDownWith:{browser:!0,export:!1,server:!1},multiElement:{browser:!1,export:!1,server:!1},name:{browser:!0,export:!1,server:!1},offsetLeft:{browser:!1,export:!1,server:!1},offsetTop:{browser:!1,export:!1,server:!1},contextMenu:{browser:!1,export:!1,server:!1},openMenu:{browser:!0,export:!1,server:!1},openPopup:{browser:!1,export:!1,server:!1},openSidebar:{browser:!0,export:!1,server:!1},openDialog:{browser:!1,export:!1,server:!1},pasteDialog:{browser:!1,export:!1,server:!1},previousSelectedElementIds:{browser:!0,export:!1,server:!1},resizingElement:{browser:!1,export:!1,server:!1},scrolledOutside:{browser:!0,export:!1,server:!1},scrollX:{browser:!0,export:!1,server:!1},scrollY:{browser:!0,export:!1,server:!1},selectedElementIds:{browser:!0,export:!1,server:!1},selectedGroupIds:{browser:!0,export:!1,server:!1},selectedElementsAreBeingDragged:{browser:!1,export:!1,server:!1},selectionElement:{browser:!1,export:!1,server:!1},shouldCacheIgnoreZoom:{browser:!0,export:!1,server:!1},showStats:{browser:!0,export:!1,server:!1},startBoundElement:{browser:!1,export:!1,server:!1},suggestedBindings:{browser:!1,export:!1,server:!1},frameRendering:{browser:!1,export:!1,server:!1},frameToHighlight:{browser:!1,export:!1,server:!1},editingFrame:{browser:!1,export:!1,server:!1},elementsToHighlight:{browser:!1,export:!1,server:!1},toast:{browser:!1,export:!1,server:!1},viewBackgroundColor:{browser:!0,export:!0,server:!0},width:{browser:!1,export:!1,server:!1},zenModeEnabled:{browser:!0,export:!1,server:!1},zoom:{browser:!0,export:!1,server:!1},viewModeEnabled:{browser:!1,export:!1,server:!1},pendingImageElementId:{browser:!1,export:!1,server:!1},showHyperlinkPopup:{browser:!1,export:!1,server:!1},selectedLinearElement:{browser:!0,export:!1,server:!1},snapLines:{browser:!1,export:!1,server:!1},originSnapOffset:{browser:!1,export:!1,server:!1},objectsSnapModeEnabled:{browser:!0,export:!1,server:!1},userToFollow:{browser:!1,export:!1,server:!1},followedBy:{browser:!1,export:!1,server:!1}}),Sg=(e,t)=>{let n={};for(let r of Object.keys(e))if(ML[r]?.[t]){let i=e[r];n[r]=i}return n},NJ=e=>Sg(e,"browser"),fT=e=>Sg(e,"export"),AF=e=>Sg(e,"server"),uo=({activeTool:e})=>e.type==="eraser",Hc=({activeTool:e})=>e.type==="hand"}),Y5,Lr,gT,Z5,Tc,ET,_F,Uu,hn,PF,DF,LF,RF,Zp,Fi=I(()=>{"use strict";D(),pt(),Kt(),Kc(),Y5=(e,t,n)=>{let r=n.reduce((i,o)=>(o.groupIds.includes(e)&&(i[o.id]=!0),i),{});return Object.keys(r).length<2?t.selectedGroupIds[e]||t.editingGroupId===e?{selectedElementIds:t.selectedElementIds,selectedGroupIds:{...t.selectedGroupIds,[e]:!1},editingGroupId:null}:t:{editingGroupId:t.editingGroupId,selectedGroupIds:{...t.selectedGroupIds,[e]:!0},selectedElementIds:{...t.selectedElementIds,...r}}},Lr=function(){let e=null,t=null,n=null,r=(o,a,s,l)=>{if(n!==void 0&&a===t&&o===e&&s.editingGroupId===n?.editingGroupId)return n;let c={};for(let h of o){let m=h.groupIds;if(s.editingGroupId){let p=m.indexOf(s.editingGroupId);p>-1&&(m=m.slice(0,p))}if(m.length>0){let p=m[m.length-1];c[p]=!0}}let d={},u=a.reduce((h,m)=>{let p=m.groupIds.find(f=>c[f]);return p&&(h[m.id]=!0,Array.isArray(d[p])?d[p].push(m.id):d[p]=[m.id]),h},{});for(let h of Object.keys(d))d[h].length<2&&c[h]&&(c[h]=!1);return t=a,e=o,n={editingGroupId:s.editingGroupId,selectedGroupIds:c,selectedElementIds:rt({...s.selectedElementIds,...u},l)},n},i=(o,a,s,l)=>{let c=l?l.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,elements:a}):st(a,o);return c.length?r(c,a,o,s):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:rt(o.selectedElementIds,s)}};return i.clearCache=()=>{t=null,e=null,n=null},i}(),gT=(e,t)=>Z5(e,t)!=null,Z5=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),Tc=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),ET=(e,t)=>{let n={...t,selectedGroupIds:{}};for(let r of e){let i=r.groupIds;if(t.editingGroupId){let o=i.indexOf(t.editingGroupId);o>-1&&(i=i.slice(0,o))}if(i.length>0){let o=i[i.length-1];n={...n,...Y5(o,n,e)}}}return n.selectedGroupIds},_F=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),Uu=(e,t)=>e.groupIds.includes(t),hn=(e,t)=>{let n=[];for(let r of e.values())Uu(r,t)&&n.push(r);return n},PF=(e,t)=>e.groupIds.find(n=>t[n]),DF=(e,t,n)=>{let r=[...e],i=t?e.indexOf(t):-1,o=i>-1?i:e.length;for(let a=0;a<o;a++)r[a]=n(r[a]);return r},LF=(e,t,n)=>{let r=[...e],i=n?r.indexOf(n):-1,o=i>-1?i:r.length;return r.splice(o,0,t),r},RF=(e,t)=>e.filter(n=>!t[n]),Zp=(e,t)=>{let n=new Map;return e.forEach(r=>{let i=r.groupIds.length===0?r.id:r.groupIds[r.groupIds.length-1],o=n.get(i)||[],a=Ue(r,t);a&&o.push(a),n.set(i,[...o,r])}),Array.from(n.values())}}),sE,wo,bT,yT,dh=I(()=>{"use strict";D(),sE=e=>e.replace(/"/g,"&quot;"),wo=e=>(e=e.trim(),e&&(0,OF.sanitizeUrl)(sE(e))),bT=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),yT=e=>{if(e=wo(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e}}),I2,oe,xt=I(()=>{"use strict";D(),I2=[],oe=e=>(I2=I2.concat(e),e)}),x3,IL,w3,kL,AL,Ii,mt,Xo,_L,X5,lo,Of=I(()=>{"use strict";D(),ae(),$i(),x3='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',IL='<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"/>',w3='<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"/>',kL=`data:${ve.svg},${encodeURIComponent(`${x3}${w3}</svg>`)}`,AL=`data:${ve.svg},${encodeURIComponent(`${x3}${IL}${w3}</svg>`)}`,Ii=e=>{e&&(e.style.cursor="")},mt=(e,t)=>{e&&(e.style.cursor=t)},X5=(e,t)=>{let n=()=>{let r=t===$e.DARK;Xo=document.createElement("canvas"),Xo.theme=t,Xo.height=20,Xo.width=20;let i=Xo.getContext("2d");i.lineWidth=1,i.beginPath(),i.arc(Xo.width/2,Xo.height/2,5,0,2*Math.PI),i.fillStyle=r?Ct.black:Ct.white,i.fill(),i.strokeStyle=r?Ct.white:Ct.black,i.stroke(),_L=Xo.toDataURL(ve.svg)};(!Xo||Xo.theme!==t)&&n(),mt(e,`url(${_L}) ${20/2} ${20/2}, auto`)},lo=(e,t)=>{if(e)if(t.activeTool.type==="selection")Ii(e);else if(Hc(t))e.style.cursor=ut.GRAB;else if(uo(t))X5(e,t.theme);else if(t.activeTool.type==="laser"){let n=t.theme===$e.LIGHT?kL:AL;e.style.cursor=`url(${n}), auto`}else if(!["image","custom"].includes(t.activeTool.type))e.style.cursor=ut.CROSSHAIR;else if(t.activeTool.type==="custom"&&t.activeTool.customType==="comment"){let n=`data:${ve.svg},${encodeURIComponent(`
122
- <svg
123
- width="24"
124
- height="24"
125
- viewBox="0 0 24 24"
126
- xmlns="http://www.w3.org/2000/svg"
127
- >
128
- <path
129
- d="M5.25 18A3.25 3.25 0 0 1 2 14.75v-8.5A3.25 3.25 0 0 1 5.25 3h13.5A3.25 3.25 0 0 1 22 6.25v8.5A3.25 3.25 0 0 1 18.75 18h-5.738L8 21.75a1.25 1.25 0 0 1-1.999-1V18h-.75Zm7.264-1.5h6.236a1.75 1.75 0 0 0 1.75-1.75v-8.5a1.75 1.75 0 0 0-1.75-1.75H5.25A1.75 1.75 0 0 0 3.5 6.25v8.5c0 .966.784 1.75 1.75 1.75h2.249v3.75l5.015-3.75Z"
130
- fill="${t.theme===$e.LIGHT?"#000":"#fff"}"
131
- />
132
- </svg>
133
- `)}`;e.style.cursor=`url(${n}) 5 20, auto`}else t.activeTool.type!=="image"&&(e.style.cursor=ut.AUTO)}}),Ko,rs,K5,NF,vT,lE,S3,ri,PL,cE,$F,FF,Ua,xT,Bm,Vu,zm,wT,ST,cs=I(()=>{"use strict";D(),ne(),sa(),wt(),Fi(),Pe(),ur(),rn(),Kt(),ae(),Ko=(e,{x:t,y:n,strokeColor:r=Yt.strokeColor,backgroundColor:i=Yt.backgroundColor,fillStyle:o=Yt.fillStyle,strokeWidth:a=Yt.strokeWidth,strokeStyle:s=Yt.strokeStyle,roughness:l=Yt.roughness,opacity:c=Yt.opacity,width:d=0,height:u=0,angle:h=0,groupIds:m=[],frameId:p=null,roundness:f=null,boundElements:g=null,link:b=null,locked:v=Yt.locked,...y})=>({id:y.id||ni(),type:e,x:t,y:n,width:d,height:u,angle:h,strokeColor:r,backgroundColor:i,fillStyle:o,strokeWidth:a,strokeStyle:s,roughness:l,opacity:c,groupIds:m,frameId:p,roundness:f,seed:y.seed??ns(),version:y.version||1,versionNonce:y.versionNonce??0,isDeleted:!1,boundElements:g,updated:Dc(),link:b,locked:v,customData:y.customData}),rs=e=>Ko(e.type,e),K5=e=>Ko("embeddable",e),NF=e=>({...Ko("iframe",e)}),vT=e=>Le({...Ko("frame",e),type:"frame",name:e?.name||null},{}),lE=e=>Le({...Ko("magicframe",e),type:"magicframe",name:e?.name||null},{}),S3=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),ri=e=>{let t=e.fontFamily||aa,n=e.fontSize||Ni,r=e.lineHeight||gl(t),i=ju(e.text),o=Qa(i,xn({fontFamily:t,fontSize:n}),r),a=e.textAlign||Df,s=e.verticalAlign||Fp,l=S3({textAlign:a,verticalAlign:s},o);return Le({...Ko("text",e),text:i,fontSize:n,fontFamily:t,textAlign:a,verticalAlign:s,x:e.x-l.x,y:e.y-l.y,width:o.width,height:o.height,containerId:e.containerId||null,originalText:i,lineHeight:r},{})},PL=(e,t,n)=>{let{width:r,height:i}=Qa(n,xn(e),e.lineHeight),{textAlign:o,verticalAlign:a}=e,s,l;if(o==="center"&&a===Nr.MIDDLE&&!e.containerId){let c=Qa(e.text,xn(e),e.lineHeight),d=S3(e,{width:r-c.width,height:i-c.height});s=e.x-d.x,l=e.y-d.y}else{let[c,d,u,h]=_e(e,t),[m,p,f,g]=yu(e,r,i,!1),b=(c-m)/2,v=(d-p)/2,y=(u-f)/2,w=(h-g)/2;[s,l]=iT({s:!0,e:o==="center"||o==="left",w:o==="center"||o==="right"},e.x,e.y,e.angle,b,v,y,w)}return{width:r,height:i,x:Number.isFinite(s)?s:e.x,y:Number.isFinite(l)?l:e.y}},cE=(e,t,n,r=e.text)=>{if(e.isDeleted)return;t&&(r=Iu(r,xn(e),po(t,e)));let i=PL(e,n,r);return{text:r,...i}},$F=(e,t,n,{text:r,isDeleted:i,originalText:o})=>Le(e,{originalText:o,isDeleted:i??e.isDeleted,...cE(e,t,n,o)}),FF=e=>({...Ko(e.type,e),points:e.points||[],pressures:[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),Ua=e=>({...Ko(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null}),xT=e=>({...Ko("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,scale:e.scale??[1,1]}),Bm=(e,t=0)=>{if(e==null||typeof e!="object")return e;let n=Object.prototype.toString.call(e);if(n==="[object Object]"){let r=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(let i in e)if(e.hasOwnProperty(i)){if(t===0&&(i==="shape"||i==="canvas"))continue;r[i]=Bm(e[i],t+1)}return r}if(Array.isArray(e)){let r=e.length,i=new Array(r);for(;r--;)i[r]=Bm(e[r],t+1);return i}return Pt.DEV&&n!=="[object Object]"&&n!=="[object Array]"&&n.startsWith("[object ")&&console.warn(`_deepCloneElement: unexpected object type ${n}. This value will not be cloned!`),e},Vu=e=>Bm(e),zm=e=>{if(fl()&&e){let t=`${e}_copy`;return window.h?.app?.getSceneElementsIncludingDeleted().find(n=>n.id===t)&&(t+="_copy"),t}return ni()},wT=(e,t,n,r)=>{let i=Vu(n);return i.id=zm(i.id),i.boundElements=null,i.updated=Dc(),i.seed=ns(),i.groupIds=DF(i.groupIds,e,o=>(t.has(o)||t.set(o,zm(o)),t.get(o))),r&&(i=Object.assign(i,r)),i},ST=(e,t)=>{let n=[],r=Fe(e),i=new Map,o=s=>{if(i.has(s))return i.get(s);if(r.has(s)){let l=zm(s);return i.set(s,l),l}return null},a=new Map;for(let s of e){let l=Bm(s);if(l.id=o(s.id),t?.randomizeSeed&&(l.seed=ns(),Wc(l)),l.groupIds&&(l.groupIds=l.groupIds.map(c=>(a.has(c)||a.set(c,zm(c)),a.get(c)))),"containerId"in l&&l.containerId){let c=o(l.containerId);l.containerId=c}if("boundElements"in l&&l.boundElements&&(l.boundElements=l.boundElements.reduce((c,d)=>{let u=o(d.id);return u&&c.push({...d,id:u}),c},[])),"endBinding"in l&&l.endBinding){let c=o(l.endBinding.elementId);l.endBinding=c?{...l.endBinding,elementId:c}:null}if("startBinding"in l&&l.startBinding){let c=o(l.startBinding.elementId);l.startBinding=c?{...l.startBinding,elementId:c}:null}l.frameId&&(l.frameId=o(l.frameId)),n.push(l)}return n}}),qo,DL,LL,RL,T3,OL,C3,NL,$L,FL,M3,Tg,Ip,Cc,TT,$J,I3,BF,kp,Eb=I(()=>{"use strict";D(),xt(),ae(),ne(),Of(),cs(),Kt(),xe(),dh(),qo=new Map,DL=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/,LL=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,RL=/^https:\/\/(?:www\.)?figma\.com/,T3=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,OL=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,C3=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,NL=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,$L=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,FL=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,M3=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,Tg=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com","dddice.com"]),Ip=e=>`<html><body>${e}</body></html>`,Cc=e=>{if(!e)return null;if(qo.has(e))return qo.get(e);let t=e,n="generic",r={w:560,h:840},i=e.match(DL);if(i?.[2]){let s=i[3]?`&start=${i[3]}`:"",l=e.includes("shorts");switch(n="video",i[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${i[2]}?enablejsapi=1${s}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${i[2]}&enablejsapi=1${s}`;break;default:e=`https://www.youtube.com/embed/${i[2]}?enablejsapi=1${s}`;break}return r=l?{w:315,h:560}:{w:560,h:315},qo.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n}}let o=e.match(LL);if(o?.[1]){let s=o?.[1],l=/^\d+$/.test(s)?void 0:new URIError("Invalid embed link format");return n="video",e=`https://player.vimeo.com/video/${s}?api=1`,r={w:560,h:315},qo.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n,error:l}}if(e.match(RL))return n="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,r={w:550,h:550},qo.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n};let a=e.match($L);if(a)return e=a[1]==="embed"?a[0]:a[0].replace("/v","/embed"),qo.set(t,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n};if(C3.test(e)){let s=e.match(C3)[1],l=sE(`https://twitter.com/x/status/${s}`),c={type:"document",srcdoc:d=>Ip(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${d}"><a href="${l}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:!0}};return qo.set(t,c),c}if(T3.test(e)){let[,s,l]=e.match(T3),c=sE(`https://gist.github.com/${s}/${l}`),d={type:"document",srcdoc:()=>Ip(`
134
- <script src="${c}.js"><\/script>
135
- <style type="text/css">
136
- * { margin: 0px; }
137
- table, .gist { height: 100%; }
138
- .gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
139
- </style>
140
- `),intrinsicSize:{w:550,h:720}};return qo.set(e,d),d}return qo.set(e,{link:e,intrinsicSize:r,type:n}),{link:e,intrinsicSize:r,type:n}},TT=e=>{let t;Ga(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),r=zn.Helvetica,i=xn({fontSize:n,fontFamily:r});return ri({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:r,fontSize:n,text:Iu(t,i,e.width-20),textAlign:"center",verticalAlign:Nr.MIDDLE,angle:e.angle??0})},$J=oe({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,t,n,r)=>{let i=nn(t,{type:"embeddable"});return lo(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:nn(t,{type:"embeddable"})},commitToHistory:!1}}}),I3=(e,t)=>{try{let{hostname:n}=new URL(e),r=n.replace(/^www\./,""),i=r.replace(/^([^.]+)/,"*");if(t instanceof Set)return Tg.has(r)||Tg.has(i);if(r===t.replace(/^www\./,""))return!0}catch{}return!1},BF=e=>{let t=e.match(NL);if(t&&t.length===2)return t[1];let n=e.match(OL);if(n&&n.length===2)return n[1];if(M3.test(e))return`https://giphy.com/embed/${M3.exec(e)[1]}`;let r=e.match(FL);return r&&r.length===2?r[1]:e},kp=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(I3(e,n))return!0;return!1}}return I3(e,Tg)}}),Vd,Yd,Cg,zF,FJ=I(()=>{"use strict";D(),ae(),dh(),Pe(),Eb(),Tr(),Kt(),xe(),Sr(),ur(),ca(),ne(),ls(),Vd=(e,t,n)=>{if(typeof n>"u")return e.draw(t);let r={sets:t.sets,shape:t.shape,options:{...t.options,fixedDecimalPlaceDigits:n}};return e.draw(r)},Yd=(e,t,n,r,i)=>{if(!r.enabled||!r.clip)return null;let o=Fr(e,i);if(o){let a=t.ownerDocument.createElementNS(It,"g");return a.setAttributeNS(It,"clip-path",`url(#${o.id})`),n.forEach(s=>a.appendChild(s)),a}return null},Cg=(e,t,n,r,i,o,a,s)=>{let l={x:o,y:a},[c,d,u,h]=_e(e,t),m=(u-c)/2-(e.x-c),p=(h-d)/2-(e.y-d);if(he(e)){let y=cr(e,t);if(yt(y)){let[w,T,k,M]=_e(y,t),C=pe.getBoundTextElementPosition(y,e,t);m=(k-w)/2-(C.x-w),p=(M-T)/2-(C.y-T),o=o+C.x-e.x,a=a+C.y-e.y}}let f=180*e.angle/Math.PI,g=r;if(e.link){let y=r.ownerDocument.createElementNS(It,"a");y.setAttribute("href",wo(e.link)),g.appendChild(y),g=y}let b=(y,w)=>{fl()&&y.setAttribute("data-id",w.id),g.appendChild(y)},v=(Fr(e,t)?.opacity??100)*e.opacity/1e4;switch(e.type){case"selection":throw new Error("Selection rendering is not supported for SVG");case"rectangle":case"diamond":case"ellipse":{let y=jt.generateElementShape(e,null),w=Vd(n,y,au);v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`);let T=Yd(e,g,[w],s.frameRendering,t);b(T||w,e);break}case"iframe":case"embeddable":{let y=jt.generateElementShape(e,s),w=Vd(n,y,au),T=e.opacity/100;T!==1&&(w.setAttribute("stroke-opacity",`${T}`),w.setAttribute("fill-opacity",`${T}`)),w.setAttribute("stroke-linecap","round"),w.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),b(w,e);let k=TT(e);Cg(k,t,n,g,i,k.x+l.x-e.x,k.y+l.y-e.y,s);let M=Vd(n,y,au);for(M.setAttribute("stroke-linecap","round"),M.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`);M.firstChild;)M.removeChild(M.firstChild);let C=hl(Math.min(e.width,e.height),e),P=Cc(yT(e.link||""));if(s.renderEmbeddables===!1||P?.type==="document"){let R=r.ownerDocument.createElementNS(It,"a");R.setAttribute("href",wo(e.link||"")),R.setAttribute("target","_blank"),R.setAttribute("rel","noopener noreferrer"),R.style.borderRadius=`${C}px`,M.appendChild(R)}else{let R=r.ownerDocument.createElementNS(It,"foreignObject");R.style.width=`${e.width}px`,R.style.height=`${e.height}px`,R.style.border="none";let A=R.ownerDocument.createElementNS(It,"div");A.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),A.style.width="100%",A.style.height="100%";let _=A.ownerDocument.createElement("iframe");_.src=P?.link??"",_.style.width="100%",_.style.height="100%",_.style.border="none",_.style.borderRadius=`${C}px`,_.style.top="0",_.style.left="0",_.allowFullscreen=!0,A.appendChild(_),R.appendChild(A),M.appendChild(R)}b(M,e);break}case"line":case"arrow":{let y=Ue(e,t),w=r.ownerDocument.createElementNS(It,"mask");if(y){w.setAttribute("id",`mask-${e.id}`);let M=r.ownerDocument.createElementNS(It,"rect");o=o||0,a=a||0,M.setAttribute("x","0"),M.setAttribute("y","0"),M.setAttribute("fill","#fff"),M.setAttribute("width",`${e.width+100+o}`),M.setAttribute("height",`${e.height+100+a}`),w.appendChild(M);let C=r.ownerDocument.createElementNS(It,"rect"),P=pe.getBoundTextElementPosition(e,y,t),R=o+P.x-e.x,A=a+P.y-e.y;C.setAttribute("x",R.toString()),C.setAttribute("y",A.toString()),C.setAttribute("fill","#000"),C.setAttribute("width",`${y.width}`),C.setAttribute("height",`${y.height}`),C.setAttribute("opacity","1"),w.appendChild(C)}let T=r.ownerDocument.createElementNS(It,"g");y&&T.setAttribute("mask",`url(#mask-${e.id})`),T.setAttribute("stroke-linecap","round"),jt.generateElementShape(e,s).forEach(M=>{let C=Vd(n,M,au);v!==1&&(C.setAttribute("stroke-opacity",`${v}`),C.setAttribute("fill-opacity",`${v}`)),C.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),e.type==="line"&&ss(e.points)&&e.backgroundColor!=="transparent"&&C.setAttribute("fill-rule","evenodd"),T.appendChild(C)});let k=Yd(e,g,[T,w],s.frameRendering,t);k?(b(k,e),g.appendChild(k)):(b(T,e),g.append(w));break}case"freedraw":{let y=jt.generateElementShape(e,s),w=y?Vd(n,y,au):r.ownerDocument.createElementNS(It,"g");v!==1&&(w.setAttribute("stroke-opacity",`${v}`),w.setAttribute("fill-opacity",`${v}`)),w.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),w.setAttribute("stroke","none");let T=r.ownerDocument.createElementNS(It,"path");T.setAttribute("fill",e.strokeColor),T.setAttribute("d",CB(e)),w.appendChild(T);let k=Yd(e,g,[w],s.frameRendering,t);b(k||w,e);break}case"image":{let y=Math.round(e.width),w=Math.round(e.height),T=Eo(e)&&i[e.fileId];if(T){let k=`image-${T.id}`,M=r.querySelector(`#${k}`);if(!M){M=r.ownerDocument.createElementNS(It,"symbol"),M.id=k;let A=r.ownerDocument.createElementNS(It,"image");A.setAttribute("width","100%"),A.setAttribute("height","100%"),A.setAttribute("href",T.dataURL),M.appendChild(A),g.prepend(M)}let C=r.ownerDocument.createElementNS(It,"use");if(C.setAttribute("href",`#${k}`),s.exportWithDarkMode&&T.mimeType!==ve.svg&&C.setAttribute("filter",b4),C.setAttribute("width",`${y}`),C.setAttribute("height",`${w}`),C.setAttribute("opacity",`${v}`),e.scale[0]!==1||e.scale[1]!==1){let A=e.scale[0]!==1?-y:0,_=e.scale[1]!==1?-w:0;C.setAttribute("transform",`scale(${e.scale[0]}, ${e.scale[1]}) translate(${A} ${_})`)}let P=r.ownerDocument.createElementNS(It,"g");if(P.appendChild(C),P.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),e.roundness){let A=r.ownerDocument.createElementNS(It,"clipPath");A.id=`image-clipPath-${e.id}`;let _=r.ownerDocument.createElementNS(It,"rect"),$=hl(Math.min(e.width,e.height),e);_.setAttribute("width",`${e.width}`),_.setAttribute("height",`${e.height}`),_.setAttribute("rx",`${$}`),_.setAttribute("ry",`${$}`),A.appendChild(_),b(A,e),P.setAttributeNS(It,"clip-path",`url(#${A.id})`)}let R=Yd(e,g,[P],s.frameRendering,t);b(R||P,e)}break}case"frame":case"magicframe":{if(s.frameRendering.enabled&&s.frameRendering.outline){let y=document.createElementNS(It,"rect");y.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`),y.setAttribute("width",`${e.width}px`),y.setAttribute("height",`${e.height}px`),y.setAttribute("rx",Zt.radius.toString()),y.setAttribute("ry",Zt.radius.toString()),y.setAttribute("fill","none"),y.setAttribute("stroke",Zt.strokeColor),y.setAttribute("stroke-width",Zt.strokeWidth.toString()),b(y,e)}break}default:if(he(e)){let y=r.ownerDocument.createElementNS(It,"g");v!==1&&(y.setAttribute("stroke-opacity",`${v}`),y.setAttribute("fill-opacity",`${v}`)),y.setAttribute("transform",`translate(${o||0} ${a||0}) rotate(${f} ${m} ${p})`);let w=e.text.replace(/\r\n?/g,`
141
- `).split(`
142
- `),T=Mu(e.fontSize,e.lineHeight),k=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,M=hT(e.fontFamily,e.fontSize,T),C=qS(e.text)?"rtl":"ltr",P=e.textAlign==="center"?"middle":e.textAlign==="right"||C==="rtl"?"end":"start";for(let A=0;A<w.length;A++){let _=r.ownerDocument.createElementNS(It,"text");_.textContent=w[A],_.setAttribute("x",`${k}`),_.setAttribute("y",`${A*T+M}`),_.setAttribute("font-family",zp(e)),_.setAttribute("font-size",`${e.fontSize}px`),_.setAttribute("fill",e.strokeColor),_.setAttribute("text-anchor",P),_.setAttribute("style","white-space: pre;"),_.setAttribute("direction",C),_.setAttribute("dominant-baseline","alphabetic"),y.appendChild(_)}let R=Yd(e,g,[y],s.frameRendering,t);b(R||y,e)}else throw new Error(`Unimplemented type ${e.type}`)}},zF=(e,t,n,r,i,o)=>{r&&(e.filter(a=>!ti(a)).forEach(a=>{if(!a.isDeleted)try{Cg(a,t,n,r,i,a.x+o.offsetX,a.y+o.offsetY,o)}catch(s){console.error(s)}}),e.filter(a=>ti(a)).forEach(a=>{if(!a.isDeleted)try{Cg(a,t,n,r,i,a.x+o.offsetX,a.y+o.offsetY,o)}catch(s){console.error(s)}}))}}),HF,Nf,Vs,uh=I(()=>{"use strict";D(),HF=class extends Error{constructor(e="Couldn't export canvas.",t="CANVAS_ERROR"){super(),this.name=t,this.message=e}},Nf=class extends DOMException{constructor(e="Request Aborted"){super(e,"AbortError")}},Vs=class extends Error{code;constructor(e="Image Scene Data Error",t="IMAGE_SCENE_DATA_ERROR"){super(e),this.name="EncodingError",this.code=t}}}),k3,bb,Xp,Tl=I(()=>{"use strict";D(),ae(),uh(),ne(),k3=500,bb=e=>{let t=e.extensions?.reduce((r,i)=>(r.push(ve[i]),r),[]),n=e.extensions?.reduce((r,i)=>i==="jpg"?r.concat(".jpg",".jpeg"):r.concat(`.${i}`),[]);return S0({description:e.description,extensions:n,mimeTypes:t,multiple:e.multiple??!1,legacySetup:(r,i,o)=>{let a=Hp(i,k3),s=()=>{l(),document.addEventListener("keyup",a),document.addEventListener("pointerup",a),a()},l=()=>{if(o.files?.length){let d=e.multiple?[...o.files]:o.files[0];r(d)}};requestAnimationFrame(()=>{window.addEventListener("focus",s)});let c=window.setInterval(()=>{l()},k3);return d=>{clearInterval(c),a.cancel(),window.removeEventListener("focus",s),document.removeEventListener("keyup",a),document.removeEventListener("pointerup",a),d&&(console.warn("Opening the file was canceled (legacy-fs)."),d(new Nf))}}})},Xp=(e,t)=>T0(e,{fileName:`${t.name}.${t.extension}`,description:t.description,extensions:[`.${t.extension}`]},t.fileHandle)}),BL,zL,A3,lc,HL,GL,WL,jL,k2,UL,_3,q5,yb,P3,Ap,hh=I(()=>{"use strict";D(),Pe(),xe(),sa(),ae(),$i(),Tr(),wt(),ne(),ne(),Kt(),dh(),BL={selection:!0,text:!0,rectangle:!0,diamond:!0,ellipse:!0,line:!0,image:!0,arrow:!0,freedraw:!0,eraser:!1,custom:!0,frame:!0,embeddable:!0,hand:!0,laser:!1,magicframe:!1},zL=e=>Object.keys(zn).includes(e)?zn[e]:aa,A3=e=>e?{...e,focus:e.focus||0}:null,lc=(e,t)=>{let n={type:t.type||e.type,version:e.version||1,versionNonce:e.versionNonce??0,isDeleted:e.isDeleted??!1,id:e.id||ni(),fillStyle:e.fillStyle||Yt.fillStyle,strokeWidth:e.strokeWidth||Yt.strokeWidth,strokeStyle:e.strokeStyle??Yt.strokeStyle,roughness:e.roughness??Yt.roughness,opacity:e.opacity==null?Yt.opacity:e.opacity,angle:e.angle||0,x:t.x??e.x??0,y:t.y??e.y??0,strokeColor:e.strokeColor||Yt.strokeColor,backgroundColor:e.backgroundColor||Yt.backgroundColor,width:e.width||0,height:e.height||0,seed:e.seed??1,groupIds:e.groupIds??[],frameId:e.frameId??null,roundness:e.roundness?e.roundness:e.strokeSharpness==="round"?{type:Lc(e.type)?Pn.LEGACY:Pn.PROPORTIONAL_RADIUS}:null,boundElements:e.boundElementIds?e.boundElementIds.map(r=>({type:"arrow",id:r})):e.boundElements??[],updated:e.updated??Dc(),link:e.link?wo(e.link):null,locked:e.locked??!1};return("customData"in e||"customData"in t)&&(n.customData="customData"in t?t.customData:e.customData),f2 in e&&(n[f2]=e[f2]),{...n,...jT(n),...t}},HL=e=>{switch(e.type){case"text":let t=e.fontSize,n=e.fontFamily;if("font"in e){let[o,a]=e.font.split(" ");t=parseFloat(o),n=zL(a)}let r=typeof e.text=="string"&&e.text||"",i=e.lineHeight||(e.height?yF(e):gl(e.fontFamily));return e=lc(e,{fontSize:t,fontFamily:n,text:r,textAlign:e.textAlign||Df,verticalAlign:e.verticalAlign||Fp,containerId:e.containerId??null,originalText:e.originalText||r,lineHeight:i}),!r&&!e.isDeleted&&(e={...e,originalText:r,isDeleted:!0},e=Wc(e)),e;case"freedraw":return lc(e,{points:e.points,lastCommittedPoint:null,simulatePressure:e.simulatePressure,pressures:e.pressures});case"image":return lc(e,{status:e.status||"pending",fileId:e.fileId,scale:e.scale||[1,1]});case"line":case"draw":case"arrow":{let{startArrowhead:o=null,endArrowhead:a=e.type==="arrow"?"arrow":null}=e,s=e.x,l=e.y,c=!Array.isArray(e.points)||e.points.length<2?[[0,0],[e.width,e.height]]:e.points;return(c[0][0]!==0||c[0][1]!==0)&&({points:c,x:s,y:l}=pe.getNormalizedPoints(e)),lc(e,{type:e.type==="draw"?"line":e.type,startBinding:A3(e.startBinding),endBinding:A3(e.endBinding),lastCommittedPoint:null,startArrowhead:o,endArrowhead:a,points:c,x:s,y:l})}case"ellipse":case"rectangle":case"diamond":case"iframe":case"embeddable":return lc(e,{});case"magicframe":case"frame":return lc(e,{name:e.name??null})}return null},GL=(e,t)=>{if(e.boundElements){let n=e.boundElements.slice(),r=new Set;e.boundElements=n.reduce((i,o)=>{let a=t.get(o.id);if(a&&!r.has(o.id)){if(r.add(o.id),a.isDeleted)return i;i.push(o),he(a)&&!a.containerId&&(a.containerId=e.id)}return i},[])}},WL=(e,t)=>{let n=e.containerId?t.get(e.containerId):null;if(!n){e.containerId=null;return}if(!e.isDeleted&&n.boundElements&&!n.boundElements.find(r=>r.id===e.id)){let r=(n.boundElements||(n.boundElements=[])).slice();r.push({type:"text",id:e.id}),n.boundElements=r}},jL=(e,t)=>{e.frameId&&(t.get(e.frameId)||(e.frameId=null))},k2=(e,t,n)=>{let r=new Set,i=t?Fe(t):null,o=(e||[]).reduce((s,l)=>{if(l.type!=="selection"&&!jc(l)){let c=HL(l);if(c){let d=i?.get(l.id);d&&d.version>c.version&&(c=Wc(c,d.version)),r.has(c.id)&&(c={...c,id:ni()}),r.add(c.id),s.push(c)}}return s},[]);if(!n?.repairBindings)return o;let a=Fe(o);for(let s of o)s.frameId&&jL(s,a),he(s)&&s.containerId?WL(s,a):s.boundElements&&GL(s,a),n.refreshDimensions&&he(s)&&Object.assign(s,cE(s,cr(s,a),a));return o},UL=(e,t,n)=>{let r=t[e];return r!==void 0?r:n[e]},_3={isSidebarDocked:(e,t)=>["defaultSidebarDockedPreference",e.isSidebarDocked??UL("defaultSidebarDockedPreference",e,t)]},q5=(e,t)=>{e=e||{};let n=ml(),r={};for(let i of Object.keys(_3))if(i in e){let[o,a]=_3[i](e,n);r[o]=a}for(let[i,o]of Object.entries(n)){let a=e[i],s=t?t[i]:void 0;r[i]=a!==void 0?a:s!==void 0?s:o}return{...r,cursorButton:t?.cursorButton||"up",penDetected:t?.penDetected??(e.penMode?e.penDetected??!1:!1),activeTool:{...nn(n,r.activeTool.type&&BL[r.activeTool.type]?r.activeTool:{type:"selection"}),lastActiveTool:null,locked:r.activeTool.locked??!1},zoom:typeof e.zoom=="number"?{value:e.zoom}:e.zoom?.value?e.zoom:n.zoom,openSidebar:typeof e.openSidebar=="string"?{name:es.name}:r.openSidebar}},yb=(e,t,n,r)=>({elements:k2(e?.elements,n,r),appState:q5(e?.appState,t||null),files:e?.files||{}}),P3=e=>{let t=k2(at(e.elements),null);return t.length?{...e,elements:t}:null},Ap=(e=[],t)=>{let n=[];for(let r of e)if(Array.isArray(r)){let i=P3({status:t,elements:r,id:ni(),created:Date.now()});i&&n.push(i)}else{let i=r,o=P3({...i,id:i.id||ni(),status:i.status||t,created:i.created||Date.now()});o&&n.push(o)}return n}}),BJ=I(()=>{"use strict";D(),ae(),si()}),Mg,D3,L3,GF,WF,Q5,J5,zJ=I(()=>{"use strict";D(),BJ(),Mg=e=>new Promise((t,n)=>{let r=typeof e=="string"?new Blob([new TextEncoder().encode(e)]):new Blob([e instanceof Uint8Array?e:new Uint8Array(e)]),i=new FileReader;i.onload=o=>{if(!o.target||typeof o.target.result!="string")return n(new Error("couldn't convert to byte string"));t(o.target.result)},i.readAsBinaryString(r)}),D3=e=>{let t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t},L3=e=>new TextDecoder("utf-8").decode(D3(e)),GF=async(e,t=!1)=>t?window.btoa(e):window.btoa(await Mg(e)),WF=async(e,t=!1)=>t?window.atob(e):L3(window.atob(e)),Q5=async({text:e,compress:t})=>{let n;if(t!==!1)try{n=await Mg((0,vb.deflate)(e))}catch(r){console.error("encode: cannot deflate",r)}return{version:"1",encoding:"bstring",compressed:!!n,encoded:n||await Mg(e)}},J5=async e=>{let t;switch(e.encoding){case"bstring":t=e.compressed?e.encoded:await L3(e.encoded);break;default:throw new Error(`decode: unknown encoding "${e.encoding}"`)}return e.compressed?(0,vb.inflate)(new Uint8Array(D3(t)),{to:"string"}):t}}),Kp={};Pf(Kp,{decodePngMetadata:()=>UF,decodeSvgMetadata:()=>YF,encodePngMetadata:()=>CT,encodeSvgMetadata:()=>VF,getTEXtChunk:()=>n4});var n4,CT,UF,VF,YF,qp=I(()=>{"use strict";D(),zJ(),ae(),si(),n4=async e=>{let t=(0,e4.default)(new Uint8Array(await Ys(e))).find(n=>n.name==="tEXt");return t?t4.default.decode(t.data):null},CT=async({blob:e,metadata:t})=>{let n=(0,e4.default)(new Uint8Array(await Ys(e))),r=t4.default.encode(ve.excalidraw,JSON.stringify(await Q5({text:t,compress:!0})));return n.splice(-1,0,r),new Blob([(0,jF.default)(n)],{type:ve.png})},UF=async e=>{let t=await n4(e);if(t?.keyword===ve.excalidraw)try{let n=JSON.parse(t.text);if(!("encoded"in n)){if("type"in n&&n.type===ei.excalidraw)return t.text;throw new Error("FAILED")}return await J5(n)}catch(n){throw console.error(n),new Error("FAILED")}throw new Error("INVALID")},VF=async({text:e})=>{let t=await GF(JSON.stringify(await Q5({text:e})),!0),n="";return n+=`<!-- payload-type:${ve.excalidraw} -->`,n+="<!-- payload-version:2 -->",n+="<!-- payload-start -->",n+=t,n+="<!-- payload-end -->",n},YF=async({svg:e})=>{if(e.includes(`payload-type:${ve.excalidraw}`)){let t=e.match(/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/);if(!t)throw new Error("INVALID");let n=(e.match(/<!-- payload-version:(\d+) -->/)?.[1]||"1")!=="1";try{let r=await WF(t[1],n),i=JSON.parse(r);if(!("encoded"in i)){if("type"in i&&i.type===ei.excalidraw)return r;throw new Error("FAILED")}return await J5(i)}catch(r){throw console.error(r),new Error("FAILED")}}throw new Error("INVALID")}}),R3,r4,ZF,xb,Xs,i4,MT,o4,XF,Yu,KF,A2,qF,dE,a4,QF,JF,VL,O3,Hm,uE,Ys,si=I(()=>{"use strict";D(),$i(),ae(),Pe(),uh(),pt(),ne(),Tl(),El(),hh(),R3=async e=>{let t;if(e.type===ve.png)try{return await(await Promise.resolve().then(()=>(qp(),Kp))).decodePngMetadata(e)}catch(n){throw n.message==="INVALID"?new Vs("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Vs("Error: cannot restore image")}else if("text"in Blob?t=await e.text():t=await new Promise(n=>{let r=new FileReader;r.readAsText(e,"utf8"),r.onloadend=()=>{r.readyState===FileReader.DONE&&n(r.result)}}),e.type===ve.svg)try{return await(await Promise.resolve().then(()=>(qp(),Kp))).decodeSvgMetadata({svg:t})}catch(n){throw n.message==="INVALID"?new Vs("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Vs("Error: cannot restore image")}return t},r4=e=>e&&e.name.match(/\.(json|excalidraw|png|svg)$/)?.[1]||null,ZF=e=>e==="png"||e==="svg",xb=e=>{let t=r4(e);return t==="png"||t==="svg"},Xs=e=>{let{type:t}=e||{};return!!t&&Object.values(Y2).includes(t)},i4=async(e,t,n,r)=>{let i=await R3(e),o;try{try{o=JSON.parse(i)}catch(a){throw Xs(e)?new Vs("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):a}if(tB(o))return{type:ve.excalidraw,data:yb({elements:UT(o.elements||[]),appState:{theme:t?.theme,fileHandle:r||e.handle||null,...fT(o.appState||{}),...t?qu(o.elements||[],t):{}},files:o.files},t,n,{repairBindings:!0,refreshDimensions:!1})};if(l4(o))return{type:ve.excalidrawlib,data:o};throw new Error("Error: invalid file")}catch(a){throw a instanceof Vs?a:new Error("Error: invalid file")}},MT=async(e,t,n,r)=>{let i=await i4(e,t,n,r);if(i.type!==ve.excalidraw)throw new Error("Error: invalid file");return i.data},o4=(e,t="unpublished")=>{let n=JSON.parse(e);if(!l4(n))throw new Error("Invalid library");let r=n.libraryItems||n.library;return Ap(r,t)},XF=async(e,t="unpublished")=>o4(await R3(e),t),Yu=async e=>new Promise(async(t,n)=>{try{ch(e)&&(e=await e),e.toBlob(r=>{if(!r)return n(new HF("Error: Canvas too big","CANVAS_POSSIBLY_TOO_BIG"));t(r)})}catch(r){n(r)}}),KF=async e=>{try{let t=await window.crypto.subtle.digest("SHA-1",await Ys(e));return F$(new Uint8Array(t))}catch(t){return console.error(t),Fo(40)}},A2=async e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=r.result;t(i)},r.onerror=i=>n(i),r.readAsDataURL(e)}),qF=(e,t="")=>{let n=e.indexOf(","),r=atob(e.slice(n+1)),i=e.slice(0,n).split(":")[1].split(";")[0],o=new ArrayBuffer(r.length),a=new Uint8Array(o);for(let s=0;s<r.length;s++)a[s]=r.charCodeAt(s);return new File([o],t,{type:i})},dE=async(e,t)=>{if(e.type===ve.svg)return e;let[n,r]=await Promise.all([import("./pica-ORBFBYLP.js").then(o=>o.default),import("./image-blob-reduce.esm-47YEP2D2.js").then(o=>o.default)]),i=r({pica:n({features:["js","wasm"]})});if(t.outputType){let{outputType:o}=t;i._create_blob=function(a){return this.pica.toBlob(a.out_canvas,o,.8).then(s=>(a.out_blob=s,a))}}if(!Xs(e))throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"});return new File([await i.toBlob(e,{max:t.maxWidthOrHeight})],e.name,{type:t.outputType||e.type})},a4=(e,t="")=>new File([new TextEncoder().encode(e)],t,{type:ve.svg}),QF=async(e,t="")=>{let n;try{n=await fetch(e)}catch{throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"})}if(!n.ok)throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"});let r=await n.blob();if(r.type&&Xs(r)){let i=t||r.name||"";return new File([r],i,{type:r.type})}throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"})},JF=async e=>{let t=e.dataTransfer.files.item(0),n=await VL(e);return{file:t?await uE(t):null,fileHandle:n}},VL=async e=>{if(no)try{return await e.dataTransfer.items[0].getAsFileSystemHandle()||null}catch(t){return console.warn(t.name,t.message),null}return null},O3=e=>{let t=null,n=`${[...new Uint8Array(e).slice(0,8)].join(" ")} `,r={png:"137 80 78 71 13 10 26 10 ",jpg:"255 216 255 ",gif:"71 73 70 56 57 97 "};return n===r.png?t=ve.png:n.startsWith(r.jpg)?t=ve.jpg:n.startsWith(r.gif)&&(t=ve.gif),t},Hm=(e,t,n)=>new File([e],n||"",{type:t}),uE=async e=>{if(e.type){if(Xs(e)){let t=await Ys(e),n=O3(t);n&&n!==e.type&&(e=Hm(t,n,e.name))}}else if(e?.name?.endsWith(".excalidrawlib"))e=Hm(await Ys(e),ve.excalidrawlib,e.name);else if(e?.name?.endsWith(".excalidraw"))e=Hm(await Ys(e),ve.excalidraw,e.name);else{let t=await Ys(e),n=O3(t);n&&(e=Hm(t,n,e.name))}return e},Ys=e=>"arrayBuffer"in e?e.arrayBuffer():new Promise((t,n)=>{let r=new FileReader;r.onload=i=>{if(!i.target?.result)return n(new Error("Couldn't convert blob to ArrayBuffer"));t(i.target.result)},r.readAsArrayBuffer(e)})}),YL,Qp,s4,eB,tB,l4,c4,nB,El=I(()=>{"use strict";D(),Tl(),$i(),ae(),Pe(),si(),YL=(e,t)=>{let n={};for(let r of e)!r.isDeleted&&"fileId"in r&&r.fileId&&t[r.fileId]&&(n[r.fileId]=t[r.fileId]);return n},Qp=(e,t,n,r)=>{let i={type:ei.excalidraw,version:Bp.excalidraw,source:Z2,elements:r==="local"?UT(e):BB(e),appState:r==="local"?fT(t):AF(t),files:r==="local"?YL(e,n):void 0};return JSON.stringify(i,null,2)},s4=async(e,t,n,r=t.name||XS)=>{let i=Qp(e,t,n,"local"),o=new Blob([i],{type:ve.excalidraw});return{fileHandle:await Xp(o,{name:r,extension:"excalidraw",description:"Excalidraw file",fileHandle:xb(t.fileHandle)?null:t.fileHandle})}},eB=async(e,t)=>{let n=await bb({description:"Excalidraw files"});return MT(await uE(n),e,t,n.handle)},tB=e=>e?.type===ei.excalidraw&&(!e.elements||Array.isArray(e.elements)&&(!e.appState||typeof e.appState=="object")),l4=e=>typeof e=="object"&&e&&e.type===ei.excalidrawLibrary&&(e.version===1||e.version===2),c4=e=>{let t={type:ei.excalidrawLibrary,version:Bp.excalidrawLibrary,source:Z2,libraryItems:e};return JSON.stringify(t,null,2)},nB=async e=>{let t=c4(e);await Xp(new Blob([t],{type:ve.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"})}}),d4,IT,kT,ZL,rB,iB=I(()=>{"use strict";D(),ae(),xe(),d4=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>{t(r)},r.onerror=i=>{n(i)},r.src=e}),IT=async({fileIds:e,files:t,imageCache:n})=>{let r=new Map,i=new Map;return await Promise.all(e.reduce((o,a)=>{let s=t[a];return s&&!r.has(a)?(r.set(a,!0),o.concat((async()=>{try{if(s.mimeType===ve.binary)throw new Error("Only images can be added to ImageCache");let l=d4(s.dataURL),c={image:l,mimeType:s.mimeType};n.set(a,c);let d=await l;n.set(a,{...c,image:d})}catch{i.set(a,!0)}})())):o},[])),{imageCache:n,updatedFiles:r,erroredFiles:i}},kT=e=>e.filter(t=>Eo(t)),ZL=e=>e?.nodeName.toLowerCase()==="svg",rB=async e=>{let t=new DOMParser().parseFromString(e,ve.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!ZL(n))throw new Error("Invalid SVG");if(n.hasAttribute("xmlns")||n.setAttribute("xmlns",It),!n.hasAttribute("width")||!n.hasAttribute("height")){let r=n.getAttribute("viewBox"),i=n.getAttribute("width")||"50",o=n.getAttribute("height")||"50";if(r){let a=r.match(/\d+ +\d+ +(\d+) +(\d+)/);a&&([,i,o]=a)}n.setAttribute("width",i),n.setAttribute("height",o)}return n.outerHTML}}),u4,hE,h4,_2,AT=I(()=>{"use strict";D(),ae(),rn(),Zc(),ur(),ls(),u4=document.createElement("img"),u4.src=`data:${ve.svg}, ${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1971c2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>')}`,hE=([e,t,n,r],i,o)=>{let a=MB,s=a/o.zoom.value,l=a/o.zoom.value,c=a/o.zoom.value,d=(e+n)/2,u=(t+r)/2,h=(a-8)/(2*o.zoom.value),m=4/o.zoom.value,p=n+m-h,f=t-m-c+h,[g,b]=Ge(p+s/2,f+l/2,d,u,i);return[g-s/2,b-l/2,s,l]},h4=(e,t,n,[r,i])=>{let o=4/n.zoom.value,[a,s,l,c]=_e(e,t),[d,u,h,m]=hE([a,s,l,c],e.angle,n);return r>d-o&&r<d+o+h&&i>u-o&&i<u+m+o},_2=(e,t,n,[r,i],o)=>{if(!e.link||n.selectedElementIds[e.id])return!1;let a=4/n.zoom.value;return!o&&n.viewModeEnabled&&Tp(e,t,[r,i],a,null)?!0:h4(e,t,n,[r,i])}}),dp,_T,PT,oB=I(()=>{"use strict";D(),ae(),dp=(e,t,n,r,i=!0)=>{e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fill(),i&&e.stroke()},_T=(e,t)=>[e.width/t,e.height/t],PT=({canvas:e,scale:t,normalizedWidth:n,normalizedHeight:r,theme:i,isExporting:o,canvasBackgroundColor:a})=>{let s=e.getContext("2d");return s.setTransform(1,0,0,1,0,0),s.scale(t,t),o&&i===$e.DARK&&(s.filter=lb),typeof a=="string"?((a==="transparent"||a.length===5||a.length===9||/(hsla|rgba)\(/.test(a))&&s.clearRect(0,0,n,r),s.save(),s.fillStyle=a,s.fillRect(0,0,n,r),s.restore()):s.clearRect(0,0,n,r),s}}),XL,N3,La,$3,F3,m4,DT,LT=I(()=>{"use strict";D(),ae(),Pe(),Sr(),xe(),ls(),Eb(),AT(),oB(),ne(),XL=(e,t,n,r,i,o,a)=>{let s={Bold:"#cccccc",Regular:"#e5e5e5"},l=-Math.round(i.value/t)*t+n%t,c=-Math.round(i.value/t)*t+r%t,d=Math.min(1/i.value,1),u=1/i.value,h=[d*3,u+(d+u)];e.save(),e.lineWidth=d;for(let m=l;m<l+o+t*2;m+=t){let p=Math.round(m-n)%(5*t)===0;e.beginPath(),e.setLineDash(p?[]:h),e.strokeStyle=p?s.Bold:s.Regular,e.moveTo(m,c-t),e.lineTo(m,c+a+t*2),e.stroke()}for(let m=c;m<c+a+t*2;m+=t){let p=Math.round(m-r)%(5*t)===0;e.beginPath(),e.setLineDash(p?[]:h),e.strokeStyle=p?s.Bold:s.Regular,e.moveTo(l-t,m),e.lineTo(l+o+t*2,m),e.stroke()}e.restore()},N3=(e,t,n,r)=>{t.translate(e.x+r.scrollX,e.y+r.scrollY),t.beginPath(),t.roundRect?t.roundRect(0,0,e.width,e.height,Zt.radius/r.zoom.value):t.rect(0,0,e.width,e.height),t.clip(),t.translate(-(e.x+r.scrollX),-(e.y+r.scrollY))},$3=(e,t,n,r)=>{if(e.link&&!n.selectedElementIds[e.id]){let[i,o,a,s]=_e(e,r),[l,c,d,u]=hE([i,o,a,s],e.angle,n),h=l+d/2,m=c+u/2;if(t.save(),t.translate(n.scrollX+h,n.scrollY+m),t.rotate(e.angle),!La||La.zoom!==n.zoom.value){La=document.createElement("canvas"),La.zoom=n.zoom.value,La.width=d*window.devicePixelRatio*n.zoom.value,La.height=u*window.devicePixelRatio*n.zoom.value;let p=La.getContext("2d");p.scale(window.devicePixelRatio*n.zoom.value,window.devicePixelRatio*n.zoom.value),p.fillStyle="#fff",p.fillRect(0,0,d,u),p.drawImage(u4,0,0,d,u),p.restore(),t.drawImage(La,l-h,c-m,d,u)}else t.drawImage(La,l-h,c-m,d,u);t.restore()}},F3=({canvas:e,rc:t,elementsMap:n,allElementsMap:r,visibleElements:i,scale:o,appState:a,renderConfig:s})=>{if(e===null)return;let{renderGrid:l=!0,isExporting:c}=s,[d,u]=_T(e,o),h=PT({canvas:e,scale:o,normalizedWidth:d,normalizedHeight:u,theme:a.theme,isExporting:c,canvasBackgroundColor:s.canvasBackgroundColor});h.scale(a.zoom.value,a.zoom.value),l&&a.gridSize&&XL(h,a.gridSize,a.scrollX,a.scrollY,a.zoom,d/a.zoom.value,u/a.zoom.value);let m=new Set;i.forEach(p=>{p.groupIds.length>0&&a.frameToHighlight&&a.selectedElementIds[p.id]&&(Ks(p,a.frameToHighlight,n)||p.groupIds.find(f=>m.has(f)))&&p.groupIds.forEach(f=>m.add(f))}),i.filter(p=>!ti(p)).forEach(p=>{try{if((p.frameId||a.frameToHighlight?.id)&&a.frameRendering.enabled&&a.frameRendering.clip){h.save();let f=EE(p,n,a);f&&Xu(p,n,a)&&N3(f,h,s,a),hp(p,n,r,t,h,s,a),h.restore()}else hp(p,n,r,t,h,s,a);c||$3(p,h,a,n)}catch(f){console.error(f)}}),i.filter(p=>ti(p)).forEach(p=>{try{let f=()=>{if(hp(p,n,r,t,h,s,a),ti(p)&&(c||sr(p)&&s.embedsValidationStatus.get(p.id)!==!0)&&p.width&&p.height){let g=TT(p);hp(g,n,r,t,h,s,a)}c||$3(p,h,a,n)};if((p.frameId||a.frameToHighlight?.id)&&a.frameRendering.enabled&&a.frameRendering.clip){h.save();let g=EE(p,n,a);g&&Xu(p,n,a)&&N3(g,h,s,a),f(),h.restore()}else f()}catch(f){console.error(f)}})},m4=hb(e=>{F3(e)},{trailing:!0}),DT=(e,t)=>{if(t){m4(e);return}F3(e)}}),KL,qL,QL,B3,z3,Jp,wb,P2,$f=I(()=>{"use strict";D(),rn(),FJ(),ne(),ae(),$i(),El(),iB(),hh(),Sr(),Pe(),wt(),xe(),LT(),KL="<!-- svg-source:excalidraw -->",qL=(e,t)=>{if(e.width<=t)return e;let n=document.createElement("canvas").getContext("2d");n.font=xn({fontFamily:e.fontFamily,fontSize:e.fontSize});let r=e.text;if(n.measureText(r).width>t)for(let i=r.length;i>0;i--){let o=`${r.slice(0,i)}...`;if(n.measureText(o).width<=t){r=o;break}}return Le(e,{text:r,width:t})},QL=(e,t)=>{let n=[],r=0,i=0;for(let o of e){if(ke(o)){Gu(o)?r++:i++;let a=ri({x:o.x,y:o.y-Zt.nameOffsetY,fontFamily:zn.Assistant,fontSize:Zt.nameFontSize,lineHeight:Zt.nameLineHeight,strokeColor:t.exportWithDarkMode?Zt.nameColorDarkTheme:Zt.nameColorLightTheme,text:WT(o,Gu(o)?r:i)});a.y-=a.height,a=qL(a,o.width),n.push(a)}n.push(o)}return n},B3=(e,t)=>(t=t||ml().frameRendering,{enabled:e?!0:t.enabled,outline:e?!1:t.outline,name:e?!1:t.name,clip:e?!0:t.clip}),z3=({elements:e,exportingFrame:t,frameRendering:n,exportWithDarkMode:r})=>{let i;return t?i=Tb(e,t):n.enabled&&n.name?i=QL(e,{exportWithDarkMode:r}):i=e,i},Jp=async({data:e,config:t})=>{let n=Object.assign({},t),{files:r}=e,{exportingFrame:i}=n,o=e.elements,a=q5(e.appState,null),s=B3(i??null,a.frameRendering??null),l=z3({elements:o,exportingFrame:i,exportWithDarkMode:a.exportWithDarkMode,frameRendering:s});i&&(n.padding=0),n.fit=n.fit??(n.width!=null||n.height!=null||n.maxWidthOrHeight!=null||n.widthOrHeight!=null?"contain":"none");let c=n.fit==="contain";(n.x!=null||n.x!=null)&&(n.fit="none"),n.fit==="cover"&&(n.padding&&!Pt.PROD&&console.warn("`padding` is ignored when `fit` is set to `cover`"),n.padding=0),n.padding=n.padding??0,n.scale=n.scale??1,n.origin=n.origin??"canvas",n.position=n.position??"center",n.maxWidthOrHeight!=null&&n.widthOrHeight!=null&&(Pt.PROD||console.warn("`maxWidthOrHeight` is ignored when `widthOrHeight` is set"),n.maxWidthOrHeight=void 0),(n.maxWidthOrHeight!=null||n.width!=null||n.height!=null)&&n.getDimensions&&(Pt.PROD||console.warn("`getDimensions` is ignored when `width`, `height`, or `maxWidthOrHeight` is set"),n.getDimensions=void 0);let d=1,u=P2(i?[i]:g4(l)),[h,m,p,f]=u,[g,b,v,y]=u;if(n.width!=null?(v=n.width,n.padding&&c&&(v-=n.padding*2),n.height?(y=n.height,n.padding&&c&&(y-=n.padding*2)):y*=v/p):n.height!=null&&(y=n.height,n.padding&&c&&(y-=n.padding*2),v*=y/f),n.maxWidthOrHeight!=null||n.widthOrHeight!=null){c&&n.padding&&(n.maxWidthOrHeight!=null?n.maxWidthOrHeight-=n.padding*2:n.widthOrHeight!=null&&(n.widthOrHeight-=n.padding*2));let M=Math.max(v,y);n.widthOrHeight!=null?d=n.widthOrHeight/M:n.maxWidthOrHeight!=null&&(d=n.maxWidthOrHeight<M?n.maxWidthOrHeight/M:1),v*=d,y*=d}else if(n.getDimensions){let M=n.getDimensions(v,y);v=M.width,y=M.height,n.scale=M.scale??n.scale}else if(c&&n.padding&&n.width==null&&n.height==null){let M=v/y;v-=n.padding*2,y-=n.padding*2/M}if(n.fit==="contain"&&!n.maxWidthOrHeight||c&&n.padding)if(n.fit==="contain"){let M=v/p,C=y/f;d=Math.min(M,C)}else{let M=(v-n.padding*2)/v,C=(y-n.padding*2)/y;d=Math.min(M,C)}else if(n.fit==="cover"){let M=v/p,C=y/f;d=Math.max(M,C)}g=n.x??h,b=n.y??m,n.origin==="content"&&(n.x!=null&&(g+=h),n.y!=null&&(b+=m)),n.position==="center"&&(g-=v/d/2-(n.x==null?p:v+n.padding*2)/2,b-=y/d/2-(n.y==null?f:y+n.padding*2)/2);let w=n.createCanvas?n.createCanvas():document.createElement("canvas"),T=n.padding/d;d*=n.scale,v*=n.scale,y*=n.scale,w.width=v+n.padding*2*n.scale,w.height=y+n.padding*2*n.scale;let{imageCache:k}=await IT({imageCache:new Map,fileIds:kT(l).map(M=>M.fileId),files:r||{}});return DT({canvas:w,rc:qt.canvas(w),elementsMap:cl(Fe(l)),allElementsMap:cl(Fe(o)),visibleElements:l,appState:{...a,frameRendering:s,width:v,height:y,offsetLeft:0,offsetTop:0,scrollX:-g+T,scrollY:-b+T,zoom:{value:VS},shouldCacheIgnoreZoom:!1,theme:n.theme||$e.LIGHT},scale:d,renderConfig:{canvasBackgroundColor:n.canvasBackgroundColor===!1?null:n.canvasBackgroundColor||a.viewBackgroundColor||Li,imageCache:k,renderGrid:!1,isExporting:!0,embedsValidationStatus:new Map,elementsPendingErasure:new Set}}),w},wb=async({data:e,config:t})=>{let n=Object.assign({},t);n.exportingFrame=n.exportingFrame??null;let r=e.elements,i=B3(n?.exportingFrame??null,e.appState.frameRendering??null),{exportPadding:o=lh,exportWithDarkMode:a=!1,viewBackgroundColor:s,exportScale:l=1,exportEmbedScene:c}=e.appState,d=z3({elements:r,exportingFrame:n.exportingFrame,exportWithDarkMode:a,frameRendering:i});n.exportingFrame&&(o=0);let u="";if(c)try{u=await(await Promise.resolve().then(()=>(qp(),Kp))).encodeSvgMetadata({text:Qp(r,e.appState,e.files||{},"local")})}catch(P){console.error(P)}let[h,m,p,f]=P2(n.exportingFrame?[n.exportingFrame]:g4(d));p+=o*2,f+=o*2;let g=document.createElementNS(It,"svg");g.setAttribute("version","1.1"),g.setAttribute("xmlns",It),g.setAttribute("viewBox",`0 0 ${p} ${f}`),g.setAttribute("width",`${p*l}`),g.setAttribute("height",`${f*l}`),a&&g.setAttribute("filter",lb);let b="https://excalidraw.com/";Pt.VITE_IS_EXCALIDRAW_NPM_PACKAGE&&(b=window.EXCALIDRAW_ASSET_PATH||`https://unpkg.com/${Pt.VITE_PKG_NAME}@${Pt.PKG_VERSION}`,b?.startsWith("/")&&(b=b.replace("/",`${window.location.origin}/`)),b=`${b}/dist/excalidraw-assets/`);let v=-h+o,y=-m+o,w=gE(r),T="",k=Fe(r);for(let P of w){let[R,A,_,$]=_e(P,k),W=(_-R)/2-(P.x-R),H=($-A)/2-(P.y-A);T+=`<clipPath id=${P.id}>
143
- <rect transform="translate(${P.x+v} ${P.y+y}) rotate(${P.angle} ${W} ${H})"
144
- width="${P.width}"
145
- height="${P.height}"
146
- >
147
- </rect>
148
- </clipPath>`}if(g.innerHTML=`
149
- ${KL}
150
- ${u}
151
- <defs>
152
- <style class="style-fonts">
153
- @font-face {
154
- font-family: "Virgil";
155
- src: url("https://excalidraw.com/Virgil.woff2");
156
- }
157
- @font-face {
158
- font-family: "Cascadia";
159
- src: url("https://excalidraw.com/Cascadia.woff2");
160
- }
161
- @font-face {
162
- font-family: "Assistant";
163
- src: url("${b}Assistant-Regular.woff2");
164
- }
165
- </style>
166
- ${T}
167
- </defs>
168
- `,e.appState.exportBackground&&s){let P=g.ownerDocument.createElementNS(It,"rect");P.setAttribute("x","0"),P.setAttribute("y","0"),P.setAttribute("width",`${p}`),P.setAttribute("height",`${f}`),P.setAttribute("fill",s),g.appendChild(P)}let M=qt.svg(g),C=n.renderEmbeddables??!1;return zF(d,cl(Fe(d)),M,g,e.files||{},{offsetX:v,offsetY:y,isExporting:!0,exportWithDarkMode:a,renderEmbeddables:C,frameRendering:i,canvasBackgroundColor:s,embedsValidationStatus:C?new Map(d.filter(P=>ke(P)).map(P=>[P.id,!0])):new Map}),g},P2=e=>{let[t,n,r,i]=Nt(e),o=Zn(t,r),a=Zn(n,i);return[t,n,o,a]}}),aB,fc,sB,cu,du,vi,xi,He,H3,RT,OT,NT,lB,cB,dB,uB,Bi=I(()=>{"use strict";D(),ae(),ne(),aB=5,fc=5,sB=4,cu=4,du=1,vi=[0,2,4,6,8],xi=(e,t)=>t.map(n=>Ct[e][n]),He={transparent:V2,charcoal:zu,white:Li,gray:xi("gray",vi),red:xi("red",vi),pink:xi("pink",vi),grape:xi("grape",vi),violet:xi("violet",vi),blue:xi("blue",vi),cyan:xi("cyan",vi),teal:xi("teal",vi),green:xi("green",vi),yellow:xi("yellow",vi),orange:xi("orange",vi),bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},H3=W$(He,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),RT=[He.charcoal,He.red[cu],He.green[cu],He.blue[cu],He.yellow[cu]],OT=[He.transparent,He.red[du],He.green[du],He.blue[du],He.yellow[du]],NT=[He.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],lB={transparent:He.transparent,white:He.white,gray:He.gray,charcoal:He.charcoal,bronze:He.bronze,...H3},cB={transparent:He.transparent,white:He.white,gray:He.gray,charcoal:He.charcoal,bronze:He.bronze,...H3},dB=e=>[He.cyan[e],He.blue[e],He.violet[e],He.grape[e],He.pink[e],He.green[e],He.teal[e],He.yellow[e],He.orange[e],He.red[e]],uB=(e,t,n)=>`#${((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}`}),wi,bt,Ra,G3,Fs,uu,Zd,Ig,W3,JL,hB,Gm,Yr,j3,eR,tR,nR,U3,rR,iR,mB,pB=I(()=>{"use strict";D(),Bi(),ae(),Pe(),sa(),wi=32,bt=12,Ra=256,G3=50,Fs="NOT_SPREADSHEET",uu="VALID_SPREADSHEET",Zd=e=>{let t=/^([-+]?)[$€£¥₩]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,"")):null},Ig=(e,t)=>e.slice(1).every(n=>Zd(n[t])!==null),W3=e=>{let t=e[0].length;if(t>2)return{type:Fs,reason:"More than 2 columns"};if(t===1){if(!Ig(e,0))return{type:Fs,reason:"Value is not numeric"};let l=Zd(e[0][0])===null,c=(l?e.slice(1):e).map(d=>Zd(d[0]));return c.length<2?{type:Fs,reason:"Less than two rows"}:{type:uu,spreadsheet:{title:l?e[0][0]:null,labels:null,values:c}}}let n=Ig(e,0),r=Ig(e,1);if(!n&&!r)return{type:Fs,reason:"Value is not numeric"};let[i,o]=r?[0,1]:[1,0],a=Zd(e[0][o])===null,s=a?e.slice(1):e;return s.length<2?{type:Fs,reason:"Less than 2 rows"}:{type:uu,spreadsheet:{title:a?e[0][o]:null,labels:s.map(l=>l[i]),values:s.map(l=>Zd(l[o]))}}},JL=e=>{let t=[];for(let n=0;n<e[0].length;n++){let r=[];for(let i=0;i<e.length;i++)r.push(e[i][n]);t.push(r)}return t},hB=e=>{let t=e.trim().split(`
169
- `).map(i=>i.trim().split(" "));if(t.length&&t[0].length!==2&&(t=e.trim().split(`
170
- `).map(i=>i.trim().split(","))),t.length===0)return{type:Fs,reason:"No values"};let n=t[0].length;if(!t.every(i=>i.length===n))return{type:Fs,reason:"All rows don't have same number of columns"};let r=W3(t);if(r.type!==uu){let i=W3(JL(t));if(i.type===uu)return i}return r},Gm=dB(sB),Yr={fillStyle:"hachure",fontFamily:aa,fontSize:Ni,opacity:100,roughness:1,strokeColor:zu,roundness:null,strokeStyle:"solid",strokeWidth:1,verticalAlign:Nr.MIDDLE,locked:!1},j3=e=>{let t=(wi+bt)*e.values.length+bt,n=Ra+bt*2;return{chartWidth:t,chartHeight:n}},eR=(e,t,n,r,i)=>e.labels?.map((o,a)=>ri({groupIds:[r],backgroundColor:i,...Yr,text:o.length>8?`${o.slice(0,5)}...`:o,x:t+a*(wi+bt)+bt*2,y:n+bt/2,width:wi,angle:5.87,fontSize:16,textAlign:"center",verticalAlign:"top"}))||[],tR=(e,t,n,r,i)=>{let o=ri({groupIds:[r],backgroundColor:i,...Yr,x:t-bt,y:n-bt,text:"0",textAlign:"right"}),a=ri({groupIds:[r],backgroundColor:i,...Yr,x:t-bt,y:n-Ra-o.height/2,text:Math.max(...e.values).toLocaleString(),textAlign:"right"});return[o,a]},nR=(e,t,n,r,i)=>{let{chartWidth:o,chartHeight:a}=j3(e),s=Ua({backgroundColor:i,groupIds:[r],...Yr,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,width:o,points:[[0,0],[o,0]]}),l=Ua({backgroundColor:i,groupIds:[r],...Yr,type:"line",x:t,y:n,startArrowhead:null,endArrowhead:null,height:a,points:[[0,0],[0,-a]]}),c=Ua({backgroundColor:i,groupIds:[r],...Yr,type:"line",x:t,y:n-Ra-bt,startArrowhead:null,endArrowhead:null,strokeStyle:"dotted",width:o,opacity:G3,points:[[0,0],[o,0]]});return[s,l,c]},U3=(e,t,n,r,i,o)=>{let{chartWidth:a,chartHeight:s}=j3(e),l=e.title?ri({backgroundColor:i,groupIds:[r],...Yr,text:e.title,x:t+a/2,y:n-Ra-bt*2-Ni,roundness:null,textAlign:"center"}):null,c=o?rs({backgroundColor:i,groupIds:[r],...Yr,type:"rectangle",x:t,y:n-s,width:a,height:s,strokeColor:zu,fillStyle:"solid",opacity:6}):null;return[...c?[c]:[],...l?[l]:[],...eR(e,t,n,r,i),...tR(e,t,n,r,i),...nR(e,t,n,r,i)]},rR=(e,t,n)=>{let r=Math.max(...e.values),i=ni(),o=Gm[Math.floor(Math.random()*Gm.length)];return[...e.values.map((a,s)=>{let l=a/r*Ra;return rs({backgroundColor:o,groupIds:[i],...Yr,type:"rectangle",x:t+s*(wi+bt)+bt,y:n-l-bt,width:wi,height:l})}),...U3(e,t,n,i,o,Pt.DEV)]},iR=(e,t,n)=>{let r=Math.max(...e.values),i=ni(),o=Gm[Math.floor(Math.random()*Gm.length)],a=0,s=[];for(let f of e.values){let g=a*(wi+bt),b=-(f/r)*Ra;s.push([g,b]),a++}let l=Math.max(...s.map(f=>f[0])),c=Math.max(...s.map(f=>f[1])),d=Math.min(...s.map(f=>f[0])),u=Math.min(...s.map(f=>f[1])),h=Ua({backgroundColor:o,groupIds:[i],...Yr,type:"line",x:t+bt+wi/2,y:n-bt,startArrowhead:null,endArrowhead:null,height:c-u,width:l-d,strokeWidth:2,points:s}),m=e.values.map((f,g)=>{let b=g*(wi+bt)+bt/2,v=-(f/r)*Ra+bt/2;return rs({backgroundColor:o,groupIds:[i],...Yr,fillStyle:"solid",strokeWidth:2,type:"ellipse",x:t+b+wi/2,y:n+v-bt*2,width:bt,height:bt})}),p=e.values.map((f,g)=>{let b=g*(wi+bt)+bt/2,v=f/r*Ra+bt/2+bt;return Ua({backgroundColor:o,groupIds:[i],...Yr,type:"line",x:t+b+wi/2+bt/2,y:n-v,startArrowhead:null,endArrowhead:null,height:v,strokeStyle:"dotted",opacity:G3,points:[[0,0],[0,v]]})});return[...U3(e,t,n,i,o,Pt.DEV),h,...p,...m]},mB=(e,t,n,r)=>e==="line"?iR(t,n,r):rR(t,n,r)});function fB(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let r=n.textContent?.trim();r&&t.push({type:"text",value:r})}else if(n instanceof HTMLImageElement){let r=n.getAttribute("src");r&&r.startsWith("http")&&t.push({type:"imageUrl",value:r})}else t=t.concat(fB(n));return t}var HJ,mE,Sb,oR,gB,aR,$T,sR,lR,EB,cR,FT,BT,Zu,dR,Xc=I(()=>{"use strict";D(),pB(),ae(),xe(),cs(),wt(),Sr(),ne(),HJ="clipboard"in navigator&&"readText"in navigator.clipboard,mE="clipboard"in navigator&&"writeText"in navigator.clipboard,Sb="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,oR=e=>!!([ei.excalidraw,ei.excalidrawClipboard,ei.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),gB=({types:e,files:t})=>{!e&&!t&&console.warn("createPasteEvent: no types or files provided");let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e))try{if(n.clipboardData?.setData(r,i),n.clipboardData?.getData(r)!==i)throw new Error(`Failed to set "${r}" as clipboardData item`)}catch(o){throw new Error(o.message)}if(t){let r=-1;for(let i of t){r++;try{if(n.clipboardData?.items.add(i),n.clipboardData?.files[r]!==i)throw new Error(`Failed to set file "${i.name}" as clipboardData item`)}catch(o){throw new Error(o.message)}}}return n},aR=({elements:e,files:t})=>{let n=Fe(e),r=new Set(e.filter(s=>ke(s))),i=!1,o=e.reduce((s,l)=>(Eo(l)&&(i=!0,t&&t[l.fileId]&&(s[l.fileId]=t[l.fileId])),s),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let a={type:ei.excalidrawClipboard,elements:e.map(s=>{if(Fr(s,n)&&!r.has(Fr(s,n))){let l=Vu(s);return re(l,{frameId:null}),l}return s}),files:t?o:void 0};return JSON.stringify(a)},$T=async(e,t,n)=>{await Zu(aR({elements:e,files:t}),n)},sR=e=>{let t=hB(e);return t.type===uu?{spreadsheet:t.spreadsheet}:null},lR=e=>{let t=e.clipboardData?.getData("text/html");if(!t)return null;try{let n=new DOMParser().parseFromString(t,"text/html"),r=fB(n.body);if(r.length)return{type:"mixedContent",value:r}}catch(n){console.error(`error in parseHTMLFromPaste: ${n.message}`)}return null},EB=async()=>{let e={};try{if(navigator.clipboard?.readText)return{"text/plain":await navigator.clipboard?.readText()}}catch(n){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${n.message}). Failling back to navigator.clipboard.read()`);else throw n}let t;try{t=await navigator.clipboard?.read()}catch(n){if(n.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${n.message}`),e;throw n}for(let n of t)for(let r of n.types)if(q2(h$,r))try{e[r]=await(await n.getType(r)).text()}catch(i){console.warn(`Cannot retrieve ${r} from clipboardItem: ${i.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},cR=async(e,t=!1)=>{try{let n=!t&&e&&lR(e);return n?n.value.every(r=>r.type==="text")?{type:"text",value:e.clipboardData?.getData("text/plain")||n.value.map(r=>r.value).join(`
171
- `).trim()}:n:{type:"text",value:(e.clipboardData?.getData("text/plain")||"").trim()}}catch{return{type:"text",value:""}}},FT=async(e,t=!1)=>{let n=await cR(e,t);if(n.type==="mixedContent")return{mixedContent:n.value};try{let r=!t&&sR(n.value);if(r)return r}catch(r){console.error(r)}try{let r=JSON.parse(n.value),i=r.type===ei.excalidrawClipboardWithAPI;if(oR(r))return{elements:r.elements,files:r.files,text:t?JSON.stringify(r.elements,null,2):void 0,programmaticAPI:i}}catch{}return{text:n.value}},BT=async e=>{try{await navigator.clipboard.write([new window.ClipboardItem({[ve.png]:e})])}catch(t){if(ch(e))await navigator.clipboard.write([new window.ClipboardItem({[ve.png]:await e})]);else throw t}},Zu=async(e,t)=>{if(mE)try{await navigator.clipboard.writeText(e||"");return}catch(n){console.error(n)}try{if(t){if(t.clipboardData?.setData("text/plain",e||""),t.clipboardData?.getData("text/plain")!==e)throw new Error("Failed to setData on clipboardEvent");return}}catch(n){console.error(n)}if(!dR(e))throw new Error("Error copying to clipboard.")},dR=e=>{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(o){console.error(o)}return n.remove(),i}}),zT,p4,pE,GJ,mh=I(()=>{"use strict";D(),$f(),hh(),ae(),qp(),El(),Xc(),FI(),zT=async({data:e,config:t})=>Jp({data:e,config:t}),p4=async({data:e,config:t})=>{let{mimeType:n=ve.png,quality:r}=t||{};n===ve.png&&typeof r=="number"&&console.warn(`"quality" will be ignored for "${ve.png}" mimeType`),n==="image/jpg"&&(n=ve.jpg),n===ve.jpg&&t?.canvasBackgroundColor&&(console.warn(`Defaulting "exportBackground" to "true" for "${ve.jpg}" mimeType`),t={...t,canvasBackgroundColor:e.appState?.viewBackgroundColor||Li});let i=await Jp({data:e,config:t});return r=r||(/image\/jpe?g/.test(n)?.92:.8),new Promise((o,a)=>{i.toBlob(async s=>{if(!s)return a(new Error("couldn't export to blob"));s&&n===ve.png&&e.appState?.exportEmbedScene&&(s=await CT({blob:s,metadata:Qp(e.elements,e.appState,e.files||{},"local")})),o(s)},n,r)})},pE=async({data:e,config:t})=>{let{elements:n,appState:r}=yb({...e,files:e.files||{}},null,null),i={...r,exportPadding:t?.padding},o=at(n),a=e.files||{};return wb({data:{elements:o,appState:i,files:a},config:{exportingFrame:t?.exportingFrame,renderEmbeddables:t?.renderEmbeddables}})},GJ=async({type:e,data:t,config:n})=>{if(e==="svg"){let r=await pE({data:t,config:n});await Zu(r.outerHTML)}else if(e==="png")await BT(p4({data:t,config:n}));else if(e==="json")await $T(t.elements,t.files);else throw new Error("Invalid export type")}}),uR,hR,V3,Y3,Z3,mR,bB,yB=I(()=>{"use strict";D(),xe(),ur(),rn(),ne(),uR=e=>e.type==="diamond"?[[e.width/2,0],[e.width,e.height/2],[e.width/2,e.height],[0,e.height/2]]:[[0,0],[0+e.width,0],[0+e.width,e.height],[0,e.height]],hR=e=>Ne(e)||vr(e)?e.points:uR(e),V3=e=>{let t=e.reduce((n,[r,i])=>(n.minY=Math.min(n.minY,i),n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.maxY=Math.max(n.maxY,i),n),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return t.cx=(t.maxX+t.minX)/2,t.cy=(t.maxY+t.minY)/2,t},Y3=e=>{let t=hR(e),{cx:n,cy:r}=V3(t),i=[n,r],o=t.map(d=>Wt([d[0],d[1]],i,e.angle)),{minX:a,minY:s,maxX:l,maxY:c}=V3(o);return[a+e.x,s+e.y,l+e.x,c+e.y]},Z3=(e,t,n=!1)=>{let r=Y3(e),i=t[0]<=r[0]&&t[2]>=r[2]&&t[1]<=r[1]&&t[3]>=r[3];return n?i?!0:r[0]<=t[0]&&r[2]>=t[2]&&r[1]<=t[1]&&r[3]>=t[3]:i},mR=(e,t)=>{let n=Y3(e);return(ap(n[0],t[0],t[2])||ap(t[0],n[0],n[2]))&&(ap(n[1],t[1],t[3])||ap(t[1],n[1],n[3]))},bB=({elements:e,bounds:t,type:n,errorMargin:r=0})=>{nT(t)&&(t=rl(t,Fe(e)));let i=[t[0]-r,t[1]-r,t[2]+r,t[3]+r],o=new Set;for(let a of e)if(!o.has(a.id)&&(n==="overlap"?mR(a,i):n==="inside"?Z3(a,i):Z3(a,i,!0))){if(o.add(a.id),a.boundElements)for(let s of a.boundElements)o.add(s.id);he(a)&&a.containerId&&o.add(a.containerId),yt(a)&&(a.startBinding&&o.add(a.startBinding.elementId),a.endBinding&&o.add(a.endBinding?.elementId))}return e.filter(a=>o.has(a.id))}});function pR(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function vB(e,t){return e[0]*t[1]-t[0]*e[1]}function WJ(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function fE(e,t){return[e[0]-t[0],e[1]-t[1]]}function fR(e,t){let n=fE(e[1],e[0]),r=fE(t,e[0]),i=vB(n,r);return Math.abs(i)<xB}function X3(e,t){let n=fE(e[1],e[0]),r=fE(t,e[0]);return vB(n,r)<0}function gR(e,t){return fR(e,t[0])||fR(e,t[1])||(X3(e,t[0])?!X3(e,t[1]):X3(e,t[1]))}function jJ(e,t){return WJ(pR(e),pR(t))&&gR(e,t)&&gR(t,e)}var xB,UJ=I(()=>{"use strict";D(),xB=1e-6}),VJ=I(()=>{"use strict";D(),mh(),yB(),UJ()});function ER(e,t,n){let r=V5(t,n),i=V5(e,n);return r.some(o=>i.some(a=>jJ(o,a)))}var HT,K3,q3,Q3,Ks,f4,wB,na,gE,g4,_p,SB,Fr,TB,Pp,Dp,E4,GT,Gc,Wm,EE,Xu,WT,Tb,Sr=I(()=>{"use strict";D(),Pe(),ur(),Kt(),ne(),wt(),pt(),Fi(),rn(),VJ(),xe(),HT=(e,t,n)=>{let r=Fe(e);for(let i of t)if(i.frameId){let o=n.get(i.id),a=n.get(i.frameId);if(o){let s=r.get(o);s&&re(s,{frameId:a??i.frameId},!1)}}},K3=(e,t,n)=>Wm(xE(e,t,n,!1)).filter(r=>!ke(r)&&!r.frameId||r.frameId===t.id),q3=(e,t,n,r)=>xE(e,t,r).some(i=>i.id===n.id),Q3=(e,t,n)=>{let[r,i,o,a]=_e(t,n),[s,l,c,d]=Nt(e);return r<=s&&i<=l&&o>=c&&a>=d},Ks=(e,t,n)=>Q3([e],t,n)||ER(e,t,n)||q3([t],e,t,n),f4=(e,t,n)=>{let[r,i,o,a]=_e(t,n);return mc([r,i],[e.x,e.y],[o,a])},wB=e=>{let t=new Map;for(let n of e){let r=ke(n)?n.id:n.frameId;r&&!t.has(r)&&t.set(r,na(e,r))}return t},na=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n},gE=e=>e.filter(t=>ke(t)),g4=e=>{let t=Fe(gE(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},_p=(e,t,n,r)=>{let i=na(e,t.id),o=new Set(i),a=new Set([...K3(e,t,r),...i.filter(h=>q3(e,h,t,r))]),s=i.filter(h=>!a.has(h)),l=new Set(Array.from(a).flatMap(h=>h.groupIds));for(let h of s)if(!ER(h,t,r))h.groupIds.length===0&&o.delete(h);else if(h.groupIds.length>0)for(let m of h.groupIds)l.add(m);for(let h of s)if(h.groupIds.length>0){let m=!0;for(let p of h.groupIds)l.has(p)&&(m=!1);m&&o.delete(h)}let c=Array.from(a).filter(h=>h.groupIds.length===0);for(let h of c)o.add(h);let d=Array.from(a).filter(h=>h.groupIds.length>0),u=ET(d,n);for(let[h,m]of Object.entries(u))if(m){let p=hn(e,h);if(Q3(p,t,r))for(let f of p)o.add(f)}return[...o].filter(h=>!(he(h)&&h.containerId))},SB=(e,t,n)=>Wm(e,K3(e,t,n)),Fr=(e,t)=>e.frameId&&t.get(e.frameId)||null,TB=(e,t)=>{let n=new Set,r=Fe(e);e=Wm(e);for(let a of e)ke(a)&&a.id!==t.id&&n.add(a.id);let i=new Set,o=[];for(let a of e)if(!(ke(a)||a.frameId&&n.has(a.frameId)))if(a.groupIds.length){let s=a.groupIds.at(-1);if(!i.has(s)){i.add(s);let l=hn(e,s);if(l.some(c=>Ks(c,t,r)))for(let c of l)o.push(c)}}else Ks(a,t,r)&&o.push(a);return o},Pp=(e,t,n)=>{let r=Fe(e),i=new Map;for(let l of e.values())l.frameId===n.id&&i.set(l.id,!0);let o=new Set(t.map(l=>l.id)),a=[],s=new Set;for(let l of t)ke(l)&&l.id!==n.id&&s.add(l.id);for(let l of Wm(e,t)){if(ke(l)||l.frameId&&s.has(l.frameId))continue;i.has(l.id)||a.push(l);let c=Ue(l,r);c&&!o.has(c.id)&&!i.has(c.id)&&a.push(c)}for(let l of a)re(l,{frameId:n.id},!1);return e},Dp=(e,t)=>{let n=new Map,r=new Map;for(let i of e)if(i.frameId){n.set(i.id,i);let o=r.get(i.frameId)||[];o.push(i);let a=Ue(i,t);a&&(n.set(a.id,a),o.push(a)),r.set(i.frameId,o)}for(let[,i]of n)re(i,{frameId:null},!1)},E4=(e,t)=>{let n=na(e,t.id);return Dp(n,Fe(e)),e},GT=(e,t,n,r)=>Pp(E4(e,n),t,n).slice(),Gc=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(r);if(t.editingGroupId)for(let s of r)s.groupIds.length===0?i.add(s):s.groupIds.flatMap(l=>hn(e,l)).forEach(l=>i.add(l));let o=new Set,a=Fe(e);return i.forEach(s=>{s.frameId&&!ke(s)&&!Xu(s,a,t)&&o.add(s)}),o.size>0&&Dp(o,a),e},Wm=(e,t)=>{let n=new Set,r=t||e;for(let a of r.values()){let s=a.groupIds[a.groupIds.length-1];s&&n.add(s)}let i=new Set;for(let a of n)hn(e,a).some(s=>ke(s))&&i.add(a);let o=[];for(let a of r.values())i.has(a.groupIds[a.groupIds.length-1])||o.push(a);return o},EE=(e,t,n)=>{let r=he(e)&&cr(e,t)||e;return n.selectedElementIds[r.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Fr(r,t)},Xu=(e,t,n)=>{let r=EE(e,t,n),i=he(e)&&cr(e,t)||e;if(r){if(!n.selectedElementIds[e.id]||!n.selectedElementsAreBeingDragged)return!0;if(i.groupIds.length===0)return Ks(i,r,t);let o=new Set(i.groupIds.flatMap(a=>hn(t,a)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let a=new Set(st(t,n));if(n.frameToHighlight!==null)return!0;a.forEach(s=>{o.delete(s)})}for(let a of o)if(ke(a))return!1;for(let a of o)if(Ks(a,r,t))return!0}return!1},WT=(e,t)=>e.name===null?Gu(e)?`Frame ${t}`:`AI Frame $${t}`:e.name,Tb=(e,t)=>bB({elements:e,bounds:t,type:"overlap"}).filter(n=>!n.frameId||n.frameId===t.id)});function YJ(e){let t=CB(e),n=new Path2D(t);return bE.set(e,n),n}function ZJ(e){return bE.get(e)}function CB(e){let t=e.simulatePressure?e.points:e.points.length?e.points.map(([r,i],o)=>[r,i,e.pressures[o]]):[[0,0,.5]],n={simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:r=>Math.sin(r*Math.PI/2),last:!!e.lastCommittedPoint};return XJ(Z1(t,n))}function bR(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function XJ(e){if(!e.length)return"";let t=e.length-1;return e.reduce((n,r,i,o)=>(i===t?n.push(r,bR(r,o[0]),"L",o[0],"Z"):n.push(r,bR(r,o[i+1])),n),["M",e[0],"Q"]).join(" ").replace(AB,"$1")}var b4,yR,J3,e6,jm,y4,vR,xR,MB,t6,n6,wR,Um,up,IB,r6,i6,kB,hp,bE,AB,ls=I(()=>{"use strict";D(),xe(),rn(),ne(),ur(),$i(),ae(),Kt(),Tr(),Sr(),ca(),b4="invert(100%) hue-rotate(180deg) saturate(1.25)",yR=ml(),J3=(e,t)=>Eo(e)&&!t.imageCache.has(e.fileId),e6=(e,t,n)=>n.theme===$e.DARK&&Eo(e)&&!J3(e,t)&&t.imageCache.get(e.fileId)?.mimeType!==ve.svg,jm=e=>e.type==="freedraw"?e.strokeWidth*12:20,y4=(e,t,n)=>{let r=(t?.opacity??100)*e.opacity/1e4;return(n.has(e.id)||t&&n.has(t.id))&&(r*=M$/100),r},vR=(e,t,n)=>{let r=jm(e),[i,o,a,s]=_e(e,t),l=Ne(e)||vr(e)?Zn(i,a):e.width,c=Ne(e)||vr(e)?Zn(o,s):e.height,d=l*window.devicePixelRatio+r*2,u=c*window.devicePixelRatio+r*2,h=n.value;return(d*h>32767||u*h>32767)&&(h=Math.min(32767/d,32767/u)),d*u*h*h>16777216&&(h=Math.sqrt(16777216/(d*u))),d=Math.floor(d*h),u=Math.floor(u*h),{width:d,height:u,scale:h}},xR=(e,t,n,r,i)=>{let o=document.createElement("canvas"),a=o.getContext("2d"),s=jm(e),{width:l,height:c,scale:d}=vR(e,t,n);o.width=l,o.height=c;let u=0,h=0;if(Ne(e)||vr(e)){let[p,f]=_e(e,t);u=e.x>p?Zn(e.x,p)*window.devicePixelRatio*d:0,h=e.y>f?Zn(e.y,f)*window.devicePixelRatio*d:0,a.translate(u,h)}a.save(),a.translate(s*d,s*d),a.scale(window.devicePixelRatio*d,window.devicePixelRatio*d);let m=qt.canvas(o);return e6(e,r,i)&&(a.filter=b4),Um(e,m,a,r,i),a.restore(),{element:e,canvas:o,theme:i.theme,scale:d,zoomValue:n.value,canvasOffsetX:u,canvasOffsetY:h,boundTextElementVersion:Ue(e,t)?.version||null,containingFrameOpacity:Fr(e,t)?.opacity||100}},MB=14,t6=document.createElement("img"),t6.src=`data:${ve.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`,n6=document.createElement("img"),n6.src=`data:${ve.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`,wR=(e,t,n)=>{t.fillStyle="#E7E7E7",t.fillRect(0,0,e.width,e.height);let r=Math.min(e.width,e.height),i=Math.min(r,Math.min(r*.4,100));t.drawImage(e.status==="error"?n6:t6,e.width/2-i/2,e.height/2-i/2,i,i)},Um=(e,t,n,r,i)=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{n.lineJoin="round",n.lineCap="round",t.draw(jt.get(e));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",jt.get(e).forEach(o=>{t.draw(o)});break}case"freedraw":{n.save(),n.fillStyle=e.strokeColor;let o=ZJ(e),a=jt.get(e);a&&t.draw(a),n.fillStyle=e.strokeColor,n.fill(o),n.restore();break}case"image":{let o=Eo(e)?r.imageCache.get(e.fileId)?.image:void 0;o!=null&&!(o instanceof Promise)?(e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,hl(Math.min(e.width,e.height),e)),n.clip()),n.drawImage(o,0,0,e.width,e.height)):wR(e,n,i.zoom.value);break}default:if(he(e)){let o=qS(e.text),a=o&&!n.canvas.isConnected;a&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",o?"rtl":"ltr"),n.save(),n.font=xn(e),n.fillStyle=e.strokeColor,n.textAlign=e.textAlign;let s=e.text.replace(/\r\n?/g,`
172
- `).split(`
173
- `),l=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,c=Mu(e.fontSize,e.lineHeight),d=hT(e.fontFamily,e.fontSize,c);for(let u=0;u<s.length;u++)n.fillText(s[u],l,u*c+d);n.restore(),a&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},up=new WeakMap,IB=()=>{up=new WeakMap,bE=new WeakMap},r6=(e,t,n,r)=>{let i=n?r.zoom:yR.zoom,o=up.get(e),a=o&&o.zoomValue!==i.value&&!r?.shouldCacheIgnoreZoom,s=Ue(e,t)?.version||null,l=Fr(e,t)?.opacity||100;if(!o||a||o.theme!==r.theme||o.boundTextElementVersion!==s||o.containingFrameOpacity!==l){let c=xR(e,t,i,n,r);return up.set(e,c),c}return o},i6=(e,t,n,r,i)=>{let o=e.element,a=jm(o),s=e.scale,[l,c,d,u]=_e(o,i);vr(o)&&(l=Math.floor(l),d=Math.ceil(d),c=Math.floor(c),u=Math.ceil(u));let h=((l+d)/2+r.scrollX)*window.devicePixelRatio,m=((c+u)/2+r.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let p=Ue(o,i);if(yt(o)&&p){let f=document.createElement("canvas"),g=f.getContext("2d"),b=Math.max(Zn(l,d),Zn(c,u));f.width=b*window.devicePixelRatio*s+a*e.scale*10,f.height=b*window.devicePixelRatio*s+a*e.scale*10;let v=(f.width-e.canvas.width)/2,y=(f.height-e.canvas.height)/2;g.translate(f.width/2,f.height/2),g.rotate(o.angle),g.drawImage(e.canvas,-e.canvas.width/2,-e.canvas.height/2,e.canvas.width,e.canvas.height);let[,,,,w,T]=_e(p,i);g.rotate(-o.angle);let k=f.width/2-(w-l)*window.devicePixelRatio*s-v-a*s,M=f.height/2-(T-c)*window.devicePixelRatio*s-y-a*s;g.translate(-k,-M),g.clearRect(-(p.width/2+yn)*window.devicePixelRatio*s,-(p.height/2+yn)*window.devicePixelRatio*s,(p.width+yn*2)*window.devicePixelRatio*s,(p.height+yn*2)*window.devicePixelRatio*s),t.translate(h,m),t.drawImage(f,-(d-l)/2*window.devicePixelRatio-v/s-a,-(u-c)/2*window.devicePixelRatio-y/s-a,f.width/s,f.height/s)}else if(t.translate(h,m),t.rotate(o.angle),"scale"in e.element&&!J3(o,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-h,-m),t.drawImage(e.canvas,(l+r.scrollX)*window.devicePixelRatio-a*e.scale/e.scale,(c+r.scrollY)*window.devicePixelRatio-a*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),Pt.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX==="true"&&as(o)){let f=Ue(o,i),g=j5(o);t.strokeStyle="#c92a2a",t.lineWidth=3,t.strokeRect((g.x+r.scrollX)*window.devicePixelRatio,(g.y+r.scrollY)*window.devicePixelRatio,po(o,f)*window.devicePixelRatio,bu(o,f)*window.devicePixelRatio)}t.restore()},kB=(e,t,n)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let r=.5/n.zoom.value;t.fillRect(r,r,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=" rgb(105, 101, 219)",t.strokeRect(r,r,e.width,e.height),t.restore()},hp=(e,t,n,r,i,o,a)=>{switch(i.globalAlpha=y4(e,Fr(e,t),o.elementsPendingErasure),e.type){case"magicframe":case"frame":{a.frameRendering.enabled&&a.frameRendering.outline&&(i.save(),i.translate(e.x+a.scrollX,e.y+a.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=Zt.strokeWidth/a.zoom.value,i.strokeStyle=Zt.strokeColor,fu(e)&&(i.strokeStyle=a.theme===$e.LIGHT?"#7affd7":"#1d8264"),Zt.radius&&i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,Zt.radius/a.zoom.value),i.stroke(),i.closePath()):i.strokeRect(0,0,e.width,e.height),i.restore());break}case"freedraw":{if(jt.generateElementShape(e,null),o.isExporting){let[s,l,c,d]=_e(e,t),u=(s+c)/2+a.scrollX,h=(l+d)/2+a.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);i.save(),i.translate(u,h),i.rotate(e.angle),i.translate(-m,-p),Um(e,r,i,o,a),i.restore()}else{let s=r6(e,t,o,a);i6(s,i,o,a,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(jt.generateElementShape(e,o),o.isExporting){let[s,l,c,d]=_e(e,t),u=(s+c)/2+a.scrollX,h=(l+d)/2+a.scrollY,m=(c-s)/2-(e.x-s),p=(d-l)/2-(e.y-l);if(he(e)){let g=cr(e,t);if(yt(g)){let b=pe.getBoundTextElementPosition(g,e,t);m=(c-s)/2-(b.x-s),p=(d-l)/2-(b.y-l)}}i.save(),i.translate(u,h),e6(e,o,a)&&(i.filter="none");let f=Ue(e,t);if(yt(e)&&f){let g=document.createElement("canvas"),b=g.getContext("2d"),v=Math.max(Zn(s,c),Zn(l,d)),y=jm(e);g.width=v*a.exportScale+y*10*a.exportScale,g.height=v*a.exportScale+y*10*a.exportScale,b.translate(g.width/2,g.height/2),b.scale(a.exportScale,a.exportScale),m=e.width/2-(e.x-s),p=e.height/2-(e.y-l),b.rotate(e.angle);let w=qt.canvas(g);b.translate(-m,-p),Um(e,w,b,o,a),b.translate(m,p),b.rotate(-e.angle);let[,,,,T,k]=_e(f,t),M=(s+c)/2-T,C=(l+d)/2-k;b.translate(-M,-C),b.clearRect(-f.width/2,-f.height/2,f.width,f.height),i.scale(1/a.exportScale,1/a.exportScale),i.drawImage(g,-g.width/2,-g.height/2,g.width,g.height)}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-m,-p),Um(e,r,i,o,a);i.restore()}else{let s=r6(e,t,o,a),l=i.imageSmoothingEnabled;!a?.shouldCacheIgnoreZoom&&(!e.angle||Z$(e.angle))&&(i.imageSmoothingEnabled=!1),i6(s,i,o,a,n),i.imageSmoothingEnabled=l}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1},bE=new WeakMap([]),AB=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g}),jt,ca=I(()=>{"use strict";D(),ls(),Q$(),Bi(),jt=class js{static rg=new Wr;static cache=new WeakMap;static get=t=>js.cache.get(t);static set=(t,n)=>js.cache.set(t,n);static delete=t=>js.cache.delete(t);static destroy=()=>{js.cache=new WeakMap};static generateElementShape=(t,n)=>{let r=n?.isExporting?void 0:js.get(t);if(r!==void 0)return r;up.delete(t);let i=q$(t,js.rg,n||{isExporting:!1,canvasBackgroundColor:He.white,embedsValidationStatus:null});return js.cache.set(t,i),i}}}),re,Le,Wc,wt=I(()=>{"use strict";D(),Sl(),mb(),sa(),ne(),ca(),re=(e,t,n=!0)=>{let r=!1,{points:i,fileId:o}=t;typeof i<"u"&&(t={...rT(i),...t});for(let a in t){let s=t[a];if(typeof s<"u"){if(e[a]===s&&(typeof s!="object"||s===null||a==="groupIds"||a==="scale"))continue;if(a==="scale"){let l=e[a],c=s;if(l[0]===c[0]&&l[1]===c[1])continue}else if(a==="points"){let l=e[a],c=s;if(l.length===c.length){let d=!1,u=l.length;for(;--u;){let h=l[u],m=c[u];if(h[0]!==m[0]||h[1]!==m[1]){d=!0;break}}if(!d)continue}}e[a]=s,r=!0}}return r&&((typeof t.height<"u"||typeof t.width<"u"||typeof o<"u"||typeof i<"u")&&jt.delete(e),e.version++,e.versionNonce=ns(),e.updated=Dc(),n&&Hn.getScene(e)?.informMutation()),e},Le=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t,updated:Dc(),version:e.version+1,versionNonce:ns()}:e},Wc=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=ns(),e.updated=Dc(),e)}),jc,ef,v4,yE,jT,Ku=I(()=>{"use strict";D(),wt(),xe(),ae(),rn(),ne(),jc=e=>Ne(e)||vr(e)?e.points.length<2:e.width===0&&e.height===0,ef=(e,t,n,r,i)=>{let[o,a,s,l]=rl(e,i),c=Ot({clientX:r.offsetLeft,clientY:r.offsetTop},r),d=Ot({clientX:r.offsetLeft+t,clientY:r.offsetTop+n},r);return c.x<=s&&c.y<=l&&d.x>=o&&d.y>=a},v4=(e,t,n)=>{let r=Math.abs(t),i=Math.abs(n);if(e==="line"||e==="arrow"||e==="freedraw"){let o=Math.round(Math.atan(i/r)/Xa)*Xa;o===0?n=0:o===Math.PI/2?t=0:n=r*Math.tan(o)*Math.sign(n)||n}else e!=="selection"&&(n=r*Math.sign(n));return{width:t,height:n}},yE=(e,t,n,r)=>{let i=n-e,o=r-t,a=Math.round(Math.atan(o/i)/Xa)*Xa;if(a===0)o=0;else if(a===Math.PI/2)i=0;else{let s=Math.tan(a),l=-1,c=t-s*e,d=-1/s,u=-1,h=r-d*n,m=(l*h-u*c)/(s*u-d*l),p=(c*d-h*s)/(s*u-d*l);i=m-e,o=p-t}return{width:i,height:o}},jT=e=>{let t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){let n=Math.abs(e.width);t.width=n,t.x=e.x-n}if(e.height<0){let n=Math.abs(e.height);t.height=n,t.y=e.y-n}return t}}),kg,SR,x4,w4,Ag,TR,S4,KJ=I(()=>{"use strict";D(),Rf(),kg=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],SR=(e,t,n,r,i,o,a)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:s,...l}=sT(e,o,t,a);if(s&&kg(s,r,i))return"rotation";let c=Object.keys(l).filter(d=>{let u=l[d];return u?kg(u,r,i):!1});return c.length>0?c[0]:!1},x4=(e,t,n,r,i,o,a)=>e.reduce((s,l)=>{if(s)return s;let c=SR(l,a,t,n,r,i,o);return c?{element:l,transformHandleType:c}:null},null),w4=([e,t,n,r],i,o,a,s)=>{let l=rE([e,t,n,r,(e+n)/2,(t+r)/2],0,a,s,aT);return Object.keys(l).find(c=>{let d=l[c];return d&&kg(d,i,o)})||!1},Ag=["ns","nesw","ew","nwse"],TR=(e,t)=>{let n=Ag.indexOf(e);if(n>=0){let r=Math.round(t/(Math.PI/4));e=Ag[(n+r)%Ag.length]}return e},S4=e=>{let{element:t,transformHandleType:n}=e,r=t&&Math.sign(t.height)*Math.sign(t.width)===-1,i=null;switch(n){case"n":case"s":i="ns";break;case"w":case"e":i="ew";break;case"nw":case"se":r?i="nesw":i="nwse";break;case"ne":case"sw":r?i="nwse":i="nesw";break;case"rotation":return"grab"}return i&&t&&(i=TR(i,t.angle)),i?`${i}-resize`:""}}),Vm,_B,CR,MR,_g,IR,kR,AR,T4,_R,PB,DB,LB=I(()=>{"use strict";D(),ae(),mb(),ur(),rn(),xe(),wt(),ne(),la(),Sl(),Kt(),Tr(),Vm=e=>e<0?e+2*Math.PI:e>=2*Math.PI?e-2*Math.PI:e,_B=(e,t,n,r,i,o,a,s,l,c,d)=>{if(n.length===1){let[u]=n;return t==="rotation"?(CR(u,r,s,l,i),Wa(u,r)):he(u)&&(t==="nw"||t==="ne"||t==="sw"||t==="se")?(kR(u,r,t,o,s,l),Wa(u,r)):t&&AR(e,a,u,r,t,o,s,l),!0}else if(n.length>1){if(t==="rotation")return _R(e,n,r,s,l,i,c,d),!0;if(t==="nw"||t==="ne"||t==="sw"||t==="se")return T4(e,n,r,t,o,s,l),!0}return!1},CR=(e,t,n,r,i)=>{let[o,a,s,l]=_e(e,t),c=(o+s)/2,d=(a+l)/2,u;ke(e)?u=0:(u=5*Math.PI/2+Math.atan2(r-d,n-c),i&&(u+=Xa/2,u-=u%Xa),u=Vm(u));let h=tl(e);if(re(e,{angle:u}),h){let m=Hn.getScene(e)?.getElement(h);m&&!yt(e)&&re(m,{angle:u})}},MR=(e,t,n,r)=>Ne(e)||vr(e)?{points:vc(0,t,vc(1,n,e.points,r),r)}:{},_g=(e,t,n)=>{let r=e.width;if(pn(e)){let o=cr(e,t);o&&(r=po(o,e))}let i=e.fontSize*(n/r);return i<d2?null:{size:i}},IR=(e,t)=>({n:/^(n|ne|nw)$/.test(e)||t&&/^(s|se|sw)$/.test(e),s:/^(s|se|sw)$/.test(e)||t&&/^(n|ne|nw)$/.test(e),w:/^(w|nw|sw)$/.test(e)||t&&/^(e|ne|se)$/.test(e),e:/^(e|ne|se)$/.test(e)||t&&/^(w|nw|sw)$/.test(e)}),kR=(e,t,n,r,i,o)=>{let[a,s,l,c]=_e(e,t),d=(a+l)/2,u=(s+c)/2,[h,m]=Ge(i,o,d,u,-e.angle),p;switch(n){case"se":p=Math.max((h-a)/(l-a),(m-s)/(c-s));break;case"nw":p=Math.max((l-h)/(l-a),(c-m)/(c-s));break;case"ne":p=Math.max((h-a)/(l-a),(c-m)/(c-s));break;case"sw":p=Math.max((l-h)/(l-a),(m-s)/(c-s));break}if(p>0){let f=e.width*p,g=e.height*p,b=_g(e,t,f);if(b===null)return;let[v,y,w,T]=yu(e,f,g,!1),k=(a-v)/2,M=(s-y)/2,C=(l-w)/2,P=(c-T)/2,[R,A]=iT(IR(n,r),e.x,e.y,e.angle,k,M,C,P);re(e,{fontSize:b.size,width:f,height:g,x:R,y:A})}},AR=(e,t,n,r,i,o,a,s)=>{let l=e.get(n.id),[c,d,u,h]=yu(l,l.width,l.height,!0),m=[c,d],p=[u,h],f=eE(m,p),g=Wt([a,s],f,-l.angle),[b,v,y,w]=yu(n,n.width,n.height,!0),T=y-b,k=w-v,M=p[0]-m[0],C=p[1]-m[1],P=M/T,R=C/k,A={},_=Ue(n,r);i.includes("e")&&(P=(g[0]-m[0])/T),i.includes("s")&&(R=(g[1]-m[1])/k),i.includes("w")&&(P=(p[0]-g[0])/T),i.includes("n")&&(R=(p[1]-g[1])/k);let $=l.width,W=l.height,H=n.width*P,K=n.height*R;if(o&&(H=2*H-$,K=2*K-W),t){let lt=Math.abs(H)/$,fn=Math.abs(K)/W;if(i.length===1&&(K*=lt,H*=fn),i.length===2){let on=Math.max(lt,fn);H=$*on*Math.sign(H),K=W*on*Math.sign(K)}}if(_){let lt=e.get(_.id);if(lt&&(A={fontSize:lt.fontSize}),t){let fn={...n,width:H,height:K},on=_g(_,r,po(fn,_));if(on===null)return;A={fontSize:on.size}}else{let fn=pT(xn(_),_.lineHeight),on=mT(_.fontSize,_.lineHeight);H=Math.max(H,fn),K=Math.max(K,on)}}let[Q,ie,X,F]=yu(l,H,K,!0),B=X-Q,U=F-ie,G=[...m];if(["n","w","nw"].includes(i)&&(G=[p[0]-Math.abs(B),p[1]-Math.abs(U)]),i==="ne"){let lt=[m[0],p[1]];G=[lt[0],lt[1]-Math.abs(U)]}if(i==="sw"){let lt=[p[0],m[1]];G=[lt[0]-Math.abs(B),lt[1]]}t&&(["s","n"].includes(i)&&(G[0]=f[0]-B/2),["e","w"].includes(i)&&(G[1]=f[1]-U/2));let Z=H<0,ee=K<0;Z&&(i.includes("e")&&(G[0]-=Math.abs(B)),i.includes("w")&&(G[0]+=Math.abs(B))),ee&&(i.includes("s")&&(G[1]-=Math.abs(U)),i.includes("n")&&(G[1]+=Math.abs(U))),o&&(G[0]=f[0]-Math.abs(B)/2,G[1]=f[1]-Math.abs(U)/2);let te=l.angle,de=Wt(G,f,te),qe=[G[0]+Math.abs(B)/2,G[1]+Math.abs(U)/2],Ye=Wt(qe,f,te);G=Wt(de,Ye,-te);let Me=[...G],Be=l.x-Q,Oe=l.y-ie;Me[0]+=Be,Me[1]+=Oe;let us=Me[0],yh=Me[1],Pl,Dl;(Ne(n)||vr(n))&&(Pl=vc(1,K,l.points,!0),Dl=vc(0,H,Pl,!0));let Sn={width:Math.abs(H),height:Math.abs(K),x:us,y:yh,points:Dl};if("scale"in n&&"scale"in l&&re(n,{scale:[(Math.sign(X-l.x)||l.scale[0])*l.scale[0],(Math.sign(F-l.y)||l.scale[1])*l.scale[1]]}),yt(n)&&_&&t){let lt=Sn.width/n.width*_.fontSize;if(lt<d2)return;A.fontSize=lt}Sn.width!==0&&Sn.height!==0&&Number.isFinite(Sn.x)&&Number.isFinite(Sn.y)&&(re(n,Sn),Wa(n,r,{newSize:{width:Sn.width,height:Sn.height}}),_&&A!=null&&re(_,{fontSize:A.fontSize}),Vp(n,r,i,t))},T4=(e,t,n,r,i,o,a)=>{let s=t.reduce((A,_)=>{let $=e.get(_.id);return $&&A.push({orig:$,latest:_}),A},[]),l=s.reduce((A,{orig:_})=>{if(!Ne(_))return A;let $=tl(_);if(!$)return A;let W=e.get($)??null;if(!pn(W))return A;let H=pe.getBoundTextElementPosition(_,W,n);return[...A,{...W,...H}]},[]),{minX:c,minY:d,maxX:u,maxY:h,midX:m,midY:p}=ia(s.map(({orig:A})=>A).concat(l)),f=r,g={ne:[c,h],se:[c,d],sw:[u,d],nw:[u,h]},[b,v]=i?[m,p]:g[f],y=Math.max(Math.abs(o-b)/(u-c)||0,Math.abs(a-v)/(h-d)||0)*(i?2:1);if(y===0)return;let w={ne:[o>=b,a<=v],se:[o>=b,a>=v],sw:[o<=b,a>=v],nw:[o<=b,a<=v]},[T,k]=w[f].map(A=>A?1:-1),M=T<0,C=k<0,P=[];for(let{orig:A,latest:_}of s){if(he(A)&&pn(A))continue;let $=A.width*y,W=A.height*y,H=Vm(A.angle*T*k),K=Ne(A)||vr(A),Q=A.x-b,ie=A.y-v,X=M&&!K?$:0,F=C&&!K?W:0,B=b+T*(Q*y+X),U=v+k*(ie*y+F),G=MR(A,$*T,W*k,!1),Z={x:B,y:U,width:$,height:W,angle:H,...G};if(dl(A)&&s.length===1&&(Z.scale=[A.scale[0]*T,A.scale[1]*k]),Ne(A)&&(M||C)){let te=Yp(A,A.points),de=Yp({...A,x:B,y:U},G.points),qe=[A.x,A.y],Ye=[B,U],Me=Be=>{let Oe=Be==="x"?0:1;return(de[Oe+2]-Ye[Oe]-(qe[Oe]-te[Oe])*y+(te[Oe+2]-qe[Oe])*y-(Ye[Oe]-de[Oe]))/2};M&&(Z.x-=Me("x")),C&&(Z.y-=Me("y"))}if(he(A)){let te=_g(A,n,$);if(!te)return;Z.fontSize=te.size}let ee=e.get(tl(A)??"");if(ee){let te=ee.fontSize*y;if(te<d2)return;Z.boundTextFontSize=te}P.push({element:_,update:Z})}let R=P.map(({element:A})=>A);for(let{element:A,update:{boundTextFontSize:_,...$}}of P){let{width:W,height:H,angle:K}=$;re(A,$,!1),Wa(A,n,{simultaneouslyUpdated:R,newSize:{width:W,height:H}});let Q=Ue(A,n);Q&&_&&(re(Q,{fontSize:_,angle:Ne(A)?void 0:K},!1),Vp(A,n,r,!0))}Hn.getScene(P[0].element)?.informMutation()},_R=(e,t,n,r,i,o,a,s)=>{let l=5*Math.PI/2+Math.atan2(i-s,r-a);o&&(l+=Xa/2,l-=l%Xa),t.filter(c=>!ke(c)).forEach(c=>{let[d,u,h,m]=_e(c,n),p=(d+h)/2,f=(u+m)/2,g=e.get(c.id)?.angle??c.angle,[b,v]=Ge(p,f,a,s,l+g-c.angle);re(c,{x:c.x+(b-p),y:c.y+(v-f),angle:Vm(l+g)},!1),Wa(c,n,{simultaneouslyUpdated:t});let y=Ue(c,n);y&&!yt(c)&&re(y,{x:y.x+(b-p),y:y.y+(v-f),angle:Vm(l+g)},!1)}),Hn.getScene(t[0])?.informMutation()},PB=(e,t,n,r,i)=>{let[o,a,s,l]=t.length===1?_e(t[0],n):Nt(t),c=(o+s)/2,d=(a+l)/2,u=t.length===1?t[0].angle:0;switch([r,i]=Ge(r,i,c,d,-u),e){case"n":return Ge(r-(o+s)/2,i-a,0,0,u);case"s":return Ge(r-(o+s)/2,i-l,0,0,u);case"w":return Ge(r-o,i-(a+l)/2,0,0,u);case"e":return Ge(r-s,i-(a+l)/2,0,0,u);case"nw":return Ge(r-o,i-a,0,0,u);case"ne":return Ge(r-s,i-a,0,0,u);case"sw":return Ge(r-o,i-l,0,0,u);case"se":return Ge(r-s,i-l,0,0,u);default:return[0,0]}},DB=(e,t)=>{let[,[n,r]]=t.points;return e==="nw"&&(n<0||r<0)||e==="ne"&&n>=0||e==="sw"&&n<=0||e==="se"&&(n>0||r>0)?"end":"origin"}}),RB,PR,o6,OB,C4,qJ=I(()=>{"use strict";D(),la(),rn(),wt(),Ku(),Kt(),ur(),xe(),RB=(e,t,n,r,i,o,a)=>{let s=new Set(t),l=t.filter(u=>ke(u)).map(u=>u.id);if(l.length>0)for(let u of i.getNonDeletedElements())u.frameId!==null&&l.includes(u.frameId)&&s.add(u);let c=Nt(Array.from(s).map(u=>e.originalElements.get(u.id)??u)),d=PR(c,n,o,a);s.forEach(u=>{if(o6(e,u,d),!yt(u)){let h=Ue(u,i.getNonDeletedElementsMap());h&&o6(e,h,d)}Wa(u,i.getElementsMapIncludingDeleted(),{simultaneouslyUpdated:Array.from(s)})})},PR=(e,t,n,r)=>{let[i,o]=e,a=i+t.x+n.x,s=o+t.y+n.y;if(n.x===0||n.y===0){let[l,c]=Fn(i+t.x,o+t.y,r);n.x===0&&(a=l),n.y===0&&(s=c)}return{x:a-i,y:s-o}},o6=(e,t,n)=>{let r=e.originalElements.get(t.id)??t,i=r.x+n.x,o=r.y+n.y;re(t,{x:i,y:o})},OB=(e,t,n)=>{let[r,i]=Nt(e);return[t-r,n-i]},C4=(e,t,n,r,i,o,a,s,l,c,d,u=null)=>{l&&e.type!=="selection"&&(d?s=a/d:(Math.abs(o-r)>Math.abs(i-n)?{width:a,height:s}=v4(t,s,i<n?-a:a):{width:a,height:s}=v4(t,a,o<r?-s:s),s<0&&(s=-s)));let h=i<n?n-a:n,m=o<r?r-s:r;c&&(a+=a,s+=s,h=n-a/2,m=r-s/2),a!==0&&s!==0&&re(e,{x:h+(u?.x??0),y:m+(u?.y??0),width:a,height:s})}}),Cb,QJ=I(()=>{"use strict";D(),pt(),Cb=(e,t)=>!!(!e.viewModeEnabled&&(e.activeTool.type!=="custom"&&(e.editingElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||st(t,e).length))}),JJ,NB,$B,FB,at,vE,a6,BB,UT,Pe=I(()=>{"use strict";D(),Ku(),xe(),cs(),rn(),Rf(),Zc(),KJ(),LB(),qJ(),xe(),Kt(),Ku(),QJ(),JJ=e=>e.reduce((t,n)=>t+n.version,0),NB=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e[n].versionNonce;return t>>>0},$B=e=>{let t=5381;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)+t+r}return t>>>0},FB=e=>e.filter(t=>!t.isDeleted&&!jc(t)),at=e=>e.filter(t=>!t.isDeleted),vE=e=>!e.isDeleted,a6=e=>at(e).map(t=>J2(t.type)?{...t,lastCommittedPoint:null}:t),BB=e=>a6(e),UT=e=>a6(e)}),tf,xE,M4,mn,zB,st,Mb,rt,Kc=I(()=>{"use strict";D(),Pe(),xe(),Sr(),ne(),Ku(),tf=e=>{let t=new Set;return e.forEach(n=>{ke(n)&&t.add(n.id)}),e.filter(n=>!(n.frameId&&t.has(n.frameId)))},xE=(e,t,n,r=!0)=>{let[i,o,a,s]=_e(t,n),l=e.filter(c=>{let[d,u,h,m]=rl(c,n),p=Fr(c,n);if(p){let[f,g,b,v]=rl(p,n);d=Math.max(f,d),u=Math.max(g,u),h=Math.min(b,h),m=Math.min(v,m)}return c.locked===!1&&c.type!=="selection"&&!pn(c)&&i<=d&&o<=u&&a>=h&&s>=m});return l=r?tf(l):l,l=l.filter(c=>{let d=Fr(c,n);return d?Ks(c,d,n):!0}),l},M4=(e,t,n,r)=>{let i=new Set(t.map(o=>o.id));return e.filter(o=>{let a=ef(o,n.width,n.height,n,r);return!i.has(o.id)&&a})},mn=function(){let e=null,t=null,n=null,r=(i,o)=>(n!=null&&i===e&&o.selectedElementIds===t||(n=i.some(a=>o.selectedElementIds[a.id]),e=i,t=o.selectedElementIds),n);return r.clearCache=()=>{e=null,t=null,n=null},r}(),zB=(e,t,n)=>{let r=Array.from(new Set(st(e,t).map(i=>n(i))));return r.length===1?r[0]:null},st=(e,t,n)=>{let r=[];for(let i of e.values()){if(t.selectedElementIds[i.id]){r.push(i);continue}if(n?.includeBoundTextElement&&pn(i)&&t.selectedElementIds[i?.containerId]){r.push(i);continue}}if(n?.includeElementsInFrames){let i=[];return r.forEach(o=>{ke(o)&&na(e,o.id).forEach(a=>i.push(a)),i.push(o)}),i}return r},Mb=(e,t)=>t.editingElement?[t.editingElement]:st(e,t,{includeBoundTextElement:!0}),rt=(e,t)=>$r(t.selectedElementIds,e)?t.selectedElementIds:e}),DR,I4,qu,HB=I(()=>{"use strict";D(),Pe(),ne(),DR=(e,t)=>{let[n,r,i,o]=t,{x:a,y:s}=Ri({sceneX:n,sceneY:r},e),{x:l,y:c}=Ri({sceneX:i,sceneY:o},e);return l-a>e.width||c-s>e.height},I4=({scenePoint:e,viewportDimensions:t,zoom:n})=>({scrollX:t.width/2/n.value-e.x,scrollY:t.height/2/n.value-e.y}),qu=(e,t)=>{if(e=FB(e),!e.length)return{scrollX:0,scrollY:0};let[n,r,i,o]=Nt(e);DR(t,[n,r,i,o])&&([n,r,i,o]=kF(e,Ot({clientX:t.scrollX,clientY:t.scrollY},t)));let a=(n+i)/2,s=(r+o)/2;return I4({scenePoint:{x:a,y:s},viewportDimensions:{width:t.width,height:t.height},zoom:t.zoom})}}),il,ol,VT=I(()=>{"use strict";D(),ae(),il=e=>Math.max(YS,Math.min(e,30)),ol=({viewportX:e,viewportY:t,nextZoom:n},r)=>{let i=e-r.offsetLeft,o=t-r.offsetTop,a=r.zoom.value,s=r.scrollX+(i-i/a),l=r.scrollY+(o-o/a),c=-(i-i/n),d=-(o-o/n);return{scrollX:s+c,scrollY:l+d,zoom:{value:n}}}}),pt=I(()=>{"use strict";D(),Kc(),HB(),pb(),VT()}),Cl=I(()=>{}),Xe,On=I(()=>{"use strict";D(),Cl(),Re(),uh(),wl(),ne(),Xe=So.default.forwardRef((e,t)=>{let{id:n}=ua(),r=So.default.useRef(null);So.default.useImperativeHandle(t,()=>r.current);let i=`ToolIcon_size_${e.size}`,[o,a]=(0,So.useState)(!1),s=(0,So.useRef)(!0),l=async d=>{let u="onClick"in e&&e.onClick?.(d);if(ch(u))try{a(!0),await u}catch(h){if(h instanceof Nf)console.warn(h);else throw h}finally{s.current&&a(!1)}};(0,So.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=(0,So.useRef)(null);if(e.type==="button"||e.type==="icon"||e.type==="submit"){let d=e.type==="icon"?"button":e.type;return(0,Di.jsxs)("button",{className:Y("ToolIcon_type_button",i,e.className,e.visible&&!e.hidden?"ToolIcon_type_button--show":"ToolIcon_type_button--hide",{ToolIcon:!e.hidden,"ToolIcon--selected":e.selected,"ToolIcon--plain":e.type==="icon"}),style:e.style,"data-testid":e["data-testid"],hidden:e.hidden,title:e.title,"aria-label":e["aria-label"],type:d,onClick:l,ref:r,disabled:o||e.isLoading,children:[(e.icon||e.label)&&(0,Di.jsxs)("div",{className:"ToolIcon__icon","aria-hidden":"true",children:[e.icon||e.label,e.keyBindingLabel&&(0,Di.jsx)("span",{className:"ToolIcon__keybinding",children:e.keyBindingLabel}),e.isLoading&&(0,Di.jsx)(oa,{})]}),e.showAriaLabel&&(0,Di.jsxs)("div",{className:"ToolIcon__label",children:[e["aria-label"]," ",o&&(0,Di.jsx)(oa,{})]}),e.children]})}return(0,Di.jsxs)("label",{className:Y("ToolIcon",e.className),title:e.title,onPointerDown:d=>{c.current=d.pointerType||null,e.onPointerDown?.({pointerType:d.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{c.current=null})},children:[(0,Di.jsx)("input",{className:`ToolIcon_type_radio ${i}`,type:"radio",name:e.name,"aria-label":e["aria-label"],"aria-keyshortcuts":e["aria-keyshortcuts"],"data-testid":e["data-testid"],id:`${n}-${e.id}`,onChange:()=>{e.onChange?.({pointerType:c.current})},checked:e.checked,ref:r}),(0,Di.jsxs)("div",{className:"ToolIcon__icon",children:[e.icon,e.keyBindingLabel&&(0,Di.jsx)("span",{className:"ToolIcon__keybinding",children:e.keyBindingLabel})]})]})}),Xe.defaultProps={visible:!0,className:"",size:"medium"},Xe.displayName="ToolButton"}),eee={};Pf(eee,{AlignBottomIcon:()=>DE,AlignLeftIcon:()=>LE,AlignRightIcon:()=>RE,AlignTopIcon:()=>PE,ArrowIcon:()=>iC,ArrowRightIcon:()=>ku,ArrowheadArrowIcon:()=>BC,ArrowheadBarIcon:()=>HC,ArrowheadCircleIcon:()=>zE,ArrowheadCircleOutlineIcon:()=>zC,ArrowheadDiamondIcon:()=>jC,ArrowheadDiamondOutlineIcon:()=>UC,ArrowheadNoneIcon:()=>FC,ArrowheadTriangleIcon:()=>GC,ArrowheadTriangleOutlineIcon:()=>WC,BringForwardIcon:()=>IE,BringToFrontIcon:()=>AE,CenterHorizontallyIcon:()=>NE,CenterVerticallyIcon:()=>OE,CloseIcon:()=>Ml,DeviceDesktopIcon:()=>CM,DiamondIcon:()=>nC,DiscordIcon:()=>mC,DistributeHorizontallyIcon:()=>SC,DistributeVerticallyIcon:()=>TC,DotsIcon:()=>XT,DuplicateIcon:()=>nf,EdgeRoundIcon:()=>$C,EdgeSharpIcon:()=>NC,EllipseIcon:()=>rC,EmbedIcon:()=>uC,EraserIcon:()=>cC,ExcalLogo:()=>GB,ExportIcon:()=>Ju,ExportImageIcon:()=>_b,ExternalLinkIcon:()=>TE,FillCrossHatchIcon:()=>IC,FillHachureIcon:()=>MC,FillSolidIcon:()=>kC,FillZigZagIcon:()=>CC,FontFamilyCodeIcon:()=>qC,FontFamilyNormalIcon:()=>KC,FontSizeExtraLargeIcon:()=>XC,FontSizeLargeIcon:()=>ZC,FontSizeMediumIcon:()=>YC,FontSizeSmallIcon:()=>VC,FreedrawIcon:()=>Bf,GithubIcon:()=>Ab,GroupIcon:()=>$E,HamburgerMenuIcon:()=>kb,HelpIcon:()=>zf,HelpIconThin:()=>hC,HomeIcon:()=>YT,ImageIcon:()=>lC,LibraryIcon:()=>Ib,LineIcon:()=>oC,LinkIcon:()=>af,LoadIcon:()=>Hf,LockedIcon:()=>Ff,MagicIcon:()=>Gf,MagicIconThin:()=>lz,MoonIcon:()=>rf,OpenAIIcon:()=>sf,PenModeIcon:()=>aC,PinIcon:()=>KT,PlusIcon:()=>ZT,RectangleIcon:()=>tC,RedoIcon:()=>ME,SelectionIcon:()=>eC,SendBackwardIcon:()=>kE,SendToBackIcon:()=>_E,SloppinessArchitectIcon:()=>LC,SloppinessArtistIcon:()=>RC,SloppinessCartoonistIcon:()=>OC,StrokeStyleDashedIcon:()=>PC,StrokeStyleDottedIcon:()=>DC,StrokeStyleSolidIcon:()=>rz,StrokeWidthBaseIcon:()=>BE,StrokeWidthBoldIcon:()=>AC,StrokeWidthExtraBoldIcon:()=>_C,SunIcon:()=>of,TextAlignBottomIcon:()=>nM,TextAlignCenterIcon:()=>JC,TextAlignLeftIcon:()=>QC,TextAlignMiddleIcon:()=>rM,TextAlignRightIcon:()=>eM,TextAlignTopIcon:()=>tM,TextIcon:()=>sC,TrashIcon:()=>bl,UndoIcon:()=>CE,UngroupIcon:()=>FE,UnlockedIcon:()=>Qu,WelcomeScreenHelpArrow:()=>QT,WelcomeScreenMenuArrow:()=>qT,WelcomeScreenTopToolbarArrow:()=>JT,XBrandIcon:()=>pC,ZoomInIcon:()=>wE,ZoomOutIcon:()=>SE,ZoomResetIcon:()=>dC,abacusIcon:()=>bM,alertTriangleIcon:()=>sM,arrowBarToLeftIcon:()=>cz,boltIcon:()=>Fb,brainIcon:()=>hM,brainIconThin:()=>mM,bucketFillIcon:()=>Lp,checkIcon:()=>fC,clipboard:()=>WB,clockIcon:()=>pM,clone:()=>ez,coffeeIcon:()=>TM,copyIcon:()=>Lb,createIcon:()=>z,cutIcon:()=>oM,done:()=>vC,downloadIcon:()=>GE,eraser:()=>iz,exportToFileIcon:()=>yC,exportToPlus:()=>XB,extraToolsIcon:()=>cM,eyeClosedIcon:()=>uM,eyeDropperIcon:()=>lM,eyeIcon:()=>Wf,file:()=>nz,flipHorizontal:()=>vM,flipVertical:()=>yM,fontSizeIcon:()=>HE,frameToolIcon:()=>Rb,fullscreenIcon:()=>dM,handIcon:()=>Db,helpIcon:()=>aM,iconFillColor:()=>Kr,laserPointerToolIcon:()=>Nb,magnetIcon:()=>SM,menu:()=>VB,mermaidLogoIcon:()=>Ob,microphoneIcon:()=>fM,microphoneMutedIcon:()=>gM,paintIcon:()=>WE,palette:()=>bC,playerPlayIcon:()=>oz,playerStopFilledIcon:()=>az,pngIcon:()=>wM,publishIcon:()=>iM,questionCircle:()=>xC,resetZoom:()=>qB,save:()=>gC,saveAs:()=>EC,searchIcon:()=>$b,selectAllIcon:()=>EM,share:()=>wC,shareIOS:()=>ZB,shareWindows:()=>KB,shield:()=>tz,start:()=>QB,stop:()=>JB,svgIcon:()=>xM,tablerCheckIcon:()=>sz,usersIcon:()=>Pb,warning:()=>YB,youtubeIcon:()=>MM,zoomAreaIcon:()=>Rp,zoomIn:()=>jB,zoomOut:()=>UB});var Kr,s6,z,ue,ye,YT,Ib,ZT,XT,KT,Qu,Ff,qT,QT,JT,GB,eC,tC,nC,rC,iC,oC,aC,Bf,sC,lC,cC,wE,SE,dC,bl,uC,nf,rf,of,kb,Ju,zf,hC,TE,Ab,mC,pC,fC,af,gC,EC,Hf,WB,bC,Lp,_b,yC,jB,UB,vC,VB,CE,ME,xC,wC,YB,ZB,XB,KB,qB,IE,kE,AE,_E,PE,DE,LE,RE,SC,TC,OE,NE,Pb,QB,JB,Ml,ez,tz,nz,$E,FE,CC,MC,IC,kC,BE,AC,_C,rz,PC,DC,LC,RC,OC,NC,$C,FC,BC,zE,zC,HC,GC,WC,jC,UC,VC,YC,ZC,XC,HE,KC,qC,QC,JC,eM,tM,nM,rM,iM,iz,Db,GE,Lb,oM,aM,oz,az,sz,sM,lM,cM,Rb,Ob,ku,Nb,Gf,lz,sf,dM,Wf,uM,hM,mM,$b,pM,fM,gM,Fb,EM,bM,yM,vM,WE,Rp,xM,wM,SM,TM,CM,cz,MM,me=I(()=>{"use strict";D(),ae(),Kr=e=>"var(--icon-fill-color)",s6=e=>e===$e.LIGHT?Ct.white:"#1e1e1e",z=(e,t=512)=>{let{width:n=512,height:r=n,mirror:i,style:o,...a}=typeof t=="number"?{width:t}:t;return(0,E.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${r}`,className:Y({"rtl-mirror":i}),style:o,...a,children:typeof e=="string"?(0,E.jsx)("path",{fill:"currentColor",d:e}):e})},ue={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},ye={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},YT=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("polyline",{points:"5 12 3 12 12 3 21 12 19 12"}),(0,E.jsx)("path",{d:"M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7"}),(0,E.jsx)("path",{d:"M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"})]}),ue),Ib=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),(0,E.jsx)("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),(0,E.jsx)("line",{x1:"3",y1:"6",x2:"3",y2:"19"}),(0,E.jsx)("line",{x1:"12",y1:"6",x2:"12",y2:"19"}),(0,E.jsx)("line",{x1:"21",y1:"6",x2:"21",y2:"19"})]}),ue),ZT=z((0,E.jsxs)("svg",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,E.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),ue),XT=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,E.jsx)("circle",{cx:"12",cy:"19",r:"1"}),(0,E.jsx)("circle",{cx:"12",cy:"5",r:"1"})]}),ue),KT=z((0,E.jsxs)("svg",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),(0,E.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),(0,E.jsx)("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),ue),Qu=z((0,E.jsxs)("g",{children:[(0,E.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,E.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,E.jsx)("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:(0,E.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,E.jsx)("g",{mask:"url(#UnlockedIcon)",children:(0,E.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"})})]}),ye),Ff=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.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,E.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,E.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"})]}),ye),qT=z((0,E.jsxs)(E.Fragment,{children:[(0,E.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,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),(0,E.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"}),QT=z((0,E.jsxs)(E.Fragment,{children:[(0,E.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,E.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,E.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"}),JT=z((0,E.jsxs)(E.Fragment,{children:[(0,E.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,E.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,E.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"}),GB=z((0,E.jsx)("g",{fill:"currentColor",children:(0,E.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"}),eC=z((0,E.jsxs)("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),tC=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),ue),nC=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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"})]}),ue),rC=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"9"})]}),ue),iC=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,E.jsx)("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),(0,E.jsx)("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),ue),oC=z((0,E.jsx)("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),ye),aC=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),(0,E.jsx)("path",{d:"M16 7h4"}),(0,E.jsx)("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),ue),Bf=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.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,E.jsx)("path",{d:"m11.25 5.417 3.333 3.333"})]}),ye),sC=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),(0,E.jsx)("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),(0,E.jsx)("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),(0,E.jsx)("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),(0,E.jsx)("polyline",{points:"5 20 11 4 13 4 20 20"})]}),ue),lC=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M12.5 6.667h.01"}),(0,E.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,E.jsx)("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),(0,E.jsx)("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),ye),cC=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M18 13.3l-6.3 -6.3"})]}),ue),wE=z((0,E.jsx)("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),ye),SE=z((0,E.jsx)("path",{d:"M5 10h10",strokeWidth:"1.25"}),ye),dC=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M21 21l-6 -6"}),(0,E.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,E.jsx)("path",{d:"M3 4v4h4"})]}),ue),bl=z((0,E.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"}),ye),uC=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("polyline",{points:"12 16 18 10 12 4"}),(0,E.jsx)("polyline",{points:"8 4 2 10 8 16"})]}),ye),nf=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.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,E.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"})]}),ye),rf=z((0,E.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"}),ye),of=z((0,E.jsx)("g",{stroke:"currentColor",strokeLinejoin:"round",children:(0,E.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"})}),{...ye,strokeWidth:1.5}),kb=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,E.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,E.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),ue),Ju=z((0,E.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"}),ye),zf=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,E.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,E.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ue),hC=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,E.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),(0,E.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ue),TE=z((0,E.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"}),ye),Ab=z((0,E.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"}),ye),mC=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.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,E.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"})]}),ye),pC=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),(0,E.jsx)("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]}),ue),fC=z((0,E.jsx)("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),af=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.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,E.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"})]}),ye),gC=z("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}),EC=z("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}),Hf=z((0,E.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"}),ye),WB=z("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}),bC=z("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"),Lp=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z"}),(0,E.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,E.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"})]}),ue),_b=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M15 8h.01"}),(0,E.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,E.jsx)("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),(0,E.jsx)("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),(0,E.jsx)("path",{d:"M19 16v6"}),(0,E.jsx)("path",{d:"M22 19l-3 3l-3 -3"})]}),ue),yC=z("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}),jB=z("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}),UB=z("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}),vC=z("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"),VB=z("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"),CE=z((0,E.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"}),ye),ME=z((0,E.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"}),ye),xC=z("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}),wC=z((0,E.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"}),ye),YB=z("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"),ZB=z("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}),XB=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M12 14v-11"}),(0,E.jsx)("path",{d:"M9 6l3 -3l3 3"})]}),ue),KB=z((0,E.jsxs)(E.Fragment,{children:[(0,E.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,E.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}),qB=z((0,E.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}),IE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{d:"M13.889 4.167H8.333c-.767 0-1.389.622-1.389 1.389v5.555c0 .767.622 1.389 1.39 1.389h5.555c.767 0 1.389-.622 1.389-1.389V5.556c0-.767-.622-1.39-1.39-1.39Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M12.5 12.5v1.389a1.389 1.389 0 0 1-1.389 1.389H5.556a1.389 1.389 0 0 1-1.39-1.39V8.334a1.389 1.389 0 0 1 1.39-1.389h1.388"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),kE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.944 12.5H12.5v1.389a1.389 1.389 0 0 1-1.389 1.389H5.556a1.389 1.389 0 0 1-1.39-1.39V8.334a1.389 1.389 0 0 1 1.39-1.389h1.388",fill:"currentColor"}),(0,E.jsx)("path",{d:"M13.889 4.167H8.333c-.767 0-1.389.621-1.389 1.389v5.555c0 .767.622 1.389 1.39 1.389h5.555c.767 0 1.389-.622 1.389-1.389V5.556c0-.768-.622-1.39-1.39-1.39Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),AE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M8.775 6.458h2.45a2.316 2.316 0 0 1 2.317 2.316v2.452a2.316 2.316 0 0 1-2.316 2.316H8.774a2.316 2.316 0 0 1-2.317-2.316V8.774a2.316 2.316 0 0 1 2.317-2.316Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316ZM12.108 3.125h2.45a2.316 2.316 0 0 1 2.317 2.316v2.451a2.316 2.316 0 0 1-2.316 2.316h-2.451a2.316 2.316 0 0 1-2.316-2.316v-2.45a2.316 2.316 0 0 1 2.316-2.317Z"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),_E=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",children:[(0,E.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("path",{d:"M5.441 9.792h2.451a2.316 2.316 0 0 1 2.316 2.316v2.45a2.316 2.316 0 0 1-2.316 2.317h-2.45a2.316 2.316 0 0 1-2.317-2.316v-2.451a2.316 2.316 0 0 1 2.316-2.316Z",stroke:"currentColor",strokeWidth:"1.25"}),(0,E.jsx)("mask",{id:"SendToBackIcon",fill:"#fff",children:(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.167 5.833v2.06a2.941 2.941 0 0 0 2.94 2.94h2.06v.393a2.941 2.941 0 0 1-2.941 2.94h-.393v-2.058a2.941 2.941 0 0 0-2.94-2.941h-2.06v-.393a2.941 2.941 0 0 1 2.942-2.94h.392Z"})}),(0,E.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.167 5.833v2.06a2.941 2.941 0 0 0 2.94 2.94h2.06v.393a2.941 2.941 0 0 1-2.941 2.94h-.393v-2.058a2.941 2.941 0 0 0-2.94-2.941h-2.06v-.393a2.941 2.941 0 0 1 2.942-2.94h.392Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M9.167 5.833h1.25v-1.25h-1.25v1.25Zm5 5h1.25v-1.25h-1.25v1.25Zm-3.334 3.334h-1.25v1.25h1.25v-1.25Zm-5-5h-1.25v1.25h1.25v-1.25Zm2.084-3.334v2.06h2.5v-2.06h-2.5Zm0 2.06a4.191 4.191 0 0 0 4.19 4.19v-2.5a1.691 1.691 0 0 1-1.69-1.69h-2.5Zm4.19 4.19h2.06v-2.5h-2.06v2.5Zm.81-1.25v.393h2.5v-.393h-2.5Zm0 .393c0 .933-.758 1.69-1.691 1.69v2.5a4.191 4.191 0 0 0 4.19-4.19h-2.5Zm-1.691 1.69h-.393v2.5h.393v-2.5Zm.857 1.25v-2.058h-2.5v2.059h2.5Zm0-2.058a4.191 4.191 0 0 0-4.19-4.191v2.5c.933 0 1.69.757 1.69 1.69h2.5Zm-4.19-4.191h-2.06v2.5h2.06v-2.5Zm-.81 1.25v-.393h-2.5v.393h2.5Zm0-.393c0-.934.758-1.69 1.692-1.69v-2.5a4.191 4.191 0 0 0-4.192 4.19h2.5Zm1.692-1.69h.392v-2.5h-.392v2.5Z",fill:"currentColor",mask:"url(#SendToBackIcon)"}),(0,E.jsx)("path",{d:"M12.108 3.125h2.45a2.316 2.316 0 0 1 2.317 2.316v2.451a2.316 2.316 0 0 1-2.316 2.316h-2.451a2.316 2.316 0 0 1-2.316-2.316v-2.45a2.316 2.316 0 0 1 2.316-2.317Z",stroke:"currentColor",strokeWidth:"1.25"})]}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),PE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),DE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),LE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),RE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),SC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),TC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),OE=z((0,E.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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"})]}),ye),NE=z((0,E.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),(0,E.jsx)("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),(0,E.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"})]}),ye),Pb=z((0,E.jsxs)("g",{strokeWidth:"1.5",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,E.jsx)("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),(0,E.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),(0,E.jsx)("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),ue),QB=z("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"),JB=z("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"),Ml=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,E.jsx)("path",{d:"M15 5 5 15M5 5l10 10"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),ez=z("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}),tz=z("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}),nz=z("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}),$E=Er.default.memo(({theme:e})=>z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M25 26H111V111H25",fill:Kr(e)}),(0,E.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:Kr(e),strokeWidth:"2"}),(0,E.jsx)("path",{d:"M100 100H160V160H100",fill:Kr(e)}),(0,E.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:Kr(e),strokeWidth:"2"}),(0,E.jsxs)("g",{fill:s6(e),stroke:Kr(e),strokeWidth:"6",children:[(0,E.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),FE=Er.default.memo(({theme:e})=>z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:"M25 26H111V111H25",fill:Kr(e)}),(0,E.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:Kr(e),strokeWidth:"2"}),(0,E.jsx)("path",{d:"M100 100H160V160H100",fill:Kr(e)}),(0,E.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:Kr(e),strokeWidth:"2"}),(0,E.jsxs)("g",{fill:s6(e),stroke:Kr(e),strokeWidth:"6",children:[(0,E.jsx)("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),(0,E.jsx)("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),CC=z((0,E.jsx)("g",{strokeWidth:1.25,children:(0,E.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"})}),ye),MC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.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,E.jsx)("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:(0,E.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,E.jsx)("g",{mask:"url(#FillHachureIcon)",children:(0,E.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"})})]}),ye),IC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("g",{clipPath:"url(#a)",children:[(0,E.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,E.jsx)("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:(0,E.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,E.jsx)("g",{mask:"url(#FillCrossHatchIcon)",children:(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),kC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...ye,fill:"currentColor"}),BE=z((0,E.jsx)(E.Fragment,{children:(0,E.jsx)("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),ye),AC=z((0,E.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),ye),_C=z((0,E.jsx)("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),ye),rz=Er.default.memo(({theme:e})=>z((0,E.jsx)("path",{d:"M6 10H34",stroke:Kr(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),PC=z((0,E.jsxs)("g",{strokeWidth:"2",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 12h2"}),(0,E.jsx)("path",{d:"M17 12h2"}),(0,E.jsx)("path",{d:"M11 12h2"})]}),ue),DC=z((0,E.jsxs)("g",{strokeWidth:"2",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 12v.01"}),(0,E.jsx)("path",{d:"M8 12v.01"}),(0,E.jsx)("path",{d:"M12 12v.01"}),(0,E.jsx)("path",{d:"M16 12v.01"}),(0,E.jsx)("path",{d:"M20 12v.01"})]}),ue),LC=z((0,E.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"}),ye),RC=z((0,E.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"}),ye),OC=z((0,E.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"}),ye),NC=z((0,E.jsxs)("svg",{strokeWidth:"1.5",children:[(0,E.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,E.jsx)("path",{d:"M13.3333 3.33331V3.34331"}),(0,E.jsx)("path",{d:"M16.6667 3.33331V3.34331"}),(0,E.jsx)("path",{d:"M16.6667 6.66669V6.67669"}),(0,E.jsx)("path",{d:"M16.6667 10V10.01"}),(0,E.jsx)("path",{d:"M3.33334 13.3333V13.3433"}),(0,E.jsx)("path",{d:"M16.6667 13.3333V13.3433"}),(0,E.jsx)("path",{d:"M3.33334 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M6.66666 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M10 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M13.3333 16.6667V16.6767"}),(0,E.jsx)("path",{d:"M16.6667 16.6667V16.6767"})]}),ye),$C=z((0,E.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),(0,E.jsx)("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),(0,E.jsx)("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),(0,E.jsx)("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),(0,E.jsx)("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),(0,E.jsx)("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),(0,E.jsx)("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),(0,E.jsx)("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),(0,E.jsx)("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),(0,E.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),(0,E.jsx)("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),(0,E.jsx)("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),ue),FC=z((0,E.jsx)("path",{d:"M6 10H34",stroke:"currentColor",strokeWidth:2,fill:"none"}),{width:40,height:20}),BC=Er.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",children:[(0,E.jsx)("path",{d:"M34 10H6M34 10L27 5M34 10L27 15"}),(0,E.jsx)("path",{d:"M27.5 5L34.5 10L27.5 15"})]}),{width:40,height:20})),zE=Er.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,E.jsx)("path",{d:"M32 10L6 10",strokeWidth:2}),(0,E.jsx)("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),zC=Er.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[(0,E.jsx)("path",{d:"M26 10L6 10"}),(0,E.jsx)("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),HC=Er.default.memo(({flip:e=!1})=>z((0,E.jsx)("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",children:(0,E.jsx)("path",{d:"M34 10H5.99996M34 10L34 5M34 10L34 15",stroke:"currentColor",strokeWidth:2,fill:"none"})}),{width:40,height:20})),GC=Er.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[(0,E.jsx)("path",{d:"M32 10L6 10",strokeWidth:2}),(0,E.jsx)("path",{d:"M27.5 5.5L34.5 10L27.5 14.5L27.5 5.5"})]}),{width:40,height:20})),WC=Er.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",children:[(0,E.jsx)("path",{d:"M6,9.5H27"}),(0,E.jsx)("path",{d:"M27,5L34,10L27,14Z",fill:"none"})]}),{width:40,height:20})),jC=Er.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[(0,E.jsx)("path",{d:"M6,9.5H20"}),(0,E.jsx)("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),UC=Er.default.memo(({flip:e=!1})=>z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[(0,E.jsx)("path",{d:"M6,9.5H20"}),(0,E.jsx)("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),VC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.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,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),YC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.jsx)("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),ZC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",children:(0,E.jsx)("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),XC=z((0,E.jsx)(E.Fragment,{children:(0,E.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"})}),ye),HE=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 7v-2h13v2"}),(0,E.jsx)("path",{d:"M10 5v14"}),(0,E.jsx)("path",{d:"M12 19h-4"}),(0,E.jsx)("path",{d:"M15 13v-1h6v1"}),(0,E.jsx)("path",{d:"M18 12v7"}),(0,E.jsx)("path",{d:"M17 19h2"})]}),ue),KC=z((0,E.jsx)(E.Fragment,{children:(0,E.jsx)("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,E.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"})})}),ye),qC=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:(0,E.jsx)("path",{d:"M5.833 6.667 2.5 10l3.333 3.333M14.167 6.667 17.5 10l-3.333 3.333M11.667 3.333 8.333 16.667"})}),(0,E.jsx)("defs",{children:(0,E.jsx)("clipPath",{id:"a",children:(0,E.jsx)("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ye),QC=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,E.jsx)("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),(0,E.jsx)("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),ue),JC=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,E.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),(0,E.jsx)("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),ue),eM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),(0,E.jsx)("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),(0,E.jsx)("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),ue),tM=Er.default.memo(({theme:e})=>z((0,E.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),(0,E.jsx)("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),ue)),nM=Er.default.memo(({theme:e})=>z((0,E.jsxs)("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),(0,E.jsx)("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),ue)),rM=Er.default.memo(({theme:e})=>z((0,E.jsxs)("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),(0,E.jsx)("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),(0,E.jsx)("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),ue)),iM=z((0,E.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}),iz=z((0,E.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"})),Db=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,E.jsx)("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),(0,E.jsx)("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),(0,E.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"})]}),ue),GE=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),(0,E.jsx)("path",{d:"M7 11l5 5l5 -5"}),(0,E.jsx)("path",{d:"M12 4l0 12"})]}),ue),Lb=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.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"})]}),ue),oM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,E.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,E.jsx)("path",{d:"M9.15 14.85l8.85 -10.85"}),(0,E.jsx)("path",{d:"M6 4l8.85 10.85"})]}),ue),aM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),(0,E.jsx)("path",{d:"M12 17l0 .01"}),(0,E.jsx)("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ue),oz=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M7 4v16l13 -8z"})]}),ue),az=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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"})]}),ue),sz=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 12l5 5l10 -10"})]}),ue),sM=z((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M12 9v4"}),(0,E.jsx)("path",{d:"M12 17h.01"})]}),ue),lM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M11 7l6 6"}),(0,E.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"})]}),ue),cM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M12 3l-4 7h8z"}),(0,E.jsx)("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),(0,E.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"})]}),ue),Rb=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 7l16 0"}),(0,E.jsx)("path",{d:"M4 17l16 0"}),(0,E.jsx)("path",{d:"M7 4l0 16"}),(0,E.jsx)("path",{d:"M17 4l0 16"})]}),ue),Ob=z((0,E.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"})),ku=z((0,E.jsxs)("g",{strokeWidth:"1.25",children:[(0,E.jsx)("path",{d:"M4.16602 10H15.8327"}),(0,E.jsx)("path",{d:"M12.5 13.3333L15.8333 10"}),(0,E.jsx)("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),ye),Nb=z((0,E.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[(0,E.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,E.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),Gf=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,E.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,E.jsx)("path",{d:"M15 6l3 3"}),(0,E.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,E.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"})]}),ue),lz=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,E.jsx)("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),(0,E.jsx)("path",{d:"M15 6l3 3"}),(0,E.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,E.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"})]}),ue),sf=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),(0,E.jsx)("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),(0,E.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,E.jsx)("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),(0,E.jsx)("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),(0,E.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"})]}),ue),dM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),(0,E.jsx)("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),(0,E.jsx)("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),(0,E.jsx)("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),ue),Wf=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),(0,E.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"})]}),ue),uM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),(0,E.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,E.jsx)("path",{d:"M3 3l18 18"})]}),ue),hM=z((0,E.jsxs)("g",{stroke:"currentColor",fill:"none",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.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,E.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,E.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,E.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,E.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),ue),mM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.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,E.jsx)("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),(0,E.jsx)("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),(0,E.jsx)("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),(0,E.jsx)("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),ue),$b=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),(0,E.jsx)("path",{d:"M21 21l-6 -6"})]}),ue),pM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M20.984 12.53a9 9 0 1 0 -7.552 8.355"}),(0,E.jsx)("path",{d:"M12 7v5l3 3"}),(0,E.jsx)("path",{d:"M19 16l-2 3h4l-2 3"})]}),ue),fM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M5 10a7 7 0 0 0 14 0"}),(0,E.jsx)("path",{d:"M8 21l8 0"}),(0,E.jsx)("path",{d:"M12 17l0 4"})]}),ue),gM=z((0,E.jsxs)("g",{strokeWidth:1.5,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 3l18 18"}),(0,E.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,E.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,E.jsx)("path",{d:"M8 21l8 0"}),(0,E.jsx)("path",{d:"M12 17l0 4"})]}),ue),Fb=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"})]}),ue),EM=z((0,E.jsxs)("g",{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M12 20v.01"}),(0,E.jsx)("path",{d:"M16 20v.01"}),(0,E.jsx)("path",{d:"M8 20v.01"}),(0,E.jsx)("path",{d:"M4 20v.01"}),(0,E.jsx)("path",{d:"M4 16v.01"}),(0,E.jsx)("path",{d:"M4 12v.01"}),(0,E.jsx)("path",{d:"M4 8v.01"}),(0,E.jsx)("path",{d:"M4 4v.01"}),(0,E.jsx)("path",{d:"M8 4v.01"}),(0,E.jsx)("path",{d:"M12 4v.01"}),(0,E.jsx)("path",{d:"M16 4v.01"}),(0,E.jsx)("path",{d:"M20 4v.01"}),(0,E.jsx)("path",{d:"M20 8v.01"}),(0,E.jsx)("path",{d:"M20 12v.01"}),(0,E.jsx)("path",{d:"M20 16v.01"}),(0,E.jsx)("path",{d:"M20 20v.01"})]}),ue),bM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M5 3v18"}),(0,E.jsx)("path",{d:"M19 21v-18"}),(0,E.jsx)("path",{d:"M5 7h14"}),(0,E.jsx)("path",{d:"M5 15h14"}),(0,E.jsx)("path",{d:"M8 13v4"}),(0,E.jsx)("path",{d:"M11 13v4"}),(0,E.jsx)("path",{d:"M16 13v4"}),(0,E.jsx)("path",{d:"M14 5v4"}),(0,E.jsx)("path",{d:"M11 5v4"}),(0,E.jsx)("path",{d:"M8 5v4"}),(0,E.jsx)("path",{d:"M3 21h18"})]}),ue),yM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M3 12l18 0"}),(0,E.jsx)("path",{d:"M7 16l10 0l-10 5l0 -5"}),(0,E.jsx)("path",{d:"M7 8l10 0l-10 -5l0 5"})]}),ue),vM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M12 3l0 18"}),(0,E.jsx)("path",{d:"M16 7l0 10l5 0l-5 -10"}),(0,E.jsx)("path",{d:"M8 7l0 10l-5 0l5 -10"})]}),ue),WE=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2"}),(0,E.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"})]}),ue),Rp=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),(0,E.jsx)("path",{d:"M22 22l-3 -3"}),(0,E.jsx)("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),(0,E.jsx)("path",{d:"M3 11v-1"}),(0,E.jsx)("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),(0,E.jsx)("path",{d:"M10 3h1"}),(0,E.jsx)("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"})]}),ue),xM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,E.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,E.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,E.jsx)("path",{d:"M10 15l2 6l2 -6"}),(0,E.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"})]}),ue),wM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),(0,E.jsx)("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),(0,E.jsx)("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"}),(0,E.jsx)("path",{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"}),(0,E.jsx)("path",{d:"M11 21v-6l3 6v-6"})]}),ue),SM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M4 8l5 0"}),(0,E.jsx)("path",{d:"M15 8l4 0"})]}),ue),TM=z((0,E.jsxs)("g",{strokeWidth:1.25,children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,E.jsx)("path",{d:"M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),(0,E.jsx)("path",{d:"M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z"}),(0,E.jsx)("path",{d:"M16.746 16.726a3 3 0 1 0 .252 -5.555"})]}),ue),CM=z((0,E.jsxs)("g",{stroke:"currentColor",children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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"})]}),{...ue,strokeWidth:1.5}),cz=z((0,E.jsxs)("g",{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.jsx)("path",{d:"M10 12l10 0"}),(0,E.jsx)("path",{d:"M10 12l4 4"}),(0,E.jsx)("path",{d:"M10 12l4 -4"}),(0,E.jsx)("path",{d:"M4 4l0 16"})]}),ue),MM=z((0,E.jsxs)("g",{children:[(0,E.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,E.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,E.jsx)("path",{d:"M10 9l5 3l-5 3z"})]}),ue)}),LR,l6,Bb,uz=I(()=>{"use strict";D(),pt(),Ce(),On(),ce(),xt(),Pe(),wt(),Fi(),Tr(),la(),xe(),ne(),me(),LR=(e,t)=>{let n=new Set(st(e.filter(r=>ke(r)),t).map(r=>r.id));return{elements:e.map(r=>t.selectedElementIds[r.id]?Le(r,{isDeleted:!0}):r.frameId&&n.has(r.frameId)?Le(r,{isDeleted:!0}):pn(r)&&t.selectedElementIds[r.containerId]?Le(r,{isDeleted:!0}):r),appState:{...t,selectedElementIds:{},selectedGroupIds:{}}}},l6=(e,t)=>{if(e.editingGroupId){let n=hn(at(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},Bb=oe({name:"deleteSelectedElements",label:"labels.delete",icon:bl,trackEvent:{category:"element",action:"delete"},perform:(e,t,n,r)=>{if(t.editingLinearElement){let{elementId:a,selectedPointsIndices:s,startBindingElement:l,endBindingElement:c}=t.editingLinearElement,d=r.scene.getNonDeletedElementsMap(),u=pe.getElement(a,d);if(!u||s==null)return!1;if(u.points.length<2){let m=e.map(f=>f.id===u.id?Le(f,{isDeleted:!0}):f),p=l6(t,m);return{elements:m,appState:{...p,editingLinearElement:null},commitToHistory:!1}}let h={startBindingElement:s?.includes(0)?null:l,endBindingElement:s?.includes(u.points.length-1)?null:c};return pe.deletePoints(u,s),{elements:e,appState:{...t,editingLinearElement:{...t.editingLinearElement,...h,selectedPointsIndices:s?.[0]>0?[s[0]-1]:[0]}},commitToHistory:!0}}let{elements:i,appState:o}=LR(e,t);return gb(i,e.filter(({id:a})=>t.selectedElementIds[a])),o=l6(o,i),{elements:i,appState:{...o,activeTool:nn(t,{type:"selection"}),multiElement:null,activeEmbeddable:null},commitToHistory:mn(at(e),t)}},keyTest:(e,t,n)=>(e.key===O.BACKSPACE||e.key===O.DELETE)&&!e[O.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n})=>(0,dz.jsx)(Xe,{type:"button",icon:bl,title:x("labels.delete"),"aria-label":x("labels.delete"),onClick:()=>n(null),visible:mn(at(e),t)})})});function RR(e,t,n,r){let i=Fe(st(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),o={regularElements:[],frameChildren:new Map},a=new Set;for(let c of e)i.has(c.id)&&ke(c)&&a.add(c.id);for(let c of e)if(i.has(c.id))if(ke(c)||c.frameId&&a.has(c.frameId))o.regularElements.push(c);else if(!c.frameId)o.regularElements.push(c);else{let d=o.frameChildren.get(c.frameId)||[];d.push(c),o.frameChildren.set(c.frameId,d)}let s=e,l=Array.from(o.frameChildren.entries());for(let[c,d]of l)s=r(e,t,n,c,d);return r(s,t,n,null,o.regularElements)}var Pg,c6,OR,d6,NR,$R,u6,h6,m6,hz,mz,pz,fz,tee=I(()=>{"use strict";D(),wt(),xe(),Fi(),pt(),Sl(),ne(),Pg=(e,t)=>e.frameId===t||e.id===t,c6=(e,t,n)=>{let r=[],i=[],o=null,a=-1,s=Fe(n||st(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++a<e.length;){let l=e[a];s.get(l.id)?(i.length&&(r=r.concat(i),i=[]),r.push(a),o=a+1):l.isDeleted&&o===a?(o=a+1,i.push(a)):i=[]}return r},OR=e=>{let t=0;return e.reduce((n,r,i)=>(i>0&&e[i-1]!==r-1&&(t=++t),(n[t]||(n[t]=[])).push(r),n),[])},d6=(e,t,n)=>{if("containerId"in e&&e.containerId)if(n==="left"){let r=Hn.getScene(e).getElement(e.containerId);if(r)return t.indexOf(r)}else return t.indexOf(e);else{let r=e.boundElements?.find(i=>i.type!=="arrow")?.id;if(r){if(n==="left")return t.indexOf(e);let i=Hn.getScene(e).getElement(r);if(i)return t.indexOf(i)}}},NR=(e,t)=>{let n=-1,r=-1;return e.forEach((i,o)=>{Pg(i,t)&&(n===-1&&(n=o),r=o)}),n===-1?[]:e.slice(n,r+1)},$R=(e,t,n,r,i)=>{let o=t[n],a=u=>u.isDeleted?!1:i?u.frameId===i:e.editingGroupId?u.groupIds.includes(e.editingGroupId):!0,s=r==="left"?k5(t,u=>a(u),Math.max(0,n-1)):I5(t,u=>a(u),n+1),l=t[s];if(!l)return-1;if(e.editingGroupId){if(o?.groupIds.join("")===l?.groupIds.join(""))return d6(l,t,r)??s;if(!l?.groupIds.includes(e.editingGroupId))return-1}if(!i&&(l.frameId||ke(l))){let u=NR(t,l.frameId||l.id);return r==="left"?t.indexOf(u[0]):t.indexOf(u[u.length-1])}if(!l.groupIds.length)return d6(l,t,r)??s;let c=e.editingGroupId?l.groupIds[l.groupIds.indexOf(e.editingGroupId)-1]:l.groupIds[l.groupIds.length-1],d=hn(t,c);return d.length?r==="left"?t.indexOf(d[0]):t.indexOf(d[d.length-1]):s},u6=(e,t)=>t.reduce((n,r)=>{let i=e[r];return n[i.id]=i,n},{}),h6=(e,t,n)=>{let r=c6(e,t),i=u6(e,r),o=OR(r);n==="right"&&(o=o.reverse());let a=new Set(r.filter(s=>ke(e[s])).map(s=>e[s].id));return o.forEach((s,l)=>{let c=s[0],d=s[s.length-1],u=n==="left"?c:d,h=s.some(v=>{let y=e[v];return y.frameId&&a.has(y.frameId)})?null:e[u]?.frameId,m=$R(t,e,u,n,h);if(m===-1||u===m)return;let p=n==="left"?e.slice(0,m):e.slice(0,c),f=e.slice(c,d+1),g=n==="left"?e.slice(m,c):e.slice(d+1,m+1),b=n==="left"?e.slice(d+1):e.slice(m+1);e=n==="left"?[...p,...f,...g,...b]:[...p,...g,...f,...b]}),e.map(s=>i[s.id]?Wc(s):s)},m6=(e,t,n,r,i)=>{let o=c6(e,t,i),a=u6(e,o),s=[],l,c;if(n==="left"){if(r)l=I5(e,m=>Pg(m,r));else if(t.editingGroupId){let m=hn(e,t.editingGroupId);if(!m.length)return e;l=e.indexOf(m[0])}else l=0;c=o[o.length-1]}else{if(r)c=k5(e,m=>Pg(m,r));else if(t.editingGroupId){let m=hn(e,t.editingGroupId);if(!m.length)return e;c=e.indexOf(m[m.length-1])}else c=e.length-1;l=o[0]}l===-1&&(l=0);for(let m=l;m<c+1;m++)o.includes(m)||s.push(e[m]);let d=Object.values(a).map(m=>Wc(m)),u=e.slice(0,l),h=e.slice(c+1);return n==="left"?[...u,...d,...s,...h]:[...u,...s,...d,...h]},hz=(e,t)=>h6(e,t,"left"),mz=(e,t)=>h6(e,t,"right"),pz=(e,t)=>RR(e,t,"left",m6),fz=(e,t)=>RR(e,t,"right",m6)}),IM,kM,AM,_M,nee=I(()=>{"use strict";D(),tee(),Ce(),ce(),ne(),xt(),me(),ae(),IM=oe({name:"sendBackward",label:"labels.sendBackward",icon:kE,trackEvent:{category:"element"},perform:(e,t)=>({elements:hz(e,t),appState:t,commitToHistory:!0}),keyPriority:40,keyTest:e=>e[O.CTRL_OR_CMD]&&!e.shiftKey&&e.code===tt.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,mp.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${x("labels.sendBackward")} \u2014 ${V("CtrlOrCmd+[")}`,children:kE})}),kM=oe({name:"bringForward",label:"labels.bringForward",icon:IE,trackEvent:{category:"element"},perform:(e,t)=>({elements:mz(e,t),appState:t,commitToHistory:!0}),keyPriority:40,keyTest:e=>e[O.CTRL_OR_CMD]&&!e.shiftKey&&e.code===tt.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,mp.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${x("labels.bringForward")} \u2014 ${V("CtrlOrCmd+]")}`,children:IE})}),AM=oe({name:"sendToBack",label:"labels.sendToBack",icon:_E,trackEvent:{category:"element"},perform:(e,t)=>({elements:pz(e,t),appState:t,commitToHistory:!0}),keyTest:e=>go?e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.BRACKET_LEFT:e[O.CTRL_OR_CMD]&&e.shiftKey&&e.code===tt.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,mp.jsx)("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${x("labels.sendToBack")} \u2014 ${V(go?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")}`,children:_E})}),_M=oe({name:"bringToFront",label:"labels.bringToFront",icon:AE,trackEvent:{category:"element"},perform:(e,t)=>({elements:fz(e,t),appState:t,commitToHistory:!0}),keyTest:e=>go?e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.BRACKET_RIGHT:e[O.CTRL_OR_CMD]&&e.shiftKey&&e.code===tt.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,mp.jsx)("button",{type:"button",className:"zIndexButton",onClick:n=>e(null),title:`${x("labels.bringToFront")} \u2014 ${V(go?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")}`,children:AE})})}),PM,ree=I(()=>{"use strict";D(),Ce(),xt(),Fi(),Pe(),xe(),Tr(),Kc(),me(),PM=oe({name:"selectAll",label:"labels.selectAll",icon:EM,trackEvent:{category:"canvas"},viewMode:!1,perform:(e,t,n,r)=>{if(t.editingLinearElement)return!1;let i=tf(e.filter(o=>!o.isDeleted&&!(he(o)&&o.containerId)&&!o.locked)).reduce((o,a)=>(o[a.id]=!0,o),{});return{appState:{...t,...Lr({editingGroupId:null,selectedElementIds:i},at(e),t,r),selectedLinearElement:Object.keys(i).length===1&&Ne(e[0])?new pe(e[0]):null},commitToHistory:!0}},keyTest:e=>e[O.CTRL_OR_CMD]&&e.key===O.A})}),FR,BR,gz,iee=I(()=>{"use strict";D(),ne(),FR=e=>{let t=e.slice(),n=new Set,r=o=>{let a=o[0]?.groupIds?.join(""),s=[o[0]],l=[];for(let c of o.slice(1))c.groupIds?.join("")===a?s.push(c):l.push(c);return l.length?[...s,...r(l)]:s},i=new Map;return t.forEach((o,a)=>{if(!i.has(o.id))if(o.groupIds?.length){let s=o.groupIds[o.groupIds.length-1],l=t.slice(a).filter(c=>{let d=c?.groupIds?.some(u=>u===s);return d&&i.set(c.id,!0),d});for(let c of r(l))n.add(c)}else n.add(o)}),n.size!==e.length?(console.error("normalizeGroupElementOrder: lost some elements... bailing!"),e):[...n]},BR=e=>{let t=B$(e),n=e.slice(),r=new Set;return n.forEach((i,o)=>{i&&(i.boundElements?.length?(r.add(i),n[o]=null,i.boundElements.forEach(a=>{let s=t.get(a.id);s&&a.type==="text"&&(r.add(s[0]),n[s[1]]=null)})):i.type==="text"&&i.containerId&&t.get(i.containerId)?.[0].boundElements?.find(a=>a.id===i.id)||(r.add(i),n[o]=null))}),r.size!==e.length?(console.error("normalizeBoundElementsOrder: lost some elements... bailing!"),e):[...r]},gz=e=>BR(FR(e))}),DM,zR,oee=I(()=>{"use strict";D(),Ce(),xt(),Pe(),pt(),On(),ce(),ne(),Tr(),Fi(),la(),ae(),Kt(),xe(),iee(),me(),Sr(),Kc(),DM=oe({name:"duplicateSelection",label:"labels.duplicateSelection",icon:nf,trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getNonDeletedElementsMap();if(t.editingLinearElement){let o=pe.duplicateSelectedPoints(t,i);return o?{elements:e,appState:o.appState,commitToHistory:!0}:!1}return{...zR(e,t),commitToHistory:!0}},keyTest:e=>e[O.CTRL_OR_CMD]&&e.key===O.D,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,Ez.jsx)(Xe,{type:"button",icon:nf,title:`${x("labels.duplicateSelection")} \u2014 ${V("CtrlOrCmd+D")}`,"aria-label":x("labels.duplicateSelection"),onClick:()=>n(null),visible:mn(at(e),t)})}),zR=(e,t)=>{let n=gz(e),r=new Map,i=[],o=[],a=new Map,s=b=>{let v=wT(t.editingGroupId,r,b,{x:b.x+_c/2,y:b.y+_c/2});return a.set(b.id,v.id),o.push(b),i.push(v),v},l=Fe(st(n,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),c=new Map,d=b=>{for(let v of b)c.set(v.id,!0);return b},u=[],h=-1;for(;++h<n.length;){let b=n[h];if(c.get(b.id))continue;let v=Ue(b,Fe(e)),y=ke(b);if(l.get(b.id)){if(b.groupIds.length||v||y){let w=Z5(t,b);if(w){let T=hn(n,w).flatMap(k=>ke(k)?[...na(e,k.id),k]:[k]);u.push(...d([...T,...T.map(k=>s(k))]));continue}if(v){u.push(...d([b,v,s(b),s(v)]));continue}if(y){let T=na(n,b.id);u.push(...d([...T,b,...T.map(k=>s(k)),s(b)]));continue}}(!b.frameId||!l.has(b.frameId))&&u.push(...d([b,s(b)]))}else u.push(...d([b]))}let m=[],p=new Map;for(h=u.length;--h>=0;){let b=u[h];p.get(b.id)||(p.set(b.id,!0),m.push(b))}let f=m.reverse();uT(u,o,a),lT(u,o,a),HT(f,o,a);let g=tf(i);return{elements:f,appState:{...t,...Lr({editingGroupId:t.editingGroupId,selectedElementIds:g.reduce((b,v)=>(pn(v)||(b[v.id]=!0),b),{})},at(f),t,null)}}}}),HR,ot,li=I(()=>{"use strict";D(),HR=["ai","command_palette"],ot=(e,t,n,r)=>{try{if(typeof window>"u"||Pt.VITE_WORKER_ID||Pt.PROD||!HR.includes(e))return;Pt.PROD||console.info("trackEvent",{category:e,action:t,label:n,value:r}),window.sa_event&&window.sa_event(t,{category:e,label:n,value:r})}catch(i){console.error("error during analytics",i)}}}),Jo,aee=I(()=>{"use strict";D(),Jo=e=>(0,Au.jsx)("div",{className:"buttonList buttonListIcon",children:e.options.map(t=>e.type==="button"?(0,Au.jsx)("button",{onClick:n=>e.onClick(t.value,n),className:Y({active:t.active??e.value===t.value}),"data-testid":t.testId,title:t.text,children:t.icon},t.text):(0,Au.jsxs)("label",{className:Y({active:e.value===t.value}),title:t.text,children:[(0,Au.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))})}),bz,see=I(()=>{"use strict";D(),Bi(),bz=({onChange:e,type:t,activeColor:n,topPicks:r})=>{let i;return t==="elementStroke"&&(i=RT),t==="elementBackground"&&(i=OT),t==="canvasBackground"&&(i=NT),r&&(i=r),i?(0,D2.jsx)("div",{className:"color-picker__top-picks",children:i.map(o=>(0,D2.jsx)("button",{className:Y("color-picker__button",{active:o===n,"is-transparent":o==="transparent"||!o}),style:{"--swatch-color":o},type:"button",title:o,onClick:()=>e(o),"data-testid":`color-top-pick-${o}`,children:(0,D2.jsx)("div",{className:"color-picker__button-outline"})},o))}):(console.error("Invalid type for TopPicks"),null)}}),jf,jE,k4,yz,qc,p6,vz,Il=I(()=>{"use strict";D(),Bi(),jf=({palette:e,color:t})=>{for(let[n,r]of Object.entries(e))if(Array.isArray(r)){let i=r.indexOf(t);if(i>-1)return{colorName:n,shade:i}}else if(r===t)return{colorName:n,shade:null};return null},jE=[["q","w","e","r","t"],["a","s","d","f","g"],["z","x","c","v","b"]].flat(),k4=({color:e,palette:t})=>!Object.values(t).flat().includes(e),yz=(e,t,n)=>{let r={elementBackground:"backgroundColor",elementStroke:"strokeColor"},i=e.filter(a=>{if(a.isDeleted)return!1;let s=a[r[t]];return k4({color:s,palette:n})}),o=new Map;return i.forEach(a=>{let s=a[r[t]];o.has(s)?o.set(s,o.get(s)+1):o.set(s,1)}),[...o.entries()].sort((a,s)=>s[1]-a[1]).map(a=>a[0]).slice(0,aB)},qc=At(null),p6=(e,t,n)=>(e*299+t*587+n*114)/1e3>=160?"black":"white",vz=(e,t)=>{if(t){let o=new Option().style;if(o.color=e,o.color){let a=o.color.replace(/^(rgb|rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(","),s=parseInt(a[0]),l=parseInt(a[1]),c=parseInt(a[2]);return p6(s,l,c)}}if(e==="transparent")return"black";let n=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),i=parseInt(e.substring(5,7),16);return p6(n,r,i)}}),GR,zb,LM=I(()=>{"use strict";D(),Il(),GR=({color:e,keyLabel:t,isCustomColor:n=!1,isShade:r=!1})=>(0,xz.jsxs)("div",{className:"color-picker__button__hotkey-label",style:{color:vz(e,n)},children:[r&&"\u21E7",t]}),zb=GR}),wz,lee=I(()=>{"use strict";D(),Il(),LM(),ce(),wz=({hex:e,onChange:t,palette:n})=>{let r=jf({color:e||"transparent",palette:n}),[i,o]=Ve(qc),a=(0,Hb.useRef)(null);if((0,Hb.useEffect)(()=>{a.current&&i==="shades"&&a.current.focus()},[r,i]),r){let{colorName:s,shade:l}=r,c=n[s];if(Array.isArray(c))return(0,Va.jsx)("div",{className:"color-picker-content--default shades",children:c.map((d,u)=>(0,Va.jsxs)("button",{ref:u===l&&i==="shades"?a:void 0,tabIndex:-1,type:"button",className:Y("color-picker__button color-picker__button--large",{active:u===l}),"aria-label":"Shade",title:`${s} - ${u+1}`,style:d?{"--swatch-color":d}:void 0,onClick:()=>{t(d),o("shades")},children:[(0,Va.jsx)("div",{className:"color-picker__button-outline"}),(0,Va.jsx)(zb,{color:d,keyLabel:u+1,isShade:!0})]},u))})}return(0,Va.jsxs)("div",{className:"color-picker-content--default",style:{position:"relative"},tabIndex:-1,children:[(0,Va.jsx)("button",{type:"button",tabIndex:-1,className:"color-picker__button color-picker__button--large color-picker__button--no-focus-visible"}),(0,Va.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:x("colorPicker.noShades")})]})}}),WR,Sz,cee=I(()=>{"use strict";D(),Il(),LM(),ce(),WR=({palette:e,color:t,onChange:n,label:r,activeShade:i})=>{let o=jf({color:t||"transparent",palette:e}),[a,s]=Ve(qc),l=(0,Gb.useRef)(null);return(0,Gb.useEffect)(()=>{l.current&&a==="baseColors"&&l.current.focus()},[o?.colorName,a]),(0,_u.jsx)("div",{className:"color-picker-content--default",children:Object.entries(e).map(([c,d],u)=>{let h=(Array.isArray(d)?d[i]:d)||"transparent",m=jE[u],p=x(`colors.${c.replace(/\d+/,"")}`,null,"");return(0,_u.jsxs)("button",{ref:o?.colorName===c?l:void 0,tabIndex:-1,type:"button",className:Y("color-picker__button color-picker__button--large",{active:o?.colorName===c,"is-transparent":h==="transparent"||!h}),onClick:()=>{n(h),s("baseColors")},title:`${p}${h.startsWith("#")?` ${h}`:""} \u2014 ${m}`,"aria-label":`${p} \u2014 ${m}`,style:h?{"--swatch-color":h}:void 0,"data-testid":`color-${c}`,children:[(0,_u.jsx)("div",{className:"color-picker__button-outline"}),(0,_u.jsx)(zb,{color:h,keyLabel:m})]},c)})})},Sz=WR}),Tz,dee=I(()=>{"use strict";D(),Il(),LM(),Tz=({colors:e,color:t,onChange:n,label:r})=>{let[i,o]=Ve(qc),a=(0,Wb.useRef)(null);return(0,Wb.useEffect)(()=>{a.current&&a.current.focus()},[t,i]),(0,Pu.jsx)("div",{className:"color-picker-content--default",children:e.map((s,l)=>(0,Pu.jsxs)("button",{ref:t===s?a:void 0,tabIndex:-1,type:"button",className:Y("color-picker__button color-picker__button--large",{active:t===s,"is-transparent":s==="transparent"||!s}),onClick:()=>{n(s),o("custom")},title:s,"aria-label":r,style:{"--swatch-color":s},children:[(0,Pu.jsx)("div",{className:"color-picker__button-outline"}),(0,Pu.jsx)(zb,{color:s,keyLabel:l+1,isCustomColor:!0})]},l))})}}),Dg,jR,Cz,uee=I(()=>{"use strict";D(),Ce(),Bi(),Il(),Dg=(e,t,n)=>{let r=Math.ceil(n/fc);switch(t=t??-1,e){case"ArrowLeft":{let i=t-1;return i<0?n-1:i}case"ArrowRight":return(t+1)%n;case"ArrowDown":{let i=t+fc;return i>=n?t%fc:i}case"ArrowUp":{let i=t-fc,o=i<0?fc*r+i:i;return o>=n?void 0:o}}},jR=({e,colorObj:t,onChange:n,palette:r,customColors:i,setActiveColorPickerSection:o,activeShade:a})=>{if(t?.shade!=null&&["Digit1","Digit2","Digit3","Digit4","Digit5"].includes(e.code)&&e.shiftKey){let s=Number(e.code.slice(-1))-1;return n(r[t.colorName][s]),o("shades"),!0}if(["1","2","3","4","5"].includes(e.key)&&i[Number(e.key)-1])return n(i[Number(e.key)-1]),o("custom"),!0;if(jE.includes(e.key)){let s=jE.indexOf(e.key),l=Object.keys(r)[s],c=r[l],d=Array.isArray(c)?c[a]:c;return n(d),o("baseColors"),!0}return!1},Cz=({event:e,activeColorPickerSection:t,palette:n,color:r,onChange:i,customColors:o,setActiveColorPickerSection:a,updateData:s,activeShade:l,onEyeDropperToggle:c,onEscape:d})=>{if(e[O.CTRL_OR_CMD])return!1;if(e.key===O.ESCAPE)return d(e),!0;if(e.key===O.ALT)return c(!0),!0;if(e.key===O.I)return c(),!0;let u=jf({color:r,palette:n});if(e.key===O.TAB){let h={custom:!!o.length,baseColors:!0,shades:u?.shade!=null,hex:!0},m=Object.entries(h).reduce((v,[y,w])=>(w&&v.push(y),v),[]),p=m.indexOf(t),f=e.shiftKey?-1:1,g=p+f>m.length-1?0:p+f<0?m.length-1:p+f,b=m[g];return b&&a(b),b==="custom"?i(o[0]):b==="baseColors"&&(Object.entries(n).find(([v,y])=>Array.isArray(y)?y.includes(r):y===r?v:null)||i(He.charcoal)),e.preventDefault(),e.stopPropagation(),!0}if(jR({e,colorObj:u,onChange:i,palette:n,customColors:o,setActiveColorPickerSection:a,activeShade:l}))return!0;if(t==="shades"&&u){let{shade:h}=u,m=Dg(e.key,h,fc);if(m!==void 0)return i(n[u.colorName][m]),!0}if(t==="baseColors"&&u){let{colorName:h}=u,m=Object.keys(n),p=m.indexOf(h),f=Dg(e.key,p,m.length);if(f!==void 0){let g=m[f],b=n[g];return i(Array.isArray(b)?b[l]:b),!0}}if(t==="custom"){let h=o.indexOf(r),m=Dg(e.key,h,o.length);if(m!==void 0){let p=o[m];return i(p),!0}}return!1}}),UR,Op,Iz=I(()=>{"use strict";D(),UR=({children:e})=>(0,Mz.jsx)("div",{className:"color-picker__heading",children:e}),Op=UR}),kz,hee=I(()=>{"use strict";D(),ce(),lee(),cee(),dee(),uee(),Iz(),Il(),Bi(),Ce(),ae(),kz=({color:e,onChange:t,label:n,type:r,elements:i,palette:o,updateData:a,children:s,onEyeDropperToggle:l,onEscape:c})=>{let[d]=yl.default.useState(()=>r==="canvasBackground"?[]:yz(i,r,o)),[u,h]=Ve(qc),m=jf({color:e,palette:o});(0,yl.useEffect)(()=>{if(!u){let b=k4({color:e,palette:o}),v=b&&!d.includes(e);h(v?"hex":b?"custom":m?.shade!=null?"shades":"baseColors")}},[u,e,o,h,m,d]);let[p,f]=(0,yl.useState)(m?.shade??(r==="elementBackground"?du:cu));(0,yl.useEffect)(()=>{m?.shade!=null&&f(m.shade);let b=v=>{v.key===O.ALT&&l(!1)};return document.addEventListener("keyup",b,{capture:!0}),()=>{document.removeEventListener("keyup",b,{capture:!0})}},[m,l]);let g=yl.default.useRef(null);return(0,Jr.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":x("labels.colorPicker"),children:(0,Jr.jsxs)("div",{ref:g,onKeyDown:b=>{Cz({event:b,activeColorPickerSection:u,palette:o,color:e,onChange:t,onEyeDropperToggle:l,customColors:d,setActiveColorPickerSection:h,updateData:a,activeShade:p,onEscape:c})&&(b.preventDefault(),b.stopPropagation())},className:"color-picker-content",tabIndex:-1,children:[!!d.length&&(0,Jr.jsxs)("div",{children:[(0,Jr.jsx)(Op,{children:x("colorPicker.mostUsedCustomColors")}),(0,Jr.jsx)(Tz,{colors:d,color:e,label:x("colorPicker.mostUsedCustomColors"),onChange:t})]}),(0,Jr.jsxs)("div",{children:[(0,Jr.jsx)(Op,{children:x("colorPicker.colors")}),(0,Jr.jsx)(Sz,{color:e,label:n,palette:o,onChange:t,activeShade:p})]}),(0,Jr.jsxs)("div",{children:[(0,Jr.jsx)(Op,{children:x("colorPicker.shades")}),(0,Jr.jsx)(wz,{hex:e,onChange:t,palette:o})]}),s]})})}}),_4,Rn,Kn=I(()=>{"use strict";D(),_4=A4.default.createContext(null),Rn=()=>A4.default.useContext(_4)}),RM,Az=I(()=>{"use strict";D(),Re(),ae(),Kn(),RM=e=>{let[t,n]=(0,lf.useState)(null),r=Wn(),{theme:i}=Rn(),{container:o}=ua();return(0,lf.useLayoutEffect)(()=>{t&&(t.className="",t.classList.add("excalidraw",...e?.className?.split(/\s+/)||[]),t.classList.toggle("excalidraw--mobile",r.editor.isMobile),t.classList.toggle("theme--dark",i===$e.DARK))},[t,i,r.editor.isMobile,e?.className]),(0,lf.useLayoutEffect)(()=>{let a=e?.parentSelector?o?.querySelector(e.parentSelector):document.body;if(!a)return;let s=document.createElement("div");return a.appendChild(s),n(s),()=>{a.removeChild(s)}},[o,e?.parentSelector]),t}});function OM(e,t,n){(0,_z.useEffect)(()=>{function r(i){let o=i;if(!e.current)return;let a=n?.(o,e.current);if(a!==!0){if(a===!1)return t(o);e.current.contains(o.target)||!document.documentElement.contains(o.target)||o.target.closest("[data-radix-portal]")||o.target===document.documentElement&&document.body.style.pointerEvents==="none"||o.target.closest("[data-prevent-outside-click]")||t(o)}}return document.addEventListener("pointerdown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("pointerdown",r),document.removeEventListener("touchstart",r)}},[e,t,n])}var NM=I(()=>{"use strict";D(),ae()}),jb,$M=I(()=>{"use strict";D(),jb=e=>{let t=(0,Pz.useRef)(e);return Object.assign(t.current,e),t.current}}),mee=I(()=>{}),Uf,Rz,Vb=I(()=>{"use strict";D(),Bi(),ae(),Kn(),Az(),NM(),Ce(),pt(),Re(),$M(),mee(),Uf=At(null),Rz=({onCancel:e,onChange:t,onSelect:n,colorPickerType:r})=>{let i=RM({className:"excalidraw-eye-dropper-backdrop",parentSelector:".excalidraw-eye-dropper-container"}),o=Rn(),a=Kf(),s=_l(),l=st(a,o),c=jb({app:s,onCancel:e,onChange:t,onSelect:n,selectedElements:l}),{container:d}=ua();(0,Ub.useEffect)(()=>{let h=u.current;if(!h||!s.canvas||!i)return;let m=!1,p=s.canvas.getContext("2d"),f=({clientX:k,clientY:M})=>{let C=p.getImageData((k-o.offsetLeft)*window.devicePixelRatio,(M-o.offsetTop)*window.devicePixelRatio,1,1).data;return uB(C[0],C[1],C[2])},g=({clientX:k,clientY:M,altKey:C})=>{h.style.top=`${M+20}px`,h.style.left=`${k+20}px`;let P=f({clientX:k,clientY:M});m&&c.onChange(r,P,c.selectedElements,{altKey:C}),h.style.background=P},b=()=>{c.onCancel()},v=(k,M)=>{c.onSelect(k,M)},y=k=>{m=!0,k.stopImmediatePropagation()},w=k=>{m=!1,d?.focus(),k.stopImmediatePropagation(),k.preventDefault(),v(f(k),k)},T=k=>{k.key===O.ESCAPE&&(k.preventDefault(),k.stopImmediatePropagation(),b())};return i.tabIndex=-1,i.focus(),g({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),i.addEventListener("keydown",T),i.addEventListener("pointerdown",y),i.addEventListener("pointerup",w),window.addEventListener("pointermove",g,{passive:!0}),window.addEventListener("blur",b),()=>{m=!1,i.removeEventListener("keydown",T),i.removeEventListener("pointerdown",y),i.removeEventListener("pointerup",w),window.removeEventListener("pointermove",g),window.removeEventListener("blur",b)}},[c,s.canvas,i,r,d,o.offsetLeft,o.offsetTop]);let u=(0,Ub.useRef)(null);return OM(u,()=>{e()},h=>!!h.target.closest(".excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop")),i?(0,Dz.createPortal)((0,Lz.jsx)("div",{ref:u,className:"excalidraw-eye-dropper-preview"}),i):null}}),Oz,pee=I(()=>{"use strict";D(),FM(),Il(),me(),Ln(),Ce(),Vb(),ce(),Re(),ne(),Oz=({color:e,onChange:t,label:n,colorPickerType:r})=>{let i=Wn(),[o,a]=(0,To.useState)(e),[s,l]=Ve(qc);(0,To.useEffect)(()=>{a(e)},[e]);let c=(0,To.useCallback)(p=>{let f=p.toLowerCase(),g=$z(f);g&&t(g),a(f)},[t]),d=(0,To.useRef)(null),u=(0,To.useRef)(null);(0,To.useEffect)(()=>{d.current&&d.current.focus()},[s]);let[h,m]=Ve(Uf,Gn);return(0,To.useEffect)(()=>()=>{m(null)},[m]),(0,ra.jsxs)("div",{className:"color-picker__input-label",children:[(0,ra.jsx)("div",{className:"color-picker__input-hash",children:"#"}),(0,ra.jsx)("input",{ref:s==="hex"?d:void 0,style:{border:0,padding:0},spellCheck:!1,className:"color-picker-input","aria-label":n,onChange:p=>{c(p.target.value)},value:(o||"").replace(/^#/,""),onBlur:()=>{a(e)},tabIndex:-1,onFocus:()=>l("hex"),onKeyDown:p=>{p.key!==O.TAB&&(p.key===O.ESCAPE&&u.current?.focus(),p.stopPropagation())}}),!i.editor.isMobile&&(0,ra.jsxs)(ra.Fragment,{children:[(0,ra.jsx)("div",{style:{width:"1px",height:"1.25rem",backgroundColor:"var(--default-border-color)"}}),(0,ra.jsx)("div",{ref:u,className:Y("excalidraw-eye-dropper-trigger",{selected:h}),onClick:()=>m(p=>p?null:{keepOpenOnAlt:!1,onSelect:f=>t(f),colorPickerType:r}),title:`${x("labels.eyeDropper")} \u2014 ${O.I.toLocaleUpperCase()} or ${V("Alt")} `,children:lM})]})]})}}),fee=I(()=>{}),f6,$z,VR,YR,UE,FM=I(()=>{"use strict";D(),ne(),see(),hee(),Il(),Re(),Bi(),Iz(),ce(),Ln(),pee(),Vb(),fee(),f6=e=>{let t=new Option().style;return t.color=e,!!t.color},$z=e=>mo(e)?e:f6(`#${e}`)?`#${e}`:f6(e)?e:null,VR=({type:e,color:t,onChange:n,label:r,elements:i,palette:o=He,updateData:a})=>{let[,s]=Ve(qc),[l,c]=Ve(Uf,Gn),{container:d}=ua(),u=Wn(),h=(0,Bn.jsxs)("div",{children:[(0,Bn.jsx)(Op,{children:x("colorPicker.hexCode")}),(0,Bn.jsx)(Oz,{color:t,label:r,onChange:f=>{n(f)},colorPickerType:e})]}),m=(0,Nz.useRef)(null),p=()=>{m.current?.querySelector(".color-picker-content")?.focus()};return(0,Bn.jsx)(OD,{container:d,children:(0,Bn.jsxs)(og,{ref:m,className:"focus-visible-none","data-prevent-outside-click":!0,onFocusOutside:f=>{p(),f.preventDefault()},onPointerDownOutside:f=>{l&&f.preventDefault()},onCloseAutoFocus:f=>{f.stopPropagation(),f.preventDefault(),d&&!D$(document.activeElement)&&d.focus(),a({openPopup:null}),s(null)},side:u.editor.isMobile&&!u.viewport.isLandscape?"bottom":"right",align:u.editor.isMobile&&!u.viewport.isLandscape?"center":"start",alignOffset:-16,sideOffset:20,style:{zIndex:"var(--zIndex-layerUI)",backgroundColor:"var(--popup-bg-color)",maxWidth:"208px",maxHeight:window.innerHeight,padding:"12px",borderRadius:"8px",boxSizing:"border-box",overflowY:"auto",boxShadow:"0px 7px 14px rgba(0, 0, 0, 0.05), 0px 0px 3.12708px rgba(0, 0, 0, 0.0798), 0px 0px 0.931014px rgba(0, 0, 0, 0.1702)"},children:[o?(0,Bn.jsx)(kz,{palette:o,color:t,onChange:f=>{n(f)},onEyeDropperToggle:f=>{c(g=>f?(g=g||{keepOpenOnAlt:!0,onSelect:n,colorPickerType:e},g.keepOpenOnAlt=!0,g):f===!1||g?null:{keepOpenOnAlt:!1,onSelect:n,colorPickerType:e})},onEscape:f=>{l?c(null):Ha(f.target)?p():a({openPopup:null})},label:r,type:e,elements:i,updateData:a,children:h}):h,(0,Bn.jsx)(ND,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})},YR=({label:e,color:t,type:n})=>(0,Bn.jsx)(ig,{type:"button",className:Y("color-picker__button active-color",{"is-transparent":t==="transparent"||!t}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:x(n==="elementStroke"?"labels.showStroke":"labels.showBackground"),children:(0,Bn.jsx)("div",{className:"color-picker__button-outline"})}),UE=({type:e,color:t,onChange:n,label:r,elements:i,palette:o=He,topPicks:a,updateData:s,appState:l})=>(0,Bn.jsx)("div",{children:(0,Bn.jsxs)("div",{role:"dialog","aria-modal":"true",className:"color-picker-container",children:[(0,Bn.jsx)(bz,{activeColor:t,onChange:n,type:e,topPicks:a}),(0,Bn.jsx)("div",{style:{width:1,height:"100%",backgroundColor:"var(--default-border-color)",margin:"0 auto"}}),(0,Bn.jsxs)(rg,{open:l.openPopup===e,onOpenChange:c=>{s({openPopup:c?e:null})},children:[(0,Bn.jsx)(YR,{color:t,label:r,type:e}),l.openPopup===e&&(0,Bn.jsx)(VR,{type:e,color:t,onChange:n,label:r,elements:i,palette:o,updateData:s})]})]})})}),gee=I(()=>{}),BM,zz=I(()=>{"use strict";D(),gee(),ne(),Ce(),BM=({children:e,left:t,top:n,onCloseRequest:r,fitInViewport:i=!1,offsetLeft:o=0,offsetTop:a=0,viewportWidth:s=window.innerWidth,viewportHeight:l=window.innerHeight})=>{let c=(0,vl.useRef)(null);(0,vl.useEffect)(()=>{let u=c.current;if(!u)return;u.contains(document.activeElement)||u.focus();let h=m=>{if(m.key===O.TAB){let p=K2(u),{activeElement:f}=document,g=p.findIndex(b=>b===f);f===u?(m.shiftKey?p[p.length-1]?.focus():p[0].focus(),m.preventDefault(),m.stopImmediatePropagation()):g===0&&m.shiftKey?(p[p.length-1]?.focus(),m.preventDefault(),m.stopImmediatePropagation()):g===p.length-1&&!m.shiftKey&&(p[0]?.focus(),m.preventDefault(),m.stopImmediatePropagation())}};return u.addEventListener("keydown",h),()=>u.removeEventListener("keydown",h)},[]);let d=(0,vl.useRef)(null);return(0,vl.useLayoutEffect)(()=>{if(i&&c.current&&n!=null&&t!=null){let u=c.current,{width:h,height:m}=u.getBoundingClientRect();if(d.current?.top===n&&d.current?.left===t)return;d.current={top:n,left:t},h>=s?(u.style.width=`${s}px`,u.style.left="0px",u.style.overflowX="scroll"):t+h-o>s?u.style.left=`${s-h-10}px`:u.style.left=`${t}px`,m>=l?(u.style.height=`${l-20}px`,u.style.top="10px",u.style.overflowY="scroll"):n+m-a>l?u.style.top=`${l-m}px`:u.style.top=`${n}px`}},[n,t,i,s,l,o,a]),(0,vl.useEffect)(()=>{if(r){let u=h=>{c.current?.contains(h.target)||(0,Fz.unstable_batchedUpdates)(()=>r(h))};return document.addEventListener("pointerdown",u,!1),()=>document.removeEventListener("pointerdown",u,!1)}},[r]),(0,Bz.jsx)("div",{className:"popover",ref:c,tabIndex:-1,children:e})}}),Eee=I(()=>{});function bee({options:e,value:t,label:n,onChange:r,onClose:i}){let o=al.default.useRef(),a=al.default.useRef(),s=al.default.useRef(null);return al.default.useEffect(()=>{a.current?a.current.focus():s.current&&s.current.focus()},[]),(0,xr.jsx)("div",{className:"picker",role:"dialog","aria-modal":"true","aria-label":n,onKeyDown:l=>{let c=e.find(d=>d.keyBinding===l.key.toLowerCase());if(!(l.metaKey||l.altKey||l.ctrlKey)&&c){let d=e.indexOf(c);s.current.children[d].focus(),l.preventDefault()}else if(l.key===O.TAB)setTimeout(()=>{let d=a.current,u=document.activeElement;d!==u&&i()},0);else if(Cp(l.key)){let{activeElement:d}=document,u=sh().rtl,h=Array.prototype.indexOf.call(s.current.children,d);if(h!==-1){let m=e.length,p=h;switch(l.key){case(u?O.ARROW_LEFT:O.ARROW_RIGHT):case O.ARROW_DOWN:{p=(h+1)%m;break}case(u?O.ARROW_RIGHT:O.ARROW_LEFT):case O.ARROW_UP:{p=(m+h-1)%m;break}}s.current.children[p].focus()}l.preventDefault()}else(l.key===O.ESCAPE||l.key===O.ENTER)&&(l.preventDefault(),i());l.nativeEvent.stopImmediatePropagation(),l.stopPropagation()},children:(0,xr.jsx)("div",{className:"picker-content",ref:s,children:e.map((l,c)=>(0,xr.jsxs)("button",{className:Y("picker-option",{active:t===l.value}),onClick:d=>{d.currentTarget.focus(),r(l.value)},title:`${l.text} ${l.keyBinding&&`\u2014 ${l.keyBinding.toUpperCase()}`}`,"aria-label":l.text||"none","aria-keyshortcuts":l.keyBinding||void 0,ref:d=>{d&&c===0&&(o.current=d),d&&l.value===t&&(a.current=d)},onFocus:()=>{r(l.value)},children:[l.icon,l.keyBinding&&(0,xr.jsx)("span",{className:"picker-keybinding",children:l.keyBinding})]},l.text))})})}function ZR({value:e,label:t,options:n,onChange:r,group:i=""}){let[o,a]=al.default.useState(!1),s=al.default.useRef(null),l=sh().rtl;return(0,xr.jsxs)("div",{children:[(0,xr.jsx)("button",{name:i,className:o?"active":"","aria-label":t,onClick:()=>a(!o),ref:s,children:n.find(c=>c.value===e)?.icon}),(0,xr.jsx)(al.default.Suspense,{fallback:"",children:o?(0,xr.jsxs)(xr.Fragment,{children:[(0,xr.jsx)(BM,{onCloseRequest:c=>c.target!==s.current&&a(!1),...l?{right:5.5}:{left:-5.5},children:(0,xr.jsx)(bee,{options:n.filter(c=>c.showInPicker!==!1),value:e,label:t,onChange:r,onClose:()=>{a(!1),s.current?.focus()}})}),(0,xr.jsx)("div",{className:"picker-triangle"})]}):null})]})}var yee=I(()=>{"use strict";D(),zz(),Eee(),Ce(),ce()}),g6,Pr,gr,XR,Lg,Hz,Gz,Wz,jz,Uz,vee,Vz,Yz,P4,D4,Zz,Xz,Kz,xee,E6,wee,qz=I(()=>{"use strict";D(),Bi(),li(),aee(),FM(),yee(),me(),ae(),Pe(),wt(),Kt(),xe(),ce(),Ce(),sa(),pt(),pb(),ne(),xt(),g6=.1,Pr=(e,t,n,r=!1)=>{let i=Fe(st(e,t,{includeBoundTextElement:r}));return e.map(o=>i.get(o.id)||o.id===t.editingElement?.id?n(o):o)},gr=function(e,t,n,r,i){let o=t.editingElement,a=at(e),s=null;return o&&(s=n(o)),s||(mn(a,t)?s=zB(r===!0?a:a.filter(l=>r(l)),t,n)??(typeof i=="function"?i(!0):i):s=typeof i=="function"?i(!1):i),s},XR=(e,t)=>pn(t)?t:re(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},!1),Lg=(e,t,n,r,i)=>{let o=new Set;return{elements:Pr(e,t,a=>{if(he(a)){let s=r(a);o.add(s);let l=Le(a,{fontSize:s});return bo(l,n.scene.getContainerElement(a),n.scene.getNonDeletedElementsMap()),l=XR(a,l),l}return a},!0),appState:{...t,currentItemFontSize:o.size===1?[...o][0]:i??t.currentItemFontSize},commitToHistory:!0}},Hz=oe({name:"changeStrokeColor",label:"labels.stroke",trackEvent:!1,perform:(e,t,n)=>({...n.currentItemStrokeColor&&{elements:Pr(e,t,r=>tE(r.type)?Le(r,{strokeColor:n.currentItemStrokeColor}):r,!0)},appState:{...t,...n},commitToHistory:!!n.currentItemStrokeColor}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r})=>(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("h3",{"aria-hidden":"true",children:x("labels.stroke")}),(0,be.jsx)(UE,{topPicks:RT,palette:lB,type:"elementStroke",label:x("labels.stroke"),color:gr(e,t,i=>i.strokeColor,!0,t.currentItemStrokeColor),onChange:i=>n({currentItemStrokeColor:i}),elements:e,appState:t,updateData:n})]})}),Gz=oe({name:"changeBackgroundColor",label:"labels.changeBackground",trackEvent:!1,perform:(e,t,n)=>({...n.currentItemBackgroundColor&&{elements:Pr(e,t,r=>Le(r,{backgroundColor:n.currentItemBackgroundColor}))},appState:{...t,...n},commitToHistory:!!n.currentItemBackgroundColor}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r})=>(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("h3",{"aria-hidden":"true",children:x("labels.background")}),(0,be.jsx)(UE,{topPicks:OT,palette:cB,type:"elementBackground",label:x("labels.background"),color:gr(e,t,i=>i.backgroundColor,!0,t.currentItemBackgroundColor),onChange:i=>n({currentItemBackgroundColor:i}),elements:e,appState:t,updateData:n})]})}),Wz=oe({name:"changeFillStyle",label:"labels.fill",trackEvent:!1,perform:(e,t,n,r)=>(ot("element","changeFillStyle",`${n} (${r.device.editor.isMobile?"mobile":"desktop"})`),{elements:Pr(e,t,i=>Le(i,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=st(e,t),i=r.length>0&&r.every(o=>o.fillStyle==="zigzag");return(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.fill")}),(0,be.jsx)(Jo,{type:"button",options:[{value:"hachure",text:`${x(i?"labels.zigzag":"labels.hachure")} (${V("Alt-Click")})`,icon:i?CC:MC,active:i?!0:void 0,testId:"fill-hachure"},{value:"cross-hatch",text:x("labels.crossHatch"),icon:IC,testId:"fill-cross-hatch"},{value:"solid",text:x("labels.solid"),icon:kC,testId:"fill-solid"}],value:gr(e,t,o=>o.fillStyle,o=>o.hasOwnProperty("fillStyle"),o=>o?null:t.currentItemFillStyle),onClick:(o,a)=>{let s=a.altKey&&o==="hachure"&&r.every(l=>l.fillStyle==="hachure")?"zigzag":o;n(s)}})]})}}),jz=oe({name:"changeStrokeWidth",label:"labels.strokeWidth",trackEvent:!1,perform:(e,t,n)=>({elements:Pr(e,t,r=>Le(r,{strokeWidth:n})),appState:{...t,currentItemStrokeWidth:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.strokeWidth")}),(0,be.jsx)(Jo,{group:"stroke-width",options:[{value:g2.thin,text:x("labels.thin"),icon:BE,testId:"strokeWidth-thin"},{value:g2.bold,text:x("labels.bold"),icon:AC,testId:"strokeWidth-bold"},{value:g2.extraBold,text:x("labels.extraBold"),icon:_C,testId:"strokeWidth-extraBold"}],value:gr(e,t,r=>r.strokeWidth,r=>r.hasOwnProperty("strokeWidth"),r=>r?null:t.currentItemStrokeWidth),onChange:r=>n(r)})]})}),Uz=oe({name:"changeSloppiness",label:"labels.sloppiness",trackEvent:!1,perform:(e,t,n)=>({elements:Pr(e,t,r=>Le(r,{seed:ns(),roughness:n})),appState:{...t,currentItemRoughness:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.sloppiness")}),(0,be.jsx)(Jo,{group:"sloppiness",options:[{value:0,text:x("labels.architect"),icon:LC},{value:1,text:x("labels.artist"),icon:RC},{value:2,text:x("labels.cartoonist"),icon:OC}],value:gr(e,t,r=>r.roughness,r=>r.hasOwnProperty("roughness"),r=>r?null:t.currentItemRoughness),onChange:r=>n(r)})]})}),vee=oe({name:"changeStrokeStyle",label:"labels.strokeStyle",trackEvent:!1,perform:(e,t,n)=>({elements:Pr(e,t,r=>Le(r,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.strokeStyle")}),(0,be.jsx)(Jo,{group:"strokeStyle",options:[{value:"solid",text:x("labels.strokeStyle_solid"),icon:BE},{value:"dashed",text:x("labels.strokeStyle_dashed"),icon:PC},{value:"dotted",text:x("labels.strokeStyle_dotted"),icon:DC}],value:gr(e,t,r=>r.strokeStyle,r=>r.hasOwnProperty("strokeStyle"),r=>r?null:t.currentItemStrokeStyle),onChange:r=>n(r)})]})}),Vz=oe({name:"changeOpacity",label:"labels.opacity",trackEvent:!1,perform:(e,t,n)=>({elements:Pr(e,t,r=>Le(r,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,be.jsxs)("label",{className:"control-label",children:[x("labels.opacity"),(0,be.jsx)("input",{type:"range",min:"0",max:"100",step:"10",onChange:r=>n(+r.target.value),value:gr(e,t,r=>r.opacity,!0,t.currentItemOpacity)??void 0})]})}),Yz=oe({name:"changeFontSize",label:"labels.fontSize",trackEvent:!1,perform:(e,t,n,r)=>Lg(e,t,r,()=>n,n),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.fontSize")}),(0,be.jsx)(Jo,{group:"font-size",options:[{value:16,text:x("labels.small"),icon:VC,testId:"fontSize-small"},{value:20,text:x("labels.medium"),icon:YC,testId:"fontSize-medium"},{value:28,text:x("labels.large"),icon:ZC,testId:"fontSize-large"},{value:36,text:x("labels.veryLarge"),icon:XC,testId:"fontSize-veryLarge"}],value:gr(e,t,i=>{if(he(i))return i.fontSize;let o=Ue(i,r.scene.getNonDeletedElementsMap());return o?o.fontSize:null},i=>he(i)||Ue(i,r.scene.getNonDeletedElementsMap())!==null,i=>i?null:t.currentItemFontSize||Ni),onChange:i=>n(i)})]})}),P4=oe({name:"decreaseFontSize",label:"labels.decreaseFontSize",icon:HE,trackEvent:!1,perform:(e,t,n,r)=>Lg(e,t,r,i=>Math.round(1/(1+g6)*i.fontSize)),keyTest:e=>e[O.CTRL_OR_CMD]&&e.shiftKey&&(e.key===O.CHEVRON_LEFT||e.key===O.COMMA)}),D4=oe({name:"increaseFontSize",label:"labels.increaseFontSize",icon:HE,trackEvent:!1,perform:(e,t,n,r)=>Lg(e,t,r,i=>Math.round(i.fontSize*(1+g6))),keyTest:e=>e[O.CTRL_OR_CMD]&&e.shiftKey&&(e.key===O.CHEVRON_RIGHT||e.key===O.PERIOD)}),Zz=oe({name:"changeFontFamily",label:"labels.fontFamily",trackEvent:!1,perform:(e,t,n,r)=>({elements:Pr(e,t,i=>{if(he(i)){let o=Le(i,{fontFamily:n,lineHeight:gl(n)});return bo(o,r.scene.getContainerElement(i),r.scene.getNonDeletedElementsMap()),o}return i},!0),appState:{...t,currentItemFontFamily:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=[{value:zn.Virgil,text:x("labels.handDrawn"),icon:Bf,testId:"font-family-virgil"},{value:zn.Helvetica,text:x("labels.normal"),icon:KC,testId:"font-family-normal"},{value:zn.Cascadia,text:x("labels.code"),icon:qC,testId:"font-family-code"}];return(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.fontFamily")}),(0,be.jsx)(Jo,{group:"font-family",options:i,value:gr(e,t,o=>{if(he(o))return o.fontFamily;let a=Ue(o,r.scene.getNonDeletedElementsMap());return a?a.fontFamily:null},o=>he(o)||Ue(o,r.scene.getNonDeletedElementsMap())!==null,o=>o?null:t.currentItemFontFamily||aa),onChange:o=>n(o)})]})}}),Xz=oe({name:"changeTextAlign",label:"Change text alignment",trackEvent:!1,perform:(e,t,n,r)=>({elements:Pr(e,t,i=>{if(he(i)){let o=Le(i,{textAlign:n});return bo(o,r.scene.getContainerElement(i),r.scene.getNonDeletedElementsMap()),o}return i},!0),appState:{...t,currentItemTextAlign:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=r.scene.getNonDeletedElementsMap();return(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.textAlign")}),(0,be.jsx)(Jo,{group:"text-align",options:[{value:"left",text:x("labels.left"),icon:QC,testId:"align-left"},{value:"center",text:x("labels.center"),icon:JC,testId:"align-horizontal-center"},{value:"right",text:x("labels.right"),icon:eM,testId:"align-right"}],value:gr(e,t,o=>{if(he(o))return o.textAlign;let a=Ue(o,i);return a?a.textAlign:null},o=>he(o)||Ue(o,i)!==null,o=>o?null:t.currentItemTextAlign),onChange:o=>n(o)})]})}}),Kz=oe({name:"changeVerticalAlign",label:"Change vertical alignment",trackEvent:{category:"element"},perform:(e,t,n,r)=>({elements:Pr(e,t,i=>{if(he(i)){let o=Le(i,{verticalAlign:n});return bo(o,r.scene.getContainerElement(i),r.scene.getNonDeletedElementsMap()),o}return i},!0),appState:{...t},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,be.jsx)("fieldset",{children:(0,be.jsx)(Jo,{group:"text-align",options:[{value:Nr.TOP,text:x("labels.alignTop"),icon:(0,be.jsx)(tM,{theme:t.theme}),testId:"align-top"},{value:Nr.MIDDLE,text:x("labels.centerVertically"),icon:(0,be.jsx)(rM,{theme:t.theme}),testId:"align-middle"},{value:Nr.BOTTOM,text:x("labels.alignBottom"),icon:(0,be.jsx)(nM,{theme:t.theme}),testId:"align-bottom"}],value:gr(e,t,i=>{if(he(i)&&i.containerId)return i.verticalAlign;let o=Ue(i,r.scene.getNonDeletedElementsMap());return o?o.verticalAlign:null},i=>he(i)||Ue(i,r.scene.getNonDeletedElementsMap())!==null,i=>i?null:Nr.MIDDLE),onChange:i=>n(i)})})}),xee=oe({name:"changeRoundness",label:"Change edge roundness",trackEvent:!1,perform:(e,t,n)=>({elements:Pr(e,t,r=>Le(r,{roundness:n==="round"?{type:Lc(r.type)?Pn.ADAPTIVE_RADIUS:Pn.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=Mb(at(e),t).some(i=>i.roundness?.type===Pn.LEGACY);return(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.edges")}),(0,be.jsx)(Jo,{group:"edges",options:[{value:"sharp",text:x("labels.sharp"),icon:NC},{value:"round",text:x("labels.round"),icon:$C}],value:gr(e,t,i=>r?null:i.roundness?"round":"sharp",i=>i.hasOwnProperty("roundness"),i=>i?null:t.currentItemRoundness),onChange:i=>n(i)})]})}}),E6=e=>[{value:null,text:x("labels.arrowhead_none"),keyBinding:"q",icon:FC},{value:"arrow",text:x("labels.arrowhead_arrow"),keyBinding:"w",icon:(0,be.jsx)(BC,{flip:e})},{value:"bar",text:x("labels.arrowhead_bar"),keyBinding:"e",icon:(0,be.jsx)(HC,{flip:e})},{value:"dot",text:x("labels.arrowhead_circle"),keyBinding:null,icon:(0,be.jsx)(zE,{flip:e}),showInPicker:!1},{value:"circle",text:x("labels.arrowhead_circle"),keyBinding:"r",icon:(0,be.jsx)(zE,{flip:e}),showInPicker:!1},{value:"circle_outline",text:x("labels.arrowhead_circle_outline"),keyBinding:null,icon:(0,be.jsx)(zC,{flip:e}),showInPicker:!1},{value:"triangle",text:x("labels.arrowhead_triangle"),icon:(0,be.jsx)(GC,{flip:e}),keyBinding:"t"},{value:"triangle_outline",text:x("labels.arrowhead_triangle_outline"),icon:(0,be.jsx)(WC,{flip:e}),keyBinding:null,showInPicker:!1},{value:"diamond",text:x("labels.arrowhead_diamond"),icon:(0,be.jsx)(jC,{flip:e}),keyBinding:null,showInPicker:!1},{value:"diamond_outline",text:x("labels.arrowhead_diamond_outline"),icon:(0,be.jsx)(UC,{flip:e}),keyBinding:null,showInPicker:!1}],wee=oe({name:"changeArrowhead",label:"Change arrowheads",trackEvent:!1,perform:(e,t,n)=>({elements:Pr(e,t,r=>{if(Ne(r)){let{position:i,type:o}=n;if(i==="start")return Le(r,{startArrowhead:o});if(i==="end")return Le(r,{endArrowhead:o})}return r}),appState:{...t,[n.position==="start"?"currentItemStartArrowhead":"currentItemEndArrowhead"]:n.type},commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=sh().rtl;return(0,be.jsxs)("fieldset",{children:[(0,be.jsx)("legend",{children:x("labels.arrowheads")}),(0,be.jsxs)("div",{className:"iconSelectList buttonList",children:[(0,be.jsx)(ZR,{label:"arrowhead_start",options:E6(!r),value:gr(e,t,i=>Ne(i)&&Gp(i.type)?i.startArrowhead:t.currentItemStartArrowhead,!0,t.currentItemStartArrowhead),onChange:i=>n({position:"start",type:i})}),(0,be.jsx)(ZR,{label:"arrowhead_end",group:"arrowheads",options:E6(!!r),value:gr(e,t,i=>Ne(i)&&Gp(i.type)?i.endArrowhead:t.currentItemEndArrowhead,!0,t.currentItemEndArrowhead),onChange:i=>n({position:"end",type:i})})]})]})}})}),See=I(()=>{}),vu,L4,KR,xl,Qc=I(()=>{"use strict";D(),See(),vu=()=>{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},L4=(e,t,n="bottom")=>{let r=e.getBoundingClientRect(),i=window.innerWidth,o=window.innerHeight,a=5,s=t.left+t.width/2-r.width/2;s<0?s=a:s+r.width>=i&&(s=i-r.width-a);let l;n==="bottom"?(l=t.top+t.height+a,l+r.height>=o&&(l=t.top-r.height-a)):(l=t.top-r.height-a,l<0&&(l=t.top+t.height+a)),Object.assign(e.style,{top:`${l}px`,left:`${s}px`})},KR=(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;let i=e.getBoundingClientRect();L4(t,i)},xl=({children:e,label:t,long:n=!1,style:r,disabled:i})=>((0,Qz.useEffect)(()=>()=>vu().classList.remove("excalidraw-tooltip--visible"),[]),i?null:(0,Jz.jsx)("div",{className:"excalidraw-tooltip-wrapper",onPointerEnter:o=>KR(o.currentTarget,vu(),t,n),onPointerLeave:()=>vu().classList.remove("excalidraw-tooltip--visible"),style:r,children:e}))}),eH,Rc,VE,YE,tH,qR,QR,pp,Tee,Cee,nH,eh,Mee,rH,Yb=I(()=>{"use strict";D(),FM(),me(),On(),ae(),Pe(),ce(),Ce(),pt(),HB(),VT(),ne(),xt(),Qc(),wt(),$i(),Bi(),Of(),eH=oe({name:"changeViewBackgroundColor",label:"labels.canvasBackground",paletteName:"Change canvas background color",trackEvent:!1,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,n)=>({appState:{...t,...n},commitToHistory:!!n.viewBackgroundColor}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r})=>(0,Mc.jsx)(UE,{palette:null,topPicks:NT,label:x("labels.canvasBackground"),type:"canvasBackground",color:t.viewBackgroundColor,onChange:i=>n({viewBackgroundColor:i}),"data-testid":"canvas-background-picker",elements:e,appState:t,updateData:n})}),Rc=oe({name:"clearCanvas",label:"labels.clearCanvas",paletteName:"Clear canvas",icon:bl,trackEvent:{category:"canvas"},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled,perform:(e,t,n,r)=>(r.imageCache.clear(),{elements:e.map(i=>Le(i,{isDeleted:!0})),appState:{...ml(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,showStats:t.showStats,pasteDialog:t.pasteDialog,activeTool:t.activeTool.type==="image"?{...t.activeTool,type:"selection"}:t.activeTool},commitToHistory:!0})}),VE=oe({name:"zoomIn",label:"buttons.zoomIn",viewMode:!0,icon:wE,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>({appState:{...t,...ol({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:il(t.zoom.value+pu)},t),userToFollow:null},commitToHistory:!1}),PanelComponent:({updateData:e})=>(0,Mc.jsx)(Xe,{type:"button",className:"zoom-in-button zoom-button",icon:wE,title:`${x("buttons.zoomIn")} \u2014 ${V("CtrlOrCmd++")}`,"aria-label":x("buttons.zoomIn"),onClick:()=>{e(null)}}),keyTest:e=>(e.code===tt.EQUAL||e.code===tt.NUM_ADD)&&(e[O.CTRL_OR_CMD]||e.shiftKey)}),YE=oe({name:"zoomOut",label:"buttons.zoomOut",icon:SE,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>({appState:{...t,...ol({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:il(t.zoom.value-pu)},t),userToFollow:null},commitToHistory:!1}),PanelComponent:({updateData:e})=>(0,Mc.jsx)(Xe,{type:"button",className:"zoom-out-button zoom-button",icon:SE,title:`${x("buttons.zoomOut")} \u2014 ${V("CtrlOrCmd+-")}`,"aria-label":x("buttons.zoomOut"),onClick:()=>{e(null)}}),keyTest:e=>(e.code===tt.MINUS||e.code===tt.NUM_SUBTRACT)&&(e[O.CTRL_OR_CMD]||e.shiftKey)}),tH=oe({name:"resetZoom",label:"buttons.resetZoom",icon:dC,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>({appState:{...t,...ol({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:il(1)},t),userToFollow:null},commitToHistory:!1}),PanelComponent:({updateData:e,appState:t})=>(0,Mc.jsx)(xl,{label:x("buttons.resetZoom"),style:{height:"100%"},children:(0,Mc.jsxs)(Xe,{type:"button",className:"reset-zoom-button zoom-button",title:x("buttons.resetZoom"),"aria-label":x("buttons.resetZoom"),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),"%"]})}),keyTest:e=>(e.code===tt.ZERO||e.code===tt.NUM_ZERO)&&(e[O.CTRL_OR_CMD]||e.shiftKey)}),qR=(e,t)=>{let[n,r,i,o]=e,a=i-n,s=t.width/a,l=o-r,c=t.height/l,d=Math.min(s,c),u=Math.floor(d/pu)*pu;return Math.min(Math.max(u,YS),1)},QR=({bounds:e,appState:t,fitToViewport:n=!1,viewportZoomFactor:r=.7})=>{let[i,o,a,s]=e,l=(i+a)/2,c=(o+s)/2,d,u,h;if(n){let m=a-i,p=s-o;d=Math.min(t.width/m,t.height/p)*Math.min(1,Math.max(r,.1)),d=Math.min(Math.max(d,.1),30);let f=t.width;if(t.openSidebar){let g=document.querySelector(".sidebar")?.offsetWidth??0;f=document.documentElement.getAttribute("dir")==="rtl"?t.width+g:t.width-g}u=f/2*(1/d)-l,h=t.height/2*(1/d)-c}else{d=qR(e,{width:t.width,height:t.height});let m=I4({scenePoint:{x:l,y:c},viewportDimensions:{width:t.width,height:t.height},zoom:{value:d}});u=m.scrollX,h=m.scrollY}return{appState:{...t,scrollX:u,scrollY:h,zoom:{value:d}},commitToHistory:!1}},pp=({targetElements:e,appState:t,fitToViewport:n,viewportZoomFactor:r})=>{let i=Nt(at(e));return QR({bounds:i,appState:t,fitToViewport:n,viewportZoomFactor:r})},Tee=oe({name:"zoomToFitSelectionInViewport",label:"labels.zoomToFitViewport",icon:Rp,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return pp({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!1})},keyTest:e=>e.code===tt.TWO&&e.shiftKey&&!e.altKey&&!e[O.CTRL_OR_CMD]}),Cee=oe({name:"zoomToFitSelection",label:"helpDialog.zoomToSelection",icon:Rp,trackEvent:{category:"canvas"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return pp({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!0})},keyTest:e=>e.code===tt.THREE&&e.shiftKey&&!e.altKey&&!e[O.CTRL_OR_CMD]}),nH=oe({name:"zoomToFit",label:"helpDialog.zoomToFit",icon:Rp,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t)=>pp({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1}),keyTest:e=>e.code===tt.ONE&&e.shiftKey&&!e.altKey&&!e[O.CTRL_OR_CMD]}),eh=oe({name:"toggleTheme",label:(e,t)=>t.theme===$e.DARK?"buttons.lightMode":"buttons.darkMode",keywords:["toggle","dark","light","mode","theme"],icon:e=>e.theme===$e.LIGHT?rf:of,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n)=>({appState:{...t,theme:n||(t.theme===$e.LIGHT?$e.DARK:$e.LIGHT)},commitToHistory:!1}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===tt.D,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.toggleTheme}),Mee=oe({name:"toggleEraserTool",label:"toolBar.eraser",trackEvent:{category:"toolbar"},perform:(e,t)=>{let n;return uo(t)?n=nn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):n=nn(t,{type:"eraser",lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:n},commitToHistory:!0}},keyTest:e=>e.key===O.E}),rH=oe({name:"toggleHandTool",label:"toolBar.hand",paletteName:"Toggle hand tool",trackEvent:{category:"toolbar"},icon:Db,viewMode:!1,perform:(e,t,n,r)=>{let i;return Hc(t)?i=nn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):(i=nn(t,{type:"hand",lastActiveToolBeforeEraser:t.activeTool}),mt(r.interactiveCanvas,ut.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},commitToHistory:!0}},keyTest:e=>!e.altKey&&!e[O.CTRL_OR_CMD]&&e.key===O.H})}),Ci,Iee=I(()=>{"use strict";D(),Ce(),Pe(),ne(),On(),me(),ce(),xt(),wt(),ur(),Tr(),Sl(),la(),xe(),Of(),Ci=oe({name:"finalize",label:"",trackEvent:!1,perform:(e,t,n,{interactiveCanvas:r,focusContainer:i,scene:o})=>{let a=o.getNonDeletedElementsMap();if(t.editingLinearElement){let{elementId:u,startBindingElement:h,endBindingElement:m}=t.editingLinearElement,p=pe.getElement(u,a);if(p)return Xn(p)&&Sc(p,h,m,a),{elements:p.points.length<2||jc(p)?e.filter(f=>f.id!==p.id):void 0,appState:{...t,cursorButton:"up",editingLinearElement:null},commitToHistory:!0}}let s=e,l=t.pendingImageElementId&&o.getElement(t.pendingImageElementId);l&&re(l,{isDeleted:!0},!1),window.document.activeElement instanceof HTMLElement&&i();let c=t.multiElement?t.multiElement:t.editingElement?.type==="freedraw"?t.editingElement:null;if(c){if(c.type!=="freedraw"&&t.lastPointerDownWith!=="touch"){let{points:h,lastCommittedPoint:m}=c;(!m||h[h.length-1]!==m)&&re(c,{points:c.points.slice(0,-1)})}jc(c)&&(s=s.filter(h=>h.id!==c.id));let u=ss(c.points,t.zoom.value);if((c.type==="line"||c.type==="freedraw")&&u){let h=c.points,m=h[0];re(c,{points:h.map((p,f)=>f===h.length-1?[m[0],m[1]]:p)})}if(Xn(c)&&!u&&c.points.length>1){let[h,m]=pe.getPointAtIndexGlobalCoordinates(c,-1,Fe(e));oE(c,t,Hn.getScene(c),{x:h,y:m},a)}}(!t.activeTool.locked&&t.activeTool.type!=="freedraw"||!c)&&Ii(r);let d;return t.activeTool.type==="eraser"?d=nn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):d=nn(t,{type:"selection"}),{elements:s,appState:{...t,cursorButton:"up",activeTool:(t.activeTool.locked||t.activeTool.type==="freedraw")&&c?t.activeTool:d,activeEmbeddable:null,draggingElement:null,multiElement:null,editingElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:c&&!t.activeTool.locked&&t.activeTool.type!=="freedraw"?{...t.selectedElementIds,[c.id]:!0}:t.selectedElementIds,selectedLinearElement:c&&Ne(c)?new pe(c):t.selectedLinearElement,pendingImageElementId:null},commitToHistory:t.activeTool.type==="freedraw"}},keyTest:(e,t)=>e.key===O.ESCAPE&&(t.editingLinearElement!==null||!t.draggingElement&&t.multiElement===null)||(e.key===O.ESCAPE||e.key===O.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>(0,iH.jsx)(Xe,{type:"button",icon:vC,title:x("buttons.done"),"aria-label":x("buttons.done"),onClick:t,visible:e.multiElement!=null,size:n?.size||"medium"})})}),kee=I(()=>{}),Aee=I(()=>{}),aH,_ee=I(()=>{"use strict";D(),kee(),ne(),Aee(),Re(),Ce(),aH=e=>{let{id:t}=ua(),[n,r]=(0,oH.useState)(e.value),i=a=>{e.ignoreFocus||N$(a.target);let s=a.target.value;s!==e.value&&e.onChange(s)},o=a=>{if(a.key===O.ENTER){if(a.preventDefault(),a.nativeEvent.isComposing||a.keyCode===229)return;a.currentTarget.blur()}};return(0,cf.jsxs)("div",{className:"ProjectName",children:[(0,cf.jsx)("label",{className:"ProjectName-label",htmlFor:"filename",children:`${e.label}:`}),(0,cf.jsx)("input",{type:"text",className:"TextInput",onBlur:i,onKeyDown:o,id:`${t}-filename`,value:n,onChange:a=>r(a.target.value)})]})}}),sH,b6,Pee=I(()=>{"use strict";D(),Cl(),ce(),On(),ae(),sH=e=>{let t=e.title||(e.value===$e.DARK?x("buttons.lightMode"):x("buttons.darkMode"));return(0,hu.jsx)(Xe,{type:"icon",icon:e.value===$e.LIGHT?b6.MOON:b6.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===$e.DARK?$e.LIGHT:$e.DARK),"data-testid":"toggle-dark-mode"})},b6={SUN:(0,hu.jsx)("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:(0,hu.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,hu.jsx)("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:(0,hu.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"})})}}),df,uf,Uc=I(()=>{"use strict";D(),Xc(),ae(),Pe(),xe(),ce(),pt(),$f(),ne(),si(),Tl(),El(),Sr(),si(),El(),df=(e,{selectedElementIds:t},n)=>{e=at(e);let r=n&&mn(e,{selectedElementIds:t}),i=null,o=r?st(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return r&&(o.length===1&&ke(o[0])?(i=o[0],o=Tb(e,i)):o.length>1&&(o=st(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:i,exportedElements:zc(o)}},uf=async({type:e,data:t,config:n})=>{let r=Object.assign({},n);if(r.padding=r.padding??lh,r.fileHandle=r.fileHandle??null,r.exportingFrame=r.exportingFrame??null,r.name=r.name||XS,t.elements.length===0)throw new Error(x("alerts.cannotExportEmptyCanvas"));if(e==="svg"||e==="clipboard-svg"){let o=wb({data:{elements:t.elements,appState:{exportBackground:r.exportBackground,exportWithDarkMode:t.appState.exportWithDarkMode,viewBackgroundColor:t.appState.viewBackgroundColor,exportPadding:r.padding,exportScale:t.appState.exportScale,exportEmbedScene:t.appState.exportEmbedScene&&e==="svg"},files:t.files},config:{exportingFrame:r.exportingFrame}});if(e==="svg")return Xp(o.then(a=>new Blob([a.outerHTML],{type:ve.svg})),{description:"Export to SVG",name:r.name,extension:t.appState.exportEmbedScene?"excalidraw.svg":"svg",fileHandle:r.fileHandle});if(e==="clipboard-svg"){let a=await o.then(s=>s.outerHTML);try{await Zu(a)}catch{throw new Error(x("errors.copyToSystemClipboardFailed"))}return}}let i=Jp({data:t,config:{canvasBackgroundColor:r.exportBackground?r.viewBackgroundColor:!1,padding:r.padding,theme:t.appState.exportWithDarkMode?"dark":"light",scale:t.appState.exportScale,fit:"none",exportingFrame:r.exportingFrame}});if(e==="png"){let o=Yu(i);return t.appState.exportEmbedScene&&o.then(a=>Promise.resolve().then(()=>(qp(),Kp)).then(({encodePngMetadata:s})=>s({blob:a,metadata:Qp(t.elements,t.appState,t.files,"local")}))),Xp(o,{description:"Export to PNG",name:r.name,extension:"png",fileHandle:r.fileHandle})}else if(e==="clipboard")try{let o=Yu(i);await BT(o)}catch(o){throw console.warn(o),o.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(x("canvasError.canvasTooBig")):Bu&&o.name==="TypeError"?new Error(`${x("alerts.couldNotCopyToClipboard")}
174
-
175
- ${x("hints.firefox_clipboard_write")}`):new Error(x("alerts.couldNotCopyToClipboard"))}else throw new Error("Unsupported export type")}}),lH,Dee=I(()=>{"use strict";D(),Uc(),Uc(),si(),lH=async(e,t,n,r)=>{let{exportBackground:i,viewBackgroundColor:o,fileHandle:a}=t,s=r4(a);if(!a||!ZF(s))throw new Error("fileHandle should exist and should be of type svg or png when resaving");t={...t,exportEmbedScene:!0};let{exportedElements:l,exportingFrame:c}=df(e,t,!1);return await uf({type:s,data:{elements:l,appState:t,files:n},config:{exportBackground:i,viewBackgroundColor:o,name:r,fileHandle:a,exportingFrame:c}}),{fileHandle:a}}}),Lee=I(()=>{}),mf,zM=I(()=>{"use strict";D(),me(),Lee(),mf=({children:e,checked:t,onChange:n,className:r})=>(0,hf.jsxs)("div",{className:Y("Checkbox",r,{"is-checked":t}),onClick:i=>{n(!t,i),i.currentTarget.querySelector(".Checkbox-box").focus()},children:[(0,hf.jsx)("button",{className:"Checkbox-box",role:"checkbox","aria-checked":t,children:fC}),(0,hf.jsx)("div",{className:"Checkbox-label",children:e})]})}),HM,cH,GM,WM,ZE,Zb,pf,dH,Xb=I(()=>{"use strict";D(),me(),_ee(),On(),Qc(),Pee(),Uc(),Dee(),ce(),Re(),Ce(),xt(),zM(),$f(),ae(),pt(),Pe(),si(),Tl(),Cl(),HM=oe({name:"changeProjectName",label:"labels.fileTitle",trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t,appProps:n,data:r,app:i})=>(0,Rr.jsx)(aH,{label:x("labels.fileTitle"),value:i.getName(),onChange:o=>t(o),ignoreFocus:r?.ignoreFocus??!1})}),cH=oe({name:"changeExportScale",label:"imageExportDialog.scale",trackEvent:{category:"export",action:"scale"},perform:(e,t,n)=>({appState:{...t,exportScale:n},commitToHistory:!1}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=at(e),i=mn(r,t)?st(r,t):r,o=(a,s,l)=>{let[,,c,d]=P2(a).map(u=>Math.trunc(u*l));return[c+s*2,d+s*2]};return(0,Rr.jsx)(Rr.Fragment,{children:cb.map(a=>{let[s,l]=o(i,lh,a),c=`${x("imageExportDialog.label.scale")} ${a}x (${s}x${l})`;return(0,Rr.jsx)(Xe,{size:"small",type:"radio",icon:`${a}x`,name:"export-canvas-scale",title:c,"aria-label":c,id:"export-canvas-scale",checked:a===t.exportScale,onChange:()=>n(a)},a)})})}}),GM=oe({name:"changeExportBackground",label:"imageExportDialog.label.withBackground",trackEvent:{category:"export",action:"toggleBackground"},perform:(e,t,n)=>({appState:{...t,exportBackground:n},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,Rr.jsx)(mf,{checked:e.exportBackground,onChange:n=>t(n),children:x("imageExportDialog.label.withBackground")})}),WM=oe({name:"changeExportEmbedScene",label:"imageExportDialog.tooltip.embedScene",trackEvent:{category:"export",action:"embedScene"},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,Rr.jsxs)(mf,{checked:e.exportEmbedScene,onChange:n=>t(n),children:[x("imageExportDialog.label.embedScene"),(0,Rr.jsx)(xl,{label:x("imageExportDialog.tooltip.embedScene"),long:!0,children:(0,Rr.jsx)("div",{className:"excalidraw-tooltip-icon",children:xC})})]})}),ZE=oe({name:"saveToActiveFile",label:"buttons.save",icon:Ju,trackEvent:{category:"export"},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{let i=!!t.fileHandle;try{let{fileHandle:o}=xb(t.fileHandle)?await lH(e,t,r.files,r.getName()):await s4(e,t,r.files,r.getName());return{commitToHistory:!1,appState:{...t,fileHandle:o,toast:i?{message:o?.name?x("toast.fileSavedToFilename").replace("{filename}",`"${o.name}"`):x("toast.fileSaved")}:null}}}catch(o){return o?.name!=="AbortError"?console.error(o):console.warn(o),{commitToHistory:!1}}},keyTest:e=>e.key===O.S&&e[O.CTRL_OR_CMD]&&!e.shiftKey}),Zb=oe({name:"saveFileToDisk",label:"exportDialog.disk_title",icon:Ju,viewMode:!0,trackEvent:{category:"export"},perform:async(e,t,n,r)=>{try{let{fileHandle:i}=await s4(e,{...t,fileHandle:null},r.files,r.getName());return{commitToHistory:!1,appState:{...t,openDialog:null,fileHandle:i,toast:{message:x("toast.fileSaved")}}}}catch(i){return i?.name!=="AbortError"?console.error(i):console.warn(i),{commitToHistory:!1}}},keyTest:e=>e.key===O.S&&e.shiftKey&&e[O.CTRL_OR_CMD],PanelComponent:({updateData:e})=>(0,Rr.jsx)(Xe,{type:"button",icon:EC,title:x("buttons.saveAs"),"aria-label":x("buttons.saveAs"),showAriaLabel:Wn().editor.isMobile,hidden:!no,onClick:()=>e(null),"data-testid":"save-as-button"})}),pf=oe({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:i,appState:o,files:a}=await eB(t,e);return{elements:i,appState:o,files:a,commitToHistory:!0}}catch(i){return i?.name==="AbortError"?(console.warn(i),!1):{elements:e,appState:{...t,errorMessage:i.message},files:r.files,commitToHistory:!1}}},keyTest:e=>e[O.CTRL_OR_CMD]&&e.key===O.O}),dH=oe({name:"exportWithDarkMode",label:"imageExportDialog.label.darkMode",trackEvent:{category:"export",action:"toggleTheme"},perform:(e,t,n)=>({appState:{...t,exportWithDarkMode:n},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,Rr.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"-45px",marginBottom:"10px"},children:(0,Rr.jsx)(sH,{value:e.exportWithDarkMode?$e.DARK:$e.LIGHT,onChange:n=>{t(n===$e.DARK)},title:x("imageExportDialog.label.darkMode")})})})}),y6,jM,UM,Ree=I(()=>{"use strict";D(),Pe(),Ce(),ce(),xt(),wt(),ae(),Kt(),xe(),pt(),me(),y6="{}",jM=oe({name:"copyStyles",label:"labels.copyStyles",icon:WE,trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=[],o=e.find(a=>t.selectedElementIds[a.id]);if(i.push(o),o&&as(o)){let a=Ue(o,r.scene.getNonDeletedElementsMap());i.push(a)}return o&&(y6=JSON.stringify(i)),{appState:{...t,toast:{message:x("toast.copyStyles")}},commitToHistory:!1}},keyTest:e=>e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.C}),UM=oe({name:"pasteStyles",label:"labels.pasteStyles",icon:WE,trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=JSON.parse(y6),o=i[0],a=i[1];if(!nT(o))return{elements:e,commitToHistory:!1};let s=st(e,t,{includeBoundTextElement:!0}),l=s.map(c=>c.id);return{elements:e.map(c=>{if(l.includes(c.id)){let d=o;if(he(c)&&c.containerId&&(d=a),!d)return c;let u=Le(c,{backgroundColor:d?.backgroundColor,strokeWidth:d?.strokeWidth,strokeColor:d?.strokeColor,strokeStyle:d?.strokeStyle,fillStyle:d?.fillStyle,opacity:d?.opacity,roughness:d?.roughness,roundness:d.roundness?j$(d.roundness.type,c)?d.roundness:U$(c):null});if(he(u)){let h=d.fontSize||Ni,m=d.fontFamily||aa;u=Le(u,{fontSize:h,fontFamily:m,textAlign:d.textAlign||Df,lineHeight:d.lineHeight||gl(m)});let p=null;u.containerId&&(p=s.find(f=>he(u)&&f.id===u.containerId)||null),bo(u,p,r.scene.getNonDeletedElementsMap())}return u.type==="arrow"&&yt(d)&&(u=Le(u,{startArrowhead:d.startArrowhead,endArrowhead:d.endArrowhead})),ke(c)&&(u=Le(u,{roundness:null,backgroundColor:"transparent"})),u}return c}),commitToHistory:!0}},keyTest:e=>e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.V})}),uH,hH,Vf,Oee=I(()=>{"use strict";D(),me(),On(),ce(),Pe(),xt(),Ce(),uH=oe({name:"toggleCanvasMenu",label:"buttons.menu",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="canvas"?null:"canvas"},commitToHistory:!1}),PanelComponent:({appState:e,updateData:t})=>(0,R4.jsx)(Xe,{type:"button",icon:kb,"aria-label":x("buttons.menu"),onClick:t,selected:e.openMenu==="canvas"})}),hH=oe({name:"toggleEditMenu",label:"buttons.edit",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="shape"?null:"shape"},commitToHistory:!1}),PanelComponent:({elements:e,appState:t,updateData:n})=>(0,R4.jsx)(Xe,{visible:Cb(t,at(e)),type:"button",icon:bC,"aria-label":x("buttons.edit"),onClick:n,selected:t.openMenu==="shape"})}),Vf=oe({name:"toggleShortcuts",label:"welcomeScreen.defaults.helpHint",icon:hC,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"}},commitToHistory:!1}),keyTest:e=>e.key===O.QUESTION_MARK})}),JR,v6,VM,YM,Nee=I(()=>{"use strict";D(),Ce(),ce(),ne(),xt(),me(),wt(),pt(),Fi(),Pe(),sa(),On(),xe(),Sr(),JR=e=>{if(e.length>=2){let t=e[0].groupIds;for(let n of t)if(e.reduce((r,i)=>r&&Uu(i,n),!0))return!0}return!1},v6=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return r.length>=2&&!JR(r)},VM=oe({name:"group",label:"labels.group",icon:e=>(0,gc.jsx)($E,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});if(i.length<2)return{appState:t,elements:e,commitToHistory:!1};let o=Tc(t);if(o.length===1){let m=o[0],p=new Set(hn(e,m).map(g=>g.id)),f=new Set(i.map(g=>g.id));if(new Set([...Array.from(p),...Array.from(f)]).size===p.size)return{appState:t,elements:e,commitToHistory:!1}}let a=[...e];new Set(i.map(m=>m.frameId)).size>1&&wB(i).forEach((m,p)=>{Dp(m,r.scene.getNonDeletedElementsMap())});let s=ni(),l=Fe(i);a=a.map(m=>l.get(m.id)?Le(m,{groupIds:LF(m.groupIds,s,t.editingGroupId)}):m);let c=hn(a,s),d=c[c.length-1],u=a.lastIndexOf(d),h=a.slice(u+1);return a=[...a.slice(0,u).filter(m=>!Uu(m,s)),...c,...h],{appState:{...t,...Y5(s,{...t,selectedGroupIds:{}},at(a))},elements:a,commitToHistory:!0}},predicate:(e,t,n,r)=>v6(e,t,r),keyTest:e=>!e.shiftKey&&e[O.CTRL_OR_CMD]&&e.key===O.G,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,gc.jsx)(Xe,{hidden:!v6(e,t,r),type:"button",icon:(0,gc.jsx)($E,{theme:t.theme}),onClick:()=>n(null),title:`${x("labels.group")} \u2014 ${V("CtrlOrCmd+G")}`,"aria-label":x("labels.group"),visible:mn(at(e),t)})}),YM=oe({name:"ungroup",label:"labels.ungroup",icon:e=>(0,gc.jsx)(FE,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=Tc(t),o=Fe(e);if(i.length===0)return{appState:t,elements:e,commitToHistory:!1};let a=[...e],s=[];a=a.map(u=>{pn(u)&&s.push(u.id);let h=RF(u.groupIds,t.selectedGroupIds);return h.length===u.groupIds.length?u:Le(u,{groupIds:h})});let l=Lr(t,at(a),t,null),c=r.scene.getSelectedElements(t),d=new Set(c.filter(u=>u.frameId).map(u=>u.frameId));return gE(e).filter(u=>d.has(u.id)).forEach(u=>{u&&(a=GT(a,_p(a,u,t,o),u,r))}),l.selectedElementIds=Object.entries(l.selectedElementIds).reduce((u,[h,m])=>(m&&!s.includes(h)&&(u[h]=!0),u),{}),{appState:{...t,...l},elements:a,commitToHistory:!0}},keyTest:e=>e.shiftKey&&e[O.CTRL_OR_CMD]&&e.key===O.G.toUpperCase(),predicate:(e,t)=>Tc(t).length>0,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,gc.jsx)(Xe,{type:"button",hidden:Tc(t).length===0,icon:(0,gc.jsx)(FE,{theme:t.theme}),onClick:()=>n(null),title:`${x("labels.ungroup")} \u2014 ${V("CtrlOrCmd+Shift+G")}`,"aria-label":x("labels.ungroup"),visible:mn(at(e),t)})})}),ZM,mH=I(()=>{"use strict";D(),ZM=(e,t,n,r,i,o,a)=>{e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),e.fill(),a&&(e.strokeStyle=a),e.stroke()}}),$ee=I(()=>{"use strict";D()});function Fee(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 ff,pH,fH,Kb=I(()=>{"use strict";D(),ae(),mH(),$ee(),ff=(e,t)=>`hsl(${Math.abs(Fee(t?.id||e))%37*10}, 100%, 83%)`,pH=e=>{let t=e?.trim()?.codePointAt(0);return(t?String.fromCodePoint(t):"?").toUpperCase()},fH=({context:e,renderConfig:t,appState:n,normalizedWidth:r,normalizedHeight:i})=>{for(let[o,a]of t.remotePointerViewportCoords){let{x:s,y:l}=a,c=n.collaborators.get(o);s-=n.offsetLeft,l-=n.offsetTop;let d=11,u=14,h=s<0||s>r-d||l<0||l>i-u;s=Math.max(s,0),s=Math.min(s,r-d),l=Math.max(l,0),l=Math.min(l,i-u);let m=ff(o,c);e.save(),e.strokeStyle=m,e.fillStyle=m;let p=t.remotePointerUserStates.get(o),f=h||p==="idle"||p==="away";f&&(e.globalAlpha=.3),t.remotePointerButton.get(o)==="down"&&(e.beginPath(),e.arc(s,l,15,0,2*Math.PI,!1),e.lineWidth=3,e.strokeStyle="#ffffff88",e.stroke(),e.closePath(),e.beginPath(),e.arc(s,l,15,0,2*Math.PI,!1),e.lineWidth=1,e.strokeStyle=m,e.stroke(),e.closePath());let g=n.theme===$e.DARK?"#2f6330":u$,b=c?.isSpeaking;b&&(e.fillStyle=g,e.strokeStyle=g,e.lineWidth=10,e.lineJoin="round",e.beginPath(),e.moveTo(s,l),e.lineTo(s+0,l+14),e.lineTo(s+4,l+9),e.lineTo(s+11,l+8),e.closePath(),e.stroke(),e.fill()),e.fillStyle=Li,e.strokeStyle=Li,e.lineWidth=6,e.lineJoin="round",e.beginPath(),e.moveTo(s,l),e.lineTo(s+0,l+14),e.lineTo(s+4,l+9),e.lineTo(s+11,l+8),e.closePath(),e.stroke(),e.fill(),e.fillStyle=m,e.strokeStyle=m,e.lineWidth=2,e.lineJoin="round",e.beginPath(),f?(e.moveTo(s-1,l-1),e.lineTo(s-1,l+15),e.lineTo(s+5,l+10),e.lineTo(s+12,l+9),e.closePath(),e.fill()):(e.moveTo(s,l),e.lineTo(s+0,l+14),e.lineTo(s+4,l+9),e.lineTo(s+11,l+8),e.closePath(),e.fill(),e.stroke());let v=t.remotePointerUsernames.get(o)||"";if(!h&&v){e.font="600 12px sans-serif";let y=(b?s+0:s)+d/2,w=(b?l+0:l)+u+2,T=5,k=3,M=e.measureText(v),C=M.actualBoundingBoxDescent+M.actualBoundingBoxAscent,P=Math.max(C,12),R=y-1,A=w-1,_=M.width+2+T*2+2,$=P+2+k*2+2;if(e.roundRect?(e.beginPath(),e.roundRect(R,A,_,$,8),e.fillStyle=m,e.fill(),e.strokeStyle=Li,e.stroke(),b&&(e.beginPath(),e.roundRect(R-2,A-2,_+4,$+4,8),e.strokeStyle=g,e.stroke())):ZM(e,R,A,_,$,8,Li),e.fillStyle=zu,e.fillText(v,y+T+1,w+k+M.actualBoundingBoxAscent+Math.floor((P-C)/2)+2),b){e.fillStyle=g;let W=8,H=8,K=5;e.fillRect(R+_+H,A+($/2-W/2),2,W),e.fillRect(R+_+H+K,A+($/2-W*2/2),2,W*2),e.fillRect(R+_+H+K*2,A+($/2-W/2),2,W)}}e.restore(),e.closePath()}}}),Bee=I(()=>{}),N4,zee=I(()=>{"use strict";D(),Bee(),Kb(),N4=({color:e,onClick:t,name:n,src:r,className:i})=>{let o=pH(n),[a,s]=(0,gH.useState)(!1),l=!a&&r,c=l?void 0:{background:e};return(0,O4.jsx)("div",{className:Y("Avatar",i),style:c,onClick:t,children:l?(0,O4.jsx)("img",{className:"Avatar-img",src:r,alt:o,referrerPolicy:"no-referrer",onError:()=>s(!0)}):o})}}),EH,Hee=I(()=>{"use strict";D(),Kb(),zee(),me(),ce(),xt(),EH=oe({name:"goToCollaborator",label:"Go to a collaborator",viewMode:!0,trackEvent:{category:"collab"},perform:(e,t,n)=>!n.socketId||t.userToFollow?.socketId===n.socketId||n.isCurrentUser?{appState:{...t,userToFollow:null},commitToHistory:!1}:{appState:{...t,userToFollow:{socketId:n.socketId,username:n.username||""},openMenu:t.openMenu==="canvas"?null:t.openMenu},commitToHistory:!1},PanelComponent:({updateData:e,data:t,appState:n})=>{let{socketId:r,collaborator:i,withName:o,isBeingFollowed:a}=t,s=ff(r,i),l=Y({"is-followed":a,"is-current-user":i.isCurrentUser===!0,"is-speaking":i.isSpeaking,"is-in-call":i.isInCall,"is-muted":i.isMuted}),c=i.isInCall?i.isSpeaking?(0,or.jsxs)("div",{className:"UserList__collaborator-status-icon-speaking-indicator",title:x("userList.hint.isSpeaking"),children:[(0,or.jsx)("div",{}),(0,or.jsx)("div",{}),(0,or.jsx)("div",{})]}):i.isMuted?(0,or.jsx)("div",{className:"UserList__collaborator-status-icon-microphone-muted",title:x("userList.hint.micMuted"),children:gM}):(0,or.jsx)("div",{title:x("userList.hint.inCall"),children:fM}):null;return o?(0,or.jsxs)("div",{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${l}`,style:{"--avatar-size":"1.5rem"},onClick:()=>e(i),children:[(0,or.jsx)(N4,{color:s,onClick:()=>{},name:i.username||"",src:i.avatarUrl,className:l}),(0,or.jsx)("div",{className:"UserList__collaborator-name",children:i.username}),(0,or.jsxs)("div",{className:"UserList__collaborator-status-icons","aria-hidden":!0,children:[a&&(0,or.jsx)("div",{className:"UserList__collaborator-status-icon-is-followed",title:x("userList.hint.followStatus"),children:Wf}),c]})]}):(0,or.jsxs)("div",{className:`UserList__collaborator UserList__collaborator--avatar-only ${l}`,children:[(0,or.jsx)(N4,{color:s,onClick:()=>{e(i)},name:i.username||"",src:i.avatarUrl,className:l}),c&&(0,or.jsx)("div",{className:"UserList__collaborator-status-icon",children:c})]})}})}),XM,Gee=I(()=>{"use strict";D(),xt(),cs(),sa(),ce(),ae(),XM=oe({name:"addToLibrary",trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});for(let o of ZS)if(i.some(a=>a.type===o))return{commitToHistory:!1,appState:{...t,errorMessage:x(`errors.libraryElementTypeError.${o}`)}};return r.library.getLatestLibrary().then(o=>r.library.setLibrary([{id:ni(),status:"unpublished",elements:i.map(Vu),created:Date.now()},...o])).then(()=>({commitToHistory:!1,appState:{...t,toast:{message:x("toast.addedToLibrary")}}})).catch(o=>({commitToHistory:!1,appState:{...t,errorMessage:o.message}}))},label:"labels.addToLibrary"})}),bH,eO,Wee=I(()=>{"use strict";D(),wt(),rn(),Fi(),bH=(e,t,n)=>{let r=Zp(e,t),i=ia(e);return r.flatMap(o=>{let a=eO(o,i,n);return o.map(s=>Le(s,{x:s.x+a.x,y:s.y+a.y}))})},eO=(e,t,{axis:n,position:r})=>{let i=ia(e),[o,a]=n==="x"?["minX","maxX"]:["minY","maxY"],s={x:0,y:0};return r==="start"?{...s,[n]:t[o]-i[o]}:r==="end"?{...s,[n]:t[a]-i[a]}:{...s,[n]:(t[o]+t[a])/2-(i[o]+i[a])/2}}}),Zr,cc,yH,vH,xH,wH,SH,TH,jee=I(()=>{"use strict";D(),Wee(),me(),On(),Pe(),xe(),Sr(),ce(),Ce(),pt(),ne(),xt(),Zr=(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return i.length>1&&!i.some(o=>ke(o))},cc=(e,t,n,r)=>{let i=n.scene.getSelectedElements(t),o=Fe(e),a=bH(i,o,r),s=Fe(a);return Gc(e.map(l=>s.get(l.id)||l),t,n)},yH=oe({name:"alignTop",label:"labels.alignTop",icon:PE,trackEvent:{category:"element"},predicate:Zr,perform:(e,t,n,r)=>({appState:t,elements:cc(e,t,r,{position:"start",axis:"y"}),commitToHistory:!0}),keyTest:e=>e[O.CTRL_OR_CMD]&&e.shiftKey&&e.key===O.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,Ec.jsx)(Xe,{hidden:!Zr(e,t,null,r),type:"button",icon:PE,onClick:()=>n(null),title:`${x("labels.alignTop")} \u2014 ${V("CtrlOrCmd+Shift+Up")}`,"aria-label":x("labels.alignTop"),visible:mn(at(e),t)})}),vH=oe({name:"alignBottom",label:"labels.alignBottom",icon:DE,trackEvent:{category:"element"},predicate:Zr,perform:(e,t,n,r)=>({appState:t,elements:cc(e,t,r,{position:"end",axis:"y"}),commitToHistory:!0}),keyTest:e=>e[O.CTRL_OR_CMD]&&e.shiftKey&&e.key===O.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,Ec.jsx)(Xe,{hidden:!Zr(e,t,null,r),type:"button",icon:DE,onClick:()=>n(null),title:`${x("labels.alignBottom")} \u2014 ${V("CtrlOrCmd+Shift+Down")}`,"aria-label":x("labels.alignBottom"),visible:mn(at(e),t)})}),xH=oe({name:"alignLeft",label:"labels.alignLeft",icon:LE,trackEvent:{category:"element"},predicate:Zr,perform:(e,t,n,r)=>({appState:t,elements:cc(e,t,r,{position:"start",axis:"x"}),commitToHistory:!0}),keyTest:e=>e[O.CTRL_OR_CMD]&&e.shiftKey&&e.key===O.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,Ec.jsx)(Xe,{hidden:!Zr(e,t,null,r),type:"button",icon:LE,onClick:()=>n(null),title:`${x("labels.alignLeft")} \u2014 ${V("CtrlOrCmd+Shift+Left")}`,"aria-label":x("labels.alignLeft"),visible:mn(at(e),t)})}),wH=oe({name:"alignRight",label:"labels.alignRight",icon:RE,trackEvent:{category:"element"},predicate:Zr,perform:(e,t,n,r)=>({appState:t,elements:cc(e,t,r,{position:"end",axis:"x"}),commitToHistory:!0}),keyTest:e=>e[O.CTRL_OR_CMD]&&e.shiftKey&&e.key===O.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,Ec.jsx)(Xe,{hidden:!Zr(e,t,null,r),type:"button",icon:RE,onClick:()=>n(null),title:`${x("labels.alignRight")} \u2014 ${V("CtrlOrCmd+Shift+Right")}`,"aria-label":x("labels.alignRight"),visible:mn(at(e),t)})}),SH=oe({name:"alignVerticallyCentered",label:"labels.centerVertically",icon:OE,trackEvent:{category:"element"},predicate:Zr,perform:(e,t,n,r)=>({appState:t,elements:cc(e,t,r,{position:"center",axis:"y"}),commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,Ec.jsx)(Xe,{hidden:!Zr(e,t,null,r),type:"button",icon:OE,onClick:()=>n(null),title:x("labels.centerVertically"),"aria-label":x("labels.centerVertically"),visible:mn(at(e),t)})}),TH=oe({name:"alignHorizontallyCentered",label:"labels.centerHorizontally",icon:NE,trackEvent:{category:"element"},predicate:Zr,perform:(e,t,n,r)=>({appState:t,elements:cc(e,t,r,{position:"center",axis:"x"}),commitToHistory:!0}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,Ec.jsx)(Xe,{hidden:!Zr(e,t,null,r),type:"button",icon:NE,onClick:()=>n(null),title:x("labels.centerHorizontally"),"aria-label":x("labels.centerHorizontally"),visible:mn(at(e),t)})})}),CH,Uee=I(()=>{"use strict";D(),wt(),Fi(),rn(),CH=(e,t,n)=>{let[r,i,o,a]=n.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],s=ia(e),l=Zp(e,t).map(h=>[h,ia(h)]).sort((h,m)=>h[1][i]-m[1][i]),c=0;for(let h of l)c+=h[1][a];let d=(s[a]-c)/(l.length-1);if(d<0){let h=l.findIndex(g=>g[1][r]===s[r]),m=l.findIndex(g=>g[1][o]===s[o]),p=(l[m][1][i]-l[h][1][i])/(l.length-1),f=l[h][1][i];return l.flatMap(([g,b],v)=>{let y={x:0,y:0};return v!==h&&v!==m&&(f+=p,y[n.axis]=f-b[i]),g.map(w=>Le(w,{x:w.x+y.x,y:w.y+y.y}))})}let u=s[r];return l.flatMap(([h,m])=>{let p={x:0,y:0};return p[n.axis]=u-m[r],u+=d,u+=m[a],h.map(f=>Le(f,{x:f.x+p.x,y:f.y+p.y}))})}}),x6,w6,MH,IH,Vee=I(()=>{"use strict";D(),me(),On(),Uee(),Pe(),xe(),Sr(),ce(),Ce(),pt(),ne(),xt(),x6=(e,t)=>{let n=t.scene.getSelectedElements(e);return n.length>1&&!n.some(r=>ke(r))},w6=(e,t,n,r)=>{let i=n.scene.getSelectedElements(t),o=CH(i,n.scene.getNonDeletedElementsMap(),r),a=Fe(o);return Gc(e.map(s=>a.get(s.id)||s),t,n)},MH=oe({name:"distributeHorizontally",label:"labels.distributeHorizontally",trackEvent:{category:"element"},perform:(e,t,n,r)=>({appState:t,elements:w6(e,t,r,{space:"between",axis:"x"}),commitToHistory:!0}),keyTest:e=>!e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.H,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,$4.jsx)(Xe,{hidden:!x6(t,r),type:"button",icon:SC,onClick:()=>n(null),title:`${x("labels.distributeHorizontally")} \u2014 ${V("Alt+H")}`,"aria-label":x("labels.distributeHorizontally"),visible:mn(at(e),t)})}),IH=oe({name:"distributeVertically",label:"labels.distributeVertically",trackEvent:{category:"element"},perform:(e,t,n,r)=>({appState:t,elements:w6(e,t,r,{space:"between",axis:"y"}),commitToHistory:!0}),keyTest:e=>!e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.V,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,$4.jsx)(Xe,{hidden:!x6(t,r),type:"button",icon:TC,onClick:()=>n(null),title:`${x("labels.distributeVertically")} \u2014 ${V("Alt+V")}`,"aria-label":x("labels.distributeVertically"),visible:mn(at(e),t)})})}),KM,qM,S6,tO,Yee=I(()=>{"use strict";D(),xt(),pt(),Pe(),LB(),ne(),Ce(),rn(),la(),Sr(),me(),KM=oe({name:"flipHorizontal",label:"labels.flipHorizontal",icon:vM,trackEvent:{category:"element"},perform:(e,t,n,r)=>({elements:Gc(S6(e,r.scene.getNonDeletedElementsMap(),t,"horizontal"),t,r),appState:t,commitToHistory:!0}),keyTest:e=>e.shiftKey&&e.code===tt.H}),qM=oe({name:"flipVertical",label:"labels.flipVertical",icon:yM,trackEvent:{category:"element"},perform:(e,t,n,r)=>({elements:Gc(S6(e,r.scene.getNonDeletedElementsMap(),t,"vertical"),t,r),appState:t,commitToHistory:!0}),keyTest:e=>e.shiftKey&&e.code===tt.V&&!e[O.CTRL_OR_CMD]}),S6=(e,t,n,r)=>{let i=st(at(e),n,{includeBoundTextElement:!0,includeElementsInFrames:!0}),o=tO(i,e,t,n,r),a=Fe(o);return e.map(s=>a.get(s.id)||s)},tO=(e,t,n,r,i)=>{let{minX:o,minY:a,maxX:s,maxY:l}=ia(e);return T4(n,e,n,"nw",!0,i==="horizontal"?s:o,i==="horizontal"?a:l),el(r)?iE(e,t,n):aE(e,n),e}}),Du,F4,XE,KE,qE,QE,kH=I(()=>{"use strict";D(),Ce(),xt(),Xc(),uz(),Uc(),Pe(),Uc(),ce(),ae(),me(),Du=oe({name:"copy",label:"labels.copy",icon:nf,trackEvent:{category:"element"},perform:async(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await $T(i,r.files,n)}catch(o){return{commitToHistory:!1,appState:{...t,errorMessage:o.message}}}return{commitToHistory:!1}},keyTest:void 0}),F4=oe({name:"paste",label:"labels.paste",trackEvent:{category:"element"},perform:async(e,t,n,r)=>{let i;try{i=await EB()}catch(o){return o.name==="AbortError"||o.name==="NotAllowedError"?!1:(console.error(`actionPaste ${o.name}: ${o.message}`),Bu?{commitToHistory:!1,appState:{...t,errorMessage:x("hints.firefox_clipboard_write")}}:{commitToHistory:!1,appState:{...t,errorMessage:x("errors.asyncPasteFailedOnRead")}})}try{r.pasteFromClipboard(gB({types:i}))}catch(o){return console.error(o),{commitToHistory:!1,appState:{...t,errorMessage:x("errors.asyncPasteFailedOnParse")}}}return{commitToHistory:!1}},keyTest:void 0}),XE=oe({name:"cut",label:"labels.cut",icon:oM,trackEvent:{category:"element"},perform:(e,t,n,r)=>(Du.perform(e,t,n,r),Bb.perform(e,t,null,r)),keyTest:e=>e[O.CTRL_OR_CMD]&&e.key===O.X}),KE=oe({name:"copyAsSvg",label:"labels.copyAsSvg",icon:xM,trackEvent:{category:"element"},perform:async(e,t,n,r)=>{if(!r.canvas)return{commitToHistory:!1};let{exportedElements:i,exportingFrame:o}=df(e,t,!0);try{return await uf({type:"clipboard-svg",data:{elements:i,appState:t,files:r.files},config:{...t,exportingFrame:o,name:r.getName()}}),{commitToHistory:!1}}catch(a){return console.error(a),{appState:{...t,errorMessage:a.message},commitToHistory:!1}}},predicate:e=>mE&&e.length>0,keywords:["svg","clipboard","copy"]}),qE=oe({name:"copyAsPng",label:"labels.copyAsPng",icon:wM,trackEvent:{category:"element"},perform:async(e,t,n,r)=>{if(!r.canvas)return{commitToHistory:!1};let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:o,exportingFrame:a}=df(e,t,!0);try{return await uf({type:"clipboard",data:{elements:o,appState:t,files:r.files},config:{...t,exportingFrame:a,name:t.name||r.getName()}}),{appState:{...t,toast:{message:x("toast.copyToClipboardAsPng",{exportSelection:i.length?x("toast.selection"):x("toast.canvas"),exportColorScheme:t.exportWithDarkMode?x("buttons.darkMode"):x("buttons.lightMode")})}},commitToHistory:!1}}catch(s){return console.error(s),{appState:{...t,errorMessage:s.message},commitToHistory:!1}}},predicate:e=>Sb&&e.length>0,keyTest:e=>e.code===tt.C&&e.altKey&&e.shiftKey,keywords:["png","clipboard","copy"]}),QE=oe({name:"copyText",label:"labels.copyText",trackEvent:{category:"element"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).reduce((o,a)=>(he(a)&&o.push(a.text),o),[]).join(`
176
-
177
- `);try{Zu(i)}catch{throw new Error(x("errors.copyToSystemClipboardFailed"))}return{commitToHistory:!1}},predicate:(e,t,n,r)=>mE&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(he),keywords:["text","clipboard","copy"]})}),JE,Zee=I(()=>{"use strict";D(),Ce(),xt(),ae(),JE=oe({name:"gridMode",label:"labels.showGrid",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.gridSize},perform(e,t){return{appState:{...t,gridSize:this.checked(t)?null:_c,objectsSnapModeEnabled:!1},commitToHistory:!1}},checked:e=>e.gridSize!==null,predicate:(e,t,n)=>typeof n.gridModeEnabled>"u",keyTest:e=>e[O.CTRL_OR_CMD]&&e.code===tt.QUOTE})}),gf,Xee=I(()=>{"use strict";D(),me(),Ce(),xt(),gf=oe({name:"zenMode",label:"buttons.zenMode",icon:TM,paletteName:"Toggle zen mode",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},commitToHistory:!1}},checked:e=>e.zenModeEnabled,predicate:(e,t,n)=>typeof n.zenModeEnabled>"u",keyTest:e=>!e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.Z})}),QM,Kee=I(()=>{"use strict";D(),me(),Ce(),xt(),QM=oe({name:"objectsSnapMode",label:"buttons.objectsSnapMode",icon:SM,viewMode:!1,trackEvent:{category:"canvas",predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridSize:null},commitToHistory:!1}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,n)=>typeof n.objectsSnapModeEnabled>"u",keyTest:e=>!e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.S})}),th,AH=I(()=>{"use strict";D(),xt(),Ce(),me(),th=oe({name:"stats",label:"stats.title",icon:bM,paletteName:"Toggle stats",viewMode:!0,trackEvent:{category:"menu"},perform(e,t){return{appState:{...t,showStats:!this.checked(t)},commitToHistory:!1}},checked:e=>e.showStats,keyTest:e=>!e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.SLASH})}),JM,eI,nO,rO,_H,PH=I(()=>{"use strict";D(),ae(),Pe(),wt(),Kt(),dT(),xe(),ne(),xt(),JM=oe({name:"unbindText",label:"labels.unbindText",trackEvent:{category:"element"},predicate:(e,t,n,r)=>r.scene.getSelectedElements(t).some(i=>as(i)),perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),o=r.scene.getNonDeletedElementsMap();return i.forEach(a=>{let s=Ue(a,o);if(s){let{width:l,height:c}=Qa(s.originalText,xn(s),s.lineHeight),d=bF(a.id);cT(a.id);let{x:u,y:h}=Mp(a,s,o);re(s,{containerId:null,width:l,height:c,text:s.originalText,x:u,y:h}),re(a,{boundElements:a.boundElements?.filter(m=>m.id!==s.id),height:d||a.height})}}),{elements:e,appState:t,commitToHistory:!0}}}),eI=oe({name:"bindText",label:"labels.bindText",trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);if(i.length===2){let o=he(i[0])||he(i[1]),a;if(ul(i[0])?a=i[0]:ul(i[1])&&(a=i[1]),o&&a&&Ue(a,r.scene.getNonDeletedElementsMap())===null)return!0}return!1},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),o,a;he(i[0])&&ul(i[1])?(o=i[0],a=i[1]):(o=i[1],a=i[0]),re(o,{containerId:a.id,verticalAlign:Nr.MIDDLE,textAlign:Hu.CENTER}),re(a,{boundElements:(a.boundElements||[]).concat({type:"text",id:o.id})});let s=a.height;return bo(o,a,r.scene.getNonDeletedElementsMap()),Up(a.id,s),{elements:nO(e,a,o),appState:{...t,selectedElementIds:{[a.id]:!0}},commitToHistory:!0}}}),nO=(e,t,n)=>{let r=e.slice(),i=r.findIndex(a=>a.id===n.id);r.splice(i,1);let o=r.findIndex(a=>a.id===t.id);return r.splice(o+1,0,n),r},rO=(e,t,n)=>{let r=e.slice(),i=r.findIndex(a=>a.id===t.id);r.splice(i,1);let o=r.findIndex(a=>a.id===n.id);return r.splice(o,0,t),r},_H=oe({name:"wrapTextInContainer",label:"labels.createContainerFromText",trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),o=i.every(a=>he(a));return i.length>0&&o},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),o=e.slice(),a={};for(let s of i)if(he(s)){let l=rs({type:"rectangle",backgroundColor:t.currentItemBackgroundColor,boundElements:[...s.boundElements||[],{id:s.id,type:"text"}],angle:s.angle,fillStyle:t.currentItemFillStyle,strokeColor:t.currentItemStrokeColor,roughness:t.currentItemRoughness,strokeWidth:t.currentItemStrokeWidth,strokeStyle:t.currentItemStrokeStyle,roundness:t.currentItemRoundness==="round"?{type:Lc("rectangle")?Pn.ADAPTIVE_RADIUS:Pn.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:s.x-yn,y:s.y-yn,width:nl(s.width,"rectangle"),height:nl(s.height,"rectangle"),groupIds:s.groupIds,frameId:s.frameId});if(s.boundElements?.length){let c=s.boundElements.filter(d=>d.type==="arrow").map(d=>d.id);o.filter(d=>c.includes(d.id)).forEach(d=>{let u=d.startBinding,h=d.endBinding;u?.elementId===s.id&&(u={...u,elementId:l.id}),h?.elementId===s.id&&(h={...h,elementId:l.id}),(u||h)&&re(d,{startBinding:u,endBinding:h},!1)})}re(s,{containerId:l.id,verticalAlign:Nr.MIDDLE,boundElements:null,textAlign:Hu.CENTER},!1),bo(s,l,r.scene.getNonDeletedElementsMap()),o=rO([...o,l],l,s),a[l.id]=!0}return{elements:o,appState:{...t,selectedElementIds:a},commitToHistory:!0}}})}),qee=I(()=>{}),Rg,T6,Og,iO,oO,Ng,Ym,DH,C6,B4,Xd,LH,aO,RH,sO,OH=I(()=>{"use strict";D(),ne(),Eb(),wt(),On(),me(),ce(),Ce(),ae(),rn(),Qc(),pt(),Zc(),dh(),qee(),li(),Re(),xe(),AT(),Rg=320,T6=85,Og=5,iO=42,oO=500,Ng=!1,Ym=new Map,DH=({element:e,elementsMap:t,setAppState:n,onLinkOpen:r,setToast:i,updateEmbedValidationStatus:o})=>{let a=wy(),s=Xf(),l=e.link||"",[c,d]=(0,Mo.useState)(l),u=(0,Mo.useRef)(null),h=a.showHyperlinkPopup==="editor",m=(0,Mo.useCallback)(()=>{if(!u.current)return;let v=wo(u.current.value)||null;if(!e.link&&v&&ot("hyperlink","create"),sr(e)){if(a.activeEmbeddable?.element===e&&n({activeEmbeddable:null}),!v){re(e,{link:null}),o(e,!1);return}if(!kp(v,s.validateEmbeddable))v&&i({message:x("toast.unableToEmbed"),closable:!0}),e.link&&Ym.set(e.id,e.link),re(e,{link:v}),o(e,!1);else{let{width:y,height:w}=e,T=Cc(v);T?.error instanceof URIError&&i({message:x("toast.unrecognizedLinkFormat"),closable:!0});let k=T?T.intrinsicSize.w/T.intrinsicSize.h:1,M=Ym.get(e.id)!==e.link;re(e,{...M?{width:T?.type==="video"?y>w?y:w*k:y,height:T?.type==="video"&&y>w?y/k:w}:{},link:v}),o(e,!0),Ym.has(e.id)&&Ym.delete(e.id)}}else re(e,{link:v})},[e,i,s.validateEmbeddable,a.activeEmbeddable,n,o]);(0,Mo.useLayoutEffect)(()=>()=>{m()},[m]),(0,Mo.useEffect)(()=>{let v=null,y=w=>{h||(v&&clearTimeout(v),sO(e,t,a,[w.clientX,w.clientY])&&(v=window.setTimeout(()=>{n({showHyperlinkPopup:!1})},oO)))};return window.addEventListener("pointermove",y,!1),()=>{window.removeEventListener("pointermove",y,!1),v&&clearTimeout(v)}},[a,e,h,n,t]);let p=(0,Mo.useCallback)(()=>{ot("hyperlink","delete"),re(e,{link:null}),h&&(u.current.value=""),n({showHyperlinkPopup:!1})},[n,e,h]),f=()=>{ot("hyperlink","edit","popup-ui"),n({showHyperlinkPopup:"editor"})},{x:g,y:b}=C6(e,a,t);return a.contextMenu||a.draggingElement||a.resizingElement||a.isRotating||a.openMenu||a.viewModeEnabled?null:(0,Ya.jsxs)("div",{className:"excalidraw-hyperlinkContainer",style:{top:`${b}px`,left:`${g}px`,width:Rg,padding:Og},onClick:()=>{!e.link&&!h&&n({showHyperlinkPopup:"editor"})},children:[h?(0,Ya.jsx)("input",{className:Y("excalidraw-hyperlinkContainer-input"),placeholder:"Type or paste your link here",ref:u,value:c,onChange:v=>d(v.target.value),autoFocus:!0,onKeyDown:v=>{v.stopPropagation(),v[O.CTRL_OR_CMD]&&v.key===O.K&&v.preventDefault(),(v.key===O.ENTER||v.key===O.ESCAPE)&&(m(),n({showHyperlinkPopup:"info"}))}}):e.link?(0,Ya.jsx)("a",{href:wo(e.link||""),className:"excalidraw-hyperlinkContainer-link",target:bT(e.link)?"_self":"_blank",onClick:v=>{if(e.link&&r){let y=eT("excalidraw-link",v.nativeEvent);r({...e,link:wo(e.link)},y),y.defaultPrevented&&v.preventDefault()}},rel:"noopener noreferrer",children:e.link}):(0,Ya.jsx)("div",{className:"excalidraw-hyperlinkContainer-link",children:x("labels.link.empty")}),(0,Ya.jsxs)("div",{className:"excalidraw-hyperlinkContainer__buttons",children:[!h&&(0,Ya.jsx)(Xe,{type:"button",title:x("buttons.edit"),"aria-label":x("buttons.edit"),label:x("buttons.edit"),onClick:f,className:"excalidraw-hyperlinkContainer--edit",icon:Bf}),l&&!sr(e)&&(0,Ya.jsx)(Xe,{type:"button",title:x("buttons.remove"),"aria-label":x("buttons.remove"),label:x("buttons.remove"),onClick:p,className:"excalidraw-hyperlinkContainer--remove",icon:bl})]})]})},C6=(e,t,n)=>{let[r,i]=_e(e,n),{x:o,y:a}=Ri({sceneX:r+e.width/2,sceneY:i},t),s=o-t.offsetLeft-Rg/2,l=a-t.offsetTop-T6;return{x:s,y:l}},B4=(e,t)=>{let n=st(e,t);return n[0]?.link?sr(n[0])?"labels.link.editEmbed":"labels.link.edit":sr(n[0])?"labels.link.createEmbed":"labels.link.create"},Xd=null,LH=(e,t,n)=>{Xd&&clearTimeout(Xd),Xd=window.setTimeout(()=>aO(e,t,n),E$)},aO=(e,t,n)=>{if(!e.link)return;let r=vu();r.classList.add("excalidraw-tooltip--visible"),r.style.maxWidth="20rem",r.textContent=e.link;let[i,o,a,s]=_e(e,n),[l,c,d,u]=hE([i,o,a,s],e.angle,t),h=Ri({sceneX:l,sceneY:c},t);L4(r,{left:h.x,top:h.y,width:d,height:u},"top"),ot("hyperlink","tooltip","link-icon"),Ng=!0},RH=()=>{Xd&&clearTimeout(Xd),Ng&&(Ng=!1,vu().classList.remove("excalidraw-tooltip--visible"))},sO=(e,t,n,[r,i])=>{let{x:o,y:a}=Ot({clientX:r,clientY:i},n),s=15/n.zoom.value;if(Tp(e,t,[o,a],s,null))return!1;let[l,c,d]=_e(e,t);if(o>=l&&o<=d&&a>=c-T6&&a<=c)return!1;let{x:u,y:h}=C6(e,n,t);return!(r>=u-s&&r<=u+Rg+Og*2+s&&i>=h-s&&i<=h+s+Og*2+iO)}}),qb,Qee=I(()=>{"use strict";D(),OH(),me(),On(),xe(),ce(),Ce(),pt(),ne(),xt(),qb=oe({name:"hyperlink",label:(e,t)=>B4(e,t),icon:af,perform:(e,t)=>t.showHyperlinkPopup==="editor"?!1:{elements:e,appState:{...t,showHyperlinkPopup:"editor",openMenu:null},commitToHistory:!0},trackEvent:{category:"hyperlink",action:"click"},keyTest:e=>e[O.CTRL_OR_CMD]&&e.key===O.K,predicate:(e,t)=>st(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=st(e,t);return(0,NH.jsx)(Xe,{type:"button",icon:af,"aria-label":x(B4(e,t)),title:`${sr(e[0])?x("labels.link.labelEmbed"):x("labels.link.label")} - ${V("CtrlOrCmd+K")}`,onClick:()=>n(null),selected:r.length===1&&!!r[0].link})}})}),$g,tI,$H,FH=I(()=>{"use strict";D(),me(),wt(),xe(),Ce(),pt(),ne(),xt(),$g=e=>e.every(t=>!t.locked),tI=oe({name:"toggleElementLock",label:(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1});return r.length===1&&!ke(r[0])?r[0].locked?"labels.elementLock.unlock":"labels.elementLock.lock":$g(r)?"labels.elementLock.lockAll":"labels.elementLock.unlockAll"},icon:(e,t)=>{let n=st(t,e);return $g(n)?Ff:Qu},trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return i.length>0&&!i.some(o=>o.locked&&o.frameId)},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});if(!i.length)return!1;let o=$g(i),a=Fe(i);return{elements:e.map(s=>a.has(s.id)?Le(s,{locked:o}):s),appState:{...t,selectedLinearElement:o?null:t.selectedLinearElement},commitToHistory:!0}},keyTest:(e,t,n,r)=>e.key.toLocaleLowerCase()===O.L&&e[O.CTRL_OR_CMD]&&e.shiftKey&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),$H=oe({name:"unlockAllElements",paletteName:"Unlock all elements",trackEvent:{category:"canvas"},viewMode:!1,icon:Qu,predicate:(e,t)=>st(e,t).length===0&&e.some(n=>n.locked),perform:(e,t)=>{let n=e.filter(r=>r.locked);return{elements:e.map(r=>r.locked?Le(r,{locked:!1}):r),appState:{...t,selectedElementIds:Object.fromEntries(n.map(r=>[r.id,!0]))},commitToHistory:!0}},label:"labels.elementLock.unlockAll"})}),BH,Jee=I(()=>{"use strict";D(),BH=()=>{let[e,t]=(0,Qb.useState)(null),n=(0,Qb.useCallback)(r=>t(r),[]);return[e,n]}}),ete=I(()=>{}),tte=I(()=>{}),Co,Jc=I(()=>{"use strict";D(),tte(),Co=zH.default.forwardRef(({children:e,padding:t,className:n,style:r},i)=>(0,HH.jsx)("div",{className:Y("Island",n),style:{"--padding":t,...r},ref:i,children:e}))}),nte=I(()=>{}),jH,rte=I(()=>{"use strict";D(),nte(),Ce(),Az(),jH=e=>{let{closeOnClickOutside:t=!0}=e,n=RM({className:"excalidraw-modal-container"}),r=(0,WH.useRef)(document.body.classList.contains("excalidraw-animations-disabled"));if(!n)return null;let i=o=>{o.key===O.ESCAPE&&(o.nativeEvent.stopImmediatePropagation(),o.stopPropagation(),e.onCloseRequest())};return(0,GH.createPortal)((0,Ef.jsxs)("div",{className:Y("Modal",e.className,{"animations-disabled":r.current}),role:"dialog","aria-modal":"true",onKeyDown:i,"aria-labelledby":e.labelledBy,"data-prevent-outside-click":!0,children:[(0,Ef.jsx)("div",{className:"Modal__background",onClick:t?e.onCloseRequest:void 0}),(0,Ef.jsx)("div",{className:"Modal__content",style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),n)}}),z4,M6,UH,nI,ey=I(()=>{"use strict";D(),Bi(),Ln(),mh(),z4=At(new Map),M6=async e=>await pE({data:{elements:e,appState:{exportBackground:!1,viewBackgroundColor:He.white},files:null},config:{}}),UH=(e,t,n)=>{let[r,i]=(0,Jb.useState)();return(0,Jb.useEffect)(()=>{if(t)if(e){let o=n.get(e);o?i(o):(async()=>{let a=await M6(t);a.querySelector(".style-fonts")?.remove(),a&&(n.set(e,a),i(a))})()}else(async()=>{let o=await M6(t);i(o)})()},[e,t,n,i]),r},nI=()=>{let[e]=Ve(z4,Gn);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:t=>{t.forEach(n=>e.delete(n))},svgCache:e}}}),$a,VH=I(()=>{"use strict";D(),$a=class{subscribers=[];on(...e){let t=e.flat().filter(n=>typeof n=="function");return this.subscribers.push(...t),()=>this.off(t)}once(...e){let t=e.flat().filter(r=>typeof r=="function");t.push(()=>n());let n=this.on(...t);return n}off(...e){let t=e.flat();this.subscribers=this.subscribers.filter(n=>!t.includes(n))}trigger(...e){for(let t of this.subscribers)t(...e);return this}clear(){this.subscribers=[]}}}),YH,ite=I(()=>{"use strict";D(),ne(),YH=class{jobs=[];running=!1;tick(){if(this.running)return;let e=this.jobs.shift();e?(this.running=!0,e.promise.resolve(Q2(e.jobFactory,...e.args).finally(()=>{this.running=!1,this.tick()}))):this.running=!1}push(e,...t){let n=JS();return this.jobs.push({jobFactory:e,promise:n,args:t}),this.tick(),n}}}),I6,Lu,Kd,lO,cO,k6,dO,H4,rI,A6,Zm,qd,Xm,Fg,_6,ote,Ru=I(()=>{"use strict";D(),si(),hh(),Ln(),rn(),uh(),ce(),ae(),ey(),ne(),VH(),ite(),Pe(),I6=new $a,Lu=At({status:"loaded",isInitialized:!1,libraryItems:[]}),Kd=e=>zc(e),lO=(e,t)=>!e.find(n=>n.elements.length!==t.elements.length?!1:n.elements.every((r,i)=>r.id===t.elements[i].id&&r.versionNonce===t.elements[i].versionNonce)),cO=(e,t)=>{let n=[];for(let r of t)lO(e,r)&&n.push(r);return[...n,...e]},k6=(e,t)=>{let n=Fe(t),r={deletedItems:new Map,addedItems:new Map};for(let o of e)n.has(o.id)||r.deletedItems.set(o.id,o);let i=Fe(e);for(let o of t)i.has(o.id)||r.addedItems.set(o.id,o);return r},dO=class{currLibraryItems=[];prevLibraryItems=Kd(this.currLibraryItems);app;constructor(e){this.app=e}updateQueue=[];getLastUpdateTask=()=>this.updateQueue[this.updateQueue.length-1];notifyListeners=()=>{if(this.updateQueue.length>0)xo.set(Lu,e=>({status:"loading",libraryItems:this.currLibraryItems,isInitialized:e.isInitialized}));else{xo.set(Lu,{status:"loaded",libraryItems:this.currLibraryItems,isInitialized:!0});try{let e=this.prevLibraryItems;this.prevLibraryItems=Kd(this.currLibraryItems);let t=Kd(this.currLibraryItems);this.app.props.onLibraryChange?.(t),I6.trigger(k6(e,t),t)}catch(e){console.error(e)}}};destroy=()=>{this.updateQueue=[],this.currLibraryItems=[],xo.set(z4,new Map)};resetLibrary=()=>this.setLibrary([]);getLatestLibrary=()=>new Promise(async e=>{try{let t=await(this.getLastUpdateTask()||this.currLibraryItems);this.updateQueue.length>0?e(this.getLatestLibrary()):e(Kd(t))}catch{return e(this.currLibraryItems)}});updateLibrary=async({libraryItems:e,prompt:t=!1,merge:n=!1,openLibraryMenu:r=!1,defaultStatus:i="unpublished"})=>(r&&this.app.setState({openSidebar:{name:es.name,tab:X2}}),this.setLibrary(()=>new Promise(async(o,a)=>{try{let s=await(typeof e=="function"&&!(e instanceof Blob)?e(this.currLibraryItems):e),l;s instanceof Blob?l=await XF(s,i):l=Ap(s,i),!t||window.confirm(x("alerts.confirmAddLibrary",{numShapes:l.length}))?(t&&this.app.focusContainer(),o(n?cO(this.currLibraryItems,l):l)):a(new Nf)}catch(s){a(s)}})));setLibrary=e=>{let t=new Promise(async(n,r)=>{try{await this.getLastUpdateTask(),typeof e=="function"&&(e=e(this.currLibraryItems)),this.currLibraryItems=Kd(await e),n(this.currLibraryItems)}catch(i){r(i)}}).catch(n=>{if(n.name==="AbortError")return console.warn("Library update aborted by user"),this.currLibraryItems;throw n}).finally(()=>{this.updateQueue=this.updateQueue.filter(n=>n!==t),this.notifyListeners()});return this.updateQueue.push(t),this.notifyListeners(),t}},H4=dO,rI=e=>{let t=Math.ceil(Math.sqrt(e.length)),n=[],r=h=>e.slice(h*t,h*t+t).reduce((m,p)=>{let{height:f}=ia(p.elements);return Math.max(m,f)},0),i=h=>{let m=0,p=0,f=0;for(let g of e){if(m%t===0&&(p=0),p===h){let{width:b}=ia(g.elements);f=Math.max(f,b)}m++,p++}return f},o=0,a=0,s=0,l=0,c=0,d=0,u=0;for(let h of e){c&&c%t===0&&(a+=s+50,o=0,d=0,u++),d===0&&(s=r(u)),l=i(d);let{minX:m,minY:p,width:f,height:g}=ia(h.elements),b=(l-f)/2,v=(s-g)/2;n.push(...h.elements.map(y=>({...y,x:y.x+o+b-m,y:y.y+a+v-p}))),o+=l+50,c++,d++}return n},A6=()=>{let e=new URLSearchParams(window.location.hash.slice(1)).get(m2.addLibrary)||new URLSearchParams(window.location.search).get(h2.addLibrary),t=e?new URLSearchParams(window.location.hash.slice(1)).get("token"):null;return e?{libraryUrl:e,idToken:t}:null},Zm=class fp{static queue=new YH;static async getLibraryItems(t,n,r=!0){let i=()=>new Promise(async(o,a)=>{try{let s=await t.load({source:n});o(Ap(s?.libraryItems||[],"published"))}catch(s){a(s)}});return r?fp.queue.push(i):i()}static run=async(t,n)=>{let r=new fp(t);return fp.queue.push(()=>n(r))};adapter;constructor(t){this.adapter=t}getLibraryItems(t){return fp.getLibraryItems(this.adapter,t,!1)}},qd=0,Xm=0,Fg=e=>$B(e.map(t=>`${t.id}:${NB(t.elements)}`).sort().join()),_6=async(e,t)=>{try{return Xm++,await Zm.run(e,async n=>{let r=Fe(await n.getLibraryItems("save"));for(let[s]of t.deletedItems)r.delete(s);let i=[];for(let[s,l]of t.addedItems)r.has(s)?r.set(s,l):i.push(l);let o=i.concat(Array.from(r.values())),a=Fg(o);return a!==qd&&await e.save({libraryItems:o}),qd=a,o})}finally{Xm--}},ote=e=>{let{excalidrawAPI:t}=e,n=(0,nh.useRef)(e);n.current=e;let r=(0,nh.useRef)(!1);(0,nh.useEffect)(()=>{if(!t)return;r.current=!1;let i=async({libraryUrl:s,idToken:l})=>{let c=new Promise(async(u,h)=>{try{let m=await(await fetch(decodeURIComponent(s))).blob();u(m)}catch(m){h(m)}}),d=l!==t.id;await(d&&document.hidden?new Promise(u=>{window.addEventListener("focus",()=>u(),{once:!0})}):null);try{await t.updateLibrary({libraryItems:c,prompt:d,merge:!0,defaultStatus:"published",openLibraryMenu:!0})}catch(u){throw u}finally{if(window.location.hash.includes(m2.addLibrary)){let u=new URLSearchParams(window.location.hash.slice(1));u.delete(m2.addLibrary),window.history.replaceState({},U2,`#${u.toString()}`)}else if(window.location.search.includes(h2.addLibrary)){let u=new URLSearchParams(window.location.search);u.delete(h2.addLibrary),window.history.replaceState({},U2,`?${u.toString()}`)}}},o=s=>{s.preventDefault();let l=A6();l&&(s.stopImmediatePropagation(),window.history.replaceState({},"",s.oldURL),i(l))},a=A6();if(a&&i(a),"getInitialLibraryItems"in n.current&&n.current.getInitialLibraryItems&&(console.warn("useHandleLibrar `opts.getInitialLibraryItems` is deprecated. Use `opts.adapter` instead."),Promise.resolve(n.current.getInitialLibraryItems()).then(s=>{t.updateLibrary({libraryItems:s,merge:!0})}).catch(s=>{console.error(`UseHandeLibrary getInitialLibraryItems failed: ${s?.message}`)})),"adapter"in n.current&&n.current.adapter){let s=n.current.adapter,l=n.current.migrationAdapter,c=JS();l?c.resolve(Q2(l.load).then(async d=>{let u=null;try{if(!d)return Zm.getLibraryItems(s,"load");u=Ap(d.libraryItems||[],"published");let h=await _6(s,k6([],u));try{await l.clear()}catch(m){console.error(`couldn't delete legacy library data: ${m.message}`)}return h}catch(h){return console.error(`couldn't migrate legacy library data: ${h.message}`),u}}).catch(d=>(console.error(`error during library migration: ${d.message}`),Zm.getLibraryItems(s,"load")))):c.resolve(Q2(Zm.getLibraryItems,s,"load")),t.updateLibrary({libraryItems:c.then(d=>{let u=d||[];return qd=Fg(u),u}),merge:!0}).finally(()=>{r.current=!0})}return window.addEventListener("hashchange",o),()=>{window.removeEventListener("hashchange",o)}},[t]),(0,nh.useEffect)(()=>{let i=I6.on(async(a,s)=>{let l=r.current,c="adapter"in n.current&&n.current.adapter||null;try{c&&qd!==Fg(s)&&await _6(c,a)}catch(d){console.error(`couldn't persist library update: ${d.message}`,a),l&&n.current.excalidrawAPI&&n.current.excalidrawAPI.updateScene({appState:{errorMessage:x("errors.saveLibraryError")}})}}),o=a=>{Xm&&$$(a)};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o),i(),qd=0,Xm=0}},[])}}),ate=I(()=>{}),uO,hO,ii,ph=I(()=>{"use strict";D(),ate(),uO=(0,G4.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:o},a)=>(0,W4.jsx)("div",{className:Y("Stack Stack_horizontal",i),style:{"--gap":t,alignItems:n,justifyContent:r,...o},ref:a,children:e})),hO=(0,G4.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:o},a)=>(0,W4.jsx)("div",{className:Y("Stack Stack_vertical",i),style:{"--gap":t,justifyItems:n,justifyContent:r,...o},ref:a,children:e})),ii={Row:uO,Col:hO}}),mO,XH,ste=I(()=>{"use strict";D(),ae(),ce(),mO=({theme:e,id:t,libraryReturnUrl:n})=>{let r=n||window.location.origin+window.location.pathname;return(0,ZH.jsx)("a",{className:"library-menu-browse-button",href:`${Pt.VITE_APP_LIBRARY_URL}?target=${window.name||"_blank"}&referrer=${r}&useHash=true&token=${t}&theme=${e}&version=${Bp.excalidrawLibrary}`,target:"_excalidraw_libraries",children:x("labels.libraries")})},XH=mO}),iI,KH=I(()=>{"use strict";D(),ste(),iI=({libraryReturnUrl:e,theme:t,id:n,style:r,children:i,className:o})=>(0,ty.jsxs)("div",{className:Y("library-menu-control-buttons",o),style:r,children:[(0,ty.jsx)(XH,{id:n,libraryReturnUrl:e,theme:t}),i]})}),pO,fO,gO,EO,bO,yO,yo,Yf=I(()=>{"use strict";D(),ce(),pO=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,fO=/{{([\w-]+)}}/,gO=/<([\w-]+)>/,EO=/<\/([\w-]+)>/,bO=(e,t)=>{let n=[{name:"",children:[]}];return e.split(pO).filter(Boolean).forEach(r=>{let i=r.match(gO),o=r.match(EO),a=r.match(fO);if(i!==null){let s=i[1];t.hasOwnProperty(s)?n.push({name:s,children:[]}):console.warn(`Trans: missed to pass in prop ${s} for interpolating ${e}`)}else if(o!==null)if(o[1]===n[n.length-1].name){let s=n.pop(),l=gp.default.createElement(gp.default.Fragment,{},...s.children),c=t[s.name];typeof c=="function"&&n[n.length-1].children.push(c(l))}else console.warn(`Trans: unexpected end tag ${r} for interpolating ${e}`);else if(a!==null){let s=a[1];t.hasOwnProperty(s)?n[n.length-1].children.push(t[s]):console.warn(`Trans: key ${s} 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},yO=({i18nKey:e,children:t,...n})=>{let{t:r}=ir();return gp.default.createElement(gp.default.Fragment,{},...bO(r(e),n))},yo=yO}),lte=I(()=>{}),cte=I(()=>{}),vO,bf,qH=I(()=>{"use strict";D(),cte(),wl(),vO=({label:e,onClick:t,className:n,children:r,actionType:i,type:o="button",isLoading:a,...s})=>{let l=i?`Dialog__action-button--${i}`:"";return(0,Ic.jsxs)("button",{className:Y("Dialog__action-button",l,n),type:o,"aria-label":e,onClick:t,...s,children:[r&&(0,Ic.jsx)("div",{style:a?{visibility:"hidden"}:{},children:r}),(0,Ic.jsx)("div",{style:a?{visibility:"hidden"}:{},children:e}),a&&(0,Ic.jsx)("div",{style:{position:"absolute",inset:0},children:(0,Ic.jsx)(oa,{})})]})},bf=vO}),xO,oI,QH=I(()=>{"use strict";D(),ce(),zi(),lte(),qH(),dy(),Re(),Ln(),xO=e=>{let{onConfirm:t,onCancel:n,children:r,confirmText:i=x("buttons.confirm"),cancelText:o=x("buttons.cancel"),className:a="",...s}=e,l=Dn(),c=ka(cy,Gn),{container:d}=ua();return(0,rh.jsxs)(ci,{onCloseRequest:n,size:"small",...s,className:`confirm-dialog ${a}`,children:[r,(0,rh.jsxs)("div",{className:"confirm-dialog-buttons",children:[(0,rh.jsx)(bf,{label:o,onClick:()=>{l({openMenu:null}),c(!1),n(),d?.focus()}}),(0,rh.jsx)(bf,{label:i,onClick:()=>{l({openMenu:null}),c(!1),t(),d?.focus()},actionType:"danger"})]})]})},oI=xO}),is,ny=I(()=>{"use strict";D(),is=class{static has(e){try{return!!window.localStorage.getItem(e)}catch(t){return console.warn(`localStorage.getItem error: ${t.message}`),!1}}static get(e){try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return console.warn(`localStorage.getItem error: ${t.message}`),null}}static set=(e,t)=>{try{return window.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){return console.warn(`localStorage.setItem error: ${n.message}`),!1}};static delete=e=>{try{window.localStorage.removeItem(e)}catch(t){console.warn(`localStorage.removeItem error: ${t.message}`)}}}}),dte=I(()=>{}),wO,SO,TO,JH,ute=I(()=>{"use strict";D(),zi(),ce(),Yf(),mh(),ae(),si(),ne(),qH(),me(),On(),ny(),dte(),wO=async e=>{let t=Math.round(8),n=Math.max(Math.round(128/64),2),r=R$(e,6),i=document.createElement("canvas");i.width=r[0].length*128+(r[0].length+1)*(t*2)-t*2,i.height=r.length*128+(r.length+1)*(t*2)-t*2;let o=i.getContext("2d");o.fillStyle=Li,o.fillRect(0,0,i.width,i.height);for(let[a,s]of e.entries()){let l=await zT({data:{elements:s.elements,files:null},config:{maxWidthOrHeight:128}}),{width:c,height:d}=l,u=Math.floor(a/6)*(128+t*2),h=a%6*(128+t*2);o.drawImage(l,h+(128-c)/2+t,u+(128-d)/2+t),o.lineWidth=n,o.strokeStyle=Ct.gray[4],o.strokeRect(h+t/2,u+t/2,128+t,128+t)}return await dE(new File([await Yu(i)],"preview",{type:ve.png}),{outputType:ve.jpg,maxWidthOrHeight:5e3})},SO=({libItem:e,appState:t,index:n,onChange:r,onRemove:i})=>{let o=(0,oi.useRef)(null),a=(0,oi.useRef)(null);return(0,oi.useEffect)(()=>{let s=o.current;s&&(async()=>{let l=await pE({data:{elements:e.elements,appState:{...t,viewBackgroundColor:Li,exportBackground:!0},files:null}});s.innerHTML=l.outerHTML})()},[e.elements,t]),(0,fe.jsxs)("div",{className:"single-library-item",children:[e.status==="published"&&(0,fe.jsx)("span",{className:"single-library-item-status",children:x("labels.statusPublished")}),(0,fe.jsx)("div",{ref:o,className:"single-library-item__svg"}),(0,fe.jsx)(Xe,{"aria-label":x("buttons.remove"),type:"button",icon:Ml,className:"single-library-item--remove",onClick:i.bind(null,e.id),title:x("buttons.remove")}),(0,fe.jsxs)("div",{style:{display:"flex",margin:"0.8rem 0",width:"100%",fontSize:"14px",fontWeight:500,flexDirection:"column"},children:[(0,fe.jsxs)("label",{style:{display:"flex",justifyContent:"space-between",flexDirection:"column"},children:[(0,fe.jsxs)("div",{style:{padding:"0.5em 0"},children:[(0,fe.jsx)("span",{style:{fontWeight:500,color:Ct.gray[6]},children:x("publishDialog.itemName")}),(0,fe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,fe.jsx)("input",{type:"text",ref:a,style:{width:"80%",padding:"0.2rem"},defaultValue:e.name,placeholder:"Item name",onChange:s=>{r(s.target.value,n)}})]}),(0,fe.jsx)("span",{className:"error",children:e.error})]})]})},TO=({onClose:e,libraryItems:t,appState:n,onSuccess:r,onError:i,updateItemsInStorage:o,onRemove:a})=>{let[s,l]=(0,oi.useState)({authorName:"",githubHandle:"",name:"",description:"",twitterHandle:"",website:""}),[c,d]=(0,oi.useState)(!1);(0,oi.useEffect)(()=>{let y=is.get(ts.PUBLISH_LIBRARY);y&&l(y)},[]);let[u,h]=(0,oi.useState)(t.slice());(0,oi.useEffect)(()=>{h(t.slice())},[t]);let m=y=>{l({...s,[y.target.name]:y.target.value})},p=async y=>{y.preventDefault(),d(!0);let w=[],T=!1;if(u.forEach(A=>{let _="";A.name||(_=x("publishDialog.errors.required"),T=!0),w.push({...A,error:_})}),T){h(w),d(!1);return}let k=await wO(u),M={type:ei.excalidrawLibrary,version:Bp.excalidrawLibrary,source:Z2,libraryItems:u},C=JSON.stringify(M,null,2),P=new Blob([C],{type:"application/json"}),R=new FormData;R.append("excalidrawLib",P),R.append("previewImage",k),R.append("previewImageType",k.type),R.append("title",s.name),R.append("authorName",s.authorName),R.append("githubHandle",s.githubHandle),R.append("name",s.name),R.append("description",s.description),R.append("twitterHandle",s.twitterHandle),R.append("website",s.website),fetch(`${Pt.VITE_APP_LIBRARY_BACKEND}/submit`,{method:"post",body:R}).then(A=>A.ok?A.json().then(({url:_})=>{is.delete(ts.PUBLISH_LIBRARY),r({url:_,authorName:s.authorName,items:u})}):A.json().catch(()=>{throw new Error(A.statusText||"something went wrong")}).then(_=>{throw new Error(_.message||A.statusText||"something went wrong")}),A=>{console.error(A),i(A),d(!1)}).catch(A=>{console.error(A),i(A),d(!1)})},f=()=>{let y=[];return u.forEach((w,T)=>{y.push((0,fe.jsx)("div",{className:"single-library-item-wrapper",children:(0,fe.jsx)(SO,{libItem:w,appState:n,index:T,onChange:(k,M)=>{let C=u.slice();C[M].name=k,h(C)},onRemove:a})},T))}),(0,fe.jsx)("div",{className:"selected-library-items",children:y})},g=(0,oi.useCallback)(()=>{o(u),is.set(ts.PUBLISH_LIBRARY,s),e()},[u,e,o,s]),b=!!t.length,v=t.some(y=>y.status==="published");return(0,fe.jsx)(ci,{onCloseRequest:g,title:x("publishDialog.title"),className:"publish-library",children:b?(0,fe.jsxs)("form",{onSubmit:p,children:[(0,fe.jsx)("div",{className:"publish-library-note",children:(0,fe.jsx)(yo,{i18nKey:"publishDialog.noteDescription",link:y=>(0,fe.jsx)("a",{href:"https://libraries.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:y})})}),(0,fe.jsx)("span",{className:"publish-library-note",children:(0,fe.jsx)(yo,{i18nKey:"publishDialog.noteGuidelines",link:y=>(0,fe.jsx)("a",{href:"https://github.com/excalidraw/excalidraw-libraries#guidelines",target:"_blank",rel:"noopener noreferrer",children:y})})}),(0,fe.jsx)("div",{className:"publish-library-note",children:x("publishDialog.noteItems")}),v&&(0,fe.jsx)("span",{className:"publish-library-note publish-library-warning",children:x("publishDialog.republishWarning")}),f(),(0,fe.jsxs)("div",{className:"publish-library__fields",children:[(0,fe.jsxs)("label",{children:[(0,fe.jsxs)("div",{children:[(0,fe.jsx)("span",{children:x("publishDialog.libraryName")}),(0,fe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,fe.jsx)("input",{type:"text",name:"name",required:!0,value:s.name,onChange:m,placeholder:x("publishDialog.placeholder.libraryName")})]}),(0,fe.jsxs)("label",{style:{alignItems:"flex-start"},children:[(0,fe.jsxs)("div",{children:[(0,fe.jsx)("span",{children:x("publishDialog.libraryDesc")}),(0,fe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,fe.jsx)("textarea",{name:"description",rows:4,required:!0,value:s.description,onChange:m,placeholder:x("publishDialog.placeholder.libraryDesc")})]}),(0,fe.jsxs)("label",{children:[(0,fe.jsxs)("div",{children:[(0,fe.jsx)("span",{children:x("publishDialog.authorName")}),(0,fe.jsx)("span",{"aria-hidden":"true",className:"required",children:"*"})]}),(0,fe.jsx)("input",{type:"text",name:"authorName",required:!0,value:s.authorName,onChange:m,placeholder:x("publishDialog.placeholder.authorName")})]}),(0,fe.jsxs)("label",{children:[(0,fe.jsx)("span",{children:x("publishDialog.githubUsername")}),(0,fe.jsx)("input",{type:"text",name:"githubHandle",value:s.githubHandle,onChange:m,placeholder:x("publishDialog.placeholder.githubHandle")})]}),(0,fe.jsxs)("label",{children:[(0,fe.jsx)("span",{children:x("publishDialog.twitterUsername")}),(0,fe.jsx)("input",{type:"text",name:"twitterHandle",value:s.twitterHandle,onChange:m,placeholder:x("publishDialog.placeholder.twitterHandle")})]}),(0,fe.jsxs)("label",{children:[(0,fe.jsx)("span",{children:x("publishDialog.website")}),(0,fe.jsx)("input",{type:"text",name:"website",pattern:"https?://.+",title:x("publishDialog.errors.website"),value:s.website,onChange:m,placeholder:x("publishDialog.placeholder.website")})]}),(0,fe.jsx)("span",{className:"publish-library-note",children:(0,fe.jsx)(yo,{i18nKey:"publishDialog.noteLicense",link:y=>(0,fe.jsx)("a",{href:"https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",children:y})})})]}),(0,fe.jsxs)("div",{className:"publish-library__buttons",children:[(0,fe.jsx)(bf,{label:x("buttons.cancel"),onClick:g,"data-testid":"cancel-clear-canvas-button"}),(0,fe.jsx)(bf,{type:"submit",label:x("buttons.submit"),actionType:"primary",isLoading:c})]})]}):(0,fe.jsx)("p",{style:{padding:"1em",textAlign:"center",fontWeight:500},children:x("publishDialog.atleastOneLibItem")})})},JH=TO}),P6,tG,hte=I(()=>{"use strict";D(),Re(),P6=({className:e="",children:t,onToggle:n,title:r,...i})=>{let o=Wn(),a=Y(`dropdown-menu-button ${e}`,"zen-mode-transition",{"dropdown-menu-button--mobile":o.editor.isMobile}).trim();return(0,eG.jsx)("button",{"data-prevent-outside-click":!0,className:a,onClick:n,type:"button","data-testid":"dropdown-menu-button",title:r,...i,children:t})},tG=P6,P6.displayName="DropdownMenuTrigger"}),j4,aI,sI,lI=I(()=>{"use strict";D(),ae(),ne(),j4=ry.default.createContext({}),aI=(e="",t=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?"dropdown-menu-item--selected":""}`.trim(),sI=(e,t)=>{let n=(0,ry.useContext)(j4);return Lf(e,r=>{let i=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});t?.(i),i.defaultPrevented||n.onSelect?.(i)})}}),CO,cI,nG=I(()=>{"use strict";D(),Re(),CO=({icon:e,shortcut:t,children:n})=>{let r=Wn();return(0,pl.jsxs)(pl.Fragment,{children:[(0,pl.jsx)("div",{className:"dropdown-menu-item__icon",children:e}),(0,pl.jsx)("div",{className:"dropdown-menu-item__text",children:n}),t&&!r.editor.isMobile&&(0,pl.jsx)("div",{className:"dropdown-menu-item__shortcut",children:t})]})},cI=CO}),Bg,D6,so,rG=I(()=>{"use strict";D(),lI(),nG(),Bg=({icon:e,onSelect:t,children:n,shortcut:r,className:i,selected:o,...a})=>{let s=sI(a.onClick,t);return(0,L2.jsx)("button",{...a,onClick:s,type:"button",className:aI(i,o),title:a.title??a["aria-label"],children:(0,L2.jsx)(cI,{icon:e,shortcut:r,children:n})})},Bg.displayName="DropdownMenuItem",D6=({children:e})=>(0,L2.jsx)("div",{style:{display:"inline-flex",marginLeft:"auto",padding:"2px 4px",background:"pink",borderRadius:6,fontSize:9,color:"black",fontFamily:"Cascadia, monospace"},children:e}),D6.displayName="DropdownMenuItemBadge",Bg.Badge=D6,so=Bg}),L6,oG,mte=I(()=>{"use strict";D(),L6=()=>(0,iG.jsx)("div",{style:{height:"1px",backgroundColor:"var(--default-border-color)",margin:".5rem 0"}}),oG=L6,L6.displayName="DropdownMenuSeparator"}),R6,aG,pte=I(()=>{"use strict";D(),R6=({children:e,className:t="",style:n,title:r})=>(0,iy.jsxs)("div",{className:`dropdown-menu-group ${t}`,style:n,children:[r&&(0,iy.jsx)("p",{className:"dropdown-menu-group-title",children:r}),e]}),aG=R6,R6.displayName="DropdownMenuGroup"}),O6,sG,fte=I(()=>{"use strict";D(),Jc(),Re(),ph(),lI(),NM(),Ce(),ae(),$M(),O6=({children:e,onClickOutside:t,className:n="",onSelect:r,style:i})=>{let o=Wn(),a=(0,oy.useRef)(null),s=jb({onClickOutside:t});OM(a,()=>{s.onClickOutside?.()}),(0,oy.useEffect)(()=>{let c=u=>{u.key===O.ESCAPE&&(u.stopImmediatePropagation(),s.onClickOutside?.())},d={capture:!0};return document.addEventListener("keydown",c,d),()=>{document.removeEventListener("keydown",c,d)}},[s]);let l=Y(`dropdown-menu ${n}`,{"dropdown-menu--mobile":o.editor.isMobile}).trim();return(0,Ep.jsx)(j4.Provider,{value:{onSelect:r},children:(0,Ep.jsx)("div",{ref:a,className:l,style:i,"data-testid":"dropdown-menu",children:o.editor.isMobile?(0,Ep.jsx)(ii.Col,{className:"dropdown-menu-container",children:e}):(0,Ep.jsx)(Co,{className:"dropdown-menu-container",padding:2,style:{zIndex:2},children:e})})})},O6.displayName="DropdownMenuContent",sG=O6}),N6,Np,lG=I(()=>{"use strict";D(),nG(),lI(),N6=({icon:e,shortcut:t,href:n,children:r,onSelect:i,className:o="",selected:a,...s})=>{let l=sI(s.onClick,i);return(0,U4.jsx)("a",{...s,href:n,target:"_blank",rel:"noreferrer",className:aI(o,a),title:s.title??s["aria-label"],onClick:l,children:(0,U4.jsx)(cI,{icon:e,shortcut:t,children:r})})},Np=N6,N6.displayName="DropdownMenuItemLink"}),MO,dG,gte=I(()=>{"use strict";D(),MO=({children:e,className:t="",selected:n,...r})=>(0,cG.jsx)("div",{...r,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${n?"dropdown-menu-item--selected":""}`.trim(),children:e}),dG=MO}),uG,hG,Ete=I(()=>{"use strict";D(),uG=e=>bp.default.Children.toArray(e).find(n=>bp.default.isValidElement(n)&&typeof n.type!="string"&&n?.type.displayName&&n.type.displayName==="DropdownMenuTrigger")||null,hG=e=>bp.default.Children.toArray(e).find(n=>bp.default.isValidElement(n)&&typeof n.type!="string"&&n?.type.displayName&&n.type.displayName==="DropdownMenuContent")||null}),bte=I(()=>{}),Qo,vt,sy=I(()=>{"use strict";D(),hte(),rG(),mte(),pte(),fte(),lG(),gte(),Ete(),bte(),Qo=({children:e,open:t})=>{let n=uG(e),r=hG(e);return(0,ay.jsxs)(ay.Fragment,{children:[n,t&&r]})},Qo.Trigger=tG,Qo.Content=sG,Qo.Item=so,Qo.ItemLink=Np,Qo.ItemCustom=dG,Qo.Group=aG,Qo.Separator=oG,vt=Qo,Qo.displayName="DropdownMenu"}),IO,kO,V4,yte=I(()=>{"use strict";D(),ce(),Yf(),Ln(),Re(),El(),Ru(),me(),On(),Tl(),ne(),QH(),ute(),zi(),sy(),dy(),Kn(),ey(),IO=(e,t)=>e.filter(n=>t.includes(n.id)),kO=({setAppState:e,selectedItems:t,library:n,onRemoveFromLibrary:r,resetLibrary:i,onSelectItems:o,appState:a,className:s})=>{let[l]=Ve(Lu,Gn),[c,d]=Ve(cy,Gn),u=()=>{let R=t.length?x("alerts.removeItemsFromsLibrary",{count:t.length}):x("alerts.resetLibrary"),A=t.length?x("confirmDialog.removeItemsFromLib"):x("confirmDialog.resetLibrary");return(0,bn.jsx)(oI,{onConfirm:()=>{t.length?r():i(),m(!1)},onCancel:()=>{m(!1)},title:A,children:(0,bn.jsx)("p",{children:R})})},[h,m]=(0,Ou.useState)(!1),p=!!t.length,f=p?l.libraryItems.filter(R=>t.includes(R.id)):l.libraryItems,g=x(p?"buttons.remove":"buttons.resetLibrary"),[b,v]=(0,Ou.useState)(!1),[y,w]=(0,Ou.useState)(null),T=(0,Ou.useCallback)(()=>(0,bn.jsxs)(ci,{onCloseRequest:()=>w(null),title:x("publishSuccessDialog.title"),className:"publish-library-success",size:"small",children:[(0,bn.jsx)("p",{children:(0,bn.jsx)(yo,{i18nKey:"publishSuccessDialog.content",authorName:y.authorName,link:R=>(0,bn.jsx)("a",{href:y?.url,target:"_blank",rel:"noopener noreferrer",children:R})})}),(0,bn.jsx)(Xe,{type:"button",title:x("buttons.close"),"aria-label":x("buttons.close"),label:x("buttons.close"),onClick:()=>w(null),"data-testid":"publish-library-success-close",className:"publish-library-success-close"})]}),[w,y]),k=(R,A)=>{v(!1),w({url:R.url,authorName:R.authorName});let _=A.slice();_.forEach($=>{t.includes($.id)&&($.status="published")}),n.setLibrary(_)},M=async()=>{try{await n.updateLibrary({libraryItems:bb({description:"Excalidraw library files"}),merge:!0,openLibraryMenu:!0})}catch(R){if(R?.name==="AbortError"){console.warn(R);return}e({errorMessage:x("errors.importLibraryError")})}},C=async()=>{let R=p?f:await n.getLatestLibrary();nB(R).catch(QS).catch(A=>{e({errorMessage:A.message})})},P=()=>(0,bn.jsxs)(vt,{open:c,children:[(0,bn.jsx)(vt.Trigger,{onToggle:()=>d(!c),children:XT}),(0,bn.jsxs)(vt.Content,{onClickOutside:()=>d(!1),onSelect:()=>d(!1),className:"library-menu",children:[!p&&(0,bn.jsx)(vt.Item,{onSelect:M,icon:Hf,"data-testid":"lib-dropdown--load",children:x("buttons.load")}),!!f.length&&(0,bn.jsx)(vt.Item,{onSelect:C,icon:Ju,"data-testid":"lib-dropdown--export",children:x("buttons.export")}),!!f.length&&(0,bn.jsx)(vt.Item,{onSelect:()=>m(!0),icon:bl,children:g}),p&&(0,bn.jsx)(vt.Item,{icon:iM,onSelect:()=>v(!0),"data-testid":"lib-dropdown--remove",children:x("buttons.publishLibrary")})]})]});return(0,bn.jsxs)("div",{className:Y("library-menu-dropdown-container",s),children:[P(),t.length>0&&(0,bn.jsx)("div",{className:"library-actions-counter",children:t.length}),h&&u(),b&&(0,bn.jsx)(JH,{onClose:()=>v(!1),libraryItems:IO(l.libraryItems,t),appState:a,onSuccess:R=>k(R,l.libraryItems),onError:R=>window.alert(R),updateItemsInStorage:()=>n.setLibrary(l.libraryItems),onRemove:R=>o(t.filter(A=>A!==R))}),y&&T()]})},V4=({selectedItems:e,onSelectItems:t,className:n})=>{let{library:r}=_l(),{clearLibraryCache:i,deleteItemsFromLibraryCache:o}=nI(),a=Rn(),s=Dn(),[l]=Ve(Lu,Gn),c=async d=>{let u=d.filter(h=>!e.includes(h.id));r.setLibrary(u).catch(()=>{s({errorMessage:x("alerts.errorRemovingFromLibrary")})}),o(e),t([])};return(0,bn.jsx)(kO,{appState:a,setAppState:s,selectedItems:e,onSelectItems:t,library:r,onRemoveFromLibrary:()=>c(l.libraryItems),resetLibrary:()=>{r.resetLibrary(),i()},className:n})}}),vte=I(()=>{}),mG,pG,xte=I(()=>{"use strict";D(),Re(),vte(),zM(),me(),ey(),mG=(0,kl.memo)(({id:e,elements:t,isPending:n,onClick:r,selected:i,onToggle:o,onDrag:a,svgCache:s})=>{let l=(0,kl.useRef)(null),c=UH(e,t,s);(0,kl.useEffect)(()=>{let p=l.current;if(p)return c&&(p.innerHTML=c.outerHTML),()=>{p.innerHTML=""}},[c]);let[d,u]=(0,kl.useState)(!1),h=Wn().editor.isMobile,m=n&&(0,kc.jsx)("div",{className:"library-unit__adder",children:ZT});return(0,kc.jsxs)("div",{className:Y("library-unit",{"library-unit__active":t,"library-unit--hover":t&&d,"library-unit--selected":i,"library-unit--skeleton":!c}),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[(0,kc.jsx)("div",{className:Y("library-unit__dragger",{"library-unit__pulse":!!n}),ref:l,draggable:!!t,onClick:t||n?p=>{e&&p.shiftKey?o(e,p):r(e)}:void 0,onDragStart:p=>{if(!e){p.preventDefault();return}u(!1),a(e,p)}}),m,e&&t&&(d||h||i)&&(0,kc.jsx)(mf,{checked:i,onChange:(p,f)=>o(e,f),className:"library-unit__checkbox"})]})}),pG=()=>(0,kc.jsx)("div",{className:"library-unit library-unit--skeleton"})});function wte(){return[!1,(0,ly.useCallback)(e=>e(),[])]}var fG,Ste=I(()=>{"use strict";D(),fG=ly.default.useTransition||wte}),Y4,R2,Tte=I(()=>{"use strict";D(),xte(),Ste(),Y4=({children:e})=>(0,Ac.jsx)("div",{className:"library-menu-items-container__grid",children:e}),R2=(0,fh.memo)(({items:e,onItemSelectToggle:t,onItemDrag:n,isItemSelected:r,onClick:i,svgCache:o,itemsRenderedPerBatch:a})=>{let[,s]=fG(),[l,c]=(0,fh.useState)(0);return(0,fh.useEffect)(()=>{l<e.length&&s(()=>{c(l+a)})},[l,e.length,s,a]),(0,Ac.jsx)(Ac.Fragment,{children:e.map((d,u)=>u<l?(0,Ac.jsx)(mG,{elements:d?.elements,isPending:!d?.id&&!!d?.elements,onClick:i,svgCache:o,id:d?.id,selected:r(d.id),onToggle:t,onDrag:n},d?.id??u):(0,Ac.jsx)(pG,{},u))})})}),AO,bG,Cte=I(()=>{"use strict";D(),AO=At(0),bG=e=>{let[t,n]=Ve(AO);return(0,gG.useEffect)(()=>{let{current:r}=e;if(!r)return;let i=(0,EG.default)(()=>{let{scrollTop:o}=r;n(o)},200);return r.addEventListener("scroll",i),()=>{i.cancel(),r.removeEventListener("scroll",i)}},[e,n]),t}}),Mte=I(()=>{});function Ite({isLoading:e,libraryItems:t,onAddToLibrary:n,onInsertLibraryItems:r,pendingElements:i,theme:o,id:a,libraryReturnUrl:s,onSelectItems:l,selectedItems:c}){let d=(0,lr.useRef)(null),u=bG(d);(0,lr.useEffect)(()=>{u>0&&d.current?.scrollTo(0,u)},[]);let{svgCache:h}=nI(),m=(0,lr.useMemo)(()=>t.filter(R=>R.status!=="published"),[t]),p=(0,lr.useMemo)(()=>t.filter(R=>R.status==="published"),[t]),f=!t.length&&!i.length,g=!i.length&&!m.length&&!p.length,[b,v]=(0,lr.useState)(null),y=(0,lr.useCallback)((R,A)=>{let _=!c.includes(R),$=[...m,...p];if(_){if(A.shiftKey&&b){let W=$.findIndex(ie=>ie.id===b),H=$.findIndex(ie=>ie.id===R);if(W===-1||H===-1){l([...c,R]);return}let K=Fe(c),Q=$.reduce((ie,X,F)=>((F>=W&&F<=H||K.has(X.id))&&ie.push(X.id),ie),[]);l(Q)}else l([...c,R]);v(R)}else v(null),l(c.filter(W=>W!==R))},[b,l,p,c,m]),w=(0,lr.useCallback)(R=>{let A;return c.includes(R)?A=t.filter(_=>c.includes(_.id)):A=t.filter(_=>_.id===R),A.map(_=>({..._,elements:ST(_.elements,{randomizeSeed:!0})}))},[t,c]),T=(0,lr.useCallback)((R,A)=>{A.dataTransfer.setData(ve.excalidrawlib,c4(w(R)))},[w]),k=(0,lr.useCallback)(R=>R?c.includes(R):!1,[c]),M=(0,lr.useCallback)(()=>{n(i)},[i,n]),C=(0,lr.useCallback)(R=>{R&&r(w(R))},[w,r]),P=h.size>=t.length?vG:yG;return(0,Gt.jsxs)("div",{className:"library-menu-items-container",style:i.length||m.length||p.length?{justifyContent:"flex-start"}:{borderBottom:0},children:[!g&&(0,Gt.jsx)(V4,{selectedItems:c,onSelectItems:l,className:"library-menu-dropdown-container--in-heading"}),(0,Gt.jsxs)(ii.Col,{className:"library-menu-items-container__items",align:"start",gap:1,style:{flex:p.length>0?1:"0 1 auto",marginBottom:0},ref:d,children:[(0,Gt.jsxs)(Gt.Fragment,{children:[!g&&(0,Gt.jsx)("div",{className:"library-menu-items-container__header",children:x("labels.personalLib")}),e&&(0,Gt.jsx)("div",{style:{position:"absolute",top:"var(--container-padding-y)",right:"var(--container-padding-x)",transform:"translateY(50%)"},children:(0,Gt.jsx)(oa,{})}),!i.length&&!m.length?(0,Gt.jsxs)("div",{className:"library-menu-items__no-items",children:[(0,Gt.jsx)("div",{className:"library-menu-items__no-items__label",children:x("library.noItems")}),(0,Gt.jsx)("div",{className:"library-menu-items__no-items__hint",children:p.length>0?x("library.hint_emptyPrivateLibrary"):x("library.hint_emptyLibrary")})]}):(0,Gt.jsxs)(Y4,{children:[i.length>0&&(0,Gt.jsx)(R2,{itemsRenderedPerBatch:P,items:[{id:null,elements:i}],onItemSelectToggle:y,onItemDrag:T,onClick:M,isItemSelected:k,svgCache:h}),(0,Gt.jsx)(R2,{itemsRenderedPerBatch:P,items:m,onItemSelectToggle:y,onItemDrag:T,onClick:C,isItemSelected:k,svgCache:h})]})]}),(0,Gt.jsxs)(Gt.Fragment,{children:[(p.length>0||i.length>0||m.length>0)&&(0,Gt.jsx)("div",{className:"library-menu-items-container__header library-menu-items-container__header--excal",children:x("labels.excalidrawLib")}),p.length>0?(0,Gt.jsx)(Y4,{children:(0,Gt.jsx)(R2,{itemsRenderedPerBatch:P,items:p,onItemSelectToggle:y,onItemDrag:T,onClick:C,isItemSelected:k,svgCache:h})}):m.length>0?(0,Gt.jsx)("div",{style:{margin:"1rem 0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",fontSize:".9rem"},children:x("library.noItems")}):null]}),f&&(0,Gt.jsx)(iI,{style:{padding:"16px 0",width:"100%"},id:a,libraryReturnUrl:s,theme:o,children:(0,Gt.jsx)(V4,{selectedItems:c,onSelectItems:l})})]})]})}var yG,vG,kte=I(()=>{"use strict";D(),El(),ce(),ne(),ph(),ae(),wl(),cs(),KH(),yte(),Tte(),Cte(),ey(),Mte(),yG=17,vG=64}),Ate=I(()=>{}),cy,$6,_O,PO,xG,dy=I(()=>{"use strict";D(),Ru(),ce(),sa(),kte(),li(),Ln(),wl(),Re(),pt(),Kn(),Ate(),KH(),ne(),ae(),cy=At(!1),$6=({children:e})=>(0,ki.jsx)("div",{className:"layer-ui__library",children:e}),_O=({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:n,setAppState:r,libraryReturnUrl:i,library:o,id:a,theme:s,selectedItems:l,onSelectItems:c})=>{let[d]=Ve(Lu,Gn),u=(0,ai.useCallback)(p=>{(async(f,g)=>{ot("element","addToLibrary","ui");for(let v of ZS)if(f.some(y=>y.type===v))return r({errorMessage:x(`errors.libraryElementTypeError.${v}`)});let b=[{status:"unpublished",elements:f,id:ni(),created:Date.now()},...g];n(),o.setLibrary(b).catch(()=>{r({errorMessage:x("alerts.errorAddingToLibrary")})})})(p,d.libraryItems)},[n,o,r,d.libraryItems]),h=(0,ai.useMemo)(()=>d.libraryItems,[d]);if(d.status==="loading"&&!d.isInitialized)return(0,ki.jsx)($6,{children:(0,ki.jsx)("div",{className:"layer-ui__library-message",children:(0,ki.jsxs)("div",{children:[(0,ki.jsx)(oa,{size:"2em"}),(0,ki.jsx)("span",{children:x("labels.libraryLoadingMessage")})]})})});let m=d.libraryItems.length>0||t.length>0;return(0,ki.jsxs)($6,{children:[(0,ki.jsx)(Ite,{isLoading:d.status==="loading",libraryItems:h,onAddToLibrary:u,onInsertLibraryItems:e,pendingElements:t,id:a,libraryReturnUrl:i,theme:s,onSelectItems:c,selectedItems:l}),m&&(0,ki.jsx)(iI,{className:"library-menu-control-buttons--at-bottom",style:{padding:"16px 12px 0 12px"},id:a,libraryReturnUrl:i,theme:s})]})},PO=(e,t)=>{let n=()=>st(t,e,{includeBoundTextElement:!0,includeElementsInFrames:!0}),r=(0,ai.useRef)(n()),i=(0,ai.useRef)(e),o=(0,ai.useRef)(t);return(!$r(e.selectedElementIds,i.current.selectedElementIds)||!$r(t,o.current))&&(r.current=n(),i.current=e,o.current=t),r.current},xG=()=>{let{library:e,id:t,onInsertElements:n}=_l(),r=Xf(),i=Rn(),o=Dn(),a=Kf(),[s,l]=(0,ai.useState)([]),c=(0,ai.useMemo)(()=>e,[e]),d=PO(i,a),u=(0,ai.useCallback)(m=>{n(rI(m))},[n]),h=(0,ai.useCallback)(()=>{o({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[o]);return(0,ki.jsx)(_O,{pendingElements:d,onInsertLibraryItems:u,onAddToLibrary:h,setAppState:o,libraryReturnUrl:r.libraryReturnUrl,library:c,id:t,theme:i.theme,selectedItems:s,onSelectItems:l})}});function _te(e){if(e&&typeof e=="number")return e;switch(e){case"small":return 550;case"wide":return 1024;case"regular":default:return 800}}var ci,zi=I(()=>{"use strict";D(),Jee(),Re(),Ce(),ete(),Jc(),rte(),ne(),dy(),Ln(),ce(),me(),ci=e=>{let[t,n]=BH(),[r]=(0,uy.useState)(document.activeElement),{id:i}=ua(),o=Wn().viewport.isMobile;(0,uy.useEffect)(()=>{if(!t)return;let c=K2(t);setTimeout(()=>{c.length>0&&e.autofocus!==!1&&(c[1]||c[0]).focus()});let d=u=>{if(u.key===O.TAB){let h=K2(t),{activeElement:m}=document,p=h.findIndex(f=>f===m);p===0&&u.shiftKey?(h[h.length-1].focus(),u.preventDefault()):p===h.length-1&&!u.shiftKey&&(h[0].focus(),u.preventDefault())}};return t.addEventListener("keydown",d),()=>t.removeEventListener("keydown",d)},[t,e.autofocus]);let a=Dn(),s=ka(cy,Gn),l=()=>{a({openMenu:null}),s(!1),r.focus(),e.onCloseRequest()};return(0,qs.jsx)(jH,{className:Y("Dialog",e.className,{"Dialog--fullscreen":o}),labelledBy:"dialog-title",maxWidth:_te(e.size),onCloseRequest:l,closeOnClickOutside:e.closeOnClickOutside,children:(0,qs.jsxs)(Co,{ref:n,children:[e.title&&(0,qs.jsx)("h2",{id:`${i}-dialog-title`,className:"Dialog__title",children:(0,qs.jsx)("span",{className:"Dialog__titleContent",children:e.title})}),o&&(0,qs.jsx)("button",{className:"Dialog__close",onClick:l,title:x("buttons.close"),"aria-label":x("buttons.close"),children:Ml}),(0,qs.jsx)("div",{className:"Dialog__content",children:e.children})]})})}}),Pte=I(()=>{}),Dte=I(()=>{}),ih,Zf=I(()=>{"use strict";D(),ne(),Dte(),ih=({type:e="button",onSelect:t,selected:n,children:r,className:i="",...o})=>(0,wG.jsx)("button",{onClick:Lf(o.onClick,a=>{t()}),type:e,className:Y("excalidraw-button",i,{selected:n}),...o,children:r})}),dI,SG=I(()=>{"use strict";D(),Pte(),Zf(),me(),dI=(0,da.forwardRef)(({onChange:e,label:t,fullWidth:n,placeholder:r,readonly:i,selectOnRender:o,onKeyDown:a,isRedacted:s=!1,...l},c)=>{let d=(0,da.useRef)(null);(0,da.useImperativeHandle)(c,()=>d.current),(0,da.useLayoutEffect)(()=>{o&&d.current?.select()},[o]);let[u,h]=(0,da.useState)(!1);return(0,Oc.jsxs)("div",{className:Y("ExcTextField",{"ExcTextField--fullWidth":n}),onClick:()=>{d.current?.focus()},children:[(0,Oc.jsx)("div",{className:"ExcTextField__label",children:t}),(0,Oc.jsxs)("div",{className:Y("ExcTextField__input",{"ExcTextField__input--readonly":i}),children:[(0,Oc.jsx)("input",{className:Y({"is-redacted":"value"in l&&l.value&&s&&!u}),readOnly:i,value:"value"in l?l.value:void 0,defaultValue:"defaultValue"in l?l.defaultValue:void 0,placeholder:r,ref:d,onChange:m=>e?.(m.target.value),onKeyDown:a}),s&&(0,Oc.jsx)(ih,{onSelect:()=>h(!u),style:{border:0,userSelect:"none"},children:u?uM:Wf})]})]})})}),DO,wr,gh=I(()=>{"use strict";D(),ae(),ce(),ne(),DO={toggleTheme:[V("Shift+Alt+D")],saveScene:[V("CtrlOrCmd+S")],loadScene:[V("CtrlOrCmd+O")],clearCanvas:[V("CtrlOrCmd+Delete")],imageExport:[V("CtrlOrCmd+Shift+E")],commandPalette:[V("CtrlOrCmd+/"),V("CtrlOrCmd+Shift+P")],cut:[V("CtrlOrCmd+X")],copy:[V("CtrlOrCmd+C")],paste:[V("CtrlOrCmd+V")],copyStyles:[V("CtrlOrCmd+Alt+C")],pasteStyles:[V("CtrlOrCmd+Alt+V")],selectAll:[V("CtrlOrCmd+A")],deleteSelectedElements:[V("Delete")],duplicateSelection:[V("CtrlOrCmd+D"),V(`Alt+${x("helpDialog.drag")}`)],sendBackward:[V("CtrlOrCmd+[")],bringForward:[V("CtrlOrCmd+]")],sendToBack:[V(go?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")],bringToFront:[V(go?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")],copyAsPng:[V("Shift+Alt+C")],copyAsSvg:[],group:[V("CtrlOrCmd+G")],ungroup:[V("CtrlOrCmd+Shift+G")],gridMode:[V("CtrlOrCmd+'")],zenMode:[V("Alt+Z")],objectsSnapMode:[V("Alt+S")],stats:[V("Alt+/")],addToLibrary:[],flipHorizontal:[V("Shift+H")],flipVertical:[V("Shift+V")],viewMode:[V("Alt+R")],hyperlink:[V("CtrlOrCmd+K")],toggleElementLock:[V("CtrlOrCmd+Shift+L")],resetZoom:[V("CtrlOrCmd+0")],zoomOut:[V("CtrlOrCmd+-")],zoomIn:[V("CtrlOrCmd++")],zoomToFitSelection:[V("Shift+3")],zoomToFit:[V("Shift+1")],zoomToFitSelectionInViewport:[V("Shift+2")],toggleEraserTool:[V("E")],toggleHandTool:[V("H")],setFrameAsActiveTool:[V("F")],saveFileToDisk:[V("CtrlOrCmd+S")],saveToActiveFile:[V("CtrlOrCmd+S")],toggleShortcuts:[V("?")]},wr=(e,t=0)=>{let n=DO[e];return n&&n.length>0?n[t]||n[0]:""}}),LO,RO,OO,NO,$O,FO,BO,zO,Z4,Lte=I(()=>{"use strict";D(),LO="\\u0300-\\u036f",RO="\\ufe20-\\ufe2f",OO="\\u20d0-\\u20ff",NO=LO+RO+OO,$O=`[${NO}]`,FO=RegExp($O,"g"),BO=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zO={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"E",\u00E6:"e",\u00DE:"T",\u00FE:"t",\u00DF:"s",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"I",\u0133:"i",\u0152:"E",\u0153:"e",\u0149:"n",\u017F:"s"},Z4=e=>e.replace(BO,t=>zO[t]||t).replace(FO,"")}),Nu,uI=I(()=>{"use strict";D(),Nu=({icon:e})=>(0,TG.jsx)("span",{style:{width:"1em",margin:"0 0.5ex 0 0.5ex",display:"inline-block",lineHeight:0,verticalAlign:"middle"},children:e})}),eb,CG,hI=I(()=>{"use strict";D(),me(),Ce(),eb=[{icon:eC,value:"selection",key:O.V,numericKey:O[1],fillable:!0},{icon:tC,value:"rectangle",key:O.R,numericKey:O[2],fillable:!0},{icon:nC,value:"diamond",key:O.D,numericKey:O[3],fillable:!0},{icon:rC,value:"ellipse",key:O.O,numericKey:O[4],fillable:!0},{icon:iC,value:"arrow",key:O.A,numericKey:O[5],fillable:!0},{icon:oC,value:"line",key:O.L,numericKey:O[6],fillable:!0},{icon:Bf,value:"freedraw",key:[O.P,O.X],numericKey:O[7],fillable:!1},{icon:sC,value:"text",key:O.T,numericKey:O[8],fillable:!1},{icon:lC,value:"image",key:null,numericKey:O[9],fillable:!1},{icon:cC,value:"eraser",key:O.E,numericKey:O[0],fillable:!1}],CG=e=>eb.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}),Rte=I(()=>{}),X4,dr,MG,Hi=I(()=>{"use strict";D(),X4=O2.default.createContext(null),dr=()=>O2.default.useContext(X4),MG=()=>O2.default.useMemo(()=>({MainMenuTunnel:oo(),WelcomeScreenMenuHintTunnel:oo(),WelcomeScreenToolbarHintTunnel:oo(),WelcomeScreenHelpHintTunnel:oo(),WelcomeScreenCenterTunnel:oo(),FooterCenterTunnel:oo(),DefaultSidebarTriggerTunnel:oo(),DefaultSidebarTabTriggersTunnel:oo(),OverwriteConfirmDialogTunnel:oo(),TTDDialogTriggerTunnel:oo(),jotaiScope:Symbol()}),[])}),K4,q4,mI,pI,kG,AG,_G,PG,hy=I(()=>{"use strict";D(),ce(),Re(),pt(),hI(),ne(),ph(),On(),pb(),li(),xe(),ko(),Qc(),Kt(),Rte(),sy(),me(),Ce(),Hi(),K4=(e,t)=>{let n=t[0]?.type||null;for(let r of t)if(r.type!==n){n=null;break}return tE(e.activeTool.type)&&e.activeTool.type!=="image"&&n!=="image"&&n!=="frame"&&n!=="magicframe"||t.some(r=>tE(r.type))},q4=(e,t)=>xc(e.activeTool.type)||t.some(n=>xc(n.type)),mI=({appState:e,elementsMap:t,renderAction:n})=>{let r=Mb(t,e),i=!1;r.length===2&&(as(r[0])||as(r[1]))&&(i=!0);let o=!!e.editingElement,a=Wn(),s=document.documentElement.getAttribute("dir")==="rtl",l=xc(e.activeTool.type)&&!mo(e.currentItemBackgroundColor)||r.some(d=>xc(d.type)&&!mo(d.backgroundColor)),c=r.length===1||i;return(0,Ee.jsxs)("div",{className:"panelColumn",children:[(0,Ee.jsx)("div",{children:K4(e,r)&&n("changeStrokeColor")}),q4(e,r)&&(0,Ee.jsx)("div",{children:n("changeBackgroundColor")}),l&&n("changeFillStyle"),(O5(e.activeTool.type)||r.some(d=>O5(d.type)))&&n("changeStrokeWidth"),(e.activeTool.type==="freedraw"||r.some(d=>d.type==="freedraw"))&&n("changeStrokeShape"),(N5(e.activeTool.type)||r.some(d=>N5(d.type)))&&(0,Ee.jsxs)(Ee.Fragment,{children:[n("changeStrokeStyle"),n("changeSloppiness")]}),(nE(e.activeTool.type)||r.some(d=>nE(d.type)))&&(0,Ee.jsx)(Ee.Fragment,{children:n("changeRoundness")}),(e.activeTool.type==="text"||r.some(he))&&(0,Ee.jsxs)(Ee.Fragment,{children:[n("changeFontSize"),n("changeFontFamily"),(e.activeTool.type==="text"||wF(r,t))&&n("changeTextAlign")]}),xF(r,t)&&n("changeVerticalAlign"),(Gp(e.activeTool.type)||r.some(d=>Gp(d.type)))&&(0,Ee.jsx)(Ee.Fragment,{children:n("changeArrowhead")}),n("changeOpacity"),(0,Ee.jsxs)("fieldset",{children:[(0,Ee.jsx)("legend",{children:x("labels.layers")}),(0,Ee.jsxs)("div",{className:"buttonList",children:[n("sendToBack"),n("sendBackward"),n("bringToFront"),n("bringForward")]})]}),r.length>1&&!i&&(0,Ee.jsxs)("fieldset",{children:[(0,Ee.jsx)("legend",{children:x("labels.align")}),(0,Ee.jsxs)("div",{className:"buttonList",children:[s?(0,Ee.jsxs)(Ee.Fragment,{children:[n("alignRight"),n("alignHorizontallyCentered"),n("alignLeft")]}):(0,Ee.jsxs)(Ee.Fragment,{children:[n("alignLeft"),n("alignHorizontallyCentered"),n("alignRight")]}),r.length>2&&n("distributeHorizontally"),(0,Ee.jsx)("div",{style:{flexBasis:"100%",height:0}}),(0,Ee.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:".5rem",marginTop:"-0.5rem"},children:[n("alignTop"),n("alignVerticallyCentered"),n("alignBottom"),r.length>2&&n("distributeVertically")]})]})]}),!o&&r.length>0&&(0,Ee.jsxs)("fieldset",{children:[(0,Ee.jsx)("legend",{children:x("labels.actions")}),(0,Ee.jsxs)("div",{className:"buttonList",children:[!a.editor.isMobile&&n("duplicateSelection"),!a.editor.isMobile&&n("deleteSelectedElements"),n("group"),n("ungroup"),c&&n("hyperlink")]})]})]})},pI=({activeTool:e,appState:t,app:n,UIOptions:r})=>{let[i,o]=(0,IG.useState)(!1),a=e.type==="frame",s=e.type==="laser",l=e.type==="embeddable",{TTDDialogTriggerTunnel:c}=dr();return(0,Ee.jsxs)(Ee.Fragment,{children:[eb.map(({value:d,icon:u,key:h,numericKey:m,fillable:p},f)=>{if(r.tools?.[d]===!1)return null;let g=x(`toolBar.${d}`),b=h&&Pc(typeof h=="string"?h:h[0]),v=b?`${b} ${x("helpDialog.or")} ${m}`:`${m}`;return(0,Ee.jsx)(Xe,{className:Y("Shape",{fillable:p}),type:"radio",icon:u,checked:e.type===d,name:"editor-current-shape",title:`${Pc(g)} \u2014 ${v}`,keyBindingLabel:m||b,"aria-label":Pc(g),"aria-keyshortcuts":v,"data-testid":`toolbar-${d}`,onPointerDown:({pointerType:y})=>{!t.penDetected&&y==="pen"&&n.togglePenMode(!0)},onChange:({pointerType:y})=>{t.activeTool.type!==d&&ot("toolbar",d,"ui"),d==="image"?n.setActiveTool({type:d,insertOnCanvasDirectly:y!=="mouse"}):n.setActiveTool({type:d})}},d)}),(0,Ee.jsx)("div",{className:"App-toolbar__divider"}),(0,Ee.jsxs)(vt,{open:i,children:[(0,Ee.jsxs)(vt.Trigger,{className:Y("App-toolbar__extra-tools-trigger",{"App-toolbar__extra-tools-trigger--selected":a||l||s&&!n.props.isCollaborating}),onToggle:()=>o(!i),title:x("toolBar.extraTools"),children:[cM,n.props.aiEnabled!==!1&&(0,Ee.jsx)("div",{style:{display:"inline-flex",marginLeft:"auto",padding:"2px 4px",borderRadius:6,fontSize:8,fontFamily:"Cascadia, monospace",position:"absolute",background:"pink",color:"black",bottom:3,right:4},children:"AI"})]}),(0,Ee.jsxs)(vt.Content,{onClickOutside:()=>o(!1),onSelect:()=>o(!1),className:"App-toolbar__extra-tools-dropdown",children:[(0,Ee.jsx)(vt.Item,{onSelect:()=>n.setActiveTool({type:"frame"}),icon:Rb,shortcut:O.F.toLocaleUpperCase(),"data-testid":"toolbar-frame",selected:a,children:x("toolBar.frame")}),(0,Ee.jsx)(vt.Item,{onSelect:()=>n.setActiveTool({type:"embeddable"}),icon:uC,"data-testid":"toolbar-embeddable",selected:l,children:x("toolBar.embeddable")}),(0,Ee.jsx)(vt.Item,{onSelect:()=>n.setActiveTool({type:"laser"}),icon:Nb,"data-testid":"toolbar-laser",selected:s,shortcut:O.K.toLocaleUpperCase(),children:x("toolBar.laser")}),(0,Ee.jsx)("div",{style:{margin:"6px 0",fontSize:14,fontWeight:600},children:"Generate"}),n.props.aiEnabled!==!1&&(0,Ee.jsx)(c.Out,{}),(0,Ee.jsx)(vt.Item,{onSelect:()=>n.setOpenDialog({name:"ttd",tab:"mermaid"}),icon:Ob,"data-testid":"toolbar-embeddable",children:x("toolBar.mermaidToExcalidraw")}),n.props.aiEnabled!==!1&&(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsxs)(vt.Item,{onSelect:()=>n.onMagicframeToolSelect(),icon:Gf,"data-testid":"toolbar-magicframe",children:[x("toolBar.magicframe"),(0,Ee.jsx)(vt.Item.Badge,{children:"AI"})]}),(0,Ee.jsx)(vt.Item,{onSelect:()=>{ot("ai","open-settings","d2c"),n.setOpenDialog({name:"settings",source:"settings",tab:"diagram-to-code"})},icon:sf,"data-testid":"toolbar-magicSettings",children:x("toolBar.magicSettings")})]})]})]})]})},kG=({renderAction:e,zoom:t})=>(0,Ee.jsx)(ii.Col,{gap:1,className:"zoom-actions",children:(0,Ee.jsxs)(ii.Row,{align:"center",children:[e("zoomOut"),e("resetZoom"),e("zoomIn")]})}),AG=({renderAction:e,className:t})=>(0,Ee.jsxs)("div",{className:`undo-redo-buttons ${t}`,children:[(0,Ee.jsx)("div",{className:"undo-button-container",children:(0,Ee.jsx)(xl,{label:x("buttons.undo"),children:e("undo")})}),(0,Ee.jsx)("div",{className:"redo-button-container",children:(0,Ee.jsxs)(xl,{label:x("buttons.redo"),children:[" ",e("redo")]})})]}),_G=({actionManager:e,showExitZenModeBtn:t})=>(0,Ee.jsx)("button",{className:Y("disable-zen-mode",{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(gf),children:x("buttons.exitZenMode")}),PG=({renderAction:e,className:t})=>(0,Ee.jsx)("div",{className:`finalize-button ${t}`,children:e("finalize",{size:"small"})})}),Q4,Ote=I(()=>{"use strict";D(),Q4=e=>{let t=(0,DG.useRef)({userFn:e});return t.current.userFn=e,t.current.stableFn||(t.current.stableFn=(...n)=>t.current.userFn(...n)),t.current.stableFn}}),yf,LG,py=I(()=>{"use strict";D(),ko(),ce(),Ln(),Re(),QH(),yf=At(null),LG=()=>{let[e,t]=Ve(yf,Gn),n=Or();return e&&e==="clearCanvas"?(0,my.jsx)(oI,{onConfirm:()=>{n.executeAction(Rc),t(null)},onCancel:()=>t(null),title:x("clearCanvasDialog.title"),children:(0,my.jsxs)("p",{className:"clear-canvas__content",children:[" ",x("alerts.clearReset")]})}):null}}),RG={};Pf(RG,{toggleTheme:()=>OG});var OG,Nte=I(()=>{"use strict";D(),ko(),OG={...eh,category:"App",label:"Toggle theme",perform:({actionManager:e})=>{e.executeAction(eh,"commandPalette")}}}),$te=I(()=>{});function Fte({customCommandPaletteItems:e}){let t=_l(),n=Rn(),r=Dn(),i=Xf(),o=Or(),[a,s]=Ve($G),[l,c]=(0,Oi.useState)(null),d=(0,Oi.useRef)(null),u=jb({uiAppState:n,customCommandPaletteItems:e,appProps:i});(0,Oi.useEffect)(()=>{let{uiAppState:k,customCommandPaletteItems:M,appProps:C}=u,P=$=>{let W="";return $.label&&(typeof $.label=="function"?W=x($.label(t.scene.getNonDeletedElements(),k,t)):W=x($.label)),W},R=$=>typeof $.icon=="function"?$.icon(k,t.scene.getNonDeletedElements()):$.icon,A=[],_=($,W,H)=>{let K={label:P($),icon:R($),category:W,shortcut:wr($.name),keywords:$.keywords,predicate:$.predicate,viewMode:$.viewMode,perform:()=>{o.executeAction($,"commandPalette")}};return H?H(K,$):K};if(k&&t.scene&&o){let $=[o.actions.group,o.actions.ungroup,o.actions.cut,o.actions.copy,o.actions.deleteSelectedElements,o.actions.copyStyles,o.actions.pasteStyles,o.actions.sendBackward,o.actions.sendToBack,o.actions.bringForward,o.actions.bringToFront,o.actions.alignTop,o.actions.alignBottom,o.actions.alignLeft,o.actions.alignRight,o.actions.alignVerticallyCentered,o.actions.alignHorizontallyCentered,o.actions.duplicateSelection,o.actions.flipHorizontal,o.actions.flipVertical,o.actions.zoomToFitSelection,o.actions.zoomToFitSelectionInViewport,o.actions.increaseFontSize,o.actions.decreaseFontSize,o.actions.toggleLinearEditor,qb].map(X=>_(X,tn.elements,(F,B)=>({...F,predicate:B.predicate?B.predicate:(U,G,Z,ee)=>st(U,G).length>0}))),W=[o.actions.toggleHandTool,o.actions.setFrameAsActiveTool].map(X=>_(X,tn.tools)),H=[o.actions.undo,o.actions.redo,o.actions.zoomIn,o.actions.zoomOut,o.actions.resetZoom,o.actions.zoomToFit,o.actions.zenMode,o.actions.viewMode,o.actions.objectsSnapMode,o.actions.toggleShortcuts,o.actions.selectAll,o.actions.toggleElementLock,o.actions.unlockAllElements,o.actions.stats].map(X=>_(X,tn.editor)),K=[o.actions.saveToActiveFile,o.actions.saveFileToDisk,o.actions.copyAsPng,o.actions.copyAsSvg].map(X=>_(X,tn.export));A=[...$,...H,{label:P(Rc),icon:R(Rc),shortcut:wr(Rc.name),category:tn.editor,keywords:["delete","destroy"],viewMode:!1,perform:()=>{xo.set(yf,"clearCanvas")}},{label:x("buttons.exportImage"),category:tn.export,icon:_b,shortcut:wr("imageExport"),keywords:["export","image","png","jpeg","svg","clipboard","picture"],perform:()=>{r({openDialog:{name:"imageExport"}})}},...K];let Q=[{label:x("toolBar.library"),category:tn.app,icon:Ib,viewMode:!1,perform:()=>{k.openSidebar?r({openSidebar:null}):r({openSidebar:{name:es.name,tab:es.defaultTab}})}},{label:x("labels.changeStroke"),keywords:["color","outline"],category:tn.elements,icon:Lp,viewMode:!1,predicate:(X,F)=>{let B=st(X,F);return B.length>0&&K4(F,B)},perform:()=>{r(X=>({openMenu:X.openMenu==="shape"?null:"shape",openPopup:"elementStroke"}))}},{label:x("labels.changeBackground"),keywords:["color","fill"],icon:Lp,category:tn.elements,viewMode:!1,predicate:(X,F)=>{let B=st(X,F);return B.length>0&&q4(F,B)},perform:()=>{r(X=>({openMenu:X.openMenu==="shape"?null:"shape",openPopup:"elementBackground"}))}},{label:x("labels.canvasBackground"),keywords:["color"],icon:Lp,category:tn.editor,viewMode:!1,perform:()=>{r(X=>({openMenu:X.openMenu==="canvas"?null:"canvas",openPopup:"canvasBackground"}))}},...eb.reduce((X,F)=>{let{value:B,icon:U,key:G,numericKey:Z}=F;if(C.UIOptions.tools?.[B]===!1)return X;let ee=G&&Pc(typeof G=="string"?G:G[0])||Z,te={label:x(`toolBar.${B}`),category:tn.tools,shortcut:ee,icon:U,keywords:["toolbar"],viewMode:!1,perform:({event:de})=>{B==="image"?t.setActiveTool({type:B,insertOnCanvasDirectly:de.type==="keydown"}):t.setActiveTool({type:B})}};return X.push(te),X},[]),...W,{label:x("toolBar.lock"),category:tn.tools,icon:k.activeTool.locked?Ff:Qu,shortcut:O.Q.toLocaleUpperCase(),viewMode:!1,perform:()=>{t.toggleLock()}},{label:`${x("labels.textToDiagram")}...`,category:tn.tools,icon:mM,viewMode:!1,predicate:C.aiEnabled,perform:()=>{r(X=>({...X,openDialog:{name:"ttd",tab:"text-to-diagram"}}))}},{label:`${x("toolBar.mermaidToExcalidraw")}...`,category:tn.tools,icon:Ob,viewMode:!1,predicate:C.aiEnabled,perform:()=>{r(X=>({...X,openDialog:{name:"ttd",tab:"mermaid"}}))}}],ie=[...A,...Q,...M||[]].map(X=>({...X,icon:X.icon||Fb,order:X.order??FG(X.category),haystack:`${Z4(X.label)} ${X.keywords?.join(" ")||""}`}));c(ie),s(ie.find(X=>X.label===a?.label)??null)}},[u,t,o,c,a?.label,s,r]);let[h,m]=(0,Oi.useState)(""),[p,f]=(0,Oi.useState)(null),[g,b]=(0,Oi.useState)({}),v=k=>{r({openDialog:null},k),m("")},y=(k,M)=>{n.openDialog?.name==="commandPalette"&&(M.stopPropagation(),M.preventDefault(),document.body.classList.add("excalidraw-animations-disabled"),v(()=>{k.perform({actionManager:o,event:M}),s(k),requestAnimationFrame(()=>{document.body.classList.remove("excalidraw-animations-disabled")})}))},w=Q4(k=>k.viewMode===!1&&n.viewModeEnabled?!1:typeof k.predicate=="function"?k.predicate(t.scene.getNonDeletedElements(),n,i,t):k.predicate===void 0||k.predicate),T=Q4(k=>{let M=Ha(k.target)||J4(k)||k.key===O.ESCAPE;if(M&&k.key!==O.ARROW_UP&&k.key!==O.ARROW_DOWN&&k.key!==O.ENTER)return;let C=Object.values(g).flat(),P=a&&!h&&w(a);if(k.key===O.ARROW_UP){k.preventDefault();let R=C.findIndex($=>$.label===p?.label);if(P){if(R===0){f(a);return}if(p===a){let $=C[C.length-1];$&&f($);return}}let A;R===-1?A=C.length-1:A=R===0?C.length-1:(R-1)%C.length;let _=C[A];_&&f(_);return}if(k.key===O.ARROW_DOWN){k.preventDefault();let R=C.findIndex($=>$.label===p?.label);if(P){if(!p||R===C.length-1){f(a);return}if(p===a){let $=C[0];$&&f($);return}}let A=(R+1)%C.length,_=C[A];_&&f(_);return}if(k.key===O.ENTER&&p&&setTimeout(()=>{y(p,k)}),!M){if(k.stopPropagation(),/^[a-zA-Z0-9]$/.test(k.key)){d?.current?.focus();return}k.preventDefault()}});return(0,Oi.useEffect)(()=>(window.addEventListener("keydown",T,{capture:!0}),()=>window.removeEventListener("keydown",T,{capture:!0})),[T]),(0,Oi.useEffect)(()=>{if(!l)return;let k=R=>{let A={};for(let _ of R)A[_.category]?A[_.category].push(_):A[_.category]=[_];return A},M=l.filter(w).sort((R,A)=>R.order-A.order),C=!h&&a&&w(a);if(!h){b(k(C?M.filter(R=>R.label!==a?.label):M)),f(C?a:M[0]||null);return}let P=Z4(h.replace(/[<>-_| ]/g,""));M=NG.default.filter(P,M,{extract:R=>R.haystack}).sort((R,A)=>A.score-R.score).map(R=>R.original),b(k(M)),f(M[0]??null)},[h,l,w,a]),(0,_t.jsxs)(ci,{onCloseRequest:()=>v(),closeOnClickOutside:!0,title:!1,size:720,autofocus:!0,className:"command-palette-dialog",children:[(0,_t.jsx)(dI,{value:h,placeholder:x("commandPalette.search.placeholder"),onChange:k=>{m(k)},selectOnRender:!0,ref:d}),!t.device.viewport.isMobile&&(0,_t.jsxs)("div",{className:"shortcuts-wrapper",children:[(0,_t.jsx)($p,{shortcut:"\u2191\u2193",children:x("commandPalette.shortcuts.select")}),(0,_t.jsx)($p,{shortcut:"\u21B5",children:x("commandPalette.shortcuts.confirm")}),(0,_t.jsx)($p,{shortcut:V("Esc"),children:x("commandPalette.shortcuts.close")})]}),(0,_t.jsxs)("div",{className:"commands",children:[a&&!h&&(0,_t.jsxs)("div",{className:"command-category",children:[(0,_t.jsxs)("div",{className:"command-category-title",children:[x("commandPalette.recents"),(0,_t.jsx)("div",{className:"icon",style:{marginLeft:"6px"},children:pM})]}),(0,_t.jsx)(eS,{command:a,isSelected:a.label===p?.label,onClick:k=>y(a,k),disabled:!w(a),onMouseMove:()=>f(a),showShortcut:!t.device.viewport.isMobile,appState:n})]}),Object.keys(g).length>0?Object.keys(g).map((k,M)=>(0,_t.jsxs)("div",{className:"command-category",children:[(0,_t.jsx)("div",{className:"command-category-title",children:k}),g[k].map(C=>(0,_t.jsx)(eS,{command:C,isSelected:C.label===p?.label,onClick:P=>y(C,P),onMouseMove:()=>f(C),showShortcut:!t.device.viewport.isMobile,appState:n},C.label))]},k)):l?(0,_t.jsxs)("div",{className:"no-match",children:[(0,_t.jsx)("div",{className:"icon",children:$b})," ",x("commandPalette.search.noMatch")]}):null]})]})}var $G,tn,FG,$p,J4,Bte,eS,BG=I(()=>{"use strict";D(),Re(),Ce(),zi(),SG(),pt(),ce(),gh(),ae(),me(),Kn(),ne(),Lte(),uI(),hI(),hy(),Ote(),ko(),Ln(),py(),Nte(),li(),$M(),$te(),$G=At(null),tn={app:"App",export:"Export",tools:"Tools",editor:"Editor",elements:"Elements",links:"Links"},FG=e=>{switch(e){case tn.app:return 1;case tn.export:return 2;case tn.editor:return 3;case tn.tools:return 4;case tn.elements:return 5;case tn.links:return 6;default:return 10}},$p=({shortcut:e,className:t,children:n})=>{let r=e.replace("++","+$").split("+");return(0,_t.jsxs)("div",{className:Y("shortcut",t),children:[r.map((i,o)=>(0,_t.jsx)("div",{className:"shortcut-wrapper",children:(0,_t.jsx)("div",{className:"shortcut-key",children:i==="$"?"+":i})},i)),(0,_t.jsx)("div",{className:"shortcut-desc",children:n})]})},J4=e=>!e.altKey&&e[O.CTRL_OR_CMD]&&(e.shiftKey&&e.key.toLowerCase()===O.P||e.key===O.SLASH),Bte=Object.assign(e=>{let t=Rn(),n=Dn();return(0,Oi.useEffect)(()=>{let r=i=>{J4(i)&&(i.preventDefault(),i.stopPropagation(),n(o=>{let a=o.openDialog?.name==="commandPalette"?null:{name:"commandPalette"};return a&&ot("command_palette","open","shortcut"),{openDialog:a}}))};return window.addEventListener("keydown",r,{capture:!0}),()=>window.removeEventListener("keydown",r,{capture:!0})},[n]),t.openDialog?.name!=="commandPalette"?null:(0,_t.jsx)(Fte,{...e})},{defaultItems:RG}),eS=({command:e,isSelected:t,disabled:n,onMouseMove:r,onClick:i,showShortcut:o,appState:a})=>{let s=()=>{};return(0,_t.jsxs)("div",{className:Y("command-item",{"item-selected":t,"item-disabled":n}),ref:l=>{t&&!n&&l?.scrollIntoView?.({block:"nearest"})},onClick:n?s:i,onMouseMove:n?s:r,title:n?x("commandPalette.itemNotAvailable"):"",children:[(0,_t.jsxs)("div",{className:"name",children:[e.icon&&(0,_t.jsx)(Nu,{icon:typeof e.icon=="function"?e.icon(a):e.icon}),e.label]}),o&&e.shortcut&&(0,_t.jsx)($p,{shortcut:e.shortcut})]})}}),fI,zte=I(()=>{"use strict";D(),BG(),Tr(),xe(),xt(),fI=oe({name:"toggleLinearEditor",category:tn.elements,label:(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];return t.editingLinearElement?.elementId===r?.id?"labels.lineEditor.exit":"labels.lineEditor.edit"},trackEvent:{category:"element"},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(i.length===1&&Ne(i[0]))},perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0],o=t.editingLinearElement?.elementId===i.id?null:new pe(i);return{appState:{...t,editingLinearElement:o},commitToHistory:!1}}})}),Hte={};Pf(Hte,{actionAddToLibrary:()=>XM,actionAlignBottom:()=>vH,actionAlignHorizontallyCentered:()=>TH,actionAlignLeft:()=>xH,actionAlignRight:()=>wH,actionAlignTop:()=>yH,actionAlignVerticallyCentered:()=>SH,actionBindText:()=>eI,actionBringForward:()=>kM,actionBringToFront:()=>_M,actionChangeBackgroundColor:()=>Gz,actionChangeExportBackground:()=>GM,actionChangeFillStyle:()=>Wz,actionChangeFontFamily:()=>Zz,actionChangeFontSize:()=>Yz,actionChangeOpacity:()=>Vz,actionChangeProjectName:()=>HM,actionChangeSloppiness:()=>Uz,actionChangeStrokeColor:()=>Hz,actionChangeStrokeWidth:()=>jz,actionChangeTextAlign:()=>Xz,actionChangeVerticalAlign:()=>Kz,actionChangeViewBackgroundColor:()=>eH,actionClearCanvas:()=>Rc,actionCopy:()=>Du,actionCopyAsPng:()=>qE,actionCopyAsSvg:()=>KE,actionCopyStyles:()=>jM,actionCut:()=>XE,actionDeleteSelected:()=>Bb,actionDuplicateSelection:()=>DM,actionFinalize:()=>Ci,actionFlipHorizontal:()=>KM,actionFlipVertical:()=>qM,actionGoToCollaborator:()=>EH,actionGroup:()=>VM,actionLink:()=>qb,actionLoadScene:()=>pf,actionPasteStyles:()=>UM,actionResetZoom:()=>tH,actionSaveFileToDisk:()=>Zb,actionSaveToActiveFile:()=>ZE,actionSelectAll:()=>PM,actionSendBackward:()=>IM,actionSendToBack:()=>AM,actionShortcuts:()=>Vf,actionToggleCanvasMenu:()=>uH,actionToggleEditMenu:()=>hH,actionToggleElementLock:()=>tI,actionToggleGridMode:()=>JE,actionToggleLinearEditor:()=>fI,actionToggleObjectsSnapMode:()=>QM,actionToggleStats:()=>th,actionToggleTheme:()=>eh,actionToggleZenMode:()=>gf,actionUnbindText:()=>JM,actionUngroup:()=>YM,actionZoomIn:()=>VE,actionZoomOut:()=>YE,actionZoomToFit:()=>nH,copyText:()=>QE,distributeHorizontally:()=>MH,distributeVertically:()=>IH});var ko=I(()=>{"use strict";D(),uz(),nee(),ree(),oee(),qz(),Yb(),Iee(),Xb(),Ree(),Oee(),Nee(),Hee(),Gee(),jee(),Vee(),Yee(),kH(),Zee(),Xee(),Kee(),AH(),PH(),Qee(),FH(),zte()}),F6,zG,HG,Gte=I(()=>{"use strict";D(),me(),On(),ce(),Ce(),wt(),la(),ne(),ae(),F6=(e,t,n)=>{if(!t.multiElement&&!t.resizingElement&&!t.editingElement&&!t.draggingElement){let r=n();if(r===null)return{commitToHistory:!1};let i=Fe(e),o=r.elements,a=Fe(o),s=e.filter(c=>!a.has(c.id)),l=o.map(c=>Le(i.get(c.id)||c,c)).concat(s.map(c=>Le(c,{isDeleted:!0})));return gb(l,s),{elements:l,appState:{...t,...r.appState},commitToHistory:!1,syncHistory:!0}}return{commitToHistory:!1}},zG=e=>({name:"undo",label:"buttons.undo",icon:CE,trackEvent:{category:"history"},viewMode:!1,perform:(t,n)=>F6(t,n,()=>e.undoOnce()),keyTest:t=>t[O.CTRL_OR_CMD]&&t.key.toLowerCase()===O.Z&&!t.shiftKey,PanelComponent:({updateData:t,data:n})=>(0,tS.jsx)(Xe,{type:"button",icon:CE,"aria-label":x("buttons.undo"),onClick:t,size:n?.size||"medium"}),commitToHistory:()=>!1}),HG=e=>({name:"redo",label:"buttons.redo",icon:ME,trackEvent:{category:"history"},viewMode:!1,perform:(t,n)=>F6(t,n,()=>e.redoOnce()),keyTest:t=>t[O.CTRL_OR_CMD]&&t.shiftKey&&t.key.toLowerCase()===O.Z||jS&&t.ctrlKey&&!t.shiftKey&&t.key===O.Y,PanelComponent:({updateData:t,data:n})=>(0,tS.jsx)(Xe,{type:"button",icon:ME,"aria-label":x("buttons.redo"),onClick:t,size:n?.size||"medium"}),commitToHistory:()=>!1})}),zg,nS,Wte=I(()=>{"use strict";D(),li(),ne(),zg=(e,t,n,r,i,o)=>{if(e.trackEvent)try{typeof e.trackEvent=="object"&&(!e.trackEvent.predicate||e.trackEvent.predicate(n,r,o))&&ot(e.trackEvent.category,e.trackEvent.action||e.name,`${t} (${i.device.editor.isMobile?"mobile":"desktop"})`)}catch(a){console.error("error while logging action:",a)}},nS=class{actions={};updater;getAppState;getElementsIncludingDeleted;app;constructor(e,t,n,r){this.updater=i=>{if(ch(i))i.then(o=>e(o));else return e(i)},this.getAppState=t,this.getElementsIncludingDeleted=n,this.app=r}registerAction(e){this.actions[e.name]=e}registerAll(e){e.forEach(t=>this.registerAction(t))}handleKeyDown(e){let t=this.app.props.UIOptions.canvasActions,n=Object.values(this.actions).sort((s,l)=>(l.keyPriority||0)-(s.keyPriority||0)).filter(s=>(s.name in t?t[s.name]:!0)&&s.keyTest&&s.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(),o=this.getAppState(),a=null;return zg(r,"keyboard",o,i,this.app,null),e.preventDefault(),e.stopPropagation(),this.updater(n[0].perform(i,o,a,this.app)),!0}executeAction(e,t="api",n=null){let r=this.getElementsIncludingDeleted(),i=this.getAppState();zg(e,t,i,r,this.app,n),this.updater(e.perform(r,i,n,this.app))}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 r=this.actions[e],i=r.PanelComponent;i.displayName="PanelComponent";let o=this.getElementsIncludingDeleted(),a=this.getAppState(),s=l=>{zg(r,"ui",a,o,this.app,l),this.updater(r.perform(this.getElementsIncludingDeleted(),this.getAppState(),l,this.app))};return(0,GG.jsx)(i,{elements:this.getElementsIncludingDeleted(),appState:this.getAppState(),updateData:s,appProps:this.app.props,app:this.app,data:t})}return null};isActionEnabled=e=>{let t=this.getElementsIncludingDeleted(),n=this.getAppState();return!e.predicate||e.predicate(t,n,this.app.props,this.app)}}}),rS,iS,B6,jte=I(()=>{"use strict";D(),rS=e=>{let t=Array.from(e.values());return{x:B6(t,n=>n.x)/t.length,y:B6(t,n=>n.y)/t.length}},iS=([e,t])=>Math.hypot(e.x-t.x,e.y-t.y),B6=(e,t)=>e.reduce((n,r)=>n+t(r),0)}),HO,GO,oS,Ute=I(()=>{"use strict";D(),xe(),cs(),HO=e=>({selectedElementIds:e.selectedElementIds,selectedGroupIds:e.selectedGroupIds,viewBackgroundColor:e.viewBackgroundColor,editingLinearElement:e.editingLinearElement,editingGroupId:e.editingGroupId,name:e.name}),GO=class{elementCache=new Map;recording=!0;stateHistory=[];redoStack=[];lastEntry=null;hydrateHistoryEntry({appState:e,elements:t}){return{appState:JSON.parse(e),elements:t.map(n=>{let r=this.elementCache.get(n.id)?.get(n.versionNonce);if(!r)throw new Error(`Element not found: ${n.id}:${n.versionNonce}`);return r})}}dehydrateHistoryEntry({appState:e,elements:t}){return{appState:JSON.stringify(e),elements:t.map(n=>{this.elementCache.has(n.id)||this.elementCache.set(n.id,new Map);let r=this.elementCache.get(n.id);return r.has(n.versionNonce)||r.set(n.versionNonce,Vu(n)),{id:n.id,versionNonce:n.versionNonce}})}}getSnapshotForTest(){return{recording:this.recording,stateHistory:this.stateHistory.map(e=>this.hydrateHistoryEntry(e)),redoStack:this.redoStack.map(e=>this.hydrateHistoryEntry(e))}}clear(){this.stateHistory.length=0,this.redoStack.length=0,this.lastEntry=null,this.elementCache.clear()}generateEntry=(e,t)=>this.dehydrateHistoryEntry({appState:HO(e),elements:t.reduce((n,r)=>{if(Ne(r)&&e.multiElement&&e.multiElement.id===r.id){if(e.multiElement&&e.multiElement.id===r.id&&r.points.length<2)return n;n.push({...r,points:r.lastCommittedPoint!==r.points[r.points.length-1]?r.points.slice(0,-1):r.points})}else n.push(r);return n},[])});shouldCreateEntry(e){let{lastEntry:t}=this;if(!t||e.elements.length!==t.elements.length)return!0;for(let r=e.elements.length-1;r>-1;r--){let i=e.elements[r],o=t.elements[r];if(!i||!o||i.id!==o.id||i.versionNonce!==o.versionNonce)return!0}let n;for(n in e.appState)if(!(n==="editingLinearElement"&&e.appState[n]?.elementId===t.appState[n]?.elementId)&&!(n==="selectedElementIds"||n==="selectedGroupIds")&&e.appState[n]!==t.appState[n])return!0;return!1}pushEntry(e,t){let n=this.generateEntry(e,t),r=this.hydrateHistoryEntry(n);if(r){if(!this.shouldCreateEntry(r))return;this.stateHistory.push(n),this.lastEntry=r,this.clearRedoStack()}}clearRedoStack(){this.redoStack.splice(0,this.redoStack.length)}redoOnce(){if(this.redoStack.length===0)return null;let e=this.redoStack.pop();return e!==void 0?(this.stateHistory.push(e),this.hydrateHistoryEntry(e)):null}undoOnce(){if(this.stateHistory.length===1)return null;let e=this.stateHistory.pop(),t=this.stateHistory[this.stateHistory.length-1];return e!==void 0?(this.redoStack.push(e),this.hydrateHistoryEntry(t)):null}setCurrentState(e,t){this.lastEntry=this.hydrateHistoryEntry(this.generateEntry(e,t))}resumeRecording(){this.recording=!0}record(e,t){this.recording&&(this.pushEntry(e,t),this.recording=!1)}},oS=GO}),Vte=I(()=>{}),br,jG,Yte=I(()=>{"use strict";D(),zz(),ce(),Vte(),gh(),Re(),br="separator",jG=WG.default.memo(({actionManager:e,items:t,top:n,left:r,onClose:i})=>{let o=wy(),a=Kf(),s=t.reduce((l,c)=>(c&&(c===br||!c.predicate||c.predicate(a,o,e.app.props,e.app))&&l.push(c),l),[]);return(0,Ba.jsx)(BM,{onCloseRequest:()=>{i()},top:n,left:r,fitInViewport:!0,offsetLeft:o.offsetLeft,offsetTop:o.offsetTop,viewportWidth:o.width,viewportHeight:o.height,children:(0,Ba.jsx)("ul",{className:"context-menu",onContextMenu:l=>l.preventDefault(),children:s.map((l,c)=>{if(l===br)return!s[c-1]||s[c-1]===br?null:(0,Ba.jsx)("hr",{className:"context-menu-item-separator"},c);let d=l.name,u="";return l.label&&(typeof l.label=="function"?u=x(l.label(a,o,e.app)):u=x(l.label)),(0,Ba.jsx)("li",{"data-testid":d,onClick:()=>{i(()=>{e.executeAction(l,"contextMenu")})},children:(0,Ba.jsxs)("button",{className:Y("context-menu-item",{dangerous:d==="deleteSelectedElements",checkmark:l.checked?.(o)}),children:[(0,Ba.jsx)("div",{className:"context-menu-item__label",children:u}),(0,Ba.jsx)("kbd",{className:"context-menu-item__shortcut",children:d?wr(d):""})]})},c)})})})})}),UG,Zte=I(()=>{"use strict";D(),ce(),zi(),Re(),UG=({children:e,onClose:t})=>{let[n,r]=(0,fy.useState)(!!e),{container:i}=ua(),o=fy.default.useCallback(()=>{r(!1),t&&t(),i?.focus()},[t,i]);return(0,$u.jsx)($u.Fragment,{children:n&&(0,$u.jsx)(ci,{size:"small",onCloseRequest:o,title:x("errorDialog.title"),children:(0,$u.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:e})})})}}),Xte=I(()=>{}),gI,VG=I(()=>{"use strict";D(),Xte(),gI=function({onChange:e,value:t,choices:n,name:r}){return(0,vf.jsx)("div",{className:"RadioGroup",children:n.map(i=>(0,vf.jsxs)("div",{className:Y("RadioGroup__choice",{active:i.value===t}),title:i.ariaLabel,children:[(0,vf.jsx)("input",{name:r,type:"radio",checked:i.value===t,onChange:()=>e(i.value),"aria-label":i.ariaLabel}),i.label]},String(i.value)))})}}),Kte=I(()=>{}),yp,qte=I(()=>{"use strict";D(),Kte(),yp=({title:e,name:t,checked:n,onChange:r,disabled:i=!1})=>(0,aS.jsx)("div",{className:Y("Switch",{toggled:n,disabled:i}),children:(0,aS.jsx)("input",{name:t,id:t,title:e,type:"checkbox",checked:n,disabled:i,onChange:()=>r(!n),onKeyDown:o=>{o.key===" "&&r(!n)}})})}),Qte=I(()=>{}),Jte=I(()=>{}),Nc,Ey=I(()=>{"use strict";D(),Jte(),uh(),wl(),ne(),Nc=(0,gy.forwardRef)(({children:e,icon:t,onClick:n,label:r,variant:i="filled",color:o="primary",size:a="medium",fullWidth:s,className:l},c)=>{let[d,u]=(0,gy.useState)(!1),h=async m=>{let p=n?.(m);if(ch(p))try{u(!0),await p}catch(f){if(f instanceof Nf)console.warn(f);else throw f}finally{u(!1)}};return(0,Fu.jsx)("button",{className:Y("ExcButton",`ExcButton--color-${o}`,`ExcButton--variant-${i}`,`ExcButton--size-${a}`,{"ExcButton--fullWidth":s},l),onClick:h,type:"button","aria-label":r,ref:c,disabled:d,children:(0,Fu.jsxs)("div",{className:"ExcButton__contents",children:[d&&(0,Fu.jsx)(oa,{}),t&&(0,Fu.jsx)("div",{className:"ExcButton__icon","aria-hidden":!0,children:t}),i!=="icon"&&(e??r)]})})})}),WO,jO,UO,Qd,YG,ene=I(()=>{"use strict";D(),Xb(),Xc(),ae(),si(),Tl(),ce(),pt(),mh(),me(),zi(),VG(),qte(),Qc(),Qte(),Ey(),ne(),Uc(),WO="filter"in document.createElement("canvas").getContext("2d"),jO=()=>(0,Ze.jsxs)("div",{children:[(0,Ze.jsx)("h3",{children:x("canvasError.cannotShowPreview")}),(0,Ze.jsx)("p",{children:(0,Ze.jsx)("span",{children:x("canvasError.canvasTooBig")})}),(0,Ze.jsxs)("em",{children:["(",x("canvasError.canvasTooBigTip"),")"]})]}),UO=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:r,onExportImage:i,name:o})=>{let a=mn(t,e),[s,l]=(0,Qr.useState)(o),[c,d]=(0,Qr.useState)(a),[u,h]=(0,Qr.useState)(e.exportBackground),[m,p]=(0,Qr.useState)(e.exportWithDarkMode),[f,g]=(0,Qr.useState)(e.exportEmbedScene),[b,v]=(0,Qr.useState)(e.exportScale),y=(0,Qr.useRef)(null),[w,T]=(0,Qr.useState)(null),{exportedElements:k,exportingFrame:M}=df(t,e,c);return(0,Qr.useEffect)(()=>{let C=y.current;if(!C)return;let P=C.offsetWidth,R=C.offsetHeight;P&&zT({data:{elements:k,appState:{...e,name:s,exportEmbedScene:f},files:n},config:{canvasBackgroundColor:u?e.viewBackgroundColor:!1,padding:lh,theme:m?"dark":"light",scale:b,maxWidthOrHeight:Math.max(P,R),exportingFrame:M}}).then(A=>(T(null),Yu(A).then(()=>{C.replaceChildren(A)}).catch(_=>{throw _.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(x("canvasError.canvasTooBig")):_}))).catch(A=>{console.error(A),T(A)})},[e,n,k,M,s,u,m,b,f]),(0,Ze.jsxs)("div",{className:"ImageExportModal",children:[(0,Ze.jsx)("h3",{children:x("imageExportDialog.header")}),(0,Ze.jsxs)("div",{className:"ImageExportModal__preview",children:[(0,Ze.jsx)("div",{className:"ImageExportModal__preview__canvas",ref:y,children:w&&(0,Ze.jsx)(jO,{})}),(0,Ze.jsx)("div",{className:"ImageExportModal__preview__filename",children:!no&&(0,Ze.jsx)("input",{type:"text",className:"TextInput",value:s,style:{width:"30ch"},onChange:C=>{l(C.target.value),r.executeAction(HM,"ui",C.target.value)}})})]}),(0,Ze.jsxs)("div",{className:"ImageExportModal__settings",children:[(0,Ze.jsx)("h3",{children:x("imageExportDialog.header")}),a&&(0,Ze.jsx)(Qd,{label:x("imageExportDialog.label.onlySelected"),name:"exportOnlySelected",children:(0,Ze.jsx)(yp,{name:"exportOnlySelected",checked:c,onChange:C=>{d(C)}})}),(0,Ze.jsx)(Qd,{label:x("imageExportDialog.label.withBackground"),name:"exportBackgroundSwitch",children:(0,Ze.jsx)(yp,{name:"exportBackgroundSwitch",checked:u,onChange:C=>{h(C),r.executeAction(GM,"ui",C)}})}),WO&&(0,Ze.jsx)(Qd,{label:x("imageExportDialog.label.darkMode"),name:"exportDarkModeSwitch",children:(0,Ze.jsx)(yp,{name:"exportDarkModeSwitch",checked:m,onChange:C=>{p(C),r.executeAction(dH,"ui",C)}})}),(0,Ze.jsx)(Qd,{label:x("imageExportDialog.label.embedScene"),tooltip:x("imageExportDialog.tooltip.embedScene"),name:"exportEmbedSwitch",children:(0,Ze.jsx)(yp,{name:"exportEmbedSwitch",checked:f,onChange:C=>{g(C),r.executeAction(WM,"ui",C)}})}),(0,Ze.jsx)(Qd,{label:x("imageExportDialog.label.scale"),name:"exportScale",children:(0,Ze.jsx)(gI,{name:"exportScale",value:b,onChange:C=>{v(C),r.executeAction(cH,"ui",C)},choices:cb.map(C=>({value:C,label:`${C}\xD7`}))})}),(0,Ze.jsxs)("div",{className:"ImageExportModal__settings__buttons",children:[(0,Ze.jsx)(Nc,{className:"ImageExportModal__settings__buttons__button",label:x("imageExportDialog.title.exportToPng"),onClick:()=>i(u2.png,k,{exportingFrame:M}),icon:GE,children:x("imageExportDialog.button.exportToPng")}),(0,Ze.jsx)(Nc,{className:"ImageExportModal__settings__buttons__button",label:x("imageExportDialog.title.exportToSvg"),onClick:()=>i(u2.svg,k,{exportingFrame:M}),icon:GE,children:x("imageExportDialog.button.exportToSvg")}),(Sb||Bu)&&(0,Ze.jsx)(Nc,{className:"ImageExportModal__settings__buttons__button",label:x("imageExportDialog.title.copyPngToClipboard"),onClick:()=>i(u2.clipboard,k,{exportingFrame:M}),icon:Lb,children:x("imageExportDialog.button.copyPngToClipboard")})]})]})]})},Qd=({label:e,children:t,tooltip:n,name:r})=>(0,Ze.jsxs)("div",{className:"ImageExportModal__settings__setting",title:e,children:[(0,Ze.jsxs)("label",{htmlFor:r,className:"ImageExportModal__settings__setting__label",children:[e,n&&(0,Ze.jsx)(xl,{label:n,long:!0,children:aM})]}),(0,Ze.jsx)("div",{className:"ImageExportModal__settings__setting__content",children:t})]}),YG=({elements:e,appState:t,files:n,actionManager:r,onExportImage:i,onCloseRequest:o,name:a})=>{let[{appStateSnapshot:s,elementsSnapshot:l}]=(0,Qr.useState)(()=>({appStateSnapshot:zc(t),elementsSnapshot:zc(e)}));return(0,Ze.jsx)(ci,{onCloseRequest:o,size:"wide",title:!1,children:(0,Ze.jsx)(UO,{elementsSnapshot:l,appStateSnapshot:s,files:n,actionManager:r,onExportImage:i,name:a})})}}),tne=I(()=>{}),EI,XG=I(()=>{"use strict";D(),tne(),EI=({children:e,side:t,className:n})=>(0,ZG.jsx)("div",{className:Y("FixedSideContainer",`FixedSideContainer_side_${t}`,n),children:e})}),nne=I(()=>{}),VO,bI,KG=I(()=>{"use strict";D(),ce(),xe(),ne(),$i(),nne(),VO=({appState:e,isMobile:t,device:n,app:r})=>{let{activeTool:i,isResizing:o,isRotating:a,lastPointerDownWith:s}=e,l=e.multiElement!==null;if(e.openSidebar&&!n.editor.canFitSidebar)return null;if(uo(e))return x("hints.eraserRevert");if(i.type==="arrow"||i.type==="line")return x(l?"hints.linearElementMulti":"hints.linearElement");if(i.type==="freedraw")return x("hints.freeDraw");if(i.type==="text")return x("hints.text");if(i.type==="embeddable")return x("hints.embeddable");if(e.activeTool.type==="image"&&e.pendingImageElementId)return x("hints.placeImage");let c=r.scene.getSelectedElements(e);if(o&&s==="mouse"&&c.length===1){let d=c[0];return Ne(d)&&d.points.length===2?x("hints.lockAngle"):dl(d)?x("hints.resizeImage"):x("hints.resize")}if(a&&s==="mouse")return x("hints.rotate");if(c.length===1&&he(c[0]))return x("hints.text_selected");if(e.editingElement&&he(e.editingElement))return x("hints.text_editing");if(i.type==="selection"){if(e.draggingElement?.type==="selection"&&!c.length&&!e.editingElement&&!e.editingLinearElement)return x("hints.deepBoxSelect");if(e.gridSize&&e.draggingElement)return x("hints.disableSnapping");if(!c.length&&!t)return x("hints.canvasPanning");if(c.length===1){if(Ne(c[0]))return e.editingLinearElement?e.editingLinearElement.selectedPointsIndices?x("hints.lineEditor_pointSelected"):x("hints.lineEditor_nothingSelected"):x("hints.lineEditor_info");if(!e.draggingElement&&ul(c[0]))return x("hints.bindTextToElement")}}return null},bI=({appState:e,isMobile:t,device:n,app:r})=>{let i=VO({appState:e,isMobile:t,device:n,app:r});return i?(i=V(i),(0,sS.jsx)("div",{className:"HintViewer",children:(0,sS.jsx)("span",{children:i})})):null}}),YO,z6,yI,qG=I(()=>{"use strict";D(),Cl(),me(),YO="medium",z6={CHECKED:Ff,UNCHECKED:Qu},yI=e=>(0,xf.jsxs)("label",{className:Y("ToolIcon ToolIcon__lock",`ToolIcon_size_${YO}`,{"is-mobile":e.isMobile}),title:`${e.title} \u2014 Q`,children:[(0,xf.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,xf.jsx)("div",{className:"ToolIcon__icon",children:e.checked?z6.CHECKED:z6.UNCHECKED})]})}),oh,vI=I(()=>{"use strict";D(),ce(),Re(),oh=({heading:e,children:t,...n})=>{let{id:r}=ua(),i=(0,Vc.jsx)("h2",{className:"visually-hidden",id:`${r}-${e}-title`,children:x(`headings.${e}`)});return(0,Vc.jsx)("section",{...n,"aria-labelledby":`${r}-${e}-title`,children:typeof t=="function"?t(i):(0,Vc.jsxs)(Vc.Fragment,{children:[i,t]})})}}),co,Za,QG,JG,lS,xI=I(()=>{"use strict";D(),Pe(),ne(),ce(),co=4,Za=6,QG="rgba(0,0,0,0.3)",JG=(e,t,n,r)=>{if(!e.length)return{horizontal:null,vertical:null};let[i,o,a,s]=Nt(e),l=t/r.zoom.value,c=n/r.zoom.value,d=t-l,u=n-c,h={top:parseInt(np("sat"))||0,bottom:parseInt(np("sab"))||0,left:parseInt(np("sal"))||0,right:parseInt(np("sar"))||0},m=sh().rtl,p=-r.scrollX+d/2+h.left,f=-r.scrollY+u/2+h.top,g=p+l-h.right,b=f+c-h.bottom,v=Math.min(i,p),y=Math.min(o,f),w=Math.max(a,g),T=Math.max(s,b);return{horizontal:p===v&&g===w?null:{x:Math.max(h.left,co)+(p-v)/(w-v)*t,y:n-Za-Math.max(co,h.bottom),width:(g-p)/(w-v)*t-Math.max(co*2,h.left+h.right),height:Za},vertical:f===y&&b===T?null:{x:m?Math.max(h.left,co):t-Za-Math.max(h.right,co),y:(f-y)/(T-y)*n+Math.max(h.top,co),width:Za,height:(b-f)/(T-y)*n-Math.max(co*2,h.top+h.bottom)}}},lS=(e,t,n)=>{let[r,i]=[e.horizontal,e.vertical].map(o=>o!=null&&o.x<=t&&t<=o.x+o.width&&o.y<=n&&n<=o.y+o.height);return{isOverEither:r||i,isOverHorizontal:r,isOverVertical:i}}}),ZO,wI,eW=I(()=>{"use strict";D(),Cl(),me(),ZO="medium",wI=e=>e.penDetected?(0,wf.jsxs)("label",{className:Y("ToolIcon ToolIcon__penMode",`ToolIcon_size_${ZO}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,wf.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,wf.jsx)("div",{className:"ToolIcon__icon",children:aC})]}):null}),rne=I(()=>{}),SI,tW=I(()=>{"use strict";D(),rn(),ce(),pt(),me(),Jc(),rne(),SI=e=>{let t=Nt(e.elements),n=Mb(e.elements,e.appState),r=Nt(n);return(0,Ae.jsx)("div",{className:"Stats",children:(0,Ae.jsxs)(Co,{padding:2,children:[(0,Ae.jsx)("div",{className:"close",onClick:e.onClose,children:Ml}),(0,Ae.jsx)("h3",{children:x("stats.title")}),(0,Ae.jsx)("table",{children:(0,Ae.jsxs)("tbody",{children:[(0,Ae.jsx)("tr",{children:(0,Ae.jsx)("th",{colSpan:2,children:x("stats.scene")})}),(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:x("stats.elements")}),(0,Ae.jsx)("td",{children:e.elements.length})]}),(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:x("stats.width")}),(0,Ae.jsx)("td",{children:Math.round(t[2])-Math.round(t[0])})]}),(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:x("stats.height")}),(0,Ae.jsx)("td",{children:Math.round(t[3])-Math.round(t[1])})]}),n.length===1&&(0,Ae.jsx)("tr",{children:(0,Ae.jsx)("th",{colSpan:2,children:x("stats.element")})}),n.length>1&&(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)("tr",{children:(0,Ae.jsx)("th",{colSpan:2,children:x("stats.selected")})}),(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:x("stats.elements")}),(0,Ae.jsx)("td",{children:n.length})]})]}),n.length>0&&(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:"x"}),(0,Ae.jsx)("td",{children:Math.round(r[0])})]}),(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:"y"}),(0,Ae.jsx)("td",{children:Math.round(r[1])})]}),(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:x("stats.width")}),(0,Ae.jsx)("td",{children:Math.round(r[2]-r[0])})]}),(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:x("stats.height")}),(0,Ae.jsx)("td",{children:Math.round(r[3]-r[1])})]})]}),n.length===1&&(0,Ae.jsxs)("tr",{children:[(0,Ae.jsx)("td",{children:x("stats.angle")}),(0,Ae.jsx)("td",{children:`${Math.round(n[0].angle*180/Math.PI)}\xB0`})]}),e.renderCustomStats?.(e.elements,e.appState)]})})]})})}}),TI,rW=I(()=>{"use strict";D(),Cl(),On(),me(),Ce(),TI=e=>(0,nW.jsx)(Xe,{className:Y("Shape",{fillable:!1}),type:"radio",icon:Db,name:"editor-current-shape",checked:e.checked,title:`${e.title} \u2014 H`,keyBindingLabel:e.isMobile?void 0:O.H.toLocaleUpperCase(),"aria-label":`${e.title} \u2014 H`,"aria-keyshortcuts":O.H,"data-testid":"toolbar-hand",onChange:()=>e.onChange?.()})}),ine=I(()=>{}),iW,one=I(()=>{"use strict";D(),ce(),ne(),me(),ine(),iW=({onHomeButtonClick:e})=>(0,N2.jsx)("label",{title:`${Pc(x("toolBar.library"))} \u2014 0`,children:(0,N2.jsx)("div",{className:"library-button",onClick:e,children:(0,N2.jsx)("div",{children:YT})})})}),oW,ane=I(()=>{"use strict";D(),ce(),ph(),Pe(),XG(),Jc(),KG(),pt(),hy(),vI(),xI(),qG(),eW(),tW(),ko(),rW(),$i(),Hi(),one(),oW=({appState:e,elements:t,actionManager:n,setAppState:r,onLockToggle:i,onHandToolToggle:o,onPenModeToggle:a,renderTopRightUI:s,renderCustomStats:l,renderSidebars:c,device:d,renderWelcomeScreen:u,UIOptions:h,app:m,onHomeButtonClick:p})=>{let{WelcomeScreenCenterTunnel:f,MainMenuTunnel:g,DefaultSidebarTriggerTunnel:b}=dr(),v=()=>(0,it.jsxs)(EI,{side:"top",className:"App-top-bar",children:[u&&(0,it.jsx)(f.Out,{}),(0,it.jsx)(oh,{heading:"shapes",children:w=>(0,it.jsx)(ii.Col,{gap:4,align:"center",children:(0,it.jsxs)(ii.Row,{gap:1,className:"App-toolbar-container",children:[(0,it.jsxs)(Co,{padding:1,className:"App-toolbar App-toolbar--mobile",children:[w,(0,it.jsx)(ii.Row,{gap:1,children:(0,it.jsx)(pI,{appState:e,activeTool:e.activeTool,UIOptions:h,app:m})})]}),s&&s(!0,e),(0,it.jsxs)("div",{className:"mobile-misc-tools-container",children:[!e.viewModeEnabled&&(0,it.jsx)(b.Out,{}),(0,it.jsx)(wI,{checked:e.penMode,onChange:()=>a(null),title:x("toolBar.penMode"),isMobile:!0,penDetected:e.penDetected}),(0,it.jsx)(yI,{checked:e.activeTool.locked,onChange:i,title:x("toolBar.lock"),isMobile:!0}),(0,it.jsx)(TI,{checked:Hc(e),onChange:()=>o(),title:x("toolBar.hand"),isMobile:!0})]}),(0,it.jsx)("div",{className:"mobile-misc-tools-container-left",children:(0,it.jsx)(iW,{onHomeButtonClick:p})})]})})}),(0,it.jsx)(bI,{appState:e,isMobile:!0,device:d,app:m})]}),y=()=>e.viewModeEnabled?(0,it.jsx)("div",{className:"App-toolbar-content",children:(0,it.jsx)(g.Out,{})}):(0,it.jsxs)("div",{className:"App-toolbar-content",children:[(0,it.jsx)(g.Out,{}),n.renderAction("toggleEditMenu"),n.renderAction("undo"),n.renderAction("redo"),n.renderAction(e.multiElement?"finalize":"duplicateSelection"),n.renderAction("deleteSelectedElements")]});return(0,it.jsxs)(it.Fragment,{children:[c(),!e.viewModeEnabled&&v(),!e.openMenu&&e.showStats&&(0,it.jsx)(SI,{appState:e,setAppState:r,elements:t,onClose:()=>{n.executeAction(th)},renderCustomStats:l}),(0,it.jsx)("div",{className:"App-bottom-bar",style:{marginBottom:Za+co*2,marginLeft:Za+co*2,marginRight:Za+co*2},children:(0,it.jsxs)(Co,{padding:0,children:[e.openMenu==="shape"&&!e.viewModeEnabled&&Cb(e,t)?(0,it.jsx)(oh,{className:"App-mobile-menu",heading:"selectedShapeActions",children:(0,it.jsx)(mI,{appState:e,elementsMap:m.scene.getNonDeletedElementsMap(),renderAction:n.renderAction})}):null,(0,it.jsxs)("footer",{className:"App-toolbar",children:[y(),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&(0,it.jsx)("button",{className:"scroll-back-to-content",onClick:()=>{r(w=>({...qu(t,w)}))},children:x("buttons.scrollBackToContent")})]})]})})]})}}),sne=I(()=>{}),H6,aW,lne=I(()=>{"use strict";D(),li(),pB(),ae(),ce(),$f(),Re(),zi(),sne(),H6=e=>{let t=(0,Al.useRef)(null),[n,r]=(0,Al.useState)(null);return(0,Al.useLayoutEffect)(()=>{if(!e.spreadsheet)return;let i=mB(e.chartType,e.spreadsheet,0,0);r(i);let o,a=t.current;return(async()=>(o=await wb({data:{elements:i,appState:{exportBackground:!1,viewBackgroundColor:Li},files:null}}),o.querySelector(".style-fonts")?.remove(),a.replaceChildren(),a.appendChild(o),e.selected&&a.parentNode.focus()))(),()=>{a.replaceChildren()}},[e.spreadsheet,e.chartType,e.selected]),(0,Qs.jsx)("button",{className:"ChartPreview",onClick:()=>{n&&e.onClick(e.chartType,n)},children:(0,Qs.jsx)("div",{ref:t})})},aW=({setAppState:e,appState:t,onClose:n})=>{let{onInsertElements:r}=_l(),i=Al.default.useCallback(()=>{n&&n()},[n]),o=(a,s)=>{r(s),ot("paste","chart",a),e({currentChartType:a,pasteDialog:{shown:!1,data:null}})};return(0,Qs.jsx)(ci,{size:"small",onCloseRequest:i,title:x("labels.pasteCharts"),className:"PasteChartDialog",autofocus:!1,children:(0,Qs.jsxs)("div",{className:"container",children:[(0,Qs.jsx)(H6,{chartType:"bar",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="bar",onClick:o}),(0,Qs.jsx)(H6,{chartType:"line",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="line",onClick:o})]})})}}),cne=I(()=>{});function*dne(e,t){let n=!0;for(let r of e)n||(yield t),n=!1,yield r}var XO,KO,Hg,qO,le,QO,lW,une=I(()=>{"use strict";D(),ce(),Ce(),zi(),ne(),cne(),me(),Xc(),ae(),gh(),XO=()=>(0,J.jsxs)("div",{className:"HelpDialog__header",children:[(0,J.jsxs)("a",{className:"HelpDialog__btn",href:"https://docs.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:[(0,J.jsx)("div",{className:"HelpDialog__link-icon",children:TE}),x("helpDialog.documentation")]}),(0,J.jsxs)("a",{className:"HelpDialog__btn",href:"https://blog.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:[(0,J.jsx)("div",{className:"HelpDialog__link-icon",children:TE}),x("helpDialog.blog")]}),(0,J.jsxs)("a",{className:"HelpDialog__btn",href:"https://github.com/excalidraw/excalidraw/issues",target:"_blank",rel:"noopener noreferrer",children:[(0,J.jsx)("div",{className:"HelpDialog__link-icon",children:Ab}),x("helpDialog.github")]}),(0,J.jsxs)("a",{className:"HelpDialog__btn",href:"https://youtube.com/@excalidraw",target:"_blank",rel:"noopener noreferrer",children:[(0,J.jsx)("div",{className:"HelpDialog__link-icon",children:MM}),"YouTube"]})]}),KO=e=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("h3",{children:e.title}),(0,J.jsx)("div",{className:"HelpDialog__islands-container",children:e.children})]}),Hg=e=>(0,J.jsxs)("div",{className:`HelpDialog__island ${e.className}`,children:[(0,J.jsx)("h4",{className:"HelpDialog__island-title",children:e.caption}),(0,J.jsx)("div",{className:"HelpDialog__island-content",children:e.children})]}),qO=e=>e.replace(/\b[a-z]\b/,t=>t.toUpperCase()),le=({label:e,shortcuts:t,isOr:n=!0})=>{let r=t.map(i=>(i.endsWith("++")?[...i.slice(0,-2).split("+"),"+"]:i.split("+")).map(o=>(0,J.jsx)(QO,{children:qO(o)},o)));return(0,J.jsxs)("div",{className:"HelpDialog__shortcut",children:[(0,J.jsx)("div",{children:e}),(0,J.jsx)("div",{className:"HelpDialog__key-container",children:[...dne(r,n?x("helpDialog.or"):null)]})]})},QO=e=>(0,J.jsx)("kbd",{className:"HelpDialog__key",...e}),lW=({onClose:e})=>{let t=sW.default.useCallback(()=>{e&&e()},[e]);return(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(ci,{onCloseRequest:t,title:x("helpDialog.title"),className:"HelpDialog",children:[(0,J.jsx)(XO,{}),(0,J.jsxs)(KO,{title:x("helpDialog.shortcuts"),children:[(0,J.jsxs)(Hg,{className:"HelpDialog__island--tools",caption:x("helpDialog.tools"),children:[(0,J.jsx)(le,{label:x("toolBar.hand"),shortcuts:[O.H]}),(0,J.jsx)(le,{label:x("toolBar.selection"),shortcuts:[O.V,O[1]]}),(0,J.jsx)(le,{label:x("toolBar.rectangle"),shortcuts:[O.R,O[2]]}),(0,J.jsx)(le,{label:x("toolBar.diamond"),shortcuts:[O.D,O[3]]}),(0,J.jsx)(le,{label:x("toolBar.ellipse"),shortcuts:[O.O,O[4]]}),(0,J.jsx)(le,{label:x("toolBar.arrow"),shortcuts:[O.A,O[5]]}),(0,J.jsx)(le,{label:x("toolBar.line"),shortcuts:[O.L,O[6]]}),(0,J.jsx)(le,{label:x("toolBar.freedraw"),shortcuts:[O.P,O[7]]}),(0,J.jsx)(le,{label:x("toolBar.text"),shortcuts:[O.T,O[8]]}),(0,J.jsx)(le,{label:x("toolBar.image"),shortcuts:[O[9]]}),(0,J.jsx)(le,{label:x("toolBar.eraser"),shortcuts:[O.E,O[0]]}),(0,J.jsx)(le,{label:x("toolBar.frame"),shortcuts:[O.F]}),(0,J.jsx)(le,{label:x("toolBar.laser"),shortcuts:[O.K]}),(0,J.jsx)(le,{label:x("labels.eyeDropper"),shortcuts:[O.I,"Shift+S","Shift+G"]}),(0,J.jsx)(le,{label:x("helpDialog.editLineArrowPoints"),shortcuts:[V("CtrlOrCmd+Enter")]}),(0,J.jsx)(le,{label:x("helpDialog.editText"),shortcuts:[V("Enter")]}),(0,J.jsx)(le,{label:x("helpDialog.textNewLine"),shortcuts:[V("Enter"),V("Shift+Enter")]}),(0,J.jsx)(le,{label:x("helpDialog.textFinish"),shortcuts:[V("Esc"),V("CtrlOrCmd+Enter")]}),(0,J.jsx)(le,{label:x("helpDialog.curvedArrow"),shortcuts:["A",x("helpDialog.click"),x("helpDialog.click"),x("helpDialog.click")],isOr:!1}),(0,J.jsx)(le,{label:x("helpDialog.curvedLine"),shortcuts:["L",x("helpDialog.click"),x("helpDialog.click"),x("helpDialog.click")],isOr:!1}),(0,J.jsx)(le,{label:x("toolBar.lock"),shortcuts:[O.Q]}),(0,J.jsx)(le,{label:x("helpDialog.preventBinding"),shortcuts:[V("CtrlOrCmd")]}),(0,J.jsx)(le,{label:x("toolBar.link"),shortcuts:[V("CtrlOrCmd+K")]})]}),(0,J.jsxs)(Hg,{className:"HelpDialog__island--view",caption:x("helpDialog.view"),children:[(0,J.jsx)(le,{label:x("buttons.zoomIn"),shortcuts:[V("CtrlOrCmd++")]}),(0,J.jsx)(le,{label:x("buttons.zoomOut"),shortcuts:[V("CtrlOrCmd+-")]}),(0,J.jsx)(le,{label:x("buttons.resetZoom"),shortcuts:[V("CtrlOrCmd+0")]}),(0,J.jsx)(le,{label:x("helpDialog.zoomToFit"),shortcuts:["Shift+1"]}),(0,J.jsx)(le,{label:x("helpDialog.zoomToSelection"),shortcuts:["Shift+2"]}),(0,J.jsx)(le,{label:x("helpDialog.movePageUpDown"),shortcuts:["PgUp/PgDn"]}),(0,J.jsx)(le,{label:x("helpDialog.movePageLeftRight"),shortcuts:["Shift+PgUp/PgDn"]}),(0,J.jsx)(le,{label:x("buttons.zenMode"),shortcuts:[V("Alt+Z")]}),(0,J.jsx)(le,{label:x("buttons.objectsSnapMode"),shortcuts:[V("Alt+S")]}),(0,J.jsx)(le,{label:x("labels.showGrid"),shortcuts:[V("CtrlOrCmd+'")]}),(0,J.jsx)(le,{label:x("labels.viewMode"),shortcuts:[V("Alt+R")]}),(0,J.jsx)(le,{label:x("labels.toggleTheme"),shortcuts:[V("Alt+Shift+D")]}),(0,J.jsx)(le,{label:x("stats.title"),shortcuts:[V("Alt+/")]}),(0,J.jsx)(le,{label:x("commandPalette.title"),shortcuts:Bu?[wr("commandPalette")]:[wr("commandPalette"),wr("commandPalette",1)]})]}),(0,J.jsxs)(Hg,{className:"HelpDialog__island--editor",caption:x("helpDialog.editor"),children:[(0,J.jsx)(le,{label:x("labels.moveCanvas"),shortcuts:[V(`Space+${x("helpDialog.drag")}`),V(`Wheel+${x("helpDialog.drag")}`)],isOr:!0}),(0,J.jsx)(le,{label:x("buttons.clearReset"),shortcuts:[V("CtrlOrCmd+Delete")]}),(0,J.jsx)(le,{label:x("labels.delete"),shortcuts:[V("Delete")]}),(0,J.jsx)(le,{label:x("labels.cut"),shortcuts:[V("CtrlOrCmd+X")]}),(0,J.jsx)(le,{label:x("labels.copy"),shortcuts:[V("CtrlOrCmd+C")]}),(0,J.jsx)(le,{label:x("labels.paste"),shortcuts:[V("CtrlOrCmd+V")]}),(0,J.jsx)(le,{label:x("labels.pasteAsPlaintext"),shortcuts:[V("CtrlOrCmd+Shift+V")]}),(0,J.jsx)(le,{label:x("labels.selectAll"),shortcuts:[V("CtrlOrCmd+A")]}),(0,J.jsx)(le,{label:x("labels.multiSelect"),shortcuts:[V(`Shift+${x("helpDialog.click")}`)]}),(0,J.jsx)(le,{label:x("helpDialog.deepSelect"),shortcuts:[V(`CtrlOrCmd+${x("helpDialog.click")}`)]}),(0,J.jsx)(le,{label:x("helpDialog.deepBoxSelect"),shortcuts:[V(`CtrlOrCmd+${x("helpDialog.drag")}`)]}),(Sb||Bu)&&(0,J.jsx)(le,{label:x("labels.copyAsPng"),shortcuts:[V("Shift+Alt+C")]}),(0,J.jsx)(le,{label:x("labels.copyStyles"),shortcuts:[V("CtrlOrCmd+Alt+C")]}),(0,J.jsx)(le,{label:x("labels.pasteStyles"),shortcuts:[V("CtrlOrCmd+Alt+V")]}),(0,J.jsx)(le,{label:x("labels.sendToBack"),shortcuts:[V(go?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")]}),(0,J.jsx)(le,{label:x("labels.bringToFront"),shortcuts:[V(go?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")]}),(0,J.jsx)(le,{label:x("labels.sendBackward"),shortcuts:[V("CtrlOrCmd+[")]}),(0,J.jsx)(le,{label:x("labels.bringForward"),shortcuts:[V("CtrlOrCmd+]")]}),(0,J.jsx)(le,{label:x("labels.alignTop"),shortcuts:[V("CtrlOrCmd+Shift+Up")]}),(0,J.jsx)(le,{label:x("labels.alignBottom"),shortcuts:[V("CtrlOrCmd+Shift+Down")]}),(0,J.jsx)(le,{label:x("labels.alignLeft"),shortcuts:[V("CtrlOrCmd+Shift+Left")]}),(0,J.jsx)(le,{label:x("labels.alignRight"),shortcuts:[V("CtrlOrCmd+Shift+Right")]}),(0,J.jsx)(le,{label:x("labels.duplicateSelection"),shortcuts:[V("CtrlOrCmd+D"),V(`Alt+${x("helpDialog.drag")}`)]}),(0,J.jsx)(le,{label:x("helpDialog.toggleElementLock"),shortcuts:[V("CtrlOrCmd+Shift+L")]}),(0,J.jsx)(le,{label:x("buttons.undo"),shortcuts:[V("CtrlOrCmd+Z")]}),(0,J.jsx)(le,{label:x("buttons.redo"),shortcuts:jS?[V("CtrlOrCmd+Y"),V("CtrlOrCmd+Shift+Z")]:[V("CtrlOrCmd+Shift+Z")]}),(0,J.jsx)(le,{label:x("labels.group"),shortcuts:[V("CtrlOrCmd+G")]}),(0,J.jsx)(le,{label:x("labels.ungroup"),shortcuts:[V("CtrlOrCmd+Shift+G")]}),(0,J.jsx)(le,{label:x("labels.flipHorizontal"),shortcuts:[V("Shift+H")]}),(0,J.jsx)(le,{label:x("labels.flipVertical"),shortcuts:[V("Shift+V")]}),(0,J.jsx)(le,{label:x("labels.showStroke"),shortcuts:[V("S")]}),(0,J.jsx)(le,{label:x("labels.showBackground"),shortcuts:[V("G")]}),(0,J.jsx)(le,{label:x("labels.decreaseFontSize"),shortcuts:[V("CtrlOrCmd+Shift+<")]}),(0,J.jsx)(le,{label:x("labels.increaseFontSize"),shortcuts:[V("CtrlOrCmd+Shift+>")]})]})]})]})})}}),hne=I(()=>{}),JO,eN,tN,Gg,nN,CI,cW=I(()=>{"use strict";D(),hne(),Qc(),Re(),Jc(),me(),ce(),ne(),ae(),JO=4,eN=8,tN=({shouldWrap:e,children:t,username:n})=>e?(0,Yn.jsx)(xl,{label:n||"Unknown user",children:t}):(0,Yn.jsx)(Js.default.Fragment,{children:t}),Gg=({actionManager:e,collaborator:t,socketId:n,withName:r=!1,shouldWrapWithTooltip:i=!1,isBeingFollowed:o})=>{let a={socketId:n,collaborator:t,withName:r,isBeingFollowed:o},s=e.renderAction("goToCollaborator",a);return(0,Yn.jsx)(tN,{username:t.username,shouldWrap:i,children:s},n)},nN=["avatarUrl","id","socketId","username","isInCall","isSpeaking","isMuted"],CI=Js.default.memo(({className:e,mobile:t,collaborators:n,userToFollow:r})=>{let i=Or(),o=new Map;n.forEach((p,f)=>{let g=p.id||f;o.set(g,{...p,socketId:f})});let a=Array.from(o.values()).filter(p=>p.username?.trim()),[s,l]=Js.default.useState(""),c=Js.default.useRef(null);(0,Js.useLayoutEffect)(()=>{if(c.current){let p=g=>{let b=Math.max(1,Math.min(8,Math.floor(g/38)));u(b)};if(p(c.current.clientWidth),!j2)return;let f=new ResizeObserver(g=>{for(let b of g){let{width:v}=b.contentRect;p(v)}});return f.observe(c.current),()=>{f.disconnect()}}},[]);let[d,u]=Js.default.useState(JO),h=s.trim().toLowerCase()?a.filter(p=>p.username?.toLowerCase().includes(s)):a,m=a.slice(0,d-1).map(p=>Gg({actionManager:i,collaborator:p,socketId:p.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:p.socketId===r}));return t?(0,Yn.jsx)("div",{className:Y("UserList UserList_mobile",e),children:a.map(p=>Gg({actionManager:i,collaborator:p,socketId:p.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:p.socketId===r}))}):(0,Yn.jsx)("div",{className:"UserList-wrapper",ref:c,children:(0,Yn.jsxs)("div",{className:Y("UserList",e),style:{"--max-avatars":d},children:[m,a.length>d-1&&(0,Yn.jsxs)(rg,{onOpenChange:p=>{p||l("")},children:[(0,Yn.jsxs)(ig,{className:"UserList__more",children:["+",a.length-d+1]}),(0,Yn.jsx)(og,{style:{zIndex:2,width:"15rem",textAlign:"left"},align:"end",sideOffset:10,children:(0,Yn.jsxs)(Co,{style:{overflow:"hidden"},children:[a.length>=eN&&(0,Yn.jsxs)("div",{className:"UserList__search-wrapper",children:[$b,(0,Yn.jsx)("input",{className:"UserList__search",type:"text",placeholder:x("userList.search.placeholder"),value:s,onChange:p=>{l(p.target.value)}})]}),(0,Yn.jsxs)("div",{className:"dropdown-menu UserList__collaborators",children:[h.length===0&&(0,Yn.jsx)("div",{className:"UserList__collaborators__empty",children:x("userList.search.empty")}),(0,Yn.jsx)("div",{className:"UserList__hint",children:x("userList.hint.text")}),h.map(p=>Gg({actionManager:i,collaborator:p,socketId:p.socketId,withName:!0,isBeingFollowed:p.socketId===r}))]})]})})]})]})})},(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 o=t.collaborators.get(r);if(!o||r!==n.next().value||!$r(i,o,nN))return!1}return!0})}),mne=I(()=>{}),cS,pne=I(()=>{"use strict";D(),mne(),cS=({children:e,color:t})=>(0,dW.jsx)("div",{className:"Card",style:{"--card-color":t==="primary"?"var(--color-primary)":Ct[t][7],"--card-color-darker":t==="primary"?"var(--color-primary-darker)":Ct[t][8],"--card-color-darkest":t==="primary"?"var(--color-primary-darkest)":Ct[t][9]},children:e})}),fne=I(()=>{}),rN,hW,gne=I(()=>{"use strict";D(),ce(),zi(),me(),On(),Xb(),pne(),fne(),Tl(),li(),ne(),rN=({elements:e,appState:t,setAppState:n,files:r,actionManager:i,exportOpts:o,canvas:a,onCloseRequest:s})=>{let{onExportToBackend:l}=o;return(0,An.jsx)("div",{className:"ExportDialog ExportDialog--json",children:(0,An.jsxs)("div",{className:"ExportDialog-cards",children:[o.saveFileToDisk&&(0,An.jsxs)(cS,{color:"lime",children:[(0,An.jsx)("div",{className:"Card-icon",children:yC}),(0,An.jsx)("h2",{children:x("exportDialog.disk_title")}),(0,An.jsxs)("div",{className:"Card-details",children:[x("exportDialog.disk_details"),!no&&i.renderAction("changeProjectName")]}),(0,An.jsx)(Xe,{className:"Card-button",type:"button",title:x("exportDialog.disk_button"),"aria-label":x("exportDialog.disk_button"),showAriaLabel:!0,onClick:()=>{i.executeAction(Zb,"ui")}})]}),l&&(0,An.jsxs)(cS,{color:"pink",children:[(0,An.jsx)("div",{className:"Card-icon",children:af}),(0,An.jsx)("h2",{children:x("exportDialog.link_title")}),(0,An.jsx)("div",{className:"Card-details",children:x("exportDialog.link_details")}),(0,An.jsx)(Xe,{className:"Card-button",type:"button",title:x("exportDialog.link_button"),"aria-label":x("exportDialog.link_button"),showAriaLabel:!0,onClick:async()=>{try{ot("export","link",`ui (${H$()})`),await l(e,t,r),s()}catch(c){n({errorMessage:c.message})}}})]}),o.renderCustomUI&&o.renderCustomUI(e,t,r,a)]})})},hW=({elements:e,appState:t,files:n,actionManager:r,exportOpts:i,canvas:o,setAppState:a})=>{let s=uW.default.useCallback(()=>{a({openDialog:null})},[a]);return(0,An.jsx)(An.Fragment,{children:t.openDialog?.name==="jsonExport"&&(0,An.jsx)(ci,{onCloseRequest:s,title:x("buttons.export"),children:(0,An.jsx)(rN,{elements:e,appState:t,setAppState:a,files:n,actionManager:r,onCloseRequest:s,exportOpts:i,canvas:o})})})}}),pW,Ene=I(()=>{"use strict";D(),ce(),me(),pW=e=>(0,mW.jsx)("button",{className:"help-icon",onClick:e.onClick,type:"button",title:`${x("helpDialog.title")} \u2014 ?`,"aria-label":x("helpDialog.title"),children:zf})}),G6,fW,bne=I(()=>{"use strict";D(),ko(),hy(),Re(),Hi(),Ene(),vI(),ph(),G6=({appState:e,actionManager:t,showExitZenModeBtn:n,renderWelcomeScreen:r})=>{let{FooterCenterTunnel:i,WelcomeScreenHelpHintTunnel:o}=dr(),a=Wn(),s=!e.viewModeEnabled&&e.multiElement&&a.isTouchScreen;return(0,yr.jsxs)("footer",{role:"contentinfo",className:"layer-ui__wrapper__footer App-menu App-menu_bottom",children:[(0,yr.jsx)("div",{className:Y("layer-ui__wrapper__footer-left zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:(0,yr.jsx)(ii.Col,{gap:2,children:(0,yr.jsxs)(oh,{heading:"canvasActions",children:[(0,yr.jsx)(kG,{renderAction:t.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&(0,yr.jsx)(AG,{renderAction:t.renderAction,className:Y("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})}),s&&(0,yr.jsx)(PG,{renderAction:t.renderAction,className:Y("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled})})]})})}),(0,yr.jsx)(i.Out,{}),(0,yr.jsx)("div",{className:Y("layer-ui__wrapper__footer-right zen-mode-transition",{"transition-right":e.zenModeEnabled}),children:(0,yr.jsxs)("div",{style:{position:"relative"},children:[r&&(0,yr.jsx)(o.Out,{}),(0,yr.jsx)(pW,{onClick:()=>t.executeAction(Vf)})]})}),(0,yr.jsx)(_G,{actionManager:t,showExitZenModeBtn:n})]})},fW=G6,G6.displayName="Footer"}),MI,EW=I(()=>{"use strict";D(),MI=gW.default.createContext({})}),dS,yne=I(()=>{"use strict";D(),ce(),Re(),EW(),me(),Qc(),Zf(),dS=({children:e,className:t})=>{let n=Wn(),r=(0,bW.useContext)(MI),i=!!(n.editor.canFitSidebar&&r.shouldRenderDockButton);return(0,$c.jsxs)("div",{className:Y("sidebar__header",t),"data-testid":"sidebar-header",children:[e,(0,$c.jsxs)("div",{className:"sidebar__header__buttons",children:[i&&(0,$c.jsx)(xl,{label:x("labels.sidebarLock"),children:(0,$c.jsx)(ih,{onSelect:()=>r.onDock?.(!r.docked),selected:!!r.docked,className:"sidebar__dock","data-testid":"sidebar-dock","aria-label":x("labels.sidebarLock"),children:KT})}),(0,$c.jsx)(ih,{"data-testid":"sidebar-close",className:"sidebar__close",onSelect:r.onCloseRequest,"aria-label":x("buttons.close"),children:Ml})]})]})},dS.displayName="SidebarHeader"}),vne=I(()=>{}),uS,xne=I(()=>{"use strict";D(),Re(),Kn(),vne(),uS=({name:e,tab:t,icon:n,title:r,children:i,onToggle:o,className:a,style:s})=>{let l=Dn(),c=Rn();return(0,Fc.jsxs)("label",{title:r,className:"sidebar-trigger__label-element",children:[(0,Fc.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",onChange:d=>{document.querySelector(".layer-ui__wrapper")?.classList.remove("animate");let u=d.target.checked;l({openSidebar:u?{name:e,tab:t}:null}),o?.(u)},checked:c.openSidebar?.name===e,"aria-label":r,"aria-keyshortcuts":"0"}),(0,Fc.jsxs)("div",{className:Y("sidebar-trigger",a),style:s,children:[n&&(0,Fc.jsx)("div",{children:n}),i&&(0,Fc.jsx)("div",{className:"sidebar-trigger__label",children:i})]})]})},uS.displayName="SidebarTrigger"}),hS,wne=I(()=>{"use strict";D(),hS=({children:e,...t})=>(0,yW.jsx)(dg,{className:"sidebar-triggers",...t,children:e}),hS.displayName="SidebarTabTriggers"}),pS,Sne=I(()=>{"use strict";D(),pS=({children:e,tab:t,onSelect:n,...r})=>(0,mS.jsx)(ug,{value:t,asChild:!0,onSelect:n,children:(0,mS.jsx)("button",{type:"button",className:"excalidraw-button sidebar-tab-trigger",...r,children:e})}),pS.displayName="SidebarTabTrigger"}),fS,Tne=I(()=>{"use strict";D(),Kn(),Re(),fS=({children:e,...t})=>{let n=Rn(),r=Dn();if(!n.openSidebar)return null;let{name:i}=n.openSidebar;return(0,vW.jsx)(cg,{className:"sidebar-tabs-root",value:n.openSidebar.tab,onValueChange:o=>r(a=>({...a,openSidebar:{...a.openSidebar,name:i,tab:o}})),...t,children:e})},fS.displayName="SidebarTabs"}),gS,Cne=I(()=>{"use strict";D(),gS=({tab:e,children:t,...n})=>(0,xW.jsx)(hg,{...n,value:e,"data-testid":e,children:t}),gS.displayName="SidebarTab"}),Mne=I(()=>{}),tb,W6,Zs,by=I(()=>{"use strict";D(),Jc(),Ln(),EW(),yne(),Re(),ne(),Ce(),ae(),xne(),wne(),Sne(),Tne(),Cne(),Kn(),NM(),Mne(),tb=At(!1),W6=(0,wn.forwardRef)(({name:e,children:t,onDock:n,docked:r,className:i,...o},a)=>{Pt.DEV&&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=Dn(),l=ka(tb,Gn);(0,wn.useLayoutEffect)(()=>(l(!!r),()=>{l(!1)}),[l,r]);let c=(0,wn.useRef)({});c.current.onCloseRequest=()=>{s({openSidebar:null})},c.current.onDock=m=>n?.(m),c.current=xp(c.current,{docked:r,shouldRenderDockButton:!!n&&r!=null});let d=(0,wn.useRef)(null);(0,wn.useImperativeHandle)(a,()=>d.current);let u=Wn(),h=(0,wn.useCallback)(()=>{document.querySelector(".Dialog")||s({openSidebar:null})},[s]);return OM(d,(0,wn.useCallback)(m=>{m.target.closest(".sidebar-trigger")||(!r||!u.editor.canFitSidebar)&&h()},[h,r,u.editor.canFitSidebar])),(0,wn.useEffect)(()=>{let m=p=>{p.key===O.ESCAPE&&(!r||!u.editor.canFitSidebar)&&h()};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[h,r,u.editor.canFitSidebar]),(0,ES.jsx)(Co,{...o,className:Y("sidebar",{"sidebar--docked":r},i),ref:d,children:(0,ES.jsx)(MI.Provider,{value:c.current,children:t})})}),W6.displayName="SidebarInner",Zs=Object.assign((0,wn.forwardRef)((e,t)=>{let n=Rn(),{onStateChange:r}=e,i=(0,wn.useRef)(n.openSidebar);(0,wn.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?null:n.openSidebar),i.current=n.openSidebar},[n.openSidebar,r,e.name]);let[o,a]=(0,wn.useState)(!1);return(0,wn.useLayoutEffect)(()=>(a(!0),()=>a(!1)),[]),o&&n.openSidebar?.name===e.name?(0,wW.createElement)(W6,{...e,ref:t,key:e.name}):null}),{Header:dS,TabTriggers:hS,TabTrigger:pS,Tabs:fS,Tab:gS,Trigger:uS}),Zs.displayName="Sidebar"});async function Ine({title:e,description:t,actionLabel:n,color:r}){return new Promise(i=>{xo.set(II,{active:!0,onConfirm:()=>i(!0),onClose:()=>i(!1),onReject:()=>i(!1),title:e,description:t,actionLabel:n,color:r})})}var II,SW=I(()=>{"use strict";D(),Ln(),II=At({active:!1})}),j6,TW,kne=I(()=>{"use strict";D(),Re(),VG(),j6=({value:e,shortcut:t,onChange:n,choices:r,children:i,name:o})=>{let a=Wn();return(0,os.jsxs)(os.Fragment,{children:[(0,os.jsxs)("div",{className:"dropdown-menu-item-base dropdown-menu-item-bare",children:[(0,os.jsx)("label",{className:"dropdown-menu-item__text",htmlFor:o,children:i}),(0,os.jsx)(gI,{name:o,value:e,onChange:n,choices:r})]}),t&&!a.editor.isMobile&&(0,os.jsx)("div",{className:"dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned",children:t})]})},j6.displayName="DropdownMenuItemContentRadio",TW=j6}),Ane=I(()=>{}),CW={};Pf(CW,{ChangeCanvasBackground:()=>CS,ClearCanvas:()=>SS,CommandPalette:()=>xS,Export:()=>MS,Help:()=>wS,LiveCollaborationTrigger:()=>kS,LoadScene:()=>bS,SaveAsImage:()=>vS,SaveToActiveFile:()=>yS,Socials:()=>IS,ToggleTheme:()=>TS});var bS,yS,vS,xS,wS,SS,TS,CS,MS,IS,kS,_ne=I(()=>{"use strict";D(),gh(),ce(),Re(),me(),me(),rG(),lG(),ko(),py(),Ln(),Kn(),SW(),Yf(),kne(),ae(),li(),Ane(),bS=()=>{let{t:e}=ir(),t=Or(),n=Kf();return t.isActionEnabled(pf)?(0,Vt.jsx)(so,{icon:Hf,onSelect:async()=>{(!n.length||await Ine({title:e("overwriteConfirm.modal.loadFromFile.title"),actionLabel:e("overwriteConfirm.modal.loadFromFile.button"),color:"warning",description:(0,Vt.jsx)(yo,{i18nKey:"overwriteConfirm.modal.loadFromFile.description",bold:r=>(0,Vt.jsx)("strong",{children:r}),br:()=>(0,Vt.jsx)("br",{})})}))&&t.executeAction(pf)},"data-testid":"load-button",shortcut:wr("loadScene"),"aria-label":e("buttons.load"),children:e("buttons.load")}):null},bS.displayName="LoadScene",yS=()=>{let{t:e}=ir(),t=Or();return t.isActionEnabled(ZE)?(0,Vt.jsx)(so,{shortcut:wr("saveScene"),"data-testid":"save-button",onSelect:()=>t.executeAction(ZE),icon:gC,"aria-label":`${e("buttons.save")}`,children:`${e("buttons.save")}`}):null},yS.displayName="SaveToActiveFile",vS=()=>{let e=Dn(),{t}=ir();return(0,Vt.jsx)(so,{icon:_b,"data-testid":"image-export-button",onSelect:()=>e({openDialog:{name:"imageExport"}}),shortcut:wr("imageExport"),"aria-label":t("buttons.exportImage"),children:t("buttons.exportImage")})},vS.displayName="SaveAsImage",xS=e=>{let t=Dn(),{t:n}=ir();return(0,Vt.jsx)(so,{icon:Fb,"data-testid":"command-palette-button",onSelect:()=>{ot("command_palette","open","menu"),t({openDialog:{name:"commandPalette"}})},shortcut:wr("commandPalette"),"aria-label":n("commandPalette.title"),className:e?.className,children:n("commandPalette.title")})},xS.displayName="CommandPalette",wS=()=>{let{t:e}=ir(),t=Or();return(0,Vt.jsx)(so,{"data-testid":"help-menu-item",icon:zf,onSelect:()=>t.executeAction(Vf),shortcut:"?","aria-label":e("helpDialog.title"),children:e("helpDialog.title")})},wS.displayName="Help",SS=()=>{let{t:e}=ir(),t=ka(yf,Gn);return Or().isActionEnabled(Rc)?(0,Vt.jsx)(so,{icon:bl,onSelect:()=>t("clearCanvas"),"data-testid":"clear-canvas-button","aria-label":e("buttons.clearReset"),children:e("buttons.clearReset")}):null},SS.displayName="ClearCanvas",TS=e=>{let{t}=ir(),n=Rn(),r=Or(),i=wr("toggleTheme");return r.isActionEnabled(eh)?e?.allowSystemTheme?(0,Vt.jsx)(TW,{name:"theme",value:e.theme,onChange:o=>e.onSelect(o),choices:[{value:$e.LIGHT,label:of,ariaLabel:`${t("buttons.lightMode")} - ${i}`},{value:$e.DARK,label:rf,ariaLabel:`${t("buttons.darkMode")} - ${i}`},{value:"system",label:CM,ariaLabel:t("buttons.systemMode")}],children:t("labels.theme")}):(0,Vt.jsx)(so,{onSelect:o=>{if(o.preventDefault(),e?.onSelect)e.onSelect(n.theme===$e.DARK?$e.LIGHT:$e.DARK);else return r.executeAction(eh)},icon:n.theme===$e.DARK?of:rf,"data-testid":"toggle-dark-mode",shortcut:i,"aria-label":n.theme===$e.DARK?t("buttons.lightMode"):t("buttons.darkMode"),children:n.theme===$e.DARK?t("buttons.lightMode"):t("buttons.darkMode")}):null},TS.displayName="ToggleTheme",CS=()=>{let{t:e}=ir(),t=Rn(),n=Or(),r=Xf();return t.viewModeEnabled||!r.UIOptions.canvasActions.changeViewBackgroundColor?null:(0,Vt.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,Vt.jsx)("div",{"data-testid":"canvas-background-label",style:{fontSize:".75rem",marginBottom:".5rem"},children:e("labels.canvasBackground")}),(0,Vt.jsx)("div",{style:{padding:"0 0.625rem"},children:n.renderAction("changeViewBackgroundColor")})]})},CS.displayName="ChangeCanvasBackground",MS=()=>{let{t:e}=ir(),t=Dn();return(0,Vt.jsx)(so,{icon:Ju,onSelect:()=>{t({openDialog:{name:"jsonExport"}})},"data-testid":"json-export-button","aria-label":e("buttons.export"),children:e("buttons.export")})},MS.displayName="Export",IS=()=>{let{t:e}=ir();return(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsx)(Np,{icon:Ab,href:"https://github.com/excalidraw/excalidraw","aria-label":"GitHub",children:"GitHub"}),(0,Vt.jsx)(Np,{icon:pC,href:"https://x.com/excalidraw","aria-label":"X",children:e("labels.followUs")}),(0,Vt.jsx)(Np,{icon:mC,href:"https://discord.gg/UexuTaE","aria-label":"Discord",children:e("labels.discordChat")})]})},IS.displayName="Socials",kS=({onSelect:e,isCollaborating:t})=>{let{t:n}=ir();return(0,Vt.jsx)(so,{"data-testid":"collab-button",icon:Pb,className:Y({"active-collab":t}),onSelect:e,children:n("labels.liveCollaboration")})},kS.displayName="LiveCollaborationTrigger"}),ah,vy=I(()=>{"use strict";D(),Hi(),ah=(e,t)=>{let n=At(0),r=i=>{let{jotaiScope:o}=dr(),[,a]=Ve(n,o),s=(0,yy.useRef)({preferHost:!1,counter:0});return(0,yy.useLayoutEffect)(()=>{let l=s.current;return a(c=>{let d=c+1;return l.counter=d,d}),()=>{a(c=>{let d=c-1;return l.counter=d,d||(l.preferHost=!1),d})}},[a]),i.__fallback||(s.current.preferHost=!0),!s.current.counter&&i.__fallback&&s.current.preferHost||s.current.counter>1&&i.__fallback?null:(0,MW.jsx)(t,{...i})};return r.displayName=e,r}}),iN,Dr,IW=I(()=>{"use strict";D(),Re(),sy(),_ne(),cW(),ce(),me(),vy(),ne(),Hi(),Kn(),iN=Object.assign(ah("MainMenu",({children:e,onSelect:t})=>{let{MainMenuTunnel:n}=dr(),r=Wn(),i=Rn(),o=Dn(),a=r.editor.isMobile?void 0:()=>o({openMenu:null});return(0,Ja.jsx)(n.In,{children:(0,Ja.jsxs)(vt,{open:i.openMenu==="canvas",children:[(0,Ja.jsx)(vt.Trigger,{onToggle:()=>{o({openMenu:i.openMenu==="canvas"?null:"canvas"})},"data-testid":"main-menu-trigger",className:"main-menu-trigger",children:kb}),(0,Ja.jsxs)(vt.Content,{onClickOutside:a,onSelect:Lf(t,()=>{o({openMenu:null})}),children:[e,r.editor.isMobile&&i.collaborators.size>0&&(0,Ja.jsxs)("fieldset",{className:"UserList-Wrapper",children:[(0,Ja.jsx)("legend",{children:x("labels.collaborators")}),(0,Ja.jsx)(CI,{mobile:!0,collaborators:i.collaborators,userToFollow:i.userToFollow?.socketId||null})]})]})]})})}),{Trigger:vt.Trigger,Item:vt.Item,ItemLink:vt.ItemLink,ItemCustom:vt.ItemCustom,Group:vt.Group,Separator:vt.Separator,DefaultItems:CW}),Dr=iN}),$2,oN,aN,AS,Pne=I(()=>{"use strict";D(),Ey(),Re(),ko(),ce(),Xb(),$2=({title:e,children:t,actionLabel:n,onClick:r})=>(0,za.jsxs)("div",{className:"OverwriteConfirm__Actions__Action",children:[(0,za.jsx)("h4",{children:e}),(0,za.jsx)("div",{className:"OverwriteConfirm__Actions__Action__content",children:t}),(0,za.jsx)(Nc,{variant:"outlined",color:"muted",label:n,size:"large",fullWidth:!0,onClick:r})]}),oN=()=>{let{t:e}=ir(),t=Or(),n=Dn();return(0,za.jsx)($2,{title:e("overwriteConfirm.action.exportToImage.title"),actionLabel:e("overwriteConfirm.action.exportToImage.button"),onClick:()=>{t.executeAction(WM,"ui",!0),n({openDialog:{name:"imageExport"}})},children:e("overwriteConfirm.action.exportToImage.description")})},aN=()=>{let{t:e}=ir(),t=Or();return(0,za.jsx)($2,{title:e("overwriteConfirm.action.saveToDisk.title"),actionLabel:e("overwriteConfirm.action.saveToDisk.button"),onClick:()=>{t.executeAction(Zb,"ui")},children:e("overwriteConfirm.action.saveToDisk.description")})},AS=Object.assign(({children:e})=>(0,za.jsx)("div",{className:"OverwriteConfirm__Actions",children:e}),{ExportToImage:oN,SaveToDisk:aN})}),Dne=I(()=>{}),F2,Lne=I(()=>{"use strict";D(),Hi(),Ln(),zi(),vy(),SW(),Ey(),me(),Pne(),Dne(),F2=Object.assign(ah("OverwriteConfirmDialog",({children:e})=>{let{OverwriteConfirmDialogTunnel:t}=dr(),[n,r]=Ve(II,Gn);if(!n.active)return null;let i=()=>{n.onClose(),r(a=>({...a,active:!1}))},o=()=>{n.onConfirm(),r(a=>({...a,active:!1}))};return(0,Ai.jsx)(t.In,{children:(0,Ai.jsx)(ci,{onCloseRequest:i,title:!1,size:916,children:(0,Ai.jsxs)("div",{className:"OverwriteConfirm",children:[(0,Ai.jsx)("h3",{children:n.title}),(0,Ai.jsxs)("div",{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${n.color}`,children:[(0,Ai.jsx)("div",{className:"OverwriteConfirm__Description__icon",children:sM}),(0,Ai.jsx)("div",{children:n.description}),(0,Ai.jsx)("div",{className:"OverwriteConfirm__Description__spacer"}),(0,Ai.jsx)(Nc,{color:n.color,size:"large",label:n.actionLabel,onClick:o})]}),(0,Ai.jsx)(AS,{children:e})]})})})}),{Actions:AS,Action:$2})}),U6,V6,_S,AW=I(()=>{"use strict";D(),ae(),Hi(),Kn(),ce(),ne(),Re(),vy(),dy(),by(),U6=ah("DefaultSidebarTrigger",e=>{let{DefaultSidebarTriggerTunnel:t}=dr();return(0,_i.jsx)(t.In,{children:(0,_i.jsx)(Zs.Trigger,{...e,className:"default-sidebar-trigger",name:es.name})})}),U6.displayName="DefaultSidebarTrigger",V6=({children:e,...t})=>{let{DefaultSidebarTabTriggersTunnel:n}=dr();return(0,_i.jsx)(n.In,{children:(0,_i.jsx)(Zs.TabTriggers,{...t,children:e})})},V6.displayName="DefaultTabTriggers",_S=Object.assign(ah("DefaultSidebar",({children:e,className:t,onDock:n,docked:r,...i})=>{let o=Rn(),a=Dn(),{DefaultSidebarTabTriggersTunnel:s}=dr();return(0,kW.createElement)(Zs,{...i,name:"default",key:"default",className:Y("default-sidebar",t),docked:r??o.defaultSidebarDockedPreference,onDock:n===!1||!n&&r!=null?void 0:Lf(n,l=>{a({defaultSidebarDockedPreference:l})})},(0,_i.jsxs)(Zs.Tabs,{children:[(0,_i.jsxs)(Zs.Header,{children:[i.__fallback&&(0,_i.jsx)("div",{style:{color:"var(--color-primary)",fontSize:"1.2em",fontWeight:"bold",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",paddingRight:"1em"},children:x("toolBar.library")}),(0,_i.jsx)(s.Out,{})]}),(0,_i.jsx)(Zs.Tab,{tab:X2,children:(0,_i.jsx)(xG,{})}),e]}))}),{Trigger:U6,TabTriggers:V6})}),Rne=I(()=>{}),One=I(()=>{}),sN,_W,Nne=I(()=>{"use strict";D(),Cl(),me(),sN="small",_W=e=>(0,Sf.jsxs)("label",{className:Y("ToolIcon ToolIcon__LaserPointer",`ToolIcon_size_${sN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,Sf.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,Sf.jsx)("div",{className:"ToolIcon__icon",children:Nb})]})}),mu,$ne=I(()=>{"use strict";D(),mu=e=>(0,PW.jsx)("p",{className:"excalidraw__paragraph",style:e.style,children:e.children})}),Fne=I(()=>{}),Y6,kI,LW=I(()=>{"use strict";D(),Re(),ne(),Y6=e=>{let t=Dn(),n=(0,PS.useRef)(null),r=(0,PS.useRef)(0);return(0,DW.jsx)(cg,{ref:n,className:"ttd-dialog-tabs-root",value:e.tab,onValueChange:i=>{if(!i)return;let o=n.current?.closest(".Modal__content");if(o){let a=o.offsetHeight||0;a>r.current&&(r.current=a,o.style.minHeight=`min(${r.current}px, 100%)`)}e.dialog==="settings"&&q2(["text-to-diagram","diagram-to-code"],i)?t({openDialog:{name:e.dialog,tab:i,source:"settings"}}):e.dialog==="ttd"&&q2(["text-to-diagram","mermaid"],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})},Y6.displayName="TTDDialogTabs",kI=Y6}),Tf,OW=I(()=>{"use strict";D(),Tf=({tab:e,children:t,...n})=>(0,RW.jsx)(hg,{...n,value:e,children:t}),Tf.displayName="TTDDialogTab"}),NW,Bne=I(()=>{"use strict";D(),zi(),SG(),me(),Ey(),zM(),Ce(),Kn(),uI(),$ne(),Fne(),LW(),OW(),NW=e=>{let[t,n]=(0,DS.useState)(e.openAIKey||""),[r,i]=(0,DS.useState)(e.isPersisted),o=Rn(),a=()=>{e.onConfirm(t.trim(),r)};return o.openDialog?.name!=="settings"?null:(0,dn.jsx)(ci,{onCloseRequest:()=>{e.onClose(),e.onConfirm(t.trim(),r)},title:(0,dn.jsxs)("div",{style:{display:"flex"},children:["Wireframe to Code (AI)"," ",(0,dn.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0.1rem 0.5rem",marginLeft:"1rem",fontSize:14,borderRadius:"12px",color:"#000",background:"pink"},children:"Experimental"})]}),className:"MagicSettings",autofocus:!1,children:(0,dn.jsx)(kI,{dialog:"settings",tab:o.openDialog.tab,children:(0,dn.jsxs)(Tf,{tab:"diagram-to-code",children:[(0,dn.jsxs)(mu,{children:["For the diagram-to-code feature we use"," ",(0,dn.jsx)(Nu,{icon:sf}),"OpenAI."]}),(0,dn.jsxs)(mu,{children:["While the OpenAI API is in beta, its use is strictly limited \u2014 as such we require you use your own API key. You can create an"," ",(0,dn.jsx)("a",{href:"https://platform.openai.com/login?launch",rel:"noopener noreferrer",target:"_blank",children:"OpenAI account"}),", add a small credit (5 USD minimum), and"," ",(0,dn.jsx)("a",{href:"https://platform.openai.com/api-keys",rel:"noopener noreferrer",target:"_blank",children:"generate your own API key"}),"."]}),(0,dn.jsx)(mu,{children:"Your OpenAI key does not leave the browser, and you can also set your own limit in your OpenAI account dashboard if needed."}),(0,dn.jsx)(dI,{isRedacted:!0,value:t,placeholder:"Paste your API key here",label:"OpenAI API key",onChange:s=>{n(s),e.onChange(s.trim(),r)},selectOnRender:!0,onKeyDown:s=>s.key===O.ENTER&&a()}),(0,dn.jsx)(mu,{children:"By default, your API token is not persisted anywhere so you'll need to insert it again after reload. But, you can persist locally in your browser below."}),(0,dn.jsx)(mf,{checked:r,onChange:i,children:"Persist API key in browser storage"}),(0,dn.jsxs)(mu,{children:["Once API key is set, you can use the ",(0,dn.jsx)(Nu,{icon:Gf})," ","tool to wrap your elements in a frame that will then allow you to turn it into code. This dialog can be accessed using the"," ",(0,dn.jsx)("b",{children:"AI Settings"})," ",(0,dn.jsx)(Nu,{icon:sf}),"."]}),(0,dn.jsx)(Nc,{className:"MagicSettings__confirm",size:"large",label:"Confirm",onClick:a})]})})})}}),zne=I(()=>{}),lN,AI,nb,_I,$W=I(()=>{"use strict";D(),ae(),FI(),si(),ny(),ce(),lN=({canvasRef:e,setError:t})=>{let n=e.current;if(!n)return;let r=n.parentElement;r&&(r.style.background="",t(null),n.replaceChildren())},AI=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:n,setError:r,data:i})=>{let o=e.current,a=o?.parentElement;if(!(!o||!a)){if(!n){lN({canvasRef:e,setError:r});return}try{let s=await t.api,l;try{l=await s.parseMermaidToExcalidraw(n,{fontSize:Ni})}catch{l=await s.parseMermaidToExcalidraw(n.replace(/"/g,"'"),{fontSize:Ni})}let{elements:c,files:d}=l;r(null),i.current={elements:OI(c,{regenerateIds:!0}),files:d};let u=await Jp({data:{elements:i.current.elements,files:i.current.files},config:{padding:lh,maxWidthOrHeight:Math.max(a.offsetWidth,a.offsetHeight)*window.devicePixelRatio}});try{await Yu(u)}catch(h){throw h.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(x("canvasError.canvasTooBig")):h}a.style.background="var(--default-bg-color)",o.replaceChildren(u)}catch(s){throw a.style.background="var(--default-bg-color)",n&&r(s),s}}},nb=e=>{is.set(ts.MERMAID_TO_EXCALIDRAW,e)},_I=({app:e,data:t,text:n,shouldSaveMermaidDataToStorage:r})=>{let{elements:i,files:o}=t.current;i.length&&(e.addElementsFromPasteOrLibrary({elements:i,files:o,position:"center",fitToContent:!0}),e.setOpenDialog(null),r&&n&&nb(n))}}),PI,BW=I(()=>{"use strict";D(),PI=({children:e})=>(0,FW.jsx)("div",{className:"ttd-dialog-panels",children:e})}),Cf,zW=I(()=>{"use strict";D(),Zf(),wl(),Cf=({label:e,children:t,panelAction:n,panelActionDisabled:r=!1,onTextSubmitInProgess:i,renderTopRight:o,renderSubmitShortcut:a,renderBottomRight:s})=>(0,ta.jsxs)("div",{className:"ttd-dialog-panel",children:[(0,ta.jsxs)("div",{className:"ttd-dialog-panel__header",children:[(0,ta.jsx)("label",{children:e}),o?.()]}),t,(0,ta.jsxs)("div",{className:Y("ttd-dialog-panel-button-container",{invisible:!n}),style:{display:"flex",alignItems:"center"},children:[(0,ta.jsxs)(ih,{className:"ttd-dialog-panel-button",onSelect:n?n.action:()=>{},disabled:r||i,children:[(0,ta.jsxs)("div",{className:Y({invisible:i}),children:[n?.label,n?.icon&&(0,ta.jsx)("span",{children:n.icon})]}),i&&(0,ta.jsx)(oa,{})]}),!r&&!i&&a?.(),s?.()]})]})}),DI,GW=I(()=>{"use strict";D(),ae(),Ce(),DI=({input:e,placeholder:t,onChange:n,onKeyboardSubmit:r})=>{let i=(0,Mf.useRef)(null),o=(0,Mf.useRef)(r);return o.current=r,(0,Mf.useEffect)(()=>{if(!o.current)return;let a=i.current;if(a){let s=l=>{l[O.CTRL_OR_CMD]&&l.key===O.ENTER&&(l.preventDefault(),o.current?.())};return a.addEventListener("keydown",s),()=>{a.removeEventListener("keydown",s)}}},[]),(0,HW.jsx)("textarea",{className:"ttd-dialog-input",onChange:n,value:e,placeholder:t,autoFocus:!0,ref:i})}}),cN,LI,WW=I(()=>{"use strict";D(),wl(),cN=({error:e})=>(0,sl.jsxs)("div",{"data-testid":"ttd-dialog-output-error",className:"ttd-dialog-output-error",children:["Error! ",(0,sl.jsx)("p",{children:e})]}),LI=({error:e,canvasRef:t,loaded:n})=>(0,sl.jsxs)("div",{className:"ttd-dialog-output-wrapper",children:[e&&(0,sl.jsx)(cN,{error:e.message}),n?(0,sl.jsx)("div",{ref:t,style:{opacity:e?"0.15":1},className:"ttd-dialog-output-canvas-container"}):(0,sl.jsx)(oa,{size:"2rem"})]})}),RI,jW=I(()=>{"use strict";D(),ne(),RI=()=>(0,If.jsxs)("div",{className:"ttd-dialog-submit-shortcut",children:[(0,If.jsx)("div",{className:"ttd-dialog-submit-shortcut__key",children:V("CtrlOrCmd")}),(0,If.jsx)("div",{className:"ttd-dialog-submit-shortcut__key",children:V("Enter")})]})}),dN,Z6,uN,UW,Hne=I(()=>{"use strict";D(),Re(),me(),zne(),ce(),Yf(),$W(),BW(),zW(),GW(),WW(),ny(),ae(),ne(),jW(),dN=`flowchart TD
178
- A[Christmas] -->|Get money| B(Go shopping)
179
- B --> C{Let me think}
180
- C -->|One| D[Laptop]
181
- C -->|Two| E[iPhone]
182
- C -->|Three| F[Car]`,Z6=Hp(nb,300),uN=({mermaidToExcalidrawLib:e})=>{let[t,n]=(0,Io.useState)(()=>is.get(ts.MERMAID_TO_EXCALIDRAW)||dN),r=(0,Io.useDeferredValue)(t.trim()),[i,o]=(0,Io.useState)(null),a=(0,Io.useRef)(null),s=(0,Io.useRef)({elements:[],files:null}),l=_l();(0,Io.useEffect)(()=>{AI({canvasRef:a,data:s,mermaidToExcalidrawLib:e,setError:o,mermaidDefinition:r}).catch(d=>{z$()&&console.error("Failed to parse mermaid definition",d)}),Z6(r)},[r,e]),(0,Io.useEffect)(()=>()=>{Z6.flush()},[]);let c=()=>{_I({app:l,data:s,text:t,shouldSaveMermaidDataToStorage:!0})};return(0,ar.jsxs)(ar.Fragment,{children:[(0,ar.jsx)("div",{className:"ttd-dialog-desc",children:(0,ar.jsx)(yo,{i18nKey:"mermaid.description",flowchartLink:d=>(0,ar.jsx)("a",{href:"https://mermaid.js.org/syntax/flowchart.html",children:d}),sequenceLink:d=>(0,ar.jsx)("a",{href:"https://mermaid.js.org/syntax/sequenceDiagram.html",children:d}),classLink:d=>(0,ar.jsx)("a",{href:"https://mermaid.js.org/syntax/classDiagram.html",children:d})})}),(0,ar.jsxs)(PI,{children:[(0,ar.jsx)(Cf,{label:x("mermaid.syntax"),children:(0,ar.jsx)(DI,{input:t,placeholder:"Write Mermaid diagram defintion here...",onChange:d=>n(d.target.value),onKeyboardSubmit:()=>{c()}})}),(0,ar.jsx)(Cf,{label:x("mermaid.preview"),panelAction:{action:()=>{c()},label:x("mermaid.button"),icon:ku},renderSubmitShortcut:()=>(0,ar.jsx)(RI,{}),children:(0,ar.jsx)(LI,{canvasRef:a,loaded:e.loaded,error:i})})]})]})},UW=uN}),LS,Gne=I(()=>{"use strict";D(),LS=({children:e,...t})=>(0,VW.jsx)(dg,{className:"ttd-dialog-triggers",...t,children:e}),LS.displayName="TTDDialogTabTriggers"}),rb,Wne=I(()=>{"use strict";D(),rb=({children:e,tab:t,onSelect:n,...r})=>(0,RS.jsx)(ug,{value:t,asChild:!0,onSelect:n,children:(0,RS.jsx)("button",{type:"button",className:"ttd-dialog-tab-trigger",...r,children:e})}),rb.displayName="TTDDialogTabTrigger"}),jne=I(()=>{}),Wg,dc,hN,mN,YW,pN,ZW=I(()=>{"use strict";D(),zi(),Re(),Hne(),LW(),Kn(),vy(),Gne(),Wne(),OW(),ce(),GW(),WW(),zW(),BW(),$W(),me(),jne(),ne(),li(),uI(),jW(),Wg=3,dc=1e3,hN=At(null),mN=At(null),YW=e=>{let t=Rn();return t.openDialog?.name!=="ttd"?null:(0,Ht.jsx)(pN,{...e,tab:t.openDialog.tab})},pN=ah("TTDDialogBase",({tab:e,...t})=>{let n=_l(),r=Dn(),i=(0,vo.useRef)(null),[o,a]=Ve(mN),[s,l]=(0,vo.useState)(o?.prompt??""),c=s.trim(),d=k=>{l(k.target.value),a(M=>({generatedResponse:M?.generatedResponse??null,prompt:k.target.value}))},[u,h]=(0,vo.useState)(!1),[m,p]=Ve(hN),f=async()=>{if(c.length>dc||c.length<Wg||u||m?.rateLimitRemaining===0||"__fallback"in t){c.length<Wg&&T(new Error(`Prompt is too short (min ${Wg} characters)`)),c.length>dc&&T(new Error(`Prompt is too long (max ${dc} characters)`));return}try{h(!0),ot("ai","generate","ttd");let{generatedResponse:k,error:M,rateLimit:C,rateLimitRemaining:P}=await t.onTextSubmit(c);if(typeof k=="string"&&a(R=>({generatedResponse:k,prompt:R?.prompt??null})),A5(C)&&A5(P)&&p({rateLimit:C,rateLimitRemaining:P}),M){T(M);return}if(!k){T(new Error("Generation failed"));return}try{await AI({canvasRef:i,data:y,mermaidToExcalidrawLib:b,setError:T,mermaidDefinition:k}),ot("ai","mermaid parse success","ttd")}catch(R){console.info(`%cTTD mermaid render errror: ${R.message}`,"color: red"),console.info(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
183
- TTD mermaid definition render errror: ${R.message}`,"color: yellow"),ot("ai","mermaid parse failed","ttd"),T(new Error("Generated an invalid diagram :(. You may also try a different prompt."))}}catch(k){let M=k.message;(!M||M==="Failed to fetch")&&(M="Request failed"),T(new Error(M))}finally{h(!1)}},g=(0,vo.useRef)(f);g.current=f;let[b,v]=(0,vo.useState)({loaded:!1,api:import("./dist-F2IUHSJR.js")});(0,vo.useEffect)(()=>{(async()=>(await b.api,v(k=>({...k,loaded:!0}))))()},[b.api]);let y=(0,vo.useRef)({elements:[],files:null}),[w,T]=(0,vo.useState)(null);return(0,Ht.jsx)(ci,{className:"ttd-dialog",onCloseRequest:()=>{n.setOpenDialog(null)},size:1200,title:!1,...t,autofocus:!1,children:(0,Ht.jsxs)(kI,{dialog:"ttd",tab:e,children:["__fallback"in t&&t.__fallback?(0,Ht.jsx)("p",{className:"dialog-mermaid-title",children:x("mermaid.title")}):(0,Ht.jsxs)(LS,{children:[(0,Ht.jsx)(rb,{tab:"text-to-diagram",children:(0,Ht.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[x("labels.textToDiagram"),(0,Ht.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1px 6px",marginLeft:"10px",fontSize:10,borderRadius:"12px",background:"pink",color:"#000"},children:"AI Beta"})]})}),(0,Ht.jsx)(rb,{tab:"mermaid",children:"Mermaid"})]}),(0,Ht.jsx)(Tf,{className:"ttd-dialog-content",tab:"mermaid",children:(0,Ht.jsx)(UW,{mermaidToExcalidrawLib:b})}),!("__fallback"in t)&&(0,Ht.jsxs)(Tf,{className:"ttd-dialog-content",tab:"text-to-diagram",children:[(0,Ht.jsx)("div",{className:"ttd-dialog-desc",children:"Currently we use Mermaid as a middle step, so you'll get best results if you describe a diagram, workflow, flow chart, and similar."}),(0,Ht.jsxs)(PI,{children:[(0,Ht.jsx)(Cf,{label:x("labels.prompt"),panelAction:{action:f,label:"Generate",icon:ku},onTextSubmitInProgess:u,panelActionDisabled:c.length>dc||m?.rateLimitRemaining===0,renderTopRight:()=>m?(0,Ht.jsxs)("div",{className:"ttd-dialog-rate-limit",style:{fontSize:12,marginLeft:"auto",color:m.rateLimitRemaining===0?"var(--color-danger)":void 0},children:[m.rateLimitRemaining," requests left today"]}):null,renderSubmitShortcut:()=>(0,Ht.jsx)(RI,{}),renderBottomRight:()=>{if(typeof o?.generatedResponse=="string")return(0,Ht.jsxs)("div",{className:"excalidraw-link",style:{marginLeft:"auto",fontSize:14},onClick:()=>{typeof o?.generatedResponse=="string"&&(nb(o.generatedResponse),r({openDialog:{name:"ttd",tab:"mermaid"}}))},children:["View as Mermaid",(0,Ht.jsx)(Nu,{icon:ku})]});let k=c.length/dc;return k>.8?(0,Ht.jsxs)("div",{style:{marginLeft:"auto",fontSize:12,fontFamily:"monospace",color:k>1?"var(--color-danger)":void 0},children:["Length: ",c.length,"/",dc]}):null},children:(0,Ht.jsx)(DI,{onChange:d,input:s,placeholder:"Describe what you want to see...",onKeyboardSubmit:()=>{g.current()}})}),(0,Ht.jsx)(Cf,{label:"Preview",panelAction:{action:()=>{console.info("Panel action clicked"),_I({app:n,data:y})},label:"Insert",icon:ku},children:(0,Ht.jsx)(LI,{canvasRef:i,error:w,loaded:b.loaded})})]})]})]})})})}),fN,gN,EN,X6,bN,KW,Une=I(()=>{"use strict";D(),ae(),Pe(),ce(),pt(),ne(),hy(),Zte(),ene(),XG(),KG(),Jc(),k$(),qG(),ane(),lne(),vI(),une(),ph(),cW(),gne(),eW(),li(),Re(),tW(),AH(),bne(),by(),Ln(),IW(),py(),Lne(),rW(),$i(),Hi(),me(),Kn(),AW(),Vb(),Rne(),One(),wt(),ca(),Sl(),Nne(),Bne(),ZW(),fN=({UIOptions:e})=>(0,se.jsxs)(Dr,{__fallback:!0,children:[(0,se.jsx)(Dr.DefaultItems.LoadScene,{}),(0,se.jsx)(Dr.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,se.jsx)(Dr.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,se.jsx)(Dr.DefaultItems.SaveAsImage,{}),(0,se.jsx)(Dr.DefaultItems.Help,{}),(0,se.jsx)(Dr.DefaultItems.ClearCanvas,{}),(0,se.jsx)(Dr.Separator,{}),(0,se.jsx)(Dr.Group,{title:"Excalidraw links",children:(0,se.jsx)(Dr.DefaultItems.Socials,{})}),(0,se.jsx)(Dr.Separator,{}),(0,se.jsx)(Dr.DefaultItems.ToggleTheme,{}),(0,se.jsx)(Dr.DefaultItems.ChangeCanvasBackground,{})]}),gN=()=>(0,se.jsxs)(F2,{__fallback:!0,children:[(0,se.jsx)(F2.Actions.SaveToDisk,{}),(0,se.jsx)(F2.Actions.ExportToImage,{})]}),EN=({actionManager:e,appState:t,files:n,setAppState:r,elements:i,canvas:o,onLockToggle:a,onHandToolToggle:s,onPenModeToggle:l,showExitZenModeBtn:c,renderTopRightUI:d,renderCustomStats:u,UIOptions:h,onExportImage:m,renderWelcomeScreen:p,onHomeButtonClick:f,children:g,app:b,isCollaborating:v,openAIKey:y,isOpenAIKeyPersisted:w,onOpenAIAPIKeyChange:T,onMagicSettingsConfirm:k,uiDisabled:M})=>{let C=Wn(),P=MG(),[R,A]=Ve(Uf,Gn),_=()=>h.canvasActions.export?(0,se.jsx)(hW,{elements:i,appState:t,files:n,actionManager:e,exportOpts:h.canvasActions.export,canvas:o,setAppState:r}):null,$=()=>!h.canvasActions.saveAsImage||t.openDialog?.name!=="imageExport"?null:(0,se.jsx)(YG,{elements:i,appState:t,files:n,actionManager:e,onExportImage:m,onCloseRequest:()=>r({openDialog:null}),name:b.getName()}),W=()=>(0,se.jsxs)("div",{style:{position:"relative"},children:[(0,se.jsx)(P.MainMenuTunnel.Out,{}),p&&(0,se.jsx)(P.WelcomeScreenMenuHintTunnel.Out,{})]}),H=()=>(0,se.jsx)(oh,{heading:"selectedShapeActions",className:Y("selected-shape-actions zen-mode-transition",{"transition-left":t.zenModeEnabled}),children:(0,se.jsx)(Co,{className:US.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:(0,se.jsx)(mI,{appState:t,elementsMap:b.scene.getNonDeletedElementsMap(),renderAction:e.renderAction})})}),K=()=>{let F=Cb(t,i);return(0,se.jsx)(EI,{side:"top",children:(0,se.jsxs)("div",{className:"App-menu App-menu_top",children:[(0,se.jsxs)(ii.Col,{gap:6,className:Y("App-menu_top__left"),children:[W(),F&&H()]}),!t.viewModeEnabled&&(0,se.jsx)(oh,{heading:"shapes",className:"shapes-section",children:B=>(0,se.jsxs)("div",{style:{position:"relative"},children:[p&&(0,se.jsx)(P.WelcomeScreenToolbarHintTunnel.Out,{}),(0,se.jsx)(ii.Col,{gap:4,align:"start",children:(0,se.jsxs)(ii.Row,{gap:1,className:Y("App-toolbar-container",{"zen-mode":t.zenModeEnabled}),children:[(0,se.jsxs)(Co,{padding:1,className:Y("App-toolbar",{"zen-mode":t.zenModeEnabled}),children:[(0,se.jsx)(bI,{appState:t,isMobile:C.editor.isMobile,device:C,app:b}),B,(0,se.jsxs)(ii.Row,{gap:1,children:[(0,se.jsx)(wI,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>l(null),title:x("toolBar.penMode"),penDetected:t.penDetected}),(0,se.jsx)(yI,{checked:t.activeTool.locked,onChange:a,title:x("toolBar.lock")}),(0,se.jsx)("div",{className:"App-toolbar__divider"}),(0,se.jsx)(TI,{checked:Hc(t),onChange:()=>s(),title:x("toolBar.hand"),isMobile:!0}),(0,se.jsx)(pI,{appState:t,activeTool:t.activeTool,UIOptions:h,app:b})]})]}),v&&(0,se.jsx)(Co,{style:{marginLeft:8,alignSelf:"center",height:"fit-content"},children:(0,se.jsx)(_W,{title:x("toolBar.laser"),checked:t.activeTool.type===_n.laser,onChange:()=>b.setActiveTool({type:_n.laser}),isMobile:!0})})]})})]})}),(0,se.jsxs)("div",{className:Y("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":t.zenModeEnabled}),children:[t.collaborators.size>0&&(0,se.jsx)(CI,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),d?.(C.editor.isMobile,t),!t.viewModeEnabled&&(!ie||t.openSidebar?.name!==es.name)&&(0,se.jsx)(P.DefaultSidebarTriggerTunnel.Out,{})]})]})})},Q=()=>(0,se.jsx)(_S,{__fallback:!0,onDock:F=>{ot("sidebar",`toggleDock (${F?"dock":"undock"})`,`(${C.editor.isMobile?"mobile":"desktop"})`)}}),ie=vm(tb,Gn);if(M)return null;let X=(0,se.jsxs)(se.Fragment,{children:[g,(0,se.jsx)(fN,{UIOptions:h}),(0,se.jsx)(_S.Trigger,{__fallback:!0,icon:Ib,title:Pc(x("toolBar.library")),onToggle:F=>{F&&ot("sidebar",`${es.name} (open)`,`button (${C.editor.isMobile?"mobile":"desktop"})`)},tab:es.defaultTab,children:x("toolBar.library")}),(0,se.jsx)(gN,{}),t.openDialog?.name==="ttd"&&(0,se.jsx)(YW,{__fallback:!0}),t.isLoading&&(0,se.jsx)(KS,{delay:250}),t.errorMessage&&(0,se.jsx)(UG,{onClose:()=>r({errorMessage:null}),children:t.errorMessage}),R&&!C.editor.isMobile&&(0,se.jsx)(Rz,{colorPickerType:R.colorPickerType,onCancel:()=>{A(null)},onChange:(F,B,U,{altKey:G})=>{if(!(F!=="elementBackground"&&F!=="elementStroke"))if(U.length){for(let Z of U)re(Z,{[G&&R.swapPreviewOnAlt?F==="elementBackground"?"strokeColor":"backgroundColor":F==="elementBackground"?"backgroundColor":"strokeColor"]:B},!1),jt.delete(Z);Hn.getScene(U[0])?.informMutation()}else r(F==="elementBackground"?{currentItemBackgroundColor:B}:{currentItemStrokeColor:B})},onSelect:(F,B)=>{A(U=>U?.keepOpenOnAlt&&B.altKey?U:null),R?.onSelect?.(F,B)}}),t.openDialog?.name==="help"&&(0,se.jsx)(lW,{onClose:()=>{r({openDialog:null})}}),t.openDialog?.name==="settings"&&(0,se.jsx)(NW,{openAIKey:y,isPersisted:w,onChange:T,onConfirm:(F,B)=>{let U=t.openDialog?.name==="settings"?t.openDialog?.source:"settings";r({openDialog:null},()=>{k(F,B,U)})},onClose:()=>{r({openDialog:null})}}),(0,se.jsx)(LG,{}),(0,se.jsx)(P.OverwriteConfirmDialogTunnel.Out,{}),$(),_(),t.pasteDialog.shown&&(0,se.jsx)(aW,{setAppState:r,appState:t,onClose:()=>r({pasteDialog:{shown:!1,data:null}})}),C.editor.isMobile&&(0,se.jsx)(oW,{app:b,onHomeButtonClick:f,appState:t,elements:i,actionManager:e,renderJSONExportDialog:_,renderImageExportDialog:$,setAppState:r,onLockToggle:a,onHandToolToggle:s,onPenModeToggle:l,renderTopRightUI:d,renderCustomStats:u,renderSidebars:Q,device:C,renderWelcomeScreen:p,UIOptions:h}),!C.editor.isMobile&&(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)("div",{className:"layer-ui__wrapper",style:t.openSidebar&&ie&&C.editor.canFitSidebar?{width:`calc(100% - ${w$}px)`}:{},children:[p&&(0,se.jsx)(P.WelcomeScreenCenterTunnel.Out,{}),K(),(0,se.jsx)(fW,{appState:t,actionManager:e,showExitZenModeBtn:c,renderWelcomeScreen:p}),t.showStats&&(0,se.jsx)(SI,{appState:t,setAppState:r,elements:i,onClose:()=>{e.executeAction(th)},renderCustomStats:u}),t.scrolledOutside&&(0,se.jsx)("button",{className:"scroll-back-to-content",onClick:()=>{r(F=>({...qu(i,F)}))},children:x("buttons.scrollBackToContent")})]}),Q()]})]});return(0,se.jsx)(_4.Provider,{value:t,children:(0,se.jsx)($0,{scope:P.jotaiScope,children:(0,se.jsx)(X4.Provider,{value:P,children:X})})})},X6=e=>{let{suggestedBindings:t,startBoundElement:n,cursorButton:r,scrollX:i,scrollY:o,...a}=e;return a},bN=(e,t)=>{if(e.children!==t.children)return!1;let{canvas:n,appState:r,...i}=e,{canvas:o,appState:a,...s}=t;return $r(X6(r),X6(a),{selectedElementIds:$r,selectedGroupIds:$r})&&$r(i,s)},KW=XW.default.memo(EN,bN)}),Vne=I(()=>{}),yN,qW,Yne=I(()=>{"use strict";D(),me(),Vne(),On(),yN=5e3,qW=({message:e,onClose:t,closable:n=!1,duration:r=yN,style:i})=>{let o=(0,Eh.useRef)(0),a=r!==1/0,s=(0,Eh.useCallback)(()=>{a&&(o.current=window.setTimeout(()=>t(),r))},[t,r,a]);return(0,Eh.useEffect)(()=>{if(a)return s(),()=>clearTimeout(o.current)},[s,e,r,a]),(0,kf.jsxs)("div",{className:"Toast",onMouseEnter:a?()=>clearTimeout(o?.current):void 0,onMouseLeave:a?s:void 0,style:i,children:[(0,kf.jsx)("p",{className:"Toast__message",children:e}),n&&(0,kf.jsx)(Xe,{icon:Ml,"aria-label":"close",type:"icon",onClick:t,className:"close"})]})}}),OS,Zne=I(()=>{"use strict";D(),me(),Ce(),xt(),OS=oe({name:"viewMode",label:"labels.viewMode",paletteName:"Toggle view mode",icon:Wf,viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},commitToHistory:!1}},checked:e=>e.viewModeEnabled,predicate:(e,t,n)=>typeof n.viewModeEnabled>"u",keyTest:e=>!e[O.CTRL_OR_CMD]&&e.altKey&&e.code===tt.R})}),QW,Xne=I(()=>{"use strict";D(),Pe(),wt(),Kt(),xe(),ne(),ca(),QW=class NS{scene;onSceneUpdated;constructor({scene:t,onSceneUpdated:n}){this.scene=t,this.onSceneUpdated=n}static loadedFontFaces=new Set;onFontsLoaded=t=>{if(t.every(r=>{let i=`${r.family}-${r.style}-${r.weight}`;return NS.loadedFontFaces.has(i)?!0:(NS.loadedFontFaces.add(i),!1)}))return!1;let n=!1;this.scene.mapElements(r=>he(r)&&!pn(r)?(jt.delete(r),n=!0,Le(r,{...cE(r,cr(r,this.scene.getNonDeletedElementsMap()),this.scene.getNonDeletedElementsMap())})):r),n&&this.onSceneUpdated()};loadFontsForElements=async t=>{let n=await Promise.all([...new Set(t.filter(r=>he(r)).map(r=>r.fontFamily))].map(r=>{let i=xn({fontFamily:r,fontSize:16});if(!document.fonts?.check?.(i))return document.fonts?.load?.(i)}));this.onFontsLoaded(n.flat().filter(Boolean))}}}),K6,JW,ej,Kne,qne,Qne=I(()=>{"use strict";D(),Pe(),Sr(),Sr(),Ce(),ne(),Of(),xt(),xe(),me(),K6=(e,t)=>{let n=t.scene.getSelectedElements(e);return n.length===1&&ke(n[0])},JW=oe({name:"selectAllElementsInFrame",label:"labels.selectAllElementsInFrame",trackEvent:{category:"canvas"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;if(ke(i)){let o=na(at(e),i.id).filter(a=>!(a.type==="text"&&a.containerId));return{elements:e,appState:{...t,selectedElementIds:o.reduce((a,s)=>(a[s.id]=!0,a),{})},commitToHistory:!1}}return{elements:e,appState:t,commitToHistory:!1}},predicate:(e,t,n,r)=>K6(t,r)}),ej=oe({name:"removeAllElementsFromFrame",label:"labels.removeAllElementsFromFrame",trackEvent:{category:"history"},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;return ke(i)?{elements:E4(e,i),appState:{...t,selectedElementIds:{[i.id]:!0}},commitToHistory:!0}:{elements:e,appState:t,commitToHistory:!1}},predicate:(e,t,n,r)=>K6(t,r)}),Kne=oe({name:"updateFrameRendering",label:"labels.updateFrameRendering",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t)=>({elements:e,appState:{...t,frameRendering:{...t.frameRendering,enabled:!t.frameRendering.enabled}},commitToHistory:!1}),checked:e=>e.frameRendering.enabled}),qne=oe({name:"setFrameAsActiveTool",label:"toolBar.frame",trackEvent:{category:"toolbar"},icon:Rb,viewMode:!1,perform:(e,t,n,r)=>{let i=nn(t,{type:"frame"});return lo(r.interactiveCanvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:nn(t,{type:"frame"})},commitToHistory:!1}},keyTest:e=>!e[O.CTRL_OR_CMD]&&!e.shiftKey&&!e.altKey&&e.key.toLocaleLowerCase()===O.F})}),vN,q6,Km,ea,Fa,xN,Jd,Q6,tj,J6,nj,uc,rj,Bt,e5,jg,wN,SN,ij,oj,aj,sj,Jne=I(()=>{"use strict";D(),ae(),rn(),xe(),Fi(),Ce(),ur(),Kc(),vN=8,q6=99999,Km=e=>vN/e,ea=class bc{static referenceSnapPoints=null;static visibleGaps=null;static setReferenceSnapPoints=t=>{bc.referenceSnapPoints=t};static getReferenceSnapPoints=()=>bc.referenceSnapPoints;static setVisibleGaps=t=>{bc.visibleGaps=t};static getVisibleGaps=()=>bc.visibleGaps;static destroy=()=>{bc.referenceSnapPoints=null,bc.visibleGaps=null}},Fa=({event:e,appState:t,selectedElements:n})=>e?t.objectsSnapModeEnabled&&!e[O.CTRL_OR_CMD]||!t.objectsSnapModeEnabled&&e[O.CTRL_OR_CMD]&&t.gridSize===null:n.length===1&&n[0].type==="arrow"?!1:t.objectsSnapModeEnabled,xN=(e,t,n=.01)=>Math.abs(e-t)<=n,Jd=(e,t,{omitCenter:n,boundingBoxCorners:r,dragOffset:i}={omitCenter:!1,boundingBoxCorners:!1})=>{let o=[];if(e.length===1){let a=e[0],[s,l,c,d,u,h]=_e(a,t);i&&(s+=i.x,c+=i.x,u+=i.x,l+=i.y,d+=i.y,h+=i.y);let m=(c-s)/2,p=(d-l)/2;if((a.type==="diamond"||a.type==="ellipse")&&!r){let f=Wt([s,l+p],[u,h],a.angle),g=Wt([s+m,l],[u,h],a.angle),b=Wt([c,l+p],[u,h],a.angle),v=Wt([s+m,d],[u,h],a.angle);o=n?[f,g,b,v]:[f,g,b,v,[u,h]]}else{let f=Wt([s,l],[u,h],a.angle),g=Wt([c,l],[u,h],a.angle),b=Wt([s,d],[u,h],a.angle),v=Wt([c,d],[u,h],a.angle);o=n?[f,g,b,v]:[f,g,b,v,[u,h]]}}else if(e.length>1){let[a,s,l,c]=C2(e,i??{x:0,y:0}),d=l-a,u=c-s,h=[a,s],m=[l,s],p=[a,c],f=[l,c],g=[a+d/2,s+u/2];o=n?[h,m,p,f]:[h,m,p,f,g]}return o.map(a=>[Bt(a[0]),Bt(a[1])])},Q6=(e,t,n,r)=>{let i=t.filter(o=>ke(o)).map(o=>o.id);return M4(e,t,n,r).filter(o=>!(o.frameId&&i.includes(o.frameId)))},tj=(e,t,n,r)=>{let i=Q6(e,t,n,r),o=Zp(i,r).filter(u=>!(u.length===1&&pn(u[0]))).map(u=>Nt(u).map(h=>Bt(h))),a=o.sort((u,h)=>u[0]-h[0]),s=[],l=0;e:for(let u=0;u<a.length;u++){let h=a[u];for(let m=u+1;m<a.length;m++){if(++l>q6)break e;let p=a[m],[,f,g,b]=h,[v,y,,w]=p;g<v&&ip([f,b],[y,w])&&s.push({startBounds:h,endBounds:p,startSide:[[g,f],[g,b]],endSide:[[v,y],[v,w]],length:v-g,overlap:op([f,b],[y,w])})}}let c=o.sort((u,h)=>u[1]-h[1]),d=[];l=0;e:for(let u=0;u<c.length;u++){let h=c[u];for(let m=u+1;m<c.length;m++){if(++l>q6)break e;let p=c[m],[f,,g,b]=h,[v,y,w]=p;b<y&&ip([f,g],[v,w])&&d.push({startBounds:h,endBounds:p,startSide:[[f,b],[g,b]],endSide:[[v,y],[w,y]],length:y-b,overlap:op([f,g],[v,w])})}}return{horizontalGaps:s,verticalGaps:d}},J6=(e,t,n,r,i,o,a)=>{if(!Fa({appState:n,event:r,selectedElements:e}))return[];if(e.length===0)return[];let s=ea.getVisibleGaps();if(s){let{horizontalGaps:l,verticalGaps:c}=s,[d,u,h,m]=C2(e,t).map(g=>Bt(g)),p=(d+h)/2,f=(u+m)/2;for(let g of l){if(!ip([u,m],g.overlap))continue;let b=g.startSide[0][0]+g.length/2,v=Bt(b-p);if(g.length>h-d&&Math.abs(v)<=a.x){Math.abs(v)<a.x&&(i.length=0),a.x=Math.abs(v);let P={type:"gap",direction:"center_horizontal",gap:g,offset:v};i.push(P);continue}let[,,y]=g.endBounds,w=d-y,T=Bt(g.length-w);if(Math.abs(T)<=a.x){Math.abs(T)<a.x&&(i.length=0),a.x=Math.abs(T);let P={type:"gap",direction:"side_right",gap:g,offset:T};i.push(P);continue}let[k,,,]=g.startBounds,M=k-h,C=Bt(M-g.length);if(Math.abs(C)<=a.x){Math.abs(C)<a.x&&(i.length=0),a.x=Math.abs(C);let P={type:"gap",direction:"side_left",gap:g,offset:C};i.push(P);continue}}for(let g of c){if(!ip([d,h],g.overlap))continue;let b=g.startSide[0][1]+g.length/2,v=Bt(b-f);if(g.length>m-u&&Math.abs(v)<=a.y){Math.abs(v)<a.y&&(o.length=0),a.y=Math.abs(v);let P={type:"gap",direction:"center_vertical",gap:g,offset:v};o.push(P);continue}let[,y,,]=g.startBounds,w=y-m,T=Bt(w-g.length);if(Math.abs(T)<=a.y){Math.abs(T)<a.y&&(o.length=0),a.y=Math.abs(T);let P={type:"gap",direction:"side_top",gap:g,offset:T};o.push(P);continue}let[,,,k]=g.endBounds,M=Bt(u-k),C=g.length-M;if(Math.abs(C)<=a.y){Math.abs(C)<a.y&&(o.length=0),a.y=Math.abs(C);let P={type:"gap",direction:"side_bottom",gap:g,offset:C};o.push(P);continue}}}},nj=(e,t,n,r)=>{let i=Q6(e,t,n,r);return Zp(i,r).filter(o=>!(o.length===1&&pn(o[0]))).flatMap(o=>Jd(o,r))},uc=(e,t,n,r,i,o,a)=>{if(!Fa({appState:n,event:r,selectedElements:e})||e.length===0&&t.length===0)return[];let s=ea.getReferenceSnapPoints();if(s)for(let l of t)for(let c of s){let d=c[0]-l[0],u=c[1]-l[1];Math.abs(d)<=a.x&&(Math.abs(d)<a.x&&(i.length=0),i.push({type:"point",points:[l,c],offset:d}),a.x=Math.abs(d)),Math.abs(u)<=a.y&&(Math.abs(u)<a.y&&(o.length=0),o.push({type:"point",points:[l,c],offset:u}),a.y=Math.abs(u))}},rj=(e,t,n,r,i)=>{let o=st(e,n);if(!Fa({appState:n,event:r,selectedElements:o})||o.length===0)return{snapOffset:{x:0,y:0},snapLines:[]};t.x=Bt(t.x),t.y=Bt(t.y);let a=[],s=[],l=Km(n.zoom.value),c={x:l,y:l},d=Jd(o,i,{dragOffset:t});uc(o,d,n,r,a,s,c),J6(o,t,n,r,a,s,c);let u={x:a[0]?.offset??0,y:s[0]?.offset??0};c.x=0,c.y=0,a.length=0,s.length=0;let h={x:Bt(t.x+u.x),y:Bt(t.y+u.y)};uc(o,Jd(o,i,{dragOffset:h}),n,r,a,s,c),J6(o,h,n,r,a,s,c);let m=jg(a,s),p=SN(o,h,[...a,...s].filter(f=>f.type==="gap"));return{snapOffset:u,snapLines:[...m,...p]}},Bt=e=>Math.round(e*10**6)/10**6,e5=e=>{let t=new Map;for(let n of e){let r=n.join(",");t.has(r)||t.set(r,n)}return Array.from(t.values())},jg=(e,t)=>{let n={},r={};if(e.length>0){for(let i of e)if(i.type==="point"){let o=Bt(i.points[0][0]);n[o]||(n[o]=[]),n[o].push(...i.points.map(a=>[Bt(a[0]),Bt(a[1])]))}}if(t.length>0){for(let i of t)if(i.type==="point"){let o=Bt(i.points[0][1]);r[o]||(r[o]=[]),r[o].push(...i.points.map(a=>[Bt(a[0]),Bt(a[1])]))}}return Object.entries(n).map(([i,o])=>({type:"points",points:e5(o.map(a=>[Number(i),a[1]]).sort((a,s)=>a[1]-s[1]))})).concat(Object.entries(r).map(([i,o])=>({type:"points",points:e5(o.map(a=>[a[0],Number(i)]).sort((a,s)=>a[0]-s[0]))})))},wN=e=>{let t=new Map;for(let n of e){let r=n.points.flat().map(i=>[Bt(i)]).join(",");t.has(r)||t.set(r,n)}return Array.from(t.values())},SN=(e,t,n)=>{let[r,i,o,a]=C2(e,t),s=[];for(let l of n){let[c,d,u,h]=l.gap.startBounds,[m,p,f,g]=l.gap.endBounds,b=op([i,a],l.gap.overlap),v=op([r,o],l.gap.overlap);switch(l.direction){case"center_horizontal":{if(b){let y=(b[0]+b[1])/2;s.push({type:"gap",direction:"horizontal",points:[[l.gap.startSide[0][0],y],[r,y]]},{type:"gap",direction:"horizontal",points:[[o,y],[l.gap.endSide[0][0],y]]})}break}case"center_vertical":{if(v){let y=(v[0]+v[1])/2;s.push({type:"gap",direction:"vertical",points:[[y,l.gap.startSide[0][1]],[y,i]]},{type:"gap",direction:"vertical",points:[[y,a],[y,l.gap.endSide[0][1]]]})}break}case"side_right":{if(b){let y=(b[0]+b[1])/2;s.push({type:"gap",direction:"horizontal",points:[[u,y],[m,y]]},{type:"gap",direction:"horizontal",points:[[f,y],[r,y]]})}break}case"side_left":{if(b){let y=(b[0]+b[1])/2;s.push({type:"gap",direction:"horizontal",points:[[o,y],[c,y]]},{type:"gap",direction:"horizontal",points:[[u,y],[m,y]]})}break}case"side_top":{if(v){let y=(v[0]+v[1])/2;s.push({type:"gap",direction:"vertical",points:[[y,a],[y,d]]},{type:"gap",direction:"vertical",points:[[y,h],[y,p]]})}break}case"side_bottom":{if(v){let y=(v[0]+v[1])/2;s.push({type:"gap",direction:"vertical",points:[[y,h],[y,p]]},{type:"gap",direction:"vertical",points:[[y,g],[y,i]]})}break}}}return wN(s.map(l=>({...l,points:l.points.map(c=>[Bt(c[0]),Bt(c[1])])})))},ij=(e,t,n,r,i,o)=>{if(!Fa({event:r,selectedElements:e,appState:n})||e.length===0||e.length===1&&!xN(e[0].angle,0))return{snapOffset:{x:0,y:0},snapLines:[]};let[a,s,l,c]=Nt(t);o&&(o.includes("e")?l+=i.x:o.includes("w")&&(a+=i.x),o.includes("n")?s+=i.y:o.includes("s")&&(c+=i.y));let d=[];if(o)switch(o){case"e":{d.push([l,s],[l,c]);break}case"w":{d.push([a,s],[a,c]);break}case"n":{d.push([a,s],[l,s]);break}case"s":{d.push([a,c],[l,c]);break}case"ne":{d.push([l,s]);break}case"nw":{d.push([a,s]);break}case"se":{d.push([l,c]);break}case"sw":{d.push([a,c]);break}}let u=Km(n.zoom.value),h={x:u,y:u},m=[],p=[];uc(t,d,n,r,m,p,h);let f={x:m[0]?.offset??0,y:p[0]?.offset??0};h.x=0,h.y=0,m.length=0,p.length=0;let[g,b,v,y]=Nt(e).map(T=>Bt(T));uc(e,[[g,b],[g,y],[v,b],[v,y]],n,r,m,p,h);let w=jg(m,p);return{snapOffset:f,snapLines:w}},oj=(e,t,n,r,i,o)=>{if(!Fa({event:n,selectedElements:[e],appState:t}))return{snapOffset:{x:0,y:0},snapLines:[]};let a=[[r.x+i.x,r.y+i.y]],s=Km(t.zoom.value),l={x:s,y:s},c=[],d=[];uc([e],a,t,n,c,d,l);let u={x:c[0]?.offset??0,y:d[0]?.offset??0};l.x=0,l.y=0,c.length=0,d.length=0;let h=Jd([e],o,{boundingBoxCorners:!0,omitCenter:!0});uc([e],h,t,n,c,d,l);let m=jg(c,d);return{snapOffset:u,snapLines:m}},aj=(e,t,n,r,i)=>{if(!Fa({event:r,selectedElements:[],appState:t}))return{originOffset:{x:0,y:0},snapLines:[]};let o=M4(e,[],t,i),a=Km(t.zoom.value),s={x:a,y:a},l=[],c=[];for(let d of o){let u=Jd([d],i);for(let h of u){let m=h[0]-n.x;Math.abs(m)<=Math.abs(s.x)&&(Math.abs(m)<Math.abs(s.x)&&(c.length=0),c.push({type:"pointer",points:[h,[h[0],n.y]],direction:"vertical"}),s.x=m);let p=h[1]-n.y;Math.abs(p)<=Math.abs(s.y)&&(Math.abs(p)<Math.abs(s.y)&&(l.length=0),l.push({type:"pointer",points:[h,[n.x,h[1]]],direction:"horizontal"}),s.y=p)}}return{originOffset:{x:c.length>0?c[0].points[0][0]-n.x:0,y:l.length>0?l[0].points[0][1]-n.y:0},snapLines:[...c,...l]}},sj=e=>e===_n.rectangle||e===_n.ellipse||e===_n.diamond||e===_n.frame||e===_n.magicframe||e===_n.image}),TN,lj,ere=I(()=>{"use strict";D(),Yf(),TN=()=>(0,rr.jsxs)("div",{"data-testid":"brave-measure-text-error",children:[(0,rr.jsx)("p",{children:(0,rr.jsx)(yo,{i18nKey:"errors.brave_measure_text_error.line1",bold:e=>(0,rr.jsx)("span",{style:{fontWeight:600},children:e})})}),(0,rr.jsx)("p",{children:(0,rr.jsx)(yo,{i18nKey:"errors.brave_measure_text_error.line2",bold:e=>(0,rr.jsx)("span",{style:{fontWeight:600},children:e})})}),(0,rr.jsx)("p",{children:(0,rr.jsx)(yo,{i18nKey:"errors.brave_measure_text_error.line3",link:e=>(0,rr.jsx)("a",{href:"http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser",children:e})})}),(0,rr.jsx)("p",{children:(0,rr.jsx)(yo,{i18nKey:"errors.brave_measure_text_error.line4",issueLink:e=>(0,rr.jsx)("a",{href:"https://github.com/excalidraw/excalidraw/issues/new",children:e}),discordLink:e=>(0,rr.jsxs)("a",{href:"https://discord.gg/UexuTaE",children:[e,"."]})})})]}),lj=TN}),qm,Oa,CN,t5,MN,OI,cj=I(()=>{"use strict";D(),ae(),Pe(),la(),cs(),Kt(),ne(),mb(),sa(),qm={width:100,height:0},Oa=100,CN=(e,t,n)=>{let r=ri({x:0,y:0,textAlign:Hu.CENTER,verticalAlign:Nr.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:r.id})}),bo(r,e,n),[e,r]},t5=(e,t,n,r,i)=>{let o,a;if(Object.assign(e,{startBinding:e?.startBinding||null,endBinding:e.endBinding||null}),t){let d=t?.width??Oa,u=t?.height??Oa,h;t.id&&(h=r.getElement(t.id),h||console.error(`No element for start binding with id ${t.id} found`));let m=t.x||e.x-d,p=t.y||e.y-u/2,f=h?h.type:t.type;if(f){if(f==="text"){let g="";h&&h.type==="text"?g=h.text:t.type==="text"&&(g=t.text),g||console.error(`No text found for start binding text element for ${e.id}`),o=ri({x:m,y:p,type:"text",...h,...t,text:g}),Object.assign(o,{x:t.x||e.x-o.width,y:t.y||e.y-o.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{o=rs({x:m,y:p,width:d,height:u,...h,...t,type:f});break}default:Su(e,`Unhandled element start type "${t.type}"`,!0)}Eu(e,o,"start",i)}}if(n){let d=n?.height??Oa,u=n?.width??Oa,h;n.id&&(h=r.getElement(n.id),h||console.error(`No element for end binding with id ${n.id} found`));let m=n.x||e.x+e.width,p=n.y||e.y-d/2,f=h?h.type:n.type;if(f){if(f==="text"){let g="";h&&h.type==="text"?g=h.text:n.type==="text"&&(g=n.text),g||console.error(`No text found for end binding text element for ${e.id}`),a=ri({x:m,y:p,type:"text",...h,...n,text:g}),Object.assign(a,{y:n.y||e.y-a.height/2})}else switch(f){case"rectangle":case"ellipse":case"diamond":{a=rs({x:m,y:p,width:u,height:d,...h,...n,type:f});break}default:Su(e,`Unhandled element end type "${f}"`,!0)}Eu(e,a,"end",i)}}if(e.points.length<2)return{linearElement:e,startBoundElement:o,endBoundElement:a};let s=e.points.length-1,l=.5,c=zc(e.points);return e.points[s][0]>e.points[s-1][0]&&(c[0][0]=l,c[s][0]-=l),e.points[s][0]<e.points[s-1][0]&&(c[0][0]=-l,c[s][0]+=l),e.points[s][1]>e.points[s-1][1]&&(c[0][1]=l,c[s][1]-=l),e.points[s][1]<e.points[s-1][1]&&(c[0][1]=-l,c[s][1]+=l),Object.assign(e,{points:c}),{linearElement:e,startBoundElement:o,endBoundElement:a}},MN=class{excalidrawElements=new Map;add=e=>{e&&this.excalidrawElements.set(e.id,e)};getElements=()=>Array.from(this.excalidrawElements.values());getElementsMap=()=>cl(this.excalidrawElements);getElement=e=>this.excalidrawElements.get(e)},OI=(e,t)=>{if(!e)return[];let n=zc(e),r=new MN,i=new Map,o=new Map;for(let s of n){let l,c=s.id;switch(t?.regenerateIds!==!1&&Object.assign(s,{id:ni()}),s.type){case"rectangle":case"ellipse":case"diamond":{let d=s?.label?.text&&s.width===void 0?0:s?.width||Oa,u=s?.label?.text&&s.height===void 0?0:s?.height||Oa;l=rs({...s,width:d,height:u});break}case"line":{let d=s.width||qm.width,u=s.height||qm.height;l=Ua({width:d,height:u,points:[[0,0],[d,u]],...s});break}case"arrow":{let d=s.width||qm.width,u=s.height||qm.height;l=Ua({width:d,height:u,endArrowhead:"arrow",points:[[0,0],[d,u]],...s}),Object.assign(l,rT(l.points));break}case"text":{let d=s?.fontFamily||aa,u=s?.fontSize||Ni,h=s?.lineHeight||gl(d),m=s.text??"",p=ju(m),f=Qa(p,xn({fontFamily:d,fontSize:u}),h);l=ri({width:f.width,height:f.height,fontFamily:d,fontSize:u,...s});break}case"image":{l=xT({width:s?.width||Oa,height:s?.height||Oa,...s});break}case"frame":{l=vT({x:0,y:0,...s});break}case"magicframe":{l=lE({x:0,y:0,...s});break}case"freedraw":case"iframe":case"embeddable":{l=s;break}default:l=s,Su(s,`Unhandled element type "${s.type}"`,!0)}r.getElement(l.id)?console.error(`Duplicate id found for ${l.id}`):(r.add(l),i.set(l.id,s),c&&o.set(c,l.id))}let a=r.getElementsMap();for(let[s,l]of i){let c=r.getElement(s);switch(l.type){case"rectangle":case"ellipse":case"diamond":case"arrow":{if(l.label?.text){let[d,u]=CN(c,l?.label,a);if(r.add(d),r.add(u),d.type==="arrow"){let h=l.type==="arrow"?l?.start:void 0,m=l.type==="arrow"?l?.end:void 0;if(h&&h.id){let b=o.get(h.id);b&&Object.assign(h,{id:b})}if(m&&m.id){let b=o.get(m.id);b&&Object.assign(m,{id:b})}let{linearElement:p,startBoundElement:f,endBoundElement:g}=t5(d,h,m,r,a);d=p,r.add(p),r.add(f),r.add(g)}}else switch(l.type){case"arrow":{let{start:d,end:u}=l;if(d&&d.id){let f=o.get(d.id);Object.assign(d,{id:f})}if(u&&u.id){let f=o.get(u.id);Object.assign(u,{id:f})}let{linearElement:h,startBoundElement:m,endBoundElement:p}=t5(c,d,u,r,a);r.add(h),r.add(m),r.add(p);break}}break}}}for(let[s,l]of i){if(l.type!=="frame"&&l.type!=="magicframe")continue;let c=r.getElement(s);if(!c)throw new Error(`Excalidraw element with id ${s} doesn't exist`);let d=[];l.children.forEach(v=>{let y=o.get(v);if(!y)throw new Error(`Element with ${v} wasn't mapped correctly`);let w=r.getElement(y);if(!w)throw new Error(`Frame element with id ${y} doesn't exist`);Object.assign(w,{frameId:c.id}),w?.boundElements?.forEach(T=>{let k=r.getElement(T.id);if(!k)throw new Error(`Bound element with id ${T.id} doesn't exist`);Object.assign(k,{frameId:c.id}),d.push(k)}),d.push(w)});let[u,h,m,p]=Nt(d),f=10;u=u-f,h=h-f,m=m+f,p=p+f;let g=Math.max(c?.width,m-u),b=Math.max(c?.height,p-h);Object.assign(c,{x:u,y:h,width:g,height:b})}return r.getElements()}}),zt,B2,NI,$I=I(()=>{"use strict";D(),ne(),zt=e=>t=>{(0,$S.unstable_batchedUpdates)(e,t)},B2=e=>hb(t=>{(0,$S.unstable_batchedUpdates)(e,t)}),NI=(()=>{let e;try{let n=dj.version.split(".");e=Number(n[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})()}),IN,kN,n5,r5,uj,AN,_N,i5,Xr,PN,tre=I(()=>{"use strict";D(),ae(),IN="#ff6b6b",kN="#ff0000",n5=1,r5=2,uj=(e,t)=>{if(!t.snapLines.length)return;let n=t.theme===$e.LIGHT||t.zenModeEnabled?IN:kN,r=(t.zenModeEnabled?n5*1.5:n5)/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,_N(i,e,t)):i.type==="gap"?(e.lineWidth=r,e.strokeStyle=n,PN(i.points[0],i.points[1],i.direction,t,e)):i.type==="points"&&(e.lineWidth=r,e.strokeStyle=n,AN(i,e,t));e.restore()},AN=(e,t,n)=>{if(!n.zenModeEnabled){let r=e.points[0],i=e.points[e.points.length-1];Xr(r,i,t)}for(let r of e.points)i5(r,n,t)},_N=(e,t,n)=>{i5(e.points[0],n,t),n.zenModeEnabled||Xr(e.points[0],e.points[1],t)},i5=([e,t],n,r)=>{r.save();let i=(n.zenModeEnabled?r5*1.5:r5)/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()},Xr=(e,t,n)=>{n.beginPath(),n.lineTo(...e),n.lineTo(...t),n.stroke()},PN=(e,t,n,r,i)=>{let o=8/r.zoom.value,a=o/2,s=o/4;if(n==="horizontal"){let l=[(e[0]+t[0])/2,e[1]];r.zenModeEnabled||Xr([e[0],e[1]-o],[e[0],e[1]+o],i),Xr([l[0]-s,l[1]-a],[l[0]-s,l[1]+a],i),Xr([l[0]+s,l[1]-a],[l[0]+s,l[1]+a],i),r.zenModeEnabled||(Xr([t[0],t[1]-o],[t[0],t[1]+o],i),Xr(e,t,i))}else{let l=[e[0],(e[1]+t[1])/2];r.zenModeEnabled||Xr([e[0]-o,e[1]],[e[0]+o,e[1]],i),Xr([l[0]-a,l[1]-s],[l[0]+a,l[1]-s],i),Xr([l[0]-a,l[1]+s],[l[0]+a,l[1]+s],i),r.zenModeEnabled||(Xr([t[0]-o,t[1]],[t[0]+o,t[1]],i),Xr(e,t,i))}}}),DN,Ug,eu,LN,Qm,RN,ON,NN,o5,$N,FN,BN,Vg,a5,s5,FS,hj,mj=I(()=>{"use strict";D(),Pe(),mH(),xI(),ls(),Kb(),Fi(),Rf(),ne(),ae(),tre(),Zc(),Tr(),oB(),xe(),DN=(e,t,n)=>{let{elementId:r,hoverPointIndex:i}=t.selectedLinearElement;if(t.editingLinearElement?.selectedPointsIndices?.includes(i))return;let o=pe.getElement(r,n);if(!o)return;let a=pe.getPointAtIndexGlobalCoordinates(o,i,n);e.save(),e.translate(t.scrollX,t.scrollY),Ug(a,e,t),e.restore()},Ug=(e,t,n)=>{t.fillStyle="rgba(105, 101, 219, 0.4)",dp(t,e[0],e[1],pe.POINT_HANDLE_SIZE/n.zoom.value,!1)},eu=(e,t,n,r,i,o,a,s,l=!1,c=0)=>{e.save(),e.translate(o,a),e.rotate(s),l&&e.fillRect(t-o,n-a,r,i),c&&e.roundRect?(e.beginPath(),e.roundRect(t-o,n-a,r,i,c),e.stroke(),e.closePath()):e.strokeRect(t-o,n-a,r,i),e.restore()},LN=(e,t,n,r,i,o)=>{e.save(),e.translate(r,i),e.rotate(o),e.beginPath(),e.moveTo(0,n/2),e.lineTo(t/2,0),e.lineTo(0,-n/2),e.lineTo(-t/2,0),e.closePath(),e.stroke(),e.restore()},Qm=(e,t,n,r,i,o=!1)=>{e.strokeStyle="#5e5ad8",e.setLineDash([]),e.fillStyle="rgba(255, 255, 255, 0.9)",i?e.fillStyle="rgba(134, 131, 226, 0.9)":o&&(e.fillStyle="rgba(177, 151, 252, 0.7)"),dp(e,n[0],n[1],r/t.zoom.value,!o)},RN=(e,t,n,r,i,o)=>{e.beginPath(),e.ellipse(r,i,t/2,n/2,o,0,Math.PI*2),e.stroke()},ON=(e,t,n)=>{let[r,i,o,a]=_e(t,n),s=o-r,l=a-i,c=jp(t,s,l),d=4;e.strokeStyle="rgba(0,0,0,.05)",e.lineWidth=c-d;let u=d/2+c/2;switch(t.type){case"rectangle":case"text":case"image":case"iframe":case"embeddable":case"frame":case"magicframe":eu(e,r-u,i-u,s+u*2,l+u*2,r+s/2,i+l/2,t.angle);break;case"diamond":let h=Math.hypot(s,l),m=u*h/l,p=u*h/s;LN(e,s+m*2,l+p*2,r+s/2,i+l/2,t.angle);break;case"ellipse":RN(e,s+u*2,l+u*2,r+s/2,i+l/2,t.angle);break}},NN=(e,t,n)=>{let[r,i,o]=t,a=jp(o,o.width,o.height);e.strokeStyle="rgba(0,0,0,0)",e.fillStyle="rgba(0,0,0,.05)",(i==="both"?[0,-1]:i==="start"?[0]:[-1]).forEach(s=>{let[l,c]=pe.getPointAtIndexGlobalCoordinates(r,s,n);dp(e,l,c,a)})},o5=(e,t,n,r=xu*2)=>{let{angle:i,elementX1:o,elementY1:a,elementX2:s,elementY2:l,selectionColors:c,cx:d,cy:u,dashed:h,activeEmbeddable:m}=n,p=s-o,f=l-a,g=r/t.zoom.value,b=8/t.zoom.value,v=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(m?4:1)/t.zoom.value;let y=c.length;for(let w=0;w<y;++w)e.strokeStyle=c[w],h&&e.setLineDash([b,v+(b+v)*(y-1)]),e.lineDashOffset=(b+v)*w,eu(e,o-g,a-g,p+g*2,f+g*2,d,u,i);e.restore()},$N=(e,t,n,r)=>{let i=Array.isArray(n)?NN:ON;e.save(),e.translate(t.scrollX,t.scrollY),i(e,n,r),e.restore()},FN=(e,t,n,r)=>{let[i,o,a,s]=_e(n,r),l=a-i,c=s-o;e.strokeStyle="rgb(0,118,255)",e.lineWidth=Zt.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),eu(e,i,o,l,c,i+l/2,o+c/2,n.angle,!1,Zt.radius/t.zoom.value),e.restore()},BN=(e,t,n)=>{let r=n.filter(s=>s.groupIds.length===0),i=n.filter(s=>s.groupIds.length>0),o=s=>{let[l,c,d,u]=Nt(s);return{angle:0,elementX1:l,elementX2:d,elementY1:c,elementY2:u,selectionColors:["rgb(0,118,255)"],dashed:!1,cx:l+(d-l)/2,cy:c+(u-c)/2,activeEmbeddable:!1}},a=s=>{let l=hn(n,s);return o(l)};Object.entries(ET(i,t)).filter(([s,l])=>l).map(([s,l])=>s).map(s=>a(s)).concat(r.map(s=>o([s]))).forEach(s=>o5(e,t,s))},Vg=(e,t,n,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let i=pe.getPointsGlobalCoordinates(n,r),{POINT_HANDLE_SIZE:o}=pe,a=t.editingLinearElement?o:o/2;i.forEach((s,l)=>{let c=!!t.editingLinearElement?.selectedPointsIndices?.includes(l);Qm(e,t,s,a,c)}),pe.getEditorMidPoints(n,r,t).filter(s=>s!==null).forEach(s=>{t?.selectedLinearElement?.segmentMidPointHoveredCoords&&pe.arePointsEqual(s,t.selectedLinearElement.segmentMidPointHoveredCoords)?t.editingLinearElement?(Qm(e,t,s,a,!1),Ug(s,e,t)):(Ug(s,e,t),Qm(e,t,s,a,!1)):(t.editingLinearElement||i.length===2)&&Qm(e,t,s,o/2,!1,!0)}),e.restore()},a5=(e,t,n,r,i)=>{Object.keys(r).forEach(o=>{let a=r[o];if(a!==void 0){let[s,l,c,d]=a;e.save(),e.lineWidth=1/n.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),o==="rotation"?dp(e,s+c/2,l+d/2,c/2):e.roundRect?(e.beginPath(),e.roundRect(s,l,c,d,2/n.zoom.value),e.fill(),e.stroke()):eu(e,s,l,c,d,s+c/2,l+d/2,i,!0),e.restore()}})},s5=({canvas:e,elementsMap:t,visibleElements:n,selectedElements:r,scale:i,appState:o,renderConfig:a})=>{if(e===null)return{atLeastOneVisibleElement:!1,elementsMap:t};let[s,l]=_T(e,i),c=PT({canvas:e,scale:i,normalizedWidth:s,normalizedHeight:l});c.save(),c.scale(o.zoom.value,o.zoom.value);let d;if(n.forEach(m=>{o.editingLinearElement?.elementId===m.id&&m&&(d=m)}),d&&Vg(c,o,d,t),o.selectionElement)try{kB(o.selectionElement,c,o)}catch(m){console.error(m)}o.isBindingEnabled&&o.suggestedBindings.filter(m=>m!=null).forEach(m=>{$N(c,o,m,t)}),o.frameToHighlight&&FN(c,o,o.frameToHighlight,t),o.elementsToHighlight&&BN(c,o,o.elementsToHighlight);let u=r.some(m=>ke(m));if(r.length===1&&o.editingLinearElement?.elementId===r[0].id&&Vg(c,o,r[0],t),o.selectedLinearElement&&o.selectedLinearElement.hoverPointIndex>=0&&DN(c,o,t),!o.multiElement&&!o.editingLinearElement){let m=fb(r,o);r.length===1&&Ne(r[0])&&o.selectedLinearElement?.elementId===r[0].id&&!r[0].locked&&Vg(c,o,r[0],t);let p=a.selectionColor||Ct.black;if(m){let f=Fe(r),g=[];for(let v of t.values()){let y=[];f.has(v.id)&&!gT(o,v)&&y.push(p);let w=a.remoteSelectedElementIds.get(v.id);if(w&&y.push(...w.map(T=>ff(T,o.collaborators.get(T)))),y.length){let[T,k,M,C,P,R]=_e(v,t,!0);g.push({angle:v.angle,elementX1:T,elementY1:k,elementX2:M,elementY2:C,selectionColors:y,dashed:!!w,cx:P,cy:R,activeEmbeddable:o.activeEmbeddable?.element===v&&o.activeEmbeddable.state==="active"})}}let b=v=>{let y=hn(t,v),[w,T,k,M]=Nt(y);g.push({angle:0,elementX1:w,elementX2:k,elementY1:T,elementY2:M,selectionColors:[Ct.black],dashed:!0,cx:w+(k-w)/2,cy:T+(M-T)/2,activeEmbeddable:!1})};for(let v of Tc(o))b(v);o.editingGroupId&&b(o.editingGroupId),g.forEach(v=>o5(c,o,v))}if(c.save(),c.translate(o.scrollX,o.scrollY),r.length===1){c.fillStyle=Ct.white;let f=sT(r[0],o.zoom,t,"mouse");!o.viewModeEnabled&&m&&a5(c,a,o,f,r[0].angle)}else if(r.length>1&&!o.isRotating){let f=xu*2/o.zoom.value;c.fillStyle=Ct.white;let[g,b,v,y]=Nt(r),w=c.getLineDash();c.setLineDash([2/o.zoom.value]);let T=c.lineWidth;c.lineWidth=1/o.zoom.value,c.strokeStyle=p,eu(c,g-f,b-f,v-g+f*2,y-b+f*2,(g+v)/2,(b+y)/2,0),c.lineWidth=T,c.setLineDash(w);let k=rE([g,b,v,y,(g+v)/2,(b+y)/2],0,o.zoom,"mouse",u?hF:aT);r.some(M=>!M.locked)&&a5(c,a,o,k,0)}c.restore()}uj(c,o),c.restore(),fH({context:c,renderConfig:a,appState:o,normalizedWidth:s,normalizedHeight:l});let h;return a.renderScrollbars&&(h=JG(n,s,l,o),c.save(),c.fillStyle=QG,c.strokeStyle="rgba(255,255,255,0.8)",[h.horizontal,h.vertical].forEach(m=>{m&&ZM(c,m.x,m.y,m.width,m.height,Za/2)}),c.restore()),{scrollBars:h,atLeastOneVisibleElement:n.length>0,elementsMap:t}},FS=hb(e=>{let t=s5(e);e.callback?.(t)},{trailing:!0}),hj=(e,t)=>{if(t){FS(e);return}let n=s5(e);return e.callback(n),n}}),zN,l5,HN,fj,nre=I(()=>{"use strict";D(),ne(),ae(),ce(),$I(),mj(),zN=e=>{let t=(0,bh.useRef)(!1);return(0,bh.useEffect)(()=>{if(!t.current){t.current=!0;return}let n=new Map,r=new Map,i=new Map,o=new Map,a=new Map;e.appState.collaborators.forEach((l,c)=>{if(l.selectedElementIds)for(let d of Object.keys(l.selectedElementIds))i.has(d)||i.set(d,[]),i.get(d).push(c);!l.pointer||l.pointer.renderCursor===!1||(l.username&&o.set(c,l.username),l.userState&&a.set(c,l.userState),r.set(c,Ri({sceneX:l.pointer.x,sceneY:l.pointer.y},e.appState)),n.set(c,l.button))});let s=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue("--color-selection")||"#6965db";hj({canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:r,remotePointerButton:n,remoteSelectedElementIds:i,remotePointerUsernames:o,remotePointerUserStates:a,selectionColor:s,renderScrollbars:!1},callback:e.renderInteractiveSceneCallback},NI())}),(0,pj.jsx)("canvas",{className:"excalidraw__canvas interactive",style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled?ut.GRAB:ut.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:x("labels.drawingCanvas")})},l5=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,editingGroupId:e.editingGroupId,editingLinearElement:e.editingLinearElement,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,isBindingEnabled:e.isBindingEnabled,suggestedBindings:e.suggestedBindings,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled}),HN=(e,t)=>e.selectionNonce!==t.selectionNonce||e.versionNonce!==t.versionNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements?!1:$r(l5(e.appState),l5(t.appState)),fj=bh.default.memo(zN,HN)}),GN,c5,WN,Ej,rre=I(()=>{"use strict";D(),LT(),ne(),$I(),GN=e=>{let t=(0,Yc.useRef)(null),n=(0,Yc.useRef)(!1);return(0,Yc.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"));let o=`${e.appState.width}px`,a=`${e.appState.height}px`;i.style.width!==o&&(i.style.width=o),i.style.height!==a&&(i.style.height=a);let s=e.appState.width*e.scale,l=e.appState.height*e.scale;i.width!==s&&(i.width=s),i.height!==l&&(i.height=l),DT({canvas:i,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},NI())}),(0,gj.jsx)("div",{className:"excalidraw__canvas-wrapper",ref:t})},c5=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId}),WN=(e,t)=>e.versionNonce!==t.versionNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:$r(c5(e.appState),c5(t.appState))&&$r(e.renderConfig,t.renderConfig),Ej=Yc.default.memo(GN,WN)}),ire=I(()=>{"use strict";D(),nre(),rre()}),BS,ore=I(()=>{"use strict";D(),Ku(),xe(),mj(),LT(),ne(),BS=class{scene;constructor(e){this.scene=e}getRenderableElements=(()=>{let e=({elementsMap:n,zoom:r,offsetLeft:i,offsetTop:o,scrollX:a,scrollY:s,height:l,width:c})=>{let d=[];for(let u of n.values())ef(u,c,l,{zoom:r,offsetLeft:i,offsetTop:o,scrollX:a,scrollY:s},n)&&d.push(u);return d},t=({elements:n,editingElement:r,pendingImageElementId:i})=>{let o=cl(new Map);for(let a of n)dl(a)&&i===a.id||(!r||r.type!=="text"||a.id!==r.id)&&o.set(a.id,a);return o};return G$(({zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:a,height:s,width:l,editingElement:c,pendingImageElementId:d,versionNonce:u})=>{let h=this.scene.getNonDeletedElements(),m=t({elements:h,editingElement:c,pendingImageElementId:d}),p=e({elementsMap:m,zoom:n,offsetLeft:r,offsetTop:i,scrollX:o,scrollY:a,height:s,width:l});return{elementsMap:m,visibleElements:p}})})();destroy(){FS.cancel(),m4.cancel(),this.getRenderableElements.clear()}}}),are=I(()=>{}),bj,sre=I(()=>{"use strict";D(),are(),bj=({trails:e})=>{let t=(0,xy.useRef)(null);return(0,xy.useEffect)(()=>{if(t.current)for(let n of e)n.start(t.current);return()=>{for(let n of e)n.stop()}},e),(0,zS.jsx)("div",{className:"SVGLayer",children:(0,zS.jsx)("svg",{ref:t})})}}),lre=I(()=>{}),jN,UN,HS,cre=I(()=>{"use strict";D(),ne(),Pe(),Re(),lre(),jN=5,UN=(e,t,n)=>{let[r,i]=_e(e,n),{x:o,y:a}=Ri({sceneX:r+e.width,sceneY:i},t),s=o-t.offsetLeft+10,l=a-t.offsetTop;return{x:s,y:l}},HS=({children:e,element:t,elementsMap:n})=>{let r=wy();if(r.contextMenu||r.draggingElement||r.resizingElement||r.isRotating||r.openMenu||r.viewModeEnabled)return null;let{x:i,y:o}=UN(t,r,n);return(0,yj.jsx)("div",{className:"excalidraw-canvas-buttons",style:{top:`${o}px`,left:`${i}px`,padding:jN},children:e})}});async function dre({image:e,apiKey:t,text:n,theme:r=$e.LIGHT}){let i={model:"gpt-4-vision-preview",max_tokens:4096,temperature:.1,messages:[{role:"system",content:vj},{role:"user",content:[{type:"image_url",image_url:{url:e,detail:"high"}},{type:"text",text:`Above is the reference wireframe. Please make a new website based on these and return just the HTML file. Also, please make it for the ${r} theme. What follows are the wireframe's text annotations (if any)...`},{type:"text",text:n}]}]},o,a=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(i)});return a.ok?o={...await a.json(),ok:!0}:o={...await a.json(),ok:!1},o}var vj,ure=I(()=>{"use strict";D(),ae(),vj=`You are a skilled front-end developer who builds interactive prototypes from wireframes, and is an expert at CSS Grid and Flex design.
184
- Your role is to transform low-fidelity wireframes into working front-end HTML code.
185
-
186
- YOU MUST FOLLOW FOLLOWING RULES:
187
-
188
- - Use HTML, CSS, JavaScript to build a responsive, accessible, polished prototype
189
- - Leverage Tailwind for styling and layout (import as script <script src="https://cdn.tailwindcss.com"><\/script>)
190
- - Inline JavaScript when needed
191
- - Fetch dependencies from CDNs when needed (using unpkg or skypack)
192
- - Source images from Unsplash or create applicable placeholders
193
- - Interpret annotations as intended vs literal UI
194
- - Fill gaps using your expertise in UX and business logic
195
- - generate primarily for desktop UI, but make it responsive.
196
- - Use grid and flexbox wherever applicable.
197
- - Convert the wireframe in its entirety, don't omit elements if possible.
198
-
199
- If the wireframes, diagrams, or text is unclear or unreadable, refer to provided text for clarification.
200
-
201
- Your goal is a production-ready prototype that brings the wireframes to life.
202
-
203
- Please output JUST THE HTML file containing your best attempt at implementing the provided wireframes.`}),VN,z2,hre=I(()=>{"use strict";D(),Cl(),VN="small",z2=e=>(0,Af.jsxs)("label",{className:Y("ToolIcon ToolIcon__MagicButton",`ToolIcon_size_${VN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,Af.jsx)("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,Af.jsx)("div",{className:"ToolIcon__icon",children:e.icon})]})}),mre=I(()=>{}),YN,xj,pre=I(()=>{"use strict";D(),me(),mre(),YN=({height:e,width:t,userToFollow:n,onDisconnect:r})=>(0,Bc.jsx)("div",{className:"follow-mode",style:{width:t,height:e},children:(0,Bc.jsxs)("div",{className:"follow-mode__badge",children:[(0,Bc.jsxs)("div",{className:"follow-mode__badge__label",children:["Following"," ",(0,Bc.jsx)("span",{className:"follow-mode__badge__username",title:n.username,children:n.username})]}),(0,Bc.jsx)("button",{onClick:r,className:"follow-mode__disconnect-btn",children:Ml})]})}),xj=YN}),wj,fre=I(()=>{"use strict";D(),wj=class{targets=new WeakMap;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}}}),ib,Sj=I(()=>{"use strict";D(),ne(),ae(),ib=class{constructor(e,t,n){this.animationFrameHandler=e,this.app=t,this.options=n,this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.trailElement=document.createElementNS(It,"path")}currentTrail;pastTrails=[];container;trailElement;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 Lm(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())}update(){this.start()}onFrame(){let e=[];for(let n of this.pastTrails)e.push(this.drawTrail(n,this.app.state));if(this.currentTrail){let n=this.drawTrail(this.currentTrail,this.app.state);e.push(n)}this.pastTrails=this.pastTrails.filter(n=>n.getStrokeOutline().length!==0),e.length===0&&this.stop();let t=e.join(" ").trim();this.trailElement.setAttribute("d",t),this.trailElement.setAttribute("fill",(this.options.fill??(()=>"black"))(this))}drawTrail(e,t){let n=e.getStrokeOutline(e.options.size/t.zoom.value).map(([r,i])=>{let o=Ri({sceneX:r,sceneY:i},t);return[o.x,o.y]});return TJ(n,!0)}}}),Tj,gre=I(()=>{"use strict";D(),Sj(),ne(),Kb(),ae(),Tj=class{constructor(e,t){this.animationFrameHandler=e,this.app=t,this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.localTrail=new ib(e,t,{...this.getTrailOptions(),fill:()=>d$})}localTrail;collabTrails=new Map;container;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(ll(n),ll(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 ib(this.animationFrameHandler,this.app,{...this.getTrailOptions(),fill:()=>t.pointer?.laserColor||ff(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))}}}}),ZN,Cj,Ere=I(()=>{"use strict";D(),Ce(),ne(),Sl(),xe(),ae(),wt(),Kt(),qz(),Yb(),Tr(),Xc(),dT(),ZN=(e,t,n,r,i,o)=>{let{zoom:a}=r,s=180*n/Math.PI,l=e*(a.value-1)/2,c=t*(a.value-1)/2;return e>i&&a.value!==1&&(l=i*(a.value-1)/2),t>o&&a.value!==1&&(c=o*(a.value-1)/2),`translate(${l}px, ${c}px) scale(${a.value}) rotate(${s}deg)`},Cj=({id:e,onChange:t,onSubmit:n,getViewportCoords:r,element:i,canvas:o,excalidrawContainer:a,app:s})=>{let l=(_,$)=>{if(!$.style.fontFamily||!$.style.fontSize)return!1;let W=$.style.fontFamily.replace(/"/g,"");return zp({fontFamily:_.fontFamily})!==W||`${_.fontSize}px`!==$.style.fontSize},c=()=>{let _=s.state,$=Hn.getScene(i)?.getElement(e);if(!$)return;let{textAlign:W,verticalAlign:H}=$,K=s.scene.getNonDeletedElementsMap();if($&&he($)){let Q=$.x,ie=$.y,X=cr($,s.scene.getNonDeletedElementsMap()),F=$.width,B=$.height,U=$.width,G=$.height;if(X&&$.containerId){if(yt(X)){let Oe=pe.getBoundTextElementPosition(X,$,K);Q=Oe.x,ie=Oe.y}let Me=l($,d),Be;if(Me?Be=Up(X.id,X.height):(Be=pc[X.id],Be||(Be=Up(X.id,X.height))),F=po(X,$),B=bu(X,$),!yt(X)&&G>B){let Oe=nl(G,X.type);re(X,{height:Oe});return}else if(!yt(X)&&X.height>Be.height&&G<B){let Oe=nl(G,X.type);re(X,{height:Oe})}else{let{y:Oe}=Mp(X,$,K);ie=Oe}}let[Z,ee]=r(Q,ie),te=d.selectionStart,de=d.selectionEnd,qe=d.value.length;if(te===de&&de!==qe){let Me=qe-de;d.selectionStart=d.value.length-Me,d.selectionEnd=d.value.length-Me}X||(F=(_.width-8-Z)/_.zoom.value,U=Math.min(U,F));let Ye=(_.height-ee)/_.zoom.value;Object.assign(d.style,{font:xn($),lineHeight:$.lineHeight,width:`${U}px`,height:`${G}px`,left:`${Z}px`,top:`${ee}px`,transform:ZN(U,G,vF($,X),_,F,Ye),textAlign:W,verticalAlign:H,color:$.strokeColor,opacity:$.opacity/100,filter:"var(--theme-filter)",maxHeight:`${Ye}px`}),d.scrollTop=0,fl()&&(d.style.fontFamily=zp($)),re($,{x:Q,y:ie})}},d=document.createElement("textarea");d.dir="auto",d.tabIndex=0,d.dataset.type="wysiwyg",d.wrap="off",d.classList.add("excalidraw-wysiwyg");let u="pre",h="normal";pn(i)&&(u="pre-wrap",h="break-word"),Object.assign(d.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:h,whiteSpace:u,overflowWrap:"break-word",boxSizing:"content-box"}),d.value=i.originalText,c(),t&&(d.onpaste=async _=>{let $=await FT(_,!0);if(!$.text)return;let W=ju($.text);if(!W)return;let H=cr(i,s.scene.getNonDeletedElementsMap()),K=xn({fontSize:s.state.currentItemFontSize,fontFamily:s.state.currentItemFontFamily});if(H){let Q=Ue(H,s.scene.getNonDeletedElementsMap()),ie=Iu(`${d.value}${W}`,K,po(H,Q)),X=lp(ie,K);d.style.width=`${X}px`}},d.oninput=()=>{t(ju(d.value))}),d.onkeydown=_=>{if(!_.shiftKey&&VE.keyTest(_))_.preventDefault(),s.actionManager.executeAction(VE),c();else if(!_.shiftKey&&YE.keyTest(_))_.preventDefault(),s.actionManager.executeAction(YE),c();else if(P4.keyTest(_))s.actionManager.executeAction(P4);else if(D4.keyTest(_))s.actionManager.executeAction(D4);else if(_.key===O.ESCAPE)_.preventDefault(),w=!0,T();else if(_.key===O.ENTER&&_[O.CTRL_OR_CMD]){if(_.preventDefault(),_.isComposing||_.keyCode===229)return;w=!0,T()}else if(_.key===O.TAB||_[O.CTRL_OR_CMD]&&(_.code===tt.BRACKET_LEFT||_.code===tt.BRACKET_RIGHT)){if(_.preventDefault(),_.isComposing)return;_.shiftKey||_.code===tt.BRACKET_LEFT?b():g(),d.dispatchEvent(new Event("input"))}};let m=4,p=" ".repeat(m),f=new RegExp(`^ {1,${m}}`),g=()=>{let{selectionStart:_,selectionEnd:$}=d,W=v(),H=d.value;W.forEach(K=>{let Q=H.slice(0,K),ie=H.slice(K);H=`${Q}${p}${ie}`}),d.value=H,d.selectionStart=_+m,d.selectionEnd=$+m*W.length},b=()=>{let{selectionStart:_,selectionEnd:$}=d,W=v(),H=[],K=d.value;W.forEach(Q=>{let ie=K.slice(Q,Q+m).match(f);if(ie){let X=K.slice(0,Q),F=K.slice(Q+ie[0].length);K=`${X}${F}`,H.push(Q)}}),d.value=K,H.length&&(_>H[H.length-1]?d.selectionStart=Math.max(_-m,H[H.length-1]):d.selectionStart=_,d.selectionEnd=Math.max(d.selectionStart,$-m*H.length))},v=()=>{let{selectionStart:_,selectionEnd:$,value:W}=d,H=W.slice(0,_).match(/[^\n]*$/)[0].length;return _=_-H,W.slice(_,$).split(`
204
- `).reduce((K,Q,ie,X)=>K.concat(ie?K[ie-1]+X[ie-1].length+1:_),[]).reverse()},y=_=>{_.preventDefault(),_.stopPropagation()},w=!1,T=()=>{k();let _=Hn.getScene(i)?.getElement(i.id);if(!_)return;let $=d.value,W=cr(_,s.scene.getNonDeletedElementsMap());if(W){if($=_.text,d.value.trim()){let H=tl(W);!H||H!==i.id?re(W,{boundElements:(W.boundElements||[]).concat({type:"text",id:i.id})}):yt(W)&&Wc(W)}else re(W,{boundElements:W.boundElements?.filter(H=>!he(H))});bo(_,W,s.scene.getNonDeletedElementsMap())}n({text:$,viaKeyboard:w,originalText:d.value})},k=()=>{R||(R=!0,d.onblur=null,d.oninput=null,d.onkeydown=null,A&&A.disconnect(),window.removeEventListener("resize",c),window.removeEventListener("wheel",y,!0),window.removeEventListener("pointerdown",C),window.removeEventListener("pointerup",M),window.removeEventListener("blur",T),window.removeEventListener("beforeunload",T),P(),d.remove())},M=_=>{window.removeEventListener("pointerup",M);let $=_?.target,W=$ instanceof HTMLElement&&$.classList.contains("active-color");setTimeout(()=>{if(d.onblur=T,W){let H=(K,Q)=>{K.find(ie=>ie.removedNodes.length>0&&ie.removedNodes[0].dataset?.radixPopperContentWrapper!==void 0)&&(setTimeout(()=>{d.focus()}),Q.disconnect())};new MutationObserver(H).observe(document.querySelector(".excalidraw-container"),{childList:!0})}W||d.focus()})},C=_=>{let $=_.target instanceof HTMLElement&&_.target.classList.contains("active-color");((_.target instanceof HTMLElement||_.target instanceof SVGElement)&&_.target.closest(`.${US.SHAPE_ACTIONS_MENU}`)&&!Ha(_.target)||$)&&(d.onblur=null,window.addEventListener("pointerup",M),window.addEventListener("blur",T))},P=Hn.getScene(i).addCallback(()=>{c(),document.activeElement?.closest(".color-picker-content")||d.focus()}),R=!1;d.select(),M();let A=null;o&&"ResizeObserver"in window?(A=new window.ResizeObserver(()=>{c()}),A.observe(o)):window.addEventListener("resize",c),window.addEventListener("pointerdown",C),window.addEventListener("wheel",y,{passive:!1,capture:!0}),window.addEventListener("beforeunload",T),a?.querySelector(".excalidraw-textEditorContainer").appendChild(d)}}),d5,u5,h5,Yg,Zg,Xg,Kg,qg,Qg,_l,Xf,Wn,ua,Kf,wy,Dn,Or,tu,Jg,Bs,nu,e2,t2,Na,ru,n2,Jm,m5,p5,iu,et,XN,KN,Ij,Re=I(()=>{"use strict";D(),ko(),Gte(),Wte(),xt(),li(),$i(),Xc(),ae(),Uc(),Ru(),hh(),Pe(),la(),Tr(),wt(),cs(),xe(),jte(),Fi(),Ute(),ce(),Ce(),Ku(),ur(),ls(),pt(),Sl(),VT(),hI(),ne(),Eb(),Yte(),Une(),Yne(),Zne(),si(),iB(),Tl(),Kt(),Zc(),OH(),dh(),Rf(),FH(),Xne(),Sr(),Kc(),kH(),Qne(),Yb(),Ln(),py(),uh(),Jne(),PH(),ere(),Vb(),cj(),by(),ire(),ore(),ca(),sre(),Of(),VH(),cre(),ure(),mh(),Bi(),hre(),me(),ny(),pre(),fre(),Sj(),gre(),$I(),ls(),Ere(),xI(),AT(),gh(),d5=vn.default.createContext(null),u5=vn.default.createContext(null),h5={viewport:{isMobile:!1,isLandscape:!1},editor:{isMobile:!1,canFitSidebar:!1},isTouchScreen:!1},Yg=vn.default.createContext(h5),Yg.displayName="DeviceContext",Zg=vn.default.createContext({container:null,id:null}),Zg.displayName="ExcalidrawContainerContext",Xg=vn.default.createContext([]),Xg.displayName="ExcalidrawElementsContext",Kg=vn.default.createContext({...ml(),width:0,height:0,offsetLeft:0,offsetTop:0}),Kg.displayName="ExcalidrawAppStateContext",qg=vn.default.createContext(()=>{console.warn("Uninitialized ExcalidrawSetAppStateContext context!")}),qg.displayName="ExcalidrawSetAppStateContext",Qg=vn.default.createContext(null),Qg.displayName="ExcalidrawActionManagerContext",_l=()=>(0,vn.useContext)(d5),Xf=()=>(0,vn.useContext)(u5),Wn=()=>(0,vn.useContext)(Yg),ua=()=>(0,vn.useContext)(Zg),Kf=()=>(0,vn.useContext)(Xg),wy=()=>(0,vn.useContext)(Kg),Dn=()=>(0,vn.useContext)(qg),Or=()=>(0,vn.useContext)(Qg),tu=!1,Jg=0,Bs=!1,nu=!1,e2=!1,t2={horizontal:null,vertical:null},Na=0,ru=!1,n2=new Map,Jm=!1,m5=0,p5=!1,iu=null,et={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},XN=class kj extends vn.default.Component{canvas;interactiveCanvas=null;rc;unmounted=!1;actionManager;device=h5;excalidrawContainerRef=vn.default.createRef();scene;renderer;fonts;resizeObserver;nearestScrollableContainer;library;libraryItemsFromStorage;id;history;excalidrawContainerValue;files={};imageCache=new Map;iFrameRefs=new Map;embedsValidationStatus=new Map;initializedEmbeds=new Set;elementsPendingErasure=new Set;hitLinkElement;lastPointerDownEvent=null;lastPointerUpEvent=null;lastPointerMoveEvent=null;lastViewportPosition={x:0,y:0};animationFrameHandler=new wj;laserTrails=new Tj(this.animationFrameHandler,this);eraserTrail=new ib(this.animationFrameHandler,this,{streamline:.2,size:5,keepHead:!0,sizeMapping:t=>{let n=Math.max(0,1-(performance.now()-t.pressure)/200),r=(10-Math.min(10,t.totalLength-t.currentIndex))/10;return Math.min(ll(r),ll(n))},fill:()=>this.state.theme===$e.LIGHT?"rgba(0, 0, 0, 0.2)":"rgba(255, 255, 255, 0.2)"});onChangeEmitter=new $a;onPointerDownEmitter=new $a;onPointerUpEmitter=new $a;onUserFollowEmitter=new $a;onScrollChangeEmitter=new $a;missingPointerEventCleanupEmitter=new $a;onRemoveEventListenersEmitter=new $a;constructor(t){super(t);let n=ml(),{excalidrawAPI:r,viewModeEnabled:i=!1,zenModeEnabled:o=!1,gridModeEnabled:a=!1,objectsSnapModeEnabled:s=!1,theme:l=n.theme,name:c=`${x("labels.untitled")}-${C5()}`}=t;if(this.state={...n,theme:l,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:i,zenModeEnabled:o,objectsSnapModeEnabled:s,gridSize:a?_c:null,name:c,width:window.innerWidth,height:window.innerHeight},this.id=Fo(),this.library=new H4(this),this.actionManager=new nS(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new Hn,this.canvas=document.createElement("canvas"),this.rc=qt.canvas(this.canvas),this.renderer=new BS(this.scene),r){let d={updateScene:this.updateScene,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,history:{clear:this.resetHistory},scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:u=>{this.actionManager.registerAction(u)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,app:this,onChange:u=>this.onChangeEmitter.on(u),onPointerDown:u=>this.onPointerDownEmitter.on(u),onPointerUp:u=>this.onPointerUpEmitter.on(u),onScrollChange:u=>this.onScrollChangeEmitter.on(u),onUserFollow:u=>this.onUserFollowEmitter.on(u)};typeof r=="function"?r(d):console.error("excalidrawAPI should be a function!")}this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new QW({scene:this.scene,onSceneUpdated:this.onSceneUpdated}),this.history=new oS,this.actionManager.registerAll(I2),this.actionManager.registerAction(zG(this.history)),this.actionManager.registerAction(HG(this.history))}onWindowMessage(t){if(t.origin!=="https://player.vimeo.com"&&t.origin!=="https://www.youtube.com")return;let n=null;try{n=JSON.parse(t.data)}catch{}if(n)switch(t.origin){case"https://player.vimeo.com":if(n.method==="paused"){let r=null,i=document.body.querySelectorAll("iframe.excalidraw__embeddable");if(!i)break;for(let o of i)o.contentWindow===t.source&&(r=o.contentWindow);r?.postMessage(JSON.stringify({method:n.value?"play":"pause",value:!0}),"*")}break;case"https://www.youtube.com":if(n.event==="infoDelivery"&&n.info&&n.id&&typeof n.info.playerState=="number"){let r=n.id,i=n.info.playerState;Object.values(tp).includes(i)&&n2.set(r,i)}break}}cacheEmbeddableRef(t,n){n&&this.iFrameRefs.set(t.id,n)}getHTMLIFrameElement(t){return this.iFrameRefs.get(t.id)}handleEmbeddableCenterClick(t){if(this.state.activeEmbeddable?.element===t&&this.state.activeEmbeddable?.state==="active"||(setTimeout(()=>{this.setState({activeEmbeddable:{element:t,state:"active"},selectedElementIds:{[t.id]:!0},draggingElement:null,selectionElement:null})},100),Ga(t)))return;let n=this.getHTMLIFrameElement(t);if(n?.contentWindow){if(n.src.includes("youtube")){let r=n2.get(t.id);switch(r||(n2.set(t.id,tp.UNSTARTED),n.contentWindow.postMessage(JSON.stringify({event:"listening",id:t.id}),"*")),r){case tp.PLAYING:case tp.BUFFERING:n.contentWindow?.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*");break;default:n.contentWindow?.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*")}}n.src.includes("player.vimeo.com")&&n.contentWindow.postMessage(JSON.stringify({method:"paused"}),"*")}}isIframeLikeElementCenter(t,n,r,i){return t&&!n.altKey&&!n.shiftKey&&!n.metaKey&&!n.ctrlKey&&(this.state.activeEmbeddable?.element!==t||this.state.activeEmbeddable?.state==="hover"||!this.state.activeEmbeddable)&&r>=t.x+t.width/3&&r<=t.x+2*t.width/3&&i>=t.y+t.height/3&&i<=t.y+2*t.height/3}updateEmbedValidationStatus=(t,n)=>{this.embedsValidationStatus.set(t.id,n),jt.delete(t)};updateEmbeddables=()=>{let t=new Set,n=!1;this.scene.getNonDeletedElements().filter(r=>{if(sr(r)){if(t.add(r.id),!this.embedsValidationStatus.has(r.id)){n=!0;let i=kp(r.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(r,i)}}else Ga(r)&&t.add(r.id);return!1}),n&&this.scene.informMutation(),this.iFrameRefs.forEach((r,i)=>{t.has(i)||this.iFrameRefs.delete(i)})};renderEmbeddables(){let t=this.state.zoom.value,n=this.state.width,r=this.state.height,i=this.scene.getNonDeletedElements().filter(o=>sr(o)&&this.embedsValidationStatus.get(o.id)===!0||Ga(o));return(0,je.jsx)(je.Fragment,{children:i.map(o=>{let{x:a,y:s}=Ri({sceneX:o.x,sceneY:o.y},this.state),l=ef(o,n,r,this.state,this.scene.getNonDeletedElementsMap()),c=this.initializedEmbeds.has(o.id);if(l&&!c&&this.initializedEmbeds.add(o.id),!(l||c))return null;let d;if(Ga(o)){d=null;let m=(o.customData?.generationData??this.magicGenerations.get(o.id))||{status:"error",message:"No generation data",code:"ERR_NO_GENERATION_DATA"};if(m.status==="done"){let p=m.html;d={intrinsicSize:{w:o.width,h:o.height},type:"document",srcdoc:()=>p}}else if(m.status==="pending")d={intrinsicSize:{w:o.width,h:o.height},type:"document",srcdoc:()=>Ip(`
205
- <style>
206
- html, body {
207
- width: 100%;
208
- height: 100%;
209
- color: ${this.state.theme===$e.DARK?"white":"black"};
210
- }
211
- body {
212
- display: flex;
213
- align-items: center;
214
- justify-content: center;
215
- flex-direction: column;
216
- gap: 1rem;
217
- }
218
-
219
- .Spinner {
220
- display: flex;
221
- align-items: center;
222
- justify-content: center;
223
- margin-left: auto;
224
- margin-right: auto;
225
- }
226
-
227
- .Spinner svg {
228
- animation: rotate 1.6s linear infinite;
229
- transform-origin: center center;
230
- width: 40px;
231
- height: 40px;
232
- }
233
-
234
- .Spinner circle {
235
- stroke: currentColor;
236
- animation: dash 1.6s linear 0s infinite;
237
- stroke-linecap: round;
238
- }
239
-
240
- @keyframes rotate {
241
- 100% {
242
- transform: rotate(360deg);
243
- }
244
- }
245
-
246
- @keyframes dash {
247
- 0% {
248
- stroke-dasharray: 1, 300;
249
- stroke-dashoffset: 0;
250
- }
251
- 50% {
252
- stroke-dasharray: 150, 300;
253
- stroke-dashoffset: -200;
254
- }
255
- 100% {
256
- stroke-dasharray: 1, 300;
257
- stroke-dashoffset: -280;
258
- }
259
- }
260
- </style>
261
- <div class="Spinner">
262
- <svg
263
- viewBox="0 0 100 100"
264
- >
265
- <circle
266
- cx="50"
267
- cy="50"
268
- r="46"
269
- stroke-width="8"
270
- fill="none"
271
- stroke-miter-limit="10"
272
- />
273
- </svg>
274
- </div>
275
- <div>Generating...</div>
276
- `)};else{let p;m.code==="ERR_GENERATION_INTERRUPTED"?p="Generation was interrupted...":p=m.message||"Generation failed",d={intrinsicSize:{w:o.width,h:o.height},type:"document",srcdoc:()=>Ip(`
277
- <style>
278
- html, body {
279
- height: 100%;
280
- }
281
- body {
282
- display: flex;
283
- flex-direction: column;
284
- align-items: center;
285
- justify-content: center;
286
- color: ${He.red[3]};
287
- }
288
- h1, h3 {
289
- margin-top: 0;
290
- margin-bottom: 0.5rem;
291
- }
292
- </style>
293
- <h1>Error!</h1>
294
- <h3>${p}</h3>
295
- `)}}}else d=Cc(yT(o.link||""));let u=this.state.activeEmbeddable?.element===o&&this.state.activeEmbeddable?.state==="active",h=this.state.activeEmbeddable?.element===o&&this.state.activeEmbeddable?.state==="hover";return(0,je.jsx)("div",{className:Y("excalidraw__embeddable-container",{"is-hovered":h}),style:{transform:l?`translate(${a-this.state.offsetLeft}px, ${s-this.state.offsetTop}px) scale(${t})`:"none",display:l?"block":"none",opacity:y4(o,Fr(o,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure),"--embeddable-radius":`${hl(Math.min(o.width,o.height),o)}px`},children:(0,je.jsxs)("div",{className:"excalidraw__embeddable-container__inner",style:{width:l?`${o.width}px`:0,height:l?`${o.height}px`:0,transform:l?`rotate(${o.angle}rad)`:"none",pointerEvents:u?hc.enabled:hc.disabled},children:[h&&(0,je.jsx)("div",{className:"excalidraw__embeddable-hint",children:x("buttons.embeddableInteractionButton")}),(0,je.jsx)("div",{className:"excalidraw__embeddable__outer",style:{padding:`${o.strokeWidth}px`},children:(sr(o)?this.props.renderEmbeddable?.(o,this.state):null)??(0,je.jsx)("iframe",{ref:m=>this.cacheEmbeddableRef(o,m),className:"excalidraw__embeddable",srcDoc:d?.type==="document"?d.srcdoc(this.state.theme):void 0,src:d?.type!=="document"?d?.link??"":void 0,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:`${d?.sandbox?.allowSameOrigin?"allow-same-origin":""} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})]})},o.id)})})}getFrameNameDOMId=t=>`${this.id}-frame-name-${t.id}`;frameNameBoundsCache={get:t=>{let n=this.frameNameBoundsCache._cache.get(t.id);if(!n||n.zoom!==this.state.zoom.value||n.versionNonce!==t.versionNonce){let r=document.getElementById(this.getFrameNameDOMId(t));if(r){let i=r.getBoundingClientRect(),o=Ot({clientX:i.x,clientY:i.y},this.state),a=Ot({clientX:i.right,clientY:i.bottom},this.state);return n={x:o.x,y:o.y,width:a.x-o.x,height:a.y-o.y,angle:0,zoom:this.state.zoom.value,versionNonce:t.versionNonce},this.frameNameBoundsCache._cache.set(t.id,n),n}return null}return n},_cache:new Map};renderFrameNames=()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return null;let t=this.state.theme===$e.DARK,n=0,r=0;return this.scene.getNonDeletedFramesLikes().map(i=>{if(Gu(i)?n++:r++,!ef(i,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 null;let{x:o,y:a}=Ri({sceneX:i.x,sceneY:i.y},this.state),s=6,l=()=>{re(i,{name:i.name?.trim()||null}),this.setState({editingFrame:null})},c,d=WT(i,Gu(i)?n:r);if(i.id===this.state.editingFrame){let u=d;c=(0,je.jsx)("input",{autoFocus:!0,value:u,onChange:h=>{re(i,{name:h.target.value})},onFocus:h=>h.target.select(),onBlur:()=>l(),onKeyDown:h=>{(h.key===O.ESCAPE||h.key===O.ENTER)&&l()},style:{background:this.state.viewBackgroundColor,filter:t?lb:"none",zIndex:2,border:"none",display:"block",padding:`${s}px`,borderRadius:4,boxShadow:"inset 0 0 0 1px var(--color-primary)",fontFamily:"Assistant",fontSize:"14px",transform:`translate(-${s}px, ${s}px)`,color:"var(--color-gray-80)",overflow:"hidden",maxWidth:`${document.body.clientWidth-o-s}px`},size:u.length+1||1,dir:"auto",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off"})}else c=d;return(0,je.jsx)("div",{id:this.getFrameNameDOMId(i),style:{position:"absolute",bottom:`${this.state.height+Zt.nameOffsetY-a+this.state.offsetTop}px`,left:`${o-this.state.offsetLeft}px`,zIndex:2,fontSize:Zt.nameFontSize,color:t?Zt.nameColorDarkTheme:Zt.nameColorLightTheme,lineHeight:Zt.nameLineHeight,width:"max-content",maxWidth:`${i.width}px`,overflow:i.id===this.state.editingFrame?"visible":"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:ut.MOVE,pointerEvents:this.state.viewModeEnabled?hc.disabled:hc.enabled},onPointerDown:u=>this.handleCanvasPointerDown(u),onWheel:u=>this.handleWheel(u),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:i.id})},children:c},i.id)})};toggleOverscrollBehavior(t){document.documentElement.style.overscrollBehaviorX=t.type==="pointerenter"?"none":"auto"}render(){let t=this.scene.getSelectedElements(this.state),{renderTopRightUI:n,renderCustomStats:r}=this.props,i=this.scene.getVersionNonce(),{elementsMap:o,visibleElements:a}=this.renderer.getRenderableElements({versionNonce: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,editingElement:this.state.editingElement,pendingImageElementId:this.state.pendingImageElementId}),s=this.scene.getNonDeletedElementsMap(),l=!(this.state.editingElement&&Ne(this.state.editingElement))&&(this.state.selectionElement||this.state.draggingElement||this.state.resizingElement||this.state.activeTool.type==="laser"&&this.state.cursorButton==="down"||this.state.editingElement&&!he(this.state.editingElement)),c=t[0];return(0,je.jsx)("div",{className:Y("excalidraw excalidraw-container",{"excalidraw--view-mode":this.state.viewModeEnabled,"excalidraw--mobile":this.device.editor.isMobile,"excalidraw--zen-mode":this.state.zenModeEnabled}),style:{"--ui-pointerEvents":l?hc.disabled:hc.enabled},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:(0,je.jsx)(d5.Provider,{value:this,children:(0,je.jsx)(u5.Provider,{value:this.props,children:(0,je.jsx)(Zg.Provider,{value:this.excalidrawContainerValue,children:(0,je.jsx)(Yg.Provider,{value:this.device,children:(0,je.jsx)(qg.Provider,{value:this.setAppState,children:(0,je.jsx)(Kg.Provider,{value:this.state,children:(0,je.jsxs)(Xg.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,je.jsxs)(Qg.Provider,{value:this.actionManager,children:[(0,je.jsx)(KW,{onHomeButtonClick:this.props.onHomeButtonClick||(()=>{}),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:sh().code,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==="selection"&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,openAIKey:this.OPENAI_KEY,isOpenAIKeyPersisted:this.OPENAI_KEY_IS_PERSISTED,onOpenAIAPIKeyChange:this.onOpenAIKeyChange,onMagicSettingsConfirm:this.onMagicSettingsConfirm,renderTopRightUI:n,uiDisabled:this.props.ui===!1,children:this.props.children}),(0,je.jsx)("div",{className:"excalidraw-textEditorContainer"}),(0,je.jsx)("div",{className:"excalidraw-contextMenuContainer"}),(0,je.jsx)("div",{className:"excalidraw-eye-dropper-container"}),(0,je.jsx)(bj,{trails:[this.laserTrails,this.eraserTrail]}),t.length===1&&this.state.showHyperlinkPopup&&(0,je.jsx)(DH,{element:c,elementsMap:s,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast,updateEmbedValidationStatus:this.updateEmbedValidationStatus},c.id),this.props.aiEnabled!==!1&&t.length===1&&fu(c)&&(0,je.jsx)(HS,{element:c,elementsMap:o,children:(0,je.jsx)(z2,{title:x("labels.convertToCode"),icon:Gf,checked:!1,onChange:()=>this.onMagicFrameGenerate(c,"button")})}),t.length===1&&Ga(c)&&c.customData?.generationData?.status==="done"&&(0,je.jsxs)(HS,{element:c,elementsMap:o,children:[(0,je.jsx)(z2,{title:x("labels.copySource"),icon:Lb,checked:!1,onChange:()=>this.onIframeSrcCopy(c)}),(0,je.jsx)(z2,{title:"Enter fullscreen",icon:dM,checked:!1,onChange:()=>{let d=this.getHTMLIFrameElement(c);if(d)try{d.requestFullscreen(),this.setState({activeEmbeddable:{element:c,state:"active"},selectedElementIds:{[c.id]:!0},draggingElement:null,selectionElement:null})}catch(u){console.warn(u),this.setState({errorMessage:"Couldn't enter fullscreen"})}}})]}),this.state.toast!==null&&(0,je.jsx)(qW,{message:this.state.toast.message,onClose:()=>this.setToast(null),duration:this.state.toast.duration,closable:this.state.toast.closable}),this.state.contextMenu&&this.props.interactive!==!1&&this.props.ui!==!1&&(0,je.jsx)(jG,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:d=>{this.setState({contextMenu:null},()=>{this.focusContainer(),d?.()})}}),(0,je.jsx)(Ej,{canvas:this.canvas,rc:this.rc,elementsMap:o,allElementsMap:s,visibleElements:a,versionNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!0,canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure}}),(0,je.jsx)(fj,{containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elementsMap:o,visibleElements:a,selectedElements:t,versionNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,je.jsx)(xj,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames()]}),this.renderEmbeddables()]})})})})})})})})}focusContainer=()=>{this.excalidrawContainerRef.current?.focus()};getSceneElementsIncludingDeleted=()=>this.scene.getElementsIncludingDeleted();getSceneElements=()=>this.scene.getNonDeletedElements();onInsertElements=t=>{this.addElementsFromPasteOrLibrary({elements:t,position:"center",files:null})};onExportImage=async(t,n,r)=>{ot("export",t,"ui");let i=await uf({type:t,data:{elements:n,appState:this.state,files:this.files},config:{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:r.exportingFrame}}).catch(QS).catch(o=>{console.error(o),this.setState({errorMessage:o.message})});this.state.exportEmbedScene&&i&&xb(i)&&this.setState({fileHandle:i})};magicGenerations=new Map;updateMagicGeneration=({frameElement:t,data:n})=>{n.status==="pending"?re(t,{customData:{generationData:void 0}},!1):re(t,{customData:{generationData:n}},!1),this.magicGenerations.set(t.id,n),this.onSceneUpdated()};getTextFromElements(t){return t.reduce((n,r)=>(he(r)&&n.push(r.text),n),[]).join(`
296
-
297
- `)}async onMagicFrameGenerate(t,n){if(!this.OPENAI_KEY){this.setState({openDialog:{name:"settings",tab:"diagram-to-code",source:"generation"}}),ot("ai","generate (missing key)","d2c");return}let r=Tb(this.scene.getNonDeletedElements(),t).filter(u=>!fu(u));if(!r.length){n==="button"?(this.setState({errorMessage:"Cannot generate from an empty frame"}),ot("ai","generate (no-children)","d2c")):this.setActiveTool({type:"magicframe"});return}let i=this.insertIframeElement({sceneX:t.x+t.width+30,sceneY:t.y,width:t.width,height:t.height});if(!i)return;this.updateMagicGeneration({frameElement:i,data:{status:"pending"}}),this.setState({selectedElementIds:{[i.id]:!0}});let o=await p4({data:{elements:this.scene.getNonDeletedElements(),appState:{...this.state,exportBackground:!0,viewBackgroundColor:this.state.viewBackgroundColor},files:this.files},config:{exportingFrame:t}}),a=await A2(o),s=this.getTextFromElements(r);ot("ai","generate (start)","d2c");let l=await dre({image:a,apiKey:this.OPENAI_KEY,text:s,theme:this.state.theme});if(!l.ok){ot("ai","generate (failed)","d2c"),console.error(l.error),this.updateMagicGeneration({frameElement:i,data:{status:"error",code:"ERR_OAI",message:l.error?.message||"Unknown error during generation"}});return}if(ot("ai","generate (success)","d2c"),l.choices[0].message.content==null){this.updateMagicGeneration({frameElement:i,data:{status:"error",code:"ERR_OAI",message:"Nothing genereated :("}});return}let c=l.choices[0].message.content,d=c.slice(c.indexOf("<!DOCTYPE html>"),c.indexOf("</html>")+7);this.updateMagicGeneration({frameElement:i,data:{status:"done",html:d}})}onIframeSrcCopy(t){t.customData?.generationData?.status==="done"&&(Zu(t.customData.generationData.html),this.setToast({message:"copied to clipboard",closable:!1,duration:1500}))}OPENAI_KEY=is.get(ts.OAI_API_KEY);OPENAI_KEY_IS_PERSISTED=is.has(ts.OAI_API_KEY)||!1;onOpenAIKeyChange=(t,n)=>{if(this.OPENAI_KEY=t||null,n){let r=is.set(ts.OAI_API_KEY,t);this.OPENAI_KEY_IS_PERSISTED=r}else this.OPENAI_KEY_IS_PERSISTED=!1};onMagicSettingsConfirm=(t,n,r)=>{if(this.OPENAI_KEY=t||null,this.onOpenAIKeyChange(this.OPENAI_KEY,n),r==="settings")return;let i=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});t?i.length?this.onMagicframeToolSelect():this.setActiveTool({type:"magicframe"}):fu(i[0])||this.setActiveTool({type:"magicframe"})};onMagicframeToolSelect=()=>{if(!this.OPENAI_KEY){this.setState({openDialog:{name:"settings",tab:"diagram-to-code",source:"tool"}}),ot("ai","tool-select (missing key)","d2c");return}let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(t.length===0)this.setActiveTool({type:_n.magicframe}),ot("ai","tool-select (empty-selection)","d2c");else{let n=t.length===1&&fu(t[0])&&t[0];if(!n&&t.some(i=>ke(i)||i.frameId)){this.setActiveTool({type:_n.magicframe});return}ot("ai","tool-select (existing selection)","d2c");let r;if(n)r=n;else{let[i,o,a,s]=Nt(t),l=50;r=lE({...Zt,x:i-l,y:o-l,width:a-i+l*2,height:s-o+l*2,opacity:100,locked:!1}),this.scene.addNewElement(r);for(let c of t)re(c,{frameId:r.id});this.setState({selectedElementIds:{[r.id]:!0}})}this.onMagicFrameGenerate(r,"upstream")}};openEyeDropper=({type:t})=>{xo.set(Uf,{swapPreviewOnAlt:!0,colorPickerType:t==="stroke"?"elementStroke":"elementBackground",onSelect:(n,r)=>{let i=t==="background"&&r.altKey||t==="stroke"&&!r.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!=="selection"?i?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:n},commitToHistory:!0}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:n},commitToHistory:!0}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(o=>this.state.selectedElementIds[o.id]?Le(o,{[i?"strokeColor":"backgroundColor"]:n}):o)})},keepOpenOnAlt:!1})};syncActionResult=zt(t=>{if(this.unmounted||t===!1)return;let n=null;if(t.elements&&(t.elements.forEach(r=>{this.state.editingElement?.id===r.id&&this.state.editingElement!==r&&vE(r)&&(n=r)}),this.scene.replaceAllElements(t.elements),t.commitToHistory&&this.history.resumeRecording()),t.files&&(this.files=t.replaceFiles?t.files:{...this.files,...t.files},this.addNewImagesToImageCache()),t.appState||n||this.state.contextMenu){t.commitToHistory&&this.history.resumeRecording();let r=t?.appState?.viewModeEnabled||!1,i=t?.appState?.zenModeEnabled||!1,o=t?.appState?.gridSize||null,a=t?.appState?.theme||this.props.theme||$e.LIGHT,s=t?.appState?.name??this.state.name,l=t?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<"u"&&(r=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<"u"&&(i=this.props.zenModeEnabled),typeof this.props.gridModeEnabled<"u"&&(o=this.props.gridModeEnabled?_c:null),n=n||t.appState?.editingElement||null,n?.isDeleted&&(n=null),this.setState(c=>Object.assign(t.appState||{},{contextMenu:null,editingElement:n,viewModeEnabled:r,zenModeEnabled:i,gridSize:o,theme:a,name:s,errorMessage:l}),()=>{t.syncHistory&&this.history.setCurrentState(this.state,this.scene.getElementsIncludingDeleted())})}});onBlur=zt(()=>{Bs=!1,this.setState({isBindingEnabled:!0})});onUnload=()=>{this.onBlur()};disableEvent=t=>{t.preventDefault()};resetHistory=()=>{this.history.clear()};resetScene=zt(t=>{this.scene.replaceAllElements([]),this.setState(n=>({...ml(),isLoading:t?.resetLoadingState?!1:n.isLoading,theme:this.state.theme})),this.resetHistory()});initializeScene=async()=>{"launchQueue"in window&&"LaunchParams"in window&&window.launchQueue.setConsumer(async r=>{if(!r.files.length)return;let i=r.files[0],o=await i.getFile();this.loadFileToCanvas(new File([o],o.name||"",{type:o.type}),i)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let t=null;try{t=await this.props.initialData||null,t?.libraryItems&&this.library.updateLibrary({libraryItems:t.libraryItems,merge:!0}).catch(r=>{console.error(r)})}catch(r){console.error(r),t={appState:{errorMessage:r.message||"Encountered an error during importing or restoring scene data"}}}let n=yb(t,null,null,{repairBindings:!0});n.appState={...n.appState,theme:this.props.theme||n.appState.theme,openSidebar:n.appState?.openSidebar||this.state.openSidebar,activeTool:n.appState.activeTool.type==="image"?{...n.appState.activeTool,type:"selection"}:n.appState.activeTool,isLoading:!1,toast:this.state.toast},t?.scrollToContent&&(n.appState={...n.appState,...qu(n.elements,{...n.appState,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.fonts.loadFontsForElements(n.elements),t?.scrollX!=null&&(n.appState.scrollX=t.scrollX),t?.scrollY!=null&&(n.appState.scrollY=t.scrollY),this.resetHistory(),this.syncActionResult({...n,commitToHistory:!0})};isMobileBreakpoint=(t,n)=>t<b$||n<v$&&t<y$;refreshViewportBreakpoints=()=>{if(!this.excalidrawContainerRef.current)return;let{clientWidth:t,clientHeight:n}=document.body,r=this.device.viewport,i=xp(r,{isLandscape:t>n,isMobile:this.isMobileBreakpoint(t,n)});return r!==i?(this.device={...this.device,viewport:i},!0):!1};refreshEditorBreakpoints=()=>{let t=this.excalidrawContainerRef.current;if(!t)return;let{width:n,height:r}=t.getBoundingClientRect(),i=this.props.UIOptions.dockedSidebarBreakpoint!=null?this.props.UIOptions.dockedSidebarBreakpoint:x$,o=this.device.editor,a=xp(o,{isMobile:this.isMobileBreakpoint(n,r),canFitSidebar:n>i});return o!==a?(this.device={...this.device,editor:a},!0):!1};async componentDidMount(){if(this.unmounted=!1,this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,Pt.MODE===v5.TEST||Pt.DEV){let t=this.setState.bind(this);Object.defineProperties(window.h,{state:{configurable:!0,get:()=>this.state},setState:{configurable:!0,value:(...n)=>this.setState(...n)},app:{configurable:!0,value:this},history:{configurable:!0,value:this.history}})}this.scene.addCallback(this.onSceneUpdated),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),fl()||(this.refreshViewportBreakpoints(),this.refreshEditorBreakpoints()),j2&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorBreakpoints(),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),s$()&&!TF()&&this.setState({errorMessage:(0,je.jsx)(lj,{})})}componentWillUnmount(){this.renderer.destroy(),this.scene=new Hn,this.renderer=new BS(this.scene),this.files={},this.imageCache.clear(),this.resizeObserver?.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.scene.destroy(),this.library.destroy(),this.laserTrails.stop(),this.eraserTrail.stop(),this.onChangeEmitter.clear(),jt.destroy(),ea.destroy(),IB(),this.onChangeEmitter.clear(),Pt.PROD&&(this.history=new oS,this.library=new H4(this),this.actionManager=new nS(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.canvas=null,this.interactiveCanvas=null,this.rc=null,this.excalidrawContainerRef.current=void 0,this.nearestScrollableContainer=void 0,this.excalidrawContainerValue={container:null,id:"unmounted"}),clearTimeout(Na),mn.clearCache(),Lr.clearCache(),Na=0,document.documentElement.style.overscrollBehaviorX=""}onResize=zt(()=>{this.scene.getElementsIncludingDeleted().forEach(t=>jt.delete(t)),this.refreshViewportBreakpoints(),this.updateDOMRect(),j2||this.refreshEditorBreakpoints(),this.setState({})});onFullscreenChange=()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state==="active"&&this.setState({activeEmbeddable:null})};removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(en(document,"keydown",this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(en(this.excalidrawContainerRef.current,"wheel",this.onWheel,{passive:!1}),en(window,"message",this.onWindowMessage,!1),en(document,"pointerup",this.removePointer),en(document,"copy",this.onCopy),en(document,"keyup",this.onKeyUp,{passive:!0}),en(document,"mousemove",this.updateCurrentCursorPosition),en(document.fonts,"loadingdone",t=>{let n=t.fontfaces;this.fonts.onFontsLoaded(n)}),en(document,"gesturestart",this.onGestureStart,!1),en(document,"gesturechange",this.onGestureChange,!1),en(document,"gestureend",this.onGestureEnd,!1),en(window,"focus",()=>{this.maybeCleanupAfterMissingPointerUp(null)})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(en(document,"fullscreenchange",this.onFullscreenChange),en(document,"paste",this.pasteFromClipboard),en(document,"cut",this.onCut),en(window,"resize",this.onResize,!1),en(window,"unload",this.onUnload,!1),en(window,"blur",this.onBlur,!1),en(this.excalidrawContainerRef.current,"dragover",this.disableEvent,!1),en(this.excalidrawContainerRef.current,"drop",this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(en(O$(this.excalidrawContainerRef.current),"scroll",this.onScroll)))}componentDidUpdate(t,n){this.updateEmbeddables();let r=this.scene.getElementsIncludingDeleted(),i=this.scene.getNonDeletedElementsMap();!this.state.showWelcomeScreen&&!r.length&&this.setState({showWelcomeScreen:!0}),t.UIOptions.dockedSidebarBreakpoint!==this.props.UIOptions.dockedSidebarBreakpoint&&this.refreshEditorBreakpoints(),n.userToFollow&&!this.state.collaborators.has(n.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),this.props.activeTool&&this.props.activeTool.type!==this.state.activeTool.type&&this.setActiveTool(this.props.activeTool),(n.zoom.value!==this.state.zoom.value||n.scrollX!==this.state.scrollX||n.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)),n.userToFollow!==this.state.userToFollow&&(n.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:n.userToFollow,action:"UNFOLLOW"}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:"FOLLOW"})),Object.keys(this.state.selectedElementIds).length&&uo(this.state)&&this.setState({activeTool:nn(this.state,{type:"selection"})}),this.state.activeTool.type==="eraser"&&n.theme!==this.state.theme&&X5(this.interactiveCanvas,this.state.theme),n.activeTool.type==="selection"&&this.state.activeTool.type!=="selection"&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),t.langCode!==this.props.langCode&&this.updateLanguage(),uo(n)&&!uo(this.state)&&this.eraserTrail.endPath(),t.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),n.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),t.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),t.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),t.gridModeEnabled!==this.props.gridModeEnabled&&this.setState({gridSize:this.props.gridModeEnabled?_c:null}),!this.props.UIOptions.canvasActions&&this.state.openMenu==="canvas"&&this.setState({openMenu:null}),this.excalidrawContainerRef.current?.classList.toggle("theme--dark",this.state.theme===$e.DARK),this.state.editingLinearElement&&!this.state.selectedElementIds[this.state.editingLinearElement.elementId]&&setTimeout(()=>{this.state.editingLinearElement&&this.actionManager.executeAction(Ci)}),this.state.editingElement?.isDeleted&&this.setState({editingElement:null}),this.state.selectedLinearElement&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&this.setState({selectedLinearElement:null});let{multiElement:o}=n;n.activeTool!==this.state.activeTool&&o!=null&&el(this.state)&&Xn(o,!1)&&oE(o,this.state,this.scene,Ka(pe.getPointAtIndexGlobalCoordinates(o,-1,i)),i),this.history.record(this.state,r),this.state.isLoading||(this.props.onChange?.(r,this.state,this.files,this.props.id),this.onChangeEmitter.trigger(r,this.state,this.files))}renderInteractiveSceneCallback=({atLeastOneVisibleElement:t,scrollBars:n,elementsMap:r})=>{n&&(t2=n);let i=he(this.state.editingElement)?!1:!t&&r.size>0;this.state.scrolledOutside!==i&&this.setState({scrolledOutside:i}),this.scheduleImageRefresh()};onScroll=Hp(()=>{let{offsetTop:t,offsetLeft:n}=this.getCanvasOffsets();this.setState(r=>r.offsetLeft===n&&r.offsetTop===t?null:{offsetTop:t,offsetLeft:n})},g$);onCut=zt(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Ha(t.target)||(this.actionManager.executeAction(XE,"keyboard",t),t.preventDefault(),t.stopPropagation())});onCopy=zt(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Ha(t.target)||(this.actionManager.executeAction(Du,"keyboard",t),t.preventDefault(),t.stopPropagation())});static resetTapTwice(){tu=!1}onTouchStart=t=>{if(a$&&t.preventDefault(),this.props.interactive!==!1){if(!tu){tu=!0,clearTimeout(Jg),Jg=window.setTimeout(kj.resetTapTwice,p$);return}if(tu&&t.touches.length===1){let n=t.touches[0];this.handleCanvasDoubleClick({clientX:n.clientX,clientY:n.clientY}),tu=!1,clearTimeout(Jg)}t.touches.length===2&&this.setState({selectedElementIds:rt({},this.state),activeEmbeddable:null})}};onTouchEnd=t=>{this.props.interactive!==!1&&(this.resetContextMenuTimer(),t.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:rt(this.state.previousSelectedElementIds,this.state)}):et.pointers.clear())};pasteFromClipboard=zt(async t=>{if(this.props.interactive===!1)return;let n=!!Jm,r=document.activeElement,i=this.excalidrawContainerRef.current?.contains(r);if(t&&!i)return;let o=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(t&&(!(o instanceof HTMLCanvasElement)||Ha(r)))return;let{x:a,y:s}=Ot({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),l=t?.clipboardData?.files[0],c=await FT(t,n);if(!l&&!n){if(c.mixedContent)return this.addElementsFromMixedContentPaste(c.mixedContent,{isPlainPaste:n,sceneX:a,sceneY:s});if(c.text){let d=c.text.trim();d.startsWith("<svg")&&d.endsWith("</svg>")&&(l=a4(d))}}if(Xs(l)&&!c.spreadsheet){if(!this.isToolSupported("image")){this.setState({errorMessage:x("errors.imageToolNotSupported")});return}let d=this.createImageElement({sceneX:a,sceneY:s});this.insertImageElement(d,l),this.initializeImageDimensions(d),this.setState({selectedElementIds:rt({[d.id]:!0},this.state)});return}if(this.props.onPaste)try{if(await this.props.onPaste(c,t)===!1)return}catch(d){console.error(d)}if(c.errorMessage)this.setState({errorMessage:c.errorMessage});else if(c.spreadsheet&&!n)this.setState({pasteDialog:{data:c.spreadsheet,shown:!0}});else if(c.elements){let d=c.programmaticAPI?OI(c.elements):c.elements;this.addElementsFromPasteOrLibrary({elements:d,files:c.files||null,position:"cursor",retainSeed:n})}else if(c.text){let d=tT(c.text).split(/\n+/).map(h=>h.trim()).filter(Boolean),u=d.map(h=>BF(h)).filter(h=>kp(h,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(h)||Cc(h)?.type==="video"));if(!Jm&&u.length>0&&u.length===d.length){let h=[];for(let m of u){let p=h[h.length-1],f=this.insertEmbeddableElement({sceneX:p?p.x+p.width+20:a,sceneY:s,link:wo(m)});f&&h.push(f)}h.length&&this.setState({selectedElementIds:Object.fromEntries(h.map(m=>[m.id,!0]))});return}this.addTextFromPaste(c.text,n)}this.setActiveTool({type:"selection"}),t?.preventDefault()});addElementsFromPasteOrLibrary=t=>{let n=k2(t.elements,null,void 0),[r,i,o,a]=Nt(n),s=Zn(r,o)/2,l=Zn(i,a)/2,c=typeof t.position=="object"?t.position.clientX:t.position==="cursor"?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,d=typeof t.position=="object"?t.position.clientY:t.position==="cursor"?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop,{x:u,y:h}=Ot({clientX:c,clientY:d},this.state),m=u-s,p=h-l,[f,g]=Fn(m,p,this.state.gridSize),b=ST(n.map(T=>Le(T,{x:T.x+f-r,y:T.y+g-i})),{randomizeSeed:!t.retainSeed}),v=[...this.scene.getElementsIncludingDeleted(),...b],y=this.getTopLayerFrameAtSceneCoords({x:u,y:h});if(y){let T=TB(b,y);Pp(v,T,y)}this.scene.replaceAllElements(v),b.forEach(T=>{if(he(T)&&pn(T)){let k=cr(T,this.scene.getElementsMapIncludingDeleted());bo(T,k,this.scene.getElementsMapIncludingDeleted())}}),t.files&&(this.files={...this.files,...t.files}),this.history.resumeRecording();let w=tf(b);this.setState({...this.state,openSidebar:this.state.openSidebar&&this.device.editor.canFitSidebar&&xo.get(tb)?this.state.openSidebar:null,...Lr({editingGroupId:null,selectedElementIds:w.reduce((T,k)=>(pn(k)||(T[k.id]=!0),T),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{t.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:"selection"}),t.fitToContent&&this.scrollToContent(b,{fitToContent:!0})};async addElementsFromMixedContentPaste(t,{isPlainPaste:n,sceneX:r,sceneY:i}){if(!n&&t.some(o=>o.type==="imageUrl")&&this.isToolSupported("image")){let o=t.filter(u=>u.type==="imageUrl").map(u=>u.value),a=await Promise.all(o.map(async u=>{try{return{file:await QF(u)}}catch(h){let m=h.message;return h.cause==="FETCH_ERROR"?m=x("errors.failedToFetchImage"):h.cause==="UNSUPPORTED"&&(m=x("errors.unsupportedFileType")),{errorMessage:m}}})),s=i,l=!1,c={};for(let u of a)if(u.file){let h=this.createImageElement({sceneX:r,sceneY:s}),m=await this.insertImageElement(h,u.file);m&&(l||(l=!0,s-=m.height/2),re(m,{y:s},!1),s=h.y+h.height+25,c[h.id]=!0)}this.setState({selectedElementIds:rt(c,this.state)});let d=a.find(u=>!!u.errorMessage);d&&d.errorMessage&&this.setState({errorMessage:d.errorMessage})}else{let o=t.filter(a=>a.type==="text");o.length&&this.addTextFromPaste(o.map(a=>a.value).join(`
298
-
299
- `),n)}}addTextFromPaste(t,n=!1){let{x:r,y:i}=Ot({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),o={x:r,y:i,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:t,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:this.state.currentItemTextAlign,verticalAlign:Fp,locked:!1},a=10,s=i,l=n?[t]:t.split(`
300
- `),c=l.reduce((u,h,m)=>{let p=h.trim(),f=gl(o.fontFamily);if(p.length){let g=this.getTopLayerFrameAtSceneCoords({x:r,y:s}),b=ri({...o,x:r,y:s,text:p,lineHeight:f,frameId:g?g.id:null});u.push(b),s+=b.height+a}else l[m-1]?.trim()&&(s+=Mu(o.fontSize,f)+a);return u},[]);if(c.length===0)return;let d=c[0].frameId;d?this.scene.insertElementsAtIndex(c,this.scene.getElementIndex(d)):this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),...c]),this.setState({selectedElementIds:rt(Object.fromEntries(c.map(u=>[u.id,!0])),this.state)}),!n&&c.length>1&&p5===!1&&!this.device.editor.isMobile&&(this.setToast({message:x("toast.pasteAsSingleElement",{shortcut:V("CtrlOrCmd+Shift+V")}),duration:5e3}),p5=!0),this.history.resumeRecording()}setAppState=(t,n)=>{this.setState(t,n)};removePointer=t=>{Na&&this.resetContextMenuTimer(),et.pointers.delete(t.pointerId)};toggleLock=(t="ui")=>{this.state.activeTool.locked||ot("toolbar","toggleLock",`${t} (${this.device.editor.isMobile?"mobile":"desktop"})`),this.setState(n=>({activeTool:{...n.activeTool,...nn(this.state,n.activeTool.locked?{type:"selection"}:n.activeTool),locked:!n.activeTool.locked}}))};updateFrameRendering=t=>{this.setState(n=>{let r=typeof t=="function"?t(n.frameRendering):t;return{frameRendering:{enabled:r?.enabled??n.frameRendering.enabled,clip:r?.clip??n.frameRendering.clip,name:r?.name??n.frameRendering.name,outline:r?.outline??n.frameRendering.outline}}})};togglePenMode=t=>{this.setState(n=>({penMode:t??!n.penMode,penDetected:!0}))};onHandToolToggle=()=>{this.actionManager.executeAction(rH)};zoomCanvas=t=>{this.setState({...ol({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:il(t)},this.state)})};cancelInProgressAnimation=null;scrollToContent=(t=this.scene.getNonDeletedElements(),n)=>{this.cancelInProgressAnimation?.();let r=Array.isArray(t)?t:[t],i=this.state.zoom,o=this.state.scrollX,a=this.state.scrollY;if(n?.fitToContent||n?.fitToViewport){let{appState:s}=pp({targetElements:r,appState:this.state,fitToViewport:!!n?.fitToViewport,viewportZoomFactor:n?.viewportZoomFactor});i=s.zoom,o=s.scrollX,a=s.scrollY}else{let s=qu(r,this.state);o=s.scrollX,a=s.scrollY}if(n?.animate){let s=this.state.scrollX,l=this.state.scrollY,c=this.state.zoom.value,d=L$({fromValues:{scrollX:s,scrollY:l,zoom:c},toValues:{scrollX:o,scrollY:a,zoom:i.value},interpolateValue:(u,h,m,p)=>{if(p==="zoom")return u*Math.pow(h/u,ll(m))},onStep:({scrollX:u,scrollY:h,zoom:m})=>{this.setState({scrollX:u,scrollY:h,zoom:{value:m}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.setState({shouldCacheIgnoreZoom:!1})},duration:n?.duration??500});this.cancelInProgressAnimation=()=>{d(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:o,scrollY:a,zoom:i})};maybeUnfollowRemoteUser=()=>{this.state.userToFollow&&this.setState({userToFollow:null})};translateCanvas=t=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(t)};setToast=t=>{this.setState({toast:t})};restoreFileFromShare=async()=>{try{let t=await caches.open("web-share-target"),n=await t.match("shared-file");if(n){let r=await n.blob(),i=new File([r],r.name||"",{type:r.type});this.loadFileToCanvas(i,null),await t.delete("shared-file"),window.history.replaceState(null,U2,window.location.pathname)}}catch(t){this.setState({errorMessage:t.message})}};addFiles=zt(t=>{let n=t.reduce((r,i)=>(r.set(i.id,i),r),new Map);this.files={...this.files,...Object.fromEntries(n)},this.scene.getNonDeletedElements().forEach(r=>{Eo(r)&&n.has(r.fileId)&&(this.imageCache.delete(r.fileId),jt.delete(r))}),this.scene.informMutation(),this.addNewImagesToImageCache()});updateScene=zt(t=>{t.commitToHistory&&this.history.resumeRecording(),t.appState&&this.setState(t.appState),t.elements&&this.scene.replaceAllElements(t.elements),t.collaborators&&this.setState({collaborators:t.collaborators})});onSceneUpdated=()=>{this.setState({})};toggleSidebar=({name:t,tab:n,force:r})=>{let i;r===void 0?i=this.state.openSidebar?.name===t&&this.state.openSidebar?.tab===n?null:t:i=r?t:null;let o=i?{name:i}:null;return o&&n&&(o.tab=n),this.setState({openSidebar:o}),!!i};updateCurrentCursorPosition=zt(t=>{this.lastViewportPosition.x=t.clientX,this.lastViewportPosition.y=t.clientY});onKeyDown=zt(t=>{if("Proxy"in window&&(!t.shiftKey&&/^[A-Z]$/.test(t.key)||t.shiftKey&&/^[a-z]$/.test(t.key))&&(t=new Proxy(t,{get(o,a){let s=o[a];return typeof s=="function"?s.bind(o):a==="key"?t.shiftKey?o.key.toUpperCase():o.key.toLowerCase():s}})),t[O.CTRL_OR_CMD]&&t.key===O.P&&!t.shiftKey&&!t.altKey){this.setToast({message:x("commandPalette.shortcutHint",{shortcut:wr("commandPalette")})}),t.preventDefault();return}if(t[O.CTRL_OR_CMD]&&t.key.toLowerCase()===O.V&&(Jm=t.shiftKey,clearTimeout(m5),m5=window.setTimeout(()=>{Jm=!1},100)),t[O.CTRL_OR_CMD]&&Ha(t.target)&&(t.code===tt.MINUS||t.code===tt.EQUAL)){t.preventDefault();return}if(Ha(t.target)&&t.key!==O.ESCAPE||Cp(t.key)&&M5(t.target))return;if(t.key===O.QUESTION_MARK){this.setState({openDialog:{name:"help"}});return}else if(t.key.toLowerCase()===O.E&&t.shiftKey&&t[O.CTRL_OR_CMD]){t.preventDefault(),this.setState({openDialog:{name:"imageExport"}});return}if(t.key===O.PAGE_UP||t.key===O.PAGE_DOWN){let o=(t.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;t.key===O.PAGE_DOWN&&(o=-o),t.shiftKey?this.translateCanvas(a=>({scrollX:a.scrollX+o})):this.translateCanvas(a=>({scrollY:a.scrollY+o}))}if(this.actionManager.handleKeyDown(t)||this.state.viewModeEnabled)return;if(t[O.CTRL_OR_CMD]&&this.state.isBindingEnabled&&this.setState({isBindingEnabled:!1}),Cp(t.key)){let o=this.state.gridSize&&(t.shiftKey?y5:this.state.gridSize)||(t.shiftKey?l$:y5),a=0,s=0;t.key===O.ARROW_LEFT?a=-o:t.key===O.ARROW_RIGHT?a=o:t.key===O.ARROW_UP?s=-o:t.key===O.ARROW_DOWN&&(s=o);let l=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});l.forEach(c=>{re(c,{x:c.x+a,y:c.y+s}),Wa(c,this.scene.getNonDeletedElementsMap(),{simultaneouslyUpdated:l})}),this.maybeSuggestBindingForAll(l),t.preventDefault()}else if(t.key===O.ENTER){let o=this.scene.getSelectedElements(this.state);if(o.length===1){let a=o[0];if(t[O.CTRL_OR_CMD])Ne(a)&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==o[0].id)&&(this.history.resumeRecording(),this.setState({editingLinearElement:new pe(a)}));else if(he(a)||SF(a)){let s;he(a)||(s=a);let l=T2(a,this.state,this.scene.getNonDeletedElementsMap()),c=l.x,d=l.y;this.startTextEditing({sceneX:c,sceneY:d,container:s}),t.preventDefault();return}else ke(a)&&this.setState({editingFrame:a.id})}}else if(!t.ctrlKey&&!t.altKey&&!t.metaKey&&this.state.draggingElement===null){let o=CG(t.key);o?(this.state.activeTool.type!==o&&ot("toolbar",o,`keyboard (${this.device.editor.isMobile?"mobile":"desktop"})`),this.setActiveTool({type:o}),t.stopPropagation()):t.key===O.Q&&(this.toggleLock("keyboard"),t.stopPropagation())}if(t.key===O.SPACE&&et.pointers.size===0&&(Bs=!0,mt(this.interactiveCanvas,ut.GRAB),t.preventDefault()),(t.key===O.G||t.key===O.S)&&!t.altKey&&!t[O.CTRL_OR_CMD]){let o=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!o.length)return;t.key===O.G&&(xc(this.state.activeTool.type)||o.some(a=>xc(a.type)))&&(this.setState({openPopup:"elementBackground"}),t.stopPropagation()),t.key===O.S&&(this.setState({openPopup:"elementStroke"}),t.stopPropagation())}if(t.key===O.K&&!t.altKey&&!t[O.CTRL_OR_CMD]){this.state.activeTool.type==="laser"?this.setActiveTool({type:"selection"}):this.setActiveTool({type:"laser"});return}t[O.CTRL_OR_CMD]&&(t.key===O.BACKSPACE||t.key===O.DELETE)&&xo.set(yf,"clearCanvas");let n=t.key.toLocaleLowerCase(),r=n===O.S&&t.shiftKey,i=t.key===O.I||n===O.G&&t.shiftKey;(r||i)&&this.openEyeDropper({type:r?"stroke":"background"})});onWheel=zt(t=>{!(t.target instanceof HTMLCanvasElement)&&t.ctrlKey&&t.preventDefault()});onKeyUp=zt(t=>{if(t.key===O.SPACE&&(this.state.viewModeEnabled?mt(this.interactiveCanvas,ut.GRAB):this.state.activeTool.type==="selection"?Ii(this.interactiveCanvas):(lo(this.interactiveCanvas,this.state),this.setState({selectedElementIds:rt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),Bs=!1),!t[O.CTRL_OR_CMD]&&!this.state.isBindingEnabled&&this.setState({isBindingEnabled:!0}),Cp(t.key)){let n=this.scene.getSelectedElements(this.state),r=this.scene.getNonDeletedElementsMap();el(this.state)?iE(n,this.scene.getNonDeletedElements(),r):aE(n,r),this.setState({suggestedBindings:[]})}});isToolSupported=t=>this.props.UIOptions.tools?.[t]!==!1;setActiveTool=t=>{if(!this.isToolSupported(t.type)){console.warn(`"${t.type}" tool is disabled via "UIOptions.canvasActions.tools.${t.type}"`);return}let n=nn(this.state,t);P$(document.activeElement)&&this.focusContainer(),J2(n.type)||this.setState({suggestedBindings:[]}),n.type==="image"&&this.onImageAction({insertOnCanvasDirectly:(t.type==="image"&&t.insertOnCanvasDirectly)??!1}),this.setState(r=>{let i={snapLines:r.snapLines.length?[]:r.snapLines,originSnapOffset:null,activeEmbeddable:null},o;return n.type!=="selection"?o={...r,activeTool:n,selectedElementIds:rt({},r),selectedGroupIds:rt({},r),editingGroupId:null,multiElement:null,...i}:o={...r,activeTool:n,...i},n.type==="hand"?mt(this.interactiveCanvas,ut.GRAB):Bs||lo(this.interactiveCanvas,o),o})};setOpenDialog=t=>{this.setState({openDialog:t})};setCursor=t=>{mt(this.interactiveCanvas,t)};resetCursor=()=>{Ii(this.interactiveCanvas)};isTouchScreenMultiTouchGesture=()=>et.pointers.size>=2;getName=()=>this.state.name||this.props.name||`${x("labels.untitled")}-${C5()}`;onGestureStart=zt(t=>{if(t.preventDefault(),this.props.interactive===!1)return!1;this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:rt({},this.state),activeEmbeddable:null}),et.initialScale=this.state.zoom.value});onGestureChange=zt(t=>{if(t.preventDefault(),this.props.interactive===!1)return!1;if(this.isTouchScreenMultiTouchGesture())return;let n=et.initialScale;n&&this.setState(r=>({...ol({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:il(n*t.scale)},r)}))});onGestureEnd=zt(t=>{if(t.preventDefault(),this.props.interactive===!1)return!1;this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:rt(this.state.previousSelectedElementIds,this.state)}),et.initialScale=null});handleTextWysiwyg(t,{isExistingElement:n=!1}){let r=this.scene.getElementsMapIncludingDeleted(),i=(o,a,s)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(l=>l.id===t.id&&he(l)?$F(l,cr(l,r),r,{text:o,isDeleted:s,originalText:a}):l)])};Cj({id:t.id,canvas:this.canvas,getViewportCoords:(o,a)=>{let{x:s,y:l}=Ri({sceneX:o,sceneY:a},this.state);return[s-this.state.offsetLeft,l-this.state.offsetTop]},onChange:zt(o=>{i(o,o,!1),vE(t)&&Wa(t,r)}),onSubmit:zt(({text:o,viaKeyboard:a,originalText:s})=>{let l=!o.trim();if(i(o,s,l),!l&&a){let c=t.containerId?t.containerId:t.id;this.setState(d=>({selectedElementIds:rt({...d.selectedElementIds,[c]:!0},d)}))}l&&gb(this.scene.getNonDeletedElements(),[t]),(!l||n)&&this.history.resumeRecording(),this.setState({draggingElement:null,editingElement:null}),this.state.activeTool.locked&&lo(this.interactiveCanvas,this.state),this.focusContainer()}),element:t,excalidrawContainer:this.excalidrawContainerRef.current,app:this}),this.deselectElements(),i(t.text,t.originalText,!1)}deselectElements(){this.setState({selectedElementIds:rt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(t,n){let r=this.getElementAtPosition(t,n,{includeBoundTextElement:!0});return r&&he(r)&&!r.isDeleted?r:null}getElementAtPosition(t,n,r){let i=this.getElementsAtPosition(t,n,r?.includeBoundTextElement,r?.includeLockedElements);if(i.length>1){if(r?.preferSelected){for(let a=i.length-1;a>-1;a--)if(this.state.selectedElementIds[i[a].id])return i[a]}let o=i[i.length-1];return x2(o,this.state,this.frameNameBoundsCache,t,n,this.scene.getNonDeletedElementsMap())?i[i.length-2]:o}return i.length===1?i[0]:null}getElementsAtPosition(t,n,r=!1,i=!1){let o=r&&i?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(s=>(i||!s.locked)&&(r||!(he(s)&&s.containerId))),a=this.scene.getNonDeletedElementsMap();return K$(o,s=>Sp(s,this.state,this.frameNameBoundsCache,t,n,a)).filter(s=>{let l=Fr(s,a);return l&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?f4({x:t,y:n},l,a):!0})}startTextEditing=({sceneX:t,sceneY:n,insertAtParentCenter:r=!0,container:i})=>{let o=!1,a=r&&this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i);i&&a&&(Ue(i,this.scene.getNonDeletedElementsMap())||(o=!0));let s=null,l=this.scene.getSelectedElements(this.state);l.length===1?he(l[0])?s=l[0]:i?s=Ue(l[0],this.scene.getNonDeletedElementsMap()):s=this.getTextElementAtPosition(t,n):s=this.getTextElementAtPosition(t,n);let c=s?.fontFamily||this.state.currentItemFontFamily,d=s?.lineHeight||gl(c),u=this.state.currentItemFontSize;if(!s&&o&&i&&!yt(i)){let p=pT(xn({fontSize:u,fontFamily:c}),d),f=mT(u,d),g=Math.max(i.height,f),b=Math.max(i.width,p);re(i,{height:g,width:b}),t=i.x+b/2,n=i.y+g/2,a&&(a=this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i))}let h=this.getTopLayerFrameAtSceneCoords({x:t,y:n}),m=s||ri({x:a?a.elementCenterX:t,y:a?a.elementCenterY:n,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:u,fontFamily:c,textAlign:a?"center":this.state.currentItemTextAlign,verticalAlign:a?Nr.MIDDLE:Fp,containerId:o?i?.id:void 0,groupIds:i?.groupIds??[],lineHeight:d,angle:i?.angle??0,frameId:h?h.id:null});if(!s&&o&&i&&re(i,{boundElements:(i.boundElements||[]).concat({type:"text",id:m.id})}),this.setState({editingElement:m}),!s)if(i&&o){let p=this.scene.getElementIndex(i.id);this.scene.insertElementAtIndex(m,p+1)}else this.scene.addNewElement(m);this.setState({editingElement:m}),this.handleTextWysiwyg(m,{isExistingElement:!!s})};handleCanvasDoubleClick=t=>{if(this.state.multiElement||this.state.activeTool.type!=="selection")return;let n=this.scene.getSelectedElements(this.state);if(n.length===1&&Ne(n[0])&&t[O.CTRL_OR_CMD]&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==n[0].id)){this.history.resumeRecording(),this.setState({editingLinearElement:new pe(n[0])});return}Ii(this.interactiveCanvas);let{x:r,y:i}=Ot(t,this.state);if(Tc(this.state).length>0){let o=this.getElementAtPosition(r,i),a=o&&PF(o,this.state.selectedGroupIds);if(a){this.setState(s=>({...s,...Lr({editingGroupId:a,selectedElementIds:{[o.id]:!0}},this.scene.getNonDeletedElements(),s,this)}));return}}if(Ii(this.interactiveCanvas),!t[O.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let o=this.getElementAtPosition(r,i);if(ti(o)){this.setState({activeEmbeddable:{element:o,state:"active"}});return}let a=U5(this.scene.getNonDeletedElements(),this.state,r,i,this.scene.getNonDeletedElementsMap());if(a&&(as(a)||!mo(a.backgroundColor)||Tu(a,this.state,this.frameNameBoundsCache,[r,i],this.scene.getNonDeletedElementsMap()))){let s=T2(a,this.state,this.scene.getNonDeletedElementsMap());r=s.x,i=s.y}this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:a})}};getElementLinkAtPosition=(t,n)=>{let r=this.scene.getNonDeletedElements().slice().reverse(),i=1/0;return r.find((o,a)=>(n&&o.id===n.id&&(i=a),o.link&&a<=i&&_2(o,this.scene.getNonDeletedElementsMap(),this.state,[t.x,t.y],this.device.editor.isMobile)))};redirectToLink=(t,n)=>{let r=un(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY,this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY);if(!this.hitLinkElement||n&&r>Us||!n&&r!==0)return;let i=Ot(this.lastPointerDownEvent,this.state),o=this.scene.getNonDeletedElementsMap(),a=_2(this.hitLinkElement,o,this.state,[i.x,i.y],this.device.editor.isMobile),s=Ot(this.lastPointerUpEvent,this.state),l=_2(this.hitLinkElement,o,this.state,[s.x,s.y],this.device.editor.isMobile);if(a&&l){let c=this.hitLinkElement.link;if(c){c=wo(c);let d;if(this.props.onLinkOpen&&(d=eT("excalidraw-link",t.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:c},d)),!d?.defaultPrevented){let u=bT(c)?"_self":"_blank",h=window.open(void 0,u);h&&(h.opener=null,h.location=c)}}}};getTopLayerFrameAtSceneCoords=t=>{let n=this.scene.getNonDeletedElementsMap(),r=this.scene.getNonDeletedFramesLikes().filter(i=>f4(t,i,n));return r.length?r[r.length-1]:null};handleCanvasPointerMove=t=>{if(this.props.interactive===!1)return!1;this.savePointer(t.clientX,t.clientY,this.state.cursorButton),this.lastPointerMoveEvent=t.nativeEvent,et.pointers.has(t.pointerId)&&et.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY});let n=et.initialScale;if(et.pointers.size===2&&et.lastCenter&&n&&et.initialDistance){let d=rS(et.pointers),u=d.x-et.lastCenter.x,h=d.y-et.lastCenter.y;et.lastCenter=d;let m=iS(Array.from(et.pointers.values())),p=this.state.activeTool.type==="freedraw"&&this.state.penMode?1:m/et.initialDistance,f=p?il(n*p):this.state.zoom.value;this.setState(g=>{let b=ol({viewportX:d.x,viewportY:d.y,nextZoom:f},g);this.translateCanvas({zoom:b.zoom,scrollX:b.scrollX+u/f,scrollY:b.scrollY+h/f,shouldCacheIgnoreZoom:!0})}),this.resetShouldCacheIgnoreZoomDebounced()}else et.lastCenter=et.initialDistance=et.initialScale=null;if(Bs||nu||e2||Hc(this.state))return;let r=lS(t2,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop).isOverEither;!this.state.draggingElement&&!this.state.multiElement&&(r?Ii(this.interactiveCanvas):lo(this.interactiveCanvas,this.state));let i=Ot(t,this.state),{x:o,y:a}=i;if(!this.state.draggingElement&&sj(this.state.activeTool.type)){let{originOffset:d,snapLines:u}=aj(this.scene.getNonDeletedElements(),this.state,{x:o,y:a},t,this.scene.getNonDeletedElementsMap());this.setState(h=>{let m=E2(h.snapLines,u),p=h.originSnapOffset?E2(h.originSnapOffset,d):d;return h.snapLines===m&&h.originSnapOffset===p?null:{snapLines:m,originSnapOffset:p}})}else this.state.draggingElement||this.setState(d=>d.snapLines.length?{snapLines:[]}:null);if(this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging){let d=pe.handlePointerMove(t,o,a,this.state,this.scene.getNonDeletedElementsMap());d&&d!==this.state.editingLinearElement&&(0,H2.flushSync)(()=>{this.setState({editingLinearElement:d})}),d?.lastUncommittedPoint!=null?this.maybeSuggestBindingAtCursor(i):(0,H2.flushSync)(()=>{this.setState({suggestedBindings:[]})})}if(_5(this.state.activeTool.type)){let{draggingElement:d}=this.state;Xn(d,!1)?this.maybeSuggestBindingsForLinearElementAtCoords(d,[i],this.state.startBoundElement):this.maybeSuggestBindingAtCursor(i)}if(this.state.multiElement){let{multiElement:d}=this.state,{x:u,y:h}=d,{points:m,lastCommittedPoint:p}=d,f=m[m.length-1];if(lo(this.interactiveCanvas,this.state),f===p)un(o-u,a-h,f[0],f[1])>=vp?re(d,{points:[...m,[o-u,a-h]]}):mt(this.interactiveCanvas,ut.POINTER);else if(m.length>2&&p&&un(o-u,a-h,p[0],p[1])<vp)mt(this.interactiveCanvas,ut.POINTER),re(d,{points:m.slice(0,-1)});else{let[g,b]=Fn(o,a,t[O.CTRL_OR_CMD]?null:this.state.gridSize),[v,y]=d?.lastCommittedPoint??[0,0],w=g-u-v,T=b-h-y;Cu(t)&&({width:w,height:T}=yE(v+u,y+h,g,b)),ss(m,this.state.zoom.value)&&mt(this.interactiveCanvas,ut.POINTER),re(d,{points:[...m.slice(0,-1),[v+w,y+T]]})}return}if(t.buttons||this.state.activeTool.type!=="selection"&&this.state.activeTool.type!=="text"&&this.state.activeTool.type!=="eraser")return;let s=this.scene.getNonDeletedElements(),l=this.scene.getSelectedElements(this.state);if(l.length===1&&!r&&!this.state.editingLinearElement){let d=x4(s,this.state,o,a,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap());if(d&&d.transformHandleType){mt(this.interactiveCanvas,S4(d));return}}else if(l.length>1&&!r){let d=w4(Nt(l),o,a,this.state.zoom,t.pointerType);if(d){mt(this.interactiveCanvas,S4({transformHandleType:d}));return}}let c=this.getElementAtPosition(i.x,i.y);this.hitLinkElement=this.getElementLinkAtPosition(i,c),!uo(this.state)&&(this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?(mt(this.interactiveCanvas,ut.POINTER),LH(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap())):(RH(),c&&(c.link||sr(c))&&this.state.selectedElementIds[c.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:"info"}):this.state.activeTool.type==="text"?mt(this.interactiveCanvas,he(c)?ut.TEXT:ut.CROSSHAIR):this.state.viewModeEnabled?mt(this.interactiveCanvas,ut.GRAB):r?mt(this.interactiveCanvas,ut.AUTO):this.state.selectedLinearElement?this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,o,a):t[O.CTRL_OR_CMD]?mt(this.interactiveCanvas,ut.AUTO):(c||this.isHittingCommonBoundingBoxOfSelectedElements(i,l))&&!c?.locked&&(c&&ti(c)&&this.isIframeLikeElementCenter(c,t,o,a)?(mt(this.interactiveCanvas,ut.POINTER),this.setState({activeEmbeddable:{element:c,state:"hover"}})):(mt(this.interactiveCanvas,ut.MOVE),this.state.activeEmbeddable?.state==="hover"&&this.setState({activeEmbeddable:null})))))};handleEraser=(t,n,r)=>{this.eraserTrail.addPointToPath(r.x,r.y);let i=!1,o=new Set,a=this.scene.getNonDeletedElements(),s=h=>{for(let m of h){if(m.locked)return;if(t.altKey?this.elementsPendingErasure.delete(m.id)&&(i=!0):this.elementsPendingErasure.has(m.id)||(i=!0,this.elementsPendingErasure.add(m.id)),i&&m.groupIds?.length){let p=m.groupIds.at(-1);if(!o.has(p)){o.add(p);let f=hn(a,p);for(let g of f)t.altKey?this.elementsPendingErasure.delete(g.id):this.elementsPendingErasure.add(g.id)}}}},l=un(n.lastCoords.x,n.lastCoords.y,r.x,r.y),c=10/this.state.zoom.value,d={...n.lastCoords},u=0;for(;u<=l;){let h=this.getElementsAtPosition(d.x,d.y);if(s(h),u===l)break;u=Math.min(u+c,l);let m=u/l,p=(1-m)*d.x+m*r.x,f=(1-m)*d.y+m*r.y;d.x=p,d.y=f}if(n.lastCoords.x=r.x,n.lastCoords.y=r.y,i){for(let h of this.scene.getNonDeletedElements())pn(h)&&(this.elementsPendingErasure.has(h.id)||this.elementsPendingErasure.has(h.containerId))&&(t.altKey?(this.elementsPendingErasure.delete(h.id),this.elementsPendingErasure.delete(h.containerId)):(this.elementsPendingErasure.add(h.id),this.elementsPendingErasure.add(h.containerId)));this.elementsPendingErasure=new Set(this.elementsPendingErasure),this.onSceneUpdated()}};handleTouchMove=t=>{ru=!0};handleHoverSelectedLinearElement(t,n,r){let i=this.scene.getNonDeletedElementsMap(),o=pe.getElement(t.elementId,i),a=Ue(o,i);if(o)if(this.state.selectedLinearElement){let s=-1,l=null;Tu(o,this.state,this.frameNameBoundsCache,[n,r],i)?(s=pe.getPointIndexUnderCursor(o,i,this.state.zoom,n,r),l=pe.getSegmentMidpointHitCoords(t,{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),s>=0||l?mt(this.interactiveCanvas,ut.POINTER):mt(this.interactiveCanvas,ut.MOVE)):fb([o],this.state)&&x2(o,this.state,this.frameNameBoundsCache,n,r,i)?mt(this.interactiveCanvas,ut.MOVE):a&&Sp(a,this.state,this.frameNameBoundsCache,n,r,this.scene.getNonDeletedElementsMap())&&mt(this.interactiveCanvas,ut.MOVE),this.state.selectedLinearElement.hoverPointIndex!==s&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:s}}),pe.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,l)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:l}})}else mt(this.interactiveCanvas,ut.AUTO)}handleCanvasPointerDown=t=>{if(this.maybeCleanupAfterMissingPointerUp(t.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.updateGestureOnPointerDown(t),t.pointerType==="touch"&&this.state.draggingElement&&this.state.draggingElement.type==="freedraw"){let l=this.state.draggingElement;this.updateScene({...l.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(c=>c.id!==l.id)}:{},appState:{draggingElement:null,editingElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:rt(Object.keys(this.state.selectedElementIds).filter(c=>c!==l.id).reduce((c,d)=>(c[d]=this.state.selectedElementIds[d],c),{}),this.state)}});return}let n=document.getSelection();if(n?.anchorNode&&n.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(t),!this.state.penDetected&&t.pointerType==="pen"&&this.setState(l=>({penMode:!0,penDetected:!0})),!this.device.isTouchScreen&&["pen","touch"].includes(t.pointerType)&&(this.device=xp(this.device,{isTouchScreen:!0})),nu||(this.lastPointerDownEvent=t,this.props.interactive!==!1&&this.handleCanvasPanUsingWheelOrSpaceDrag(t)))return;if(this.setState({lastPointerDownWith:t.pointerType,cursorButton:"down"}),this.savePointer(t.clientX,t.clientY,"down"),t.button===zs.ERASER&&this.state.activeTool.type!==_n.eraser){this.setState({activeTool:nn(this.state,{type:_n.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(t);let l=()=>{c(),d?.(),uo(this.state)&&this.setState({activeTool:nn(this.state,{...this.state.activeTool.lastActiveTool||{type:_n.selection},lastActiveToolBeforeEraser:null})})},c=en(window,"pointerup",l,{once:!0}),d;requestAnimationFrame(()=>{d=this.missingPointerEventCleanupEmitter.once(l)})});return}if(t.button!==zs.MAIN&&t.button!==zs.TOUCH&&t.button!==zs.ERASER||et.pointers.size>1)return;let r=this.initialPointerDownState(t);if(this.setState({selectedElementsAreBeingDragged:!1}),this.props.interactive!==!1&&this.handleDraggingScrollBar(t,r)||(this.clearSelectionIfNotUsingSelection(),this.updateBindingEnabledOnPointerMove(t),this.props.interactive!==!1&&this.handleSelectionOnPointerDown(t,r))||!(!this.state.penMode||t.pointerType!=="touch"||this.state.activeTool.type==="selection"||this.state.activeTool.type==="text"||this.state.activeTool.type==="image"))return;if(this.state.activeTool.type==="text"){this.handleTextOnPointerDown(t,r);return}else if(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")this.handleLinearElementOnPointerDown(t,this.state.activeTool.type,r);else if(this.state.activeTool.type==="image"){mt(this.interactiveCanvas,ut.CROSSHAIR);let l=this.state.pendingImageElementId&&this.scene.getElement(this.state.pendingImageElementId);if(!l)return;this.setState({draggingElement:l,editingElement:l,pendingImageElementId:null,multiElement:null});let{x:c,y:d}=Ot(t,this.state),u=this.getTopLayerFrameAtSceneCoords({x:c,y:d});re(l,{x:c,y:d,frameId:u?u.id:null})}else this.state.activeTool.type==="freedraw"?this.handleFreeDrawElementOnPointerDown(t,this.state.activeTool.type,r):this.state.activeTool.type==="custom"?lo(this.interactiveCanvas,this.state):this.state.activeTool.type===_n.frame||this.state.activeTool.type===_n.magicframe?this.createFrameElementOnPointerDown(r,this.state.activeTool.type):this.state.activeTool.type==="laser"?this.laserTrails.startPath(r.lastCoords.x,r.lastCoords.y):this.state.activeTool.type!=="eraser"&&this.state.activeTool.type!=="hand"&&this.createGenericElementOnPointerDown(this.state.activeTool.type,r);this.props?.onPointerDown?.(this.state.activeTool,r),this.onPointerDownEmitter.trigger(this.state.activeTool,r,t),this.state.activeTool.type==="eraser"&&this.eraserTrail.startPath(r.lastCoords.x,r.lastCoords.y);let i=this.onPointerMoveFromPointerDownHandler(r),o=this.onPointerUpFromPointerDownHandler(r),a=this.onKeyDownFromPointerDownHandler(r),s=this.onKeyUpFromPointerDownHandler(r);this.missingPointerEventCleanupEmitter.once(l=>o(l||t.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type==="laser")&&(window.addEventListener("pointermove",i),window.addEventListener("pointerup",o),window.addEventListener("keydown",a),window.addEventListener("keyup",s),r.eventListeners.onMove=i,r.eventListeners.onUp=o,r.eventListeners.onKeyUp=s,r.eventListeners.onKeyDown=a)};handleCanvasPointerUp=t=>{this.removePointer(t),this.lastPointerUpEvent=t;let n=Ot({clientX:t.clientX,clientY:t.clientY},this.state),r=t.timeStamp-(this.lastPointerDownEvent?.timeStamp??0);if(this.device.editor.isMobile&&r<300){let i=this.getElementAtPosition(n.x,n.y);if(ti(i)&&this.isIframeLikeElementCenter(i,t,n.x,n.y)){this.handleEmbeddableCenterClick(i);return}}if(this.device.isTouchScreen){let i=this.getElementAtPosition(n.x,n.y);this.hitLinkElement=this.getElementLinkAtPosition(n,i)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?r<300&&ti(this.hitLinkElement)&&!h4(this.hitLinkElement,this.scene.getNonDeletedElementsMap(),this.state,[n.x,n.y])?this.handleEmbeddableCenterClick(this.hitLinkElement):this.redirectToLink(t,this.device.isTouchScreen):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})};maybeOpenContextMenuAfterPointerDownOnTouchDevices=t=>{t.pointerType==="touch"&&(ru=!1,Na?ru=!0:Na=window.setTimeout(()=>{Na=0,ru||this.handleCanvasContextMenu(t)},f$))};resetContextMenuTimer=()=>{clearTimeout(Na),Na=0,ru=!1};maybeCleanupAfterMissingPointerUp=t=>{iu?.(),this.missingPointerEventCleanupEmitter.trigger(t).clear()};handleCanvasPanUsingWheelOrSpaceDrag=t=>{if(!(et.pointers.size<=1&&(t.button===zs.WHEEL||t.button===zs.MAIN&&Bs||Hc(this.state)||this.state.viewModeEnabled))||he(this.state.editingElement))return!1;nu=!0,t.preventDefault();let n=!1,r=typeof window===void 0?!1:/Linux/.test(window.navigator.platform);mt(this.interactiveCanvas,ut.GRABBING);let{clientX:i,clientY:o}=t,a=B2(l=>{let c=i-l.clientX,d=o-l.clientY;if(i=l.clientX,o=l.clientY,r&&!n&&(Math.abs(c)>1||Math.abs(d)>1)){n=!0;let u=m=>{document.body.removeEventListener("paste",u),m.stopPropagation()},h=()=>{setTimeout(()=>{document.body.removeEventListener("paste",u),window.removeEventListener("pointerup",h)},100)};document.body.addEventListener("paste",u),window.addEventListener("pointerup",h)}this.translateCanvas({scrollX:this.state.scrollX-c/this.state.zoom.value,scrollY:this.state.scrollY-d/this.state.zoom.value})}),s=zt(iu=()=>{iu=null,nu=!1,Bs||(this.state.viewModeEnabled?mt(this.interactiveCanvas,ut.GRAB):lo(this.interactiveCanvas,this.state)),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",s),window.removeEventListener("blur",s),a.flush()});return window.addEventListener("blur",s),window.addEventListener("pointermove",a,{passive:!0}),window.addEventListener("pointerup",s),!0};updateGestureOnPointerDown(t){et.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),et.pointers.size===2&&(et.lastCenter=rS(et.pointers),et.initialScale=this.state.zoom.value,et.initialDistance=iS(Array.from(et.pointers.values())))}initialPointerDownState(t){let n=Ot(t,this.state),r=this.scene.getSelectedElements(this.state),[i,o,a,s]=Nt(r);return{origin:n,withCmdOrCtrl:t[O.CTRL_OR_CMD],originInGrid:Ka(Fn(n.x,n.y,t[O.CTRL_OR_CMD]?null:this.state.gridSize)),scrollbars:lS(t2,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop),lastCoords:{...n},originalElements:this.scene.getNonDeletedElements().reduce((l,c)=>(l.set(c.id,Vu(c)),l),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:"origin",center:{x:(a+i)/2,y:(s+o)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(n,r)},drag:{hasOccurred:!1,offset:null},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1}}}handleDraggingScrollBar(t,n){if(!(n.scrollbars.isOverEither&&!this.state.multiElement))return!1;e2=!0,n.lastCoords.x=t.clientX,n.lastCoords.y=t.clientY;let r=B2(o=>{o.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(o,n)}),i=zt(()=>{iu=null,e2=!1,lo(this.interactiveCanvas,this.state),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",i),r.flush()});return iu=i,window.addEventListener("pointermove",r),window.addEventListener("pointerup",i),!0}clearSelectionIfNotUsingSelection=()=>{this.state.activeTool.type!=="selection"&&this.setState({selectedElementIds:rt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})};handleSelectionOnPointerDown=(t,n)=>{if(this.state.activeTool.type==="selection"){let r=this.scene.getNonDeletedElements(),i=this.scene.getNonDeletedElementsMap(),o=this.scene.getSelectedElements(this.state);if(o.length===1&&!this.state.editingLinearElement){let a=x4(r,this.state,n.origin.x,n.origin.y,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap());a!=null&&(this.setState({resizingElement:a.element}),n.resize.handleType=a.transformHandleType)}else o.length>1&&(n.resize.handleType=w4(Nt(o),n.origin.x,n.origin.y,this.state.zoom,t.pointerType));if(n.resize.handleType)n.resize.isResizing=!0,n.resize.offset=Ka(PB(n.resize.handleType,o,i,n.origin.x,n.origin.y)),o.length===1&&Ne(o[0])&&o[0].points.length===2&&(n.resize.arrowDirection=DB(n.resize.handleType,o[0]));else{if(this.state.selectedLinearElement){let l=this.state.editingLinearElement||this.state.selectedLinearElement,c=pe.handlePointerDown(t,this.state,this.history,n.origin,l,this.scene.getNonDeletedElements(),i);if(c.hitElement&&(n.hit.element=c.hitElement),c.linearElementEditor&&(this.setState({selectedLinearElement:c.linearElementEditor}),this.state.editingLinearElement&&this.setState({editingLinearElement:c.linearElementEditor})),c.didAddPoint)return!0}if(n.hit.element=n.hit.element??this.getElementAtPosition(n.origin.x,n.origin.y),n.hit.element&&this.getElementLinkAtPosition({x:n.origin.x,y:n.origin.y},n.hit.element))return!1;n.hit.allHitElements=this.getElementsAtPosition(n.origin.x,n.origin.y);let a=n.hit.element,s=n.hit.allHitElements.some(l=>this.isASelectedElement(l));if((a===null||!s)&&!t.shiftKey&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&this.clearSelection(a),this.state.editingLinearElement)this.setState({selectedElementIds:rt({[this.state.editingLinearElement.elementId]:!0},this.state)});else if(a!=null){if(t[O.CTRL_OR_CMD])return this.state.selectedElementIds[a.id]||(n.hit.wasAddedToSelection=!0),this.setState(l=>({..._F(l,a),previousSelectedElementIds:this.state.selectedElementIds})),!1;this.state.selectedElementIds[a.id]||(this.state.editingGroupId&&!Uu(a,this.state.editingGroupId)&&this.setState({selectedElementIds:rt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!s&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(l=>{let c={...l.selectedElementIds,[a.id]:!0},d=[];if(Object.keys(l.selectedElementIds).forEach(u=>{let h=this.scene.getElement(u);h&&d.push(h)}),ke(a))na(d,a.id).forEach(u=>{delete c[u.id]});else if(a.frameId)c[a.frameId]&&delete c[a.id];else{let u=a.groupIds,h=new Set(u.flatMap(m=>hn(this.scene.getNonDeletedElements(),m)).filter(m=>ke(m)).map(m=>m.id));h.size>0&&d.forEach(m=>{m.frameId&&h.has(m.frameId)&&(delete c[m.id],m.groupIds.flatMap(p=>hn(this.scene.getNonDeletedElements(),p)).forEach(p=>{delete c[p.id]}))})}return{...Lr({editingGroupId:l.editingGroupId,selectedElementIds:c},this.scene.getNonDeletedElements(),l,this),showHyperlinkPopup:a.link||sr(a)?"info":!1}}),n.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1};isASelectedElement(t){return t!=null&&this.state.selectedElementIds[t.id]}isHittingCommonBoundingBoxOfSelectedElements(t,n){if(n.length<2)return!1;let r=10/this.state.zoom.value,[i,o,a,s]=Nt(n);return t.x>i-r&&t.x<a+r&&t.y>o-r&&t.y<s+r}handleTextOnPointerDown=(t,n)=>{if(he(this.state.editingElement))return;let r=n.origin.x,i=n.origin.y,o=this.getElementAtPosition(r,i,{includeBoundTextElement:!0}),a=U5(this.scene.getNonDeletedElements(),this.state,r,i,this.scene.getNonDeletedElementsMap());as(o)&&(a=o,r=o.x+o.width/2,i=o.y+o.height/2),this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:a}),Ii(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:nn(this.state,{type:"selection"})})};handleFreeDrawElementOnPointerDown=(t,n,r)=>{let[i,o]=Fn(r.origin.x,r.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:i,y:o}),s=FF({type:n,x:i,y:o,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:t.pressure===.5,locked:!1,frameId:a?a.id:null});this.setState(d=>{let u={...d.selectedElementIds};return delete u[s.id],{selectedElementIds:rt(u,d)}});let l=s.simulatePressure?s.pressures:[...s.pressures,t.pressure];re(s,{points:[[0,0]],pressures:l});let c=qa(r.origin,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());this.scene.addNewElement(s),this.setState({draggingElement:s,editingElement:s,startBoundElement:c,suggestedBindings:[]})};insertIframeElement=({sceneX:t,sceneY:n,width:r,height:i})=>{let[o,a]=Fn(t,n,this.lastPointerDownEvent?.[O.CTRL_OR_CMD]?null:this.state.gridSize),s=NF({type:"iframe",x:o,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:r,height:i});return this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),s]),s};insertEmbeddableElement=({sceneX:t,sceneY:n,link:r})=>{let[i,o]=Fn(t,n,this.lastPointerDownEvent?.[O.CTRL_OR_CMD]?null:this.state.gridSize),a=Cc(r);if(!a)return;a.error instanceof URIError&&this.setToast({message:x("toast.unrecognizedLinkFormat"),closable:!0});let s=K5({type:"embeddable",x:i,y:o,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:r});return this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),s]),s};createImageElement=({sceneX:t,sceneY:n,addToFrameUnderCursor:r=!0})=>{let[i,o]=Fn(t,n,this.lastPointerDownEvent?.[O.CTRL_OR_CMD]?null:this.state.gridSize),a=r?this.getTopLayerFrameAtSceneCoords({x:i,y:o}):null;return xT({type:"image",x:i,y:o,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})};handleLinearElementOnPointerDown=(t,n,r)=>{if(this.state.multiElement){let{multiElement:i}=this.state;if(i.type==="line"&&ss(i.points,this.state.zoom.value)){re(i,{lastCommittedPoint:i.points[i.points.length-1]}),this.actionManager.executeAction(Ci);return}let{x:o,y:a,lastCommittedPoint:s}=i;if(i.points.length>1&&s&&un(r.origin.x-o,r.origin.y-a,s[0],s[1])<vp){this.actionManager.executeAction(Ci);return}this.setState(l=>({selectedElementIds:rt({...l.selectedElementIds,[i.id]:!0},l)})),re(i,{lastCommittedPoint:i.points[i.points.length-1]}),mt(this.interactiveCanvas,ut.POINTER)}else{let[i,o]=Fn(r.origin.x,r.origin.y,t[O.CTRL_OR_CMD]?null:this.state.gridSize),a=this.getTopLayerFrameAtSceneCoords({x:i,y:o}),{currentItemStartArrowhead:s,currentItemEndArrowhead:l}=this.state,[c,d]=n==="arrow"?[s,l]:[null,null],u=Ua({type:n,x:i,y:o,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:Pn.PROPORTIONAL_RADIUS}:null,startArrowhead:c,endArrowhead:d,locked:!1,frameId:a?a.id:null});this.setState(m=>{let p={...m.selectedElementIds};return delete p[u.id],{selectedElementIds:rt(p,m)}}),re(u,{points:[...u.points,[0,0]]});let h=qa(r.origin,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());this.scene.addNewElement(u),this.setState({draggingElement:u,editingElement:u,startBoundElement:h,suggestedBindings:[]})}};getCurrentItemRoundness(t){return this.state.currentItemRoundness==="round"?{type:Lc(t)?Pn.ADAPTIVE_RADIUS:Pn.PROPORTIONAL_RADIUS}:null}createGenericElementOnPointerDown=(t,n)=>{let[r,i]=Fn(n.origin.x,n.origin.y,this.lastPointerDownEvent?.[O.CTRL_OR_CMD]?null:this.state.gridSize),o=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),a={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.getCurrentItemRoundness(t),locked:!1,frameId:o?o.id:null},s;t==="embeddable"?s=K5({type:"embeddable",...a}):s=rs({type:t,...a}),s.type==="selection"?this.setState({selectionElement:s,draggingElement:s}):(this.scene.addNewElement(s),this.setState({multiElement:null,draggingElement:s,editingElement:s}))};createFrameElementOnPointerDown=(t,n)=>{let[r,i]=Fn(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[O.CTRL_OR_CMD]?null:this.state.gridSize),o={x:r,y:i,opacity:this.state.currentItemOpacity,locked:!1,...Zt},a=n===_n.magicframe?lE(o):vT(o);this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted(),a]),this.setState({multiElement:null,draggingElement:a,editingElement:a})};maybeCacheReferenceSnapPoints(t,n,r=!1){Fa({event:t,appState:this.state,selectedElements:n})&&(r||!ea.getReferenceSnapPoints())&&ea.setReferenceSnapPoints(nj(this.scene.getNonDeletedElements(),n,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(t,n,r=!1){Fa({event:t,appState:this.state,selectedElements:n})&&(r||!ea.getVisibleGaps())&&ea.setVisibleGaps(tj(this.scene.getNonDeletedElements(),n,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(t){return zt(n=>{this.maybeHandleResize(t,n)||this.maybeDragNewGenericElement(t,n)})}onKeyUpFromPointerDownHandler(t){return zt(n=>{n.key===O.ALT&&n.preventDefault(),!this.maybeHandleResize(t,n)&&this.maybeDragNewGenericElement(t,n)})}onPointerMoveFromPointerDownHandler(t){return B2(n=>{if(t.drag.offset===null&&(t.drag.offset=Ka(OB(this.scene.getSelectedElements(this.state),t.origin.x,t.origin.y))),!(n.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(n,t))return;let r=Ot(n,this.state);if(uo(this.state)){this.handleEraser(n,t,r);return}this.state.activeTool.type==="laser"&&this.laserTrails.addPointToPath(r.x,r.y);let[i,o]=Fn(r.x,r.y,n[O.CTRL_OR_CMD]?null:this.state.gridSize);if(!t.drag.hasOccurred&&(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")&&un(r.x,r.y,t.origin.x,t.origin.y)<Us)return;if(t.resize.isResizing&&(t.lastCoords.x=r.x,t.lastCoords.y=r.y,this.maybeHandleResize(t,n)))return!0;let a=this.scene.getNonDeletedElementsMap();if(this.state.selectedLinearElement){let d=this.state.editingLinearElement||this.state.selectedLinearElement;if(pe.shouldAddMidpoint(this.state.selectedLinearElement,r,this.state,a)){let u=pe.addMidpoint(this.state.selectedLinearElement,r,this.state,!n[O.CTRL_OR_CMD],a);if(!u)return;(0,H2.flushSync)(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,pointerDownState:u.pointerDownState,selectedPointsIndices:u.selectedPointsIndices}}),this.state.editingLinearElement&&this.setState({editingLinearElement:{...this.state.editingLinearElement,pointerDownState:u.pointerDownState,selectedPointsIndices:u.selectedPointsIndices}})});return}else if(d.pointerDownState.segmentMidpoint.value!==null&&!d.pointerDownState.segmentMidpoint.added)return;if(pe.handlePointDragging(n,this.state,r.x,r.y,(u,h)=>{this.maybeSuggestBindingsForLinearElementAtCoords(u,h)},d,this.scene.getNonDeletedElementsMap())){t.lastCoords.x=r.x,t.lastCoords.y=r.y,t.drag.hasOccurred=!0,this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging&&this.setState({editingLinearElement:{...this.state.editingLinearElement,isDragging:!0}}),this.state.selectedLinearElement.isDragging||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0}});return}}let s=t.hit.allHitElements.some(d=>this.isASelectedElement(d)),l=this.state.editingLinearElement&&n.shiftKey&&this.state.editingLinearElement.elementId===t.hit.element?.id;if((s||t.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!l){let d=this.scene.getSelectedElements(this.state);if(d.every(m=>m.locked))return;let u=d.find(m=>ke(m)),h=this.getTopLayerFrameAtSceneCoords(r);if(this.setState({frameToHighlight:h&&!u?h:null}),t.drag.hasOccurred=!0,this.setState({selectedElementsAreBeingDragged:!0}),d.length>0&&!t.withCmdOrCtrl&&!this.state.editingElement&&this.state.activeEmbeddable?.state!=="active"){let m={x:r.x-t.origin.x,y:r.y-t.origin.y},p=[...t.originalElements.values()],f=n.shiftKey;if(f){let v=Math.abs(m.x),y=Math.abs(m.y),w=f&&v<y,T=f&&v>y;w&&(m.x=0),T&&(m.y=0)}this.maybeCacheVisibleGaps(n,d),this.maybeCacheReferenceSnapPoints(n,d);let{snapOffset:g,snapLines:b}=rj(p,m,this.state,n,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:b}),!this.state.editingFrame&&RB(t,d,m,this.state,this.scene,g,n[O.CTRL_OR_CMD]?null:this.state.gridSize),this.maybeSuggestBindingForAll(d),n.altKey&&!t.hit.hasBeenDuplicated){t.hit.hasBeenDuplicated=!0;let v=[],y=[],w=new Map,T=new Map,k=t.hit.element,M=new Set(this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).map(R=>R.id)),C=this.scene.getElementsIncludingDeleted();for(let R of C)if(M.has(R.id)||R.id===k?.id&&t.hit.wasAddedToSelection){let A=wT(this.state.editingGroupId,w,R),_=t.originalElements.get(R.id);re(A,{x:_.x,y:_.y}),t.originalElements.set(A.id,A),v.push(A),y.push(R),T.set(R.id,A.id)}else v.push(R);let P=[...v,...y];uT(v,y,T),lT(P,y,T,"duplicatesServeAsOld"),HT(P,y,T),this.scene.replaceAllElements(P),this.maybeCacheVisibleGaps(n,d,!0),this.maybeCacheReferenceSnapPoints(n,d,!0)}return}}let c=this.state.draggingElement;if(c){if(c.type==="freedraw"){let d=c.points,u=r.x-c.x,h=r.y-c.y,m=d.length>0&&d[d.length-1];if(!(m&&m[0]===u&&m[1]===h)){let p=c.simulatePressure?c.pressures:[...c.pressures,n.pressure];re(c,{points:[...d,[u,h]],pressures:p})}}else if(Ne(c)){t.drag.hasOccurred=!0,this.setState({selectedElementsAreBeingDragged:!0});let d=c.points,u=i-c.x,h=o-c.y;Cu(n)&&d.length===2&&({width:u,height:h}=yE(c.x,c.y,r.x,r.y)),d.length===1?re(c,{points:[...d,[u,h]]}):d.length===2&&re(c,{points:[...d.slice(0,-1),[u,h]]}),Xn(c,!1)&&this.maybeSuggestBindingsForLinearElementAtCoords(c,[r],this.state.startBoundElement)}else t.lastCoords.x=r.x,t.lastCoords.y=r.y,this.maybeDragNewGenericElement(t,n);if(this.state.activeTool.type==="selection"){t.boxSelection.hasOccurred=!0;let d=this.scene.getNonDeletedElements();if(this.state.editingLinearElement)pe.handleBoxSelection(n,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let u=!0;!n.shiftKey&&mn(d,this.state)&&(t.withCmdOrCtrl&&t.hit.element?this.setState(m=>Lr({...m,selectedElementIds:{[t.hit.element.id]:!0}},this.scene.getNonDeletedElements(),m,this)):u=!1);let h=xE(d,c,this.scene.getNonDeletedElementsMap());this.setState(m=>{let p={...u&&m.selectedElementIds,...h.reduce((f,g)=>(f[g.id]=!0,f),{})};return t.hit.element&&(h.length?delete p[t.hit.element.id]:p[t.hit.element.id]=!0),m=u?m:{...m,selectedGroupIds:{},editingGroupId:null},{...Lr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:h.length===1&&Ne(h[0])?new pe(h[0]):null,showHyperlinkPopup:h.length===1&&(h[0].link||sr(h[0]))?"info":!1}})}}}})}handlePointerMoveOverScrollbars(t,n){if(n.scrollbars.isOverHorizontal){let r=t.clientX,i=r-n.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-i/this.state.zoom.value}),n.lastCoords.x=r,!0}if(n.scrollbars.isOverVertical){let r=t.clientY,i=r-n.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-i/this.state.zoom.value}),n.lastCoords.y=r,!0}return!1}onPointerUpFromPointerDownHandler(t){return zt(n=>{this.removePointer(n),t.eventListeners.onMove&&t.eventListeners.onMove.flush();let{draggingElement:r,resizingElement:i,multiElement:o,activeTool:a,isResizing:s,isRotating:l}=this.state;this.setState(m=>({isResizing:!1,isRotating:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:"up",editingElement:o||he(this.state.editingElement)?this.state.editingElement:null,snapLines:E2(m.snapLines,[]),originSnapOffset:null})),ea.setReferenceSnapPoints(null),ea.setVisibleGaps(null),this.savePointer(n.clientX,n.clientY,"up"),this.setState({selectedElementsAreBeingDragged:!1}),this.onPointerUpEmitter.trigger(this.state.activeTool,t,n);let c=this.scene.getNonDeletedElementsMap();if(this.state.editingLinearElement)if(!t.boxSelection.hasOccurred&&t.hit?.element?.id!==this.state.editingLinearElement.elementId)this.actionManager.executeAction(Ci);else{let m=pe.handlePointerUp(n,this.state.editingLinearElement,this.state,this.scene.getNonDeletedElements(),c);m!==this.state.editingLinearElement&&this.setState({editingLinearElement:m,suggestedBindings:[]})}else if(this.state.selectedLinearElement)if(t.hit?.element?.id!==this.state.selectedLinearElement.elementId)this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null});else{let m=pe.handlePointerUp(n,this.state.selectedLinearElement,this.state,this.scene.getNonDeletedElements(),c),{startBindingElement:p,endBindingElement:f}=m,g=this.scene.getElement(m.elementId);Xn(g)&&Sc(g,p,f,c),m!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...m,selectedPointsIndices:null},suggestedBindings:[]})}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener("pointermove",t.eventListeners.onMove),window.removeEventListener("pointerup",t.eventListeners.onUp),window.removeEventListener("keydown",t.eventListeners.onKeyDown),window.removeEventListener("keyup",t.eventListeners.onKeyUp),this.state.pendingImageElementId&&this.setState({pendingImageElementId:null}),this.props?.onPointerUp?.(a,t),this.onPointerUpEmitter.trigger(this.state.activeTool,t,n),r?.type==="freedraw"){let m=Ot(n,this.state),p=r.points,f=m.x-r.x,g=m.y-r.y;f===p[0][0]&&g===p[0][1]&&(g+=1e-4,f+=1e-4);let b=r.simulatePressure?[]:[...r.pressures,n.pressure];re(r,{points:[...p,[f,g]],pressures:b,lastCommittedPoint:[f,g]}),this.actionManager.executeAction(Ci);return}if(dl(r)){let m=r;try{this.initializeImageDimensions(m),this.setState({selectedElementIds:rt({[m.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ci)})}catch(p){console.error(p),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(f=>f.id!==m.id)),this.actionManager.executeAction(Ci)}return}if(Ne(r)){r.points.length>1&&this.history.resumeRecording();let m=Ot(n,this.state);!t.drag.hasOccurred&&r&&!o?(re(r,{points:[...r.points,[m.x-r.x,m.y-r.y]]}),this.setState({multiElement:r,editingElement:this.state.draggingElement})):t.drag.hasOccurred&&!o&&(el(this.state)&&Xn(r,!1)&&oE(r,this.state,this.scene,m,c),this.setState({suggestedBindings:[],startBoundElement:null}),a.locked?this.setState(p=>({draggingElement:null})):(Ii(this.interactiveCanvas),this.setState(p=>({draggingElement:null,activeTool:nn(this.state,{type:"selection"}),selectedElementIds:rt({...p.selectedElementIds,[r.id]:!0},p),selectedLinearElement:new pe(r)}))));return}if(a.type!=="selection"&&r&&jc(r)){this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(m=>m.id!==r.id)),this.setState({draggingElement:null});return}if(r){if(t.drag.hasOccurred){let m=Ot(n,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){let p=this.scene.getElement(this.state.selectedLinearElement.elementId);if(p?.frameId){let f=Fr(p,c);f&&p&&(Ks(p,f,this.scene.getNonDeletedElementsMap())||(re(p,{groupIds:[]}),Dp([p],this.scene.getNonDeletedElementsMap()),this.scene.informMutation()))}}else{let p=this.getTopLayerFrameAtSceneCoords(m),f=this.scene.getSelectedElements(this.state),g=this.scene.getElementsMapIncludingDeleted(),b=v=>{if(v.length>0){for(let y of v){let w=y.groupIds.indexOf(this.state.editingGroupId);re(y,{groupIds:y.groupIds.slice(0,w)},!1)}g.forEach(y=>{y.groupIds.length&&hn(g,y.groupIds[y.groupIds.length-1]).length<2&&re(y,{groupIds:[]},!1)}),this.setState({editingGroupId:null})}};if(p&&!this.state.selectedElementIds[p.id]){let v=f.filter(y=>y.frameId!==p.id&&Xu(y,g,this.state));this.state.editingGroupId&&b(v),g=Pp(g,v,p)}else if(!p&&this.state.editingGroupId){let v=f.filter(y=>y.frameId&&!Xu(y,g,this.state));b(v)}g=Gc(g,this.state,this),this.scene.replaceAllElements(g)}}if(ke(r)){let m=SB(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(Pp(this.scene.getElementsMapIncludingDeleted(),m,r))}re(r,jT(r))}if(i&&this.history.resumeRecording(),i&&jc(i)&&this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(m=>m.id!==i.id)),t.resize.isResizing){let m=Gc(this.scene.getElementsIncludingDeleted(),this.state,this),p=this.scene.getSelectedElements(this.state).filter(f=>ke(f));for(let f of p)m=GT(m,_p(this.scene.getElementsIncludingDeleted(),f,this.state,c),f,this);this.scene.replaceAllElements(m)}let d=t.hit.element;this.state.selectedLinearElement?.elementId!==d?.id&&Ne(d)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new pe(d)});let u=this.lastPointerDownEvent,h=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(uo(this.state)&&u&&h){if(this.eraserTrail.endPath(),un(u.clientX,u.clientY,h.clientX,h.clientY)===0){let m=Ot({clientX:h.clientX,clientY:h.clientY},this.state);this.getElementsAtPosition(m.x,m.y).forEach(p=>this.elementsPendingErasure.add(p.id))}this.eraseElements();return}else this.elementsPendingErasure.size&&this.restoreReadyToEraseElements();if(d&&!t.drag.hasOccurred&&!t.hit.wasAddedToSelection&&(!this.state.editingLinearElement||!t.boxSelection.hasOccurred)&&(n.shiftKey&&!this.state.editingLinearElement?this.state.selectedElementIds[d.id]?gT(this.state,d)?this.setState(m=>{let p={...m.selectedElementIds};for(let f of d.groupIds.flatMap(g=>hn(this.scene.getNonDeletedElements(),g)))delete p[f.id];return{selectedGroupIds:{...m.selectedElementIds,...d.groupIds.map(f=>({[f]:!1})).reduce((f,g)=>({...f,...g}),{})},selectedElementIds:rt(p,m)}}):this.state.selectedLinearElement?.isDragging||this.setState(m=>{let p={...m.selectedElementIds};delete p[d.id];let f=st(this.scene.getNonDeletedElements(),{selectedElementIds:p});return{...Lr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:f.length===1&&Ne(f[0])?new pe(f[0]):m.selectedLinearElement}}):d.frameId&&this.state.selectedElementIds[d.frameId]?this.setState(m=>{let p={...m.selectedElementIds,[d.id]:!0};return delete p[d.frameId],(this.scene.getElement(d.frameId)?.groupIds??[]).flatMap(f=>hn(this.scene.getNonDeletedElements(),f)).forEach(f=>{delete p[f.id]}),{...Lr({editingGroupId:m.editingGroupId,selectedElementIds:p},this.scene.getNonDeletedElements(),m,this),showHyperlinkPopup:d.link||sr(d)?"info":!1}}):this.setState(m=>({selectedElementIds:rt({...m.selectedElementIds,[d.id]:!0},m)})):this.setState(m=>({...Lr({editingGroupId:m.editingGroupId,selectedElementIds:{[d.id]:!0}},this.scene.getNonDeletedElements(),m,this),selectedLinearElement:Ne(d)&&m.selectedLinearElement?.elementId!==d.id?new pe(d):m.selectedLinearElement}))),!t.drag.hasOccurred&&!this.state.isResizing&&(d&&x2(d,this.state,this.frameNameBoundsCache,t.origin.x,t.origin.y,this.scene.getNonDeletedElementsMap())||!d&&t.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.editingLinearElement?this.setState({editingLinearElement:null}):this.setState({selectedElementIds:rt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null});return}if(!a.locked&&a.type!=="freedraw"&&r&&r.type!=="selection"&&this.setState(m=>({selectedElementIds:rt({...m.selectedElementIds,[r.id]:!0},m),showHyperlinkPopup:sr(r)&&!r.link?"editor":m.showHyperlinkPopup})),(a.type!=="selection"||mn(this.scene.getNonDeletedElements(),this.state))&&this.history.resumeRecording(),(t.drag.hasOccurred||s||l)&&(el(this.state)?iE(this.scene.getSelectedElements(this.state),this.scene.getNonDeletedElements(),c):aE(this.scene.getSelectedElements(this.state),c)),a.type==="laser"){this.laserTrails.endPath();return}!a.locked&&a.type!=="freedraw"?(Ii(this.interactiveCanvas),this.setState({draggingElement:null,suggestedBindings:[],activeTool:nn(this.state,{type:"selection"})})):this.setState({draggingElement:null,suggestedBindings:[]}),d&&this.lastPointerUpEvent&&this.lastPointerDownEvent&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<300&&et.pointers.size<=1&&ti(d)&&this.isIframeLikeElementCenter(d,this.lastPointerUpEvent,t.origin.x,t.origin.y)&&this.handleEmbeddableCenterClick(d)})}restoreReadyToEraseElements=()=>{this.elementsPendingErasure=new Set,this.onSceneUpdated()};eraseElements=()=>{let t=!1,n=this.scene.getElementsIncludingDeleted().map(r=>this.elementsPendingErasure.has(r.id)||r.frameId&&this.elementsPendingErasure.has(r.frameId)||pn(r)&&this.elementsPendingErasure.has(r.containerId)?(t=!0,Le(r,{isDeleted:!0})):r);this.elementsPendingErasure=new Set,t&&(this.history.resumeRecording(),this.scene.replaceAllElements(n))};initializeImage=async({imageFile:t,imageElement:n,showCursorImagePreview:r=!1})=>{if(!Xs(t))throw new Error(x("errors.unsupportedFileType"));let i=t.type;if(mt(this.interactiveCanvas,"wait"),i===ve.svg)try{t=a4(await rB(await t.text()),t.name)}catch(l){throw console.warn(l),new Error(x("errors.svgImageInsertError"))}let o=await(this.props.generateIdForFile?.(t)||KF(t));if(!o)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),new Error(x("errors.imageInsertError"));if(!this.files[o]?.dataURL){try{t=await dE(t,{maxWidthOrHeight:S$})}catch(l){console.error("Error trying to resizing image file on insertion",l)}if(t.size>S5)throw new Error(x("errors.fileTooBig",{maxSize:`${Math.trunc(S5/1024/1024)}MB`}))}if(r){let l=this.files[o]?.dataURL,c=l&&qF(l);this.setImagePreviewCursor(c||t)}let a=this.files[o]?.dataURL||await A2(t),s=re(n,{fileId:o},!1);return new Promise(async(l,c)=>{try{this.files={...this.files,[o]:{mimeType:i,id:o,dataURL:a,created:Date.now(),lastRetrieved:Date.now()}};let d=this.imageCache.get(o);d||(this.addNewImagesToImageCache(),await this.updateImageCache([s])),d?.image instanceof Promise&&await d.image,this.state.pendingImageElementId!==s.id&&this.state.draggingElement?.id!==s.id&&this.initializeImageDimensions(s,!0),l(s)}catch(d){console.error(d),c(new Error(x("errors.imageInsertError")))}finally{r||Ii(this.interactiveCanvas)}})};insertImageElement=async(t,n,r)=>{if(!this.isToolSupported("image")){this.setState({errorMessage:x("errors.imageToolNotSupported")});return}this.scene.addNewElement(t);try{return await this.initializeImage({imageFile:n,imageElement:t,showCursorImagePreview:r})}catch(i){return re(t,{isDeleted:!0}),this.actionManager.executeAction(Ci),this.setState({errorMessage:i.message||x("errors.imageInsertError")}),null}};setImagePreviewCursor=async t=>{let n;try{n=await dE(t,{maxWidthOrHeight:96})}catch(i){throw i.cause==="UNSUPPORTED"?new Error(x("errors.unsupportedFileType")):i}let r=await A2(n);if(t.type===ve.svg){let i=await d4(r),o=Math.min(i.height,96),a=o*(i.width/i.height);a>96&&(a=96,o=a*(i.height/i.width));let s=document.createElement("canvas");s.height=o,s.width=a,s.getContext("2d").drawImage(i,0,0,a,o),r=s.toDataURL(ve.svg)}this.state.pendingImageElementId&&mt(this.interactiveCanvas,`url(${r}) 4 4, auto`)};onImageAction=async({insertOnCanvasDirectly:t})=>{try{let n=this.state.width/2+this.state.offsetLeft,r=this.state.height/2+this.state.offsetTop,{x:i,y:o}=Ot({clientX:n,clientY:r},this.state),a=await bb({description:"Image",extensions:Object.keys(Y2)}),s=this.createImageElement({sceneX:i,sceneY:o,addToFrameUnderCursor:!1});t?(this.insertImageElement(s,a),this.initializeImageDimensions(s),this.setState({selectedElementIds:rt({[s.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ci)})):this.setState({pendingImageElementId:s.id},()=>{this.insertImageElement(s,a,!0)})}catch(n){n.name!=="AbortError"?console.error(n):console.warn(n),this.setState({pendingImageElementId:null,editingElement:null,activeTool:nn(this.state,{type:"selection"})},()=>{this.actionManager.executeAction(Ci)})}};initializeImageDimensions=(t,n=!1)=>{let r=Eo(t)&&this.imageCache.get(t.fileId)?.image;if(!r||r instanceof Promise){if(t.width<Us/this.state.zoom.value&&t.height<Us/this.state.zoom.value){let i=100/this.state.zoom.value;re(t,{x:t.x-i/2,y:t.y-i/2,width:i,height:i})}return}if(n||t.width<Us/this.state.zoom.value&&t.height<Us/this.state.zoom.value){let i=Math.max(this.state.height-120,160),o=Math.min(i,Math.floor(this.state.height*.5)/this.state.zoom.value),a=Math.min(r.naturalHeight,o),s=a*(r.naturalWidth/r.naturalHeight),l=t.x+t.width/2-s/2,c=t.y+t.height/2-a/2;re(t,{x:l,y:c,width:s,height:a})}};updateImageCache=async(t,n=this.files)=>{let{updatedFiles:r,erroredFiles:i}=await IT({imageCache:this.imageCache,fileIds:t.map(o=>o.fileId),files:n});if(r.size||i.size)for(let o of t)r.has(o.fileId)&&jt.delete(o);return i.size&&this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(o=>Eo(o)&&i.has(o.fileId)?Le(o,{status:"error"}):o)),{updatedFiles:r,erroredFiles:i}};addNewImagesToImageCache=async(t=kT(this.scene.getNonDeletedElements()),n=this.files)=>{let r=t.filter(i=>!i.isDeleted&&!this.imageCache.has(i.fileId));if(r.length){let{updatedFiles:i}=await this.updateImageCache(r,n);i.size&&this.scene.informMutation()}};scheduleImageRefresh=(0,Mj.default)(()=>{this.addNewImagesToImageCache()},m$);updateBindingEnabledOnPointerMove=t=>{let n=gF(t);this.state.isBindingEnabled!==n&&this.setState({isBindingEnabled:n})};maybeSuggestBindingAtCursor=t=>{let n=qa(t,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());this.setState({suggestedBindings:n!=null?[n]:[]})};maybeSuggestBindingsForLinearElementAtCoords=(t,n,r)=>{if(!n.length)return;let i=n.reduce((o,a)=>{let s=qa(a,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());return s!=null&&!W5(t,r?.id,s)&&o.push(s),o},[]);this.setState({suggestedBindings:i})};maybeSuggestBindingForAll(t){if(t.length>50)return;let n=EF(t,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());this.setState({suggestedBindings:n})}clearSelection(t){this.setState(n=>({selectedElementIds:rt({},n),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:n.editingGroupId&&t!=null&&Uu(t,n.editingGroupId)?n.editingGroupId:null})),this.setState({selectedElementIds:rt({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds})}handleInteractiveCanvasRef=t=>{t!==null?(this.interactiveCanvas=t,this.interactiveCanvas.addEventListener("wheel",this.handleWheel),this.interactiveCanvas.addEventListener("touchstart",this.onTouchStart),this.interactiveCanvas.addEventListener("touchend",this.onTouchEnd)):(this.interactiveCanvas?.removeEventListener("wheel",this.handleWheel),this.interactiveCanvas?.removeEventListener("touchstart",this.onTouchStart),this.interactiveCanvas?.removeEventListener("touchend",this.onTouchEnd))};handleAppOnDrop=async t=>{let{file:n,fileHandle:r}=await JF(t),{x:i,y:o}=Ot(t,this.state);try{if(Xs(n)&&this.isToolSupported("image")){if(n?.type===ve.png||n?.type===ve.svg)try{let l=await MT(n,this.state,this.scene.getElementsIncludingDeleted(),r);this.syncActionResult({...l,appState:{...l.appState||this.state,isLoading:!1},replaceFiles:!0,commitToHistory:!0});return}catch(l){if(l.name!=="EncodingError")throw new Error(x("alerts.couldNotLoadInvalidFile"))}let s=this.createImageElement({sceneX:i,sceneY:o});this.insertImageElement(s,n),this.initializeImageDimensions(s),this.setState({selectedElementIds:rt({[s.id]:!0},this.state)});return}}catch(s){return this.setState({isLoading:!1,errorMessage:s.message})}let a=t.dataTransfer.getData(ve.excalidrawlib);if(a&&typeof a=="string"){try{let s=o4(a);this.addElementsFromPasteOrLibrary({elements:rI(s),position:t,files:null})}catch(s){this.setState({errorMessage:s.message})}return}if(n&&await this.loadFileToCanvas(n,r),t.dataTransfer?.types?.includes("text/plain")){let s=t.dataTransfer?.getData("text");if(s&&kp(s,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(s)||Cc(s)?.type==="video")){let l=this.insertEmbeddableElement({sceneX:i,sceneY:o,link:wo(s)});l&&this.setState({selectedElementIds:{[l.id]:!0}})}}};loadFileToCanvas=async(t,n)=>{t=await uE(t);try{let r;try{r=await i4(t,this.state,this.scene.getElementsIncludingDeleted(),n)}catch(i){let o=i instanceof Vs;if(o&&i.code==="IMAGE_NOT_CONTAINS_SCENE_DATA"&&!this.isToolSupported("image")){this.setState({isLoading:!1,errorMessage:x("errors.imageToolNotSupported")});return}let a=x(o?"alerts.cannotRestoreFromImage":"alerts.couldNotLoadInvalidFile");this.setState({isLoading:!1,errorMessage:a})}if(!r)return;r.type===ve.excalidraw?(this.setState({isLoading:!0}),this.syncActionResult({...r.data,appState:{...r.data.appState||this.state,isLoading:!1},replaceFiles:!0,commitToHistory:!0})):r.type===ve.excalidrawlib&&await this.library.updateLibrary({libraryItems:t,merge:!0,openLibraryMenu:!0}).catch(i=>{console.error(i),this.setState({errorMessage:x("errors.importLibraryError")})})}catch(r){this.setState({isLoading:!1,errorMessage:r.message})}};handleCanvasContextMenu=t=>{if(t.preventDefault(),this.props.interactive===!1||("pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="touch"||"pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="pen"&&t.button!==zs.SECONDARY)&&this.state.activeTool.type!=="selection")return;let{x:n,y:r}=Ot(t,this.state),i=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),o=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:n,y:r},o),s=i||a?"element":"canvas",l=this.excalidrawContainerRef.current,{top:c,left:d}=l.getBoundingClientRect(),u=t.clientX-d,h=t.clientY-c;ot("contextMenu","openContextMenu",s),this.setState({...i&&!this.state.selectedElementIds[i.id]?{...this.state,...Lr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[i.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:Ne(i)?new pe(i):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:h,left:u,items:this.getContextMenuItems(s)}})})};maybeDragNewGenericElement=(t,n)=>{let r=this.state.draggingElement,i=t.lastCoords;if(r)if(r.type==="selection"&&this.state.activeTool.type!=="eraser")C4(r,this.state.activeTool.type,t.origin.x,t.origin.y,i.x,i.y,Zn(t.origin.x,i.x),Zn(t.origin.y,i.y),lu(n),S2(n));else{let[o,a]=Fn(i.x,i.y,n[O.CTRL_OR_CMD]?null:this.state.gridSize),s=Eo(r)&&this.imageCache.get(r.fileId)?.image,l=s&&!(s instanceof Promise)?s.width/s.height:null;this.maybeCacheReferenceSnapPoints(n,[r]);let{snapOffset:c,snapLines:d}=oj(r,this.state,n,{x:t.originInGrid.x+(this.state.originSnapOffset?.x??0),y:t.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:o-t.originInGrid.x,y:a-t.originInGrid.y},this.scene.getNonDeletedElementsMap());o+=c.x,a+=c.y,this.setState({snapLines:d}),C4(r,this.state.activeTool.type,t.originInGrid.x,t.originInGrid.y,o,a,Zn(t.originInGrid.x,o),Zn(t.originInGrid.y,a),dl(r)?!lu(n):lu(n),S2(n),l,this.state.originSnapOffset),this.maybeSuggestBindingForAll([r]),(this.state.activeTool.type===_n.frame||this.state.activeTool.type===_n.magicframe)&&this.setState({elementsToHighlight:_p(this.scene.getNonDeletedElements(),r,this.state,this.scene.getNonDeletedElementsMap())})}};maybeHandleResize=(t,n)=>{let r=this.scene.getSelectedElements(this.state),i=r.filter(d=>ke(d)),o=t.resize.handleType;if(i.length>0&&o==="rotation")return!1;this.setState({isResizing:o&&o!=="rotation",isRotating:o==="rotation",activeEmbeddable:null});let a=t.lastCoords,[s,l]=Fn(a.x-t.resize.offset.x,a.y-t.resize.offset.y,n[O.CTRL_OR_CMD]?null:this.state.gridSize),c=new Map;if(i.forEach(d=>{na(this.scene.getNonDeletedElements(),d.id).forEach(u=>{c.set(d.id+u.id,{x:u.x-d.x,y:u.y-d.y})})}),!this.state.selectedElementsAreBeingDragged){let[d,u]=Fn(a.x,a.y,n[O.CTRL_OR_CMD]?null:this.state.gridSize),h={x:d-t.originInGrid.x,y:u-t.originInGrid.y},m=[...t.originalElements.values()];this.maybeCacheReferenceSnapPoints(n,r);let{snapOffset:p,snapLines:f}=ij(r,st(m,this.state),this.state,n,h,o);s+=p.x,l+=p.y,this.setState({snapLines:f})}if(_B(t.originalElements,o,r,this.scene.getElementsMapIncludingDeleted(),Cu(n),S2(n),r.length===1&&dl(r[0])?!lu(n):lu(n),s,l,t.resize.center.x,t.resize.center.y)){this.maybeSuggestBindingForAll(r);let d=new Set;return i.forEach(u=>{_p(this.scene.getNonDeletedElements(),u,this.state,this.scene.getNonDeletedElementsMap()).forEach(h=>d.add(h))}),this.setState({elementsToHighlight:[...d]}),!0}return!1};getContextMenuItems=t=>{let n=[];return n.push(qE,KE),t==="canvas"?this.state.viewModeEnabled?[...n,JE,gf,OS,th]:[F4,br,qE,KE,QE,br,PM,$H,br,JE,QM,gf,OS,th]:(n.push(QE),this.state.viewModeEnabled?[Du,...n]:[XE,Du,F4,JW,ej,br,...n,br,jM,UM,br,VM,JM,eI,_H,YM,br,XM,br,IM,kM,AM,_M,br,KM,qM,br,fI,qb,DM,tI,br,Bb])};handleWheel=zt(t=>{if(t.preventDefault(),nu||this.props.interactive===!1)return;let{deltaX:n,deltaY:r}=t;if(t.metaKey||t.ctrlKey){let i=Math.sign(r),o=pu*100,a=Math.abs(r),s=r;a>o&&(s=o*i);let l=this.state.zoom.value-s/100;l+=Math.log10(Math.max(1,this.state.zoom.value))*-i*Math.min(1,a/20),this.translateCanvas(c=>({...ol({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:il(l)},c),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(t.shiftKey){this.translateCanvas(({zoom:i,scrollX:o})=>({scrollX:o-(r||n)/i.value}));return}this.translateCanvas(({zoom:i,scrollX:o,scrollY:a})=>({scrollX:o-n/i.value,scrollY:a-r/i.value}))});getTextWysiwygSnappedToCenterPosition(t,n,r,i){if(i){let o=i.x+i.width/2,a=i.y+i.height/2,s=T2(i,r,this.scene.getNonDeletedElementsMap());if(s&&(o=s.x,a=s.y),Math.hypot(t-o,n-a)<c$){let{x:l,y:c}=Ri({sceneX:o,sceneY:a},r);return{viewportX:l,viewportY:c,elementCenterX:o,elementCenterY:a}}}}savePointer=(t,n,r)=>{if(!t||!n)return;let{x:i,y:o}=Ot({clientX:t,clientY:n},this.state);isNaN(i)||isNaN(o);let a={x:i,y:o,tool:this.state.activeTool.type==="laser"?"laser":"pointer"};this.props.onPointerUpdate?.({pointer:a,button:r,pointersMap:et.pointers})};resetShouldCacheIgnoreZoomDebounced=Hp(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300);updateDOMRect=t=>{if(this.excalidrawContainerRef?.current){let n=this.excalidrawContainerRef.current,{width:r,height:i,left:o,top:a}=n.getBoundingClientRect(),{width:s,height:l,offsetTop:c,offsetLeft:d}=this.state;if(r===s&&i===l&&o===d&&a===c){t&&t();return}this.setState({width:r,height:i,offsetLeft:o,offsetTop:a},()=>{t&&t()})}};refresh=()=>{this.setState({...this.getCanvasOffsets()})};getCanvasOffsets(){if(this.excalidrawContainerRef?.current){let t=this.excalidrawContainerRef.current,{left:n,top:r}=t.getBoundingClientRect();return{offsetLeft:n,offsetTop:r}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){let t=W2.find(n=>n.code===this.props.langCode)||yc;await WS(t),this.setAppState({})}},KN=()=>{(Pt.MODE===v5.TEST||Pt.DEV)&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(e)}}}))},KN(),Ij=XN}),bre=I(()=>{}),yre=I(()=>{}),vre=I(()=>{}),qN,Aj,xre=I(()=>{"use strict";D(),qN=()=>{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)})},Aj=qN}),wre=I(()=>{}),f5,Sre,Tre=I(()=>{"use strict";D(),Hi(),wre(),Kn(),f5=({children:e})=>{let{FooterCenterTunnel:t}=dr(),n=Rn();return(0,GS.jsx)(t.In,{children:(0,GS.jsx)("div",{className:Y("footer-center zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})},Sre=f5,f5.displayName="FooterCenter"}),Cre=I(()=>{}),QN,JN,_j,Mre=I(()=>{"use strict";D(),Cre(),QN=()=>(0,Pi.jsx)("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ExcalidrawLogo-icon",children:(0,Pi.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"})}),JN=()=>(0,Pi.jsxs)("svg",{viewBox:"0 0 450 55",xmlns:"http://www.w3.org/2000/svg",fill:"none",className:"ExcalidrawLogo-text",children:[(0,Pi.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,Pi.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,Pi.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,Pi.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)"})]}),_j=({style:e,size:t="small",withText:n})=>(0,Pi.jsxs)("div",{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,Pi.jsx)(QN,{}),n&&(0,Pi.jsx)(JN,{})]})}),r2,ou,g5,Mi,i2,o2,a2,s2,l2,E5,Ire=I(()=>{"use strict";D(),ko(),gh(),ce(),Re(),Hi(),me(),Kn(),Mre(),r2=({icon:e,shortcut:t,children:n})=>{let r=Wn();return(0,kt.jsxs)(kt.Fragment,{children:[(0,kt.jsx)("div",{className:"welcome-screen-menu-item__icon",children:e}),(0,kt.jsx)("div",{className:"welcome-screen-menu-item__text",children:n}),t&&!r.editor.isMobile&&(0,kt.jsx)("div",{className:"welcome-screen-menu-item__shortcut",children:t})]})},r2.displayName="WelcomeScreenMenuItemContent",ou=({onSelect:e,children:t,icon:n,shortcut:r,className:i="",...o})=>(0,kt.jsx)("button",{...o,type:"button",className:`welcome-screen-menu-item ${i}`,onClick:e,children:(0,kt.jsx)(r2,{icon:n,shortcut:r,children:t})}),ou.displayName="WelcomeScreenMenuItem",g5=({children:e,href:t,icon:n,shortcut:r,className:i="",...o})=>(0,kt.jsx)("a",{...o,className:`welcome-screen-menu-item ${i}`,href:t,target:"_blank",rel:"noreferrer",children:(0,kt.jsx)(r2,{icon:n,shortcut:r,children:e})}),g5.displayName="WelcomeScreenMenuItemLink",Mi=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=dr();return(0,kt.jsx)(t.In,{children:(0,kt.jsx)("div",{className:"welcome-screen-center",children:e||(0,kt.jsxs)(kt.Fragment,{children:[(0,kt.jsx)(i2,{}),(0,kt.jsx)(o2,{children:x("welcomeScreen.defaults.center_heading")}),(0,kt.jsxs)(a2,{children:[(0,kt.jsx)(l2,{}),(0,kt.jsx)(s2,{})]})]})})})},Mi.displayName="Center",i2=({children:e})=>(0,kt.jsx)("div",{className:"welcome-screen-center__logo virgil welcome-screen-decor",children:e||(0,kt.jsx)(_j,{withText:!0})}),i2.displayName="Logo",o2=({children:e})=>(0,kt.jsx)("div",{className:"welcome-screen-center__heading welcome-screen-decor virgil",children:e}),o2.displayName="Heading",a2=({children:e})=>(0,kt.jsx)("div",{className:"welcome-screen-menu",children:e}),a2.displayName="Menu",s2=()=>{let e=Or();return(0,kt.jsx)(ou,{onSelect:()=>e.executeAction(Vf),shortcut:"?",icon:zf,children:x("helpDialog.title")})},s2.displayName="MenuItemHelp",l2=()=>{let e=Rn(),t=Or();return e.viewModeEnabled?null:(0,kt.jsx)(ou,{onSelect:()=>t.executeAction(pf),shortcut:wr("loadScene"),icon:Hf,children:x("buttons.load")})},l2.displayName="MenuItemLoadScene",E5=({onSelect:e})=>{let{t}=ir();return(0,kt.jsx)(ou,{shortcut:null,onSelect:e,icon:Pb,children:t("labels.liveCollaboration")})},E5.displayName="MenuItemLiveCollaborationTrigger",Mi.Logo=i2,Mi.Heading=o2,Mi.Menu=a2,Mi.MenuItem=ou,Mi.MenuItemLink=g5,Mi.MenuItemHelp=s2,Mi.MenuItemLoadScene=l2,Mi.MenuItemLiveCollaborationTrigger=E5}),ob,ab,sb,kre=I(()=>{"use strict";D(),ce(),Hi(),me(),ob=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=dr();return(0,ho.jsx)(t.In,{children:(0,ho.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu",children:[qT,(0,ho.jsx)("div",{className:"welcome-screen-decor-hint__label",children:e||x("welcomeScreen.defaults.menuHint")})]})})},ob.displayName="MenuHint",ab=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=dr();return(0,ho.jsx)(t.In,{children:(0,ho.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar",children:[(0,ho.jsx)("div",{className:"welcome-screen-decor-hint__label",children:e||x("welcomeScreen.defaults.toolbarHint")}),JT]})})},ab.displayName="ToolbarHint",sb=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=dr();return(0,ho.jsx)(t.In,{children:(0,ho.jsxs)("div",{className:"virgil welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help",children:[(0,ho.jsx)("div",{children:e||x("welcomeScreen.defaults.helpHint")}),QT]})})},sb.displayName="HelpHint"}),Are=I(()=>{}),ep,_re,Pre=I(()=>{"use strict";D(),Ire(),kre(),Are(),ep=e=>(0,fo.jsx)(fo.Fragment,{children:e.children||(0,fo.jsxs)(fo.Fragment,{children:[(0,fo.jsx)(Mi,{}),(0,fo.jsx)(ob,{}),(0,fo.jsx)(ab,{}),(0,fo.jsx)(sb,{})]})}),ep.displayName="WelcomeScreen",ep.Center=Mi,ep.Hints={MenuHint:ob,ToolbarHint:ab,HelpHint:sb},_re=ep}),Dre=I(()=>{}),b5,Lre,Rre=I(()=>{"use strict";D(),ce(),me(),Zf(),Dre(),Kn(),b5=({isCollaborating:e,onSelect:t,...n})=>{let r=Rn(),i=r.width<830;return(0,Sy.jsxs)(ih,{...n,className:Y("collab-button",{active:e}),type:"button",onSelect:t,style:{position:"relative",width:i?void 0:"auto"},title:x("labels.liveCollaboration"),children:[i?wC:x("labels.share"),r.collaborators.size>0&&(0,Sy.jsx)("div",{className:"CollabButton-collaborators",children:r.collaborators.size})]})},Lre=b5,b5.displayName="LiveCollaborationTrigger"}),e$,Ore=I(()=>{"use strict";D(),Hi(),sy(),Re(),me(),ce(),li(),e$=({children:e,icon:t})=>{let{TTDDialogTriggerTunnel:n}=dr(),r=Dn();return(0,_f.jsx)(n.In,{children:(0,_f.jsxs)(vt.Item,{onSelect:()=>{ot("ai","dialog open","ttd"),r({openDialog:{name:"ttd",tab:"text-to-diagram"}})},icon:t??hM,children:[e??x("labels.textToDiagram"),(0,_f.jsx)(vt.Item.Badge,{children:"AI"})]})})},e$.displayName="TTDDialogTrigger"}),t$,n$,r$,FI=I(()=>{D(),SJ(),Re(),ne(),bre(),yre(),vre(),xre(),ce(),ae(),Ln(),Tre(),IW(),Pre(),Rre(),Pe(),ce(),hh(),mh(),El(),si(),ls(),Ru(),xe(),ae(),wt(),Ru(),ne(),by(),Zf(),Re(),$f(),AW(),ZW(),Ore(),dh(),Yb(),cj(),rn(),yB(),$i(),Ln(),Ru(),me(),ko(),cs(),BG(),Aj(),t$=e=>{let{onChange:t,initialData:n,excalidrawAPI:r,isCollaborating:i=!1,onPointerUpdate:o,renderTopRightUI:a,langCode:s=yc.code,viewModeEnabled:l,zenModeEnabled:c,gridModeEnabled:d,libraryReturnUrl:u,theme:h,name:m,renderCustomStats:p,onPaste:f,detectScroll:g=!0,handleKeyboardGlobally:b=!1,onLibraryChange:v,autoFocus:y=!1,generateIdForFile:w,onLinkOpen:T,onPointerDown:k,onPointerUp:M,onScrollChange:C,id:P,onHomeButtonClick:R,children:A,validateEmbeddable:_,renderEmbeddable:$,aiEnabled:W,ui:H,interactive:K,activeTool:Q}=e,ie=e.UIOptions?.canvasActions,X={...e.UIOptions,canvasActions:{...w5.canvasActions,...ie},tools:{image:e.UIOptions?.tools?.image??!0}};return ie?.export&&(X.canvasActions.export.saveFileToDisk=ie.export?.saveFileToDisk??w5.canvasActions.export.saveFileToDisk),X.canvasActions.toggleTheme===null&&typeof h>"u"&&(X.canvasActions.toggleTheme=!0),(0,Ty.useEffect)(()=>{(async()=>await import("./roundRect-B4P3NWN6.js"))();let F=B=>{typeof B.scale=="number"&&B.scale!==1&&B.preventDefault()};return document.addEventListener("touchmove",F,{passive:!1}),()=>{document.removeEventListener("touchmove",F)}},[]),(0,G2.jsx)($0,{unstable_createStore:()=>xo,scope:Gn,children:(0,G2.jsx)(_$,{langCode:s,theme:h,children:(0,G2.jsx)(Ij,{id:P,onChange:t,initialData:n,excalidrawAPI:r,isCollaborating:i,onPointerUpdate:o,renderTopRightUI:a,langCode:s,viewModeEnabled:K===!1?!0:l,zenModeEnabled:c,gridModeEnabled:d,libraryReturnUrl:u,theme:h,name:m,renderCustomStats:p,UIOptions:X,onPaste:f,detectScroll:g,handleKeyboardGlobally:b,onLibraryChange:v,autoFocus:y,generateIdForFile:w,onLinkOpen:T,onPointerDown:k,onPointerUp:M,onScrollChange:C,validateEmbeddable:_,renderEmbeddable:$,aiEnabled:W!==!1,onHomeButtonClick:R,ui:H,interactive:K,activeTool:Q,children:A})})})},n$=(e,t)=>{if(e.children!==t.children)return!1;let{initialData:n,UIOptions:r={},...i}=e,{initialData:o,UIOptions:a={},...s}=t,l=Object.keys(r),c=Object.keys(a);return l.length!==c.length?!1:l.every(d=>d==="canvasActions"?Object.keys(r.canvasActions).every(u=>u==="export"&&r?.canvasActions?.export&&a?.canvasActions?.export?r.canvasActions.export.saveFileToDisk===a.canvasActions.export.saveFileToDisk:r?.canvasActions?.[u]===a?.canvasActions?.[u]):r[d]===a[d])&&$r(i,s)},r$=Ty.default.memo(t$,n$),r$.displayName="Excalidraw"});FI();var Pye=async({data:e,config:t})=>Ux({data:e,config:t}),Nre=async({data:e,config:t})=>{let{mimeType:n=we.png,quality:r}=t||{};n===we.png&&typeof r=="number"&&console.warn(`"quality" will be ignored for "${we.png}" mimeType`),n==="image/jpg"&&(n=we.jpg),n===we.jpg&&t?.canvasBackgroundColor&&(console.warn(`Defaulting "exportBackground" to "true" for "${we.jpg}" mimeType`),t={...t,canvasBackgroundColor:e.appState?.viewBackgroundColor||bs});let i=await Ux({data:e,config:t});return r=r||(/image\/jpe?g/.test(n)?.92:.8),new Promise((o,a)=>{i.toBlob(async s=>{if(!s)return a(new Error("couldn't export to blob"));s&&n===we.png&&e.appState?.exportEmbedScene&&(s=await Pj({blob:s,metadata:pm(e.elements,e.appState,e.files||{},"local")})),o(s)},n,r)})},$re=async({data:e,config:t})=>{let{elements:n,appState:r}=k0({...e,files:e.files||{}},null,null),i={...r,exportPadding:t?.padding},o=at(n),a=e.files||{};return $_({data:{elements:o,appState:i,files:a},config:{exportingFrame:t?.exportingFrame,renderEmbeddables:t?.renderEmbeddables}})},Dye=async({type:e,data:t,config:n})=>{if(e==="svg"){let r=await $re({data:t,config:n});await Xx(r.outerHTML)}else if(e==="png")await Z_(Nre({data:t,config:n}));else if(e==="json")await V_(t.elements,t.files);else throw new Error("Invalid export type")};S();var Fre=e=>e.type==="diamond"?[[e.width/2,0],[e.width,e.height/2],[e.width/2,e.height],[0,e.height/2]]:[[0,0],[0+e.width,0],[0+e.width,e.height],[0,e.height]],Bre=e=>Tt(e)||kn(e)?e.points:Fre(e),Dj=e=>{let t=e.reduce((n,[r,i])=>(n.minY=Math.min(n.minY,i),n.minX=Math.min(n.minX,r),n.maxX=Math.max(n.maxX,r),n.maxY=Math.max(n.maxY,i),n),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return t.cx=(t.maxX+t.minX)/2,t.cy=(t.maxY+t.minY)/2,t},Rj=e=>{let t=Bre(e),{cx:n,cy:r}=Dj(t),i=[n,r],o=t.map(d=>sn([d[0],d[1]],i,e.angle)),{minX:a,minY:s,maxX:l,maxY:c}=Dj(o);return[a+e.x,s+e.y,l+e.x,c+e.y]},Lj=(e,t,n=!1)=>{let r=Rj(e),i=t[0]<=r[0]&&t[2]>=r[2]&&t[1]<=r[1]&&t[3]>=r[3];return n?i?!0:r[0]<=t[0]&&r[2]>=t[2]&&r[1]<=t[1]&&r[3]>=t[3]:i},zre=(e,t)=>{let n=Rj(e);return(cm(n[0],t[0],t[2])||cm(t[0],n[0],n[2]))&&(cm(n[1],t[1],t[3])||cm(t[1],n[1],n[3]))},Oj=({elements:e,bounds:t,type:n,errorMargin:r=0})=>{Pv(t)&&(t=eo(t,St(e)));let i=[t[0]-r,t[1]-r,t[2]+r,t[3]+r],o=new Set;for(let a of e){if(o.has(a.id))continue;if(n==="overlap"?zre(a,i):n==="inside"?Lj(a,i):Lj(a,i,!0)){if(o.add(a.id),a.boundElements)for(let l of a.boundElements)o.add(l.id);ct(a)&&a.containerId&&o.add(a.containerId),gt(a)&&(a.startBinding&&o.add(a.startBinding.elementId),a.endBinding&&o.add(a.endBinding?.elementId))}}return e.filter(a=>o.has(a.id))};S();function Nj(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function Bj(e,t){return e[0]*t[1]-t[0]*e[1]}function Hre(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Cy(e,t){return[e[0]-t[0],e[1]-t[1]]}var Gre=1e-6;function $j(e,t){let n=Cy(e[1],e[0]),r=Cy(t,e[0]),i=Bj(n,r);return Math.abs(i)<Gre}function BI(e,t){let n=Cy(e[1],e[0]),r=Cy(t,e[0]);return Bj(n,r)<0}function Fj(e,t){return $j(e,t[0])||$j(e,t[1])||(BI(e,t[0])?!BI(e,t[1]):BI(e,t[1]))}function zj(e,t){return Hre(Nj(e),Nj(t))&&Fj(e,t)&&Fj(t,e)}var ove=(e,t,n)=>{let r=St(e);for(let i of t)if(i.frameId){let o=n.get(i.id),a=n.get(i.frameId);if(o){let s=r.get(o);s&&Ie(s,{frameId:a??i.frameId},!1)}}};function Hj(e,t,n){let r=_x(t,n),i=_x(e,n);return r.some(a=>i.some(s=>zj(a,s)))}var Gj=(e,t,n)=>My(X1(e,t,n,!1)).filter(r=>!ht(r)&&!r.frameId||r.frameId===t.id),Wj=(e,t,n,r)=>X1(e,t,r).some(i=>i.id===n.id);var jj=(e,t,n)=>{let[r,i,o,a]=Te(t,n),[s,l,c,d]=kr(e);return r<=s&&i<=l&&o>=c&&a>=d},As=(e,t,n)=>jj([e],t,n)||Hj(e,t,n)||Wj([t],e,t,n),ave=(e,t,n)=>{let[r,i,o,a]=Te(t,n);return ql([r,i],[e.x,e.y],[o,a])};var sve=e=>{let t=new Map;for(let n of e){let r=ht(n)?n.id:n.frameId;r&&!t.has(r)&&t.set(r,qf(e,r))}return t},qf=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n},Vx=e=>e.filter(t=>ht(t)),Yx=e=>{let t=St(Vx(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},lve=(e,t,n,r)=>{let i=qf(e,t.id),o=new Set(i),a=new Set([...Gj(e,t,r),...i.filter(h=>Wj(e,h,t,r))]),s=i.filter(h=>!a.has(h)),l=new Set(Array.from(a).flatMap(h=>h.groupIds));for(let h of s)if(!Hj(h,t,r))h.groupIds.length===0&&o.delete(h);else if(h.groupIds.length>0)for(let m of h.groupIds)l.add(m);for(let h of s)if(h.groupIds.length>0){let m=!0;for(let p of h.groupIds)l.has(p)&&(m=!1);m&&o.delete(h)}let c=Array.from(a).filter(h=>h.groupIds.length===0);for(let h of c)o.add(h);let d=Array.from(a).filter(h=>h.groupIds.length>0),u=QA(d,n);for(let[h,m]of Object.entries(u))if(m){let p=Cd(e,h);if(jj(p,t,r))for(let f of p)o.add(f)}return[...o].filter(h=>!(ct(h)&&h.containerId))},cve=(e,t,n)=>My(e,Gj(e,t,n)),Ar=(e,t)=>e.frameId&&t.get(e.frameId)||null,dve=(e,t)=>{let n=new Set,r=St(e);e=My(e);for(let a of e)ht(a)&&a.id!==t.id&&n.add(a.id);let i=new Set,o=[];for(let a of e)if(!(ht(a)||a.frameId&&n.has(a.frameId)))if(a.groupIds.length){let s=a.groupIds.at(-1);if(!i.has(s)){i.add(s);let l=Cd(e,s);if(l.some(c=>As(c,t,r)))for(let c of l)o.push(c)}}else As(a,t,r)&&o.push(a);return o},Wre=(e,t,n)=>{let r=St(e),i=new Map;for(let l of e.values())l.frameId===n.id&&i.set(l.id,!0);let o=new Set(t.map(l=>l.id)),a=[],s=new Set;for(let l of t)ht(l)&&l.id!==n.id&&s.add(l.id);for(let l of My(e,t)){if(ht(l)||l.frameId&&s.has(l.frameId))continue;i.has(l.id)||a.push(l);let c=dt(l,r);c&&!o.has(c.id)&&!i.has(c.id)&&a.push(c)}for(let l of a)Ie(l,{frameId:n.id},!1);return e},Uj=(e,t)=>{let n=new Map,r=new Map;for(let i of e)if(i.frameId){n.set(i.id,i);let o=r.get(i.frameId)||[];o.push(i);let a=dt(i,t);a&&(n.set(a.id,a),o.push(a)),r.set(i.frameId,o)}for(let[,i]of n)Ie(i,{frameId:null},!1)},jre=(e,t)=>{let n=qf(e,t.id);return Uj(n,St(e)),e},uve=(e,t,n,r)=>Wre(jre(e,n),t,n).slice(),hve=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),i=new Set(r);if(t.editingGroupId)for(let s of r)s.groupIds.length===0?i.add(s):s.groupIds.flatMap(l=>Cd(e,l)).forEach(l=>i.add(l));let o=new Set,a=St(e);return i.forEach(s=>{s.frameId&&!ht(s)&&!_0(s,a,t)&&o.add(s)}),o.size>0&&Uj(o,a),e},My=(e,t)=>{let n=new Set,r=t||e;for(let a of r.values()){let s=a.groupIds[a.groupIds.length-1];s&&n.add(s)}let i=new Set;for(let a of n)Cd(e,a).some(s=>ht(s))&&i.add(a);let o=[];for(let a of r.values())i.has(a.groupIds[a.groupIds.length-1])||o.push(a);return o},A0=(e,t,n)=>{let r=ct(e)&&pr(e,t)||e;return n.selectedElementIds[r.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Ar(r,t)},_0=(e,t,n)=>{let r=A0(e,t,n),i=ct(e)&&pr(e,t)||e;if(r){if(!n.selectedElementIds[e.id]||!n.selectedElementsAreBeingDragged)return!0;if(i.groupIds.length===0)return As(i,r,t);let o=new Set(i.groupIds.flatMap(a=>Cd(t,a)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){let a=new Set(jr(t,n));if(n.frameToHighlight!==null)return!0;a.forEach(l=>{o.delete(l)})}for(let a of o)if(ht(a))return!1;for(let a of o)if(As(a,r,t))return!0}return!1},B_=(e,t)=>e.name===null?Bh(e)?`Frame ${t}`:`AI Frame $${t}`:e.name,z_=(e,t)=>Oj({elements:e,bounds:t,type:"overlap"}).filter(n=>!n.frameId||n.frameId===t.id);var Ure=e=>{let t=new Set;return e.forEach(n=>{ht(n)&&t.add(n.id)}),e.filter(n=>!(n.frameId&&t.has(n.frameId)))},X1=(e,t,n,r=!0)=>{let[i,o,a,s]=Te(t,n),l=e.filter(c=>{let[d,u,h,m]=eo(c,n),p=Ar(c,n);if(p){let[f,g,b,v]=eo(p,n);d=Math.max(f,d),u=Math.max(g,u),h=Math.min(b,h),m=Math.min(v,m)}return c.locked===!1&&c.type!=="selection"&&!pi(c)&&i<=d&&o<=u&&a>=h&&s>=m});return l=r?Ure(l):l,l=l.filter(c=>{let d=Ar(c,n);return d?As(c,d,n):!0}),l},vve=(e,t,n,r)=>{let i=new Set(t.map(o=>o.id));return e.filter(o=>{let a=Vj(o,n.width,n.height,n,r);return!i.has(o.id)&&a})},eZ=function(){let e=null,t=null,n=null,r=(i,o)=>(n!=null&&i===e&&o.selectedElementIds===t||(n=i.some(a=>o.selectedElementIds[a.id]),e=i,t=o.selectedElementIds),n);return r.clearCache=()=>{e=null,t=null,n=null},r}(),tZ=(e,t,n)=>{let r=Array.from(new Set(jr(e,t).map(i=>n(i))));return r.length===1?r[0]:null},jr=(e,t,n)=>{let r=[];for(let i of e.values()){if(t.selectedElementIds[i.id]){r.push(i);continue}if(n?.includeBoundTextElement&&pi(i)&&t.selectedElementIds[i?.containerId]){r.push(i);continue}}if(n?.includeElementsInFrames){let i=[];return r.forEach(o=>{ht(o)&&qf(e,o.id).forEach(a=>i.push(a)),i.push(o)}),i}return r},nZ=(e,t)=>t.editingElement?[t.editingElement]:jr(e,t,{includeBoundTextElement:!0}),Dx=(e,t)=>Av(t.selectedElementIds,e)?t.selectedElementIds:e;var Yj=e=>{let t=new Map,n=[];for(let r of e)r.isDeleted||(n.push(r),t.set(r.id,r));return{elementsMap:t,elements:n}},Vre=e=>{let t=["includeBoundTextElement","includeElementsInFrames"],n="";for(let r of t)n+=`${r}:${e[r]?"1":"0"}`;return n},Zj=e=>typeof e=="string",zI=class e{static sceneMapByElement=new WeakMap;static sceneMapById=new Map;static mapElementToScene(t,n){Zj(t)?this.sceneMapById.set(t,n):(this.sceneMapByElement.set(t,n),this.sceneMapById.set(t.id,n))}static getScene(t){return Zj(t)?this.sceneMapById.get(t)||null:this.sceneMapByElement.get(t)||null}callbacks=new Set;nonDeletedElements=[];nonDeletedElementsMap=Hl(new Map);elements=[];nonDeletedFramesLikes=[];frames=[];elementsMap=Hl(new Map);selectedElementsCache={selectedElementIds:null,elements:null,cache:new Map};versionNonce;getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}getSelectedElements(t){let n=Vre(t),r=t?.elements||this.nonDeletedElements;if(this.selectedElementsCache.elements===r&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){let o=this.selectedElementsCache.cache.get(n);if(o)return o}else t?.elements==null&&this.selectedElementsCache.cache.clear();let i=jr(r,{selectedElementIds:t.selectedElementIds},t);return t?.elements==null&&(this.selectedElementsCache.selectedElementIds=t.selectedElementIds,this.selectedElementsCache.elements=this.nonDeletedElements,this.selectedElementsCache.cache.set(n,i)),i}getNonDeletedFramesLikes(){return this.nonDeletedFramesLikes}getElement(t){return this.elementsMap.get(t)||null}getVersionNonce(){return this.versionNonce}getNonDeletedElement(t){let n=this.getElement(t);return n&&Xj(n)?n:null}mapElements(t){let n=!1,r=this.elements.map(i=>{let o=t(i);return o!==i&&(n=!0),o});return n&&this.replaceAllElements(r),n}replaceAllElements(t){this.elements=t instanceof Array?t:Array.from(t.values());let n=[];this.elementsMap.clear(),this.elements.forEach(i=>{ht(i)&&n.push(i),this.elementsMap.set(i.id,i),e.mapElementToScene(i,this)});let r=Yj(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=n,this.nonDeletedFramesLikes=Yj(this.frames).elements,this.informMutation()}informMutation(){this.versionNonce=Go();for(let t of Array.from(this.callbacks))t()}addCallback(t){if(this.callbacks.has(t))throw new Error;return this.callbacks.add(t),()=>{if(!this.callbacks.has(t))throw new Error;this.callbacks.delete(t)}}destroy(){this.nonDeletedElements=[],this.elements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),e.sceneMapById.forEach((t,n)=>{t===this&&e.sceneMapById.delete(n)}),this.callbacks.clear()}insertElementAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),t,...this.elements.slice(n)];this.replaceAllElements(r)}insertElementsAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");let r=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];this.replaceAllElements(r)}addNewElement=t=>{t.frameId?this.insertElementAtIndex(t,this.getElementIndex(t.frameId)):this.replaceAllElements([...this.elements,t])};getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}getContainerElement=t=>t&&t.containerId&&this.getElement(t.containerId)||null},Qi=zI;var Ie=(e,t,n=!0)=>{let r=!1,{points:i,fileId:o}=t;typeof i<"u"&&(t={...YA(i),...t});for(let a in t){let s=t[a];if(typeof s<"u"){if(e[a]===s&&(typeof s!="object"||s===null||a==="groupIds"||a==="scale"))continue;if(a==="scale"){let l=e[a],c=s;if(l[0]===c[0]&&l[1]===c[1])continue}else if(a==="points"){let l=e[a],c=s;if(l.length===c.length){let d=!1,u=l.length;for(;--u;){let h=l[u],m=c[u];if(h[0]!==m[0]||h[1]!==m[1]){d=!0;break}}if(!d)continue}}e[a]=s,r=!0}}return r&&((typeof t.height<"u"||typeof t.width<"u"||typeof o<"u"||typeof i<"u")&&Lt.delete(e),e.version++,e.versionNonce=Go(),e.updated=Ea(),n&&Qi.getScene(e)?.informMutation()),e},Jl=(e,t)=>{let n=!1;for(let r in t){let i=t[r];if(typeof i<"u"){if(e[r]===i&&(typeof i!="object"||i===null))continue;n=!0}}return n?{...e,...t,updated:Ea(),version:e.version+1,versionNonce:Go()}:e},um=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=Go(),e.updated=Ea(),e);var fm=e=>Tt(e)||kn(e)?e.points.length<2:e.width===0&&e.height===0,Vj=(e,t,n,r,i)=>{let[o,a,s,l]=eo(e,i),c=Fh({clientX:r.offsetLeft,clientY:r.offsetTop},r),d=Fh({clientX:r.offsetLeft+t,clientY:r.offsetTop+n},r);return c.x<=s&&c.y<=l&&d.x>=o&&d.y>=a},Iy=(e,t,n)=>{let r=Math.abs(t),i=Math.abs(n);if(e==="line"||e==="arrow"||e==="freedraw"){let o=Math.round(Math.atan(i/r)/No)*No;o===0?n=0:o===Math.PI/2?t=0:n=r*Math.tan(o)*Math.sign(n)||n}else e!=="selection"&&(n=r*Math.sign(n));return{width:t,height:n}},gx=(e,t,n,r)=>{let i=n-e,o=r-t,a=Math.round(Math.atan(o/i)/No)*No;if(a===0)o=0;else if(a===Math.PI/2)i=0;else{let s=Math.tan(a),l=-1,c=t-s*e,d=-1/s,u=-1,h=r-d*n,m=(l*h-u*c)/(s*u-d*l),p=(c*d-h*s)/(s*u-d*l);i=m-e,o=p-t}return{width:i,height:o}};var Hx=e=>{let t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){let n=Math.abs(e.width);t.width=n,t.x=e.x-n}if(e.height<0){let n=Math.abs(e.height);t.height=n,t.y=e.y-n}return t};S();var GI=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],Kj=(e,t,n,r,i,o,a)=>{if(!n.selectedElementIds[e.id])return!1;let{rotation:s,...l}=tx(e,o,t,a);if(s&&GI(s,r,i))return"rotation";let c=Object.keys(l).filter(d=>{let u=l[d];return u?GI(u,r,i):!1});return c.length>0?c[0]:!1},Yre=(e,t,n,r,i,o,a)=>e.reduce((s,l)=>{if(s)return s;let c=Kj(l,a,t,n,r,i,o);return c?{element:l,transformHandleType:c}:null},null),Zre=([e,t,n,r],i,o,a,s)=>{let l=r0([e,t,n,r,(e+n)/2,(t+r)/2],0,a,s,ex);return Object.keys(l).find(d=>{let u=l[d];return u&&GI(u,i,o)})||!1},HI=["ns","nesw","ew","nwse"],Xre=(e,t)=>{let n=HI.indexOf(e);if(n>=0){let r=Math.round(t/(Math.PI/4));e=HI[(n+r)%HI.length]}return e},Kre=e=>{let{element:t,transformHandleType:n}=e,r=t&&Math.sign(t.height)*Math.sign(t.width)===-1,i=null;switch(n){case"n":case"s":i="ns";break;case"w":case"e":i="ew";break;case"nw":case"se":r?i="nesw":i="nwse";break;case"ne":case"sw":r?i="nwse":i="nesw";break;case"rotation":return"grab"}return i&&t&&(i=Xre(i,t.angle)),i?`${i}-resize`:""};S();var ky=e=>e<0?e+2*Math.PI:e>=2*Math.PI?e-2*Math.PI:e,qre=(e,t,n,r,i,o,a,s,l,c,d)=>{if(n.length===1){let[u]=n;return t==="rotation"?(Qre(u,r,s,l,i),Is(u,r)):ct(u)&&(t==="nw"||t==="ne"||t==="sw"||t==="se")?(tie(u,r,t,o,s,l),Is(u,r)):t&&nie(e,a,u,r,t,o,s,l),!0}else if(n.length>1){if(t==="rotation")return iie(e,n,r,s,l,i,c,d),!0;if(t==="nw"||t==="ne"||t==="sw"||t==="se")return rie(e,n,r,t,o,s,l),!0}return!1},Qre=(e,t,n,r,i)=>{let[o,a,s,l]=Te(e,t),c=(o+s)/2,d=(a+l)/2,u;ht(e)?u=0:(u=5*Math.PI/2+Math.atan2(r-d,n-c),i&&(u+=No/2,u-=u%No),u=ky(u));let h=Xl(e);if(Ie(e,{angle:u}),h){let m=Qi.getScene(e)?.getElement(h);m&&!gt(e)&&Ie(m,{angle:u})}},Jre=(e,t,n,r)=>Tt(e)||kn(e)?{points:ks(0,t,ks(1,n,e.points,r),r)}:{},WI=(e,t,n)=>{let r=e.width;if(pi(e)){let a=pr(e,t);a&&(r=Ji(a,e))}let o=e.fontSize*(n/r);return o<g1?null:{size:o}},eie=(e,t)=>({n:/^(n|ne|nw)$/.test(e)||t&&/^(s|se|sw)$/.test(e),s:/^(s|se|sw)$/.test(e)||t&&/^(n|ne|nw)$/.test(e),w:/^(w|nw|sw)$/.test(e)||t&&/^(e|ne|se)$/.test(e),e:/^(e|ne|se)$/.test(e)||t&&/^(w|nw|sw)$/.test(e)}),tie=(e,t,n,r,i,o)=>{let[a,s,l,c]=Te(e,t),d=(a+l)/2,u=(s+c)/2,[h,m]=De(i,o,d,u,-e.angle),p;switch(n){case"se":p=Math.max((h-a)/(l-a),(m-s)/(c-s));break;case"nw":p=Math.max((l-h)/(l-a),(c-m)/(c-s));break;case"ne":p=Math.max((h-a)/(l-a),(c-m)/(c-s));break;case"sw":p=Math.max((l-h)/(l-a),(m-s)/(c-s));break}if(p>0){let f=e.width*p,g=e.height*p,b=WI(e,t,f);if(b===null)return;let[v,y,w,T]=Kl(e,f,g,!1),k=(a-v)/2,M=(s-y)/2,C=(l-w)/2,P=(c-T)/2,[R,A]=g0(eie(n,r),e.x,e.y,e.angle,k,M,C,P);Ie(e,{fontSize:b.size,width:f,height:g,x:R,y:A})}},nie=(e,t,n,r,i,o,a,s)=>{let l=e.get(n.id),[c,d,u,h]=Kl(l,l.width,l.height,!0),m=[c,d],p=[u,h],f=tm(m,p),g=sn([a,s],f,-l.angle),[b,v,y,w]=Kl(n,n.width,n.height,!0),T=y-b,k=w-v,M=p[0]-m[0],C=p[1]-m[1],P=M/T,R=C/k,A={},_=dt(n,r);i.includes("e")&&(P=(g[0]-m[0])/T),i.includes("s")&&(R=(g[1]-m[1])/k),i.includes("w")&&(P=(p[0]-g[0])/T),i.includes("n")&&(R=(p[1]-g[1])/k);let $=l.width,W=l.height,H=n.width*P,K=n.height*R;if(o&&(H=2*H-$,K=2*K-W),t){let lt=Math.abs(H)/$,fn=Math.abs(K)/W;if(i.length===1&&(K*=lt,H*=fn),i.length===2){let on=Math.max(lt,fn);H=$*on*Math.sign(H),K=W*on*Math.sign(K)}}if(_){let lt=e.get(_.id);if(lt&&(A={fontSize:lt.fontSize}),t){let fn={...n,width:H,height:K},on=WI(_,r,Ji(fn,_));if(on===null)return;A={fontSize:on.size}}else{let fn=LA(In(_),_.lineHeight),on=_A(_.fontSize,_.lineHeight);H=Math.max(H,fn),K=Math.max(K,on)}}let[Q,ie,X,F]=Kl(l,H,K,!0),B=X-Q,U=F-ie,G=[...m];if(["n","w","nw"].includes(i)&&(G=[p[0]-Math.abs(B),p[1]-Math.abs(U)]),i==="ne"){let lt=[m[0],p[1]];G=[lt[0],lt[1]-Math.abs(U)]}if(i==="sw"){let lt=[p[0],m[1]];G=[lt[0]-Math.abs(B),lt[1]]}t&&(["s","n"].includes(i)&&(G[0]=f[0]-B/2),["e","w"].includes(i)&&(G[1]=f[1]-U/2));let Z=H<0,ee=K<0;Z&&(i.includes("e")&&(G[0]-=Math.abs(B)),i.includes("w")&&(G[0]+=Math.abs(B))),ee&&(i.includes("s")&&(G[1]-=Math.abs(U)),i.includes("n")&&(G[1]+=Math.abs(U))),o&&(G[0]=f[0]-Math.abs(B)/2,G[1]=f[1]-Math.abs(U)/2);let te=l.angle,de=sn(G,f,te),qe=[G[0]+Math.abs(B)/2,G[1]+Math.abs(U)/2],Ye=sn(qe,f,te);G=sn(de,Ye,-te);let Me=[...G],Be=l.x-Q,Oe=l.y-ie;Me[0]+=Be,Me[1]+=Oe;let us=Me[0],yh=Me[1],Pl,Dl;(Tt(n)||kn(n))&&(Pl=ks(1,K,l.points,!0),Dl=ks(0,H,Pl,!0));let Sn={width:Math.abs(H),height:Math.abs(K),x:us,y:yh,points:Dl};if("scale"in n&&"scale"in l&&Ie(n,{scale:[(Math.sign(X-l.x)||l.scale[0])*l.scale[0],(Math.sign(F-l.y)||l.scale[1])*l.scale[1]]}),gt(n)&&_&&t){let lt=Sn.width/n.width*_.fontSize;if(lt<g1)return;A.fontSize=lt}Sn.width!==0&&Sn.height!==0&&Number.isFinite(Sn.x)&&Number.isFinite(Sn.y)&&(Ie(n,Sn),Is(n,r,{newSize:{width:Sn.width,height:Sn.height}}),_&&A!=null&&Ie(_,{fontSize:A.fontSize}),Yl(n,r,i,t))},rie=(e,t,n,r,i,o,a)=>{let s=t.reduce((A,_)=>{let $=e.get(_.id);return $&&A.push({orig:$,latest:_}),A},[]),l=s.reduce((A,{orig:_})=>{if(!Tt(_))return A;let $=Xl(_);if(!$)return A;let W=e.get($)??null;if(!pi(W))return A;let H=Et.getBoundTextElementPosition(_,W,n);return[...A,{...W,...H}]},[]),{minX:c,minY:d,maxX:u,maxY:h,midX:m,midY:p}=KA(s.map(({orig:A})=>A).concat(l)),f=r,g={ne:[c,h],se:[c,d],sw:[u,d],nw:[u,h]},[b,v]=i?[m,p]:g[f],y=Math.max(Math.abs(o-b)/(u-c)||0,Math.abs(a-v)/(h-d)||0)*(i?2:1);if(y===0)return;let w={ne:[o>=b,a<=v],se:[o>=b,a>=v],sw:[o<=b,a>=v],nw:[o<=b,a<=v]},[T,k]=w[f].map(A=>A?1:-1),M=T<0,C=k<0,P=[];for(let{orig:A,latest:_}of s){if(ct(A)&&pi(A))continue;let $=A.width*y,W=A.height*y,H=ky(A.angle*T*k),K=Tt(A)||kn(A),Q=A.x-b,ie=A.y-v,X=M&&!K?$:0,F=C&&!K?W:0,B=b+T*(Q*y+X),U=v+k*(ie*y+F),G=Jre(A,$*T,W*k,!1),Z={x:B,y:U,width:$,height:W,angle:H,...G};if(k1(A)&&s.length===1&&(Z.scale=[A.scale[0]*T,A.scale[1]*k]),Tt(A)&&(M||C)){let te=wd(A,A.points),de=wd({...A,x:B,y:U},G.points),qe=[A.x,A.y],Ye=[B,U],Me=Be=>{let Oe=Be==="x"?0:1;return(de[Oe+2]-Ye[Oe]-(qe[Oe]-te[Oe])*y+(te[Oe+2]-qe[Oe])*y-(Ye[Oe]-de[Oe]))/2};M&&(Z.x-=Me("x")),C&&(Z.y-=Me("y"))}if(ct(A)){let te=WI(A,n,$);if(!te)return;Z.fontSize=te.size}let ee=e.get(Xl(A)??"");if(ee){let te=ee.fontSize*y;if(te<g1)return;Z.boundTextFontSize=te}P.push({element:_,update:Z})}let R=P.map(({element:A})=>A);for(let{element:A,update:{boundTextFontSize:_,...$}}of P){let{width:W,height:H,angle:K}=$;Ie(A,$,!1),Is(A,n,{simultaneouslyUpdated:R,newSize:{width:W,height:H}});let Q=dt(A,n);Q&&_&&(Ie(Q,{fontSize:_,angle:Tt(A)?void 0:K},!1),Yl(A,n,r,!0))}Qi.getScene(P[0].element)?.informMutation()},iie=(e,t,n,r,i,o,a,s)=>{let l=5*Math.PI/2+Math.atan2(i-s,r-a);o&&(l+=No/2,l-=l%No),t.filter(c=>!ht(c)).forEach(c=>{let[d,u,h,m]=Te(c,n),p=(d+h)/2,f=(u+m)/2,g=e.get(c.id)?.angle??c.angle,[b,v]=De(p,f,a,s,l+g-c.angle);Ie(c,{x:c.x+(b-p),y:c.y+(v-f),angle:ky(l+g)},!1),Is(c,n,{simultaneouslyUpdated:t});let y=dt(c,n);y&&!gt(c)&&Ie(y,{x:y.x+(b-p),y:y.y+(v-f),angle:ky(l+g)},!1)}),Qi.getScene(t[0])?.informMutation()},oie=(e,t,n,r,i)=>{let[o,a,s,l]=t.length===1?Te(t[0],n):kr(t),c=(o+s)/2,d=(a+l)/2,u=t.length===1?t[0].angle:0;switch([r,i]=De(r,i,c,d,-u),e){case"n":return De(r-(o+s)/2,i-a,0,0,u);case"s":return De(r-(o+s)/2,i-l,0,0,u);case"w":return De(r-o,i-(a+l)/2,0,0,u);case"e":return De(r-s,i-(a+l)/2,0,0,u);case"nw":return De(r-o,i-a,0,0,u);case"ne":return De(r-s,i-a,0,0,u);case"sw":return De(r-o,i-l,0,0,u);case"se":return De(r-s,i-l,0,0,u);default:return[0,0]}},aie=(e,t)=>{let[,[n,r]]=t.points;return e==="nw"&&(n<0||r<0)||e==="ne"&&n>=0||e==="sw"&&n<=0||e==="se"&&(n>0||r>0)?"end":"origin"};S();var sie=(e,t,n,r,i,o,a)=>{let s=new Set(t),l=t.filter(u=>ht(u)).map(u=>u.id);if(l.length>0)for(let u of i.getNonDeletedElements())u.frameId!==null&&l.includes(u.frameId)&&s.add(u);let c=kr(Array.from(s).map(u=>e.originalElements.get(u.id)??u)),d=lie(c,n,o,a);s.forEach(u=>{if(qj(e,u,d),!gt(u)){let h=dt(u,i.getNonDeletedElementsMap());h&&qj(e,h,d)}Is(u,i.getElementsMapIncludingDeleted(),{simultaneouslyUpdated:Array.from(s)})})},lie=(e,t,n,r)=>{let[i,o]=e,a=i+t.x+n.x,s=o+t.y+n.y;if(n.x===0||n.y===0){let[l,c]=nm(i+t.x,o+t.y,r);n.x===0&&(a=l),n.y===0&&(s=c)}return{x:a-i,y:s-o}},qj=(e,t,n)=>{let r=e.originalElements.get(t.id)??t,i=r.x+n.x,o=r.y+n.y;Ie(t,{x:i,y:o})},cie=(e,t,n)=>{let[r,i]=kr(e);return[t-r,n-i]},die=(e,t,n,r,i,o,a,s,l,c,d,u=null)=>{l&&e.type!=="selection"&&(d?s=a/d:(Math.abs(o-r)>Math.abs(i-n)?{width:a,height:s}=Iy(t,s,i<n?-a:a):{width:a,height:s}=Iy(t,a,o<r?-s:s),s<0&&(s=-s)));let h=i<n?n-a:n,m=o<r?r-s:r;c&&(a+=a,s+=s,h=n-a/2,m=r-s/2),a!==0&&s!==0&&Ie(e,{x:h+(u?.x??0),y:m+(u?.y??0),width:a,height:s})};S();var uie=(e,t)=>!!(!e.viewModeEnabled&&(e.activeTool.type!=="custom"&&(e.editingElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||jr(t,e).length));var Cxe=e=>e.reduce((t,n)=>t+n.version,0),Mxe=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e[n].versionNonce;return t>>>0},Ixe=e=>{let t=5381;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)+t+r}return t>>>0},B7=e=>e.filter(t=>!t.isDeleted&&!fm(t)),Gx=e=>e.filter(t=>!t.isDeleted),Xj=e=>!e.isDeleted,Qj=e=>Gx(e).map(t=>_v(t.type)?{...t,lastCommittedPoint:null}:t),x_=e=>Qj(e),I0=e=>Qj(e);var eU=async e=>{let t;if(e.type===we.png)try{return await(await import("./image-5SBTIZPN.js")).decodePngMetadata(e)}catch(n){throw n.message==="INVALID"?new Ma("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Ma("Error: cannot restore image")}else if("text"in Blob?t=await e.text():t=await new Promise(n=>{let r=new FileReader;r.readAsText(e,"utf8"),r.onloadend=()=>{r.readyState===FileReader.DONE&&n(r.result)}}),e.type===we.svg)try{return await(await import("./image-5SBTIZPN.js")).decodeSvgMetadata({svg:t})}catch(n){throw n.message==="INVALID"?new Ma("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Ma("Error: cannot restore image")}return t};var hie=e=>e&&e.name.match(/\.(json|excalidraw|png|svg)$/)?.[1]||null,Qxe=e=>e==="png"||e==="svg",b_=e=>{let t=hie(e);return t==="png"||t==="svg"},_y=e=>{let{type:t}=e||{};return!!t&&Object.values(xv).includes(t)},mie=async(e,t,n,r)=>{let i=await eU(e),o;try{try{o=JSON.parse(i)}catch(a){throw _y(e)?new Ma("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):a}if(v_(o))return{type:we.excalidraw,data:k0({elements:I0(o.elements||[]),appState:{theme:t?.theme,fileHandle:r||e.handle||null,...S1(o.appState||{}),...t?Gv(o.elements||[],t):{}},files:o.files},t,n,{repairBindings:!0,refreshDimensions:!1})};if(Bx(o))return{type:we.excalidrawlib,data:o};throw new Error("Error: invalid file")}catch(a){throw a instanceof Ma?a:new Error("Error: invalid file")}},y_=async(e,t,n,r)=>{let i=await mie(e,t,n,r);if(i.type!==we.excalidraw)throw new Error("Error: invalid file");return i.data},pie=(e,t="unpublished")=>{let n=JSON.parse(e);if(!Bx(n))throw new Error("Invalid library");let r=n.libraryItems||n.library;return k_(r,t)},Jxe=async(e,t="unpublished")=>pie(await eU(e),t),ewe=async e=>new Promise(async(t,n)=>{try{M1(e)&&(e=await e),e.toBlob(r=>{if(!r)return n(new C0("Error: Canvas too big","CANVAS_POSSIBLY_TOO_BIG"));t(r)})}catch(r){n(r)}}),twe=async e=>{try{let t=await window.crypto.subtle.digest("SHA-1",await ds(e));return m7(new Uint8Array(t))}catch(t){return console.error(t),Fo(40)}},nwe=async e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=r.result;t(i)},r.onerror=i=>n(i),r.readAsDataURL(e)}),rwe=(e,t="")=>{let n=e.indexOf(","),r=atob(e.slice(n+1)),i=e.slice(0,n).split(":")[1].split(";")[0],o=new ArrayBuffer(r.length),a=new Uint8Array(o);for(let s=0;s<r.length;s++)a[s]=r.charCodeAt(s);return new File([o],t,{type:i})},iwe=async(e,t)=>{if(e.type===we.svg)return e;let[n,r]=await Promise.all([import("./pica-ORBFBYLP.js").then(o=>o.default),import("./image-blob-reduce.esm-47YEP2D2.js").then(o=>o.default)]),i=r({pica:n({features:["js","wasm"]})});if(t.outputType){let{outputType:o}=t;i._create_blob=function(a){return this.pica.toBlob(a.out_canvas,o,.8).then(s=>(a.out_blob=s,a))}}if(!_y(e))throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"});return new File([await i.toBlob(e,{max:t.maxWidthOrHeight})],e.name,{type:t.outputType||e.type})},owe=(e,t="")=>new File([new TextEncoder().encode(e)],t,{type:we.svg}),awe=async(e,t="")=>{let n;try{n=await fetch(e)}catch{throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"})}if(!n.ok)throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"});let r=await n.blob();if(r.type&&_y(r)){let i=t||r.name||"";return new File([r],i,{type:r.type})}throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"})},swe=async e=>{let t=e.dataTransfer.files.item(0),n=await fie(e);return{file:t?await Fx(t):null,fileHandle:n}},fie=async e=>{if(no)try{return await e.dataTransfer.items[0].getAsFileSystemHandle()||null}catch(t){return console.warn(t.name,t.message),null}return null},Jj=e=>{let t=null,n=`${[...new Uint8Array(e).slice(0,8)].join(" ")} `,r={png:"137 80 78 71 13 10 26 10 ",jpg:"255 216 255 ",gif:"71 73 70 56 57 97 "};return n===r.png?t=we.png:n.startsWith(r.jpg)?t=we.jpg:n.startsWith(r.gif)&&(t=we.gif),t},Ay=(e,t,n)=>new File([e],n||"",{type:t}),Fx=async e=>{if(e.type){if(_y(e)){let t=await ds(e),n=Jj(t);n&&n!==e.type&&(e=Ay(t,n,e.name))}}else if(e?.name?.endsWith(".excalidrawlib"))e=Ay(await ds(e),we.excalidrawlib,e.name);else if(e?.name?.endsWith(".excalidraw"))e=Ay(await ds(e),we.excalidraw,e.name);else{let t=await ds(e),n=Jj(t);n&&(e=Ay(t,n,e.name))}return e},ds=e=>"arrayBuffer"in e?e.arrayBuffer():new Promise((t,n)=>{let r=new FileReader;r.onload=i=>{if(!i.target?.result)return n(new Error("Couldn't convert blob to ArrayBuffer"));t(i.target.result)},r.readAsArrayBuffer(e)});var jI=e=>new Promise((t,n)=>{let r=typeof e=="string"?new Blob([new TextEncoder().encode(e)]):new Blob([e instanceof Uint8Array?e:new Uint8Array(e)]),i=new FileReader;i.onload=o=>{if(!o.target||typeof o.target.result!="string")return n(new Error("couldn't convert to byte string"));t(o.target.result)},i.readAsBinaryString(r)}),tU=e=>{let t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t},nU=e=>new TextDecoder("utf-8").decode(tU(e)),rU=async(e,t=!1)=>t?window.btoa(e):window.btoa(await jI(e)),iU=async(e,t=!1)=>t?window.atob(e):nU(window.atob(e)),UI=async({text:e,compress:t})=>{let n;if(t!==!1)try{n=await jI((0,Py.deflate)(e))}catch(r){console.error("encode: cannot deflate",r)}return{version:"1",encoding:"bstring",compressed:!!n,encoded:n||await jI(e)}},VI=async e=>{let t;switch(e.encoding){case"bstring":t=e.compressed?e.encoded:await nU(e.encoded);break;default:throw new Error(`decode: unknown encoding "${e.encoding}"`)}return e.compressed?(0,Py.inflate)(new Uint8Array(tU(t)),{to:"string"}):t};var gie=async e=>{let n=(0,YI.default)(new Uint8Array(await ds(e))).find(r=>r.name==="tEXt");return n?ZI.default.decode(n.data):null},Pj=async({blob:e,metadata:t})=>{let n=(0,YI.default)(new Uint8Array(await ds(e))),r=ZI.default.encode(we.excalidraw,JSON.stringify(await UI({text:t,compress:!0})));return n.splice(-1,0,r),new Blob([(0,oU.default)(n)],{type:we.png})},Swe=async e=>{let t=await gie(e);if(t?.keyword===we.excalidraw)try{let n=JSON.parse(t.text);if(!("encoded"in n)){if("type"in n&&n.type===Mr.excalidraw)return t.text;throw new Error("FAILED")}return await VI(n)}catch(n){throw console.error(n),new Error("FAILED")}throw new Error("INVALID")},Twe=async({text:e})=>{let t=await rU(JSON.stringify(await UI({text:e})),!0),n="";return n+=`<!-- payload-type:${we.excalidraw} -->`,n+="<!-- payload-version:2 -->",n+="<!-- payload-start -->",n+=t,n+="<!-- payload-end -->",n},Cwe=async({svg:e})=>{if(e.includes(`payload-type:${we.excalidraw}`)){let t=e.match(/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/);if(!t)throw new Error("INVALID");let i=(e.match(/<!-- payload-version:(\d+) -->/)?.[1]||"1")!=="1";try{let o=await iU(t[1],i),a=JSON.parse(o);if(!("encoded"in a)){if("type"in a&&a.type===Mr.excalidraw)return o;throw new Error("FAILED")}return await VI(a)}catch(o){throw console.error(o),new Error("FAILED")}}throw new Error("INVALID")};export{q as a,J_ as b,$0 as c,At as d,vm as e,ka as f,Ve as g,j as h,Y as i,p1 as j,coe as k,uoe as l,moe as m,poe as n,foe as o,goe as p,Vk as q,Yk as r,Eoe as s,boe as t,yoe as u,voe as v,f1 as w,xoe as x,woe as y,Soe as z,Toe as A,Coe as B,Cn as C,zr as D,Nn as E,$o as F,ji as G,ud as H,E1 as I,b1 as J,bs as K,hd as L,Moe as M,Ioe as N,xv as O,we as P,koe as Q,Mr as R,wv as S,Aoe as T,_oe as U,Poe as V,Doe as W,Loe as X,Xk as Y,Roe as Z,v1 as _,Ooe as $,Noe as aa,$oe as ba,Foe as ca,Boe as da,zoe as ea,Hoe as fa,Goe as ga,Kk as ha,qk as ia,Woe as ja,joe as ka,ft as la,Sv as ma,Mn as na,ga as oa,Tv as pa,Hr as qa,Uoe as ra,hY as sa,n7 as ta,Voe as ua,Yoe as va,Zoe as wa,r7 as xa,jo as ya,qt as za,Fo as Aa,dae as Ba,uae as Ca,hae as Da,fY as Ea,mae as Fa,pae as Ga,Iv as Ha,In as Ia,d7 as Ja,u7 as Ka,h7 as La,fae as Ma,gae as Na,mi as Oa,$h as Pa,Eae as Qa,Fh as Ra,kv as Sa,bae as Ta,fd as Ua,yae as Va,vae as Wa,xae as Xa,ys as Ya,wae as Za,Sae as _a,Tae as $a,Cae as ab,St as bb,Mae as cb,ba as db,Iae as eb,kae as fb,Aae as gb,_ae as hb,M1 as ib,Pae as jb,Av as kb,Dae as lb,I1 as mb,Lae as nb,p7 as ob,Rae as pb,Oae as qb,Nae as rb,$ae as sb,Fae as tb,f7 as ub,Hl as vb,Bae as wb,Bo as xb,k1 as yb,A1 as zb,gd as Ab,Ui as Bb,ct as Cb,Bh as Db,E7 as Eb,ht as Fb,Tt as Gb,gt as Hb,_v as Ib,Vi as Jb,vY as Kb,_1 as Lb,Pv as Mb,P1 as Nb,pi as Ob,D1 as Pb,jae as Qb,Uae as Rb,Go as Sb,to as Tb,Qi as Ub,YA as Vb,sn as Wb,Qn as Xb,xa as Yb,nm as Zb,Sa as _b,Que as $b,Jue as ac,ZY as bc,Lle as cc,XY as dc,KY as ec,Wv as fc,qY as gc,QY as hc,ex as ic,Ece as jc,r0 as kc,tx as lc,nA as mc,rx as nc,mZ as oc,s0 as pc,l0 as qc,ox as rc,Jce as sc,Ur as tc,ede as uc,tde as vc,nde as wc,cx as xc,pde as yc,ux as zc,Jh as Ac,fde as Bc,gde as Cc,dx as Dc,RZ as Ec,Ede as Fc,em as Gc,Is as Hc,bde as Ic,yde as Jc,vde as Kc,Et as Lc,im as Mc,CA as Nc,MA as Oc,$de as Pc,vx as Qc,GZ as Rc,qde as Sc,kA as Tc,Zl as Uc,Sd as Vc,_A as Wc,wx as Xc,Td as Yc,LA as Zc,Xl as _c,dt as $c,pr as ad,Qde as bd,Jde as cd,eue as dd,tue as ed,nue as fd,rue as gd,yx as hd,Ji as id,am as jd,iue as kd,m0 as ld,Te as md,kr as nd,Uue as od,KA as pd,Vue as qd,pd as rd,iae as sd,S1 as td,o7 as ud,a7 as vd,uX as wd,ohe as xd,ahe as yd,hX as zd,she as Ad,QA as Bd,lhe as Cd,mX as Dd,Cd as Ed,che as Fd,dhe as Gd,uhe as Hd,hhe as Id,Md as Jd,Ehe as Kd,t_ as Ld,n_ as Md,r_ as Nd,Ct as Od,MX as Pd,IX as Qd,kX as Rd,s_ as Sd,dm as Td,Hhe as Ud,Ghe as Vd,Whe as Wd,jhe as Xd,Wo as Yd,x0 as Zd,DX as _d,Uhe as $d,Ql as ae,LX as be,Rx as ce,RX as de,Vhe as ee,h_ as fe,p_ as ge,ime as he,ome as ie,no as je,M0 as ke,Ma as le,E_ as me,$x as ne,I_ as oe,zx as pe,k0 as qe,k_ as re,gie as se,Pj as te,Swe as ue,Twe as ve,Cwe as we,hie as xe,Qxe as ye,b_ as ze,_y as Ae,mie as Be,y_ as Ce,pie as De,Jxe as Ee,ewe as Fe,twe as Ge,nwe as He,rwe as Ie,iwe as Je,owe as Ke,awe as Le,swe as Me,Fx as Ne,pm as Oe,zme as Pe,Hme as Qe,UX as Re,Gme as Se,VX as Te,w_ as Ue,S_ as Ve,Yme as We,jx as Xe,tK as Ye,fpe as Ze,ype as _e,A_ as $e,__ as af,rK as bf,R_ as cf,Ux as df,$_ as ef,F_ as ff,Tce as gf,Cce as hf,i0 as if,o0 as jf,Je as kf,Mce as lf,Ice as mf,kce as nf,Ace as of,_ce as pf,Pce as qf,efe as rf,mK as sf,hfe as tf,mfe as uf,V_ as vf,pfe as wf,ffe as xf,Z_ as yf,Xx as zf,rg as Af,ig as Bf,OD as Cf,og as Df,ND as Ef,Nw as Ff,oo as Gf,l9 as Hf,cg as If,dg as Jf,ug as Kf,hg as Lf,Lm as Mf,Pye as Nf,Nre as Of,$re as Pf,Dye as Qf,Lj as Rf,zre as Sf,Oj as Tf,ove as Uf,As as Vf,ave as Wf,sve as Xf,qf as Yf,Vx as Zf,lve as _f,cve as $f,Ar as ag,dve as bg,Wre as cg,Uj as dg,jre as eg,uve as fg,hve as gg,_0 as hg,B_ as ig,z_ as jg,ZZ as kg,vue as lg,xue as mg,Mx as ng,Lt as og,Ie as pg,Jl as qg,um as rg,fm as sg,Vj as tg,gx as ug,Hx as vg,Yre as wg,Zre as xg,Kre as yg,qre as zg,rie as Ag,oie as Bg,aie as Cg,sie as Dg,cie as Eg,die as Fg,uie as Gg,Cxe as Hg,Mxe as Ig,Ixe as Jg,Gx as Kg,Xj as Lg,Ure as Mg,X1 as Ng,vve as Og,eZ as Pg,tZ as Qg,jr as Rg,nZ as Sg,Dx as Tg,YY as Ug,Gv as Vg,JY as Wg,$le as Xg};
301
- /*! Bundled license information:
302
-
303
- react/cjs/react-jsx-runtime.production.min.js:
304
- (**
305
- * @license React
306
- * react-jsx-runtime.production.min.js
307
- *
308
- * Copyright (c) Facebook, Inc. and its affiliates.
309
- *
310
- * This source code is licensed under the MIT license found in the
311
- * LICENSE file in the root directory of this source tree.
312
- *)
313
-
314
- use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
315
- (**
316
- * @license React
317
- * use-sync-external-store-shim.production.min.js
318
- *
319
- * Copyright (c) Facebook, Inc. and its affiliates.
320
- *
321
- * This source code is licensed under the MIT license found in the
322
- * LICENSE file in the root directory of this source tree.
323
- *)
324
-
325
- use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
326
- (**
327
- * @license React
328
- * use-sync-external-store-shim/with-selector.production.min.js
329
- *
330
- * Copyright (c) Facebook, Inc. and its affiliates.
331
- *
332
- * This source code is licensed under the MIT license found in the
333
- * LICENSE file in the root directory of this source tree.
334
- *)
335
- */