@esri/solutions-components 1.0.0-next.20250618.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (577) hide show
  1. package/dist/cdn/{6HWGPY7I.js → 2AZTGGQP.js} +1 -1
  2. package/dist/cdn/{TF5CJGN3.js → 2DNLAFAS.js} +2 -2
  3. package/dist/cdn/{YALUQDOM.js → 2ETHF7OM.js} +2 -2
  4. package/dist/cdn/{6EBE7D3T.js → 2IP6OT43.js} +2 -2
  5. package/dist/cdn/{453KXUYO.js → 2JQ2BEIQ.js} +2 -2
  6. package/dist/cdn/2V47J56C.js +18 -0
  7. package/dist/cdn/{EGKSG7TA.js → 2VDJE4V4.js} +2 -2
  8. package/dist/cdn/{VXTFPJBV.js → 375NF2W7.js} +2 -2
  9. package/dist/cdn/{SO62B7Z3.js → 37FXFNVH.js} +2 -2
  10. package/dist/cdn/{PVFJ6K6W.js → 3EO7HXAA.js} +2 -2
  11. package/dist/cdn/{WF2RAOLM.js → 3EVGRBFY.js} +1 -1
  12. package/dist/cdn/{WFR3PXSW.js → 3GL66CHB.js} +2 -2
  13. package/dist/cdn/{MSH2N77W.js → 3NF274CX.js} +2 -2
  14. package/dist/cdn/3O4G5XDF.js +18 -0
  15. package/dist/cdn/{HD6GEVSM.js → 3WWZQYHU.js} +2 -2
  16. package/dist/cdn/{PFOB7ASU.js → 45CNJSWY.js} +2 -2
  17. package/dist/cdn/{MVYMHCMR.js → 4AMMMHQL.js} +2 -2
  18. package/dist/cdn/{5P7J37EO.js → 4BIK73M6.js} +2 -2
  19. package/dist/cdn/{HNUIQ7IZ.js → 4DELYGXR.js} +1 -1
  20. package/dist/cdn/{OOT5WQ62.js → 4H2V4B6C.js} +2 -2
  21. package/dist/cdn/{XQAPI6JH.js → 4LOK3JWB.js} +2 -2
  22. package/dist/cdn/{QHKMVJ5X.js → 4MI7L2IM.js} +2 -2
  23. package/dist/cdn/{XUGJHSZI.js → 4OJANGG2.js} +2 -2
  24. package/dist/cdn/{FG544GQQ.js → 4P66S2XD.js} +2 -2
  25. package/dist/cdn/{DAFU7J4K.js → 4QO4KGLF.js} +1 -1
  26. package/dist/cdn/{Q364SBXU.js → 4RVVEL4U.js} +2 -2
  27. package/dist/cdn/{VADJYPUJ.js → 4RYZ25UY.js} +1 -1
  28. package/dist/cdn/4W4XMW2A.js +4 -0
  29. package/dist/cdn/{T4MFZ5DG.js → 562IDXBA.js} +2 -2
  30. package/dist/cdn/{6UOPWVSQ.js → 5C2W5W6U.js} +2 -2
  31. package/dist/cdn/{YKVL7P5B.js → 5JQYCQWD.js} +1 -1
  32. package/dist/cdn/{DVTD3RRP.js → 5LUSAPPH.js} +2 -2
  33. package/dist/cdn/{PDM6CH37.js → 5YSFQ4E3.js} +1 -1
  34. package/dist/cdn/{H4L5UITT.js → 65FSH56H.js} +2 -2
  35. package/dist/cdn/{2NGHUOMA.js → 6C3QGOV2.js} +2 -2
  36. package/dist/cdn/{4SP7X7DP.js → 6EBCWPAA.js} +2 -2
  37. package/dist/cdn/{XRNX4VET.js → 6JY7QTCS.js} +2 -2
  38. package/dist/cdn/6KPH5V5K.js +4 -0
  39. package/dist/cdn/{N3YGWBR3.js → 6NDD2A2S.js} +2 -2
  40. package/dist/cdn/{SVBFKGLB.js → 6PD2H4JH.js} +2 -2
  41. package/dist/cdn/{VVAMHZYI.js → 6WGXTLF4.js} +2 -2
  42. package/dist/cdn/{DR7UWBT2.js → 753QAV4W.js} +2 -2
  43. package/dist/cdn/{2QMR4VJO.js → 77US24T3.js} +2 -2
  44. package/dist/cdn/{XAIVE56G.js → 7C7SXM4M.js} +2 -2
  45. package/dist/cdn/{ZYETE37K.js → 7ESWUYD7.js} +2 -2
  46. package/dist/cdn/{M74EDYJB.js → 7N6NOB6I.js} +2 -2
  47. package/dist/cdn/{HJNANARE.js → 7QIEPJRP.js} +1 -1
  48. package/dist/cdn/{F7KUGTUU.js → 7S572CXN.js} +2 -2
  49. package/dist/cdn/{DVMZWZNK.js → 7U4V4KQD.js} +1 -1
  50. package/dist/cdn/{MQLPRI7Y.js → 7V252QBT.js} +2 -2
  51. package/dist/cdn/{UK7MIIEG.js → 7VTP4EVO.js} +2 -2
  52. package/dist/cdn/{ZGFK6XAL.js → 7XRIDSQA.js} +2 -2
  53. package/dist/cdn/{VZXN74EN.js → A3YY7YT4.js} +2 -2
  54. package/dist/cdn/{7TPKHYZN.js → A534RBYP.js} +1 -1
  55. package/dist/cdn/{OK74DXXN.js → A5FGCYNW.js} +2 -2
  56. package/dist/cdn/{73IH4MCM.js → A6RESCXF.js} +2 -2
  57. package/dist/cdn/{HA35S6IO.js → AABCWF4V.js} +2 -2
  58. package/dist/cdn/{5RB5A7EC.js → AB4XPYGH.js} +2 -2
  59. package/dist/cdn/{VTDUS325.js → AF27BERT.js} +2 -2
  60. package/dist/cdn/{DTZRURFU.js → AH6XEMQ2.js} +2 -2
  61. package/dist/cdn/{4SJARCJN.js → AMW6PLM5.js} +2 -2
  62. package/dist/cdn/{NKVQEPKT.js → ASHWLSNH.js} +2 -2
  63. package/dist/cdn/{K3SFQS3G.js → ATNDBD4K.js} +2 -2
  64. package/dist/cdn/{ABSAMC2G.js → B4IYKBMJ.js} +2 -2
  65. package/dist/cdn/{LJV2QPIV.js → B5KSOIAE.js} +2 -2
  66. package/dist/cdn/{E7KWO47I.js → B7B5O4K4.js} +3 -3
  67. package/dist/cdn/{6HYKI6RA.js → BAUJD3CH.js} +2 -2
  68. package/dist/cdn/{CMLCPPNQ.js → BF4MLXML.js} +1 -1
  69. package/dist/cdn/{G6YNF253.js → BM7MU2L4.js} +2 -2
  70. package/dist/cdn/{T5DYODQ7.js → BMVYNMLV.js} +2 -2
  71. package/dist/cdn/{YFONVRE2.js → BOHONSFJ.js} +2 -2
  72. package/dist/cdn/{ZV2CLEQX.js → BVSTBYJQ.js} +2 -2
  73. package/dist/cdn/{4CDWPSJT.js → BZES2KJM.js} +2 -2
  74. package/dist/cdn/{H6FKM52H.js → C5B7DSSA.js} +2 -2
  75. package/dist/cdn/{MY6L5L57.js → C5POLXJA.js} +2 -2
  76. package/dist/cdn/{YYKCOF6W.js → C6BGGFEF.js} +2 -2
  77. package/dist/cdn/{5SEG6ZB4.js → CDDGYF3K.js} +1 -1
  78. package/dist/cdn/{OBL44JYU.js → CGUIDOP7.js} +2 -2
  79. package/dist/cdn/{IB3ETAZV.js → CLZ76DFI.js} +1 -1
  80. package/dist/cdn/{27XA7D5R.js → COE4KJBH.js} +2 -2
  81. package/dist/cdn/{Y7OVAK3H.js → CUK7OF76.js} +2 -2
  82. package/dist/cdn/{2QW5BNYG.js → CX2QWWHL.js} +2 -2
  83. package/dist/cdn/{WXIC5V6X.js → CXK3KS6W.js} +1 -1
  84. package/dist/cdn/{DUAH255O.js → D55TK32T.js} +2 -2
  85. package/dist/cdn/{5FLJ3R4Z.js → DBQ42J5H.js} +2 -2
  86. package/dist/cdn/{3NQ4XAFD.js → DC22KAGH.js} +2 -2
  87. package/dist/cdn/{US6OVDOV.js → DEQ6UPN5.js} +2 -2
  88. package/dist/cdn/{S777APZD.js → DJG2ZUWK.js} +2 -2
  89. package/dist/cdn/{TJY3W6ZV.js → DMWC3BFF.js} +2 -2
  90. package/dist/cdn/{O7DFUJAV.js → DUVNOIA7.js} +2 -2
  91. package/dist/cdn/DYWRP4H5.js +18 -0
  92. package/dist/cdn/{ELHBUZR2.js → DZWNJWAP.js} +2 -2
  93. package/dist/cdn/{22DEUWIT.js → EFEMVR7H.js} +2 -2
  94. package/dist/cdn/{L4EB6CDR.js → EHTK6HWZ.js} +1 -1
  95. package/dist/cdn/{XV3E5CCZ.js → F2T2S2QU.js} +1 -1
  96. package/dist/cdn/{R3KDQDD7.js → F3GQ2KDF.js} +2 -2
  97. package/dist/cdn/{5Q3XETDO.js → FDRKGYGJ.js} +1 -1
  98. package/dist/cdn/{2XC7LXEB.js → FFU546ZJ.js} +2 -2
  99. package/dist/cdn/{F4RH4VWK.js → FGCO2ORF.js} +1 -1
  100. package/dist/cdn/{KPBIM4OX.js → FJDXAEGB.js} +2 -2
  101. package/dist/cdn/{BKVCY3ER.js → FSQJF7E4.js} +2 -2
  102. package/dist/cdn/{FC4KGDP5.js → FVAP4UBB.js} +4 -4
  103. package/dist/cdn/{PVWZATYG.js → FWP6XYXK.js} +1 -1
  104. package/dist/cdn/{3TNVVFNO.js → G457BSKN.js} +2 -2
  105. package/dist/cdn/{NK74ETZE.js → G4CYMD2F.js} +2 -2
  106. package/dist/cdn/{BHJ37YW3.js → G4UJUDJT.js} +2 -2
  107. package/dist/cdn/{YEEVLAKF.js → GEOD3XEI.js} +2 -2
  108. package/dist/cdn/{Q3ZAVJA2.js → GFKIE25D.js} +2 -2
  109. package/dist/cdn/{IXSWEW6F.js → GH7MZ4TU.js} +1 -1
  110. package/dist/cdn/{42CLIUFU.js → GK2GYSCW.js} +2 -2
  111. package/dist/cdn/{ZVP43N4V.js → GQVTZIV3.js} +2 -2
  112. package/dist/cdn/{6GCHXKQA.js → GU6ODYX3.js} +2 -2
  113. package/dist/cdn/{FDSGJDEW.js → GUNSWZAV.js} +2 -2
  114. package/dist/cdn/{XUSEEFTR.js → GVD3BPTW.js} +2 -2
  115. package/dist/cdn/{YQDVAXQW.js → H4S5Q3QE.js} +2 -2
  116. package/dist/cdn/{27IJK3XU.js → HG3L3JDR.js} +2 -2
  117. package/dist/cdn/{6XUFEP6O.js → HI7D2U25.js} +2 -2
  118. package/dist/cdn/HLGUH3Z5.js +4 -0
  119. package/dist/cdn/{V44FLEND.js → HQIAVN67.js} +1 -1
  120. package/dist/cdn/{B7H3UB3X.js → HYWAINS4.js} +2 -2
  121. package/dist/cdn/{Y7NXM543.js → I3E3JX77.js} +2 -2
  122. package/dist/cdn/{OYK55OPW.js → I4QX6RMP.js} +2 -2
  123. package/dist/cdn/{2B2GYFSL.js → I6ZE3VUY.js} +1 -1
  124. package/dist/cdn/{M5HIWWVR.js → IKGNORRI.js} +1 -1
  125. package/dist/cdn/{Q7AF5GSO.js → IKVFAXUB.js} +2 -2
  126. package/dist/cdn/{VUHOWKOE.js → IRZGR6FA.js} +2 -2
  127. package/dist/cdn/{2ILROAQZ.js → IXJEV6RS.js} +2 -2
  128. package/dist/cdn/{EY6GQSJA.js → IXTBS5WJ.js} +2 -2
  129. package/dist/cdn/{USL7FSTL.js → J4JPFH2C.js} +2 -2
  130. package/dist/cdn/{IT4KHWLP.js → JKOAF37V.js} +2 -2
  131. package/dist/cdn/{S6M65JNG.js → JOYJ7K2X.js} +2 -2
  132. package/dist/cdn/{M6ZT4KAQ.js → JQ7HMAJD.js} +2 -2
  133. package/dist/cdn/{Y5OV27ST.js → JSPHL3ZQ.js} +2 -2
  134. package/dist/cdn/{67AB4WK2.js → JUIF3JFS.js} +1 -1
  135. package/dist/cdn/{E5ZOUWWV.js → JVW5HI2D.js} +2 -2
  136. package/dist/cdn/{SEKMKSIL.js → JYTMSQVX.js} +2 -2
  137. package/dist/cdn/{XUCC6Q63.js → K3GLXE2P.js} +2 -2
  138. package/dist/cdn/{NGOEQEFU.js → K7A26VQP.js} +2 -2
  139. package/dist/cdn/{IMEGNZXQ.js → KAZSBKHX.js} +1 -1
  140. package/dist/cdn/{FX4AQK2Q.js → KFYEVP5G.js} +2 -2
  141. package/dist/cdn/{ANHMYCUR.js → KIQPCYN6.js} +1 -1
  142. package/dist/cdn/{HF665LFM.js → KNPFBJQA.js} +2 -2
  143. package/dist/cdn/{ZGM2MNP7.js → KQRRNLN7.js} +2 -2
  144. package/dist/cdn/{5SQBN4JE.js → KQT4EINQ.js} +2 -2
  145. package/dist/cdn/{WUJLNKKN.js → KSLSMSNN.js} +2 -2
  146. package/dist/cdn/{6HHQ2JHH.js → KTI5QE2K.js} +2 -2
  147. package/dist/cdn/{BU5B4DZ4.js → KTKSUQ5S.js} +2 -2
  148. package/dist/cdn/{TQAYE35S.js → KVEA5E7H.js} +2 -2
  149. package/dist/cdn/{XYGC3GAD.js → KZFFQCTK.js} +1 -1
  150. package/dist/cdn/{37DEXVCR.js → L72F3CMH.js} +1 -1
  151. package/dist/cdn/{NYP2DH6E.js → LDJU7VV4.js} +2 -2
  152. package/dist/cdn/{YCZJL2J6.js → LKE4PKVZ.js} +2 -2
  153. package/dist/cdn/{EY7Y6MEK.js → LWNLZFMB.js} +2 -2
  154. package/dist/cdn/{MVACBSIQ.js → LZC5OKYE.js} +2 -2
  155. package/dist/cdn/{BHMGYZRR.js → M2MY5G5H.js} +2 -2
  156. package/dist/cdn/{G5SYJQGV.js → M3JQHFSU.js} +1 -1
  157. package/dist/cdn/{7U6QJOKE.js → M5DV4YRX.js} +2 -2
  158. package/dist/cdn/{RCBT5CJJ.js → MAFJTGI7.js} +2 -2
  159. package/dist/cdn/{SWEIKA4N.js → MAVOVPIB.js} +2 -2
  160. package/dist/cdn/{4EGTPR4P.js → MC2Q2QYK.js} +2 -2
  161. package/dist/cdn/{PHYMHJGH.js → MI54WZOS.js} +2 -2
  162. package/dist/cdn/{JW27PEBE.js → MTPMC5GM.js} +2 -2
  163. package/dist/cdn/{WTF2NDZG.js → MU4OTO47.js} +2 -2
  164. package/dist/cdn/{3AOBWOCE.js → MUWEJYVI.js} +2 -2
  165. package/dist/cdn/{WWZ7BEPS.js → MW3TOC4O.js} +2 -2
  166. package/dist/cdn/{2RLX463P.js → N2SMCNLL.js} +2 -2
  167. package/dist/cdn/{GHZQTMSB.js → N6EHMAJL.js} +2 -2
  168. package/dist/cdn/{LLZMMGKZ.js → NCU6UX4Y.js} +2 -2
  169. package/dist/cdn/{3QUOD6OE.js → NF2EHSNV.js} +2 -2
  170. package/dist/cdn/{NBEXVLVJ.js → NKZQ7OVS.js} +1 -1
  171. package/dist/cdn/{BMITAUIB.js → NMZOOVD5.js} +2 -2
  172. package/dist/cdn/{BBAQTD4M.js → NP4W7EDK.js} +2 -2
  173. package/dist/cdn/O3JIKJGK.js +4 -0
  174. package/dist/cdn/{73H7XOOM.js → O5NFMICR.js} +1 -1
  175. package/dist/cdn/{MM3ENMYR.js → OGLT2FNT.js} +2 -2
  176. package/dist/cdn/{4DEGIQWI.js → OGW4H5WS.js} +2 -2
  177. package/dist/cdn/{LALLH4DA.js → OIK6EGQ7.js} +2 -2
  178. package/dist/cdn/{5IBICH3B.js → OKHJNJQ3.js} +2 -2
  179. package/dist/cdn/{7LYZPZHS.js → ORH5XZIQ.js} +1 -1
  180. package/dist/cdn/{EY6WF4OC.js → OS2XMULM.js} +2 -2
  181. package/dist/cdn/{MZHBGZQK.js → OWK6VKPV.js} +2 -2
  182. package/dist/cdn/{UTBNZS5I.js → OZVC6WF4.js} +2 -2
  183. package/dist/cdn/{BGLXMZEH.js → P325FJIH.js} +2 -2
  184. package/dist/cdn/{TK4CSKXO.js → PCAPJGRX.js} +2 -2
  185. package/dist/cdn/{A54BEPSN.js → PE2TLSRM.js} +2 -2
  186. package/dist/cdn/{KPHYMONP.js → PFD6TBZM.js} +2 -2
  187. package/dist/cdn/{P64CKY6D.js → PGXDDG5S.js} +2 -2
  188. package/dist/cdn/{O2UMUEEH.js → PLASWOCJ.js} +1 -1
  189. package/dist/cdn/{5TTH6ZFB.js → PPVPQPWQ.js} +2 -2
  190. package/dist/cdn/{PSKK6R7V.js → PS7XJL2U.js} +2 -2
  191. package/dist/cdn/{ZM7CSJ7J.js → PSP2JCLX.js} +1 -1
  192. package/dist/cdn/{37S6NBZ3.js → PUKJYYTH.js} +2 -2
  193. package/dist/cdn/{YDLCJOSG.js → PUQGIVUM.js} +2 -2
  194. package/dist/cdn/{4D5AWIAL.js → PXCWZJ7U.js} +2 -2
  195. package/dist/cdn/PY55NBB3.js +18 -0
  196. package/dist/cdn/{GV2TYF3E.js → PYIX27UL.js} +2 -2
  197. package/dist/cdn/{W5XHOYDJ.js → PYNMB3I2.js} +2 -2
  198. package/dist/cdn/{G63RAOIA.js → Q5AWSODM.js} +2 -2
  199. package/dist/cdn/{74IMQNIQ.js → Q7M5LNDV.js} +2 -2
  200. package/dist/cdn/{YDJEUHQO.js → QEZIPKKL.js} +2 -2
  201. package/dist/cdn/{UN6UPWDA.js → QPA3WWD5.js} +2 -2
  202. package/dist/cdn/{TG4PTBAJ.js → QPGA66A2.js} +2 -2
  203. package/dist/cdn/{SRYMJYQK.js → QQBRQOVF.js} +2 -2
  204. package/dist/cdn/{BT2SQ524.js → QUGE5UIB.js} +2 -2
  205. package/dist/cdn/{6DLP7EAR.js → QZYPXSAV.js} +2 -2
  206. package/dist/cdn/{5RSJCEFW.js → RFH4QYOD.js} +2 -2
  207. package/dist/cdn/{6DTUA3D5.js → RM3ZEQXS.js} +2 -2
  208. package/dist/cdn/{ZQFZG7LI.js → RPF35HAJ.js} +2 -2
  209. package/dist/cdn/{A4LFNBYA.js → RRC2IGCL.js} +2 -2
  210. package/dist/cdn/{5AAP2PXG.js → RUKTK5PF.js} +1 -1
  211. package/dist/cdn/{YZVOT3TE.js → RV44MYN7.js} +2 -2
  212. package/dist/cdn/{EBEY5UUD.js → RV5R7U2A.js} +2 -2
  213. package/dist/cdn/{DVUDZVYK.js → RX5LSG2B.js} +2 -2
  214. package/dist/cdn/{ENVYZICY.js → S2NGFTAF.js} +2 -2
  215. package/dist/cdn/{DFWM7SK2.js → SFY7JL2D.js} +2 -2
  216. package/dist/cdn/{FTZ55E57.js → SGGYFQLR.js} +2 -2
  217. package/dist/cdn/{RFU2GA77.js → SRZKPJVK.js} +2 -2
  218. package/dist/cdn/{DYZGFY5X.js → SZEHA4OQ.js} +2 -2
  219. package/dist/cdn/{DILHH7QS.js → T2HT5CMC.js} +2 -2
  220. package/dist/cdn/T6E7HFWP.js +4 -0
  221. package/dist/cdn/{DSPEQAWS.js → T7T6X6O5.js} +2 -2
  222. package/dist/cdn/{EINFPK4N.js → TARGNPVA.js} +2 -2
  223. package/dist/cdn/{6HDVZ6WN.js → TBQ6UDD2.js} +2 -2
  224. package/dist/cdn/TCDPSWNN.js +4 -0
  225. package/dist/cdn/{CU2OKRTG.js → TGHZAXVE.js} +2 -2
  226. package/dist/cdn/{YWQZU6B6.js → TKP6ZIYO.js} +1 -1
  227. package/dist/cdn/{HJ4Y6HPF.js → TNPHUDU5.js} +2 -2
  228. package/dist/cdn/{SQ5LN6VW.js → TQWK6V5V.js} +1 -1
  229. package/dist/cdn/{OH63VQJ5.js → TSYBPIHM.js} +2 -2
  230. package/dist/cdn/TXLKUYV2.js +89 -0
  231. package/dist/cdn/{US7BWYVK.js → TY7GL3FG.js} +2 -2
  232. package/dist/cdn/{2U4CAZGB.js → TZRKKXAD.js} +2 -2
  233. package/dist/cdn/{2KPY6FAI.js → U3YAUOKI.js} +2 -2
  234. package/dist/cdn/{LN6K3MM3.js → U45DGMUG.js} +2 -2
  235. package/dist/cdn/{LTVJKXTE.js → UANGRMJE.js} +2 -2
  236. package/dist/cdn/{G74J63ZD.js → UKSUWA3B.js} +1 -1
  237. package/dist/cdn/{CNNZEBLF.js → UNYBJ7BO.js} +1 -1
  238. package/dist/cdn/{CDYS4E5S.js → USSUHCJG.js} +2 -2
  239. package/dist/cdn/{A4CHRBGU.js → UUIA7SBZ.js} +2 -2
  240. package/dist/cdn/{EPI3ZTID.js → UUIMWX7O.js} +2 -2
  241. package/dist/cdn/{HTCAIHM5.js → UUUHJN3K.js} +2 -2
  242. package/dist/cdn/{4FYXKV37.js → UZFCVNKV.js} +2 -2
  243. package/dist/cdn/{WEEW5J3L.js → VF3OE7WS.js} +1 -1
  244. package/dist/cdn/{3BKKIYBV.js → VKXA2IQW.js} +2 -2
  245. package/dist/cdn/{TIRLXBT3.js → VTR2E6HB.js} +2 -2
  246. package/dist/cdn/{GOFTF4EY.js → VU6ZKOYY.js} +2 -2
  247. package/dist/cdn/{WK34FXLR.js → VUHPVY6F.js} +2 -2
  248. package/dist/cdn/{U4PHRGHK.js → VXCPN4DG.js} +2 -2
  249. package/dist/cdn/{3TPEYV7S.js → VXPBZUD6.js} +2 -2
  250. package/dist/cdn/{HWI6PJH6.js → VXZ2B534.js} +2 -2
  251. package/dist/cdn/{2DHUGRRB.js → W3GM72GU.js} +2 -2
  252. package/dist/cdn/{F5P6EE5Q.js → WC247XQ6.js} +2 -2
  253. package/dist/cdn/{SRQQ7EAN.js → WIZLQW7N.js} +2 -2
  254. package/dist/cdn/{SHHFJEV3.js → WP57L3ZR.js} +2 -2
  255. package/dist/cdn/{Y4ADZQLA.js → WSWWUPOS.js} +2 -2
  256. package/dist/cdn/{N2NWQNTT.js → WTQ4CUVN.js} +2 -2
  257. package/dist/cdn/{DLPQ7KWA.js → WVJNLVM2.js} +2 -2
  258. package/dist/cdn/{M62LQBTE.js → WY2YAJV2.js} +1 -1
  259. package/dist/cdn/{EY52J72L.js → WZT6CYOJ.js} +1 -1
  260. package/dist/cdn/{542RTT6E.js → X4I3726V.js} +2 -2
  261. package/dist/cdn/{XASQJVGW.js → X6AY6CXE.js} +2 -2
  262. package/dist/cdn/{DXF42425.js → XDTSRIUV.js} +4 -4
  263. package/dist/cdn/{OOR7B2NO.js → XGBQUYNN.js} +2 -2
  264. package/dist/cdn/{EWZOYKQ3.js → XM4IJDWV.js} +1 -1
  265. package/dist/cdn/{LGZSANLR.js → XXLQWESJ.js} +2 -2
  266. package/dist/cdn/{6WUBV4EA.js → Y33UFW64.js} +2 -2
  267. package/dist/cdn/{RJBIVLYE.js → Y737Y2JU.js} +2 -2
  268. package/dist/cdn/{2YTLZMHD.js → YHQYMIPA.js} +2 -2
  269. package/dist/cdn/{4QZAEPJT.js → YLMMX2OH.js} +2 -2
  270. package/dist/cdn/YLTGHBKB.js +4 -0
  271. package/dist/cdn/{MG7NQAZZ.js → YMQZBSVF.js} +2 -2
  272. package/dist/cdn/{PIRSNAXE.js → YO3NHOIF.js} +2 -2
  273. package/dist/cdn/{OYEUCIJC.js → YQMCID5Z.js} +2 -2
  274. package/dist/cdn/{QUJW5EU5.js → YT3HXHZX.js} +2 -2
  275. package/dist/cdn/{DUMHFQTN.js → YWSDRWQN.js} +2 -2
  276. package/dist/cdn/{WTSSBTYD.js → YXHUA4CI.js} +2 -2
  277. package/dist/cdn/ZEVGAANR.js +4 -0
  278. package/dist/cdn/{2N2KO565.js → ZFJUFWKG.js} +2 -2
  279. package/dist/cdn/{SOMI2AAW.js → ZGA5KQXP.js} +2 -2
  280. package/dist/cdn/{QBIIXF4H.js → ZPNUYCYC.js} +2 -2
  281. package/dist/cdn/ZRK24AZH.js +4 -0
  282. package/dist/cdn/{ZERUSMWZ.js → ZRPPJQRE.js} +2 -2
  283. package/dist/cdn/{4QMPHBZG.js → ZUSLGKOQ.js} +2 -2
  284. package/dist/cdn/{VQQ5DFPD.js → ZUVIZNK3.js} +2 -2
  285. package/dist/cdn/assets/solution-item-diagram/item-icons/360vr16.svg +1 -0
  286. package/dist/cdn/assets/solution-item-diagram/item-icons/3dobjecttileslayer16.svg +1 -0
  287. package/dist/cdn/assets/solution-item-diagram/item-icons/3dtileslayerpackage16.svg +1 -0
  288. package/dist/cdn/assets/solution-item-diagram/item-icons/addindesktop16.svg +1 -0
  289. package/dist/cdn/assets/solution-item-diagram/item-icons/apacheparquet16.svg +1 -0
  290. package/dist/cdn/assets/solution-item-diagram/item-icons/apps16.svg +1 -0
  291. package/dist/cdn/assets/solution-item-diagram/item-icons/appsgray16.svg +1 -0
  292. package/dist/cdn/assets/solution-item-diagram/item-icons/bigdataanalytics16.svg +69 -0
  293. package/dist/cdn/assets/solution-item-diagram/item-icons/cad16.svg +1 -0
  294. package/dist/cdn/assets/solution-item-diagram/item-icons/catalog16.svg +1 -0
  295. package/dist/cdn/assets/solution-item-diagram/item-icons/classificationschema16.svg +1 -0
  296. package/dist/cdn/assets/solution-item-diagram/item-icons/classifierdefinition16.svg +1 -0
  297. package/dist/cdn/assets/solution-item-diagram/item-icons/codeSnippet16.svg +1 -0
  298. package/dist/cdn/assets/solution-item-diagram/item-icons/csv16.svg +1 -0
  299. package/dist/cdn/assets/solution-item-diagram/item-icons/csvcollection16.svg +1 -0
  300. package/dist/cdn/assets/solution-item-diagram/item-icons/dashboard16.svg +1 -0
  301. package/dist/cdn/assets/solution-item-diagram/item-icons/data16.svg +1 -0
  302. package/dist/cdn/assets/solution-item-diagram/item-icons/dataengineeringmodel16.svg +12 -0
  303. package/dist/cdn/assets/solution-item-diagram/item-icons/dataengineeringworkbook16.svg +5 -0
  304. package/dist/cdn/assets/solution-item-diagram/item-icons/datafiles16.svg +1 -0
  305. package/dist/cdn/assets/solution-item-diagram/item-icons/datafilesgray16.svg +1 -0
  306. package/dist/cdn/assets/solution-item-diagram/item-icons/datapipeline16.svg +1 -0
  307. package/dist/cdn/assets/solution-item-diagram/item-icons/datastore16.svg +1 -0
  308. package/dist/cdn/assets/solution-item-diagram/item-icons/datastorecollection16.svg +1 -0
  309. package/dist/cdn/assets/solution-item-diagram/item-icons/deeplearningpackage16.svg +1 -0
  310. package/dist/cdn/assets/solution-item-diagram/item-icons/deeplearningproject16.svg +1 -0
  311. package/dist/cdn/assets/solution-item-diagram/item-icons/desktopstyle16.svg +1 -0
  312. package/dist/cdn/assets/solution-item-diagram/item-icons/dictionarystyle16.svg +1 -0
  313. package/dist/cdn/assets/solution-item-diagram/item-icons/elevationlayer16.svg +1 -0
  314. package/dist/cdn/assets/solution-item-diagram/item-icons/excaliburimageryproject16.svg +1 -0
  315. package/dist/cdn/assets/solution-item-diagram/item-icons/excel16.svg +1 -0
  316. package/dist/cdn/assets/solution-item-diagram/item-icons/experiencebuilder16.svg +15 -0
  317. package/dist/cdn/assets/solution-item-diagram/item-icons/experiencebuilderwidget16.svg +1 -0
  318. package/dist/cdn/assets/solution-item-diagram/item-icons/experiencebuilderwidgetpackage16.svg +1 -0
  319. package/dist/cdn/assets/solution-item-diagram/item-icons/features16.svg +1 -0
  320. package/dist/cdn/assets/solution-item-diagram/item-icons/featureshosted16.svg +1 -0
  321. package/dist/cdn/assets/solution-item-diagram/item-icons/feed16.svg +126 -0
  322. package/dist/cdn/assets/solution-item-diagram/item-icons/geocodeservice16.svg +1 -0
  323. package/dist/cdn/assets/solution-item-diagram/item-icons/geodataservice16.svg +1 -0
  324. package/dist/cdn/assets/solution-item-diagram/item-icons/geopackage16.svg +1 -0
  325. package/dist/cdn/assets/solution-item-diagram/item-icons/geoprocessingmodel16.svg +1 -0
  326. package/dist/cdn/assets/solution-item-diagram/item-icons/group16.png +0 -0
  327. package/dist/cdn/assets/solution-item-diagram/item-icons/hubevent16.svg +1 -0
  328. package/dist/cdn/assets/solution-item-diagram/item-icons/hubinitiative16.svg +1 -0
  329. package/dist/cdn/assets/solution-item-diagram/item-icons/hubinitiativetemplate16.svg +1 -0
  330. package/dist/cdn/assets/solution-item-diagram/item-icons/hubpage16.svg +1 -0
  331. package/dist/cdn/assets/solution-item-diagram/item-icons/hubproject16.svg +1 -0
  332. package/dist/cdn/assets/solution-item-diagram/item-icons/hubsite16.svg +1 -0
  333. package/dist/cdn/assets/solution-item-diagram/item-icons/image16.svg +1 -0
  334. package/dist/cdn/assets/solution-item-diagram/item-icons/imagecollection16.svg +1 -0
  335. package/dist/cdn/assets/solution-item-diagram/item-icons/imagery16.svg +1 -0
  336. package/dist/cdn/assets/solution-item-diagram/item-icons/indoorpositioningdataservice16.svg +1 -0
  337. package/dist/cdn/assets/solution-item-diagram/item-icons/insightsmodel16.svg +1 -0
  338. package/dist/cdn/assets/solution-item-diagram/item-icons/insightspage16.svg +1 -0
  339. package/dist/cdn/assets/solution-item-diagram/item-icons/insightsscript16.svg +12 -0
  340. package/dist/cdn/assets/solution-item-diagram/item-icons/insightstheme16.svg +1 -0
  341. package/dist/cdn/assets/solution-item-diagram/item-icons/insightsworkbookpackage16.svg +15 -0
  342. package/dist/cdn/assets/solution-item-diagram/item-icons/instantapps16.svg +68 -0
  343. package/dist/cdn/assets/solution-item-diagram/item-icons/integratedmeshtileslayer16.svg +1 -0
  344. package/dist/cdn/assets/solution-item-diagram/item-icons/investigation16.svg +1 -0
  345. package/dist/cdn/assets/solution-item-diagram/item-icons/kernelgatewayconnection16.svg +15 -0
  346. package/dist/cdn/assets/solution-item-diagram/item-icons/key16.svg +1 -0
  347. package/dist/cdn/assets/solution-item-diagram/item-icons/kml16.svg +1 -0
  348. package/dist/cdn/assets/solution-item-diagram/item-icons/knowledgegraph16.svg +1 -0
  349. package/dist/cdn/assets/solution-item-diagram/item-icons/knowledgegraphlayer16.svg +1 -0
  350. package/dist/cdn/assets/solution-item-diagram/item-icons/knowledgestudio16.svg +1 -0
  351. package/dist/cdn/assets/solution-item-diagram/item-icons/layergroup16.svg +1 -0
  352. package/dist/cdn/assets/solution-item-diagram/item-icons/layergroup2d16.svg +1 -0
  353. package/dist/cdn/assets/solution-item-diagram/item-icons/layergroup3d16.svg +1 -0
  354. package/dist/cdn/assets/solution-item-diagram/item-icons/layers16.svg +1 -0
  355. package/dist/cdn/assets/solution-item-diagram/item-icons/layersfeatures16.svg +1 -0
  356. package/dist/cdn/assets/solution-item-diagram/item-icons/layersfeatureshosted16.svg +1 -0
  357. package/dist/cdn/assets/solution-item-diagram/item-icons/layersgray16.svg +1 -0
  358. package/dist/cdn/assets/solution-item-diagram/item-icons/linkchart16.svg +44 -0
  359. package/dist/cdn/assets/solution-item-diagram/item-icons/livestreamvideolayer16.svg +1 -0
  360. package/dist/cdn/assets/solution-item-diagram/item-icons/mapimages16.svg +1 -0
  361. package/dist/cdn/assets/solution-item-diagram/item-icons/maps16.svg +1 -0
  362. package/dist/cdn/assets/solution-item-diagram/item-icons/mapsgray16.svg +1 -0
  363. package/dist/cdn/assets/solution-item-diagram/item-icons/maptiles16.svg +1 -0
  364. package/dist/cdn/assets/solution-item-diagram/item-icons/marketplace16.svg +1 -0
  365. package/dist/cdn/assets/solution-item-diagram/item-icons/markup16.svg +1 -0
  366. package/dist/cdn/assets/solution-item-diagram/item-icons/medialayer16.svg +1 -0
  367. package/dist/cdn/assets/solution-item-diagram/item-icons/mediaservice16.svg +1 -0
  368. package/dist/cdn/assets/solution-item-diagram/item-icons/mission16.svg +1 -0
  369. package/dist/cdn/assets/solution-item-diagram/item-icons/missionreport16.svg +1 -0
  370. package/dist/cdn/assets/solution-item-diagram/item-icons/mobilescenepackage16.svg +1 -0
  371. package/dist/cdn/assets/solution-item-diagram/item-icons/nativeapp16.svg +3 -0
  372. package/dist/cdn/assets/solution-item-diagram/item-icons/nativeappinstaller16.svg +15 -0
  373. package/dist/cdn/assets/solution-item-diagram/item-icons/notebook16.svg +11 -0
  374. package/dist/cdn/assets/solution-item-diagram/item-icons/notebookcodesnippets16.svg +3 -0
  375. package/dist/cdn/assets/solution-item-diagram/item-icons/orthomappingproject16.svg +1 -0
  376. package/dist/cdn/assets/solution-item-diagram/item-icons/orthomappingtemplate16.svg +1 -0
  377. package/dist/cdn/assets/solution-item-diagram/item-icons/pdf16.svg +1 -0
  378. package/dist/cdn/assets/solution-item-diagram/item-icons/powerpoint16.svg +1 -0
  379. package/dist/cdn/assets/solution-item-diagram/item-icons/premiumcontent16.svg +1 -0
  380. package/dist/cdn/assets/solution-item-diagram/item-icons/premiumcredits16.svg +1 -0
  381. package/dist/cdn/assets/solution-item-diagram/item-icons/premiumitem16.svg +1 -0
  382. package/dist/cdn/assets/solution-item-diagram/item-icons/propresentation16.svg +1 -0
  383. package/dist/cdn/assets/solution-item-diagram/item-icons/proproject16.svg +41 -0
  384. package/dist/cdn/assets/solution-item-diagram/item-icons/proreport16.svg +47 -0
  385. package/dist/cdn/assets/solution-item-diagram/item-icons/quickcaptureproject16.svg +1 -0
  386. package/dist/cdn/assets/solution-item-diagram/item-icons/rasterprocessingtemplate16.svg +1 -0
  387. package/dist/cdn/assets/solution-item-diagram/item-icons/realitymappingproject16.svg +1 -0
  388. package/dist/cdn/assets/solution-item-diagram/item-icons/realtimeanalytics16.svg +61 -0
  389. package/dist/cdn/assets/solution-item-diagram/item-icons/relationaldatabaseconnection16.svg +1 -0
  390. package/dist/cdn/assets/solution-item-diagram/item-icons/report16.svg +1 -0
  391. package/dist/cdn/assets/solution-item-diagram/item-icons/reporttemplate16.svg +1 -0
  392. package/dist/cdn/assets/solution-item-diagram/item-icons/routelayer16.svg +1 -0
  393. package/dist/cdn/assets/solution-item-diagram/item-icons/scenepackage16.svg +1 -0
  394. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayer16.svg +1 -0
  395. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayerbuilding16.svg +85 -0
  396. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayerline16.svg +1 -0
  397. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayermesh16.svg +1 -0
  398. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayermultipatch16.svg +1 -0
  399. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayerpoint16.svg +1 -0
  400. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayerpointcloud16.svg +1 -0
  401. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayerpolygon16.svg +1 -0
  402. package/dist/cdn/assets/solution-item-diagram/item-icons/sceneweblayervoxel16.svg +1 -0
  403. package/dist/cdn/assets/solution-item-diagram/item-icons/shapefile16.svg +1 -0
  404. package/dist/cdn/assets/solution-item-diagram/item-icons/solutions16.svg +1 -0
  405. package/dist/cdn/assets/solution-item-diagram/item-icons/spatiotemporal16.svg +1 -0
  406. package/dist/cdn/assets/solution-item-diagram/item-icons/spatiotemporaltable16.svg +1 -0
  407. package/dist/cdn/assets/solution-item-diagram/item-icons/sqlite16.svg +1 -0
  408. package/dist/cdn/assets/solution-item-diagram/item-icons/statisticaldatacollection16.svg +1 -0
  409. package/dist/cdn/assets/solution-item-diagram/item-icons/storymap16.svg +1 -0
  410. package/dist/cdn/assets/solution-item-diagram/item-icons/storymapbriefing16.svg +1 -0
  411. package/dist/cdn/assets/solution-item-diagram/item-icons/storymapcollection16.svg +1 -0
  412. package/dist/cdn/assets/solution-item-diagram/item-icons/storymapstemplate16.svg +1 -0
  413. package/dist/cdn/assets/solution-item-diagram/item-icons/storymaptheme16.svg +1 -0
  414. package/dist/cdn/assets/solution-item-diagram/item-icons/streamlayer16.svg +1 -0
  415. package/dist/cdn/assets/solution-item-diagram/item-icons/style16.svg +1 -0
  416. package/dist/cdn/assets/solution-item-diagram/item-icons/suitabilitymodel16.svg +1 -0
  417. package/dist/cdn/assets/solution-item-diagram/item-icons/survey123addin16.svg +1 -0
  418. package/dist/cdn/assets/solution-item-diagram/item-icons/survey16.svg +1 -0
  419. package/dist/cdn/assets/solution-item-diagram/item-icons/table16.svg +1 -0
  420. package/dist/cdn/assets/solution-item-diagram/item-icons/taskfile16.svg +1 -0
  421. package/dist/cdn/assets/solution-item-diagram/item-icons/tiledimagerylayer16.svg +1 -0
  422. package/dist/cdn/assets/solution-item-diagram/item-icons/tilepackage16.svg +1 -0
  423. package/dist/cdn/assets/solution-item-diagram/item-icons/tool16.svg +1 -0
  424. package/dist/cdn/assets/solution-item-diagram/item-icons/toolsgray16.svg +1 -0
  425. package/dist/cdn/assets/solution-item-diagram/item-icons/urbanmodel16.svg +120 -0
  426. package/dist/cdn/assets/solution-item-diagram/item-icons/urbanproject16.svg +5 -0
  427. package/dist/cdn/assets/solution-item-diagram/item-icons/utilitynetwork16.svg +1 -0
  428. package/dist/cdn/assets/solution-item-diagram/item-icons/vectortile16.svg +1 -0
  429. package/dist/cdn/assets/solution-item-diagram/item-icons/vectortilefile16.svg +1 -0
  430. package/dist/cdn/assets/solution-item-diagram/item-icons/vectortilepackage16.svg +1 -0
  431. package/dist/cdn/assets/solution-item-diagram/item-icons/webexperiencetemplate16.svg +19 -0
  432. package/dist/cdn/assets/solution-item-diagram/item-icons/websceneglobal16.svg +1 -0
  433. package/dist/cdn/assets/solution-item-diagram/item-icons/webscenelocal16.svg +1 -0
  434. package/dist/cdn/assets/solution-item-diagram/item-icons/wfsogcoptions16.svg +1 -0
  435. package/dist/cdn/assets/solution-item-diagram/item-icons/word16.svg +1 -0
  436. package/dist/cdn/assets/solution-item-diagram/item-icons/workbook16.svg +1 -0
  437. package/dist/cdn/assets/solution-item-diagram/item-icons/workflow16.svg +1 -0
  438. package/dist/cdn/assets/solution-item-diagram/t9n/messages.en.json +1 -0
  439. package/dist/cdn/assets/solution-item-diagram/t9n/messages.json +1 -0
  440. package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.en.json +1 -1
  441. package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.json +1 -1
  442. package/dist/cdn/index.js +2 -2
  443. package/dist/cdn/main.css +1 -1
  444. package/dist/chunks/Auth.js +1 -1
  445. package/dist/chunks/appConfig.js +1 -1
  446. package/dist/chunks/cardFetchingUtils.js +1 -1
  447. package/dist/chunks/common.js +1 -1
  448. package/dist/chunks/deployAppContexts.js +1 -1
  449. package/dist/chunks/downloadUtils.js +1 -1
  450. package/dist/chunks/helpers.js +1 -1
  451. package/dist/chunks/index.js +1 -1
  452. package/dist/chunks/interfaces.js +1 -1
  453. package/dist/chunks/loadModules.js +1 -1
  454. package/dist/chunks/mapViewUtils.js +1 -1
  455. package/dist/chunks/pciUtils.js +1 -1
  456. package/dist/chunks/popupUtils.js +1 -1
  457. package/dist/chunks/privilegeUtils.js +1 -1
  458. package/dist/chunks/publicNotificationStore.js +1 -1
  459. package/dist/chunks/queryUtils.js +1 -1
  460. package/dist/chunks/runtime.js +3 -3
  461. package/dist/chunks/solution-store.js +1 -1
  462. package/dist/chunks/templates.js +1 -1
  463. package/dist/chunks/useT9n.js +1 -1
  464. package/dist/components/arcgis-solutions-assistant/customElement.js +1 -1
  465. package/dist/components/basemap-gallery/customElement.js +1 -1
  466. package/dist/components/buffer-tools/customElement.js +1 -1
  467. package/dist/components/card-manager/customElement.js +1 -1
  468. package/dist/components/consent-manager/customElement.js +1 -1
  469. package/dist/components/create-feature/customElement.d.ts +6 -0
  470. package/dist/components/create-feature/customElement.js +12 -11
  471. package/dist/components/create-related-feature/customElement.js +1 -1
  472. package/dist/components/crowdsource-manager/customElement.js +1 -1
  473. package/dist/components/crowdsource-reporter/customElement.js +1 -1
  474. package/dist/components/deduct-calculator/customElement.js +1 -1
  475. package/dist/components/delete-button/customElement.js +1 -1
  476. package/dist/components/delete-dialog/customElement.js +1 -1
  477. package/dist/components/edit-card/customElement.js +1 -1
  478. package/dist/components/feature-details/customElement.js +1 -1
  479. package/dist/components/feature-list/customElement.js +1 -1
  480. package/dist/components/field-selection/customElement.js +1 -1
  481. package/dist/components/floor-filter/customElement.js +1 -1
  482. package/dist/components/info-card/customElement.js +1 -1
  483. package/dist/components/json-editor/customElement.js +1 -1
  484. package/dist/components/layer-list/customElement.js +1 -1
  485. package/dist/components/layer-table/customElement.js +6 -3
  486. package/dist/components/map-card/customElement.js +1 -1
  487. package/dist/components/map-draw-tools/customElement.js +1 -1
  488. package/dist/components/map-fullscreen/customElement.js +1 -1
  489. package/dist/components/map-layer-picker/customElement.js +1 -1
  490. package/dist/components/map-legend/customElement.js +1 -1
  491. package/dist/components/map-picker/customElement.js +1 -1
  492. package/dist/components/map-search/customElement.js +1 -1
  493. package/dist/components/map-select-tools/customElement.js +1 -1
  494. package/dist/components/map-tools/customElement.js +1 -1
  495. package/dist/components/pci-calculator/customElement.js +1 -1
  496. package/dist/components/pdf-download/customElement.js +1 -1
  497. package/dist/components/public-notification/customElement.js +1 -1
  498. package/dist/components/refine-selection/customElement.js +1 -1
  499. package/dist/components/selection-tool/customElement.js +1 -1
  500. package/dist/components/solution-article-card/customElement.js +1 -1
  501. package/dist/components/solution-configuration/customElement.js +1 -1
  502. package/dist/components/solution-configure-dialog/customElement.js +1 -1
  503. package/dist/components/solution-configure-titles/customElement.js +1 -1
  504. package/dist/components/solution-contents/customElement.js +1 -1
  505. package/dist/components/solution-delete-dialog/customElement.js +22 -22
  506. package/dist/components/solution-deploy-dialog/customElement.js +1 -1
  507. package/dist/components/solution-deployed-card/customElement.d.ts +1 -0
  508. package/dist/components/solution-deployed-card/customElement.js +85 -26
  509. package/dist/components/solution-deployed-card/index.d.ts +2 -0
  510. package/dist/components/solution-deployed-card/index.js +2 -0
  511. package/dist/components/solution-deploying-panel/customElement.js +1 -1
  512. package/dist/components/solution-details-card/customElement.js +1 -1
  513. package/dist/components/solution-details-panel/customElement.js +1 -1
  514. package/dist/components/solution-item/customElement.js +1 -1
  515. package/dist/components/solution-item-accordion/customElement.js +1 -1
  516. package/dist/components/solution-item-details/customElement.js +1 -1
  517. package/dist/components/solution-item-diagram/customElement.d.ts +9 -0
  518. package/dist/components/solution-item-diagram/customElement.js +918 -0
  519. package/dist/components/solution-item-diagram/index.d.ts +4 -0
  520. package/dist/components/solution-item-diagram/index.js +4 -0
  521. package/dist/components/solution-item-diagram/utils/SolutionDisplay.d.ts +122 -0
  522. package/dist/components/solution-item-diagram/utils/getItemIcon.d.ts +26 -0
  523. package/dist/components/solution-item-diagram/utils/prepareDataForSolutionDisplay.d.ts +27 -0
  524. package/dist/components/solution-item-diagram/utils/solutionGraph.d.ts +125 -0
  525. package/dist/components/solution-item-icon/customElement.js +1 -1
  526. package/dist/components/solution-item-sharing/customElement.js +1 -1
  527. package/dist/components/solution-organization-variables/customElement.js +1 -1
  528. package/dist/components/solution-resource-item/customElement.js +1 -1
  529. package/dist/components/solution-snapshot-gallery/customElement.js +1 -1
  530. package/dist/components/solution-spatial-ref/customElement.js +1 -1
  531. package/dist/components/solution-template-data/customElement.js +1 -1
  532. package/dist/components/solution-variables/customElement.js +1 -1
  533. package/dist/components/solutions-all-panel/customElement.js +1 -1
  534. package/dist/components/solutions-all-shell/customElement.js +1 -1
  535. package/dist/components/solutions-article-panel/customElement.js +1 -1
  536. package/dist/components/solutions-articles/customElement.js +1 -1
  537. package/dist/components/solutions-articles-shell/customElement.js +1 -1
  538. package/dist/components/solutions-deployed-panel/customElement.d.ts +2 -0
  539. package/dist/components/solutions-deployed-panel/customElement.js +35 -22
  540. package/dist/components/solutions-deployed-panel/index.d.ts +1 -0
  541. package/dist/components/solutions-deployed-panel/index.js +1 -0
  542. package/dist/components/solutions-deployed-shell/customElement.js +1 -1
  543. package/dist/components/solutions-filter-panel/customElement.js +1 -1
  544. package/dist/components/spatial-ref/customElement.js +1 -1
  545. package/dist/components/store-manager/customElement.js +1 -1
  546. package/dist/docs/api.json +126 -63
  547. package/dist/docs/docs.json +126 -59
  548. package/dist/docs/vscode.html-custom-data.json +12 -7
  549. package/dist/docs/web-types.json +31 -12
  550. package/dist/index.d.ts +5 -5
  551. package/dist/index.js +1 -1
  552. package/dist/loader.js +4 -4
  553. package/dist/types/lumina.d.ts +6 -6
  554. package/dist/types/preact.d.ts +7 -7
  555. package/dist/types/react.d.ts +8 -8
  556. package/dist/types/stencil.d.ts +6 -6
  557. package/package.json +3 -1
  558. package/dist/cdn/34VGLVS5.js +0 -18
  559. package/dist/cdn/D66XSD5Y.js +0 -4
  560. package/dist/cdn/EJLW4JV3.js +0 -4
  561. package/dist/cdn/H22IKHML.js +0 -18
  562. package/dist/cdn/IQO7KVU5.js +0 -4
  563. package/dist/cdn/KYK2XITJ.js +0 -18
  564. package/dist/cdn/MHE3733S.js +0 -4
  565. package/dist/cdn/O26ML2SO.js +0 -18
  566. package/dist/cdn/O6DP3IP7.js +0 -4
  567. package/dist/cdn/RYNALENB.js +0 -4
  568. package/dist/cdn/SSAXEWTS.js +0 -4
  569. package/dist/cdn/TBIDLSGQ.js +0 -18
  570. package/dist/cdn/WAYFDZQA.js +0 -4
  571. package/dist/cdn/WF74JSAD.js +0 -4
  572. package/dist/cdn/assets/solution-items-diagram/t9n/messages.en.json +0 -1
  573. package/dist/cdn/assets/solution-items-diagram/t9n/messages.json +0 -1
  574. package/dist/components/solution-items-diagram/customElement.d.ts +0 -5
  575. package/dist/components/solution-items-diagram/customElement.js +0 -44
  576. package/dist/components/solution-items-diagram/index.d.ts +0 -2
  577. package/dist/components/solution-items-diagram/index.js +0 -2
@@ -0,0 +1,89 @@
1
+ /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
+ See https://js.arcgis.com/1.0/esri/copyright.txt for details.
3
+ v1.0.0 */
4
+ import{a as Zs,b as Qs}from"./DUVNOIA7.js";import{a as Zn}from"./IXJEV6RS.js";import{D as Jn,c as qn,d as Hn,p as Wn,y as $n}from"./ZGA5KQXP.js";import"./PLASWOCJ.js";(function(){let A=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};A.requestAnimationFrame===void 0&&(A.setImmediate===void 0?A.requestAnimationFrame=x=>A.setTimeout(x,0):A.requestAnimationFrame=A.setImmediate);class f{static tr=A.navigator!==void 0&&A.navigator.platform!==void 0&&A.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static Rk(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&f.Tg(s),s=f.ir(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static ir(t,e){return A.setTimeout(t,e)}static Tg(t){A.clearTimeout(t)}static hs(t){return A.document.createElement(t)}static o(t){throw new Error(t)}static L(t,e){let i="The object is frozen, so its properties cannot be set: "+t.toString();e!==void 0&&(i+=" to value: "+e),f.o(i)}static dE(t,e,i,s){}static s(t,e,i,s){}static gE(t,e,i){}static ec(t,e,i){if(t===null||typeof t!="object"){let s=f.uC(e);i!==void 0&&(s+="."+i),f.Zi(t,"object",s)}}static k(t,e,i){f.s(t,"function",e,i)}static mE(t,e,i){}static Zi(t,e,i,s){}static W(t,e,i,s){let n=f.uC(i);s!==void 0&&(n+="."+s),f.o(n+" is not in the range "+e+": "+t)}static Re(t){}static er(t,e){}static ni(t){A.console&&A.console.log(t)}static Y(t){return t!==null&&typeof t=="object"}static it(t){return typeof t=="function"}static vk=[];static et(){let t=f.vk.pop();return t===void 0?[]:t}static J(t){t.length=0,f.vk.push(t)}static pE=Object.freeze([]);static uC(t){return t===null?"*":typeof t=="string"?t:f.it(t)?t.name:""}static Dn(t){return f.it(t)?t.className?t.className:t.name:f.Y(t)&&t.constructor?f.Dn(t.constructor):typeof t}static Uh(t,e){return e==null||e===""?null:f.Y(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return f.Y(t)&&(t.text?e=t.text:t.name?e=t.name:t.key!==void 0?e=t.key:t.id!==void 0?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:t.Key!==void 0?e=t.Key:t.Id!==void 0?e=t.Id:t.ID!==void 0&&(e=t.ID))),e===void 0?"undefined":e===null?"null":e.toString()}static dw(t,e){if(t.hasOwnProperty(e))return!0;let i=Object.getPrototypeOf(t);for(;i&&i!==Function;){if(i.hasOwnProperty(e))return!0;let s=i.yE;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static WD(t){let e=[],i=0;for(i=0;i<256;i++)e[i]=i;let s=0,n=0;for(i=0;i<256;i++)s=(s+e[i]+119)%256,n=e[i],e[i]=e[s],e[s]=n;i=0,s=0;let o="";for(let r=0;r<t.length;r++)i=(i+1)%256,s=(s+e[i])%256,n=e[i],e[i]=e[s],e[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^e[(e[i]+e[s])%256]);return o}static JD(t){let e="0123456789abcdef",i=[];for(let r=0;r<256;r++)i[e.charAt(r>>4)+e.charAt(r&15)]=String.fromCharCode(r);t.length%2&&(t="0"+t);let s=[],n=0;for(let r=0;r<t.length;r+=2)s[n++]=i[t.substring(r,r+2)];let o=s.join("");return o===""?"0":o}static Ts(t){return f.WD(f.JD(t))}static color1="@COLOR1";static color2="@COLOR2";static gw="32ab5ff3b26f42dc0ed90f21412913b5"}f.vfo="29e646fdb165";class V{Ok;constructor(){this.Ok=[]}toString(){return this.Ok.join("")}add(t){t!==""&&this.Ok.push(t)}}class K{}class W{g;constructor(){this.g=[]}[Symbol.iterator](){return this.g.values()}key;value;get iterator(){return this}reset(){}next(){return!1}hasNext(){return!1}first(){return null}any(){return!1}all(){return!0}each(){return this}map(t){return this}filter(){return this}get count(){return 0}ul(){}toString(){return"EmptyIterator"}static instance=new W}class ${constructor(t){this.key=-1,this.value=t}[Symbol.iterator](){return[this.value].values()}key;value;get iterator(){return this}reset(){this.key=-1}next(){return this.key===-1?(this.key=0,!0):!1}hasNext(){return this.next()}first(){return this.key=0,this.value}any(t){return this.key=-1,t(this.value)}all(t){return this.key=-1,t(this.value)}each(t){return this.key=-1,t(this.value),this}map(t){return new $(t(this.value))}filter(t){return t(this.value)?new $(this.value):W.instance}get count(){return 1}ul(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class it{qt;Ds;Yt;At;constructor(t){this.qt=t,this.Ds=null,t.sr=null,this.Yt=t.nt,this.At=-1}[Symbol.iterator](){return this.Ds===null?this.qt.r.values():this.qt.r.filter(this.Ds).values()}key;value;get iterator(){return this}get predicate(){return this.Ds}set predicate(t){this.Ds=t}reset(){let t=this.qt;t.sr=null,this.Yt=t.nt,this.At=-1}next(){let t=this.qt;if(t.nt!==this.Yt){if(this.key<0)return!1;f.Re(t)}let e=t.r,i=e.length,s=++this.At,n=this.Ds;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.At=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.ul()}return!1}hasNext(){return this.next()}first(){let t=this.qt;this.Yt=t.nt,this.At=0;let e=t.r,i=e.length,s=this.Ds;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.At=n,this.key=n,this.value=o,o;n++}return null}else if(i>0){let n=e[0];return this.key=0,this.value=n,n}else return null}any(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.nt!==i&&f.Re(e)}}return!1}all(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.nt!==i&&f.Re(e)}}return!0}each(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.nt!==i&&f.Re(e))}return this}map(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.nt!==i&&f.Re(e))}let a=new G;return a.r=s,a.ve(),a.iterator}filter(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.nt!==i&&f.Re(e))}let a=new G;return a.r=s,a.ve(),a.iterator}get count(){let t=this.Ds;if(t!==null){let e=0,i=this.qt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Yt=-1,this.Ds=null,this.qt.sr=this}toString(){return"ListIterator@"+this.At+"/"+this.qt.count}}class ht{qt;Yt;At;constructor(t){this.qt=t,t.nr=null,this.Yt=t.nt,this.At=t.r.length}[Symbol.iterator](){return this.qt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.qt;t.nr=null,this.Yt=t.nt,this.At=t.r.length}next(){let t=this.qt;if(t.nt!==this.Yt){if(this.key<0)return!1;f.Re(t)}let e=--this.At;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.ul(),!1)}hasNext(){return this.next()}first(){let t=this.qt;this.Yt=t.nt;let e=t.r,i=e.length-1;if(this.At=i,i>=0){let s=e[i];return this.key=i,this.value=s,s}else return null}any(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.nt!==i&&f.Re(e)}return!1}all(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.nt!==i&&f.Re(e)}return!0}each(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.nt!==i&&f.Re(e)}return this}map(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.nt!==i&&f.Re(e)}let r=new G;return r.r=s,r.ve(),r.iterator}filter(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.nt!==i&&f.Re(e)}let r=new G;return r.r=s,r.ve(),r.iterator}get count(){return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Yt=-1,this.qt.nr=this}toString(){return"ListIteratorBackwards("+this.At+"/"+this.qt.count+")"}}class G{h;r;nt;sr;nr;constructor(t){I.Ki(this),this.h=!1,this.r=[],this.nt=0,this.sr=null,this.nr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}ve(){let t=this.nt;t++,t>999999999&&(t=0),this.nt=t}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"List()#"+I.as(this)}add(t){return this.h&&f.L(this,t),this.r.push(t),this.ve(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.h&&f.L(this);let e=this.r;if(Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e.push(n)}}else{let i=t.iterator;for(;i.next();){let s=i.value;e.push(s)}}return this.ve(),this}clear(){this.h&&f.L(this),this.r.length=0,this.ve()}contains(t){return this.has(t)}has(t){return t===null?!1:this.r.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.r.indexOf(t)}elt(t){let e=this.r;return(t<0||t>=e.length)&&f.W(t,"0 <= i < length",G,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&f.W(t,"0 <= i < length",G,"setElt:i"),this.h&&f.L(this,t),i[t]=e}set(t,e){this.setElt(t,e)}first(){let t=this.r;return t.length===0?null:t[0]}last(){let t=this.r,e=t.length;return e>0?t[e-1]:null}pop(){this.h&&f.L(this);let t=this.r;return t.length>0?t.pop():null}any(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.nt!==i&&f.Re(this)}return!1}all(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.nt!==i&&f.Re(this)}return!0}each(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.nt!==i&&f.Re(this);return this}map(t){let e=new G,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.nt!==n&&f.Re(this);return e.r=i,e.ve(),e}filter(t){let e=new G,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.nt!==n&&f.Re(this)}return e.r=i,e.ve(),e}insertAt(t,e){t<0&&f.W(t,">= 0",G,"insertAt:i"),this.h&&f.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.ve()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.h&&f.L(this,t);let e=this.r,i=e.indexOf(t);return i===-1?!1:(i===e.length-1?e.pop():e.splice(i,1),this.ve(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&f.W(t,"0 <= i < length",G,"removeAt:i"),this.h&&f.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.ve()}removeRange(t,e){let i=this.r,s=i.length;if(t<0)t=0;else if(t>=s)return this;if(e<0)return this;if(e>=s&&(e=s-1),t>e)return this;this.h&&f.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.ve(),this}copy(){let t=new G,e=this.r;return e.length>0&&(t.r=Array.prototype.slice.call(e)),t}toArray(){let t=this.r,e=this.count,i=new Array(e);for(let s=0;s<e;s++)i[s]=t[s];return i}get dC(){return this.r}toSet(){let t=new I,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.h&&f.L(this),this.r.sort(t),this.ve(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.h&&f.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&f.W(e,"0 <= from < length",G,"sortRange:from"),o===2){let r=s[e],a=s[e+1];return t(r,a)>0&&(s[e]=a,s[e+1]=r,this.ve()),this}if(e===0)if(i>=n)s.sort(t);else{let r=s.slice(0,i);r.sort(t);for(let a=0;a<i;a++)s[a]=r[a]}else if(i>=n){let r=s.slice(e);r.sort(t);for(let a=e;a<n;a++)s[a]=r[a-e]}else{let r=s.slice(e,i);r.sort(t);for(let a=e;a<i;a++)s[a]=r[a-e]}return this.ve(),this}reverse(){return this.h&&f.L(this),this.r.reverse(),this.ve(),this}get count(){return this.r.length}get size(){return this.r.length}get length(){return this.r.length}get iterator(){if(this.r.length<=0)return W.instance;let t=this.sr;return t!==null?(t.reset(),t):new it(this)}get iteratorBackwards(){if(this.r.length<=0)return W.instance;let t=this.nr;return t!==null?(t.reset(),t):new ht(this)}}class Tt{wo;ii;constructor(t){this.wo=t,this.ii=t.g.values()}[Symbol.iterator](){return this.wo.g.values()}key;value;get iterator(){return this}reset(){let t=this.wo;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.wo.g.size===0?null:(this.ii=this.wo.g.values(),this.ii.next().value)}any(t){return this.wo.any(t)}all(t){return this.wo.all(t)}each(t){return this.wo.each(t),this}map(t){let e=new G;return this.wo.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new G;return this.wo.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.wo.count}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"SetIterator"}}class I{h;g;constructor(t){this.h=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"Set()#"+I.as(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s!==null&&this.g.add(s)}}else{let e=t.iterator;for(;e.next();){let i=e.value;i!==null&&this.g.add(i)}}return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1;return!0}containsAny(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0;return!1}first(){return this.g.size===0?null:this.g.values().next().value}any(t){for(let e of this.g)if(t(e))return!0;return!1}all(t){for(let e of this.g)if(!t(e))return!1;return!0}each(t){for(let e of this.g)t(e);return this}map(t){let e=new I;for(let i of this.g)e.add(t(i));return e}filter(t){let e=new I;for(let i of this.g)t(i)&&e.add(i);return e}delete(t){return this.h&&f.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.delete(t[i])}else{let e=t.iterator;for(;e.next();)this.delete(e.value)}return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.h&&f.L(this);let e=new I;e.addAll(t);let i=[],s=this.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}return this.removeAll(i),this}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new I;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){let t=new G;return this.g.forEach(e=>t.add(e)),t}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Tt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static mw=1;static Ki(t){t.__gohashid=I.mw++}static as(t){return t.__gohashid}}class Rt{q;ii;constructor(t){this.q=t,this.ii=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.keys()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.keys(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=this.q,i=new G;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.q,i=new G;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapKeySetIterator"}}class he extends I{q;constructor(t){super(),I.Ki(this),this.h=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}u(){return this}Nt(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){f.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){f.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){f.o("This Set is read-only: "+this.toString())}first(){return this.q.g.size===0?null:this.q.g.keys().next().value}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=new I;for(let i of this.q.g)e.add(t(i[0]));return e}filter(t){let e=new I;for(let i of this.q.g){let s=i[0];t(s)&&e.add(s)}return e}copy(){return new he(this.q)}toSet(){let t=new I,e=this.q.g;for(let i of e)t.add(i[0]);return t}toArray(){let t=this.q.g,e=new Array(t.size),i=0;for(let s of t)e[i]=s[0],i++;return e}toList(){let t=new G,e=this.q.g;for(let i of e)t.add(i[0]);return t}get count(){return this.q.size}get size(){return this.q.size}get iterator(){return this.q.size<=0?W.instance:new Rt(this.q)}}class Oe{q;ii;constructor(t){this.q=t,this.ii=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.values(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[1]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[1]))return!1;return!0}each(t){for(let e of this.q.g)t(e[1]);return this}map(t){let e=this.q,i=new G;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.q,i=new G;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapValueSetIterator"}}class Ut{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class Wt{q;ii;constructor(t){this.q=t,this.ii=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.entries()}next(){let t=this.ii.next();return t.done?(this.key=null,this.value=null,!1):(this.key=t.value[0],this.value=t.value[1],!0)}hasNext(){return this.next()}first(){if(this.q.g.size===0)return null;this.ii=this.q.g.entries();let t=this.ii.next().value;return this.key=t[0],this.value=t[1],new Ut(t[0],t[1])}any(t){return this.q.any(t)}all(t){return this.q.all(t)}each(t){return this.q.each(t),this}map(t){let e=new G,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new G,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapIterator"}}class pt{h;g;constructor(t){I.Ki(this),this.h=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}u(){return this.h=!0,this}Nt(){return this.h=!1,this}toString(){return"Map()#"+I.as(this)}set(t,e){return this.h&&f.L(this,t),this.g.set(t,e),this}add(t,e){return this.set(t,e)}addAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];this.set(s.key,s.value)}}else if(t instanceof pt){let e=t.iterator;for(;e.next();)this.set(e.key,e.value)}else{let e=t.iterator;for(;e.next();){let i=e.value;this.set(i.key,i.value)}}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return new Ut(t[0],t[1])}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e))return!0;return!1}all(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),!t(e))return!1;return!0}each(t){let e=null;for(let[i,s]of this.g)e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),t(i)&&e.set(s,n);return e}has(t){return this.g.has(t)}contains(t){return this.has(t)}get(t){let e=this.g.get(t);return e===void 0?null:e}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.h&&f.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new pt;return t.g=new Map(this.g),t}toArray(){let t=this.g,e=new Array(t.size),i=0;for(let s of t)e[i]=new Ut(s[0],s[1]),i++;return e}toKeySet(){return new he(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Wt(this)}get iteratorKeys(){return this.count<=0?W.instance:new Rt(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?W.instance:new Oe(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;h;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):f.o("Invalid arguments to Point constructor: "+t+", "+e),this.h=!1}a(t){return this.px=t.px,this.py=t.py,this}i(t,e){return this.px=t,this.py=e,this}setTo(t,e){return this.px=t,this.py=e,this}set(t){return this.px=t.px,this.py=t.py,this}copy(){let t=new P;return t.px=this.px,t.py=this.py,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new P(s,o)}else return new P}static stringify(t){return t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return f.s(t,"number",P,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)}toString(){return"Point("+this.x+","+this.y+")"}equals(t){return t instanceof P?this.px===t.x&&this.py===t.y:!1}equalTo(t,e){return this.px===t&&this.py===e}equalsApprox(t){return L.f(this.px,t.x)&&L.f(this.py,t.y)}add(t){return this.px+=t.x,this.py+=t.y,this}subtract(t){return this.px-=t.x,this.py-=t.y,this}offset(t,e){return this.px+=t,this.py+=e,this}rotate(t){if(t===0)return this;let e=this.px,i=this.py;if(e===0&&i===0)return this;let s=0,n=0;if(t>=360?t-=360:t<0&&(t+=360),t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let o=t*Math.PI/180;s=Math.cos(o),n=Math.sin(o)}return this.px=s*e-n*i,this.py=n*e+s*i,this}scale(t,e){return this.px*=t,this.py*=e,this}distanceSquaredPoint(t){let e=t.x-this.px,i=t.y-this.py;return e*e+i*i}distanceSquared(t,e){let i=t-this.px,s=e-this.py;return i*i+s*s}normalize(){let t=this.px,e=this.py,i=Math.sqrt(t*t+e*e);return i>0&&(this.px=t/i,this.py=e/i),this}directionPoint(t){return this.gC(t.x-this.px,t.y-this.py)}direction(t,e){return this.gC(t-this.px,e-this.py)}gC(t,e){if(t===0)return e>0?90:e<0?270:0;if(e===0)return t>0?0:180;{if(isNaN(t)||isNaN(e))return 0;let i=Math.atan(Math.abs(e/t))*180/Math.PI;return t<0?e<0?i+=180:i=180-i:e<0&&(i=360-i),i}}static compareWithLineSegment(t,e,i,s,n,o){return L.eu(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return L.eu(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return L.su(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return L.dl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return L.dl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return L.Dg(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return L.Dg(this.px,this.py,t.x,t.y,e.width,e.height,this),this}setRectSpot(t,e){return this.px=t.x+e.x*t.width+e.offsetX,this.py=t.y+e.y*t.height+e.offsetY,this}setSpot(t,e,i,s,n){return this.px=t+n.x*i+n.offsetX,this.py=e+n.y*s+n.offsetY,this}T(t){return t.gt(this),this}Oe(t){return t.$e(this),this}static distanceLineSegmentSquared(t,e,i,s,n,o){let r=n-i,a=o-s,h=r*r+a*a,l=i-t,c=s-e,u=-l*r-c*a;if(u<=0||u>=h)return r=n-t,a=o-e,Math.min(l*l+c*c,r*r+a*a);{let d=r*c-a*l;return d*d/h}}static distanceSquared(t,e,i,s){let n=i-t,o=s-e;return n*n+o*o}static direction(t,e,i,s){let n=i-t,o=s-e;if(n===0)return o>0?90:o<0?270:0;if(o===0)return n>0?0:180;{if(isNaN(n)||isNaN(o))return 0;let r=Math.atan(Math.abs(o/n))*180/Math.PI;return n<0?o<0?r+=180:r=180-r:o<0&&(r=360-r),r}}get x(){return this.px}set x(t){this.px=t}get y(){return this.py}set y(t){this.py=t}isReal(){return isFinite(this.x)&&isFinite(this.y)}static xo=new P(0,0).$();static mC=new P(-1/0,-1/0).$();static pC=new P(1/0,1/0).$();static yC=new P(6,6).$();static Ik=new P(NaN,NaN).$();static Ek=[];static l(){let t=P.Ek.pop();return t===void 0?new P:t}static V(t,e){let i=P.Ek.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static e(t){P.Ek.push(t)}}class Q{sw;sh;h;constructor(t,e){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof e=="number"&&(e>=0||isNaN(e))?(this.sw=t,this.sh=e):f.o("Invalid arguments to Size constructor: "+t+", "+e),this.h=!1}a(t){return this.sw=t.sw,this.sh=t.sh,this}i(t,e){return this.sw=t,this.sh=e,this}setTo(t,e){return this.sw=t,this.sh=e,this}set(t){return this.sw=t.sw,this.sh=t.sh,this}copy(){let t=new Q;return t.sw=this.sw,t.sh=this.sh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new Q(s,o)}else return new Q}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",Q,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof Q?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return L.f(this.sw,t.width)&&L.f(this.sh,t.height)}inflate(t,e){let i=this.width+t;this.sw=i>=0?i:0;let s=this.height+e;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){t<0&&f.W(t,">= 0",Q,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&f.W(t,">= 0",Q,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static sc=new Q(0,0).$();static Uk=new Q(1,1).$();static wC=new Q(6,6).$();static nu=new Q(8,8).$();static xC=new Q(10,10).$();static Bk=new Q(1/0,1/0).$();static yw=new Q(NaN,NaN).$();static bC=[];static l(){let t=Q.bC.pop();return t===void 0?new Q:t}static e(t){Q.bC.push(t)}}class z{rx;ry;rw;rh;h;constructor(t,e,i,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof e=="number"&&typeof i=="number"&&(i>=0||isNaN(i))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=e,this.rw=i,this.rh=s;else if(t instanceof P){let n=t.x,o=t.y;if(e instanceof P){let r=e.x,a=e.y;this.rx=Math.min(n,r),this.ry=Math.min(o,a),this.rw=Math.abs(n-r),this.rh=Math.abs(o-a)}else e instanceof Q?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):f.o("Incorrect second argument supplied to Rect constructor "+e)}else f.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.h=!1}a(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}i(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}Fn(t,e){return this.rw=t,this.rh=e,this}setTo(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}set(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return this.rx=t.x,this.ry=t.y,this}setSize(t){return this.rw=t.width,this.rh=t.height,this}copy(){let t=new z;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),new z(s,o,r,a)}else return new z}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",z,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"}equals(t){return t instanceof z?this.rx===t.x&&this.ry===t.y&&this.rw===t.width&&this.rh===t.height:!1}equalTo(t,e,i,s){return this.rx===t&&this.ry===e&&this.rw===i&&this.rh===s}equalsApprox(t){return L.f(this.rx,t.x)&&L.f(this.ry,t.y)&&L.f(this.rw,t.width)&&L.f(this.rh,t.height)}equalsApproxTo(t,e,i,s){return L.f(this.rx,t)&&L.f(this.ry,e)&&L.f(this.rw,i)&&L.f(this.rh,s)}equalsApproxClose(t){return L.z(this.rx,t.x)&&L.z(this.ry,t.y)&&L.z(this.rw,t.width)&&L.z(this.rh,t.height)}containsPoint(t){return this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return this.rx<=t.x&&t.x+t.width<=this.rx+this.rw&&this.ry<=t.y&&t.y+t.height<=this.ry+this.rh}contains(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.rx<=t&&t+i<=this.rx+this.rw&&this.ry<=e&&e+s<=this.ry+this.rh}offset(t,e){return this.rx+=t,this.ry+=e,this}inflate(t,e){return this.ww(e,t,e,t)}addMargin(t){return this.ww(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.ww(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.ww(t,e,i,s)}ww(t,e,i,s){let n=this.rw;e+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=e+s);let o=this.rh;return t+i<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+i),this}intersectRect(t){return this.kC(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.kC(t,e,i,s)}kC(t,e,i,s){let n=Math.max(this.rx,t),o=Math.max(this.ry,e),r=Math.min(this.rx+this.rw,t+i),a=Math.min(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=Math.max(0,r-n),this.rh=Math.max(0,a-o),this}intersectsRect(t){return this.intersects(t.x,t.y,t.width,t.height)}intersects(t,e,i,s){let n=this.rw,o=this.rx;if(n!==1/0&&i!==1/0&&(n+=o,i+=t,isNaN(i)||isNaN(n)||o>i||t>n))return!1;let r=this.rh,a=this.ry;return!(r!==1/0&&s!==1/0&&(r+=a,s+=e,isNaN(s)||isNaN(r)||a>s||e>r))}intersectsRectPlus(t,e){let i=this.rw,s=t.width+e+e,n=this.rx,o=t.x-e;if(i+=n,s+=o,n>s||o>i)return!1;let r=this.rh,a=t.height+e+e,h=this.ry,l=t.y-e;return r+=h,a+=l,!(h>a||l>r)}unionPoint(t){return this.unionNoCheck(t.x,t.y,0,0)}unionRect(t){return this.unionNoCheck(t.rx,t.ry,t.rw,t.rh)}union(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.unionNoCheck(t,e,i,s)}unionNoCheck(t,e,i,s){let n=Math.min(this.rx,t),o=Math.min(this.ry,e),r=Math.max(this.rx+this.rw,t+i),a=Math.max(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=a-o,this}setSpot(t,e,i){return this.rx=t-i.offsetX-i.x*this.rw,this.ry=e-i.offsetY-i.y*this.rh,this}static contains(t,e,i,s,n,o,r,a){return r===void 0&&(r=0),a===void 0&&(a=0),t<=n&&n+r<=t+i&&e<=o&&o+a<=e+s}static intersects(t,e,i,s,n,o,r,a){let h=i,l=r,c=t,u=n;if(h+=c,l+=u,c>l||u>h)return!1;let d=s,g=a,p=e,m=o;return d+=p,g+=m,!(p>g||m>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return L.PC(t,e,i,s,n,o,r,a)}get x(){return this.rx}set x(t){this.rx=t}get y(){return this.ry}set y(t){this.ry=t}get width(){return this.rw}set width(t){t<0&&f.W(t,">= 0",z,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&f.W(t,">= 0",z,"height"),this.rh=t}get left(){return this.rx}set left(t){this.rx=t}get top(){return this.ry}set top(t){this.ry=t}get right(){return this.rx+this.rw}set right(t){this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){this.ry+=t-(this.ry+this.rh)}get position(){return new P(this.rx,this.ry)}set position(t){this.rx=t.x,this.ry=t.y}get size(){return new Q(this.rw,this.rh)}set size(t){this.rw=t.width,this.rh=t.height}get center(){return new P(this.rx+this.rw/2,this.ry+this.rh/2)}set center(t){this.rx=t.x-this.rw/2,this.ry=t.y-this.rh/2}get centerX(){return this.rx+this.rw/2}set centerX(t){this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){this.ry=t-this.rh/2}isReal(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)}isEmpty(){return this.width===0&&this.height===0}static Fg=new z(0,0,0,0).$();static $D=new z(NaN,NaN,NaN,NaN).$();static Vk=[];static l(){let t=z.Vk.pop();return t===void 0?new z:t}static V(t,e,i,s){let n=z.Vk.pop();return n===void 0?new z(t,e,i,s):n.i(t,e,i,s)}static e(t){z.Vk.push(t)}}class Lt{mt;mr;mb;ml;h;constructor(t,e,i,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):e===void 0?(e=t,i=t,s=t,this.mt=t,this.mr=e,this.mb=i,this.ml=s):i===void 0?(i=t,s=e,this.mt=t,this.mr=e,this.mb=i,this.ml=s):s!==void 0?(this.mt=t,this.mr=e,this.mb=i,this.ml=s):f.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s),this.h=!1}a(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}setTo(t,e,i,s){return this.mt=t,this.mr=e,this.mb=i,this.ml=s,this}set(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}copy(){let t=new Lt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=NaN;for(;e[i]==="";)i++;let n=e[i++];if(n&&(s=parseFloat(n)),isNaN(s))return new Lt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Lt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Lt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Lt(s,o):new Lt(s,o,r,a)}else return new Lt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return f.s(t,"number",Lt,"stringifyFixed:digits"),e=>e.top.toFixed(t)+" "+e.right.toFixed(t)+" "+e.bottom.toFixed(t)+" "+e.left.toFixed(t)}toString(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"}equals(t){return t instanceof Lt?this.mt===t.top&&this.mr===t.right&&this.mb===t.bottom&&this.ml===t.left:!1}equalTo(t,e,i,s){return this.mt===t&&this.mr===e&&this.mb===i&&this.ml===s}equalsApprox(t){return L.f(this.mt,t.top)&&L.f(this.mr,t.right)&&L.f(this.mb,t.bottom)&&L.f(this.ml,t.left)}get top(){return this.mt}set top(t){this.mt=t}get right(){return this.mr}set right(t){this.mr=t}get bottom(){return this.mb}set bottom(t){this.mb=t}get left(){return this.ml}set left(t){this.ml=t}isReal(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)}static Rg=new Lt(0,0,0,0).$();static SC=new Lt(2,2,2,2).$();static MC=[];static l(){let t=Lt.MC.pop();return t===void 0?new Lt:t}static e(t){Lt.MC.push(t)}}class D{sx;sy;ox;oy;h;constructor(t,e,i,s){t===void 0?(this.sx=0,this.sy=0,this.ox=0,this.oy=0):(e===void 0&&(e=0),i===void 0&&(i=0),s===void 0&&(s=0),this.sx=t,this.sy=e,this.ox=i,this.oy=s),this.h=!1}a(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}setTo(t,e,i,s){return this.sx=t,this.sy=e,this.ox=i,this.oy=s,this}set(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}copy(){let t=new D;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Nt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}pw(t){}Ie(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this}wE(t,e){(isNaN(t)||t>1||t<0)&&f.W(t,"0 <= "+e+" <= 1",D,e)}xE(t,e){(isNaN(t)||t===1/0||t===-1/0)&&f.W(t,"real number, not NaN or Infinity",D,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return D.None;if(t==="TopLeft")return D.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return D.TopCenter;if(t==="TopRight")return D.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return D.LeftCenter;if(t==="Center")return D.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return D.RightCenter;if(t==="BottomLeft")return D.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return D.BottomCenter;if(t==="BottomRight")return D.BottomRight;if(t==="TopSide")return D.TopSide;if(t==="LeftSide")return D.LeftSide;if(t==="RightSide")return D.RightSide;if(t==="BottomSide")return D.BottomSide;if(t==="TopBottomSides")return D.TopBottomSides;if(t==="LeftRightSides")return D.LeftRightSides;if(t==="TopLeftSides")return D.TopLeftSides;if(t==="TopRightSides")return D.TopRightSides;if(t==="BottomLeftSides")return D.BottomLeftSides;if(t==="BottomRightSides")return D.BottomRightSides;if(t==="NotTopSide")return D.NotTopSide;if(t==="NotLeftSide")return D.NotLeftSide;if(t==="NotRightSide")return D.NotRightSide;if(t==="NotBottomSide")return D.NotBottomSide;if(t==="AllSides")return D.AllSides;if(t==="Default")return D.Default;let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n!==void 0&&n.length>0&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n!==void 0&&n.length>0&&(a=parseFloat(n)),new D(s,o,r,a)}else return new D}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return f.s(t,"number",D,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.offsetX.toFixed(t)+" "+e.offsetY.toFixed(t)}toString(){return this.isSpot()?this.ox===0&&this.oy===0?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.equals(D.None)?"None":this.equals(D.TopLeft)?"TopLeft":this.equals(D.TopCenter)?"Top":this.equals(D.TopRight)?"TopRight":this.equals(D.LeftCenter)?"Left":this.equals(D.Center)?"Center":this.equals(D.RightCenter)?"Right":this.equals(D.BottomLeft)?"BottomLeft":this.equals(D.BottomCenter)?"Bottom":this.equals(D.BottomRight)?"BottomRight":this.equals(D.TopSide)?"TopSide":this.equals(D.LeftSide)?"LeftSide":this.equals(D.RightSide)?"RightSide":this.equals(D.BottomSide)?"BottomSide":this.equals(D.TopBottomSides)?"TopBottomSides":this.equals(D.LeftRightSides)?"LeftRightSides":this.equals(D.TopLeftSides)?"TopLeftSides":this.equals(D.TopRightSides)?"TopRightSides":this.equals(D.BottomLeftSides)?"BottomLeftSides":this.equals(D.BottomRightSides)?"BottomRightSides":this.equals(D.NotTopSide)?"NotTopSide":this.equals(D.NotLeftSide)?"NotLeftSide":this.equals(D.NotRightSide)?"NotRightSide":this.equals(D.NotBottomSide)?"NotBottomSide":this.equals(D.AllSides)?"AllSides":this.equals(D.Default)?"Default":"None"}equals(t){return t instanceof D?(this.sx===t.x||isNaN(this.sx)&&isNaN(t.x))&&(this.sy===t.y||isNaN(this.sy)&&isNaN(t.y))&&this.ox===t.offsetX&&this.oy===t.offsetY:!1}opposite(){return new D(.5-(this.sx-.5),.5-(this.sy-.5),-this.ox,-this.oy)}includesSide(t){if(!this.isSide())return!1;if(!t.isSide())if(t.equals(D.Left))t=D.LeftSide;else if(t.equals(D.Right))t=D.RightSide;else if(t.equals(D.Top))t=D.TopSide;else if(t.equals(D.Bottom))t=D.BottomSide;else return!1;let e=this.oy,i=t.offsetY;return(e&i)===i}get x(){return this.sx}set x(t){this.sx=t}get y(){return this.sy}set y(t){this.sy=t}get offsetX(){return this.ox}set offsetX(t){this.ox=t}get offsetY(){return this.oy}set offsetY(t){this.oy=t}isSpot(){return!isNaN(this.x)&&!isNaN(this.y)}isNoSpot(){return isNaN(this.x)||isNaN(this.y)}isSide(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===1&&this.offsetY!==0}isNone(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===0&&this.offsetY===0}isDefault(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===-1&&this.offsetY===0}static None=new D(0,0,0,0).Ie(0).$();static Default=new D(0,0,-1,0).Ie(-1).$();static TopLeft=new D(0,0,0,0).$();static TopCenter=new D(.5,0,0,0).$();static TopRight=new D(1,0,0,0).$();static LeftCenter=new D(0,.5,0,0).$();static Center=new D(.5,.5,0,0).$();static RightCenter=new D(1,.5,0,0).$();static BottomLeft=new D(0,1,0,0).$();static BottomCenter=new D(.5,1,0,0).$();static BottomRight=new D(1,1,0,0).$();static MiddleTop=D.TopCenter;static MiddleLeft=D.LeftCenter;static MiddleRight=D.RightCenter;static MiddleBottom=D.BottomCenter;static Top=D.TopCenter;static Left=D.LeftCenter;static Right=D.RightCenter;static Bottom=D.BottomCenter;static TopSide=new D(0,0,1,1).Ie(1).$();static LeftSide=new D(0,0,1,2).Ie(1).$();static RightSide=new D(0,0,1,4).Ie(1).$();static BottomSide=new D(0,0,1,8).Ie(1).$();static TopBottomSides=new D(0,0,1,9).Ie(1).$();static LeftRightSides=new D(0,0,1,6).Ie(1).$();static TopLeftSides=new D(0,0,1,3).Ie(1).$();static TopRightSides=new D(0,0,1,5).Ie(1).$();static BottomLeftSides=new D(0,0,1,10).Ie(1).$();static BottomRightSides=new D(0,0,1,12).Ie(1).$();static NotTopSide=new D(0,0,1,14).Ie(1).$();static NotLeftSide=new D(0,0,1,13).Ie(1).$();static NotRightSide=new D(0,0,1,11).Ie(1).$();static NotBottomSide=new D(0,0,1,7).Ie(1).$();static AllSides=new D(0,0,1,15).Ie(1).$();static zk=new D(.156,.156).$();static Xk=new D(.844,.844).$();static NC=[];static l(){let t=D.NC.pop();return t===void 0?new D:t}static e(t){D.NC.push(t)}}class Pt{m11;m12;m21;m22;dx;dy;constructor(){this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0}set(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this}setTo(t,e,i,s,n,o){return this.m11=t,this.m12=e,this.m21=i,this.m22=s,this.dx=n,this.dy=o,this}copy(){let t=new Pt;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t}toString(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"}equals(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy}Gk(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ri(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}nc(t){let e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,s=this.m11*t.m21+this.m21*t.m22,n=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=s,this.m22=n,this}CC(t){let e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,s=-t.m12*e,n=-t.m21*e,o=t.m11*e,r=e*(t.m21*t.dy-t.m22*t.dx),a=e*(t.m12*t.dx-t.m11*t.dy),h=this.m11*i+this.m21*s,l=this.m12*i+this.m22*s,c=this.m11*n+this.m21*o,u=this.m12*n+this.m22*o;return this.dx=this.m11*r+this.m21*a+this.dx,this.dy=this.m12*r+this.m22*a+this.dy,this.m11=h,this.m12=l,this.m21=c,this.m22=u,this}xw(){let t=1/(this.m11*this.m22-this.m12*this.m21),e=this.m22*t,i=-this.m12*t,s=-this.m21*t,n=this.m11*t,o=t*(this.m21*this.dy-this.m22*this.dx),r=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=e,this.m12=i,this.m21=s,this.m22=n,this.dx=o,this.dy=r,this}cs(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return this;this.Fs(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m11*s+this.m21*n,r=this.m12*s+this.m22*n,a=this.m11*-n+this.m21*s,h=this.m12*-n+this.m22*s;return this.m11=o,this.m12=r,this.m21=a,this.m22=h,this.Fs(-e,-i),this}Fs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}tt(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}ZD(){if(this.m11===1&&this.m12===0)return 0;let t=Math.atan2(this.m12,this.m11)*180/Math.PI;return t<0&&(t+=360),t}gt(t){let e=t.x,i=t.y;return t.i(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}$e(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=t.x-this.dx,a=t.y-this.dy;return t.i(r*i+a*n,r*s+a*o)}bw(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=e*(this.m21*this.dy-this.m22*this.dx),a=e*(this.m12*this.dx-this.m11*this.dy),h=t.x*1.25,l=t.y*1.2;return t.i(h*i+l*n+r,h*s+l*o+a)}vg(t){let e=t.x,i=t.y,s=e+t.width,n=i+t.height,o=this.m11,r=this.m12,a=this.m21,h=this.m22,l=this.dx,c=this.dy,u=e*o+i*a+l,d=e*r+i*h+c,g=s*o+i*a+l,p=s*r+i*h+c,m=e*o+n*a+l,y=e*r+n*h+c,w=s*o+n*a+l,b=s*r+n*h+c,v=u,k=u,S=d,M=d;return v=Math.min(v,g),k=Math.max(k,g),S=Math.min(S,p),M=Math.max(M,p),v=Math.min(v,m),k=Math.max(k,m),S=Math.min(S,y),M=Math.max(M,y),v=Math.min(v,w),k=Math.max(k,w),S=Math.min(S,b),M=Math.max(M,b),t.i(v,S,k-v,M-S),t}static LC=[];static l(){let t=Pt.LC.pop();return t===void 0?new Pt:t}static e(t){Pt.LC.push(t)}static Yk="54a702f3e53909c447824c6706603faf4c"}let L={QD:"7da71ca0ad381e90",Rn:4*((Math.sqrt(2)-1)/3),AC:null,kw:x=>{if(x<=0)return 0;let t=L.AC;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);L.AC=t}if(x<1){let e=1/x;return e<=2e3?1/t[e|0]:Math.sqrt(x)}else return x<=2e3?t[x|0]:Math.sqrt(x)},f:(x,t)=>{let e=x-t;return e<.5&&e>-.5},z:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},vi:(x,t,e,i,s,n,o)=>{s<=0&&(s=1e-6);let r=0,a=0,h=0,l=0;if(x<e?(a=x,r=e):(a=e,r=x),t<i?(l=t,h=i):(l=i,h=t),x===e)return l<=o&&o<=h&&x-s<=n&&n<=x+s;if(t===i)return a<=n&&n<=r&&t-s<=o&&o<=t+s;let c=r+s,u=a-s;if(u<=n&&n<=c){let d=h+s,g=l-s;if(g<=o&&o<=d)if(c-u>d-g)if(x-e>s||e-x>s){let p=(i-t)/(e-x)*(n-x)+t;if(p-s<=o&&o<=p+s)return!0}else return!0;else if(t-i>s||i-t>s){let p=(e-x)/(i-t)*(o-t)+x;if(p-s<=n&&n<=p+s)return!0}else return!0}return!1},Pw:(x,t,e,i,s,n,o,r,a,h,l,c)=>{if(!L.vi(x,t,o,r,c,e,i)||!L.vi(x,t,o,r,c,s,n)){let u=(x+e)/2,d=(t+i)/2,g=(e+s)/2,p=(i+n)/2,m=(s+o)/2,y=(n+r)/2,w=(u+g)/2,b=(d+p)/2,v=(g+m)/2,k=(p+y)/2,S=(w+v)/2,M=(b+k)/2;return L.Pw(x,t,u,d,w,b,S,M,a,h,l,c)||L.Pw(S,M,v,k,m,y,o,r,a,h,l,c)}else return L.vi(x,t,o,r,c,h,l)},TC:(x,t,e,i,s,n,o,r,a)=>{let h=(x+e)/2,l=(t+i)/2,c=(e+s)/2,u=(i+n)/2,d=(s+o)/2,g=(n+r)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2;return a.i((p+y)/2,(m+w)/2),a},_D:(x,t,e,i,s,n,o,r)=>{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(s+o)/2,d=(n+r)/2,g=(a+l)/2,p=(h+c)/2,m=(l+u)/2,y=(c+d)/2;return P.direction(g,p,m,y)},ou:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.ou(x,t,l,c,m,y,v,k,a,h),L.ou(v,k,w,b,g,p,o,r,a,h)}else h.unionNoCheck(x,t,0,0),h.unionNoCheck(o,r,0,0);return h},vn:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+u)/2,y=(c+d)/2,w=(u+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.vn(x,t,l,c,m,y,v,k,a,h),L.vn(v,k,w,b,g,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},Kk:(x,t,e,i,s,n,o,r,a,h)=>{if(L.vi(x,t,s,n,h,e,i))return L.vi(x,t,s,n,h,r,a);{let l=(x+e)/2,c=(t+i)/2,u=(e+s)/2,d=(i+n)/2,g=(l+u)/2,p=(c+d)/2;return L.Kk(x,t,l,c,g,p,o,r,a,h)||L.Kk(g,p,u,d,s,n,o,r,a,h)}},bE:(x,t,e,i,s,n,o)=>{let r=(x+e)/2,a=(t+i)/2,h=(e+s)/2,l=(i+n)/2;return o.i((r+h)/2,(a+l)/2),o},jk:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.unionNoCheck(x,t,0,0),r.unionNoCheck(s,n,0,0);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(a+l)/2,d=(h+c)/2;L.jk(x,t,a,h,u,d,o,r),L.jk(u,d,l,c,s,n,o,r)}return r},Og:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.length===0&&(r.push(x),r.push(t)),r.push(s),r.push(n);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,c=(i+n)/2,u=(a+l)/2,d=(h+c)/2;L.Og(x,t,a,h,u,d,o,r),L.Og(u,d,l,c,s,n,o,r)}return r},Ig:(x,t,e,i,s,n,o,r,a,h,l,c,u,d)=>{if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2,N=1/0,C=!1,R=0,O=0;if(L.Ig(x,t,g,p,v,k,F,T,a,h,l,c,u,d)){let B=(d.x-a)**2+(d.y-h)**2;B<N&&(N=B,C=!0,R=d.x,O=d.y)}if(L.Ig(F,T,S,M,w,b,o,r,a,h,l,c,u,d)){let B=(d.x-a)**2+(d.y-h)**2;B<N&&(N=B,C=!0,R=d.x,O=d.y)}return C&&(d.x=R,d.y=O),C}else{if(!L.su(x,t,o,r,a,h,l,c))return!1;let g=(x-o)*(h-c)-(t-r)*(a-l);if(g===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/g,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/g;return d.i(p,m),!0}},Eg:(x,t,e,i,s,n,o,r,a,h,l,c,u)=>{let d=0;if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2;d+=L.Eg(x,t,g,p,v,k,F,T,a,h,l,c,u),d+=L.Eg(F,T,S,M,w,b,o,r,a,h,l,c,u)}else{let g=(x-o)*(h-c)-(t-r)*(a-l);if(g===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*c-h*l))/g,m=((x*r-t*o)*(h-c)-(t-r)*(a*c-h*l))/g;if(p>=l)return d;let y=0,w=0;if((a>l?a-l:l-a)<(h>c?h-c:c-h)){if(t<r?(y=t,w=r):(y=r,w=t),m<y||m>w)return d}else if(x<o?(y=x,w=o):(y=o,w=x),p<y||p>w)return d;g>0?d++:g<0&&d--}return d},dl:(x,t,e,i,s,n,o)=>{if(L.z(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.i(x,r),!1):h>a?(o.i(x,a),!1):(o.i(x,h),!0)}else if(L.z(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.i(r,t),!1):h>a?(o.i(a,t),!1):(o.i(h,t),!0)}else{let r=(e-x)**2+(i-t)**2,a=((x-s)*(x-e)+(t-n)*(t-i))/r;if(a<-5e-6)return o.i(x,t),!1;if(a>1.000005)return o.i(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.i(h,l),!0}}},On:(x,t,e,i,s,n,o,r,a)=>{if(L.f(x,e)&&L.f(t,i))return a.i(x,t),!1;if(L.z(s,o)){if(L.z(x,e))return L.dl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return L.dl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(L.z(x,e)){let l=h*(x-s)+n,c=0,u=0;return t<i?(c=t,u=i):(c=i,u=t),l<c?(a.i(x,c),!1):l>u?(a.i(x,u),!1):(a.i(x,l),!0)}else{let l=(i-t)/(e-x);if(L.z(h,l))return L.dl(x,t,e,i,s,n,a),!1;{let c=(l*x-h*s+n-t)/(l-h);if(L.z(l,0)){let u=0,d=0;return x<e?(u=x,d=e):(u=e,d=x),c<u?(a.i(u,t),!1):c>d?(a.i(d,t),!1):(a.i(c,t),!0)}else{let u=l*(c-x)+t;return L.dl(x,t,e,i,c,u,a)}}}}},kE:(x,t,e,i,s)=>L.On(e.x,e.y,i.x,i.y,x.x,x.y,t.x,t.y,s),PE:(x,t,e,i,s,n,o,r,a,h)=>{let l=1/0;function c(S,M){let F=(S-x)**2+(M-t)**2;F<l&&(l=F,a.i(S,M))}c(a.x,a.y);let u=0,d=0,g=0,p=0;s<o?(u=s,d=o):(u=o,d=s),n<r?(g=s,p=o):(g=o,p=s);let m=d-u,y=p-g,w=m/2+h,b=y/2+h,v=(s+o)/2,k=(n+r)/2;if(w===0||b===0)return a;if(L.f(x,e)){let S=1-(e-v)**2/(w*w);if(S<0)return a;let M=Math.sqrt(S),F=b*M+k,T=-b*M+k;c(e,F),c(e,T)}else{let S=(i-t)/(e-x),M=1/(w*w)+S*S/(b*b),F=2*S*(t-S*x)/(b*b)-2*S*k/(b*b)-2*v/(w*w),T=2*S*x*k/(b*b)-2*t*k/(b*b)+k*k/(b*b)+v*v/(w*w)-1+(t-S*x)*(t-S*x)/(b*b),N=F*F-4*M*T;if(N<0)return a;let C=Math.sqrt(N),R=(-F+C)/(2*M);c(R,S*R-S*x+t);let O=(-F-C)/(2*M);c(O,S*O-S*x+t)}return a},gl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,c=t;if(L.On(x,t,x,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(e,t,e,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(x,t,e,t,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}if(L.On(x,i,e,i,s,n,o,r,a)){let u=(a.x-s)**2+(a.y-n)**2;u<h&&(h=u,l=a.x,c=a.y)}return a.i(l,c),h<1e21},Sw:(x,t,e)=>L.PC(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),PC:(x,t,e,i,s,n,o,r)=>{let a=x,h=x+e,l=t,c=t+i;if(s===o){let u=0,d=0;return n<r?(u=n,d=r):(u=r,d=n),a<=s&&s<=h&&u<=c&&d>=l}if(n===r){let u=0,d=0;return s<o?(u=s,d=o):(u=o,d=s),l<=n&&n<=c&&u<=h&&d>=a}return!!(z.contains(x,t,e,i,s,n)||z.contains(x,t,e,i,o,r)||L.su(a,l,h,l,s,n,o,r)||L.su(h,l,h,c,s,n,o,r)||L.su(h,c,a,c,s,n,o,r)||L.su(a,c,a,l,s,n,o,r))},su:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:L.eu(x,t,e,i,s,n)*L.eu(x,t,e,i,o,r)<=0&&L.eu(s,n,o,r,x,t)*L.eu(s,n,o,r,e,i)<=0,eu:(x,t,e,i,s,n)=>{let o=e-x,r=i-t,a=s-x,h=n-t,l=a*r-h*o;return l===0&&(l=a*o+h*r,l>0&&(a-=o,h-=r,l=a*o+h*r,l<0&&(l=0))),l},Ug:x=>(x<0&&(x+=360),x>=360&&(x-=360),x),DC:(x,t,e,i,s,n)=>{let o=Math.PI;n||(i=i*(o/180),s=s*(o/180));let r=i>s?-1:1,a=1e-5,h=o*2,l=[],c=o/2,u=i,d=Math.min(h,Math.abs(s-i));if(d<a){let g=u+r*Math.min(d,c),p=x+e*Math.cos(u),m=t+e*Math.sin(u),y=x+e*Math.cos(g),w=t+e*Math.sin(g),b=(p+y)/2,v=(m+w)/2;return l.push([p,m,b,v,b,v,y,w]),l}for(;d>a;){let g=u+r*Math.min(d,c);l.push(L.tF(e,u,g,x,t)),d-=Math.abs(g-u),u=g}return l},tF:(x,t,e,i,s)=>{let n=(e-t)/2,o=x*Math.cos(n),r=x*Math.sin(n),a=o,h=-r,l=a*a+h*h,c=l+a*o+h*r,u=4/3*(Math.sqrt(2*l*c)-c)/(a*r-h*o),d=a-u*h,g=h+u*a,p=d,m=-g,y=n+t,w=Math.cos(y),b=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*w-g*b,s+d*b+g*w,i+p*w-m*b,s+p*b+m*w,i+x*Math.cos(e),s+x*Math.sin(e)]},Dg:(x,t,e,i,s,n,o)=>{let r=s,a=n,h=Math.floor((x-e)/r)*r+e,l=Math.floor((t-i)/a)*a+i,c=h;h+r-x<r/2&&(c=h+r);let u=l;return l+a-t<a/2&&(u=l+a),o.i(c,u),o},FC:(x,t)=>{let e=Math.max(x,t),i=Math.min(x,t),s=1,n=1;do s=e%i,n=i,e=i,i=s;while(s>0);return n},iF:(x,t,e,i)=>{let s=e<0,n=i<0,o=0,r=0,a=0;x<t?(r=1,a=0):(r=0,a=1);let h=0,l=0,c=0,u=0;return o=r,h=o===0?x:t,c=o===0?e:i,(o===0?s:n)&&(c=-c),o=a,l=o===0?x:t,u=o===0?e:i,(o===0?s:n)&&(u=-u),L.eF(h,l,c,u,0,0)},eF:(x,t,e,i,s,n)=>{let o=0;if(i>0)if(e>0){let r=x*x,a=t*t,h=x*e,l=t*i,c=-a+l,u=-a+Math.sqrt(h*h+l*l),d=c,g=9999999999;for(let y=0;y<g&&(d=.5*(c+u),!(d===c||d===u));++y){let w=h/(d+r),b=l/(d+a),v=w*w+b*b-1;if(v>0)c=d;else if(v<0)u=d;else break}s=r*e/(d+r),n=a*i/(d+a);let p=s-e,m=n-i;o=Math.sqrt(p*p+m*m)}else s=0,n=t,o=Math.abs(i-t);else{let r=x*x-t*t,a=x*e;if(a<r){let h=a/r,l=h*h;s=x*h,n=t*Math.sqrt(Math.abs(1-l));let c=s-e;o=Math.sqrt(c*c+n*n)}else s=x,n=0,o=Math.abs(e-x)}return o},In:new K,Bg:new K,or:new K,rr:0,Vg:100};L.za=L.QD;var ei=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ei||{}),ms=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(ms||{});class kt{n;zg;Xg;oc;ru;lu;En;Un;Bn;H;we;xe;Qi;_i;Rs;rc;lc;constructor(t){I.Ki(this),this.n=2,t===void 0&&(t=4),this.H=t,this.we=0,this.xe=0,this.Qi=0,this._i=0,t===4?this.Rs=new G:this.Rs=kt.Mw,this.zg=this.Rs.nt,this.Xg=new z().u(),this.oc=null,this.ru=null,this.lu=NaN,this.En=D.TopLeft,this.Un=D.BottomRight,this.rc=NaN,this.lc=NaN,this.Bn=2}copy(){let t=new kt;if(t.n=this.n&-2,t.H=this.H,t.we=this.we,t.xe=this.xe,t.Qi=this.Qi,t._i=this._i,this.H===4){let e=this.Rs.r,i=t.Rs;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Rs=i}else t.Rs=this.Rs;return t.zg=this.zg,t.Xg.a(this.Xg),t.oc=this.oc,t.ru=this.ru,t.lu=this.lu,t.En=this.En.P(),t.Un=this.Un.P(),t.rc=this.rc,t.lc=this.lc,t.Bn=this.Bn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static Mw=new G().u();get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){if(this.h=!0,this.type!==4)return this;let t=this.figures;t.u();for(let e of t)e.u();return this}equalsApprox(t){if(!(t instanceof kt))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.RC(t):t.type===1&&this.type===4?t.RC(this):!1;if(this.type===4){let e=this.figures.r,i=t.figures.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}else return L.f(this.startX,t.startX)&&L.f(this.startY,t.startY)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)}RC(t){if(this.type!==1||t.type!==4)return!1;if(t.figures.count===1){let e=t.figures.elt(0);if(e.segments.count===1&&L.f(this.startX,e.startX)&&L.f(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&L.f(this.endX,i.endX)&&L.f(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return f.s(t,"number",kt,"stringifyFixed:digits"),e=>e.toString(t)}oi(t){t in ei?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i;switch(this.type){case 1:return t<0?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+e(this.startX)+" "+e(this.startY)+"L"+e(this.endX)+" "+e(this.endY);case 2:return i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0?"M"+i.x.toString()+" "+i.y.toString()+"H"+i.right.toString()+"V"+i.bottom.toString()+"H"+i.left.toString()+"z":"M"+e(i.x)+" "+e(i.y)+"H"+e(i.right)+"V"+e(i.bottom)+"H"+e(i.left)+"z";case 3:if(i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0){let r=i.left.toString()+" "+(i.y+i.height/2).toString(),a=i.right.toString()+" "+(i.y+i.height/2).toString();return"M"+r+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+a+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+r}else{let r=e(i.left)+" "+e(i.y+i.height/2),a=e(i.right)+" "+e(i.y+i.height/2);return"M"+r+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+a+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+r}case 4:let s="",n=this.figures.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];r>0&&(s+=" x "),a.isFilled&&(s+="F "),s+=a.toString(t)}return s;default:return ei[this.type]}}static fillPath(t){typeof t!="string"&&f.Zi(t,"string",kt,"fillPath:str");let e=t.split(/[Xx]/),i=e.length,s="";for(let n=0;n<i;n++){let o=e[n];if(o.match(/[Ff]/)!==null){n===0?s+=o:s+="X"+(o[0]===" "?"":" ")+o;continue}s+=(n===0?"":"X ")+"F"+(o[0]===" "?"":" ")+o}return s}static Gg="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&f.Zi(t,"string",kt,"parse:str");let i=new RegExp("(["+kt.Gg+"])(["+kt.Gg+"])","gm"),s=new RegExp("(["+kt.Gg+"])([^s])","gm"),n=new RegExp("([^s])(["+kt.Gg+"])","gm");t=t.replace(/,/gm," "),t=t.replace(i,"$1 $2"),t=t.replace(i,"$1 $2"),t=t.replace(s,"$1 $2"),t=t.replace(n,"$1 $2"),t=t.replace(/([0-9])([+\-])/gm,"$1 $2"),t=t.replace(/[\s\r\t\n]+/gm," "),t=t.replace(/^\s+|\s+$/g,"");let o=t.split(" ");for(let R=0;R<o.length;R++){let O=o[R];if(O.match(/(\.[0-9]*)(\.)/gm)!==null){let B=f.et(),X="",Y=!1;for(let j=0;j<O.length;j++){let U=O[j];U==="."&&!Y?(Y=!0,X+=U):U==="."?(B.push(X),X="."):X+=U}B.push(X),o.splice(R,1);for(let j=0;j<B.length;j++)o.splice(R+j,0,B[j]);R+=B.length-1,f.J(B)}}let r=-1,a="",h="",l=new P(0,0),c=new P(0,0),u=new P(0,0),d=!0;function g(){return r>=v-1||o[r+1].match(N)!==null?!0:(d=!1,!1)}function p(){return r++,o[r]}function m(R){let O=parseFloat(p()),B=parseFloat(p());a===a.toLowerCase()&&(O=u.x+O,B=u.y+B),R.i(O,B)}function y(){return m(u),u}function w(){return m(c),c}function b(){let R=h.toLowerCase();return R==="c"||R==="s"||R==="q"||R==="t"?new P(2*u.x-c.x,2*u.y-c.y):new P(u.x,u.y)}let v=o.length,k=Ke.vC(null),S=!1,M=!1,F=!1,T=!0,N=new RegExp("["+kt.Gg+"]");for(;!(r>=v-1);){if(h=a,a=p(),a==="")continue;d=!0;let R=!1;switch(a.toUpperCase()){case"X":T=!0,S=!1,M=!1;break;case"M":let O=y();for(k.bi===null||T===!0?(k.hu(O.x,O.y,S,!1,!M,F),T=!1):k.sF(O.x,O.y),l.a(u);!g();){let B=y();k.lr(B.x,B.y)}break;case"L":for(;!g();){let B=y();k.lr(B.x,B.y)}d&&(R=!0);break;case"H":for(;!g();)u.i((a===a.toLowerCase()?u.x:0)+parseFloat(p()),u.y),k.lr(u.x,u.y);break;case"V":for(;!g();)u.i(u.x,(a===a.toLowerCase()?u.y:0)+parseFloat(p())),k.lr(u.x,u.y);d&&(R=!0);break;case"C":for(;!g();){let B=new P;m(B);let X=w(),Y=y();k.hr(B.x,B.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!g();){let B=b(),X=w(),Y=y();k.hr(B.x,B.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!g();){let B=w(),X=y();k.Nw(B.x,B.y,X.x,X.y)}d&&(R=!0);break;case"T":for(;!g();){let B=b();c.a(B);let X=y();k.Nw(B.x,B.y,X.x,X.y),c.a(X)}d&&(R=!0);break;case"B":for(;!g();){let B=parseFloat(p()),X=parseFloat(p()),Y=parseFloat(p()),j=parseFloat(p()),U=parseFloat(p()),nt=U,at=!1;g()||(nt=parseFloat(p()),g()||(at=parseFloat(p())!==0)),a===a.toLowerCase()&&(Y+=u.x,j+=u.y),k.nF(B,X,Y,j,U,nt,at)}d&&(R=!0);break;case"A":for(;!g();){let B=Math.abs(parseFloat(p())),X=Math.abs(parseFloat(p())),Y=parseFloat(p()),j=!1,U=!1,nt=0,at=0,tt=p();tt.length===1?(j=!!parseFloat(tt),U=!!parseFloat(p()),nt=parseFloat(p()),at=parseFloat(p())):tt.length===2?(j=!!parseFloat(tt[0]),U=!!parseFloat(tt[1]),nt=parseFloat(p()),at=parseFloat(p())):(j=!!parseFloat(tt[0]),U=!!parseFloat(tt[1]),nt=parseFloat(tt.slice(2)),at=parseFloat(p())),a===a.toLowerCase()&&(nt=u.x+nt,at=u.y+at),u.i(nt,at),k.oF(B,X,Y,j,U,nt,at)}d&&(R=!0);break;case"Z":k.rF(),u.a(l);break;case"F":{let B="",X=1;for(;o[r+X];){if(o[r+X]==="0"){F=!0,X++;continue}if(o[r+X].match(/[Uu]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}B=o[r+X];break}B.match(/[Mm]/)?S=!0:k.lF();break}case"U":{let B="",X=1;for(;o[r+X];){if(o[r+X].match(/[Ff]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}B=o[r+X];break}B.match(/[Mm]/)?M=!0:k.hF(!1);break}default:if(a==="0"||a==="1")break;f.ni("Unknown geometry command: "+a);break}if(R){f.ni(`Bad geometry command: ${a}, next token: ${p()},
5
+ string: ${t}`);break}}let C=k.Yg;if(Ke.OC(k),e){let R=C.figures.iterator;for(;R.next();){let O=R.value;O.isFilled=!0}}return C}static IC(t,e){let i=t.length,s=P.l();for(let n=0;n<i;n++){let o=t[n];s.x=o[0],s.y=o[1],e.gt(s),o[0]=s.x,o[1]=s.y,s.x=o[2],s.y=o[3],e.gt(s),o[2]=s.x,o[3]=s.y,s.x=o[4],s.y=o[5],e.gt(s),o[4]=s.x,o[5]=s.y,s.x=o[6],s.y=o[7],e.gt(s),o[6]=s.x,o[7]=s.y}P.e(s)}Hk(){if(this.wt)return!0;if(this.type===4){let t=this.figures;if(this.zg!==t.nt)return!0;let e=this.figures.r,i=e.length;for(let s=0;s<i;s++)if(e[s].Hk())return!0}return!1}Cw(){if(this.wt=!1,this.oc=null,this.ru=null,this.lu=NaN,this.type===4){let e=this.figures;this.zg=e.nt;let i=this.figures.r,s=i.length;for(let n=0;n<s;n++)i[n].aF()}let t=this.Xg;t.Nt(),isNaN(this.rc)||isNaN(this.lc)?t.i(0,0,0,0):t.i(0,0,this.rc,this.lc),this.EC(t,!1),t.unionNoCheck(0,0,0,0),t.u()}computeBoundsWithoutOrigin(){let t=new z;return this.EC(t,!0),t}EC(t,e){switch(this.type){case 1:case 2:case 3:e?t.i(this.we,this.xe,0,0):t.unionNoCheck(this.we,this.xe,0,0),t.unionNoCheck(this.Qi,this._i,0,0);break;case 4:let i=this.figures,s=i.r,n=i.length;for(let o=0;o<n;o++){let r=s[o];e&&o===0?t.i(r.startX,r.startY,0,0):t.unionNoCheck(r.startX,r.startY,0,0);let a=r.segments.r,h=a.length,l=r.startX,c=r.startY;for(let u=0;u<h;u++){let d=a[u];switch(d.type){case 2:case 1:l=d.endX,c=d.endY,t.unionNoCheck(l,c,0,0);break;case 3:L.ou(l,c,d.point1X,d.point1Y,d.point2X,d.point2Y,d.endX,d.endY,.5,t),l=d.endX,c=d.endY;break;case 4:L.jk(l,c,d.point1X,d.point1Y,d.endX,d.endY,.5,t),l=d.endX,c=d.endY;break;case 5:case 6:let g=d.type===5?d.bo(r):d.Bh(r,l,c),p=g.length;if(p===0){l=d.type===5?d.centerX:d.endX,c=d.type===5?d.centerY:d.endY,t.unionNoCheck(l,c,0,0);break}let m=null;for(let y=0;y<p;y++)m=g[y],L.ou(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],.5,t);m!==null&&(l=m[6],c=m[7]);break;default:f.o("Unknown Segment type: "+d.type)}}}break;default:f.o("Unknown Geometry type: "+this.type)}}cF(t,e){let i=this.bounds,s=t/i.width,n=e/i.height;return isFinite(s)||(s=1),isFinite(n)||(n=1),s===1&&n===1?this:this.copy().scale(s,n)}normalize(){this.h&&f.L(this);let t=this.computeBoundsWithoutOrigin();return this.offset(-t.x,-t.y),new P(-t.x,-t.y)}offset(t,e){return this.h&&f.L(this),this.T(1,0,0,1,t,e),this}scale(t,e){return this.h&&f.L(this),this.T(t,0,0,e,0,0),this}rotate(t,e,i){this.h&&f.L(this),e===void 0&&(e=0),i===void 0&&(i=0);let s=Pt.l();return s.Ri(),s.cs(t,e,i),this.T(s.m11,s.m12,s.m21,s.m22,s.dx,s.dy),Pt.e(s),this}T(t,e,i,s,n,o){let r=0,a=0;switch(this.type){case 1:case 2:case 3:r=this.we,a=this.xe,this.we=r*t+a*i+n,this.xe=r*e+a*s+o,r=this.Qi,a=this._i,this.Qi=r*t+a*i+n,this._i=r*e+a*s+o;break;case 4:let h=this.figures.r,l=h.length;for(let c=0;c<l;c++){let u=h[c];r=u.startX,a=u.startY,u.startX=r*t+a*i+n,u.startY=r*e+a*s+o;let d=u.segments.r,g=d.length;for(let p=0;p<g;p++){let m=d[p];switch(m.type){case 2:case 1:r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 3:r=m.point1X,a=m.point1Y,m.point1X=r*t+a*i+n,m.point1Y=r*e+a*s+o,r=m.point2X,a=m.point2Y,m.point2X=r*t+a*i+n,m.point2Y=r*e+a*s+o,r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 4:r=m.point1X,a=m.point1Y,m.point1X=r*t+a*i+n,m.point1Y=r*e+a*s+o,r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 5:if(r=m.centerX,a=m.centerY,m.centerX=r*t+a*i+n,m.centerY=r*e+a*s+o,e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),m.startAngle+=y}t<0&&(m.startAngle=180-m.startAngle,m.sweepAngle=-m.sweepAngle),s<0&&(m.startAngle=-m.startAngle,m.sweepAngle=-m.sweepAngle),m.radiusX*=Math.sqrt(t*t+i*i),m.radiusY!==void 0&&(m.radiusY*=Math.sqrt(e*e+s*s));break;case 6:if(r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o,m.radiusX===0||m.radiusY===0)break;if(e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),m.xAxisRotation+=y}t<0&&(m.xAxisRotation=180-m.xAxisRotation,m.isClockwiseArc=!m.isClockwiseArc),s<0&&(m.xAxisRotation=-m.xAxisRotation,m.isClockwiseArc=!m.isClockwiseArc),m.radiusX*=Math.sqrt(t*t+i*i),m.radiusY*=Math.sqrt(e*e+s*s);break;default:f.o("Unknown Segment type: "+m.type)}}}break}return this.wt=!0,this}containsPoint(t,e){e===void 0&&(e=0);let i=this.we,s=this.xe,n=this.Qi,o=this._i;switch(this.type){case 1:return L.vi(i,s,n,o,e,t.x,t.y);case 2:{let r=Math.min(i,n)-e,a=Math.min(s,o)-e,h=Math.abs(n-i)+e*2,l=Math.abs(o-s)+e*2,c=z.V(r,a,h,l),u=c.containsPoint(t);return z.e(c),u}case 3:{let r=Math.min(i,n)-e,a=Math.min(s,o)-e,h=Math.abs(n-i)+e*2,l=Math.abs(o-s)+e*2,c=h/2,u=l/2;return c<=0||u<=0?!1:(r=t.x-(r+c),a=t.y-(a+u),r*r/(c*c)+a*a/(u*u)<=1)}case 4:return this.qk(t,e,!0,!1);default:return!1}}qk(t,e,i,s){let n=t.x,o=t.y,r=this.bounds.x-20,a=o,h=0,l=0,c=0,u=0,d=0,g=0,p=this.figures.r,m=p.length;for(let y=0;y<m;y++){let w=p[y],b=!w.isEvenOdd;if(w.isFilled){if(i&&w.Wk(n,o,e))return!0}else{if(w.Wk(n,o,s?e:e+2))return!0;continue}let v=w.segments;l=w.startX,c=w.startY;let k=l,S=c,M=v.r;for(let F=0;F<=v.length;F++){let T,N;switch(F!==v.length?(T=M[F],N=T.type,d=T.endX,g=T.endY):(N=2,d=k,g=S),N){case 1:{let C=this.Lw(n,o,r,a,l,c,k,S);if(isNaN(C))return!0;h+=C,k=d,S=g;break}case 2:{let C=this.Lw(n,o,r,a,l,c,d,g);if(isNaN(C))return!0;h+=C;break}case 3:u=L.Eg(l,c,T.point1X,T.point1Y,T.point2X,T.point2Y,d,g,r,a,n,o,.5),h+=u;break;case 4:{let C=(l+2*T.point1X)/3,R=(c+2*T.point1Y)/3,O=(T.point1X*2+d)/3,B=(T.point1Y*2+g)/3;u=L.Eg(l,c,C,R,O,B,d,g,r,a,n,o,.5),h+=u;break}case 5:case 6:{let C=T.type===5?T.bo(w):T.Bh(w,l,c),R=C.length;if(R===0){let B=this.Lw(n,o,r,a,l,c,T.type===5?T.centerX:T.endX,T.type===5?T.centerY:T.endY);if(isNaN(B))return!0;h+=B;break}let O=null;for(let B=0;B<R;B++){if(O=C[B],B===0){let X=this.Lw(n,o,r,a,l,c,O[0],O[1]);if(isNaN(X))return!0;h+=X}u=L.Eg(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],r,a,n,o,.5),h+=u}O!==null&&(d=O[6],g=O[7]);break}default:f.o("Unknown Segment type: "+T.type)}l=d,c=g}if(b){if(h!==0)return!0}else if(h%2!==0)return!0;h=0}return!1}Lw(t,e,i,s,n,o,r,a){if(L.vi(n,o,r,a,.05,t,e))return NaN;let h=(t-i)*(o-a);if(h===0)return 0;let l=((t*s-e*i)*(n-r)-(t-i)*(n*a-o*r))/h,c=(t*s-e*i)*(o-a)/h;if(l>=t)return 0;if((n>r?n-r:r-n)<(o>a?o-a:a-o)){if(o<a){if(c<o||c>a)return 0}else if(c<a||c>o)return 0}else if(n<r){if(l<n||l>r)return 0}else if(l<r||l>n)return 0;return h>0?1:-1}UC(t,e,i){let s=this.figures.r,n=s.length;for(let o=0;o<n;o++)if(s[o].Wk(t,e,i))return!0;return!1}getPointAlongPath(t,e){if(t<0?t=0:t>1&&(t=1),e===void 0&&(e=new P),this.type===1)return e.i(this.startX+t*(this.endX-this.startX),this.startY+t*(this.endY-this.startY)),e;let i=this.flattenedSegments,s=this.flattenedLengths,n=this.flattenedTotalLength,o=i.length,r=n*t,a=0;for(let h=0;h<o;h++){let l=s[h],c=l.length;for(let u=0;u<c;u++){let d=l[u];if(a+d>=r){let g=r-a,p=d===0?0:g/d,m=i[h],y=m[u*2],w=m[u*2+1],b=m[u*2+2],v=m[u*2+3];return e.i(y+(b-y)*p,w+(v-w)*p),e}a+=d}}return e}getAngleAlongPath(t){if(t<0?t=0:t>1&&(t=1),this.type===1)return Math.atan2(this.endY-this.startY,this.endX-this.startX)*180/Math.PI;let e=this.flattenedSegments,i=this.flattenedLengths,s=this.flattenedTotalLength,n=e.length,o=s*t,r=0;for(let a=0;a<n;a++){let h=i[a],l=h.length;for(let c=0;c<l;c++){let u=h[c];if(r+u>=o){let d=e[a],g=d[c*2],p=d[c*2+1],m=d[c*2+2],y=d[c*2+3];return Math.abs(m-g)<1&&Math.abs(y-p)<1?0:Math.abs(m-g)<1?y-p>=0?90:270:Math.abs(y-p)<1?m-g>=0?0:180:Math.atan2(y-p,m-g)*180/Math.PI}r+=u}}return NaN}getPointAndAngleAlongPath(t,e){if(t<0?t=0:t>1&&(t=1),e===void 0&&(e=[]),e.length=3,this.type===1)return e[0]=this.startX+t*(this.endX-this.startX),e[1]=this.startY+t*(this.endY-this.startY),e[2]=Math.atan2(this.endY-this.startY,this.endX-this.startX)*180/Math.PI,e;let i=this.flattenedSegments,s=this.flattenedLengths,n=this.flattenedTotalLength,o=i.length,r=n*t,a=0;for(let h=0;h<o;h++){let l=s[h],c=l.length;for(let u=0;u<c;u++){let d=l[u];if(a+d>=r){let g=r-a,p=d===0?0:g/d,m=i[h],y=m[u*2],w=m[u*2+1],b=m[u*2+2],v=m[u*2+3];e[0]=y+(b-y)*p,e[1]=w+(v-w)*p;let k;return Math.abs(b-y)<1&&Math.abs(v-w)<1?k=0:Math.abs(b-y)<1?k=v-w>=0?90:270:Math.abs(v-w)<1?k=b-y>=0?0:180:k=Math.atan2(v-w,b-y)*180/Math.PI,e[2]=k,e}a+=d}}return e}getFractionForPoint(t){if(this.type===1){let e=this.startX,i=this.startY,s=this.endX,n=this.endY;if(e===s&&i===n)return 0;{let o=t.x,r=t.y,a=0,h=0;if(e===s)return i<n?(a=i,h=n):(a=n,h=i),r<=a?a===i?0:1:r>=h?h===i?0:1:Math.abs(r-i)/(h-a);if(i===n)return e<s?(a=e,h=s):(a=s,h=e),o<=a?a===e?0:1:o>=h?h===e?0:1:Math.abs(o-e)/(h-a);{let l=(s-e)**2+(n-i)**2,c=P.l();L.dl(e,i,s,n,o,r,c);let u=c.x,d=c.y;return P.e(c),Math.sqrt(((u-e)**2+(d-i)**2)/l)}}}else if(this.type===2){let e=this.startX,i=this.startY,s=this.endX,n=this.endY;if(e===s&&i===n)return 0;{let o=s-e,r=n-i,a=o*2+r*2,h=t.x,l=t.y;h=Math.min(Math.max(h,e),s),l=Math.min(Math.max(l,i),n);let c=Math.abs(h-e),u=Math.abs(h-s),d=Math.abs(l-i),g=Math.abs(l-n),p=Math.min(c,u,d,g);if(p===d)return h/a;if(p===u)return(o+l)/a;if(p===g)return(o*2+r-h)/a;if(p===c)return(o*2+r*2-l)/a}}else{let e=this.flattenedSegments,i=this.flattenedLengths,s=this.flattenedTotalLength,n=P.l(),o=1/0,r=0,a=0,h=e.length,l=0,c=0;for(let d=0;d<h;d++){let g=e[d],p=i[d],m=g.length;for(let y=0;y<m;y+=2){let w=g[y],b=g[y+1];if(y===0){l=w,c=b;continue}L.dl(l,c,w,b,t.x,t.y,n);let v=(n.x-t.x)**2+(n.y-t.y)**2;v<o&&(o=v,r=a,r+=Math.sqrt((n.x-l)**2+(n.y-c)**2)),a+=p[(y-2)/2],l=w,c=b}}P.e(n);let u=r/s;return u<0?0:u>1?1:u}return 0}get flattenedSegments(){return this.BC(),this.oc}BC(){if(this.oc===null){let t=this.oc=[],e=this.ru=[];this.fF(t,e)}}get flattenedLengths(){return this.BC(),this.ru}get flattenedTotalLength(){let t=this.lu;if(isNaN(t)){if(this.type===1){let e=Math.abs(this.endX-this.startX),i=Math.abs(this.endY-this.startY);t=Math.sqrt(e*e+i*i)}else if(this.type===2){let e=Math.abs(this.endX-this.startX),i=Math.abs(this.endY-this.startY);t=e*2+i*2}else{let e=this.flattenedLengths,i=e.length;t=0;for(let s=0;s<i;s++){let n=e[s],o=n.length;for(let r=0;r<o;r++)t+=n[r]}}this.lu=t}return t}Jk(t){let e=[],i=0,s=0,n=t.length;for(let o=0;o<n;o+=2){let r=t[o],a=t[o+1];if(o===0){i=r,s=a;continue}let h=Math.sqrt(P.distanceSquared(i,s,r,a));e.push(h),i=r,s=a}return e}fF(t,e){let i=[],s=[];if(this.type===1)i.push(this.startX),i.push(this.startY),i.push(this.endX),i.push(this.endY),t.push(i),s.push(Math.sqrt((this.startX-this.endX)**2+(this.startY-this.endY)**2)),e.push(s);else if(this.type===2)i.push(this.startX),i.push(this.startY),i.push(this.endX),i.push(this.startY),i.push(this.endX),i.push(this.endY),i.push(this.startX),i.push(this.endY),i.push(this.startX),i.push(this.startY),t.push(i),s.push(Math.abs(this.startX-this.endX)),s.push(Math.abs(this.startY-this.endY)),s.push(Math.abs(this.startX-this.endX)),s.push(Math.abs(this.startY-this.endY)),e.push(s);else if(this.type===3){let n=new $t;n.startX=this.endX,n.startY=(this.startY+this.endY)/2;let o=new vt(5);o.startAngle=0,o.sweepAngle=360,o.centerX=(this.startX+this.endX)/2,o.centerY=(this.startY+this.endY)/2,o.radiusX=Math.abs(this.startX-this.endX)/2,o.radiusY=Math.abs(this.startY-this.endY)/2,n.add(o);let r=o.bo(n),a=r.length;if(a===0)i.push(o.centerX),i.push(o.centerY);else{let h=n.startX,l=n.startY;for(let c=0;c<a;c++){let u=r[c];L.vn(h,l,u[2],u[3],u[4],u[5],u[6],u[7],.5,i),h=u[6],l=u[7]}}t.push(i),e.push(this.Jk(i))}else{let n=this.figures.iterator;for(;n.next();){let o=n.value;i=[],i.push(o.startX),i.push(o.startY);let r=o.startX,a=o.startY,h=r,l=a,c=o.segments.r,u=c.length;for(let d=0;d<u;d++){let g=c[d];switch(g.type){case 1:i.length>=4&&(t.push(i),e.push(this.Jk(i))),i=[],i.push(g.endX),i.push(g.endY),r=g.endX,a=g.endY,h=r,l=a;break;case 2:i.push(g.endX),i.push(g.endY),r=g.endX,a=g.endY;break;case 3:L.vn(r,a,g.point1X,g.point1Y,g.point2X,g.point2Y,g.endX,g.endY,.5,i),r=g.endX,a=g.endY;break;case 4:L.Og(r,a,g.point1X,g.point1Y,g.endX,g.endY,.5,i),r=g.endX,a=g.endY;break;case 5:{let p=g.bo(o),m=p.length;if(m===0){i.push(g.centerX),i.push(g.centerY),r=g.centerX,a=g.centerY;break}for(let y=0;y<m;y++){let w=p[y];L.vn(r,a,w[2],w[3],w[4],w[5],w[6],w[7],.5,i),r=w[6],a=w[7]}break}case 6:{let p=g.Bh(o,r,a),m=p.length,y=g.endX,w=g.endY;if(m===0){i.push(y),i.push(w),r=y,a=w;break}for(let b=0;b<m;b++){let v=p[b];L.vn(r,a,v[2],v[3],v[4],v[5],v[6],v[7],.5,i),r=v[6],a=v[7]}break}default:f.o("Segment not of valid type: "+g.type)}g.isClosed&&(i.push(h),i.push(l))}i.length>=4&&(t.push(i),e.push(this.Jk(i)))}}}get type(){return this.H}set type(t){this.H!==t&&(this.h&&f.L(this,t),this.H=t,t===4?this.Rs=new G:(kt.Mw===null&&(kt.Mw=new G().u()),this.Rs=kt.Mw),this.wt=!0)}get startX(){return this.we}set startX(t){this.we!==t&&(this.h&&f.L(this,t),this.we=t,this.wt=!0)}get startY(){return this.xe}set startY(t){this.xe!==t&&(this.h&&f.L(this,t),this.xe=t,this.wt=!0)}get endX(){return this.Qi}set endX(t){this.Qi!==t&&(this.h&&f.L(this,t),this.Qi=t,this.wt=!0)}get endY(){return this._i}set endY(t){this._i!==t&&(this.h&&f.L(this,t),this._i=t,this.wt=!0)}get figures(){return this.Rs}set figures(t){this.Rs!==t&&(this.h&&f.L(this,t),this.Rs=t,this.wt=!0)}add(t){return this.Rs.add(t),this}setSpots(t,e,i,s,n,o,r,a){return this.h&&f.L(this),this.En=new D(t,e,n,o).u(),this.Un=new D(i,s,r,a).u(),this}get spot1(){return this.En}set spot1(t){this.h&&f.L(this,t),this.En=t.P()}get spot2(){return this.Un}set spot2(t){this.h&&f.L(this,t),this.Un=t.P()}get defaultStretch(){return this.Bn}set defaultStretch(t){this.Bn=t}get bounds(){return this.Hk()&&this.Cw(),this.Xg}}kt.stringify=kt.stringify,kt.stringifyFixed=kt.stringifyFixed,kt.fillPath=kt.fillPath,kt.parse=kt.parse;class $t{n;we;xe;hc;Kg;Ee;constructor(t,e,i,s,n){i===void 0&&(i=!0),s===void 0&&(s=!0),n===void 0&&(n=!1),this.n=2|(i?4:0)|(s?8:0)|(n?16:0),t!==void 0?this.we=t:this.we=0,e!==void 0?this.xe=e:this.xe=0,this.hc=new G,this.Kg=this.hc.nt,this.Ee=null}copy(){let t=new $t;t.n=this.n&-2,t.we=this.we,t.xe=this.xe;let e=this.hc.r,i=e.length,s=t.hc;for(let n=0;n<i;n++){let o=e[n].copy();s.add(o)}return t.Kg=this.Kg,t.Ee=this.Ee,t}equalsApprox(t){if(!(t instanceof $t)||!L.f(this.startX,t.startX)||!L.f(this.startY,t.startY))return!1;let e=this.segments.r,i=t.segments.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}toString(t){t===void 0&&(t=-1);let e="";if(t<0)e="M"+this.startX.toString()+" "+this.startY.toString();else{let n=o=>o===0?"0":o.toFixed(t);e="M"+n(this.startX)+" "+n(this.startY)}let i=this.segments.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];e+=" "+o.toString(t)}return e}get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){this.h=!0;let t=this.segments;t.u();let e=t.r,i=t.length;for(let s=0;s<i;s++)e[s].u();return this}Hk(){if(this.wt)return!0;let t=this.segments;if(this.Kg!==t.nt)return!0;for(let e of t)if(e.wt)return!0;return!1}aF(){this.wt=!1,this.Ee=null;let t=this.segments;this.Kg=t.nt;for(let e of t)e.wt=!1,e.vs=null}get isFilled(){return(this.n&4)!==0}set isFilled(t){this.h&&f.L(this,t),t?this.n|=4:this.n&=-5}get isShadowed(){return(this.n&8)!==0}set isShadowed(t){this.h&&f.L(this,t),t?this.n|=8:this.n&=-9}get isEvenOdd(){return(this.n&16)!==0}set isEvenOdd(t){this.h&&f.L(this,t),t?this.n|=16:this.n&=-17}get startX(){return this.we}set startX(t){this.h&&f.L(this,t),this.we=t,this.Ee=null,this.wt=!0}get startY(){return this.xe}set startY(t){this.h&&f.L(this,t),this.xe=t,this.Ee=null,this.wt=!0}get segments(){return this.hc}set segments(t){this.h&&f.L(this,t),this.hc=t,this.Ee=null,this.wt=!0}add(t){return this.hc.add(t),this.Ee=null,this}Wk(t,e,i){let s=this,n=s.startX,o=s.startY,r=n,a=o,h=s.segments.r,l=h.length;for(let c=0;c<l;c++){let u=h[c];switch(u.type){case 1:r=u.endX,a=u.endY,n=u.endX,o=u.endY;break;case 2:if(L.vi(n,o,u.endX,u.endY,i,t,e))return!0;n=u.endX,o=u.endY;break;case 3:if(L.Pw(n,o,u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY,.5,t,e,i))return!0;n=u.endX,o=u.endY;break;case 4:if(L.Kk(n,o,u.point1X,u.point1Y,u.endX,u.endY,.5,t,e,i))return!0;n=u.endX,o=u.endY;break;case 5:case 6:let d=u.type===5?u.bo(s):u.Bh(s,n,o),g=d.length,p=u.type===5?u.centerX:u.endX,m=u.type===5?u.centerY:u.endY;if(g===0){if(L.vi(n,o,p,m,i,t,e))return!0;n=p,o=m;break}let y=null;for(let w=0;w<g;w++)if(y=d[w],w===0&&L.vi(n,o,y[0],y[1],i,t,e)||L.Pw(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],.5,t,e,i))return!0;y!==null&&(n=y[6],o=y[7]);break;default:f.o("Unknown Segment type: "+u.type)}if(u.isClosed&&(n!==r||o!==a)&&L.vi(n,o,r,a,i,t,e))return!0}return!1}}var Ci=(x=>(x[x.Move=1]="Move",x[x.Line=2]="Line",x[x.Bezier=3]="Bezier",x[x.QuadraticBezier=4]="QuadraticBezier",x[x.Arc=5]="Arc",x[x.SvgArc=6]="SvgArc",x))(Ci||{});class vt{H;n;Qi;_i;tn;pl;yl;ar;vs;constructor(t,e,i,s,n,o,r,a){if(I.Ki(this),t===void 0&&(t=2),this.H=t,this.n=2,e!==void 0?this.Qi=e:this.Qi=0,i!==void 0?this._i=i:this._i=0,s===void 0&&(s=0),n===void 0&&(n=0),o===void 0&&(o=0),r===void 0&&(r=0),t===6){let h=o;h=h%360,h<0&&(h+=360),this.tn=h,this.pl=0,this.yl=Math.max(s,0),this.ar=Math.max(n,0),typeof r=="boolean"?r&&(this.isLargeArc=!0):typeof r=="number"&&r&&(this.isLargeArc=!0),a&&(this.isClockwiseArc=!0)}else this.tn=s,this.pl=n,t===5&&(o=Math.max(o,0)),this.yl=o,typeof r=="number"?(t===5&&(r=Math.max(r,0)),this.ar=r):this.ar=0;this.vs=null}copy(){let t=new vt;return t.H=this.H,t.n=this.n&-2,t.Qi=this.Qi,t._i=this._i,t.tn=this.tn,t.pl=this.pl,t.yl=this.yl,t.ar=this.ar,t}equalsApprox(t){if(!(t instanceof vt)||this.type!==t.type||this.isClosed!==t.isClosed)return!1;switch(this.type){case 1:case 2:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY);case 3:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.point1X,t.point1X)&&L.f(this.point1Y,t.point1Y)&&L.f(this.point2X,t.point2X)&&L.f(this.point2Y,t.point2Y);case 4:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.point1X,t.point1X)&&L.f(this.point1Y,t.point1Y);case 5:return L.f(this.startAngle,t.startAngle)&&L.f(this.sweepAngle,t.sweepAngle)&&L.f(this.centerX,t.centerX)&&L.f(this.centerY,t.centerY)&&L.f(this.radiusX,t.radiusX)&&L.f(this.radiusY,t.radiusY);case 6:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&L.f(this.xAxisRotation,t.xAxisRotation)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.radiusX,t.radiusX)&&L.f(this.radiusY,t.radiusY);default:return!1}}oi(t){t in Ci?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i="";switch(this.type){case 1:t<0?i="M"+this.endX.toString()+" "+this.endY.toString():i="M"+e(this.endX)+" "+e(this.endY);break;case 2:t<0?i="L"+this.endX.toString()+" "+this.endY.toString():i="L"+e(this.endX)+" "+e(this.endY);break;case 3:t<0?i="C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():i="C"+e(this.point1X)+" "+e(this.point1Y)+" "+e(this.point2X)+" "+e(this.point2Y)+" "+e(this.endX)+" "+e(this.endY);break;case 4:t<0?i="Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():i="Q"+e(this.point1X)+" "+e(this.point1Y)+" "+e(this.endX)+" "+e(this.endY);break;case 5:t<0?i="B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+" "+this.radiusX.toString()+" "+this.radiusY.toString():i="B"+e(this.startAngle)+" "+e(this.sweepAngle)+" "+e(this.centerX)+" "+e(this.centerY)+" "+e(this.radiusX)+" "+e(this.radiusY);break;case 6:t<0?i="A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():i="A"+e(this.radiusX)+" "+e(this.radiusY)+" "+e(this.xAxisRotation)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+e(this.endX)+" "+e(this.endY);break;default:i=Ci[this.type]}return i+(this.isClosed?"z":"")}static Move=1;static Line=2;static Bezier=3;static QuadraticBezier=4;static Arc=5;static SvgArc=6;get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){return this.h=!0,this}close(){return this.isClosed=!0,this}bo(t){if(this.vs!==null&&t.wt===!1)return this.vs;let e=this.radiusX,i=this.radiusY;if(i===void 0&&(i=e),e===0||i===0)return this.vs=[],this.vs;let s=this.tn,n=this.pl,o=L.DC(0,0,e<i?e:i,this.startAngle,this.startAngle+this.sweepAngle,!1);if(e!==i){let a=Pt.l();a.Ri(),e<i?a.tt(1,i/e):a.tt(e/i,1),kt.IC(o,a),Pt.e(a)}let r=o.length;for(let a=0;a<r;a++){let h=o[a];h[0]+=s,h[1]+=n,h[2]+=s,h[3]+=n,h[4]+=s,h[5]+=n,h[6]+=s,h[7]+=n}return this.vs=o,this.vs}Bh(t,e,i){if(this.vs!==null&&t.wt===!1)return this.vs;if(this.radiusX===0||this.radiusY===0)return this.vs=[],this.vs;let s=e,n=i,o=this.yl,r=this.ar;o===0&&(o=1e-4),r===0&&(r=1e-4);let a=this.tn*(Math.PI/180),h=this.isLargeArc,l=this.isClockwiseArc,c=this.Qi,u=this._i,d=Math.cos(a),g=Math.sin(a),p=d*(s-c)/2+g*(n-u)/2,m=-g*(s-c)/2+d*(n-u)/2,y=p*p/(o*o)+m*m/(r*r);y>1&&(o*=Math.sqrt(y),r*=Math.sqrt(y));let w=(h===l?-1:1)*Math.sqrt((o*o*r*r-o*o*m*m-r*r*p*p)/(o*o*m*m+r*r*p*p));isNaN(w)&&(w=0);let b=w*o*m/r,v=w*-r*p/o;isNaN(b)&&(b=0),isNaN(v)&&(v=0);let k=(s+c)/2+d*b-g*v,S=(n+u)/2+g*b+d*v,M=(st,et)=>Math.sqrt(st*st+et*et),F=(st,et,ut,gt)=>(st*ut+et*gt)/(M(st,et)*M(ut,gt)),T=(st,et,ut,gt)=>(st*gt<et*ut?-1:1)*Math.acos(F(st,et,ut,gt)),N=T(1,0,(p-b)/o,(m-v)/r),C=(p-b)/o,R=(m-v)/r,O=(-p-b)/o,B=(-m-v)/r,X=T(C,R,O,B),Y=F(C,R,O,B);Y<=-1?X=Math.PI:Y>=1&&(X=0),!l&&X>0&&(X=X-2*Math.PI),l&&X<0&&(X=X+2*Math.PI);let j=o>r?o:r,U=o>r?1:o/r,nt=o>r?r/o:1,at=L.DC(0,0,j,N,N+X,!0),tt=Pt.l();return tt.Ri(),tt.Fs(k,S),tt.cs(this.tn,0,0),tt.tt(U,nt),kt.IC(at,tt),Pt.e(tt),this.vs=at,this.vs}get isClosed(){return(this.n&8)!==0}set isClosed(t){this.isClosed!==t&&(t?this.n|=8:this.n&=-9,this.wt=!0)}get type(){return this.H}set type(t){this.h&&f.L(this,t),this.H=t,this.wt=!0}get endX(){return this.Qi}set endX(t){this.h&&f.L(this,t),this.Qi=t,this.wt=!0}get endY(){return this._i}set endY(t){this.h&&f.L(this,t),this._i=t,this.wt=!0}get point1X(){return this.tn}set point1X(t){this.h&&f.L(this,t),this.tn=t,this.wt=!0}get point1Y(){return this.pl}set point1Y(t){this.h&&f.L(this,t),this.pl=t,this.wt=!0}get point2X(){return this.yl}set point2X(t){this.h&&f.L(this,t),this.yl=t,this.wt=!0}get point2Y(){return this.ar}set point2Y(t){this.h&&f.L(this,t),this.ar=t,this.wt=!0}get centerX(){return this.tn}set centerX(t){this.h&&f.L(this,t),this.tn=t,this.wt=!0}get centerY(){return this.pl}set centerY(t){this.h&&f.L(this,t),this.pl=t,this.wt=!0}get radiusX(){return this.yl}set radiusX(t){t<0&&f.W(t,">= zero",vt,"radiusX"),this.h&&f.L(this,t),this.yl=t,this.wt=!0}get radiusY(){return this.ar}set radiusY(t){t<0&&f.W(t,">= zero",vt,"radiusY"),this.h&&f.L(this,t),this.ar=t,this.wt=!0}get startAngle(){return this.Qi}set startAngle(t){this.h&&f.L(this,t),t=t%360,t<0&&(t+=360),this.Qi=t,this.wt=!0}get sweepAngle(){return this._i}set sweepAngle(t){this.h&&f.L(this,t),t>360&&(t=360),t<-360&&(t=-360),this._i=t,this.wt=!0}get isClockwiseArc(){return(this.n&4)!==0}set isClockwiseArc(t){this.h&&f.L(this,t),t?this.n|=4:this.n&=-5,this.wt=!0}get isLargeArc(){return(this.n&16)!==0}set isLargeArc(t){this.h&&f.L(this,t),t?this.n|=16:this.n&=-17,this.wt=!0}get xAxisRotation(){return this.tn}set xAxisRotation(t){this.h&&f.L(this,t),t=t%360,t<0&&(t+=360),this.tn=t,this.wt=!0}}class Ye{N;Aw;Tw;jg;Hg;qg;Wg;Jg;$g;Zg;Qg;_g;tm;im;ko;em;sm;nm;be;constructor(){this.N=null,this.Aw=new P(0,0).u(),this.Tw=new P(0,0).u(),this.jg=0,this.Hg=0,this.qg=1,this.Wg="",this.Jg="",this.$g=!1,this.Zg=!1,this.Qg=0,this._g=0,this.tm=!1,this.im=!1,this.ko=!1,this.em=null,this.sm=0,this.nm=null,this.be=null}copy(){let t=new Ye;return this.clone(t)}clone(t){return t.N=this.N,t.Aw.a(this.viewPoint),t.Tw.a(this.documentPoint),t.jg=this.jg,t.Hg=this.Hg,t.qg=this.qg,t.Wg=this.Wg,t.Jg=this.Jg,t.$g=this.$g,t.Zg=this.Zg,t.Qg=this.Qg,t._g=this._g,t.tm=this.tm,t.im=this.im,t.ko=this.ko,t.em=this.em,t.sm=this.sm,t.nm=this.nm,t.be=this.be,t}toString(){let t="^";return this.modifiers!==0&&(t+="M:"+this.modifiers),this.button!==0&&(t+="B:"+this.button),this.key!==""&&(t+="K:"+this.key),this.clickCount!==0&&(t+="C:"+this.clickCount),this.delta!==0&&(t+="D:"+this.delta),this.handled&&(t+="h"),this.bubbles&&(t+="b"),this.documentPoint!==null&&(t+="@"+this.documentPoint.toString()),t}get diagram(){return this.N}set diagram(t){this.N=t}get viewPoint(){return this.Aw}set viewPoint(t){this.Aw.a(t)}get documentPoint(){return this.Tw}set documentPoint(t){this.Tw.a(t)}getMultiTouchViewPoint(t,e){let i=this.diagram;return i===null||i.VC(this.event,t,e),e}getMultiTouchDocumentPoint(t,e){let i=this.diagram;return i===null||(i.VC(this.event,t,e),e.a(i.transformViewToDoc(e))),e}get modifiers(){return this.jg}set modifiers(t){this.jg=t}get button(){return this.Hg}set button(t){if(this.Hg=t,this.event===null)switch(t){case 0:this.buttons=1;return;case 1:this.buttons=4;return;case 2:this.buttons=2;return}}get buttons(){return this.qg}set buttons(t){this.qg=t}get key(){return this.Wg}set key(t){this.Wg=t}get code(){return this.Jg}set code(t){this.Jg=t}get down(){return this.$g}set down(t){this.$g=t}get up(){return this.Zg}set up(t){this.Zg=t}get clickCount(){return this.Qg}set clickCount(t){this.Qg=t}get delta(){return this._g}set delta(t){this._g=t}get isMultiTouch(){return this.tm}set isMultiTouch(t){this.tm=t}get handled(){return this.im}set handled(t){this.im=t}get bubbles(){return this.ko}set bubbles(t){this.ko=t}get event(){return this.em}set event(t){this.em=t}get isTouchEvent(){let t=this.event;return t===null?!1:t.pointerType==="touch"||t.pointerType==="pen"}get timestamp(){return this.sm}set timestamp(t){this.sm=t}get targetDiagram(){return this.nm}set targetDiagram(t){this.nm=t}get targetObject(){return this.be}set targetObject(t){this.be=t}get control(){return(this.modifiers&1)!==0}set control(t){this.modifiers=t?this.modifiers|1:this.modifiers&-2}get shift(){return(this.modifiers&4)!==0}set shift(t){this.modifiers=t?this.modifiers|4:this.modifiers&-5}get alt(){return(this.modifiers&2)!==0}set alt(t){this.modifiers=t?this.modifiers|2:this.modifiers&-3}get meta(){return(this.modifiers&8)!==0}set meta(t){this.modifiers=t?this.modifiers|8:this.modifiers&-9}get left(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===0:(this.buttons&1)!==0}set left(t){t?this.buttons|=1:this.buttons&=-2}get right(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===2:(this.buttons&2)!==0}set right(t){t?this.buttons|=2:this.buttons&=-3}get middle(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===1:(this.buttons&4)!==0}set middle(t){t?this.buttons|=4:this.buttons&=-5}get commandKey(){let t=this.code,e=this.key;return"cxvyzagCXVYZAG".includes(e)?e.toLowerCase():t==="KeyC"?"c":t==="KeyX"?"x":t==="KeyV"?"v":t==="KeyY"?"y":t==="KeyZ"?"z":t==="KeyA"?"a":t==="KeyG"?"g":t!==""?t:e}}class Wi{N;Pt;om;rm;constructor(){this.N=null,this.Pt="",this.om=null,this.rm=null}copy(){let t=new Wi;return t.N=this.N,t.Pt=this.Pt,t.om=this.om,t.rm=this.rm,t}toString(){let t="*"+this.name;return this.subject!==null&&(t+=":"+this.subject.toString()),this.parameter!==null&&(t+="("+this.parameter.toString()+")"),t}get diagram(){return this.N}set diagram(t){this.N=t}get name(){return this.Pt}set name(t){this.Pt=t}get subject(){return this.om}set subject(t){this.om=t}get parameter(){return this.rm}set parameter(t){this.rm=t}}var ps=(x=>(x[x.Transaction=1]="Transaction",x[x.Property=2]="Property",x[x.Insert=3]="Insert",x[x.Remove=4]="Remove",x))(ps||{});class ii{au;lm;en;ki;N;cu;ac;cc;fc;uc;constructor(){this.au=2,this.lm="",this.en="",this.ki=null,this.N=null,this.cu=null,this.ac=null,this.cc=null,this.fc=null,this.uc=null}static Transaction=1;static Property=2;static Insert=3;static Remove=4;clear(){this.ki=null,this.N=null,this.cu=null,this.ac=null,this.cc=null,this.fc=null,this.uc=null}copy(){let t=new ii;t.au=this.au,t.lm=this.lm,t.en=this.en,t.ki=this.ki,t.N=this.N,t.cu=this.cu;let e=this.ac;return f.Y(e)&&f.it(e.copyFrozen)?t.ac=e.copyFrozen():t.ac=e,e=this.cc,f.Y(e)&&f.it(e.copyFrozen)?t.cc=e.copyFrozen():t.cc=e,e=this.fc,f.Y(e)&&f.it(e.copyFrozen)?t.fc=e.copyFrozen():t.fc=e,e=this.uc,f.Y(e)&&f.it(e.copyFrozen)?t.uc=e.copyFrozen():t.uc=e,t}oi(t){t in ps?this.change=t:f.er(this,t)}toString(){let t="";return this.change===1?t+="* ":this.change===2?t+=this.model!==null?"!m":"!d":t+=(this.model!==null?"!m":"!d")+this.change,this.propertyName&&typeof this.propertyName=="string"&&(t+=" "+this.propertyName),this.modelChange&&this.modelChange!==this.propertyName&&(t+=" "+this.modelChange),t+=": ",this.change===1?this.oldValue!==null&&(t+=" "+this.oldValue):(this.object!==null&&(t+=f.toString(this.object)),this.oldValue!==null&&(t+=" old: "+f.toString(this.oldValue)),this.oldParam!==null&&(t+=" "+this.oldParam),this.newValue!==null&&(t+=" new: "+f.toString(this.newValue)),this.newParam!==null&&(t+=" "+this.newParam)),t}getValue(t){return t?this.oldValue:this.newValue}getParam(t){return t?this.oldParam:this.newParam}canUndo(){return this.model!==null||this.diagram!==null}undo(){this.canUndo()&&(this.model!==null?this.model.changeState(this,!0):this.diagram!==null&&this.diagram.zC(this,!0))}canRedo(){return this.model!==null||this.diagram!==null}redo(){this.canRedo()&&(this.model!==null?this.model.changeState(this,!1):this.diagram!==null&&this.diagram.zC(this,!1))}get model(){return this.ki}set model(t){this.ki=t}get diagram(){return this.N}set diagram(t){this.N=t}get change(){return this.au}set change(t){this.au=t}get modelChange(){return this.lm}set modelChange(t){this.lm=t}get propertyName(){return this.en}set propertyName(t){this.en=t}get isTransactionFinished(){return this.au===1&&(this.en==="CommittedTransaction"||this.en==="FinishedUndo"||this.en==="FinishedRedo")}get object(){return this.cu}set object(t){this.cu=t}get oldValue(){return this.ac}set oldValue(t){this.ac=t}get oldParam(){return this.cc}set oldParam(t){this.cc=t}get newValue(){return this.fc}set newValue(t){this.fc=t}get newParam(){return this.uc}set newParam(t){this.uc=t}}class Ai{XC;Pt;$k;constructor(){this.XC=new G().u(),this.Pt="",this.$k=!1}toString(t){let e="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(t!==void 0&&t>0){let i=this.changes.count;for(let s=0;s<i;s++){let n=this.changes.elt(s);n!==null&&(e+=`
6
+ `+n.toString())}}return e}clear(){let t=this.changes;t.Nt();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),t.u()}canUndo(){return this.isComplete}undo(){if(this.canUndo())for(let t=this.changes.count-1;t>=0;t--){let e=this.changes.elt(t);e!==null&&e.undo()}}canRedo(){return this.isComplete}redo(){if(!this.canRedo())return;let t=this.changes.count;for(let e=0;e<t;e++){let i=this.changes.elt(e);i!==null&&i.redo()}}uF(t){let e=this.changes;for(let i=e.count-1;i>=t;i--){let s=e.elt(i);s!==null&&s.undo(),e.Nt(),e.removeAt(i)}e.u()}optimize(){if(!this.isComplete)return;let t=this.changes;t.Nt();let e=new pt;for(let s=0;s<t.count;s++){let n=t.elt(s);if(n===null||n.change!==2||!n.object)continue;let o=e.get(n.object);o||(o=new pt,e.set(n.object,o));let r=o.get(n.propertyName);r===null?o.set(n.propertyName,-1):(r>0&&t.setElt(r,null),o.set(n.propertyName,s))}let i=0;for(let s=0;s<t.count;s++){let n=t.elt(s);n!==null&&(s>i&&t.setElt(i,n),i++)}for(;t.length>i;)t.pop();t.u()}get changes(){return this.XC}get name(){return this.Pt}set name(t){this.Pt=t}get isComplete(){return this.$k}set isComplete(t){this.$k=t}}class $i{Dw;Oi;GC;Os;Zk;hm;Vn;Qk;_k;sn;dc;Fw;Is;Rw;vw;am;Ow;constructor(t){this.Dw=new I,this.Oi=!1,this.GC=new G().u(),this.Os=-1,this.Zk=999,this.Is=!1,this.hm=null,this.Vn=0,this.Qk=!1,this._k=23,this.sn=new G().u(),this.dc=new G,this.Fw=!0,this.Rw=!1,this.vw=!1,this.am=!1,this.Ow=!1,t&&Object.assign(this,t)}toString(t){let e="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;e+="[";let i=this.nestedTransactionNames.count;for(let s=0;s<i;s++)s>0&&(e+=" "),e+=this.nestedTransactionNames.elt(s);if(e+="]",t!==void 0&&t>0){i=this.history.count;for(let s=0;s<i;s++)e+=`
7
+ `+this.history.elt(s).toString(t-1)}return e}clear(){let t=this.history;t.Nt();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),this.Os=-1,t.u(),this.Is=!1,this.hm=null,this.Vn=0,this.sn.Nt(),this.sn.clear(),this.sn.u(),this.dc.clear(),this.Rw=!1,this.vw=!1,this.am=!1,this.Ow=!1}copyProperties(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.cm=t.cm}addModel(t){this.Dw.add(t)}removeModel(t){this.Dw.delete(t)}startTransaction(t){if(t===void 0&&(t=""),t===null&&(t=""),this.isUndoingRedoing)return!1;this.Fw===!0&&(this.Fw=!1,this.Vn++,this.wl||this.xl("StartingFirstTransaction",t,this.currentTransaction),this.Vn>0&&this.Vn--),this.isEnabled&&(this.sn.Nt(),this.sn.add(t),this.sn.u(),this.currentTransaction===null?this.dc.add(0):this.dc.add(this.currentTransaction.changes.count)),this.Vn++;let e=this.transactionLevel===1;return e&&(this.wl||this.xl("StartedTransaction",t,this.currentTransaction)),e}commitTransaction(t){return t===void 0&&(t=""),this.YC(!0,t)}rollbackTransaction(){return this.YC(!1,"")}YC(t,e){if(this.isUndoingRedoing)return!1;this.cm&&this.transactionLevel<1&&f.ni("Ending transaction without having started a transaction: "+e);let i=this.transactionLevel===1,s=this.currentTransaction;i&&t&&(this.wl||this.xl("CommittingTransaction",e,s));let n=0;if(this.transactionLevel>0&&(this.Vn--,this.isEnabled)){let o=this.sn.count;o>0&&(e===""&&(e=this.sn.elt(0)),this.sn.Nt(),this.sn.removeAt(o-1),this.sn.u());let r=this.dc.count;r>0&&(n=this.dc.elt(r-1),this.dc.removeAt(r-1))}if(i){if(t){if(this.am=!1,s===null&&e!==""&&(s=this.currentTransaction),this.isEnabled&&s!==null){let o=s;o.isComplete||(o.isComplete=!0,o.name=e),this.discardHistoryAfterIndex();let r=this.history;r.Nt();let a=this.maxHistoryLength;if(a>=0){if(a===0)r.clear();else if(r.count>=a){let h=r.elt(0);h!==null&&h.clear(),r.removeAt(0),this.Os--}}a!==0&&(r.count===0||r.get(r.count-1)!==o)&&(r.add(o),this.Os++),r.u(),s=o}this.wl||this.xl("CommittedTransaction",e,s)}else{this.Is=!0;try{this.isEnabled&&s!==null&&(s.isComplete=!0,s.undo())}finally{this.wl||this.xl("RolledBackTransaction",e,s),this.Is=!1}s!==null&&s.clear()}return this.hm=null,this.Iw&&this.clear(),this.Iw=!1,this.Ew=!1,!0}else return this.isEnabled&&!t&&s!==null&&s.uF(n),!1}discardHistoryAfterIndex(){if(this.isUndoingRedoing||!this.canRedo())return;let t=this.history;t.Nt();for(let e=t.count-1;e>this.historyIndex;e--){let i=t.elt(e);i!==null&&i.clear(),t.removeAt(e),this.am=!0}t.u()}SE(t){this.Vn+=t,this.Vn<0&&(this.Vn=0)}canUndo(){if(!this.isEnabled||this.transactionLevel>0)return!1;let t=this.transactionToUndo;return!!(t!==null&&t.canUndo())}undo(){if(!this.canUndo())return;let t=this.transactionToUndo;try{this.Is=!0,this.xl("StartingUndo","Undo",t),this.Os--,t.undo()}catch(e){f.ni("undo error: "+e.toString())}finally{this.xl("FinishedUndo","Undo",t),this.Is=!1}}canRedo(){if(!this.isEnabled||this.transactionLevel>0)return!1;let t=this.transactionToRedo;return!!(t!==null&&t.canRedo())}redo(){if(!this.canRedo())return;let t=this.transactionToRedo;try{this.Is=!0,this.xl("StartingRedo","Redo",t),this.Os++,t.redo()}catch(e){f.ni("redo error: "+e.toString())}finally{this.xl("FinishedRedo","Redo",t),this.Is=!1}}xl(t,e,i){i===void 0&&(i=null);let s=new ii;s.change=1,s.propertyName=t,s.object=i,s.oldValue=e;let n=this.models;for(;n.next();){let o=n.value;s.model=o,o.dF(s)}}handleChanged(t){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(t)){let e=this.currentTransaction;e===null&&(e=new Ai,this.hm=e);let i=t.copy(),s=e.changes;if(s.Nt(),s.add(i),s.u(),this.cm&&this._k>0&&this.transactionLevel<=0&&!this.Fw){let n=t.diagram;if(n!==null&&n.Vh===!1)return;f.ni("Change not within a transaction: "+i.toString()),this._k--}}}skipsEvent(t){if(t===null||t.change===1)return!0;let e=t.object;if(e===null)return!1;if(e.layer!==void 0){let i=e.layer;if(i!==null&&i.isTemporary)return!0}else if(e.isTemporary)return!0;return!1}get models(){return this.Dw.iterator}get isEnabled(){return this.Oi}set isEnabled(t){this.Oi=t}get transactionToUndo(){return this.historyIndex>=0&&this.historyIndex<=this.history.count-1?this.history.elt(this.historyIndex):null}get transactionToRedo(){return this.historyIndex<this.history.count-1?this.history.elt(this.historyIndex+1):null}get isUndoingRedoing(){return this.Is}get history(){return this.GC}get maxHistoryLength(){return this.Zk}set maxHistoryLength(t){this.Zk=t}get historyIndex(){return this.Os}get currentTransaction(){return this.hm}get transactionLevel(){return this.Vn}get isInTransaction(){return this.Vn>0}get cm(){return this.Qk}set cm(t){this.Qk=t}get nestedTransactionNames(){return this.sn}get Iw(){return this.Rw}set Iw(t){this.Rw=t}get Ew(){return this.vw}set Ew(t){this.vw=t}get wl(){return this.Ow}set wl(t){this.Ow=t}get isJustDiscarded(){return this.am}}class ee{N;Pt;Oi;tP;iP;fm;KC;constructor(){I.Ki(this),this.N=q.um(),this.Pt="",this.Oi=!0,this.tP=!1,this.iP=null,this.KC=new Ye,this.fm=-1}get diagram(){return this.N}set diagram(t){t instanceof q&&(this.N=t)}toString(){return this.name!==""?this.name+" Tool":f.Dn(this.constructor)}updateAdornments(t){}canStart(){return this.isEnabled}doStart(){}doActivate(){this.isActive=!0}doDeactivate(){this.isActive=!1}doStop(){}doCancel(){this.transactionResult=null,this.stopTool()}stopTool(){let t=this.diagram;t.currentTool===this&&(t.currentTool=null,t.currentCursor="")}doMouseDown(){!this.isActive&&this.canStart()&&this.doActivate()}doMouseMove(){}doMouseUp(){this.stopTool()}doMouseWheel(){}canStartMultiTouch(){return!0}standardPinchZoomStart(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.V(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.V(NaN,NaN));if(!i.isReal()||!s.isReal()){P.e(i),P.e(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){t.eP=t.scale;let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o);t.sP=r,e.bubbles=!1}P.e(i),P.e(s)}standardPinchZoomMove(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.V(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.V(NaN,NaN));if(!i.isReal()||!s.isReal()){P.e(i),P.e(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o)/t.sP,a=new P((Math.min(s.x,i.x)+Math.max(s.x,i.x))/2,(Math.min(s.y,i.y)+Math.max(s.y,i.y))/2),h=t.eP*r,l=t.commandHandler;if(h!==t.scale&&l.canResetZoom(h)){let c=t.zoomPoint;t.zoomPoint=a,l.resetZoom(h),t.zoomPoint=c}e.bubbles=!1}P.e(i),P.e(s)}doKeyDown(){this.diagram.lastInput.code==="Escape"&&this.doCancel()}doKeyUp(){}startTransaction(t){return t===void 0&&(t=this.name),this.transactionResult=null,this.diagram.startTransaction(t)}stopTransaction(){let t=this.diagram;return this.transactionResult===null?t.rollbackTransaction():t.commitTransaction(this.transactionResult)}standardMouseSelect(){let t=this.diagram;if(!t.allowSelect)return;let e=t.lastInput,i=t.findPartAt(e.documentPoint,!1);if(i!==null){if(f.tr?e.meta:e.control){t.D("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!s.isSelected),t.D("ChangedSelection",t.selection)}else if(e.shift){if(!i.isSelected){t.D("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!0),t.D("ChangedSelection",t.selection)}}else if(!i.isSelected){let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&t.select(s)}}else e.left&&!(f.tr?e.meta:e.control)&&!e.shift&&t.clearSelection()}standardMouseClick(t,e){t===void 0&&(t=null),e===void 0&&(e=o=>!o.layer?.isTemporary);let i=this.diagram,s=i.lastInput,n=i.findObjectAt(s.documentPoint,t,e);return s.targetObject=n,this.gF(n,s,i),s.handled}gF(t,e,i){if(e.handled=!1,t!==null&&!t.isEnabledObject())return;let s=0;e.left?e.clickCount===1?s=1:e.clickCount===2?s=2:s=1:e.right&&e.clickCount===1&&(s=3);let n="ObjectSingleClicked";if(t!==null){switch(s){case 1:n="ObjectSingleClicked";break;case 2:n="ObjectDoubleClicked";break;case 3:n="ObjectContextClicked";break}s!==0&&i.D(n,t)}else{switch(s){case 1:n="BackgroundSingleClicked";break;case 2:n="BackgroundDoubleClicked";break;case 3:n="BackgroundContextClicked";break}s!==0&&i.D(n)}if(t!==null)for(;t!==null;){let o=null;switch(s){case 1:o=t.click;break;case 2:o=t.doubleClick?t.doubleClick:t.click;break;case 3:o=t.contextClick;break}if(o!==null&&(o(e,t),e.handled))break;t=t.panel}else{let o=null;switch(s){case 1:o=i.click;break;case 2:o=i.doubleClick?i.doubleClick:i.click;break;case 3:o=i.contextClick;break}o!==null&&o(e)}}standardMouseOver(){let t=this.diagram,e=t.lastInput;if(t.animationManager.pi===!0)return;let i=t.skipsUndoManager;t.skipsUndoManager=!0;let s=t.viewportBounds.containsPoint(e.documentPoint)?t.findObjectAt(e.documentPoint,null,null):null;e.event&&(e.event.type==="pointercancel"||e.event.type==="pointerout")&&(s=null),e.targetObject=s;let n=!1;if(s!==t.gc){let o=t.gc,r=o;for(t.gc=s,this.doCurrentObjectChanged(o,s),e.handled=!1;o!==null;){let a=o.mouseLeave;if(a!==null&&(s===o||s!==null&&s.isContainedBy(o)||(a(e,o,s),n=!0,e.handled)))break;o=o.panel}for(o=r,e.handled=!1;s!==null;){let a=s.mouseEnter;if(a!==null&&(o===s||o!==null&&o.isContainedBy(s)||(a(e,s,o),n=!0,e.handled)))break;s=s.panel}s=t.gc}if(s!==null){let o=s,r="";for(;o!==null&&(r=o.cursor,r==="");)o=o.panel;for(t.currentCursor=r,e.handled=!1,o=s;o!==null;){let a=o.mouseOver;if(a!==null&&(a(e,o),n=!0,e.handled))break;o=o.panel}}else{this.doUpdateCursor(null);let o=t.mouseOver;o!==null&&(o(e),n=!0)}n&&t.requestUpdate(),t.skipsUndoManager=i}doUpdateCursor(t){let e=this.diagram;e&&(e.currentCursor="")}doCurrentObjectChanged(t,e){}standardMouseWheel(){let t=this.diagram,e=t.lastInput,i=e.delta;if(i===0||!t.documentBounds.isReal())return;let s=t.commandHandler,n=t.toolManager.mouseWheelBehavior;if(s!==null&&(n===2&&!e.shift||n===1&&e.control)){if(i>0?s.canIncreaseZoom():s.canDecreaseZoom()){let o=t.zoomPoint;t.zoomPoint=e.viewPoint,i>0?s.increaseZoom():s.decreaseZoom(),t.zoomPoint=o}e.bubbles=!1}else if(n===2&&e.shift||n===1&&!e.control){let o=t.position.copy(),r=e.event,a=r.deltaMode,h=r.deltaX,l=r.deltaY,c="pixel";if((h!==0||l!==0)&&!e.shift){switch(a){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break}if(h!==0&&t.allowHorizontalScroll){let u=t.scrollHorizontalLineChange;h=h*(u/16),t.scroll(c,h>0?"right":"left",Math.abs(h))}if(l!==0&&t.allowVerticalScroll){let u=t.scrollVerticalLineChange;l=l*(u/16),t.scroll(c,l>0?"down":"up",Math.abs(l))}}else!e.shift&&t.allowVerticalScroll?(i=i*3*t.scrollVerticalLineChange,t.scroll(c,i>0?"up":"down",Math.abs(i))):e.shift&&t.allowHorizontalScroll&&(i=i*3*t.scrollHorizontalLineChange,t.scroll(c,i>0?"left":"right",Math.abs(i)));this.doWheelChange(t,o,e)}}doWheelChange(t,e,i){(!t.position.equals(e)||i.event.wheelDeltaX!==0)&&(i.bubbles=!1)}standardWaitAfter(t,e){e===void 0&&(e=this.diagram.lastInput),this.cancelWaitAfter();let i=this,s=e.clone(this.KC);this.fm=f.ir(()=>i.doWaitAfter(s),t)}cancelWaitAfter(){this.fm!==-1&&f.Tg(this.fm),this.fm=-1}doWaitAfter(t){}findToolHandleAt(t,e){let i=this.diagram.findObjectAt(t,s=>{for(;s!==null&&!(s.panel instanceof St);)s=s.panel;return s});return i===null?null:i.part.category===e?i:null}isBeyondDragSize(t,e){let i=this.diagram;t===void 0&&(t=i.firstInput.viewPoint),e===void 0&&(e=i.lastInput.viewPoint);let s=i.toolManager.dragSize,n=s.width,o=s.height;return i.firstInput.isTouchEvent&&(n+=6,o+=6),Math.abs(e.x-t.x)>n||Math.abs(e.y-t.y)>o}get name(){return this.Pt}set name(t){f.s(t,"string",ee,"name"),this.Pt=t}get isEnabled(){return this.Oi}set isEnabled(t){f.s(t,"boolean",ee,"isEnabled"),this.Oi=t}get isActive(){return this.tP}set isActive(t){f.s(t,"boolean",ee,"isActive"),this.tP=t}get transactionResult(){return this.iP}set transactionResult(t){t!==null&&f.s(t,"string",ee,"transactionResult"),this.iP=t}}var mn=(x=>(x[x.Scroll=1]="Scroll",x[x.Zoom=2]="Zoom",x[x.None=3]="None",x))(mn||{}),pn=(x=>(x[x.Zoom=1]="Zoom",x[x.Cancel=2]="Cancel",x[x.None=3]="None",x))(pn||{});class xe extends ee{jC;HC;qC;nP;oP;rP;lP;hP;aP;cP;dm;zh;constructor(t){super(),this.name="ToolManager",this.jC=new G,this.HC=new G,this.qC=new G,this.nP=850,this.oP=850,this.rP=new Q(2,2).$(),this.lP=5e3,this.hP=1,this.aP=1,this.cP=null,this.dm=null,this.zh=-1,t&&Object.assign(this,t)}static WheelScroll=1;static WheelZoom=2;static WheelNone=3;static GestureZoom=1;static GestureCancel=2;static GestureNone=3;get mouseWheelBehavior(){return this.hP}set mouseWheelBehavior(t){this.hP=t}get gestureBehavior(){return this.aP}set gestureBehavior(t){this.aP=t}initializeStandardTools(){}updateAdornments(t){let e=this.currentToolTip;if(e instanceof St&&this.dm===t){let i=e.adornedObject;(t!==null?i!==null&&i.part===t:i===null)?this.showToolTip(e,i):this.hideToolTip()}}doMouseDown(){let t=this.diagram,e=t.lastInput;if(e.isTouchEvent&&this.gestureBehavior===2&&(e.bubbles=!1),e.isMultiTouch){if(this.cancelWaitAfter(),this.gestureBehavior===3){e.bubbles=!0;return}if(this.gestureBehavior===2)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomStart();return}}let i=t.undoManager,s=this.mouseDownTools.length;for(let n=0;n<s;n++){let o=this.mouseDownTools.elt(n);if(o.diagram=this.diagram,o.canStart()){t.doFocus(),t.currentTool=o,t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseDown());return}}t.lastInput.button===1&&(this.mouseWheelBehavior===1?this.mouseWheelBehavior=2:this.mouseWheelBehavior===2&&(this.mouseWheelBehavior=1)),this.doActivate(),this.standardWaitAfter(this.holdDelay,e)}doMouseMove(){let t=this.diagram,e=t.lastInput;if(e.isMultiTouch){if(this.gestureBehavior===3){e.bubbles=!0;return}if(this.gestureBehavior===2)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomMove();return}}if(this.isActive){let s=this.mouseMoveTools.length;for(let n=0;n<s;n++){let o=this.mouseMoveTools.elt(n);if(o.diagram=this.diagram,o.canStart()){t.doFocus(),t.currentTool=o,t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseMove());return}}}this.standardMouseActivity(t);let i=e.event;i!==null&&(i.type==="pointermove"||!i.cancelable)&&(e.bubbles=!0)}standardMouseActivity(t){this.standardMouseOver(),this.isBeyondDragSize()&&this.standardWaitAfter(this.isActive?this.holdDelay:this.hoverDelay,t.lastInput)}doCurrentObjectChanged(t,e){let i=this.currentToolTip;i!==null&&(e!==null&&i instanceof St&&(e===i||e.isContainedBy(i))||this.hideToolTip())}doWaitAfter(t){let e=this.diagram;if(e.mF()&&(this.doMouseHover(),this.isActive||this.doToolTip(),t.isTouchEvent&&!e.lastInput.handled)){let i=t.copy();i.button=2,e.lastInput=i,e.Uw=!0,e.doMouseUp();return}}doMouseHover(){let t=this.diagram,e=t.lastInput;e.targetObject===null&&(e.targetObject=t.findObjectAt(e.documentPoint,null,null));let i=e.targetObject;if(i!==null)for(e.handled=!1;i!==null;){let s=this.isActive?i.mouseHold:i.mouseHover;if(s!==null&&(s(e,i),e.handled))break;i=i.panel}else{let s=this.isActive?t.mouseHold:t.mouseHover;s!==null&&s(e)}}doToolTip(){let t=this.diagram,e=t.lastInput;e.targetObject===null&&(e.targetObject=t.findObjectAt(e.documentPoint,null,null));let i=e.targetObject;if(i!==null){let s=this.currentToolTip;if(s instanceof St&&(i===s||i.isContainedBy(s)))return;for(;i!==null;){let n=i.toolTip;if(n!==null){this.showToolTip(n,i);return}i=i.panel}this.hideToolTip()}else{let s=t.toolTip;s!==null?this.showToolTip(s,null):this.hideToolTip()}}showToolTip(t,e){let i=this.diagram;if(t!==this.currentToolTip&&this.hideToolTip(),t instanceof St){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category="ToolTip",t.hasPlaceholder()&&(t.placeholder.scale=i.scale);let n=t.diagram;n!==null&&n!==i&&n.remove(t),i.add(t),e!==null?t.adornedObject=e:t.data=i.model,t.ensureBounds(),this.positionToolTip(t,e)}else t instanceof Ne&&t!==this.currentToolTip&&t.show!==null&&t.show(e,i,this);this.currentToolTip=t,this.zh!==-1&&(f.Tg(this.zh),this.zh=-1);let s=this.toolTipDuration;if(s>0&&s!==1/0){let n=this;this.zh=f.ir(()=>n.hideToolTip(),s)}}positionToolTip(t,e){if(t.hasPlaceholder())return;let i=t,s=this.diagram,n=s.lastInput.documentPoint.copy(),o=i.measuredBounds,r=s.viewportBounds;s.lastInput.isTouchEvent&&(n.x-=o.width),n.x+o.width>r.right&&(n.x-=o.width+5/s.scale),n.x<r.x&&(n.x=r.x),n.y+20/s.scale+o.height>r.bottom?n.y-=o.height+5/s.scale:n.y+=20/s.scale,n.y<r.y&&(n.y=r.y),i.position=n}hideToolTip(){this.zh!==-1&&(f.Tg(this.zh),this.zh=-1);let t=this.diagram,e=this.currentToolTip;e!==null&&(e instanceof St?(t.remove(e),this.dm!==null&&this.dm.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Ne&&e.hide!==null&&e.hide(t,this),this.currentToolTip=null)}get currentToolTip(){return this.cP}set currentToolTip(t){this.cP=t,this.dm=t!==null&&t instanceof St?t.adornedPart:null}doMouseUp(){this.cancelWaitAfter();let t=this.diagram;if(this.isActive){let e=this.mouseUpTools.length;for(let i=0;i<e;i++){let s=this.mouseUpTools.elt(i);if(s.diagram=this.diagram,s.canStart()){t.doFocus(),t.currentTool=s,t.currentTool===s&&(s.isActive||s.doActivate(),s.doMouseUp());return}}}t.doFocus(),this.doDeactivate()}doMouseWheel(){this.standardMouseWheel()}doKeyDown(){let t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyDown()}doKeyUp(){let t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyUp()}findTool(t){f.s(t,"string",xe,"findTool:name");let e=this.mouseDownTools.length;for(let i=0;i<e;i++){let s=this.mouseDownTools.elt(i);if(s.name===t)return s}e=this.mouseMoveTools.length;for(let i=0;i<e;i++){let s=this.mouseMoveTools.elt(i);if(s.name===t)return s}e=this.mouseUpTools.length;for(let i=0;i<e;i++){let s=this.mouseUpTools.elt(i);if(s.name===t)return s}return null}replaceTool(t,e){f.s(t,"string",xe,"replaceTool:name"),e!==null&&(e.diagram=this.diagram);let i=this.mouseDownTools.length;for(let s=0;s<i;s++){let n=this.mouseDownTools.elt(s);if(n.name===t)return e!==null?this.mouseDownTools.setElt(s,e):this.mouseDownTools.removeAt(s),n}i=this.mouseMoveTools.length;for(let s=0;s<i;s++){let n=this.mouseMoveTools.elt(s);if(n.name===t)return e!==null?this.mouseMoveTools.setElt(s,e):this.mouseMoveTools.removeAt(s),n}i=this.mouseUpTools.length;for(let s=0;s<i;s++){let n=this.mouseUpTools.elt(s);if(n.name===t)return e!==null?this.mouseUpTools.setElt(s,e):this.mouseUpTools.removeAt(s),n}return null}replaceStandardTool(t,e,i){this.Jt(t,e,i)}Jt(t,e,i){f.s(t,"string",xe,"replaceStandardTool:name"),e!==null&&(e.name=t,e.diagram=this.diagram),this.findTool(t)?this.replaceTool(t,e):e!==null&&i.add(e)}get mouseDownTools(){return this.jC}get mouseMoveTools(){return this.HC}get mouseUpTools(){return this.qC}get hoverDelay(){return this.nP}set hoverDelay(t){f.s(t,"number",xe,"hoverDelay"),this.nP=t}get holdDelay(){return this.oP}set holdDelay(t){f.s(t,"number",xe,"holdDelay"),this.oP=t}get dragSize(){return this.rP}set dragSize(t){this.rP=t.P()}get toolTipDuration(){return this.lP}set toolTipDuration(t){f.s(t,"number",xe,"toolTipDuration"),this.lP=t}get actionTool(){return this.findTool("Action")}set actionTool(t){this.Jt("Action",t,this.mouseDownTools)}get relinkingTool(){return this.findTool("Relinking")}set relinkingTool(t){this.Jt("Relinking",t,this.mouseDownTools)}get linkReshapingTool(){return this.findTool("LinkReshaping")}set linkReshapingTool(t){this.Jt("LinkReshaping",t,this.mouseDownTools)}get resizingTool(){return this.findTool("Resizing")}set resizingTool(t){this.Jt("Resizing",t,this.mouseDownTools)}get rotatingTool(){return this.findTool("Rotating")}set rotatingTool(t){this.Jt("Rotating",t,this.mouseDownTools)}get linkingTool(){return this.findTool("Linking")}set linkingTool(t){this.Jt("Linking",t,this.mouseMoveTools)}get draggingTool(){return this.findTool("Dragging")}set draggingTool(t){this.Jt("Dragging",t,this.mouseMoveTools)}get dragSelectingTool(){return this.findTool("DragSelecting")}set dragSelectingTool(t){this.Jt("DragSelecting",t,this.mouseMoveTools)}get panningTool(){return this.findTool("Panning")}set panningTool(t){this.Jt("Panning",t,this.mouseMoveTools)}get contextMenuTool(){return this.findTool("ContextMenu")}set contextMenuTool(t){this.Jt("ContextMenu",t,this.mouseUpTools)}get textEditingTool(){return this.findTool("TextEditing")}set textEditingTool(t){this.Jt("TextEditing",t,this.mouseUpTools)}get clickCreatingTool(){return this.findTool("ClickCreating")}set clickCreatingTool(t){this.Jt("ClickCreating",t,this.mouseUpTools)}get clickSelectingTool(){return this.findTool("ClickSelecting")}set clickSelectingTool(t){this.Jt("ClickSelecting",t,this.mouseUpTools)}}class Dt extends ee{fP;uP;nn;dP;gP;mP;pP;mc;gm;yP;Xh;cr;WC;wP;fu;uu;xP;bP;kP;PP;constructor(t){super(),this.name="Dragging",this.fP=!0,this.PP=!0,this.uP=!0,this.nn=null,this.dP=null,this.gP=null,this.mP=null,this.pP=!1,this.fu=!1,this.mc=new P(NaN,NaN),this.gm=new P,this.yP=!0,this.Xh=100,this.cr=[],this.WC=new I().u(),this.wP=new Qi,this.uu=null,this.xP="copy",this.bP="",this.kP="no-drop",t&&Object.assign(this,t)}get isCopyEnabled(){return this.fP}set isCopyEnabled(t){f.s(t,"boolean",Dt,"isCopyEnabled"),this.fP=t}get copiesEffectiveCollection(){return this.uP}set copiesEffectiveCollection(t){f.s(t,"boolean",Dt,"copiesEffectiveCollection"),this.uP=t}get dragOptions(){return this.wP}set dragOptions(t){this.wP=t}get isGridSnapEnabled(){return this.dragOptions.isGridSnapEnabled}set isGridSnapEnabled(t){f.s(t,"boolean",Dt,"isGridSnapEnabled"),this.dragOptions.isGridSnapEnabled=t}get isComplexRoutingRealtime(){return this.yP}set isComplexRoutingRealtime(t){this.yP=t;let e=this.diagram.findRouter("AvoidsLinks");e!==null&&(e.isRealtime=t)}get isGridSnapRealtime(){return this.dragOptions.isGridSnapRealtime}set isGridSnapRealtime(t){f.s(t,"boolean",Dt,"isGridSnapRealtime"),this.dragOptions.isGridSnapRealtime=t}get gridSnapCellSize(){return this.dragOptions.gridSnapCellSize}set gridSnapCellSize(t){this.dragOptions.gridSnapCellSize.equals(t)||(t=t.P(),this.dragOptions.gridSnapCellSize=t)}get gridSnapCellSpot(){return this.dragOptions.gridSnapCellSpot}set gridSnapCellSpot(t){this.dragOptions.gridSnapCellSpot.equals(t)||(t=t.P(),this.dragOptions.gridSnapCellSpot=t)}get gridSnapOrigin(){return this.dragOptions.gridSnapOrigin}set gridSnapOrigin(t){this.dragOptions.gridSnapOrigin.equals(t)||(t=t.P(),this.dragOptions.gridSnapOrigin=t)}get dragsLink(){return this.dragOptions.dragsLink}set dragsLink(t){f.s(t,"boolean",Dt,"dragsLink"),this.dragOptions.dragsLink=t}get dragsTree(){return this.dragOptions.dragsTree}set dragsTree(t){f.s(t,"boolean",Dt,"dragsTree"),this.dragOptions.dragsTree=t}get copyCursor(){return this.xP}set copyCursor(t){this.xP=t}get moveCursor(){return this.bP}set moveCursor(t){this.bP=t}get nodropCursor(){return this.kP}set nodropCursor(t){this.kP=t}get currentPart(){return this.dP}set currentPart(t){this.dP=t}get copiedParts(){return this.mP}set copiedParts(t){this.mP=t}get draggedParts(){return this.gP}set draggedParts(t){this.gP=t}get draggingParts(){return this.copiedParts!==null?this.copiedParts.toKeySet():this.draggedParts!==null?this.draggedParts.toKeySet():this.WC}get draggedLink(){return this.diagram.draggedLink}set draggedLink(t){this.diagram.draggedLink=t}get isDragOutStarted(){return this.pP}set isDragOutStarted(t){this.pP=t}get startPoint(){return this.gm}set startPoint(t){this.gm.equals(t)||this.gm.a(t)}get delay(){return this.Xh}set delay(t){f.s(t,"number",Dt,"delay"),this.Xh=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly&&!t.allowDragOut||!t.allowMove&&!t.allowCopy&&!t.allowDragOut||!t.allowSelect)return!1;let e=t.lastInput;return!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.isTouchEvent&&e.timestamp-t.firstInput.timestamp<this.Xh)?!1:this.findDraggablePart()!==null}findDraggablePart(){let t=this.diagram,e=t.findPartAt(t.firstInput.documentPoint,!1);if(e===null)return null;for(;e!==null&&!e.canSelect();)e=e.containingGroup;return e!==null&&(e.canMove()||e.canCopy())?e:null}standardMouseSelect(){let t=this.diagram;if(!t.allowSelect)return;let e=t.findPartAt(t.firstInput.documentPoint,!1);if(e!==null){for(;e!==null&&!e.canSelect();)e=e.containingGroup;if(this.currentPart=e,this.currentPart!==null&&!this.currentPart.isSelected){t.D("ChangingSelection",t.selection);let i=t.lastInput;!(f.tr?i.meta:i.control)&&!i.shift&&t.clearSelection(!0),this.currentPart.isSelected=!0,t.D("ChangedSelection",t.selection)}}}doActivate(){let t=this.diagram;this.uu=null,this.currentPart===null&&this.standardMouseSelect();let e=this.currentPart;if(e===null||!e.canMove()&&!e.canCopy())return;t.cacheGroupExternalLinks(!0),Dt.dt=null,this.isActive=!0,this.mc.set(t.position),this.SP(t.selection),this.cr.length=0,t.animationManager.stopAnimation();let i=this.computeEffectiveCollection(t.selection,this.dragOptions);this.draggedParts=i,this.PP=!!this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,t.du=!0,t.getRenderingHint("temporaryPixelRatio")===!0&&t.avgSpf>30&&t.Bw(),t.JC(this.draggedParts),t.gu=!0,this.startTransaction("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&this.pF()}SP(t){if(!this.dragsLink)return;let e=this.diagram,i=e.model.mm(),s=t.first();i&&t.count===1&&s instanceof _&&this.mayDragLink(s)?(this.draggedLink=s,this.draggedLink.canRelinkFrom()&&this.draggedLink.canRelinkTo()&&this.draggedLink.clearAdornments(),this.nn=e.toolManager.findTool("Relinking"),this.nn===null&&(this.nn=new ys,this.nn.diagram=e),this.nn.originalLink=this.draggedLink):(this.draggedLink=null,this.nn=null)}mayDragLink(t){let e=this.diagram;return e!==null&&e.allowRelink}computeEffectiveCollection(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)}Es(t){return t===void 0?new ni(P.xo):this.isGridSnapEnabled?new ni(new P(Math.round(t.x*1e3)/1e3,Math.round(t.y*1e3)/1e3)):new ni(t.copy())}doDeactivate(){this.isActive=!1;let t=this.diagram;this.diagram.layout.isRealtime=this.PP,t.gu=!1,t.bl=!0,t.cacheGroupExternalLinks(!1),t.stopAutoScroll(),this.MP(),t.NP(this.draggedParts),this.uu=null,this.currentPart=null,this.draggedParts=null,this.isDragOutStarted=!1,this.fu=!1,Dt.yF(),this.$C(),this.mc.i(NaN,NaN),Dt.Gh!==null&&(Dt.Gh.currentCursor=""),Dt.Gh=null,Dt.dt=null,this.kl(),t.isMouseCaptured=!1,t.currentCursor="",t.du=!1,this.stopTransaction(),t.CP(!0)}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}MP(){let t=this.diagram,e=t.skipsUndoManager;t.skipsUndoManager=!0;let i=t.lastInput;this.ZC(i,null),t.skipsUndoManager=e,this.cr.length=0}QC(){this.kl(),this.LP();let t=this.diagram;this.mc.isReal()&&(t.position=this.mc),t.stopAutoScroll()}doCancel(){this.kl(),this.LP();let t=this.diagram;this.mc.isReal()&&(t.position=this.mc),this.stopTool()}doKeyDown(){let t=this.diagram;if(!this.isActive)return;let e=t.lastInput,i=t.previousInput;e.code==="Escape"?this.doCancel():(e.code!==i.code||e.modifiers!==i.modifiers)&&this.doMouseMove()}doKeyUp(){this.isActive&&this.doMouseMove()}wF(t,e){let i=1/0,s=1/0,n=-1/0,o=-1/0,r=t.iterator;for(;r.next();){let a=r.value;if(!a.isVisible())continue;let h=a.location,l=h.x,c=h.y;isNaN(l)||isNaN(c)||(l<i&&(i=l),c<s&&(s=c),l>n&&(n=l),c>o&&(o=c))}return i===1/0?e.i(0,0,0,0):e.i(i,s,n-i,o-s),e}AP(t){if(this.copiedParts!==null)return;let e=this.diagram;if(t&&(e.isReadOnly||e.isModelReadOnly)||this.draggedParts===null)return;let i=e.undoManager;i.isEnabled&&i.isInTransaction?i.currentTransaction!==null&&i.currentTransaction.changes.count>0&&(e.undoManager.rollbackTransaction(),e.startTransaction("Drag")):this.LP(),e.skipsUndoManager=!t,e.partManager.addsToTemporaryLayer=!t,this.startPoint=e.firstInput.documentPoint;let s=this.copiesEffectiveCollection?this.draggedParts.toKeySet():e.selection,n=e.copyParts(s,e,!0),o=new pt,r=this.draggedParts.iterator;for(;r.next();){let h=r.key;if(h.ke()&&h.canCopy()){let l=n.get(h);if(l===null)continue;l.location=h.location,l.ensureBounds(),o.set(l,this.Es(l.location))}}let a=n.iterator;for(;a.next();){let h=a.value;h instanceof _&&h.canCopy()&&o.set(h,this.Es())}if(this.copiedParts=o,this.SP(o.toKeySet()),this.draggedLink!==null){let h=this.draggedLink,l=h.routeBounds;h.fr(this.startPoint.x-(l.x+l.width/2),this.startPoint.y-(l.y+l.height/2))}this.doUpdateCursor(null)}kl(){let t=this.diagram;if(this.copiedParts!==null){if(t.removeParts(this.copiedParts.toKeySet(),!1),this.copiedParts=null,this.draggedParts!==null){let e=this.draggedParts.iterator;for(;e.next();)if(e.key instanceof _){let i=e.value;i.point=new P(0,0)}}this.doUpdateCursor(null)}t.skipsUndoManager=!1,t.partManager.addsToTemporaryLayer=!1,this.startPoint=t.firstInput.documentPoint}$C(){this.draggedLink!==null&&(this.dragsLink&&this.nn!==null&&(this.nn.stopDraggingMouseMove(),this.nn.originalLink=null),this.draggedLink=null,this.nn=null)}pc(t,e){if(t===null)return;let i=this.diagram,s=this.startPoint,n=P.l();n.a(i.lastInput.documentPoint),this.moveParts(t,n.subtract(s),e),P.e(n),i.getRenderingHint("temporaryPixelRatio")===!0&&i.Pl===null&&i.avgSpf>30&&(i.Bw(),i.mu())}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram;s!==null&&s.TP(t,e,this.dragOptions,i)}LP(){if(this.draggedParts===null)return;let t=this.diagram,e=this.draggedParts.iterator;for(;e.next();){let i=e.key;i.ke()&&(i.location=e.value.point)}for(e=this.draggedParts.iterator;e.next();){let i=e.key;if(i instanceof _&&i.suspendsRouting){let s=e.value.point;this.draggedParts.set(i,this.Es()),i.fr(-s.x,-s.y)}}t.maybeUpdate()}xF(t){if(t===null)return!0;let e=t.part;return!!(e===null||e instanceof St||e.layer?.isTemporary||this.draggedParts&&this.draggedParts.has(e)||this.copiedParts&&this.copiedParts.has(e))}DP(t){let e=this.diagram;this.dragsLink&&(this.draggedLink!==null&&(this.draggedLink.fromNode=null,this.draggedLink.toNode=null),this._C(!1));let i=this.findDragOverObject(t),s=e.lastInput;s.targetObject=i,this.doUpdateCursor(i);let n=e.skipsUndoManager,o=!1;try{if(e.skipsUndoManager=!0,o=this.ZC(s,i),!this.isActive&&Dt.dt===null)return;let r=i!==null?i.part:null;if(r===null||e.handlesDragDropForTopLevelParts&&r.isTopLevel&&!(r instanceof ft)){let a=e.mouseDragOver;a!==null&&(a(s),o=!0)}if(!this.isActive&&Dt.dt===null||(this.doDragOver(t,i),!this.isActive&&Dt.dt===null))return}finally{e.skipsUndoManager=n,o&&e.maybeUpdate()}this.uu=i,!e.isReadOnly&&(e.allowMove||e.allowCopy)&&(e.allowHorizontalScroll||e.allowVerticalScroll)&&e.doAutoScroll(s.viewPoint)}findDragOverObject(t){return this.diagram.FP(t,null,e=>!this.xF(e))}doUpdateCursor(t){let e=this.diagram;(t===null||this.uu!==t)&&(!this.diagram.currentTool.isActive||this.mayCopy()?e.currentCursor=this.copyCursor:this.mayMove()?e.currentCursor=this.moveCursor:this.mayDragOut()&&(e.currentCursor=this.nodropCursor))}ZC(t,e){let i=!1,s=this.cr.length,n=s>0?this.cr[0]:null;if(e===n)return!1;t.handled=!1;for(let r=0;r<s;r++){let a=this.cr[r],h=a.mouseDragLeave;if(h!==null&&(h(t,a,e),i=!0,t.handled))break}if(this.cr.length=0,!this.isActive&&Dt.dt===null||e===null)return i;t.handled=!1;let o=e;for(;o!==null;)this.cr.push(o),o=this.tL(o);s=this.cr.length;for(let r=0;r<s;r++){let a=this.cr[r],h=a.mouseDragEnter;if(h!==null&&(h(t,a,n),i=!0,t.handled))break}return i}ME(t,e){return t===null?!1:!!(t===e||t.isContainedBy(e)||e instanceof ft&&!(t instanceof ft)&&e.handlesDragDropForMembers&&t.part?.isMemberOf(e))}tL(t){let e=t.panel;if(e!==null)return e;if(t instanceof Nt&&!(t instanceof ft)){let i=t.containingGroup;if(i!==null&&i.handlesDragDropForMembers)return i}return null}iL(t,e){let i=this.diagram,s=this.nn;if(s===null)return null;let n=s.portGravity,o=i.findObjectsNear(t,n,l=>s.findValidLinkablePort(l,e)),r=P.l(),a=1/0,h=null;for(let l=o.iterator;l.next();){let c=l.value;if(c.part===null)continue;let u=c.getDocumentPoint(D.Center,r),d=t.distanceSquaredPoint(u);d<a&&(h=c,a=d)}return P.e(r),h}_C(t){let e=this.draggedLink;if(e!==null){if(e.pointsCount<2)return;let i=this.diagram;if(i.isReadOnly)return;let s=this.nn;if(s===null)return;let n=null,o=null;e.fromNode===null&&(n=this.iL(e.getPoint(0),!1),n!==null&&(o=n.part));let r=null,a=null;e.toNode===null&&(r=this.iL(e.getPoint(e.pointsCount-1),!0),r!==null&&(a=r.part)),s.isValidLink(o,n,a,r)?t?(e.defaultFromPoint=e.getPoint(0),e.defaultToPoint=e.getPoint(e.pointsCount-1),e.suspendsRouting=!1,e.fromNode=o,n!==null&&(e.fromPortId=n.portId),e.toNode=a,r!==null&&(e.toPortId=r.portId),e.fromPort!==i.RP&&i.D("LinkRelinked",e,i.RP),e.toPort!==i.vP&&i.D("LinkRelinked",e,i.vP)):s.doDraggingMouseMove(o,n,a,r):s.doDraggingMouseMove(null,null,null,null)}}doDragOver(t,e){}eL(t){let e=this.diagram;this.dragsLink&&this._C(!0),this.MP();let i=this.findDragOverObject(t),s=e.lastInput;if(s.targetObject=i,i!==null){s.handled=!1;let a=i;for(;a!==null;){let h=a.mouseDrop;if(h!==null&&(h(s,a),s.handled))break;this.bF(s,a),a=this.tL(a)}}else{let a=e.mouseDrop;a!==null&&a(s)}if(!this.isActive&&Dt.dt===null)return;let n=this.copiedParts||this.draggedParts;if(n!==null){let a=n.iterator;for(;a.next();){let h=a.key;h instanceof rt&&h.linksConnected.each(l=>l.suspendsRouting=!1)}}if(this.doDropOnto(t,i),!this.isActive&&Dt.dt===null)return;let o=z.l(),r=e.selection.iterator;for(;r.next();){let a=r.value;a instanceof rt&&this.kF(e,a,o)}z.e(o)}bF(t,e){let i=this.diagram,s=e.part;if(i.handlesDragDropForTopLevelParts&&s!==null&&s.isTopLevel&&!(s instanceof ft)){let n=i.mouseDrop;n!==null&&n(t)}}kF(t,e,i){if(!e.canAvoid())return;let s=!1;i=e.getAvoidableRect(i),t.viewportBounds.containsRect(i)&&(s=!0);let n=this.copiedParts||this.draggedParts;if(n===null)return;let o=t.OP(i,a=>a.part,a=>a instanceof _,!0,a=>a instanceof _,s);if(o.count===0)return;let r=o.iterator;for(;r.next();){let a=r.value;n.has(a)&&n.has(e)||!a.isMemberOf(e)&&a.isAvoiding&&a.invalidateRoute()}}doDropOnto(t,e){}doMouseMove(){if(!this.isActive)return;let t=this.diagram,e=t.lastInput;this.simulatedMouseMove(e.event,e.documentPoint,e.targetDiagram)||this.currentPart!==null&&this.draggedParts!==null&&(this.mayCopy()?(this.AP(!1),this.pc(this.copiedParts,!1)):this.mayMove()?(this.kl(),this.pc(this.draggedParts,!0)):this.mayDragOut()?(this.AP(!1),this.pc(this.copiedParts,!1)):this.kl(),this.DP(t.lastInput.documentPoint))}doMouseUp(){if(!this.isActive)return;let t=this.diagram,e=t.lastInput;if(this.simulatedMouseUp(e.event,e.documentPoint,e.targetDiagram))return;let i=!1,s=this.mayCopy();if(s&&this.copiedParts!==null?(this.kl(),this.AP(!0),this.pc(this.copiedParts,!1),this.copiedParts!==null&&(t.D("ChangingSelection",t.selection),t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0}))):(i=!0,this.kl(),this.mayMove()&&(this.pc(this.draggedParts,!0),this.DP(t.lastInput.documentPoint))),this.fu=!0,this.eL(t.lastInput.documentPoint),this.isActive){let n=s&&this.copiedParts,o=n?this.copiedParts?.toKeySet():this.draggedParts?this.draggedParts.toKeySet():null;this.copiedParts=null,i&&this.PF(),t.invalidateDocumentBounds(),t.NP(this.draggedParts),this.transactionResult=n?"Copy":"Move",t.D(n?"SelectionCopied":"SelectionMoved",o)}this.stopTool(),s&&t.D("ChangedSelection",t.selection)}simulatedMouseMove(t,e,i){if(Dt.dt===null)return!1;let s=Dt.dt.diagram;i instanceof q||(i=null);let n=Dt.Gh;if(i!==n){if(n!==null&&n!==s){n.stopAutoScroll(),Dt.dt.isDragOutStarted=!1;let r=n.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDragLeave()}if(Dt.Gh=i,i!==null&&i!==s){Dt.dt.QC();let r=i.toolManager.findTool("Dragging");r!==null&&(r.sL(),r.doSimulatedDragEnter())}this.doUpdateCursor(null)}if(i===null||i===s||!i.allowDrop||i.isReadOnly||!i.allowInsert)return!1;let o=i.toolManager.findTool("Dragging");if(o!==null){let r=e;t!==null&&(t.targetTouches!==void 0&&(t.targetTouches.length>0?t=t.targetTouches[0]:t.changedTouches.length>0&&(t=t.changedTouches[0])),r=i.getMouse(t)),i.lastInput.documentPoint=r,i.lastInput.viewPoint=i.transformDocToView(r),i.lastInput.down=!1,i.lastInput.up=!1,o.doSimulatedDragOver()}return!0}simulatedMouseUp(t,e,i){if(Dt.dt===null)return!1;let s=Dt.Gh,n=Dt.dt.diagram;if(i===null)return Dt.dt.doCancel(),!0;if(i!==s){if(s!==null){let r=s.toolManager.findTool("Dragging");if(s!==null&&s!==n&&r!==null)return s.stopAutoScroll(),Dt.dt.isDragOutStarted=!1,r.doSimulatedDragLeave(),!1}Dt.Gh=i;let o=i.toolManager.findTool("Dragging");o!==null&&(Dt.dt.QC(),o.sL(),o.doSimulatedDragEnter())}if(i!==this.diagram){let o=e;t!==null?(t.targetTouches!==void 0&&(t.targetTouches.length>0?t=t.targetTouches[0]:t.changedTouches.length>0&&(t=t.changedTouches[0])),o=i.getMouse(t)):o===null&&(o=new P),i.lastInput.documentPoint=o,i.lastInput.viewPoint=i.transformDocToView(o),i.lastInput.down=!1,i.lastInput.up=!0;let r=i.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDrop();let a=Dt.dt;if(a!==null){let h=a.mayCopy();a.transactionResult=h?"Copy":"Move",a.stopTool()}return!0}return!1}PF(){if(this.draggedParts===null)return;let t=this.draggedParts.iterator;for(;t.next();){let e=t.key;if(e instanceof rt){let i=e.containingGroup;i!==null&&i.hasPlaceholder()&&!this.draggedParts.has(i)&&i.placeholder.c()}}}mayCopy(){if(!this.isCopyEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowCopy||!(f.tr?t.lastInput.alt:t.lastInput.control))return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())}mayDragOut(){if(!this.isCopyEnabled)return!1;let t=this.diagram;if(!t.allowDragOut||!t.allowCopy||t.allowMove)return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())}mayMove(){let t=this.diagram;if(t.isReadOnly||!t.allowMove)return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canMove())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canMove())}sL(){Dt.Vw.has(this)||Dt.Vw.add(this)}static yF(){if(Dt.Vw.count>0){let t=Dt.Vw,e=t.length;for(let i=0;i<e;i++){let s=t.elt(i);s.$C(),s.kl(),s.MP(),s.diagram.stopAutoScroll()}t.clear()}}computeBorder(t,e,i){return!this.fu&&this.draggedParts!==null&&!this.draggedParts.has(t)?i.a(e):null}getDraggingSource(){return Dt.dt}mayDragIn(){let t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;let e=Dt.dt;return!(e===null||e.diagram.model.dataFormat!==t.model.dataFormat)}doSimulatedDragEnter(){if(!this.mayDragIn())return;let t=this.diagram;t.animationManager.stopAnimation(),t.ur(),t.animationManager.stopAnimation();let e=Dt.dt;e!==null&&(this.diagram.du=!0,t.lastInput.event===null&&(t.lastInput.event=e.diagram.lastInput.event)),this.doUpdateCursor(null)}doSimulatedDragLeave(){let t=Dt.dt;t!==null&&t.doSimulatedDragOut(),this.diagram.du=!1,this.doCancel()}doSimulatedDragOver(){let t=this.diagram;t.animationManager.pu=!0;let e=Dt.dt;if(e!==null&&e.draggedParts!==null){if(!this.mayDragIn())return;this.nL(e.draggedParts.toKeySet(),!1,t.firstInput),this.pc(this.copiedParts,!1),this.DP(t.lastInput.documentPoint)}t.animationManager.pu=!1}doSimulatedDrop(){let t=this.diagram,e=Dt.dt;if(e!==null){let i=e.diagram;if(e.fu=!0,this.kl(),e.draggedParts===null||!this.mayDragIn())return;t.animationManager.pu=!0,t.D("ChangingSelection",t.selection),this.startTransaction("Drop"),this.nL(e.draggedParts.toKeySet(),!0,t.lastInput),this.pc(this.copiedParts,!1);let s=new I;this.copiedParts!==null&&(t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0,s.add(n)})),this.eL(t.lastInput.documentPoint),t.invalidateDocumentBounds(),this.copiedParts!==null&&(this.transactionResult="ExternalCopy"),this.copiedParts=null,t.doFocus(),t.du=!1,t.D("ExternalObjectsDropped",s,i),this.stopTransaction(),t.D("ChangedSelection",t.selection)}t.animationManager.pu=!1}nL(t,e,i){if(this.copiedParts!==null)return;let s=this.diagram;if(s.isReadOnly||s.isModelReadOnly)return;s.skipsUndoManager=!e,s.partManager.addsToTemporaryLayer=!e,this.startPoint=i.documentPoint;let n=s.copyParts(t,s,!0),o=z.l();this.wF(t,o);let r=o.x+o.width/2,a=o.y+o.height/2;z.e(o);let h=this.gm,l=new pt,c=P.l(),u=t.iterator;for(;u.next();){let g=u.value;if(g instanceof _&&g.canCopy()){let p=n.get(g);if(p===null)continue;p.points=g.points,p.fr(h.x-r,h.y-a),p.suspendsRouting=!0,l.set(p,this.Es())}}let d=t.iterator;for(;d.next();){let g=d.value;if(g.ke()&&g.canCopy()){let p=n.get(g);if(p===null)continue;let m=g.location;c.i(h.x-(r-m.x),h.y-(a-m.y)),p.location=c,p.ensureBounds(),l.set(p,this.Es(c))}}if(P.e(c),this.copiedParts=l,this.SP(l.toKeySet()),this.draggedLink!==null){let g=this.draggedLink,p=g.routeBounds;g.fr(this.startPoint.x-(p.x+p.width/2),this.startPoint.y-(p.y+p.height/2))}this.doUpdateCursor(null)}pF(){this.isDragOutStarted=!0,this.fu=!1,Dt.dt=this,Dt.Gh=this.diagram,this.doSimulatedDragOut()}doSimulatedDragOut(){let t=this.diagram;!this.mayCopy()&&!this.mayMove()?t.currentCursor=this.nodropCursor:t.currentCursor="",this.uu=null}computeMove(t,e,i,s){let n=this.diagram;return n!==null?n.computeMove(t,e,this.dragOptions,s):new P}static Vw=new G;static dt=null;static Gh=null}xe.prototype.doCancel=function(){Dt.dt!==null&&Dt.dt.doCancel(),ee.prototype.doCancel.call(this)};class Ge extends ee{IP;EP;Sl;UP;BP;Yh;VP;Kh;zP;XP;GP;YP;KP;jP;oL;HP;Ml;qP;constructor(){super(),this.IP=100,this.EP=!1,this.Sl="pointer",this.UP=new _({layerName:"Tool"}).add(new ct({isPanelMain:!0,stroke:"blue"}).theme("stroke","tempLink"),new ct({toArrow:"Standard",fill:"blue",stroke:"blue"}).theme("fill","tempLink").theme("stroke","tempLink")).Et(),this.Yh=new ct("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:Q.Uk}).theme("stroke","tempPort"),this.BP=new rt({selectable:!1,layerName:"Tool"}).add(this.Yh).Et(),this.Kh=new ct("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:Q.Uk}).theme("stroke","tempPort"),this.VP=new rt({selectable:!1,layerName:"Tool"}).add(this.Kh).Et(),this.zP=null,this.XP=null,this.GP=null,this.YP=null,this.KP=null,this.jP=!0,this.oL=new pt,this.HP=null,this.Ml=null,this.qP=null}doStop(){this.diagram.stopAutoScroll(),this.originalLink=null,this.originalFromNode=null,this.originalFromPort=null,this.originalToNode=null,this.originalToPort=null,this.validPortsCache.clear(),this.targetPort=null}get portGravity(){return this.IP}set portGravity(t){f.s(t,"number",Ge,"portGravity"),t>=0&&(this.IP=t)}get isUnconnectedLinkValid(){return this.EP}set isUnconnectedLinkValid(t){f.s(t,"boolean",Ge,"isUnconnectedLinkValid"),this.EP=t}get linkingCursor(){return this.Sl}set linkingCursor(t){this.Sl=t}get temporaryLink(){return this.UP}set temporaryLink(t){t.Et(),this.UP=t}get temporaryFromNode(){return this.BP}set temporaryFromNode(t){t.Et(),this.BP=t,t&&(this.Yh=t.port)}get temporaryFromPort(){return this.Yh}set temporaryFromPort(t){if(this.Yh!==null){let e=this.Yh.panel;if(e!==null){let i=e.C.indexOf(this.Yh);e.removeAt(i),e.insertAt(i,t)}}this.Yh=t}get temporaryToNode(){return this.VP}set temporaryToNode(t){t.Et(),this.VP=t,t&&(this.Kh=t.port)}get temporaryToPort(){return this.Kh}set temporaryToPort(t){if(this.Kh!==null){let e=this.Kh.panel;if(e!==null){let i=e.C.indexOf(this.Kh);e.removeAt(i),e.insertAt(i,t)}}this.Kh=t}get originalLink(){return this.zP}set originalLink(t){this.zP=t}get originalFromNode(){return this.XP}set originalFromNode(t){this.XP=t}get originalFromPort(){return this.GP}set originalFromPort(t){this.GP=t}get originalToNode(){return this.YP}set originalToNode(t){this.YP=t}get originalToPort(){return this.KP}set originalToPort(t){this.KP=t}get isForwards(){return this.jP}set isForwards(t){this.jP=t}get validPortsCache(){return this.oL}get targetPort(){return this.HP}set targetPort(t){this.HP=t}copyPortProperties(t,e,i,s,n){if(t===null||e===null||i===null||s===null)return;let o=e.getDocumentScale(),r=Q.l();r.width=e.naturalBounds.width*o,r.height=e.naturalBounds.height*o,s.desiredSize=r,Q.e(r),n?(s.toSpot=e.toSpot,s.toEndSegmentLength=e.toEndSegmentLength):(s.fromSpot=e.fromSpot,s.fromEndSegmentLength=e.fromEndSegmentLength),i.locationSpot=D.Center;let a=P.l();i.location=e.getDocumentPoint(D.Center,a),P.e(a),s.angle=e.getDocumentAngle(),this.portTargeted!==null&&this.portTargeted(t,e,i,s,n)}setNoTargetPortProperties(t,e,i){e!==null&&(e.desiredSize=Q.Uk,e.fromSpot=D.None,e.toSpot=D.None),t!==null&&(t.location=this.diagram.lastInput.documentPoint),this.portTargeted!==null&&this.portTargeted(null,null,t,e,i)}doMouseDown(){this.isActive&&this.doMouseMove()}doMouseMove(){if(this.isActive){let t=this.diagram;if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null&&this.targetPort.part instanceof rt){let e=this.targetPort.part;this.isForwards?this.copyPortProperties(e,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(e,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.doAutoScroll(t.lastInput.viewPoint)}}findValidLinkablePort(t,e){if(t===null)return null;let i=t.part;if(!(i instanceof rt))return null;for(;t!==null;){let s=e?t.toLinkable:t.fromLinkable;if(s===!0&&(t.portId!==null||t instanceof rt)&&(e?this.isValidTo(i,t):this.isValidFrom(i,t)))return t;if(s===!1)return null;t=t.panel}return null}findTargetPort(t){let e=this.diagram,i=e.lastInput.documentPoint,s=this.portGravity,n=e.findObjectsNear(i,s,h=>this.findValidLinkablePort(h,t),null,!0),o=1/0,r=null,a=n.iterator;for(;a.next();){let h=a.value,l=h.part;if(!(l instanceof rt))continue;let c=h.getDocumentPoint(D.Center,P.l()),u=i.x-c.x,d=i.y-c.y;P.e(c);let g=u*u+d*d;if(g<o){let p=this.validPortsCache.get(h);p!==null?p&&(r=h,o=g):t&&this.isValidLink(this.originalFromNode,this.originalFromPort,l,h)||!t&&this.isValidLink(l,h,this.originalToNode,this.originalToPort)?(this.validPortsCache.set(h,!0),r=h,o=g):this.validPortsCache.set(h,!1)}}if(r!==null){let h=r.part;if(h instanceof rt&&(h.layer===null||h.layer.allowLink))return r}return null}isValidFrom(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.fromLinkable!==!0))return!1;let i=e.fromMaxLinks;if(i<1/0){if(this.originalLink!==null&&t===this.originalFromNode&&e===this.originalFromPort)return!0;let s=e.portId;if(s===null&&(s=""),t.findLinksOutOf(s).count>=i)return!1}return!0}isValidTo(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.toLinkable!==!0))return!1;let i=e.toMaxLinks;if(i<1/0){if(this.originalLink!==null&&t===this.originalToNode&&e===this.originalToPort)return!0;let s=e.portId;if(s===null&&(s=""),t.findLinksInto(s).count>=i)return!1}return!0}isInSameNode(t,e){if(t===null||e===null)return!1;if(t===e)return!0;let i=t.part,s=e.part;return i!==null&&i===s}isLinked(t,e){if(t===null||e===null)return!1;let i=t.part;if(!(i instanceof rt))return!1;let s=t.portId;s===null&&(s="");let n=e.part;if(!(n instanceof rt))return!1;let o=e.portId;o===null&&(o="");let r=n.findLinksInto(o);for(;r.next();){let a=r.value;if(a.fromNode===i&&a.fromPortId===s)return!0}return!1}isValidLink(t,e,i,s){if(!this.isValidFrom(t,e)||!this.isValidTo(i,s)||e!==null&&s!==null&&(!(e.fromLinkableSelfNode&&s.toLinkableSelfNode)&&this.isInSameNode(e,s)||!(e.fromLinkableDuplicates&&s.toLinkableDuplicates)&&this.isLinked(e,s))||this.originalLink!==null&&(t!==null&&this.isLabelDependentOnLink(t,this.originalLink)||i!==null&&this.isLabelDependentOnLink(i,this.originalLink))||t!==null&&i!==null&&(t.data===null&&i.data!==null||t.data!==null&&i.data===null)||!this.isValidCycle(t,i,this.originalLink))return!1;let n;return t!==null&&e!==null&&(n=t.linkValidation,n!==null&&!n(t,e,i,s,this.originalLink))||i!==null&&s!==null&&(n=i.linkValidation,n!==null&&!n(t,e,i,s,this.originalLink))?!1:(n=this.linkValidation,n!==null?n(t,e,i,s,this.originalLink):!0)}isLabelDependentOnLink(t,e){if(t===null)return!1;let i=t.labeledLink;if(i===null)return!1;if(i===e)return!0;let s=new I;return s.add(t),this.WP(i,e,s)}WP(t,e,i){if(t===e)return!0;let s=t.fromNode;if(s!==null&&s.labeledLink&&(i.add(s),this.WP(s.labeledLink,e,i)))return!0;let n=t.toNode;return!!(n!==null&&n.labeledLink&&(i.add(n),this.WP(n.labeledLink,e,i)))}isValidCycle(t,e,i){if(i===void 0&&(i=null),t===null||e===null)return this.isUnconnectedLinkValid;let s=this.diagram,n=1;if(s&&(s.model.pm()?n=s.isTreePathToChildren?5:6:n=s.validCycle),n===1)return!0;if(n===5){let o=i||this.temporaryLink;if(o!==null&&!o.isTreeLink)return!0;let r=e.linksConnected;for(;r.next();){let a=r.value;if(a!==i&&a.isTreeLink&&a.toNode===e)return!1}return!this.yu(t,e,i,!0)}else if(n===6){let o=i||this.temporaryLink;if(o!==null&&!o.isTreeLink)return!0;let r=t.linksConnected;for(;r.next();){let a=r.value;if(a!==i&&a.isTreeLink&&a.fromNode===t)return!1}return!this.yu(t,e,i,!0)}else{if(n===2)return!this.SF(t,e,i);if(n===3)return!this.yu(t,e,i,!1);if(n===4)return!this.MF(t,e,i)}return!0}yu(t,e,i,s){if(t===e)return!0;if(t===null||e===null)return!1;let n=t.linksConnected;for(;n.next();){let o=n.value;if(o===i||s&&!o.isTreeLink||o.toNode!==t)continue;let r=o.fromNode;if(!(r===t||r===null)&&this.yu(r,e,i,s))return!0}return!1}SF(t,e,i){if(t===e)return!0;let s=new I;return s.add(e),this.rL(s,t,e,i)}rL(t,e,i,s){if(e===i)return!0;if(e===null||i===null||t.has(e))return!1;t.add(e);let n=e.linksConnected;for(;n.next();){let o=n.value;if(o===s||o.toNode!==e)continue;let r=o.fromNode;if(!(r===e||r===null)&&this.rL(t,r,i,s))return!0}return!1}MF(t,e,i){if(t===e)return!0;let s=new I;return s.add(e),this.lL(s,t,e,i)}lL(t,e,i,s){if(e===i)return!0;if(e===null||i===null||t.has(e))return!1;t.add(e);let n=e.linksConnected;for(;n.next();){let o=n.value;if(o===s)continue;let r=o.fromNode,a=o.toNode,h=r===e?a:r;if(!(h===e||h===null)&&this.lL(t,h,i,s))return!0}return!1}get linkValidation(){return this.Ml}set linkValidation(t){t!==null&&f.k(t,Ge,"linkValidation"),this.Ml=t}get portTargeted(){return this.qP}set portTargeted(t){t!==null&&f.k(t,Ge,"portTargeted"),this.qP=t}}var yn=(x=>(x[x.Either=1]="Either",x[x.ForwardsOnly=2]="ForwardsOnly",x[x.BackwardsOnly=3]="BackwardsOnly",x))(yn||{});class Li extends Ge{JP;$P;b;ZP;constructor(t){super(),this.name="Linking",this.JP={},this.$P=null,this.b=1,this.ZP=null,t&&Object.assign(this,t)}static Either=1;static ForwardsOnly=2;static BackwardsOnly=3;get archetypeLinkData(){return this.JP}set archetypeLinkData(t){t!==null&&f.ec(t,Li,"archetypeLinkData"),this.JP=t}get archetypeLabelNodeData(){return this.$P}set archetypeLabelNodeData(t){t!==null&&f.ec(t,Li,"archetypeLabelNodeData"),this.$P=t}get direction(){return this.b}set direction(t){this.b=t}get startObject(){return this.ZP}set startObject(t){this.ZP=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||t.isModelReadOnly||!t.allowLink||!t.model.zw()||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize()?!1:this.findLinkablePort()!==null}findLinkablePort(){let t=this.diagram,e=this.startObject;if(e===null&&(e=t.findObjectAt(t.firstInput.documentPoint,null,null)),e===null)return null;let i=e.part;if(!(i instanceof rt))return null;let s=this.direction;if(s===1||s===2){let n=this.findValidLinkablePort(e,!1);if(n!==null)return this.isForwards=!0,n;if(this.startObject===i){let o=i.port;if(this.findValidLinkablePort(o,!1))return this.isForwards=!0,o}}if(s===1||s===3){let n=this.findValidLinkablePort(e,!0);if(n!==null)return this.isForwards=!1,n;if(this.startObject===i){let o=i.port;if(this.findValidLinkablePort(o,!0))return this.isForwards=!1,o}}return null}doActivate(){let t=this.diagram,e=this.findLinkablePort();if(e===null){this.stopTool();return}if(this.startTransaction(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.isForwards){this.temporaryToNode!==null&&(this.temporaryToNode.location=t.lastInput.documentPoint),this.originalFromPort=e;let i=this.originalFromPort.part;i instanceof rt&&(this.originalFromNode=i),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else{this.temporaryFromNode!==null&&(this.temporaryFromNode.location=t.lastInput.documentPoint),this.originalToPort=e;let i=this.originalToPort.part;i instanceof rt&&(this.originalToNode=i),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)}t.add(this.temporaryFromNode),this.temporaryFromNode&&this.temporaryFromNode.ensureBounds(),t.add(this.temporaryToNode),this.temporaryToNode&&this.temporaryToNode.ensureBounds(),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.invalidateRoute(),t.add(this.temporaryLink)),this.isActive=!0}doDeactivate(){this.isActive=!1;let t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()}doStop(){super.doStop(),this.startObject=null}doMouseUp(){if(this.isActive){let t=this.diagram;this.transactionResult=null;let e=null,i=null,s=null,n=null,o=null;try{this.targetPort=this.findTargetPort(this.isForwards);let r=this.targetPort;if(r!==null){let a=r.part;a instanceof rt&&(this.isForwards?(this.originalFromNode!==null&&(e=this.originalFromNode,i=this.originalFromPort),s=a,n=r):(e=a,i=r,this.originalToNode!==null&&(s=this.originalToNode,n=this.originalToPort)))}else this.isForwards?this.originalFromNode!==null&&this.isUnconnectedLinkValid&&(e=this.originalFromNode,i=this.originalFromPort):this.originalToNode!==null&&this.isUnconnectedLinkValid&&(s=this.originalToNode,n=this.originalToPort);e!==null||s!==null?(o=this.insertLink(e,i,s,n),o!==null?(r===null&&(this.isForwards?o.defaultToPoint=t.lastInput.documentPoint:o.defaultFromPoint=t.lastInput.documentPoint),t.allowSelect&&(t.D("ChangingSelection",t.selection),t.clearSelection(!0),o.isSelected=!0),this.transactionResult=this.name,t.D("LinkDrawn",o)):this.doNoLink(e,i,s,n)):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),o&&t.allowSelect&&t.D("ChangedSelection",t.selection)}}}isNewTreeLink(){let t=this.archetypeLinkData;if(t===null)return!0;if(t instanceof _)return t.isTreeLink;let e=this.diagram;if(e===null)return!0;let i=e.partManager.getLinkCategoryForData(t),s=e.partManager.findLinkTemplateForCategory(i);return s!==null?s.isTreeLink:!0}insertLink(t,e,i,s){return this.diagram.partManager.insertLink(t,e,i,s)}doNoLink(t,e,i,s){}}class ys extends Ge{hL=null;aL=null;QP=null;_P=null;fs;tS;constructor(t){super(),this.name="Relinking",this.fromHandleArchetype=new ct("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:0}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.toHandleArchetype=new ct("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:-1}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.tS=new z,t&&Object.assign(this,t)}updateAdornments(t){if(t===null||!(t instanceof _))return;let e="RelinkFrom",i=null;if(t.isSelected&&!this.diagram.isReadOnly){let s=t.selectionObject;s!==null&&t.canRelinkFrom()&&t.actualBounds.isReal()&&t.isVisible()&&s.actualBounds.isReal()&&s.isVisibleObject()&&(i=t.findAdornment(e),i===null&&(i=this.makeAdornment(s,!1),t.addAdornment(e,i)))}if(i===null&&t.removeAdornment(e),e="RelinkTo",i=null,t.isSelected&&!this.diagram.isReadOnly){let s=t.selectionObject;s!==null&&t.canRelinkTo()&&t.actualBounds.isReal()&&t.isVisible()&&s.actualBounds.isReal()&&s.isVisibleObject()&&(i=t.findAdornment(e),i===null?(i=this.makeAdornment(s,!0),t.addAdornment(e,i)):i.c())}i===null&&t.removeAdornment(e)}makeAdornment(t,e){let i=e?this._P:this.QP;return i&&(i=i.copy(),i.adornedObject=t),i}get fromHandleArchetype(){return this.hL}set fromHandleArchetype(t){this.hL=t,t!==null?this.QP=new St(H.Link).add(t).Et():this.QP=null}get toHandleArchetype(){return this.aL}set toHandleArchetype(t){this.aL=t,t!==null?this._P=new St(H.Link).add(t).Et():this._P=null}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowRelink||!t.model.zw()||!t.lastInput.left)return!1;let e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom");return e===null&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo")),e!==null}doActivate(){let t=this.diagram;if(this.originalLink===null){let i=this.handle;if(i===null&&(i=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom"),i===null&&(i=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo"))),i===null)return;let s=i.part;if(!(s instanceof St)||!(s.adornedPart instanceof _))return;this.handle=i,this.isForwards=s===null||s.category==="RelinkTo",this.originalLink=s.adornedPart}let e=this.originalLink;e!==null&&(this.startTransaction(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.originalFromPort=e.fromPort,this.originalFromNode=e.fromNode,this.originalToPort=e.toPort,this.originalToNode=e.toNode,this.tS.set(e.actualBounds),e.pointsCount>0&&(e.fromNode===null&&(this.temporaryFromPort!==null&&(this.temporaryFromPort.desiredSize=Q.sc),this.temporaryFromNode!==null&&(this.temporaryFromNode.location=e.getPoint(0))),e.toNode===null&&(this.temporaryToPort!==null&&(this.temporaryToPort.desiredSize=Q.sc),this.temporaryToNode!==null&&(this.temporaryToNode.location=e.getPoint(e.pointsCount-1)))),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0),t.add(this.temporaryFromNode),t.add(this.temporaryToNode),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(e,this.temporaryLink),this.temporaryLink.invalidateRoute(),t.add(this.temporaryLink)),this.isActive=!0)}copyLinkProperties(t,e){if(t===null||e===null)return;e.adjusting=t.adjusting,e.corner=t.corner;let i=t.curve;(i===11||i===10)&&(i=0),e.curve=i,e.curviness=t.curviness,e.isTreeLink=t.isTreeLink,e.points=t.points,e.routing=t.routing,e.smoothness=t.smoothness,e.fromSpot=t.fromSpot,e.fromEndSegmentLength=t.fromEndSegmentLength,e.fromShortLength=t.fromShortLength,e.toSpot=t.toSpot,e.toEndSegmentLength=t.toEndSegmentLength,e.toShortLength=t.toShortLength}doDeactivate(){this.isActive=!1;let t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()}doStop(){super.doStop(),this.handle=null}doMouseUp(){if(this.isActive){let t=this.diagram;this.transactionResult=null;let e=this.originalFromNode,i=this.originalFromPort,s=this.originalToNode,n=this.originalToPort,o=this.originalLink;try{if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null){let r=this.targetPort.part;r instanceof rt&&(this.isForwards?(s=r,n=this.targetPort):(e=r,i=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?(s=null,n=null):(e=null,i=null):o=null;o!==null?(this.reconnectLink(o,this.isForwards?s:e,this.isForwards?n:i,this.isForwards),this.targetPort===null&&(this.isForwards?o.defaultToPoint=t.lastInput.documentPoint:o.defaultFromPoint=t.lastInput.documentPoint,o.invalidateRoute()),this.transactionResult=this.name,t.D("LinkRelinked",o,this.isForwards?this.originalToPort:this.originalFromPort)):this.originalLink!==null&&this.doNoRelink(this.originalLink,this.isForwards),this.originalLink!==null&&this.originalLink.invalidateOtherJumpOvers(this.tS)}finally{this.stopTool()}}}reconnectLink(t,e,i,s){let n=i!==null&&i.portId!==null?i.portId:"";return s?(t.toNode=e,t.toPortId=n):(t.fromNode=e,t.fromPortId=n),!0}doNoRelink(t,e){}doDraggingMouseMove(t,e,i,s){t!==null?(this.copyPortProperties(t,e,this.temporaryFromNode,this.temporaryFromPort,!1),this.diagram.add(this.temporaryFromNode)):this.diagram.remove(this.temporaryFromNode),i!==null?(this.copyPortProperties(i,s,this.temporaryToNode,this.temporaryToPort,!0),this.diagram.add(this.temporaryToNode)):this.diagram.remove(this.temporaryToNode)}stopDraggingMouseMove(){this.diagram.remove(this.temporaryFromNode),this.diagram.remove(this.temporaryToNode)}}var xn=(x=>(x[x.None=0]="None",x[x.Horizontal=1]="Horizontal",x[x.Vertical=2]="Vertical",x[x.All=3]="All",x))(xn||{});class Ji extends ee{dr;iS;eS;fs;Xw;sS;ym;constructor(t){super(),this.name="LinkReshaping",this.dr=new ct("Rectangle",{desiredSize:Q.wC,fill:"lightblue",stroke:"dodgerblue"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.iS=new ct("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:"move"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.eS=3,this.fs=null,this.Xw=null,this.sS=new P,this.ym=new G,t&&Object.assign(this,t)}static None=0;static Horizontal=1;static Vertical=2;static All=3;getReshapingBehavior(t){return t?t.gr:0}setReshapingBehavior(t,e){t.gr=e}updateAdornments(t){if(t===null||!(t instanceof _))return;let e=null;if(t.isSelected&&!this.diagram.isReadOnly){let i=t.path;i!==null&&t.canReshape()&&t.actualBounds.isReal()&&t.isVisible()&&i.actualBounds.isReal()&&i.isVisibleObject()&&(e=t.findAdornment(this.name),(e===null||e.nS!==t.pointsCount||e.oS!==t.resegmentable)&&(e=this.makeAdornment(i),e!==null&&(e.nS=t.pointsCount,e.oS=t.resegmentable,t.addAdornment(this.name,e))))}e===null&&t.removeAdornment(this.name)}makeAdornment(t){let e=t.part,i=e.points,s=e.pointsCount,n=e.isOrthogonal,o=null;if(i!==null&&s>1){o=new St,o.type=H.Link;let r=e.firstPickIndex,a=e.lastPickIndex,h=n?1:0;if(e.resegmentable&&e.computeCurve()!==9)for(let l=r+h;l<a-h;l++){let c=this.makeResegmentHandle(t,l);c!==null&&(c.segmentIndex=l,c.segmentFraction=.5,c.fromMaxLinks=999,o.add(c))}for(let l=r+1;l<a;l++){let c=this.makeHandle(t,l);if(c!==null){if(c.segmentIndex=l,l!==r)if(l===r+1&&n){let u=e.getPoint(r),d=e.getPoint(r+1);L.f(u.x,d.x)&&L.f(u.y,d.y)?(d=e.getPoint(r-1),L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")):L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")}else if(l===a-1&&n){let u=e.getPoint(a-1),d=e.getPoint(a);L.f(u.x,d.x)&&L.f(u.y,d.y)?(u=e.getPoint(a+1),L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")):L.f(u.x,d.x)?(this.setReshapingBehavior(c,2),c.cursor="n-resize"):L.f(u.y,d.y)&&(this.setReshapingBehavior(c,1),c.cursor="w-resize")}else l===a||(this.setReshapingBehavior(c,3),c.cursor="move");o.add(c)}}o.adornedObject=t}return o}makeHandle(t,e){let i=this.handleArchetype;return i===null?null:i.copy().rS()}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t}makeResegmentHandle(t,e){let i=this.midHandleArchetype;return i===null?null:i.copy().rS()}get midHandleArchetype(){return this.iS}set midHandleArchetype(t){this.iS=t}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedLink(){return this.Xw}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowReshape||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle===null)return;let e=this.handle.part.adornedPart;if(e instanceof _){if(this.Xw=e,t.isMouseCaptured=!0,this.startTransaction(this.name),e.resegmentable&&this.handle.fromMaxLinks===999){let i=e.points.copy(),s=this.getResegmentingPoint();if(i.insertAt(this.handle.segmentIndex+1,s),e.isOrthogonal&&i.insertAt(this.handle.segmentIndex+1,s),e.points=i,e.invalidateAdornments(),e.updateAdornments(),this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name),this.handle===null){this.doDeactivate();return}}this.sS=e.getPoint(this.handle.segmentIndex),this.ym=e.points.copy(),this.isActive=!0}}doDeactivate(){this.stopTransaction(),this.handle=null,this.Xw=null;let t=this.diagram;t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){let t=this.adornedLink;t!==null&&(t.points=this.ym),this.stopTool()}getResegmentingPoint(){return this.handle===null?this.diagram.lastInput.documentPoint:this.handle.getDocumentPoint(D.Center)}doMouseMove(){let t=this.diagram;if(this.isActive){let e=this.computeReshape(t.lastInput.documentPoint);this.reshape(e)}}doMouseUp(){let t=this.diagram;if(this.isActive){let e=this.computeReshape(t.lastInput.documentPoint);this.reshape(e);let i=this.adornedLink;if(i!==null&&i.resegmentable&&this.handle!==null){let s=this.handle.segmentIndex,n=i.getPoint(s-1),o=i.getPoint(s),r=i.getPoint(s+1);if(i.isOrthogonal){if(s>i.firstPickIndex+1&&s<i.lastPickIndex-1){let a=i.getPoint(s-2);if(this.isWithinResegmentingDistance(n,o)&&(this.isInLineOrtho(a,n,o,r,!0)||this.isInLineOrtho(a,n,o,r,!1))){let h=i.points.copy();this.isInLineOrtho(a,n,o,r,!0)?(h.setElt(s-2,new P(a.x,(r.y+a.y)/2)),h.setElt(s+1,new P(r.x,(r.y+a.y)/2))):(h.setElt(s-2,new P((r.x+a.x)/2,a.y)),h.setElt(s+1,new P((r.x+a.x)/2,r.y))),h.removeAt(s),h.removeAt(s-1),i.points=h,i.invalidateAdornments()}else if(a=i.getPoint(s+2),this.isWithinResegmentingDistance(o,r)&&(this.isInLineOrtho(n,o,r,a,!0)||this.isInLineOrtho(n,o,r,a,!1))){let h=i.points.copy();this.isInLineOrtho(n,o,r,a,!0)?(h.setElt(s-1,new P(n.x,(n.y+a.y)/2)),h.setElt(s+2,new P(a.x,(n.y+a.y)/2))):(h.setElt(s-1,new P((n.x+a.x)/2,n.y)),h.setElt(s+2,new P((n.x+a.x)/2,a.y))),h.removeAt(s+1),h.removeAt(s),i.points=h,i.invalidateAdornments()}}}else{let a=P.l();if(L.dl(n.x,n.y,r.x,r.y,o.x,o.y,a)&&a.distanceSquaredPoint(o)<this.resegmentingDistance*this.resegmentingDistance){let h=i.points.copy();h.removeAt(s),i.points=h,i.invalidateAdornments()}P.e(a)}}t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("LinkReshaped",this.adornedLink,this.ym)}this.stopTool()}isWithinResegmentingDistance(t,e){return Math.abs(t.x-e.x)<this.resegmentingDistance&&Math.abs(t.y-e.y)<this.resegmentingDistance}isInLineOrtho(t,e,i,s,n){return n?Math.abs(t.y-e.y)<this.resegmentingDistance&&Math.abs(e.y-i.y)<this.resegmentingDistance&&Math.abs(i.y-s.y)<this.resegmentingDistance:Math.abs(t.x-e.x)<this.resegmentingDistance&&Math.abs(e.x-i.x)<this.resegmentingDistance&&Math.abs(i.x-s.x)<this.resegmentingDistance}get resegmentingDistance(){return this.eS}set resegmentingDistance(t){f.s(t,"number",Ji,"resegmentingDistance"),this.eS=t}reshape(t){let e=this.adornedLink;if(e===null)return;let i=this.handle;if(i===null)return;e.startRoute();let s=i.segmentIndex,n=this.getReshapingBehavior(i);if(e.isOrthogonal)if(s===e.firstPickIndex+1){let o=e.firstPickIndex+1;n===2?(e.setPointAt(o,e.getPoint(o-1).x,t.y),e.setPointAt(o+1,e.getPoint(o+2).x,t.y)):n===1&&(e.setPointAt(o,t.x,e.getPoint(o-1).y),e.setPointAt(o+1,t.x,e.getPoint(o+2).y))}else if(s===e.lastPickIndex-1){let o=e.lastPickIndex-1;n===2?(e.setPointAt(o-1,e.getPoint(o-2).x,t.y),e.setPointAt(o,e.getPoint(o+1).x,t.y)):n===1&&(e.setPointAt(o-1,t.x,e.getPoint(o-2).y),e.setPointAt(o,t.x,e.getPoint(o+1).y))}else{let o=s,r=e.getPoint(o),a=e.getPoint(o-1),h=e.getPoint(o+1);L.f(a.x,r.x)&&L.f(r.y,h.y)?(L.f(a.x,e.getPoint(o-2).x)&&!L.f(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),L.f(h.y,e.getPoint(o+2).y)&&!L.f(h.x,e.getPoint(o+2).x)?e.insertPointAt(o+1,h.x,t.y):e.setPointAt(o+1,h.x,t.y)):L.f(a.y,r.y)&&L.f(r.x,h.x)?(L.f(a.y,e.getPoint(o-2).y)&&!L.f(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),L.f(h.x,e.getPoint(o+2).x)&&!L.f(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):L.f(a.x,r.x)&&L.f(r.x,h.x)?(L.f(a.x,e.getPoint(o-2).x)&&!L.f(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),L.f(h.x,e.getPoint(o+2).x)&&!L.f(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):L.f(a.y,r.y)&&L.f(r.y,h.y)&&(L.f(a.y,e.getPoint(o-2).y)&&!L.f(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),L.f(h.y,e.getPoint(o+2).y)&&!L.f(h.x,e.getPoint(o+2).x)?e.insertPointAt(o+1,h.x,t.y):e.setPointAt(o+1,h.x,t.y)),e.setPointAt(s,t.x,t.y)}else{e.setPointAt(s,t.x,t.y);let o=e.fromNode,r=e.fromPort;if(o!==null){let l=o.findVisibleNode();l!==null&&l!==o&&(o=l,r=o.port)}if(s===1&&r!==null&&e.computeSpot(!0,r).isNoSpot()){let l=r.getDocumentPoint(D.Center,P.l()),c=e.getLinkPointFromPoint(o,r,l,t,!0,P.l());e.setPointAt(0,c.x,c.y),P.e(l),P.e(c)}let a=e.toNode,h=e.toPort;if(a!==null){let l=a.findVisibleNode();l!==null&&l!==a&&(a=l,h=a.port)}if(s===e.pointsCount-2&&h!==null&&e.computeSpot(!1,h).isNoSpot()){let l=h.getDocumentPoint(D.Center,P.l()),c=e.getLinkPointFromPoint(a,h,l,t,!1,P.l());e.setPointAt(e.pointsCount-1,c.x,c.y),P.e(l),P.e(c)}}e.commitRoute()}computeReshape(t){let e=this.adornedLink;if(e===null)return t;let i=this.handle;if(i===null)return t;let s=i.segmentIndex;switch(this.getReshapingBehavior(i)){case 3:return t;case 2:{let n=e.getPoint(s);return new P(n.x,t.y)}case 1:{let n=e.getPoint(s);return new P(t.x,n.y)}default:case 0:return e.getPoint(s)}}get originalPoint(){return this.sS}get originalPoints(){return this.ym}}class Ti extends ee{pr;yr;Po;yc;lS;us;dr;fs;wm;hS;wc;Gw;Yw;Kw;constructor(t){super(),this.name="Resizing",this.pr=new Q(1,1).u(),this.yr=new Q(9999,9999).u(),this.Po=new Q(NaN,NaN).u(),this.yc=!1,this.lS=!0,this.us=null,this.dr=new ct("Rectangle",{alignmentFocus:D.Center,desiredSize:Q.wC,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.wm=new P,this.hS=new Q,this.wc=new P,this.Gw=new Q(0,0),this.Yw=new Q(1/0,1/0),this.Kw=new Q(1,1),t&&Object.assign(this,t)}updateAdornments(t){if(!(t===null||t instanceof _)){if(t.isSelected&&!this.diagram.isReadOnly){let e=t.resizeObject,i=t.findAdornment(this.name);if(e!==null&&t.canResize()&&t.actualBounds.isReal()&&t.isVisible()&&e.actualBounds.isReal()&&e.isVisibleObject()&&((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null)){let s=e.getDocumentAngle();t.Nl()&&this.updateResizeHandles(i,s),t.addAdornment(this.name,i);return}}t.removeAdornment(this.name)}}makeAdornment(t){let e=null,i=t.part?.resizeAdornmentTemplate;if(i){if(e=i.copy(),e===null)return null}else{e=new St,e.type=H.Spot,e.locationSpot=D.Center;let s=new ve;s.isPanelMain=!0,e.add(s);let n=this.makeHandle(t,D.TopLeft);n!==null&&e.add(n),n=this.makeHandle(t,D.TopRight),n!==null&&e.add(n),n=this.makeHandle(t,D.BottomRight),n!==null&&e.add(n),n=this.makeHandle(t,D.BottomLeft),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleTop),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleRight),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleBottom),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleLeft),n!==null&&e.add(n)}return e.adornedObject=t,e}makeHandle(t,e){let i=this.handleArchetype;if(i===null)return null;let s=i.copy().rS();return s.alignment=e,s}updateResizeHandles(t,e){if(t!==null){if(!t.alignment.isDefault()&&(t.cursor==="pointer"||t.cursor.indexOf("resize")>0))this.NF(t,e);else if(t instanceof H){let i=t.elements;for(;i.next();){let s=i.value;this.updateResizeHandles(s,e)}}}}NF(t,e){let i=t.alignment;i.isNoSpot()&&(i=D.Center);let s=e;if(i.x<=0)i.y<=0?s+=225:i.y>=1?s+=135:s+=180;else if(i.x>=1)i.y<=0?s+=315:i.y>=1&&(s+=45);else if(i.y<=0)s+=270;else if(i.y>=1)s+=90;else return;s<0?s+=360:s>=360&&(s-=360),s<22.5?t.cursor="e-resize":s<67.5?t.cursor="se-resize":s<112.5?t.cursor="s-resize":s<157.5?t.cursor="sw-resize":s<202.5?t.cursor="w-resize":s<247.5?t.cursor="nw-resize":s<292.5?t.cursor="n-resize":s<337.5?t.cursor="ne-resize":t.cursor="e-resize"}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedObject(){return this.us}set adornedObject(t){t!==null&&t.part instanceof St&&f.o("new handle must not be in an Adornment: "+t),this.us=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowResize||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle!==null&&(this.adornedObject=this.handle.part.adornedObject,this.adornedObject!==null&&this.adornedObject.part!==null&&(t.isMouseCaptured=!0,t.animationManager.stopAnimation(),t.gu=!0,this.startTransaction(this.name),this.wm.set(this.adornedObject.getDocumentPoint(this.handle.alignment.opposite())),this.wc.set(this.adornedObject.part.location),this.hS.set(this.adornedObject.desiredSize),this.Kw=this.computeCellSize(),this.Gw=this.computeMinSize(),this.Yw=this.computeMaxSize(),this.isActive=!0))}doDeactivate(){let t=this.diagram;t.gu=!1,t.bl=!0,this.stopTransaction(),this.handle=null,this.us=null,t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){this.adornedObject!==null&&this.adornedObject.part!==null&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation),this.stopTool()}doMouseMove(){let t=this.diagram;if(!this.isActive||this.adornedObject===null||this.handle===null)return;let e=this.Gw,i=this.Yw,s=this.Kw,n=t.lastInput.documentPoint,o=this.adornedObject.getLocalPoint(n,P.l()),r=this.computeReshape(),a=this.computeResize(o,this.handle.alignment,e,i,s,r);this.resize(a),t.maybeUpdate(),P.e(o)}doMouseUp(){let t=this.diagram;if(this.isActive&&this.adornedObject!==null&&this.handle!==null){let e=this.Gw,i=this.Yw,s=this.Kw,n=this.adornedObject.getLocalPoint(t.lastInput.documentPoint,P.l()),o=this.computeReshape(),r=this.computeResize(n,this.handle.alignment,e,i,s,o);this.resize(r),P.e(n),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()}resize(t){let e=this.diagram,i=this.adornedObject;if(i===null)return;i.desiredSize=t.size;let s=i.part;if(s===null||this.handle===null)return;s.ensureBounds();let n=i.getDocumentPoint(this.handle.alignment.opposite());if(s instanceof ft){let o=new G;o.add(s);let r;!this.dragsMembers&&!s.hasPlaceholder()&&(r=new Qi,r.dragsMembers=!1),e.moveParts(o,this.oppositePoint.copy().subtract(n),!0,r)}else s.location=s.location.copy().subtract(n).add(this.oppositePoint);e.maybeUpdate()}computeResize(t,e,i,s,n,o){if(this.adornedObject===null)return z.Fg;e.isNoSpot()&&(e=D.Center);let r=this.adornedObject.naturalBounds,a=r.x,h=r.y,l=r.x+r.width,c=r.y+r.height,u=1;if(!o){let p=r.width,m=r.height;p<=0&&(p=1),m<=0&&(m=1),u=m/p}let d=P.l();L.Dg(t.x,t.y,a,h,n.width,n.height,d);let g=r.copy();return e.x<=0?e.y<=0?(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=Math.max(l-g.x,i.width),g.y=Math.max(d.y,c-s.height),g.y=Math.min(g.y,c-i.height),g.height=Math.max(c-g.y,i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width),g.x=l-g.width,g.y=c-g.height)):e.y>=1?(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=Math.max(l-g.x,i.width),g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width),g.x=l-g.width)):(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=l-g.x,o||(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u,g.y=h+.5*(c-h-g.height))):e.x>=1?e.y<=0?(g.width=Math.max(Math.min(d.x-a,s.width),i.width),g.y=Math.max(d.y,c-s.height),g.y=Math.min(g.y,c-i.height),g.height=Math.max(c-g.y,i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width),g.y=c-g.height)):e.y>=1?(g.width=Math.max(Math.min(d.x-a,s.width),i.width),g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u):(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width))):(g.width=Math.max(Math.min(d.x-a,s.width),i.width),o||(g.height=Math.max(Math.min(u*g.width,s.height),i.height),g.width=g.height/u,g.y=h+.5*(c-h-g.height))):e.y<=0?(g.y=Math.max(d.y,c-s.height),g.y=Math.min(g.y,c-i.height),g.height=c-g.y,o||(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width,g.x=a+.5*(l-a-g.width))):e.y>=1&&(g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.width=Math.max(Math.min(g.height/u,s.width),i.width),g.height=u*g.width,g.x=a+.5*(l-a-g.width))),P.e(d),g}computeReshape(){let t=0;return this.adornedObject instanceof ct&&(t=this.adornedObject.aS()),!(t===6||this.diagram.lastInput.shift)}computeMinSize(){if(this.adornedObject===null)return Q.sc;let t=this.adornedObject.minSize.copy(),e=this.minSize;return!isNaN(e.width)&&e.width>t.width&&(t.width=e.width),!isNaN(e.height)&&e.height>t.height&&(t.height=e.height),t}computeMaxSize(){if(this.adornedObject===null)return Q.Bk;let t=this.adornedObject.maxSize.copy(),e=this.maxSize;return!isNaN(e.width)&&e.width<t.width&&(t.width=e.width),!isNaN(e.height)&&e.height<t.height&&(t.height=e.height),t}computeCellSize(){let t=new Q(NaN,NaN),e=this.adornedObject?.part;if(e){let n=e.resizeCellSize;!isNaN(n.width)&&n.width>0&&(t.width=n.width),!isNaN(n.height)&&n.height>0&&(t.height=n.height)}let i=this.cellSize;isNaN(t.width)&&!isNaN(i.width)&&i.width>0&&(t.width=i.width),isNaN(t.height)&&!isNaN(i.height)&&i.height>0&&(t.height=i.height);let s=this.diagram;if((isNaN(t.width)||isNaN(t.height))&&s){let n=s.grid;n!==null&&n.visible&&this.isGridSnapEnabled&&(i=n.gridCellSize,isNaN(t.width)&&!isNaN(i.width)&&i.width>0&&(t.width=i.width),isNaN(t.height)&&!isNaN(i.height)&&i.height>0&&(t.height=i.height))}return(isNaN(t.width)||t.width===0||t.width===1/0)&&(t.width=1),(isNaN(t.height)||t.height===0||t.height===1/0)&&(t.height=1),t}get minSize(){return this.pr}set minSize(t){if(!this.pr.equals(t)){let e=t.width;isNaN(e)&&(e=0);let i=t.height;isNaN(i)&&(i=0),this.pr.i(e,i)}}get maxSize(){return this.yr}set maxSize(t){if(!this.yr.equals(t)){let e=t.width;isNaN(e)&&(e=1/0);let i=t.height;isNaN(i)&&(i=1/0),this.yr.i(e,i)}}get cellSize(){return this.Po}set cellSize(t){this.Po.equals(t)||this.Po.a(t)}get isGridSnapEnabled(){return this.yc}set isGridSnapEnabled(t){f.s(t,"boolean",Ti,"isGridSnapEnabled"),this.yc=t}get dragsMembers(){return this.lS}set dragsMembers(t){f.s(t,"boolean",Ti,"dragsMembers"),this.lS=t}get oppositePoint(){return this.wm}set oppositePoint(t){this.wm.equals(t)||this.wm.a(t)}get originalDesiredSize(){return this.hS}get originalLocation(){return this.wc}}class si extends ee{cS;fS;us=null;dr=null;jw=null;fs=null;uS;xm;wc;dS;gS;constructor(t){super(),this.name="Rotating",this.cS=45,this.fS=2,this.wc=new P,this.us=null,this.handleArchetype=new ct("Ellipse",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.uS=0,this.xm=new P(NaN,NaN),this.dS=0,this.gS=50,t&&Object.assign(this,t)}updateAdornments(t){if(t!==null){if(t.Cl()){let e=t.rotateObject;if(e===t||e===t.path||e.isPanelMain)return}if(t.isSelected&&!this.diagram.isReadOnly){let e=t.rotateObject;if(e!==null&&t.canRotate()&&t.actualBounds.isReal()&&t.isVisible()&&e.actualBounds.isReal()&&e.isVisibleObject()){let i=t.findAdornment(this.name);if((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null){i.angle=e.getDocumentAngle(),i.hasPlaceholder()||(i.location=this.computeAdornmentLocation(e)),t.addAdornment(this.name,i);return}}}t.removeAdornment(this.name)}}makeAdornment(t){let e=null,i=t.part?.rotateAdornmentTemplate;return i?e=i.copy():this.jw!==null&&(e=this.jw.copy()),e===null?null:(e.adornedObject=t,e)}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t,t!==null?this.jw=new St(H.Position,{locationSpot:D.Center}).add(t).Et():this.jw=null}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedObject(){return this.us}set adornedObject(t){t!==null&&t.part instanceof St&&f.o("new handle must not be in an Adornment: "+t),this.us=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowRotate||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;if(this.adornedObject===null){if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle===null)return;this.adornedObject=this.handle.part.adornedObject}this.adornedObject===null||this.adornedObject.part===null||(t.isMouseCaptured=!0,t.delaysLayout=!0,this.startTransaction(this.name),this.uS=this.adornedObject.angle,this.xm=this.computeRotationPoint(this.adornedObject),this.wc=this.adornedObject.part.location.copy(),this.isActive=!0)}computeRotationPoint(t){let e=t.part;if(e!==null){let i=e.locationObject;if(e.rotationSpot.isSpot())return t.getDocumentPoint(e.rotationSpot);if(t===e||t===i)return i.getDocumentPoint(e.locationSpot)}return t.getDocumentPoint(D.Center)}computeAdornmentLocation(t){let e=this.rotationPoint;e.isReal()||(e=this.computeRotationPoint(t));let i=t.getLocalPoint(e),s=this.handleAngle;s<0?s+=360:s>=360&&(s-=360),s=Math.round(Math.round(s/45)*45);let n=this.handleDistance;return s===0?i.x=t.naturalBounds.width+n:s===45?(i.x=t.naturalBounds.width+n,i.y=t.naturalBounds.height+n):s===90?i.y=t.naturalBounds.height+n:s===135?(i.x=-n,i.y=t.naturalBounds.height+n):s===180?i.x=-n:s===225?(i.x=-n,i.y=-n):s===270?i.y=-n:s===315&&(i.x=t.naturalBounds.width+n,i.y=-n),t.getDocumentPoint(i)}doDeactivate(){let t=this.diagram;this.stopTransaction(),this.handle=null,this.us=null,this.xm=new P(NaN,NaN),t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){let t=this.diagram;t.delaysLayout=!1,this.rotate(this.originalAngle),this.stopTool()}doMouseMove(){let t=this.diagram;if(this.isActive){let e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e)}}doMouseUp(){let t=this.diagram;if(this.isActive){t.delaysLayout=!1;let e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()}rotate(t){let e=this.adornedObject;if(e===null||e.part===null)return;e.angle=t;let i=e.part;i.ensureBounds();let s=i.locationObject,n=i.rotateObject;if(s===n||s.isContainedBy(n)){let o=this.wc.copy();i.location=o.subtract(this.rotationPoint).rotate(t-this.originalAngle).add(this.rotationPoint)}this.diagram.maybeUpdate()}computeRotate(t){let e=this.rotationPoint.directionPoint(t)-this.handleAngle,i=this.adornedObject?.panel;i&&(e-=i.getDocumentAngle()),e>=360?e-=360:e<0&&(e+=360);let s=Math.min(Math.abs(this.snapAngleMultiple),180),n=Math.min(Math.abs(this.snapAngleEpsilon),s/2);return!this.diagram.lastInput.shift&&s>0&&n>0&&(e%s<n?e=Math.floor(e/s)*s:e%s>s-n&&(e=(Math.floor(e/s)+1)*s)),e>=360?e-=360:e<0&&(e+=360),e}get snapAngleMultiple(){return this.cS}set snapAngleMultiple(t){f.s(t,"number",si,"snapAngleMultiple"),this.cS=t}get snapAngleEpsilon(){return this.fS}set snapAngleEpsilon(t){f.s(t,"number",si,"snapAngleEpsilon"),this.fS=t}get originalAngle(){return this.uS}get rotationPoint(){return this.xm}set rotationPoint(t){this.xm=t.copy()}get handleAngle(){return this.dS}set handleAngle(t){f.s(t,"number",si,"handleAngle"),this.dS=t}get handleDistance(){return this.gS}set handleDistance(t){f.s(t,"number",si,"handleDistance"),this.gS=t}}class wn extends ee{constructor(t){super(),this.name="ClickSelecting",t&&Object.assign(this,t)}canStart(){return!(!this.isEnabled||this.isBeyondDragSize())}doMouseUp(){this.isActive&&(this.standardMouseSelect(),this.standardMouseClick()||this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip()),this.stopTool()}}class bn extends ee{xc;constructor(t){super(),this.name="Action",this.xc=null,t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram,e=t.lastInput,i=t.findObjectAt(e.documentPoint,s=>{for(;s.panel!==null;){if(s.isActionable)return s;s=s.panel}return s});return i!==null&&i.isActionable?(this.xc=i,t.gc=t.findObjectAt(e.documentPoint,null,null),!0):!1}doMouseDown(){if(!this.isActive)this.canStart()&&this.doActivate();else{let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionDown!==null&&e.actionDown(t,e)}}doMouseMove(){if(this.isActive){let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionMove!==null&&e.actionMove(t,e)}}doMouseUp(){if(this.isActive){let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionUp!==null&&e.actionUp(t,e),this.standardMouseClick(i=>{for(;i.panel!==null;){if(i.isActionable&&i===e)return i;i=i.panel}return i},i=>i===e)}this.stopTool()}doCancel(){let t=this.diagram.lastInput,e=this.xc;e!==null&&(t.targetObject=e,e.actionCancel!==null&&e.actionCancel(t,e),this.stopTool())}doStop(){this.xc=null}}class di extends ee{Ll;mS;yc;pS;constructor(t){super(),this.name="ClickCreating",this.Ll=null,this.mS=!0,this.yc=!1,this.pS=new P(0,0),t&&Object.assign(this,t)}canStart(){if(!this.isEnabled||this.archetypeNodeData===null)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(t.lastInput.clickCount===1&&(this.pS=t.lastInput.viewPoint.copy()),t.lastInput.clickCount!==2||this.isBeyondDragSize(this.pS))return!1}else if(t.lastInput.clickCount!==1)return!1;return!(t.currentTool!==this&&t.findPartAt(t.lastInput.documentPoint,!0)!==null)}doMouseUp(){let t=this.diagram;this.isActive&&this.insertPart(t.lastInput.documentPoint),this.stopTool()}insertPart(t){let e=this.diagram,i=this.archetypeNodeData;if(i===null)return null;let s=null;try{if(e.D("ChangingSelection",e.selection),this.startTransaction(this.name),i instanceof Nt)i.ke()&&(i.Et(),s=i.copy(),s!==null&&e.add(s));else if(i!==null){let n=e.model.copyNodeData(i);f.Y(n)&&(e.model.addNodeData(n),s=e.findPartForData(n))}if(s!==null){let n=P.V(t.x,t.y);this.isGridSnapEnabled&&this.diagram.yS(s,t,n),s.location=n,e.allowSelect&&(e.clearSelection(!0),s.isSelected=!0),P.e(n)}e.invalidateDocumentBounds(),this.transactionResult=this.name,e.D("PartCreated",s)}finally{this.stopTransaction(),e.D("ChangedSelection",e.selection)}return s}get archetypeNodeData(){return this.Ll}set archetypeNodeData(t){t!==null&&f.ec(t,di,"archetypeNodeData"),this.Ll=t}get isDoubleClick(){return this.mS}set isDoubleClick(t){f.s(t,"boolean",di,"isDoubleClick"),this.mS=t}get isGridSnapEnabled(){return this.yc}set isGridSnapEnabled(t){f.s(t,"boolean",di,"isGridSnapEnabled"),this.yc=t}}class Di extends ee{Xh;wS;Al;constructor(t){super(),this.name="DragSelecting",this.Xh=175,this.wS=!1,this.Al=new Nt({layerName:"Tool",selectable:!1}).add(new ct("Rectangle",{name:"SHAPE",fill:null,stroke:"magenta"}).theme("stroke","dragSelect")).Et(),t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(!t.allowSelect)return!1;let e=t.lastInput;return!(!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.timestamp-t.firstInput.timestamp<this.delay||t.findPartAt(e.documentPoint,!0)!==null))}doActivate(){let t=this.diagram;this.isActive=!0,t.isMouseCaptured=!0,t.skipsUndoManager=!0,this.box&&t.add(this.box),this.doMouseMove()}doDeactivate(){let t=this.diagram;t.stopAutoScroll(),this.box&&t.remove(this.box),t.skipsUndoManager=!1,t.isMouseCaptured=!1,this.isActive=!1}doMouseMove(){let t=this.diagram;if(this.isActive&&this.box!==null){let e=this.computeBoxBounds(),i=this.box.findObject("SHAPE");i===null&&(i=this.box.findMainElement());let s=Q.l().i(e.width,e.height);i!==null&&(i.desiredSize=s),this.box.bc(e.x,e.y,!1),Q.e(s),(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.doAutoScroll(t.lastInput.viewPoint)}}doMouseUp(){if(this.isActive){let t=this.diagram;this.box&&t.remove(this.box);try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),this.selectInRect(this.computeBoxBounds()),t.D("ChangedSelection",t.selection)}finally{t.currentCursor=""}}this.stopTool()}computeBoxBounds(){let t=this.diagram;return new z(t.firstInput.documentPoint,t.lastInput.documentPoint)}selectInRect(t){let e=this.diagram,i=e.lastInput,s=e.findPartsIn(t,this.isPartialInclusion);if(f.tr?i.meta:i.control)if(i.shift){let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected&&(o.isSelected=!1)}}else{let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected=!o.isSelected}}else if(i.shift){let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected||(o.isSelected=!0)}}else{let n=new G,o=e.selection.iterator;for(;o.next();){let h=o.value;s.has(h)||n.add(h)}let r=n.iterator;for(;r.next();){let h=r.value;h.isSelected=!1}let a=s.iterator;for(;a.next();){let h=a.value;h.isSelected||(h.isSelected=!0)}}}get delay(){return this.Xh}set delay(t){f.s(t,"number",Di,"delay"),this.Xh=t}get isPartialInclusion(){return this.wS}set isPartialInclusion(t){f.s(t,"boolean",Di,"isPartialInclusion"),this.wS=t}get box(){return this.Al}set box(t){t!==null&&t.Et(),this.Al=t}}class Zi extends ee{Hw;cL;ko;xS;constructor(t){super(),this.name="Panning",this.Hw=new P,this.cL=new P,this.ko=!1;let e=this;this.xS=()=>{let i=e.diagram;i!==null&&i.Pi(A.document,"scroll",e.xS,!1),e.stopTool()},t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return!(!t.allowHorizontalScroll&&!t.allowVerticalScroll||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize())}doActivate(){let t=this.diagram;this.ko?(t.lastInput.bubbles=!0,t.Ut(A.document,"scroll",this.xS,!1)):(t.currentCursor="move",t.isMouseCaptured=!0,this.Hw.a(t.position)),this.isActive=!0}doDeactivate(){let t=this.diagram;t.currentCursor="",t.isMouseCaptured=!1,this.isActive=!1}doCancel(){let t=this.diagram;t.position=this.Hw,t.isMouseCaptured=!1,this.stopTool()}doMouseMove(){this.fL()}doMouseUp(){this.fL(),this.stopTool()}fL(){let t=this.diagram;if(this.isActive&&t){if(this.ko){t.lastInput.bubbles=!0;return}let e=t.position,i=t.firstInput.documentPoint,s=t.lastInput.documentPoint,n=e.x+i.x-s.x,o=e.y+i.y-s.y;t.allowHorizontalScroll||(n=e.x),t.allowVerticalScroll||(o=e.y),t.position=this.cL.i(n,o)}}get bubbles(){return this.ko}set bubbles(t){f.s(t,"boolean",Zi,"bubbles"),this.ko=t}get originalPosition(){return this.Hw}}class Ne{qw;Ww;bS;kS;constructor(t){this.qw=null,this.Ww=null,this.bS=null,this.kS=null,t&&Object.assign(this,t)}get mainElement(){return this.bS}set mainElement(t){this.bS=t}get show(){return this.qw}set show(t){this.qw!==t&&(t!==null&&f.k(t,Ne,"show"),this.qw=t)}get hide(){return this.Ww}set hide(t){this.Ww!==t&&(t!==null&&f.k(t,Ne,"hide"),this.Ww=t)}get valueFunction(){return this.kS}set valueFunction(t){this.kS=t}}class we{ri;Jw;kc;constructor(t,e,i){this.ri=t,this.Jw=e,this.kc=i}}class qt extends ee{PS;$w;SS;MS;Zw;Qw;bm;constructor(t){super(),this.name="ContextMenu",this.PS=null,this.$w=null,this.SS=null,this.MS=new P,this.Zw=null,this.bm=!1;let e=this;this.Qw=()=>e.stopTool(),t&&Object.assign(this,t)}CF(){let t=new Ne;t.show=(r,a,h)=>h.showDefaultContextMenu(),t.hide=(r,a)=>a.hideDefaultContextMenu(),qt.wu=t;let e=this;this.Qw=()=>e.stopTool();let i=f.hs("div"),s=f.hs("div");i.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px",s.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";let n=f.hs("style");A.document.getElementsByTagName("head")[0].appendChild(n),n.sheet.insertRule(".goCXul { list-style: none; }",0),n.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0),n.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);let o=this.diagram;o!==null&&(o.Ut(i,"contextmenu",qt.jh,!1),o.Ut(i,"selectstart",qt.jh,!1),o.Ut(s,"contextmenu",qt.jh,!1)),i.className="goCXforeground",s.className="goCXbackground",A.document.body&&(A.document.body.appendChild(i),A.document.body.appendChild(s)),qt.km=i,qt.Pm=s,qt.NS=!0}static wu=null;static NS=!1;static Pm;static km;static jh(t){return t.preventDefault(),!1}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return this.isBeyondDragSize()||!t.lastInput.right||t.lastInput.clickCount>1?!1:!!(t.lastInput.isTouchEvent&&this.defaultTouchContextMenu!==null||this.findObjectWithContextMenu()!==null)}doStart(){let t=this.diagram;this.MS.set(t.firstInput.documentPoint)}doStop(){this.hideContextMenu(),this.currentObject=null,this.bm=!1}findObjectWithContextMenu(t){t===void 0&&(t=null);let e=this.diagram,i=e.lastInput,s=null;if(t instanceof q||(t instanceof dt?s=t:s=e.findObjectAt(i.documentPoint,null,n=>!n.layer?.isTemporary)),s!==null){let n=s;for(;n!==null;){if(n.contextMenu!==null)return n;n=n.panel}if(e.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return s.part}else if(e.contextMenu!==null)return e;return null}doActivate(){}doMouseDown(){if(super.doMouseDown(),this.isActive&&this.currentContextMenu instanceof St){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doMouseDown(),t.doDeactivate())}this.diagram.toolManager.mouseDownTools.has(this)&&this.doContextClick()}doMouseUp(){if(this.isActive&&this.currentContextMenu instanceof St){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doCancel(),t.doDeactivate())}this.doContextClick()}doContextClick(){let t=this.diagram;if(!this.isActive)this.canStart()&&(this.openMenu(!0),this.isActive||this.stopTool());else{let e=this.currentContextMenu;if(e===null)return;let i=null;e instanceof Ne||(i=t.findObjectAt(t.lastInput.documentPoint,null,null),i!==null&&i.isContainedBy(e)&&this.standardMouseClick(null,null)),this.maybeStopTool(i)}}maybeStopTool(t){this.stopTool(),this.canStart()&&(this.diagram.currentTool=this,this.doMouseUp())}openMenu(t,e){if(e===void 0&&(e=null),this.bm)return;this.bm=!0,t&&this.standardMouseSelect();let i=this.standardMouseClick();if(this.bm=!1,!i){this.isActive=!0;let s=qt.wu;if(e===null&&(e=this.findObjectWithContextMenu()),e!==null){let n=e.contextMenu;n!==null?(this.currentObject=e instanceof dt?e:null,this.showContextMenu(n,this.currentObject)):s!==null&&this.showContextMenu(s,this.currentObject)}else s!==null&&this.showContextMenu(s,null);this.currentContextMenu instanceof St&&!this.currentContextMenu.visible&&this.stopTool()}}doMouseMove(){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.doMouseMove(),this.isActive&&this.diagram.toolManager.doMouseMove()}showContextMenu(t,e){let i=this.diagram;if(t!==this.currentContextMenu&&this.hideContextMenu(),t instanceof St){let s=t;s.layerName="Tool",s.selectable=!1,s.scale=1/i.scale,s.category=this.name,s.hasPlaceholder()&&(s.placeholder.scale=i.scale);let n=s.diagram;n!==null&&n!==i&&n.remove(s),i.add(s),e!==null?s.adornedObject=e:s.data=i.model,s.ensureBounds(),this.positionContextMenu(s,e)}else t instanceof Ne&&t.show!==null&&t.show(e,i,this);this.currentContextMenu=t}positionContextMenu(t,e){if(t.hasPlaceholder())return;let i=t,s=this.diagram,n=s.lastInput.documentPoint.copy(),o=i.measuredBounds,r=s.viewportBounds;s.lastInput.isTouchEvent&&(n.x-=o.width),n.x+o.width>r.right&&(n.x-=o.width+5/s.scale),n.x<r.x&&(n.x=r.x),n.y+o.height>r.bottom&&(n.y-=o.height+5/s.scale),n.y<r.y&&(n.y=r.y),i.position=n}hideContextMenu(){let t=this.diagram,e=this.currentContextMenu;e!==null&&(e instanceof St?(t.remove(e),this.$w!==null&&this.$w.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Ne&&(e.hide!==null?e.hide(t,this):e.mainElement!==null&&(e.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())}LF(){let t=this,e=new G;return e.add(new we("Copy",i=>i.commandHandler.copySelection(),i=>i.commandHandler.canCopySelection())),e.add(new we("Cut",i=>i.commandHandler.cutSelection(),i=>i.commandHandler.canCutSelection())),e.add(new we("Delete",i=>i.commandHandler.deleteSelection(),i=>i.commandHandler.canDeleteSelection())),e.add(new we("Paste",i=>i.commandHandler.pasteSelection(t.mouseDownPoint),i=>i.commandHandler.canPasteSelection(t.mouseDownPoint))),e.add(new we("Select All",i=>i.commandHandler.selectAll(),i=>i.commandHandler.canSelectAll())),e.add(new we("Undo",i=>i.commandHandler.undo(),i=>i.commandHandler.canUndo())),e.add(new we("Redo",i=>i.commandHandler.redo(),i=>i.commandHandler.canRedo())),e.add(new we("Scroll To Part",i=>i.commandHandler.scrollToPart(),i=>i.commandHandler.canScrollToPart())),e.add(new we("Zoom To Fit",i=>i.commandHandler.zoomToFit(),i=>i.commandHandler.canZoomToFit())),e.add(new we("Reset Zoom",i=>i.commandHandler.resetZoom(),i=>i.commandHandler.canResetZoom())),e.add(new we("Group Selection",i=>i.commandHandler.groupSelection(),i=>i.commandHandler.canGroupSelection())),e.add(new we("Ungroup Selection",i=>i.commandHandler.ungroupSelection(),i=>i.commandHandler.canUngroupSelection())),e.add(new we("Edit Text",i=>i.commandHandler.editTextBlock(),i=>i.commandHandler.canEditTextBlock())),e}showDefaultContextMenu(){let t=this.diagram;this.Zw===null&&(this.Zw=this.LF()),qt.km.innerHTML="",qt.Pm.addEventListener("pointerdown",this.Qw,!1);let e=this,i=f.hs("ul");i.className="goCXul",qt.km.appendChild(i),i.innerHTML="";let s=this.Zw.iterator;for(;s.next();){let n=s.value,o=n.Jw,r=n.kc;if(!f.it(o)||f.it(r)&&!r(t))continue;let a=f.hs("li");a.className="goCXli";let h=f.hs("a");h.className="goCXa",h.href="#",h.Jw=o,h.addEventListener("pointerdown",function(l){return this.Jw(t),e.stopTool(),l.preventDefault(),!1},!1),h.textContent=n.ri,a.appendChild(h),i.appendChild(a)}qt.km.style.display="block",qt.Pm.style.display="block"}hideDefaultContextMenu(){if(this.currentContextMenu===null||this.currentContextMenu!==qt.wu)return;qt.km.style.display="none",qt.Pm.style.display="none";let t=this.diagram;t!==null&&t.Pi(qt.Pm,"pointerdown",this.Qw,!1),this.currentContextMenu=null}get currentContextMenu(){return this.PS}set currentContextMenu(t){this.PS=t,this.$w=t instanceof St?t.adornedPart:null}get defaultTouchContextMenu(){return qt.NS===!1&&qt.wu===null&&q.isUsingDOM()&&this.CF(),qt.wu}set defaultTouchContextMenu(t){t===null&&(qt.NS=!0),qt.wu=t}get currentObject(){return this.SS}set currentObject(t){this.SS=t}get mouseDownPoint(){return this.MS}}var vn=(x=>(x[x.LostFocus=1]="LostFocus",x[x.MouseDown=2]="MouseDown",x[x.Tab=3]="Tab",x[x.Enter=4]="Enter",x))(vn||{}),kn=(x=>(x[x.SingleClick=1]="SingleClick",x[x.SingleClickSelected=2]="SingleClickSelected",x[x.DoubleClick=3]="DoubleClick",x))(kn||{}),Sn=(x=>(x[x.None=1]="None",x[x.Active=2]="Active",x[x.Editing=3]="Editing",x[x.Validating=4]="Validating",x[x.Invalid=5]="Invalid",x[x.Validated=6]="Validated",x))(Sn||{});class me extends ee{Pe;CS;LS;Tl;Yt;AS;TS;DS;_w;FS;constructor(t){super(),this.name="TextEditing",this.Pe=new xt,this.CS=null,this.LS=2,this.Tl=null,this.Yt=1,this.AS=1,this.TS=!0,this.DS=null,this._w=new Ne,this.AF(this._w),t&&Object.assign(this,t)}static LostFocus=1;static MouseDown=2;static Tab=3;static Enter=4;static SingleClick=1;static SingleClickSelected=2;static DoubleClick=3;static StateNone=1;static StateActive=2;static StateEditing=3;static StateValidating=4;static StateInvalid=5;static StateValidated=6;AF(t){if(!q.isUsingDOM())return;let e=f.hs("textarea");this.FS=e;let i=this;e.addEventListener("input",function(s){if(i.textBlock===null)return;let n=i.measureTemporaryTextBlock(this.value),o=this.textScale;this.style.width=20+Math.max(i.textBlock.measuredBounds.width,n.measuredBounds.width)*o+"px",this.rows=Math.max(i.textBlock.lineCount,n.lineCount)},!1),e.addEventListener("keydown",function(s){if(s.isComposing||i.textBlock===null)return;let n=s.key;if(n==="Enter"){i.textBlock.isMultiline===!1&&s.preventDefault(),i.acceptText(4);return}else if(n==="Tab"){i.acceptText(3),s.preventDefault();return}else n==="Escape"&&(i.doCancel(),i.diagram!==null&&i.diagram.doFocus())},!1),e.addEventListener("focus",function(s){i.TF(s)},!1),e.addEventListener("blur",function(s){i.DF(s)},!1),t.valueFunction=()=>e.value,t.mainElement=e,t.show=(s,n,o)=>{if(!(s instanceof xt)||!n||!n.div||!(o instanceof me))return;if(o.state===5){e.style.border="3px solid red",e.focus();return}let r=s.getDocumentPoint(D.Center),a=n.position,h=n.scale,l=s.getDocumentScale()*h;l<o.minimumEditorScale&&(l=o.minimumEditorScale);let c=s.naturalBounds.width*l+6,u=s.naturalBounds.height*l+2,d=(r.x-a.x)*h,g=(r.y-a.y)*h,p=s.verticalAlignment,m=(s.lineHeight+s.spacingAbove+s.spacingBelow)*s.lineCount*l,y=.5*u-.5*m,w=p.y*u-p.y*m+p.offsetY-y-m/2;e.value=s.text,n.div.style.font=s.font;let b=1;e.style.position="absolute",e.style.zIndex="100",e.style.font="inherit",e.style.fontSize=l*100+"%",e.style.lineHeight="normal",e.style.width=c+"px",e.style.left=(d-c/2|0)-b+"px",e.style.top=(g+w|0)-b+"px",e.style.textAlign=s.textAlign,e.style.margin="0",e.style.padding=b+"px",e.style.border="0",e.style.outline="none",e.style.whiteSpace="pre-wrap",e.style.overflow="hidden",e.rows=s.lineCount,e.textScale=l,e.className="goTXarea",n.div.appendChild(e),e.focus(),o.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))},t.hide=(s,n)=>{s.div&&s.div.removeChild(e)}}get textBlock(){return this.CS}set textBlock(t){this.CS=t}get currentTextEditor(){return this.DS}set currentTextEditor(t){this.DS=t}get defaultTextEditor(){return this._w}set defaultTextEditor(t){this._w=t}get starting(){return this.LS}set starting(t){this.LS=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly||me.Pc&&me.Pc!==this&&(me.Pc.acceptText(2),me.Pc&&me.Pc!==this)||!t.lastInput.left||this.isBeyondDragSize())return!1;let e=t.lastInput.documentPoint,i=t.findObjectAt(e);if(i===null||!(i instanceof xt)||!i.editable||i.part===null||!i.part.canEdit())return!1;let s=i.part;return!(s===null||this.starting===2&&!s.isSelected||this.starting===3&&t.lastInput.clickCount<2)}doStart(){me.Pc=this,this.textBlock!==null&&this.doActivate()}doActivate(){if(this.isActive)return;let t=this.diagram;if(t===null)return;let e=this.textBlock;if(e===null&&(e=t.findObjectAt(t.lastInput.documentPoint)),e===null||!(e instanceof xt)||(this.textBlock=e,e.part===null))return;t.animationManager.stopAnimation(),this.isActive=!0,this.Yt=2;let i=this.defaultTextEditor;e.textEditor!==null&&(i=e.textEditor),this.Pe=this.textBlock.copy();let s=new z(this.textBlock.getDocumentPoint(D.TopLeft),this.textBlock.getDocumentPoint(D.BottomRight));t.scrollToRect(s),i!==null&&i.show!==null&&i.show(e,t,this),this.currentTextEditor=i}doCancel(){this.stopTool()}doMouseUp(){this.canStart()&&this.doActivate()}doMouseDown(){this.isActive&&this.acceptText(2)}acceptText(t){switch(t){case 2:this.Yt===6?this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus():(this.Yt===2||this.Yt===5||this.Yt===3)&&(this.Yt=4,this.uL());break;case 1:case 4:case 3:if(t===4&&this.textBlock!==null&&this.textBlock.isMultiline===!0)return;(this.Yt===2||this.Yt===5||this.Yt===3)&&(this.Yt=4,this.uL());break}}uL(){let t=this.textBlock,e=this.diagram,i=this.currentTextEditor;if(t!==null&&i!==null){let s=t.text,n="";if(i.valueFunction!==null&&(n=i.valueFunction()),!this.isValidText(t,s,n)){this.Yt=5,this.doError(s,n);return}this.startTransaction(this.name),this.Yt=6,this.transactionResult=this.name,t.text=n,this.doSuccess(s,n),e!==null&&e.D("TextEdited",t,s),this.stopTransaction(),this.stopTool(),e!==null&&e.doFocus()}}doError(t,e){let i=this.textBlock;if(i===null)return;i.errorFunction!==null&&i.errorFunction(this,t,e);let s=this.currentTextEditor;s!==null&&s.show!==null&&s.show(i,this.diagram,this)}doSuccess(t,e){let i=this.textBlock;i!==null&&i.textEdited!==null&&i.textEdited(i,t,e)}doDeactivate(){let t=this.diagram;if(t!==null){if(this.Yt=1,this.currentTextEditor!==null){let e=this.currentTextEditor;e!==null&&e.hide!==null&&e.hide(t,this)}this.textBlock=null,this.isActive=!1}}doStop(){me.Pc=null}TF(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.FS;this.Yt===2&&(this.Yt=3),f.it(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}DF(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.FS;f.it(e.focus)&&e.focus(),f.it(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}isValidText(t,e,i){let s=this.textValidation;if(s!==null&&!s(t,e,i))return!1;let n=t.textValidation;return!(n!==null&&!n(t,e,i))}get textValidation(){return this.Tl}set textValidation(t){t!==null&&f.k(t,me,"textValidation"),this.Tl=t}get minimumEditorScale(){return this.AS}set minimumEditorScale(t){t!==null&&f.s(t,"number",me,"minimumEditorScale"),this.AS=t}get selectsTextOnActivate(){return this.TS}set selectsTextOnActivate(t){t!==null&&f.s(t,"boolean",me,"selectsTextOnActivate"),this.TS=t}get state(){return this.Yt}set state(t){this.Yt!==t&&(this.Yt=t)}measureTemporaryTextBlock(t){let e=this.Pe;return e.text=t,this.textBlock!==null&&e.ht(this.textBlock.Dl,1/0),e}static Pc=null}var Pn=(x=>(x[x.Default=1]="Default",x[x.AnimateLocations=2]="AnimateLocations",x[x.None=3]="None",x))(Pn||{});class pe{N;Si;Oi;wr;zn;So;RS;vS;Sm;pi;Sc;on;Mm;Hh;tx;Nm;ix;Mc;pu;Cm;constructor(t){this.N=q.um(),this.Si=!1,this.Sm=!1,this.pi=!1,this.Sc=!1,this.ix=!0,this.Mc=1,this.pu=!1,this.Oi=!0,this.wr=!0,this.So=600,this.RS=!1,this.vS=!1,this.zn=new I,this.on=new Ce,this.Mm=new Ce,this.on.ds=this,this.Hh=new I,this.tx=new I,this.Nm=new I,this.Cm=new I,t&&Object.assign(this,t)}Mo(t){this.N=t}NE(){return this.N}canStart(t){return!0}Fl(t){return!this.Oi||!this.canStart(t)?!1:(this.zn.add(t),this.defaultAnimation.isAnimating&&this.stopAnimation(),this.N.Mi(),this.pi=!0,!0)}getBundleAnimation(){return this.Mm}OS(){if(!this.Oi||(this.Mm.ce.count>0&&this.Mm.start(),!this.pi))return;let t=this.on,e=this.N,i=this.zn.has("Model");if(i&&(this.Sc=!0,this.Mc===1?(t.isViewportUnconstrained=!0,t.ce.clear(),t.add(e,"position",e.position.copy().offset(0,-200),e.position),t.add(e,"opacity",0,1)):this.Mc===3&&t.ce.clear(),this.Mc===2&&e.ex.equals(e.at)?this.ix=!0:this.ix=!1,e.D("InitialAnimationStarting",this)),i&&!this.wr||t.ce.count===0){this.zn.clear(),this.pi=!1,t.ce.clear(),t.nx(e),this.Sc=!1,e.S();return}this.zn.clear(),e.xr=!1;let s=t.ce.get(e);e.autoScale!==1&&s!==null&&(delete s.ei.scale,delete s.gs.scale);let n=this;A.requestAnimationFrame(()=>{n.pi===!1||t.Si||(e.getRenderingHint("temporaryPixelRatio")&&e.Bw(),e.IS(),n.pi=!1,t.start(),t.Si&&(n.xu(),e.invalidateDocumentBounds(),t.dL(0),e.ur(!0),n.bu(),e.D("AnimationStarting",n)))})}ES(){return this.zn.has("Trigger")&&this.zn.count===1}gL(t,e,i,s){this.isTicking||this.ES()||t instanceof _&&(t.fromNode!==null||t.toNode!==null)||this.on.add(t,"position",e,i,s)}lx(t){return this.on.lx(t)}US(t){return this.on.US(t)}FF(t){let e=this.Hh,i=this;function s(){if(i.Nm.count>0&&(e.addAll(i.Nm),i.Nm.clear(),i.Si=!0),i.Si===!1||e.count===0)return;i.tx.addAll(e);let n=i.tx.iterator;for(;n.next();){let o=n.value;o.Si!==!1&&(o.RF()?o.mL(!1):o.Nc=!0)}if(i.tx.clear(),i.Si===!1){A.requestAnimationFrame(s);return}i.xu(),i.N.ur(),i.bu(),A.requestAnimationFrame(s)}this.Si?this.vF(t):(this.Si=!0,e.add(t),A.requestAnimationFrame(()=>s()))}vF(t){this.Nm.add(t)}OF(){let t=this.Hh.iterator;for(;t.next();)t.value.Nc=!1}xu(){if(this.Sm)return;let t=this.N;this.RS=t.skipsUndoManager,this.vS=t.fe,t.skipsUndoManager=!0,t.fe=!0,this.Sm=!0}bu(){let t=this.N;t.skipsUndoManager=this.RS,t.fe=this.vS,this.Sm=!1}stopAnimation(t){let e=this.on;if(this.pi===!0&&(this.pi=!1,this.Sc=!1,this.zn.clear(),e.IF()&&this.N.requestUpdate()),!this.Si){e.ce.clear(),e.nx(this.N);return}if(e.ku(!0),e.nx(null),t===!0){let i=this.Hh.toArray();for(let s=0;s<i.length;s++)i[s].ku(!0)}}ku(t){this.Hh.delete(t),this.Hh.count===0&&(this.Si=!1,this.N.requestUpdate()),t===this.defaultAnimation&&this.N.D("AnimationFinished",this)}Cc(t,e){this.pi&&(!this.zn.has("Expand Tree")&&!this.zn.has("Expand SubGraph")||(this.on.Cc(t,e),this.pL(t)))}Lc(t,e){this.pi&&(!this.zn.has("Collapse Tree")&&!this.zn.has("Collapse SubGraph")||(this.on.Lc(t,e),this.on.BS(e,"position",e.position,e.position),this.pL(t)))}yL(t,e){!this.pi||t.equals(e)||this.ES()||(this.N.Vh||(t=e.copy()),this.on.BS(this.N,"position",t,e))}wL(t,e){this.pi&&(this.ES()||this.on.add(this.N,"scale",t,e))}VS(t,e){t.Se&&(t.br=e,this.Cm.add(t))}pL(t){let e=t.findLinksConnected();for(;e.next();){let i=e.value;i.Se&&(i.br=i.points.copy(),this.Cm.add(i))}}get isEnabled(){return this.Oi}set isEnabled(t){f.s(t,"boolean",pe,"isEnabled"),this.Oi=t,t&&this.Hh.each(e=>{!e.isAnimating&&e.runCount===1/0&&e.start()})}get duration(){return this.So}set duration(t){f.s(t,"number",pe,"duration"),t<1&&f.W(t,">= 1",pe,"duration"),this.So=t}get isAnimating(){return this.Si}get isTicking(){return this.Sm}get isInitial(){return this.wr}set isInitial(t){f.s(t,"boolean",pe,"isInitial"),this.wr=t}get defaultAnimation(){return this.on}get activeAnimations(){return this.Hh}get initialAnimationStyle(){return this.Mc}set initialAnimationStyle(t){this.Mc=t}static hx=new pt;static defineAnimationEffect(t,e){pe.hx.set(t,e)}static zS(t,e,i,s,n){t===null&&(t=[0,0,0,0]),e===null&&(e=[0,0,0,0]);let o=t[0],r=t[1],a=t[2],h=t[3],l=e[0],c=e[1],u=e[2],d=e[3];a===0||a===100?(o=l,r=c):(u===0||u===100)&&(l=o,c=r),Math.abs(l-o)>180&&(l>o?o+=360:l+=360);let g=n(i,o,l-o,s)%360,p=n(i,r,c-r,s),m=n(i,a,u-a,s),y=n(i,h,d-h,s);return"hsla("+g+", "+p+"%, "+m+"%, "+y+")"}static Default=1;static AnimateLocations=2;static None=3}{let x=pe.hx,t=(e,i,s,n,o,r)=>{e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))};x.set("position:diagram",t),x.set("position",t),x.set("position:part",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!1):e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("location",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!0):e.location=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("position:placeholder",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!1):e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("position:nodeCollapse",(e,i,s,n,o,r)=>{let a=e.actualBounds,h=s.actualBounds,l=h.x+h.width/2-a.width/2,c=h.y+h.height/2-a.height/2;o<r?e.bc(n(o,i.x,l-i.x,r),n(o,i.y,c-i.y,r),!1):e.position=new P(n(o,i.x,l-i.x,r),n(o,i.y,c-i.y,r))}),x.set("desiredSize",(e,i,s,n,o,r)=>{e.desiredSize=new Q(n(o,i.width,s.width-i.width,r),n(o,i.height,s.height-i.height,r))}),x.set("width",(e,i,s,n,o,r)=>{e.width=n(o,i,s-i,r)}),x.set("height",(e,i,s,n,o,r)=>{e.height=n(o,i,s-i,r)}),x.set("fill",(e,i,s,n,o,r)=>{e.fill=pe.zS(i,s,o,r,n)}),x.set("stroke",(e,i,s,n,o,r)=>{e.stroke=pe.zS(i,s,o,r,n)}),x.set("strokeWidth",(e,i,s,n,o,r)=>{e.strokeWidth=n(o,i,s-i,r)}),x.set("strokeDashOffset",(e,i,s,n,o,r)=>{e.strokeDashOffset=n(o,i,s-i,r)}),x.set("background",(e,i,s,n,o,r)=>{e.background=pe.zS(i,s,o,r,n)}),x.set("opacity",(e,i,s,n,o,r)=>{e.opacity=n(o,i,s-i,r)}),x.set("scale",(e,i,s,n,o,r)=>{e.scale=n(o,i,s-i,r)}),x.set("angle",(e,i,s,n,o,r)=>{e.angle=n(o,i,s-i,r)})}class Ce{ax;Lm;Si;Pu;So;ms;xL;Ac;ce;cx;ei;Xn;Su;Tc;fx;ux;Nc;XS;gx;ds;N;GS;YS;KS;constructor(t){this.N=null,this.ds=null,this.XS=null,this.gx=null,this.GS=!1,this.Si=!1,this.Nc=!1,this.ei=0,this.Xn=0,this.ax=Ce.EaseInOutQuad,this.Lm=Ce.EaseInOutQuad,this.Su=!1,this.Tc=!1,this.fx=1,this.ux=0,this.So=NaN,this.ms=NaN,this.YS=0,this.Pu=null,this.xL=P.xo,this.ce=new pt,this.cx=new pt,this.Ac=new I,this.KS=1,t&&Object.assign(this,t)}suspend(){this.Nc=!0}advanceTo(t,e){e&&(this.Nc=!1),this.Su&&t>=this.ms&&(this.Tc=!0,t=t-this.ms),this.YS=t,this.mL(!0),this.ds.xu(),this.N.ur(),this.ds.bu(),this.N.redraw()}nx(t){if(this.cx.clear(),this.Tc=!1,this.ux=0,this.ms=NaN,this.Ac.count>0&&this.Ac.clear(),t!==null){let e=t.links;for(;e.next();)e.value.br=null}}IF(){return this.ce.count>0}start(){if(this.ce.count===0)return this;if(this.Si)return this;let t=this.N,e=this.ce.iterator;for(;e.next();){let s=e.key;t===null&&(s instanceof q?t=s:s instanceof dt&&(t=s.diagram))}if(t!==null)this.N=t,this.ds=t.animationManager;else return this;let i=this.ds;return i.isEnabled===!1?this:(this.ms=isNaN(this.So)?i.duration:this.So,this.Lm=this.ax,i.Sc&&i.Mc===1&&this===i.defaultAnimation&&(this.Lm=Ce.EaseOutExpo,this.ms=isNaN(this.So)?i.duration===600?900:i.duration:this.So),this.KS=t.scrollMode,this.isViewportUnconstrained&&(t.qh=2),i.xu(),this.Ac.each(s=>{s.data=null,t.add(s)}),i.bu(),this.Si=!0,this.ei=+new Date,this.Xn=this.ei+this.ms,i.FF(this),this)}addTemporaryPart(t,e){return t.ke()?(this.Ac.add(t),this.N=e,this):this}add(t,e,i,s,n){if(this.N===null&&(t instanceof q?this.N=t:t instanceof dt&&t.diagram!==null&&(this.N=t.diagram)),t instanceof Nt){if(!t.isAnimated)return this;e==="position"&&(e="position:part")}return this.BS(t,e,i,s,n),this}BS(t,e,i,s,n){let o=this.ce,r,a,h;if(t instanceof q&&e==="position"&&(e="position:diagram"),(e==="fill"||e==="stroke"||e==="background")&&(E.No(i),E.jS(),i=[E.Ii.n0,E.Ii.n1,E.Ii.n2,E.Ii.n3],E.No(s),E.jS(),s=[E.Ii.n0,E.Ii.n1,E.Ii.n2,E.Ii.n3]),o.has(t))r=o.get(t),a=r.ei,h=r.gs,a[e]===void 0&&(a[e]=this.Mu(i)),h[e]=this.Mu(s);else{if(e==="position"&&i.equalsApprox(s))return;a={},h={},a[e]=this.Mu(i),h[e]=this.Mu(s),r=new Qo(a,h,n),o.set(t,r)}let l=a[e];l instanceof P&&!l.isReal()&&l.a(this.xL),n&&e.indexOf("position:")===0&&t instanceof Nt?r.mx.location=this.Mu(t.location):n&&(r.mx[e]=this.Mu(i))}Mu(t){return t instanceof P||t instanceof Q?t.copy():t}EF(t){let e=this.ce;if(e.has(t)){let i=e.get(t);i.yx=!0}}lx(t){if(!this.Si)return!1;let e=this.ce.get(t);return e!==null&&e.yx}US(t){if(!this.Si)return!1;let e=this.ce.get(t);return e!==null&&!!(e.ei.position||e.ei["position:part"]||e.ei.location)}RF(){if(this.Ac.count>0)return!0;let t=this.ce.iterator;for(;t.next();){let e=t.key;if(e instanceof dt&&e.diagram!==null||e instanceof q)return!0}return!1}mL(t){if(this.Nc&&!t)return;let e=this.ds;if(this.Si===!1)return;let i=+new Date,s=i>this.Xn?this.ms:i-this.ei;t&&(s=this.YS,s<this.ms?(this.ei=+new Date-s,this.Xn=this.ei+this.ms):s=this.ms),e.xu(),this.dL(s),this.N.ur(!0),e.bu(),i>this.Xn&&(this.Su&&!this.Tc?(this.ei=+new Date,this.Xn=this.ei+this.ms,this.Tc=!0):this.ku(!1))}dL(t){let e=this.ms,i=this.ce.iterator,s=this.Tc;for(;i.next();){let n=i.key;if(n instanceof dt&&n.diagram===null)continue;let o=i.value,r=s?o.gs:o.ei,a=s?o.ei:o.gs,h=pe.hx;for(let l in a)l==="position"&&(a["position:placeholder"]||a["position:nodeCollapse"])||h.get(l)!==null&&h.get(l)(n,r[l],a[l],this.Lm,t,e,this)}}stop(){return this.Si?(this.ku(!0),this):this}ku(t){if(this.gx!==null&&this.gx.UF(this.XS),!this.Si)return;let e=this.N,i=this.ds;i.Sc=!1,this.Si=!1,this.Nc=!1,i.xu();let s=this.ce,n=this.Ac.iterator;for(;n.next();)e.remove(n.value);let o=this.Su,r=s.iterator,a=pe.hx;for(;r.next();){let l=r.key,c=r.value,u=o?c.gs:c.ei,d=o?c.ei:c.gs,g=c.mx;for(let p in d)if(a.get(p)!==null){let m=p;c.wx&&(m==="position:nodeCollapse"||m==="position:placeholder")&&(m="position"),a.get(m)(l,u[p],g[p]!==void 0?g[p]:c.wx?u[p]:d[p],this.Lm,this.ms,this.ms,this)}c.wx&&g.location!==void 0&&l instanceof Nt&&(l.location=g.location),c.yx&&l instanceof Nt&&l.Ei(!1)}this.ux++;let h=!t&&this.fx>this.ux;if(!h&&(this===i.Mm||this===i.defaultAnimation)&&this.ce.clear(),e.xx.clear(),e.CP(!1),e.invalidateDocumentBounds(),e.S(),e.ur(!0),i.defaultAnimation===this){let l=i.Cm.iterator;for(;l.next();)l.value.BF();i.Cm.clear()}if(e.ur(!0),this.isViewportUnconstrained&&(e.scrollMode=this.KS),i.bu(),h){this.Tc=!1,this.start();return}this.nx(null),e.bL(),i.ku(this),this.Pu&&this.Pu(this),e.requestUpdate()}Cc(t,e){let i=e.actualBounds,s=null;if(e instanceof ft&&(s=e.placeholder),s!==null&&s.visible){let n=s.getDocumentPoint(D.TopLeft),o=s.padding;n.x+=o.left,n.y+=o.top,this.add(t,"position",n,t.position,!1)}else this.add(t,"position",new P(i.x+i.width/2,i.y+i.height/2),t.position,!1);this.add(t,"scale",.01,t.scale,!1),t instanceof ft&&this.VF(t,e)}VF(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof rt&&this.Cc(s,e)}}Lc(t,e){if(!t.isVisible())return;let i=null;if(e instanceof ft&&(i=e.placeholder),i!==null&&i.visible){let s=i.getDocumentPoint(D.TopLeft),n=i.padding;s.x+=n.left,s.y+=n.top,this.add(t,"position:placeholder",t.position,s,!0)}else this.add(t,"position:nodeCollapse",t.position,e,!0);this.add(t,"scale",t.scale,.01,!0),this.EF(t),t instanceof ft&&this.zF(t,e)}zF(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof rt&&this.Lc(s,e)}}get duration(){return this.So}set duration(t){f.s(t,"number",Ce,"duration"),t<1&&f.W(t,">= 1",Ce,"duration"),this.So=t}get reversible(){return this.Su}set reversible(t){this.Su=t}get runCount(){return this.fx}set runCount(t){t>0?this.fx=t:f.o("Animation.runCount value must be a positive integer.")}get finished(){return this.Pu}set finished(t){this.Pu!==t&&(t!==null&&f.k(t,Ce,"finished"),this.Pu=t)}get easing(){return this.ax}set easing(t){this.ax=t}get isViewportUnconstrained(){return this.GS}set isViewportUnconstrained(t){this.GS=t}get isAnimating(){return this.Si}getTemporaryState(t){let e=this.cx.get(t);return e===null&&(e={},this.cx.set(t,e)),e}static EaseLinear=(t,e,i,s)=>i*t/s+e;static EaseInOutQuad=(t,e,i,s)=>(t/=s/2,t<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e);static EaseInQuad=(t,e,i,s)=>i*(t/=s)*t+e;static EaseOutQuad=(t,e,i,s)=>-i*(t/=s)*(t-2)+e;static EaseInExpo=(t,e,i,s)=>t===0?e:i*Math.pow(2,10*(t/s-1))+e;static EaseOutExpo=(t,e,i,s)=>t===s?e+i:i*(-Math.pow(2,-10*t/s)+1)+e}class Qo{ei;gs;mx;wx;yx;constructor(t,e,i){this.ei=t,this.gs=e,this.mx={},this.wx=i,this.yx=!1}}var Mn=(x=>(x[x.Default=1]="Default",x[x.Immediate=2]="Immediate",x[x.Bundled=3]="Bundled",x))(Mn||{});class Fi{be;en;Nu;Dc;constructor(t,e,i){this.be=null,this.en=t,this.Nu=i||1,this.Dc=null,e!==void 0&&(this.Dc=e,i===void 0&&(this.Nu=2))}copy(){let t=new Fi(this.en);t.Nu=this.Nu;let e=this.Dc;if(e!==null){let i={};e.duration!==void 0&&(i.duration=e.duration),e.finished!==void 0&&(i.finished=e.finished),e.easing!==void 0&&(i.easing=e.easing),t.Dc=i}return t}get propertyName(){return this.en}set propertyName(t){this.en=t}get animationSettings(){return this.Dc}set animationSettings(t){this.Dc=t}XF(t){let e=this.Dc;e!==null&&(e.duration&&(t.duration=e.duration),e.finished&&(t.finished=e.finished),e.easing&&(t.easing=e.easing))}get startCondition(){return this.Nu}set startCondition(t){this.Nu=t}static Default=1;static Immediate=2;static Bundled=3}class Vt{N;Pt;$t;kr;Rl;vl;Ol;Il;El;Ul;Bl;Vl;zl;Xl;Gl;Yl;kc;Kl;bx;Am;Cu;Ct;constructor(t){I.Ki(this),this.N=null,this.Ct=new G,this.Pt="",this.$t=1,this.kr=!1,this.Rl=!0,this.vl=!0,this.Ol=!0,this.Il=!0,this.El=!0,this.Ul=!0,this.Bl=!0,this.Vl=!0,this.zl=!0,this.Xl=!0,this.Gl=!0,this.Yl=!0,this.kc=!0,this.Kl=!0,this.bx=!0,this.Am=!1,this.Cu=[],t&&Object.assign(this,t)}GF(){let t=this.Ct;for(let e=0;e<t.length;e++)t.r[e].HS(null);t.clear(),this.Cu.length=0}Mo(t){this.N=t}toString(t){t===void 0&&(t=0);let e='Layer "'+this.name+'"';if(t<=0)return e;let i=0,s=0,n=0,o=0,r=0,a=this.Ct.iterator;for(;a.next();){let l=a.value;l instanceof ft?n++:l instanceof rt?s++:l instanceof _?o++:l instanceof St?r++:i++}let h="";if(i>0&&(h+=i+" Parts "),s>0&&(h+=s+" Nodes "),n>0&&(h+=n+" Groups "),o>0&&(h+=o+" Links "),r>0&&(h+=r+" Adornments "),t>1){let l=this.Ct.iterator;for(;l.next();){let c=l.value;h+=`
8
+ `+c.toString();let u=c.data;u!==null&&I.as(u)&&(h+=" #"+I.as(u)),c instanceof rt?h+=" "+f.toString(u):c instanceof _&&(h+=" "+f.toString(c.fromNode)+" "+f.toString(c.toNode))}}return e+" "+this.Ct.count+": "+h}findObjectAt(t,e,i){if(e===void 0&&(e=null),i===void 0&&(i=null),this.Kl===!1)return null;let s=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(s=!0);let n=P.l(),o=this.Ct.r,r=o.length;for(let a=r;a--;){let h=o[a];if(s===!0&&h.Nl()===!1||!h.isVisible())continue;n.a(t),n.Oe(h.Us);let l=h.kL(n,e,i);if(l!==null&&(e!==null&&(l=e(l)),l!==null&&(i===null||i(l))))return P.e(n),l}return P.e(n),null}findObjectsAt(t,e,i,s){if(e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof G)&&!(s instanceof I)&&(s=new I),this.Kl===!1)return s;let n=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(n=!0);let o=P.l(),r=this.Ct.r,a=r.length;for(let h=a;h--;){let l=r[h];if(n===!0&&l.Nl()===!1||!l.isVisible())continue;o.a(t),o.Oe(l.Us);let c=l;l.PL(o,e,i,s)&&(e!==null&&(c=e(c)),c!==null&&(i===null||i(c))&&s.add(c))}return P.e(o),s}findObjectsIn(t,e,i,s,n){if(e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof G)&&!(n instanceof I)&&(n=new I),this.Kl===!1)return n;let o=!1;this.diagram!==null&&this.diagram.viewportBounds.containsRect(t)&&(o=!0);let r=this.Ct.r,a=r.length;for(let h=a;h--;){let l=r[h];if(o===!0&&l.Nl()===!1||!l.isVisible())continue;let c=l;l.Tm(t,e,i,s,n)&&(e!==null&&(c=e(c)),c!==null&&(i===null||i(c))&&n.add(c))}return n}OP(t,e,i,s,n,o,r){if(this.Kl===!1)return n;let a=this.Ct.r,h=a.length;for(let l=h;l--;){let c=a[l];if(r===!0&&c.Nl()===!1||!o(c)||!c.isVisible())continue;let u=c;c.Tm(t,e,i,s,n)&&(e!==null&&(u=e(u)),u!==null&&(i===null||i(u))&&n.add(u))}return n}findObjectsNear(t,e,i,s,n,o){if(i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof G||n instanceof I)&&(o=n),n=!0),!(o instanceof G)&&!(o instanceof I)&&(o=new I),this.Kl===!1)return o;let r=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(r=!0);let a=P.l(),h=P.l(),l=this.Ct.r,c=l.length;for(let u=c;u--;){let d=l[u];if(r===!0&&d.Nl()===!1||!d.isVisible())continue;a.a(t),a.Oe(d.Us),h.i(t.x+e,t.y),h.Oe(d.Us);let g=d;d.SL(a,h,i,s,n,o)&&(i!==null&&(g=i(g)),g!==null&&(s===null||s(g))&&o.add(g))}return P.e(a),P.e(h),o}qS(){return this.Ct.r}ps(t,e){if(!this.visible)return;let i=this.Ct.r,s=i.length;if(s===0)return;let n=f.et(),o=f.et();for(let r=0;r<s;r++){let a=i[r];if(a.WS=r,a instanceof _){if(a.Se===!1)continue}else if(a instanceof St&&a.adornedPart!==null)continue;let h=a.actualBounds;a.isVisible()&&h.intersectsRectPlus(e,10)?(a.ps(!0),n.push(a)):(a.ps(!1),a.adornments!==null&&a.adornments.count>0&&o.push(a))}for(let r=0;r<n.length;r++){let a=n[r];a.JS();let h=a.adornments;for(;h.next();){let l=h.value;l.ht(1/0,1/0),l.Bt(),l.ps(!0)}}for(let r=0;r<o.length;r++)o[r].JS();f.J(n),f.J(o)}Lu(t){let e=1;return this.$t!==1&&(e=t.globalAlpha,t.globalAlpha=e*this.$t),e}ML(t,e){for(let i=0;i<e;i++)t[i].Au()}Ui(t,e,i){if(!this.visible||this.$t===0||(i===void 0&&(i=!0),!i&&this.isTemporary))return;let s=this.Ct.r,n=s.length;if(n===0)return;t.kr&&this.ML(s,n);let o=this.Lu(t),r=this.Cu;r.length=0;let a=e.scale,h=z.l();for(let l=0;l<n;l++){let c=s[l];this.Dm(t,c,e,r,a,h,!0)}z.e(h),t.kr&&this.ML(s,n),t.globalAlpha=o}CE(t,e,i){if(!this.visible||this.$t===0)return;let s=this.Ct.r,n=s.length;if(n===0)return;let o=this.Lu(t),r=this.Cu;r.length=0;let a=e.scale,h=z.l();for(let l=0;l<n;l++){let c=s[l];i.has(c)||this.Dm(t,c,e,r,a,h,!0)}z.e(h),t.globalAlpha=o}YF(t,e,i,s){if(!this.visible||this.$t===0||!s&&this.isTemporary)return;let n=this.Ct.r,o=n.length;if(o===0)return;let r=this.Lu(t),a=this.Cu;a.length=0;let h=e.scale,l=z.l();for(let c=0;c<o;c++){let u=n[c];i.has(u)&&this.Dm(t,u,e,a,h,l,!1)}z.e(l),t.globalAlpha=r}KF(t,e,i,s,n){if(!this.visible||this.opacity===0)return;let o=this.diagram.grid.part;if(!s&&this.isTemporary){if(n&&o.layer===this){let r=this.Lu(t);o.Ui(t,i),t.globalAlpha=r}}else{let r=this.Lu(t),a=i.scale,h=z.l(),l=this.Ct.r,c=l.length;for(let u=0;u<c;u++){let d=l[u];!n&&d===o||this.Dm(t,d,i,null,a,h,!1)}z.e(h),t.globalAlpha=r}}LE(t,e,i){if(!this.visible||this.$t===0)return;let s=this.Lu(t),n=this.Cu;n.length=0;let o=e.scale,r=z.l(),a=this.Ct.r,h=a.length,l=i.length;for(let c=0;c<h;c++){let u=a[c],d=u.Wh(u.actualBounds);this.jF(d,i,l,o)&&this.Dm(t,u,e,n,o,r,!0)}z.e(r),t.globalAlpha=s}Dm(t,e,i,s,n,o,r){if(r&&!e.Nl()){t.removePartFromView(e);return}if(s!==null&&e instanceof _&&(e.isOrthogonal&&s.push(e),e.Se===!1)){t.removePartFromView(e);return}let a=!1,h=e.containingGroup;for(;h!==null;)a?h.si!==null&&o.intersectRect(h.si):h.si!==null&&(a=!0,o.a(h.si)),h=h.containingGroup;let l=e.actualBounds,c=!1;if(a&&e.isVisible()){if(!o.intersectsRect(l)){t.removePartFromView(e);return}c=!o.containsRect(l)}c&&(t.save(),t instanceof ue?t.partClipRect=o.copy():(t.beginPath(),t.rect(o.x,o.y,o.width,o.height),t.clip())),l.width*n>i.Fm||l.height*n>i.Fm?e.Ui(t,i):this.HF(t,e,i),c&&(t.restore(),t.clearContextCache(!0))}HF(t,e,i){if(t instanceof ue){e.Ui(t,i);return}let s=e.actualBounds,n=e.naturalBounds;if(s.width===0||s.height===0||isNaN(s.x)||isNaN(s.y)||!e.isVisible())return;let o=e.T;if(e.background===null){e.rn(t,"rgba(0,0,0,0.3)",!0,!1,n,s),t.fillRect(s.x,s.y,s.width,s.height);return}if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),e.rn(t,e.background,!0,!1,n,s),t.fillRect(0,0,n.width/2,n.height/2),!o.Gk()){let r=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*r,-o.m12*r,-o.m21*r,o.m11*r,r*(o.m21*o.dy-o.m22*o.dx),r*(o.m12*o.dx-o.m11*o.dy))}}jF(t,e,i,s){let n=2/s,o=4/s;for(let r=0;r<i;r++){let a=e[r];if(!(a.width===0||a.height===0)&&t.intersects(a.x-n,a.y-n,a.width+o,a.height+o))return!0}return!1}t(t,e,i,s,n){let o=this.diagram;o!==null&&o.raiseChangedEvent(2,t,this,e,i,s,n)}Jh(t,e,i){let s=this.Ct;if(e.HS(this),t>=s.count)t=s.count;else if(s.elt(t)===e)return-1;s.insertAt(t,e),e.Rm(i);let n=this.diagram;return n!==null&&(i?n.S():n.Jh(e)),this.kx(t,e),t}te(t,e,i){if(!i&&e.layer!==this&&e.layer!==null)return e.layer.te(t,e,i);let s=this.Ct;if(t<0||t>=s.length){if(t=s.indexOf(e),t<0)return-1}else if(s.elt(t)!==e&&(t=s.indexOf(e),t<0))return-1;e.vm(i),s.removeAt(t);let n=this.diagram;return n!==null&&(i?n.S():n.te(e)),e.HS(null),t}kx(t,e){t=this.qF(t,e),e instanceof ft&&this.WF(t,e),e.svg!==null&&e.svg.remove()}qF(t,e){let i=e.zOrder;if(isNaN(i))return t;let s=this.Ct,n=s.count;if(n<=1)return t;if(t<0&&(t=s.indexOf(e)),t<0)return-1;let o=t-1,r=NaN;for(;o>=0&&(r=s.elt(o).zOrder,!!isNaN(r));)o--;let a=t+1,h=NaN;for(;a<n&&(h=s.elt(a).zOrder,!!isNaN(h));)a++;if(!isNaN(r)&&r>i)for(;;){if(o===-1||r<=i)return o++,o===t?t:(s.removeAt(t),s.insertAt(o,e),o);for(r=NaN;--o>=0&&(r=s.elt(o).zOrder,!!isNaN(r)););}else if(!isNaN(h)&&h<i)for(;;){if(a===n||h>=i)return a--,a===t?t:(s.removeAt(t),s.insertAt(a,e),a);for(h=NaN;++a<n&&(h=s.elt(a).zOrder,!!isNaN(h)););}return t}WF(t,e){if(e===null||!isNaN(e.zOrder))return;this.JF(t,e);let i=e.containingGroup;i!==null&&this.kx(-1,i)}JF(t,e){if(e.memberParts.count===0)return;let i=-1,s=this.Ct.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];if(r===e&&(t=o,i>=0)||i<0&&r.containingGroup===e&&(i=o,t>=0))break}if(!(i<0)&&i<t){let o=this.Ct;o.removeAt(t),o.insertAt(i,e)}}get parts(){return this.Ct.iterator}get partsBackwards(){return this.Ct.iteratorBackwards}get diagram(){return this.N}get name(){return this.Pt}set name(t){f.s(t,"string",Vt,"name");let e=this.Pt;if(e!==t){let i=this.diagram;if(i!==null){e===""&&f.o("Cannot rename default Layer to: "+t);let n=i.layers;for(;n.next();)n.value.name===t&&f.o("Layer.name is already present in this diagram: "+t)}this.Pt=t,this.t("name",e,t);let s=this.Ct.iterator;for(;s.next();){let n=s.value;n.layerName=this.Pt}}}get opacity(){return this.$t}set opacity(t){let e=this.$t;if(e!==t){f.s(t,"number",Vt,"opacity"),(t<0||t>1)&&f.W(t,"0 <= value <= 1",Vt,"opacity"),this.$t=t;let i=this.diagram;i!==null&&i.S(),this.t("opacity",e,t)}}get isViewportAligned(){return this.Am}set isViewportAligned(t){let e=this.Am;e!==t&&(this.Am=t,this.diagram&&(this.NL(),this.diagram.S()),this.t("isViewportAligned",e,t),t&&(this.isInDocumentBounds=!1))}NL(){if(!this.Am)return;let t=this.diagram,e=this.Ct.r,i=e.length,s=t.xt,n=t.bt;for(let o=0;o<i;o++){let r=e[o],a=r.naturalBounds.width,h=r.naturalBounds.height,l=r.alignment;(l.isDefault()||!l.isSpot())&&(l=D.BottomRight);let c=r.alignmentFocus;c.isDefault()&&(c=new D(l.x,l.y));let u=l.x*s+l.offsetX-(c.x*a+c.offsetX),d=l.y*n+l.offsetY-(c.y*h+c.offsetY),g=P.V(u,d);t.$F(g),r.bc(g.x,g.y,!0),P.e(g),r.tt=1/t.scale}}get isTemporary(){return this.kr}set isTemporary(t){let e=this.kr;e!==t&&(f.s(t,"boolean",Vt,"isTemporary"),this.kr=t,this.t("isTemporary",e,t))}get visible(){return this.kc}set visible(t){let e=this.kc;if(e!==t){f.s(t,"boolean",Vt,"visible"),this.kc=t;let i=this.Ct.iterator;for(;i.next();)i.value.Ei(t);let s=this.diagram;s!==null&&s.S(),this.t("visible",e,t)}}get pickable(){return this.Kl}set pickable(t){let e=this.Kl;e!==t&&(f.s(t,"boolean",Vt,"pickable"),this.Kl=t,this.t("pickable",e,t))}get isInDocumentBounds(){return this.bx}set isInDocumentBounds(t){let e=this.bx;e!==t&&(this.bx=t,this.diagram!==null&&this.diagram.invalidateDocumentBounds(),this.t("isInDocumentBounds",e,t))}get allowCopy(){return this.Rl}set allowCopy(t){let e=this.Rl;e!==t&&(f.s(t,"boolean",Vt,"allowCopy"),this.Rl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.vl}set allowDelete(t){let e=this.vl;e!==t&&(f.s(t,"boolean",Vt,"allowDelete"),this.vl=t,this.t("allowDelete",e,t))}get allowTextEdit(){return this.Ol}set allowTextEdit(t){let e=this.Ol;e!==t&&(f.s(t,"boolean",Vt,"allowTextEdit"),this.Ol=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.Il}set allowGroup(t){let e=this.Il;e!==t&&(f.s(t,"boolean",Vt,"allowGroup"),this.Il=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.El}set allowUngroup(t){let e=this.El;e!==t&&(f.s(t,"boolean",Vt,"allowUngroup"),this.El=t,this.t("allowUngroup",e,t))}get allowLink(){return this.Ul}set allowLink(t){let e=this.Ul;e!==t&&(f.s(t,"boolean",Vt,"allowLink"),this.Ul=t,this.t("allowLink",e,t))}get allowRelink(){return this.Bl}set allowRelink(t){let e=this.Bl;e!==t&&(f.s(t,"boolean",Vt,"allowRelink"),this.Bl=t,this.t("allowRelink",e,t))}get allowMove(){return this.Vl}set allowMove(t){let e=this.Vl;e!==t&&(f.s(t,"boolean",Vt,"allowMove"),this.Vl=t,this.t("allowMove",e,t))}get allowReshape(){return this.zl}set allowReshape(t){let e=this.zl;e!==t&&(f.s(t,"boolean",Vt,"allowReshape"),this.zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Xl}set allowResize(t){let e=this.Xl;e!==t&&(f.s(t,"boolean",Vt,"allowResize"),this.Xl=t,this.t("allowResize",e,t))}get allowRotate(){return this.Gl}set allowRotate(t){let e=this.Gl;e!==t&&(f.s(t,"boolean",Vt,"allowRotate"),this.Gl=t,this.t("allowRotate",e,t))}get allowSelect(){return this.Yl}set allowSelect(t){let e=this.Yl;e!==t&&(f.s(t,"boolean",Vt,"allowSelect"),this.Yl=t,this.t("allowSelect",e,t))}}var xs=(x=>(x[x.None=1]="None",x[x.Uniform=2]="Uniform",x[x.UniformToFill=3]="UniformToFill",x))(xs||{}),Nn=(x=>(x[x.All=1]="All",x[x.NotDirected=2]="NotDirected",x[x.NotDirectedFast=3]="NotDirectedFast",x[x.NotUndirected=4]="NotUndirected",x[x.DestinationTree=5]="DestinationTree",x[x.SourceTree=6]="SourceTree",x))(Nn||{}),Cn=(x=>(x[x.Document=1]="Document",x[x.Infinite=2]="Infinite",x))(Cn||{}),An=(x=>(x[x.TreeParent=1]="TreeParent",x[x.AllParents=2]="AllParents",x[x.AnyParents=3]="AnyParents",x))(An||{});class q{ds;Wt;$S;Px;Pr;Tu;Sx;Mx;Nx;Cx;Lx;Ax;$h;qh;Tx;Dx;Fx;jl;Fc;Sr;Om;Rx;vx;Du;Gn;Mr;Zh;Co;Im;Rc;Em;vc;Fu;Nr;Yn;ZS;QS;Ox;Ix;_S;Ex;tM;iM;eM;Ux;Um;Cr;Lr;Ar;Tr;Dr;Fr;Bx;Rr;Vx;vr;Or;Ir;Er;zx;sM;Lo;nM;Xx;Gx;oM;ki;rM;lM;hM;Os;Ao;Oi;Yx;Rl;vl;Kx;jx;Ol;Il;El;Hx;Ul;Bl;Vl;zl;Xl;Gl;Yl;qx;Wx;aM;Ru;vu;Jx;$x;Zx;Qx;Bm;_x;tb;ib;Zt;cM;eb;fM;Ou;ln;Kn;ie;jn;CL;Hl;uM;dM;Vm;sb;Iu;zm;nb;Ur;ql;Qh;gM;mM;Xm;ob;rb;Ze;Eu;Gm;Uu;Wl;Oc;Ym;Br;_h;pM;Km;Ht;T;Ue;xr;Bi;ys;yM;Jl;Vr;bl;zr;ta;Ic;wM;Bu;ia;Vu;Xt;$l;at;tt;zu;xt;bt;ft;Ec;Uw;lb;ea;Uc;hb;ab;cb;ZF;QF;Vi;Pl;Fm;jm;xM;bM;LL;Hm;_F;tR;iR;fb;eR;sR;nR;sa;AL;Zl;na;oa;ra;la;mu;jh;Qt;St;Bc;eP;sP;gc;$t;static ub=null;static TL=new pt;static kM;static PM=null;gu;db;gb;pb;yb;wb;qm;SM;Wm;Jm;$m;ex;MM;NM;Vc;constructor(t,e){if(q.gw||(q.Yk(),q.gw=!0),I.Ki(this),q.DL(this),this.Ht=!0,this.St=null,this.xt=0,this.bt=0,this.ft=null,q.isUsingDOM()){let s=this,n=()=>{s.Pi(A.document,"DOMContentLoaded",n,!1),s.setRTL()};A.document.body!==null?this.setRTL():s.Ut(A.document,"DOMContentLoaded",n,!1)}this.Ec=null,q.CM("Model",Se);let i=this;return this.rM=s=>i.partManager.doModelDataChanged(s),this.lM=s=>i.partManager.doModelChanged(s),this.hb=null,this.ab=null,this.FL(),this.model=yt.LM(),this.themeManager=new ai,this.Lo=!0,this.RL(),this.layout=new ne,this.Lo=!1,this._F=null,this.tR=null,this.iR=null,this.fb=null,this.eR=null,this.sR=null,this.nR=null,this.sa=null,this.AL=null,this.Zl=null,this.na=null,this.oa=null,this.ra=null,this.la=null,this.mu=()=>{},this.jh=null,this.Uu=!1,this.Bc=new _o(this),t!==void 0&&(typeof t=="string"||A.Element&&t instanceof Element?this.AM(t):e=t),e&&this.setProperties(e),this.Ht=!1,this.requestUpdate(),this}mF(){return this.ft!==null}get renderer(){return this.Oc}set renderer(t){if(this instanceof _i)return;t===""&&(t="default");let e=t.toLowerCase(),i=this.Oc;if(e===i)return;this.Oc=e;let s=null;e==="default"||e==="canvas"?(s=this.Wl.get("svg"),s!==null&&s.Tt.remove(),this.ft&&(this.Qt=this.ft.li),this.Qt.clearContextCache(!0)):e==="svg"?(this.Wl.has("svg")?s=this.Wl.get("svg"):(s=new Ri(this,A.document),this.addRenderer("svg",s)),this.div!==null&&this.div.appendChild(s.Tt),this.Qt=s.li,this.ft&&(this.ft.li.setTransform(this.Vi,0,0,this.Vi,0,0),this.ft.li.clearRect(0,0,this.xt,this.bt))):e==="debug"&&(this.Wl.has("SVG")||(s=new Ri(this,A.document),this.addRenderer("SVG",s),s.Tt.style.backgroundColor="whitesmoke",this.div!==null&&this.div.after(s.Tt))),this.Ht||this.redraw()}FL(){this.Vc=new G,this.setupRouters(),this.ds=new pe,this.ds.Mo(this),this.Wt=17,this.$S=!1,this.zu=!1,this.Px="default",this.Xt=new G,this.Wl=new pt,this.Oc="default",this.resetRenderingHints(),this.oR(),this.$t=1,this.at=new P(NaN,NaN).u(),this.ex=new P(NaN,NaN),this.tt=1,this.Km=1,this.Sx=new P(NaN,NaN).u(),this.Mx=NaN,this.Nx=1e-4,this.Cx=100,this.T=new Pt,this.Lx=new P(NaN,NaN).u(),this.Ax=new z(NaN,NaN,NaN,NaN).u(),this.$h=new Lt(0,0,0,0).u(),this.qh=1,this.Tx=!1,this.Dx=null,this.Fx=null,this.jl=1,this.Fc=D.Default,this.Sr=1,this.Om=D.Default,this.Rx=D.None,this.vx=D.None,this.Ue=!0,this.Du=!1,this.Gn=new Set,this.Mr=new I,this.Zh=new I,this.Co=!1,this.$l=new pt,this.Bu=!0,this.Im=250,this.Rc=-1,this.Em=new Lt(16,16,16,16).u(),this.xr=!1,this.vc=!1,this.Fu=!0,this.Ym=new Ye,this.Ym.diagram=this,this.Br=new Ye,this.Br.diagram=this,this._h=new Ye,this._h.diagram=this,this.Nr=null,this.Yn=null,this.Uw=!1,this.rR(),this.zr=new I,this.Ox=!0,this.Ix=1,this._S=!1,this.Ex=1,this.Ux="auto",this.Um="auto",this.Cr=null,this.Lr=null,this.Ar=null,this.Tr=null,this.Dr=null,this.Fr=null,this.Bx=null,this.Rr=null,this.Vx=!1,this.vr=null,this.Or=null,this.Ir=null,this.Er=null,this.zx=!1,this.lb={},this.ea=[null,null],this.Lo=!1,this.nM=!1,this.Xx=!1,this.Gx=!1,this.oM=!0,this.ys=!1,this.ia=!1,this.hM=!0,this.Os=-2,this.Jl=new pt,this.Vu=new G,this.Ao=!1,this.Oi=!0,this.Yx=!0,this.Rl=!0,this.vl=!0,this.Kx=!1,this.jx=!0,this.Ol=!0,this.Il=!0,this.El=!0,this.Hx=!0,this.Ul=!0,this.Bl=!0,this.Vl=!0,this.zl=!0,this.Xl=!0,this.Gl=!0,this.Yl=!0,this.qx=!0,this.Wx=!0,this.aM=!1,this.Uc=!1,this.Ru=!0,this.vu=!0,this.Jx=!0,this.$x=!0,this.Zx=16,this.Qx=16,this.Bm=!1,this._x=!1,this.tb=0,this.ib=0,this.Zt=new Lt(5).u(),this.cM=new I().u(),this.eb=999999999,this.fM=new I().u(),this.ta=!0,this.Ou=!0,this.Ic=!0,this.ln=!1,this.Kn=!1,this.Vr=!0,this.bl=!1,this.jn=!1,this.CL=new I,this.wM=new I,this.Hl=null,this.uM=new Q(8,8),this.dM=999,this.Vm=!1,this.eP=1,this.sP=0,this.Bi={scale:1,position:new P,bounds:new z,canvasSize:new Q,newCanvasSize:new Q,isScroll:!1},this.Bi.canvasSize=this.Bi.canvasSize,this.Bi.newCanvasSize=this.Bi.newCanvasSize,this.Bi.isScroll=!1,this.sb=new z(NaN,NaN,NaN,NaN).u(),this.Iu=new Q(NaN,NaN).u(),this.zm=new z(NaN,NaN,NaN,NaN).u(),this.nb=!1,this.lR(),this.Ze=null,this.Eu=!1,this.gc=null,this.partManager=new Se,this.toolManager=new xe,this.toolManager.initializeStandardTools(),this.defaultTool=this.toolManager,this.currentTool=this.defaultTool,this.gb=null,this.pb=new Qi,this.yb=null,this.wb=null,this.db=!1,this.gu=!1,this.commandHandler=new be,this.Jm=null,this.$m=P.Ik,this.MM=!1,this.Vi=1,this.Pl=null,this.Fm=1,this.qm=0,this.SM=[0,0,0,0,0],this.Wm=0,this.jm=1,this.xM=0,this.bM=new P,this.LL=500,this.Gm=new P,this.Hm=!1}static vL=A.document!==void 0;static isUsingDOM(){return q.vL}static useDOM(t){q.vL=t?A.document!==void 0:!1}static Qe=new WeakMap;clear(){this.animationManager.stopAnimation(),this.model.clear(),q.OL(),this.IL(!1),this.Vu.clear(),this.EL(),this.Hl=null,this.invalidateDocumentBounds(),this.ensureBounds(),this.S()}IL(t){this.animationManager.stopAnimation(!0),this.cM=new I().u(),this.fM=new I().u();let e=this.skipsUndoManager,i=this.ki!==null&&this.ki!==void 0;i&&(this.skipsUndoManager=!0);let s=null;this.Ze!==null&&(s=this.Ze.part,s!==null&&this.remove(s));let n=[],o=this.Xt.length;if(t){for(let r=0;r<o;r++){let a=this.Xt.r[r].parts;for(;a.next();){let h=a.value;h!==s&&h.data===null&&n.push(h)}}for(let r=0;r<n.length;r++){let a=n[r];this.remove(a)}}for(let r=0;r<o;r++)this.Xt.r[r].GF();return this.partManager.clear(),this.Gn.clear(),this.Mr.clear(),this.Zh.clear(),this.$l.clear(),this.zr.clear(),this.gc=null,this.Vu.clear(),this.EL(),f.vk=[],s!==null&&(this.add(s),this.partManager.parts.delete(s)),i&&(this.skipsUndoManager=e),n}static Zm=null;static xb="";static OL(){q.Zm=null,q.xb=""}static AE(){return null}reset(){this.clear(),this.Ht=!0,this.FL(),this.themeManager=new ai,this.Ql(),this.Lo=!0,this.RL(),this.layout=new ne,this.Lo=!1,this.model=yt.LM(),this.model.undoManager=new $i,this.Uu=!1,this.Ht=!1,this.S()}lR(){this.Ur=new pt,this.gM=new rt().add(new xt({stroke:"black",font:"10pt sans-serif"}).bind("text","",f.toString).theme("stroke","text").theme("font","normal")),this.Ur.set("",this.gM),this.Ur.set("Comment",new rt().add(new xt({stroke:"brown",font:"10pt sans-serif"}).bind("text","",f.toString).theme("stroke","comment").theme("font","normal"))),this.Ur.set("LinkLabel",new rt({selectable:!1,avoidable:!1}).add(new ct("Ellipse",{fill:"black",stroke:null,desiredSize:new Q(3,3).$()}).theme("fill","link"))),this.Qh=new pt,this.yM=new ft(H.Vertical,{selectionObjectName:"GROUPPANEL"}).add(new xt({stroke:"black",font:"bold 12pt sans-serif"}).bind("text","",f.toString).theme("stroke","text").theme("font","bold"),new H(H.Auto,{name:"GROUPPPANEL"}).add(new ct({fill:"rgba(128,128,128,0.2)",stroke:"black",strokeWidth:1}).theme("fill","group").theme("stroke","outline").theme("strokeWidth","group"),new ve({padding:5}).theme("padding","group"))),this.Qh.set("",this.yM),this.ql=new pt,this.mM=new _().add(new ct({isPanelMain:!0,stroke:"black"}).theme("stroke","link"),new ct({toArrow:"Standard",fill:"black",stroke:null,strokeWidth:0}).theme("toArrow").theme("fill","link")),this.ql.set("",this.mM),this.ql.set("Comment",new _().add(new ct({isPanelMain:!0,stroke:"brown"}).theme("stroke","comment"))),this.Xm=new St(H.Auto).add(new ct({fill:null,stroke:"dodgerblue",strokeWidth:3}).theme("stroke","selection").theme("strokeWidth","selection"),new ve({margin:1.5}).theme("margin","selection","numbers",null,t=>t?new Lt(t/2):1.5)),this.ob=this.Xm,this.rb=new St(H.Link).add(new ct({isPanelMain:!0,fill:null,stroke:"dodgerblue",strokeWidth:3}).theme("stroke","selection").theme("strokeWidth","selection"))}setRTL(t){let e=t===void 0?this.div:t;e===null&&(e=A.document.body);let i=f.hs("div");i.dir="rtl",i.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;",i.textContent="A",e.appendChild(i);let s="reverse";i.scrollLeft>0?s="default":(i.scrollLeft=1,i.scrollLeft===0&&(s="negative")),e.removeChild(i),this.Px=s}setScrollWidth(t){let e=t===void 0?this.div:t;e===null&&(e=A.document.body);let i=0;if(q.isUsingDOM()){let s=q.PM,n=q.kM;s===null&&(q.PM=f.hs("p"),s=q.PM,s.style.width="100%",s.style.height="200px",s.style.boxSizing="content-box",q.kM=f.hs("div"),n=q.kM,n.style.position="absolute",n.style.visibility="hidden",n.style.width="200px",n.style.height="150px",n.style.boxSizing="content-box",n.appendChild(s)),n.style.overflow="hidden",e.appendChild(n);let o=s.offsetWidth;n.style.overflow="scroll";let r=s.offsetWidth;o===r&&(r=n.clientWidth),e.removeChild(n),i=o-r,i===0&&!f.tr&&(i=11)}this.Wt=i,this.$S=!0}oi(t){t in xs?this.autoScale=t:f.er(this,t)}toString(t){t===void 0&&(t=0);let e="";this.div&&this.div.id&&(e=this.div.id);let i='Diagram "'+e+'"';if(t<=0)return i;let s=this.Xt.iterator;for(;s.next();){let n=s.value;i+=`
9
+ `+n.toString(t-1)}return i}static DL(t){q.ub=t}static um(){return q.ub}static fromDiv(t){let e=t;if(typeof t=="string"&&(e=A.document.getElementById(t)),e instanceof HTMLDivElement){let i=q.Qe.get(e);if(i)return i}return null}get div(){return this.St}set div(t){if(this.St!==t){let e=this.St;if(e!==null){if(q.Qe.delete(e),e.goDiagram=void 0,e.go=void 0,e.innerHTML="",this.ft!==null){let s=this.ft.Tt;this.Pi(s,"pointermove",this.na,!1),this.Pi(s,"pointerdown",this.Zl,!1),this.Pi(s,"pointerup",this.oa,!1),this.Pi(s,"pointerout",this.ra,!1),this.Pi(s,"pointercancel",this.la,!1),this.ft.dispose()}this.Ec&&(this.Ec.disconnect(),this.Ec=null);let i=this.toolManager;i!==null&&(i.mouseDownTools.each(s=>s.cancelWaitAfter()),i.mouseMoveTools.each(s=>s.cancelWaitAfter()),i.mouseUpTools.each(s=>s.cancelWaitAfter())),i.cancelWaitAfter(),this.currentTool.doCancel(),this.ft=null,this.Pi(A,"resize",this.fb,!1),this.Pi(A,"wheel",this.sa,!0),q.um()===this&&q.DL(null)}else this.Zl===null&&(this.jn=!1);if(this.St=null,t!==null){let i=q.Qe.get(t);i&&(i.div=null),this.AM(t),this.mu(),this.themeManager&&this.themeManager.hR()}else this.themeManager&&this.themeManager.aR()}}setupRouters(){this.Vc.push(new br)}AM(t){let e=this;if(!q.isUsingDOM())return;t==null&&f.o("Diagram setup requires an argument DIV."),e.St!==null&&f.o("Diagram has already completed setup."),typeof t=="string"?e.St=A.document.getElementById(t):t instanceof HTMLDivElement?e.St=t:f.o("No DIV or DIV id supplied: "+t),e.St===null&&f.o("Invalid DIV id; could not get element with id: "+t);let i=q.Qe.get(e.St);if(i&&i!==this&&f.o("Invalid div id; div already has a Diagram associated with it."),!e.Ec&&A.ResizeObserver){let c=A.ResizeObserver,u=f.Rk(()=>e.requestUpdate(),250,!1);e.Ec=new c(()=>u()),e.Ec.observe(e.St)}A.getComputedStyle(e.St,null).position==="static"&&(e.St.style.position="relative");let s=5,n="rgba(2"+s+"5, 255, 255, 0)";s--,e.St.style["-webkit-tap-highlight-color"]=n,e.St.innerHTML="",q.Qe.set(e.St,e),e.St.goDiagram=e,e.St.go=A.go;let o=new Ue(e);o.style!==void 0&&(o.style.position="absolute",o.style.top="0px",o.style.left="0px",A.getComputedStyle(e.St,null).getPropertyValue("direction")==="rtl"&&(e.zu=!0),o.style.zIndex="2",o.style.userSelect="none",o.style.MozUserSelect="none",o.style.touchAction="none",o.style.letterSpacing="normal !important",o.style.wordSpacing="normal !important",o.style.lang="unknown"),e.ft=o,e.Qt=o.li;let r=e.Qt;e.Vi=e.computePixelRatio(),e.viewSize.isReal()||(e.xt=e.St.clientWidth||1,e.bt=e.St.clientHeight||1),e.UL(e.xt,e.bt);let a=e;e.St.insertBefore(o.Tt,e.St.firstChild);let h=new Ue(null);if(h.width=1,h.height=1,e.ZF=h,e.QF=h.li,q.isUsingDOM()){let c=f.hs("div"),u=f.hs("div");c.style.position="absolute",c.style.overflow="auto",c.style.width=e.xt+"px",c.style.height=e.bt+"px",c.style.zIndex="1",u.style.position="absolute",u.style.width="1px",u.style.height="1px",e.St.appendChild(c),c.appendChild(u),c.onscroll=q.cR,c.addEventListener("pointerdown",q.fR),c.N=e,c.uR=!0,c.dR=!0,e.hb=c,e.ab=u}e.mu=f.Rk(()=>{e.Pl=null,e.S()},300,!1),e.fb=f.Rk(()=>{e.IS()},250,!1),e.jh=c=>(c.preventDefault(),!1),e.sa=c=>{if(!a.isEnabled)return;let u=a.zc(c,!0);u.bubbles=!0;let d=0,g=0;u.delta=0,c.deltaX!==void 0?(c.deltaX!==0&&(d=c.deltaX>0?1:-1),c.deltaY!==0&&(g=c.deltaY>0?1:-1),u.delta=Math.abs(c.deltaX)>Math.abs(c.deltaY)?-d:-g):c.wheelDeltaX!==void 0?(c.wheelDeltaX!==0&&(d=c.wheelDeltaX>0?-1:1),c.wheelDeltaY!==0&&(g=c.wheelDeltaY>0?-1:1),u.delta=Math.abs(c.wheelDeltaX)>Math.abs(c.wheelDeltaY)?-d:-g):c.wheelDelta!==void 0&&c.wheelDelta!==0&&(u.delta=c.wheelDelta>0?1:-1),a.doMouseWheel(),a.ha(u,c)},e.AL=c=>{if(!a.isEnabled)return;e.Uc=!1,a.zc(c,!0);let u=a.currentTool;u.cancelWaitAfter(),u.standardMouseOver()},e.Zl=c=>{if(!a.isEnabled)return;e.Uc=!0;let u=a.lb;u[c.pointerId]===void 0&&(u[c.pointerId]=c);let d=a.ea,g=!1;if(d[0]!==null&&(d[0].pointerId===c.pointerId||d[0].pointerType!==c.pointerType))d[0]=c;else if(d[1]!==null&&d[1].pointerId===c.pointerId)d[1]=c,g=!0;else if(d[0]===null)d[0]=c;else if(d[1]===null)d[1]=c,g=!0;else{c.preventDefault();return}let p=c.pointerType==="touch"||c.pointerType==="pen";p&&(a.Uw=!1,a.Hm=!0);let m=a.gR(c,c,g),y=a.bM,w=p?25:10;if(c.timeStamp-a.xM<a.LL&&!(Math.abs(y.x-c.screenX)>w||Math.abs(y.y-c.screenY)>w)?a.jm++:a.jm=1,m.clickCount=a.jm,a.xM=c.timeStamp,a.bM.setTo(c.screenX,c.screenY),a.doMouseDown(),c.button===1){c.preventDefault();return}a.ha(m,c)},e.na=c=>{if(!a.isEnabled)return;e.Uc=!0;let u=a.ea;if(u[0]!==null&&(u[0].pointerId===c.pointerId||u[0].pointerType!==c.pointerType))u[0]=c;else if(u[1]!==null&&u[1].pointerId===c.pointerId){u[1]=c;return}else if(u[0]===null)u[0]=c;else return;if(u[0].pointerId!==c.pointerId)return;let d=a.mR(c,c,u[1]!==null);a.doMouseMove(),a.ha(d,c)},e.oa=c=>{if(!a.isEnabled)return;e.Uc=!0;let u=c.pointerType==="touch"||c.pointerType==="pen",d=a.lb;if(u&&a.Uw){delete d[c.pointerId],c.preventDefault();return}let g=a.ea;if(g[0]!==null&&(g[0].pointerId===c.pointerId||g[0].pointerType!==c.pointerType))g[0]=null;else if(g[1]!==null&&g[1].pointerId===c.pointerId){g[1]=null;return}else return;let p=a.TM(c,!1,!0,!1,!0,!1),m=A.document.elementFromPoint(c.clientX,c.clientY)||null;m!==null&&m.shadowRoot!==void 0&&m.shadowRoot!==null&&(m=m.shadowRoot.elementFromPoint(c.clientX,c.clientY)),m!==null&&m.N instanceof q&&m.N!==a&&m.N.Qm(c,p),m===null&&(m=c.target),a.Qm(c,p),p.clickCount=a.jm,p.targetDiagram=a.bb(c,m),p.targetObject=null,a.doMouseUp(),a.ha(p,c),u&&(a.Hm=!1)},e.ra=c=>{if(!a.isEnabled)return;e.Uc=!1;let u=a.lb;u[c.pointerId]&&delete u[c.pointerId];let d=a.ea;if(d[0]!==null&&d[0].pointerId===c.pointerId&&(d[0]=null),d[1]!==null&&d[1].pointerId===c.pointerId&&(d[1]=null),c.pointerType==="touch"||c.pointerType==="pen")return;let g=a.currentTool;g.cancelWaitAfter(),g.standardMouseOver()},e.la=c=>{let u=a.ea;u[0]!==null&&u[0].pointerId===c.pointerId?(u[0]=null,a.Hm=!1):u[1]!==null&&u[1].pointerId===c.pointerId&&(u[1]=null)};let l=r;if(e.cb=l.E[f.Ts("7eba17a4ca3b1a8346")][f.Ts("78a118b7")](l.E,q.Xu,s,s),r.clearContextCache(!0),e.pR(),this.Oc==="svg"){let c=this.Wl.get("svg");this.St&&this.St.appendChild(c.Tt),this.Qt=c.li}}addEventListener(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}Ut(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}removeEventListener(t,e,i,s){t.removeEventListener(e,i,{capture:s})}Pi(t,e,i,s){t.removeEventListener(e,i,{capture:s})}pR(){let t=this,e=this.ft.Tt;e instanceof HTMLCanvasElement||(e=t.div),this.Ut(e,"pointerdown",t.Zl,!1),this.Ut(e,"pointermove",t.na,!1),this.Ut(e,"pointerup",t.oa,!1),this.Ut(e,"pointerout",t.ra,!1),this.Ut(e,"pointercancel",t.la,!1),this.Ut(e,"pointerenter",t.yR,!1),this.Ut(e,"pointerleave",t.wR,!1),this.Ut(e,"wheel",t.sa,!1),this.Ut(e,"keydown",t.xR,!1),this.Ut(e,"keyup",t.bR,!1),this.Ut(e,"blur",t.kR,!1),this.Ut(e,"focus",t.PR,!1),this.Ut(e,"selectstart",i=>(i.preventDefault(),!1),!1),this.Ut(e,"contextmenu",i=>(i.preventDefault(),!1),!1),this.Ut(A,"resize",t.fb,!1)}Bw(){this.qm>30&&(this.Pl=1)}CP(t){this.Pl!==null&&(this.Pl=null,t&&this.mu(),this.qm=0,this.SM=[0,0,0,0,0],this.Wm=0)}computePixelRatio(){return this.Pl!==null?this.Pl:A.devicePixelRatio||1}get avgSpf(){return this.qm}doMouseDown(){this.currentTool.doMouseDown()}doMouseMove(){this.currentTool.doMouseMove()}doMouseUp(){this.currentTool.doMouseUp()}doMouseWheel(){this.currentTool.doMouseWheel()}doKeyDown(){this.currentTool.doKeyDown()}doKeyUp(){this.currentTool.doKeyUp()}doFocus(){this.focus()}focus(){if(this.ft)if(this.scrollsPageOnFocus)this.ft.focus();else{let t=A.scrollX,e=A.scrollY;this.ft.focus(),A.scrollTo(t,e)}}PR(t){let e=q.Qe.get(this);e&&e.D("GainedFocus")}kR(t){let e=q.Qe.get(this);e&&e.D("LostFocus")}IS(){if(this.ft===null)return;let t=this.St;if(t===null||t.clientWidth===0||t.clientHeight===0)return;this.$S||this.setScrollWidth();let e=this.Kn?this.Wt:0,i=this.ln?this.Wt:0,s=this.Vi;if(this.Vi=this.computePixelRatio(),this.Vi!==s&&(this.Du=!0,this.requestUpdate()),t.clientWidth!==this.xt+e||t.clientHeight!==this.bt+i){this.aa(),this.Ue=!0;let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(this.vc=!0,n.invalidateLayout()),this.ys||this.requestUpdate()}}RL(){let t=0,e=new Vt;e.name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="ViewportBackground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Background",this.Xr(e,t++),e=new Vt,e.name="",this.Xr(e,t++),e=new Vt,e.name="Foreground",this.Xr(e,t++),e=new Vt,e.name="ViewportForeground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,this.Xr(e,t++)}BL(){let t=new H(H.Grid,{name:"GRID"}).add(new ct("LineH",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new ct("LineV",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new ct("LineH",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new ct("LineV",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new ct("LineH",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor"),new ct("LineV",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor")),e=new Nt({layerName:"Grid",zOrder:0,isInDocumentBounds:!1,isAnimated:!1,pickable:!1,locationObjectName:"GRID"}).add(t);return this.add(e),this.partManager.parts.delete(e),t.visible=!1,t}static cR(){let t=q.Qe.get(this.parentElement||this);if(t){if(t._x){t._x=!1;return}if(!t.isEnabled){t.VL();return}t.diagramScroll(this)}}static fR(t){if(!this.N.isEnabled){this.N.updateScroll();return}this.N.tb=t.target.scrollTop,this.N.ib=t.target.scrollLeft}diagramScroll(t){if(this.ft===null)return;let e=this.hb,i=this.ab;this.Bm=!0;let s=this.documentBounds,n=this.viewportBounds,o=this.$h,r=s.x-o.left,a=s.y-o.top,h=s.width+o.left+o.right,l=s.height+o.top+o.bottom,c=s.right+o.right,u=s.bottom+o.bottom,d=n.x,g=n.y,p=n.width,m=n.height,y=n.right,w=n.bottom,b=this.scale,v,k=t.scrollLeft;if(this.zu)switch(this.Px){case"negative":k=k+t.scrollWidth-t.clientWidth;break;case"reverse":k=t.scrollWidth-k-t.clientWidth;break}let S=k;if(p<h||m<l){v=P.V(this.position.x,this.position.y),this.allowHorizontalScroll&&this.ib!==S&&(v.x=S/b+r,this.ib=S),this.allowVerticalScroll&&this.tb!==t.scrollTop&&(v.y=t.scrollTop/b+a,this.tb=t.scrollTop),this.position=v,P.e(v),this.Bm=!1,this.Ou=!1;return}if(v=P.l(),t.uR&&this.allowHorizontalScroll&&(r<d&&(this.position=v.i(S+r,this.position.y)),c>y)){let M=e.scrollWidth-this.xt;this.position=v.i(-M+S-this.xt/b+c,this.position.y)}if(t.dR&&this.allowVerticalScroll&&(a<g&&(this.position=v.i(this.position.x,t.scrollTop+a)),u>w)){let M=e.scrollHeight-this.bt;this.position=v.i(this.position.x,-M+t.scrollTop-this.bt/b+u)}P.e(v),this._l(),this.Bm=!1,this.Ou=!1,s=this.documentBounds,n=this.viewportBounds,c=s.right,y=n.right,u=s.bottom,w=n.bottom,r=s.x,d=n.x,a=s.y,g=n.y,p>=h&&r>=d&&c<=y&&(i.style.width="1px"),m>=l&&a>=g&&u<=w&&(i.style.height="1px")}computeBounds(t){return t===void 0&&(t=new z),this.Mi(),this.zL(t)}zL(t){if(this.fixedBounds.isReal())return t.a(this.fixedBounds),t.addMargin(this.Zt),t;let e=!0,i=this.Xt.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if(!o.visible||!o.isInDocumentBounds)continue;let r=o.Ct.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!l.isInDocumentBounds||!l.isVisible())continue;let c=l.actualBounds;c.isReal()&&(e?(e=!1,t.a(c)):t.unionRect(c))}}return e&&t.i(0,0,0,0),t.addMargin(this.Zt),t}computePartsBounds(t,e){e===void 0&&(e=!1);let i=null;if(Array.isArray(t))for(let s=0;s<t.length;s++){let n=t[s];!e&&n instanceof _||(n.ensureBounds(),i===null?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}else{let s=t.iterator;for(;s.next();){let n=s.value;!e&&n instanceof _||(n.ensureBounds(),i===null?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}}return i===null?new z(NaN,NaN,0,0):i}Bs(t){if(!t&&!this.jn||this.Ht||this.ft===null||!this.documentBounds.isReal())return;if(this.Ht=!0,t){let u=this.initialPosition;if(u.isReal()){this.Ht=!1,this.position=u;return}let d=this.initialDocumentSpot,g=this.initialViewportSpot;d.isNoSpot()&&(d=D.TopLeft),g.isNoSpot()&&(g=D.TopLeft);let p=P.l();p.setRectSpot(this.documentBounds,d);let m=this.viewportBounds,y=z.V(0,0,m.width,m.height),w=P.l();w.setRectSpot(y,g),w.i(p.x-w.x,p.y-w.y),this.Ht=!1,this.position=w,z.e(y),P.e(w)}let e=this.jl;t&&this.Sr!==1&&(e=this.Sr);let i=e!==1?this.Gu(e):this.scale,s=this.at.x,n=this.at.y,o=this.xt/i,r=this.bt/i,a=this.Fc,h=this.Om;if(t&&!a.isSpot()&&(h.isSpot()||h.isDefault())){let u=this.initialDocumentSpot.isSpot()&&this.initialViewportSpot.isSpot();a=h.isDefault()&&!u?D.Center:h}this.DM(this.documentBounds,o,r,a,t);let l=this.scale;this.scale=i,this.Ht=!1;let c=this.viewportBounds;c.equalsApproxTo(s,n,o,r)||this.onViewportBoundsChanged(new z(s,n,o,r),c,l,!1)}Gu(t){let e=this.Km;if(this.ft===null)return e;if(t===1)return this.scale;this.ensureBounds();let i=this.documentBounds;if(!i.isReal())return e;let s=i.width,n=i.height,o=this.xt+(this.Kn?this.Wt:0),r=this.bt+(this.ln?this.Wt:0),a=o/s,h=r/n,l=this.$h,c=l.left+l.right!==0,u=l.top+l.bottom!==0;(c||u)&&(h===a?(h=(r-this.Wt)/n,a=(o-this.Wt)/s):h>a?h=(r-this.Wt)/n:a=(o-this.Wt)/s);let d=0;return t===2?d=Math.min(h,a):t===3&&(h>a?d=(r-this.Wt)/n:d=(o-this.Wt)/s),d>e&&(d=e),d<this.minScale&&(d=this.minScale),d>this.maxScale&&(d=this.maxScale),d}zoomToFit(){let t=this.qh;this.qh=1,this.scale=this.Gu(2),this.alignDocument(D.Center,D.Center),t!==1&&(this.Bs(!1),this.DM(this.documentBounds,this.xt/this.tt,this.bt/this.tt,this.Fc,!1)),this.qh=t}zoomToRect(t,e){e===void 0&&(e=2);let i=t.width,s=t.height;if(i===0||s===0||isNaN(i)&&isNaN(s))return;let n=1;if(e===2||e===3)if(isNaN(i))n=this.viewportBounds.height*this.scale/s;else if(isNaN(s))n=this.viewportBounds.width*this.scale/i;else{let o=this.xt,r=this.bt;e===3?r/s>o/i?n=(r-(this.ln?this.Wt:0))/s:n=(o-(this.Kn?this.Wt:0))/i:n=Math.min(r/s,o/i)}this.scale=n,this.position=new P(t.x,t.y)}get SR(){return this.Ht}set SR(t){this.Ht=t}alignDocument(t,e){this.ensureBounds();let i=this.documentBounds,s=this.viewportBounds;this.position=new P(i.x+(t.x*i.width+t.offsetX)-(e.x*s.width-e.offsetX),i.y+(t.y*i.height+t.offsetY)-(e.y*s.height-e.offsetY))}focusObject(t){if(t instanceof dt){this.Jm=t;let e=P.l();this.$m=this.transformDocToView(t.getDocumentPoint(D.TopLeft,e)),P.e(e)}else this.Jm=null,this.$m=P.Ik}DM(t,e,i,s,n){let o=P.V(this.at.x,this.at.y),r=o.x,a=o.y;if(this.Jm!==null){let h=P.l();h=this.Jm.getDocumentPoint(D.TopLeft,h),r=h.x-this.$m.x/this.scale,a=h.y-this.$m.y/this.scale,s=D.None,P.e(h)}if(n||this.scrollMode===1){s.isSpot()&&(e>t.width&&(r=t.x+(s.x*t.width+s.offsetX)-(s.x*e-s.offsetX)),i>t.height&&(a=t.y+(s.y*t.height+s.offsetY)-(s.y*i-s.offsetY)));let h=this.$h,l=e-t.width;if(e<t.width+h.left+h.right){let u=r+e/2;u=Math.min(u,t.right+Math.max(l,h.right)-e/2),u=Math.max(u,t.left-Math.max(l,h.left)+e/2),r=u-e/2}else r>t.left?r=t.left:r<t.right-e&&(r=t.right-e);let c=i-t.height;if(i<t.height+h.top+h.bottom){let u=a+i/2;u=Math.min(u,t.bottom+Math.max(c,h.bottom)-i/2),u=Math.max(u,t.top-Math.max(c,h.top)+i/2),a=u-i/2}else a>t.top?a=t.top:a<t.bottom-i&&(a=t.bottom-i)}if(o.x=isFinite(r)?r:-this.Zt.left,o.y=isFinite(a)?a:-this.Zt.top,this.positionComputation!==null){let h=this.positionComputation(this,o);o.x=h.x,o.y=h.y}this.ds.yL(this.at,o),this.at.i(o.x,o.y),this.kb(),this.Ql(),this.MR(),P.e(o)}findPartAt(t,e){if(e===void 0&&(e=!0),e){let i=this.FP(t,s=>s.part,s=>s.canSelect());if(i instanceof Nt)return i}else{let i=this.FP(t,s=>s.part);if(i instanceof Nt)return i}return null}findObjectAt(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Mi();let s=this.Xt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}FP(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Mi();let s=this.Xt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible||n.isTemporary)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}findPartsAt(t,e,i){return e===void 0&&(e=!0),this.NR(t,s=>s.part,e?s=>s instanceof Nt&&s.canSelect():null,i)}NR(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof G)&&!(s instanceof I)&&(s=new I),this.Mi();let n=this.Xt.iteratorBackwards;for(;n.next();){let o=n.value;!o.visible||o.isTemporary||o.findObjectsAt(t,e,i,s)}return s}findObjectsAt(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof G)&&!(s instanceof I)&&(s=new I),this.Mi();let n=this.Xt.iteratorBackwards;for(;n.next();){let o=n.value;o.visible&&o.findObjectsAt(t,e,i,s)}return s}findPartsIn(t,e,i,s){return e===void 0&&(e=!1),i===void 0&&(i=!0),this.CR(t,null,n=>n instanceof Nt&&(!i||n.canSelect()),e,s)}findObjectsIn(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof G)&&!(n instanceof I)&&(n=new I),this.Mi();let o=this.Xt.iteratorBackwards;for(;o.next();){let r=o.value;r.visible&&r.findObjectsIn(t,e,i,s,n)}return n}OP(t,e,i,s,n,o){let r=new I;this.Mi();let a=this.Xt.iteratorBackwards;for(;a.next();){let h=a.value;h.visible&&h.OP(t,e,i,s,r,n,o)}return r}CR(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof G)&&!(n instanceof I)&&(n=new I),this.Mi();let o=this.Xt.iteratorBackwards;for(;o.next();){let r=o.value;!r.visible||r.isTemporary||r.findObjectsIn(t,e,i,s,n)}return n}findPartsNear(t,e,i,s,n){return i===void 0&&(i=!0),s===void 0&&(s=!0),this.LR(t,e,null,o=>o instanceof Nt&&(!s||o.canSelect()),i,n)}findObjectsNear(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof G||n instanceof I)&&(o=n),n=!0),!(o instanceof G)&&!(o instanceof I)&&(o=new I),this.Mi();let r=this.Xt.iteratorBackwards;for(;r.next();){let a=r.value;a.visible&&a.findObjectsNear(t,e,i,s,n,o)}return o}LR(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof G||n instanceof I)&&(o=n),n=!0),!(o instanceof G)&&!(o instanceof I)&&(o=new I),this.Mi();let r=this.Xt.iteratorBackwards;for(;r.next();){let a=r.value;!a.visible||a.isTemporary||a.findObjectsNear(t,e,i,s,n,o)}return o}acceptEvent(t){return this.zc(t,t instanceof MouseEvent)}zc(t,e){let i=this.Br;this.Br=this._h,this._h=i,i.diagram=this,i.event=t,e?this.Qm(t,i):(i.viewPoint=this.Br.viewPoint,i.documentPoint=this.Br.documentPoint);let s=0,n=t;return n.ctrlKey&&(s+=1),n.altKey&&(s+=2),n.shiftKey&&(s+=4),n.metaKey&&(s+=8),i.modifiers=s,i.button=n.button,n.buttons!==void 0&&(i.buttons=n.buttons),f.tr&&n.button===0&&n.ctrlKey&&(i.button=2),i.down=!1,i.up=!1,i.clickCount=1,i.delta=0,i.handled=!1,i.bubbles=!1,i.timestamp=t.timeStamp,i.isMultiTouch=!1,i.targetDiagram=this.bb(t,t.target),i.targetObject=null,i}bb(t,e){if(e===null)return null;let i=q.Qe.get(e);if(i)return i;let s=t.path;if(!s&&f.it(t.composedPath)&&(s=t.composedPath()),s&&s[0]){let n=q.Qe.get(s[0]);if(n)return n}return null}gR(t,e,i){let s=this.TM(t,!0,!1,!1,!0,i);return this.Qm(e,s),s.targetDiagram=this.bb(t,t.target),s.targetObject=null,i||s.clone(this.Ym),s}mR(t,e,i){let s=this.TM(t,!1,!1,!1,!1,i),n=A.document.elementFromPoint(e.clientX,e.clientY)||null;n!==null&&n.shadowRoot!==void 0&&n.shadowRoot!==null&&(n=n.shadowRoot.elementFromPoint(e.clientX,e.clientY));let o=this,r=t;if(n){let a=this.bb(t,n);a&&(r=e,o=a)}return s.targetDiagram=o,this.Qm(r,s),s.targetObject=null,s}TM(t,e,i,s,n,o){let r=this.Br;this.Br=this._h,this._h=r,r.diagram=this,r.clickCount=1,r.delta=0;let a=0;return t.ctrlKey&&(a+=1),t.altKey&&(a+=2),t.shiftKey&&(a+=4),t.metaKey&&(a+=8),r.modifiers=a,r.event=t,r.timestamp=t.timeStamp,r.button=i?this.firstInput.button:t.button,r.buttons=t.buttons,f.tr&&t.button===0&&t.ctrlKey&&(r.button=2),r.down=e,r.up=i,r.handled=s,r.bubbles=n,r.isMultiTouch=o,r}ha(t,e){return t.bubbles?!0:(e.stopPropagation!==void 0&&e.stopPropagation(),e.cancelable!==!1&&e.preventDefault(),e.cancelBubble=!0,!1)}xR(t){let e=q.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!1);return i.key=t.key,i.code=t.code,i.down=!0,e.doKeyDown(),e.ha(i,t)}bR(t){let e=q.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!1);return i.key=t.key,i.code=t.code,i.up=!0,e.doKeyUp(),e.ha(i,t)}yR(t){let e=q.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!0);return e.mouseEnter!==null&&e.mouseEnter(i),e.currentTool.standardMouseOver(),e.ha(i,t)}wR(t){let e=q.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!0);return e.mouseLeave!==null&&e.mouseLeave(i),e.ha(i,t)}getMouse(t){let e=this.ft;if(e===null)return new P(0,0);let i=e.getBoundingClientRect(),s=(t.clientX-i.left)*(this.xt/i.width),n=(t.clientY-i.top)*(this.bt/i.height);return new P(s,n).Oe(this.T)}Qm(t,e){let i=this.ft,s=0,n=0;if(i!==null){let r=i.getBoundingClientRect();s=(t.clientX-r.left)*(this.xt/r.width),n=(t.clientY-r.top)*(this.bt/r.height)}e.viewPoint.i(s,n);let o=P.V(s,n);this.T.$e(o),e.documentPoint.a(o),P.e(o)}VC(t,e,i){let s;if(this.ea[0]!==null)s=this.ea[e];else return;let n=this.ft;if(n!==null){let o=n.getBoundingClientRect();i.i((s.clientX-o.left)*(this.xt/o.width),(s.clientY-o.top)*(this.bt/o.height))}}invalidateDocumentBounds(){this.ta||(this.ta=!0,this.requestUpdate(!1))}AR(){this.ys||this.Mi(),this.ensureBounds()}redraw(){this.Ht||this.ys||(this.S(),this.maybeUpdate())}isUpdateRequested(){return this.xr}delayInitialization(t){t===void 0&&(t=null);let e=this.animationManager,i=e.isEnabled;e.stopAnimation(),e.isEnabled=!1,this.ur(),this.jn=!1,this.ex=new P(NaN,NaN),e.isEnabled=i,this.ys=!0;let s=this;t!==null&&f.ir(()=>{s.ys=!1,e.Fl("Model"),t(s)},1)}requestUpdate(t){if(t===void 0&&(t=!1),this.xr===!0||this.Ht||t===!1&&this.ys)return;this.xr=!0;let e=this;A.requestAnimationFrame(()=>{e.xr&&e.maybeUpdate()})}maybeUpdate(){this.Fu&&!this.xr||(this.Fu&&(this.Fu=!1),this.ur())}FM(t,e){!this.Ou||this.Ht||this.animationManager.defaultAnimation.isAnimating||this.VL()||(t&&this.Mi(),e&&this.Bs(!1))}ur(t){if(this.ys||(this.xr=!1,this.St===null&&!this.Iu.isReal()))return;this.ys=!0;let e=this.animationManager,i=this.Vu;if(!e.isAnimating&&i.length!==0){let c=i.r,u=c.length;for(let d=0;d<u;d++){let g=c[d];g.ue(!1),g.c()}i.clear()}let s=this.wM;s.count>0&&(s.each(c=>c.RM()),s.clear());let n=!1,o=!1;e.defaultAnimation.isAnimating&&(o=!0,n=this.skipsUndoManager,this.skipsUndoManager=!0),e.pi||this.IS(),t||this.FM(!1,!0);let r=!this.undoManager.isUndoingRedoing&&(this.bl||this.Vc.count!==0&&this.Mr.size!==0),a=!this.jn||this.Vr;this.Mi(!0);let h=!1;(a||r)&&(this.jn?this.vM(!this.vc,r):(this.startTransaction("Initial Layout"),e.isEnabled===!1&&e.stopAnimation(),this.vM(!1,r)),h=a),this.vc=!1,this.bl=!1,this.Mi(),this.Ze!==null&&(this.Ze.visible&&!this.Eu&&(this.th(),this.Eu=!0),!this.Ze.visible&&this.Eu&&(this.Eu=!1)),this.Xx||this.AR(),t||this.FM(!0,!1);let l=!1;if(h){let c=z.l();c.a(this.viewportBounds),this.jn||(this.jn=!0,l=!0,this.skipsUndoManager||(this.undoManager.Iw=!0),this.undoManager.Ew=!0,this.TR()),this.DR(),this.Mi(!1),t||this.FM(!0,!0),z.e(c)}else if(e.Sc&&e.ix){if(this.Sr!==1)this.scale=this.Gu(this.Sr);else if(this.jl!==1)this.scale=this.Gu(this.jl);else{let c=this.initialScale;isFinite(c)&&c>0&&(this.scale=c)}this.Bs(!0)}h&&l&&this.commitTransaction("Initial Layout"),t||this.Ui(this.Qt),o&&(this.skipsUndoManager=n),this.ys=!1}get Vh(){return this.jn}TR(){if(this.Sr!==1)this.scale=this.Gu(this.Sr);else if(this.jl!==1)this.scale=this.Gu(this.jl);else{let e=this.initialScale;isFinite(e)&&e>0&&(this.scale=e)}this.Bs(!0);let t=this.Xt.r;this.ps(t,t.length,this,this.viewportBounds),this.D("InitialLayoutCompleted"),this.ex.a(this.at),this.th()}DR(){this.D("LayoutCompleted")}_m(t){this.Gn.add(t)}addInvalidRoute(t){this.Co?this.Zh.add(t):this.Mr.add(t)}Mi(t){if(this.Gn.size!==0&&!(!this.ys&&this.animationManager.isTicking)){if(this.ys||(this.bl=!0),t){this.XL(this.Gn);return}for(let e=0;e<23&&this.Gn.size!==0;e++){let i=new Set(this.Gn);this.Gn.clear(),this.RM(i,this.Gn)}this.nodes.each(e=>{e instanceof ft&&e.GL(!1)})}}XL(t,e){for(let i of t)!i.ke()||i instanceof ft||(i.Gr()?(i.ht(1/0,1/0),i.Bt()):e&&e.add(i));for(let i of t)if(i instanceof ft){if(!i.isVisible())continue;this.Pb(i)}}RM(t,e){this.XL(t,e);for(let i of t){if(!(i instanceof _))continue;let s=i;s.isVisible()&&(s.Gr()?(s.ht(1/0,1/0),s.Bt()):e.add(s))}for(let i of t)i instanceof St&&i.isVisible()&&(i.Gr()?(i.ht(1/0,1/0),i.Bt()):e.add(i))}t0(t){let e=t instanceof q,i=e?t.links:t.memberParts,s=this.Gn;if(e)this.Mi(!0);else{for(;i.next();){let n=i.value;s.has(n)&&(!n.ke()||n instanceof ft||n.Gr()&&(n.ht(1/0,1/0),n.Bt()))}for(i.reset();i.next();){let n=i.value;if(s.has(n)&&n instanceof ft){if(!n.isVisible())continue;this.Pb(n)}}i.reset()}for(;i.next();){let n=i.value;n instanceof _&&s.has(n)&&n.isVisible()&&n.Gr()&&(n.ht(1/0,1/0),n.Bt())}}Pb(t){let e=f.et(),i=f.et(),s=t.memberParts;for(;s.next();){let o=s.value;o.isVisible()&&(o instanceof ft?(o.To()||o._e()||o.ih())&&this.Pb(o):o instanceof _?o.fromNode===t||o.toNode===t?i.push(o):e.push(o):(o.ht(1/0,1/0),o.Bt()))}let n=e.length;for(let o=0;o<n;o++){let r=e[o];r.ht(1/0,1/0),r.Bt()}f.J(e),t.ht(1/0,1/0),t.Bt(),n=i.length;for(let o=0;o<n;o++){let r=i[o];r.ht(1/0,1/0),r.Bt()}f.J(i)}ps(t,e,i,s){if(!(!this.Ic&&!this.animationManager.isAnimating)){for(let n=0;n<e;n++)t[n].ps(i,s);this.Mi()}}Ui(t){this.St!==null&&(this.ft===null&&f.o("No canvas specified"),this.Oc==="svg"?this.FR(t):this.RR(t))}RR(t){let e=this.animationManager;if(e.pi||e.isAnimating&&!e.isTicking)return;let i=new Date;if(this.i0(),this.St&&this.St.style.opacity==="0")return;let s=t!==this.Qt,n=this.Xt.r,o=n.length,r=this;if(this.ps(n,o,r,r.viewportBounds),s)t.clearContextCache(!0),this._l();else if(!this.Ue&&!e.isAnimating)return;let a=this.T,h=this.Vi;t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,this.xt,this.bt),this.$t!==1&&(t.globalAlpha=this.$t),this.OM(t);for(let g=0;g<o;g++)t.setTransform(h,0,0,h,0,0),t.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),t.commitTransform(),n[g].Ui(t,r);let l=!1;this.Bc?this.Bc.Xu(this)&&(l=this.cb()):l=!0,l&&(Pt.prototype.$e=Pt.prototype.bw),s?(this.Qt.clearContextCache(!0),this._l()):(this.Ic=!1,this.Ue=!1);let c=+new Date-+i,u=!1,d=this.SM;if(u||this.Pl===null){d[this.Wm]=c,this.Wm=(this.Wm+1)%d.length;let g=0;for(let p=0;p<d.length;p++)g+=d[p];this.qm=g/d.length}if(this.$t!==1&&(t.globalAlpha=1),u){t.setTransform(1,0,0,1,0,0);for(let g=0;g<d.length;g++)t.fillText(d[g].toString(),20,150+ +(g*20))}}FR(t){if(this.St===null)return;let e=this.animationManager;if(e.pi||e.isAnimating&&!e.isTicking)return;this.i0();let i=this.xt,s=this.bt;t.surface.resize(i,s,i,s);let n=this.Xt.r,o=n.length,r=this;if(this.ps(n,o,r,r.viewportBounds),!this.Ue&&!e.isAnimating)return;let a=this.T;t.lastDrawnPart=null,t.setDiagramPosScale(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),this.$t!==1&&(t.globalAlpha=this.$t),this.OM(t);let h=this.Vi;this.ft.li.setTransform(h,0,0,h,0,0),this.ft.li.clearRect(0,0,this.xt,this.bt);for(let c=0;c<o;c++)n[c].Ui(t,r);let l=!1;this.Bc?this.Bc.Xu(this)&&(l=this.cb()):l=!0,l&&(Pt.prototype.$e=Pt.prototype.bw),this.Ic=!1,this.Ue=!1}Sb(t,e,i,s,n,o,r,a,h){if(this.St===null)return;this.ft===null&&f.o("No canvas specified"),o===void 0&&(o=null),r===void 0&&(r=null),a===void 0&&(a=!1),h===void 0&&(h=!1),this.i0(),this.Qt.clearContextCache(!0),this._l(),this.ia=!0;let l=this.tt;this.tt=s;let c=this,u=this.Xt.r,d=u.length;try{let g=new z(n.x,n.y,i.width/s,i.height/s),p=g.copy();p.addMargin(e),this.th(p),this.Mi(),this.ps(u,d,c,g),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i.width,i.height),r!==null&&r!==""&&(t.fillStyle=r,t.fillBackground(0,0,i.width,i.height));let m=this.Vi;t.scale(m,m);let y=Pt.l();y.Ri(),y.Fs(e.left,e.top),y.tt(s),(n.x!==0||n.y!==0)&&y.Fs(-n.x,-n.y),t.setTransform(y.m11,y.m12,y.m21,y.m22,y.dx,y.dy),t.commitTransform(),t instanceof ue&&t.setDiagramPosScale(y.m11,y.m12,y.m21,y.m22,y.dx,y.dy),Pt.e(y),this.OM(t),t.globalAlpha=this.$t;let w=this.findLayer("Grid");if(o){let b=new I,v=o.iterator;for(v.reset();v.next();){let k=v.value;k instanceof Nt&&(!h&&k.layer===w||(k.Au(),b.add(k)))}for(let k=0;k<d;k++)u[k].YF(t,c,b,a);b.each(k=>k.Au())}else for(let b=0;b<d;b++){let v=u[b];v===w?h&&v.Ui(t,c,!0):v.Ui(t,c,a)}this.ia=!1,this.Bc&&this.Bc.Xu(this)&&this.cb()}finally{this.tt=l,this.Qt.clearContextCache(!0),this._l(),this.ps(u,d,c,c.viewportBounds),this.th(),this.Qt instanceof ue&&(this.Qt.diagramGroup.replaceChildren(),this.redraw())}}getRenderingHint(t){return this.Pr[t]}setRenderingHint(t,e){t==="minDrawingLength"&&(this.Fm=e),this.Pr[t]=e,this.redraw()}resetRenderingHints(){this.Pr=new K,this.Pr.drawShadows=!0,this.Pr.textGreeking=!0,this.Pr.viewportOptimizations=!f.tr,this.Pr.temporaryPixelRatio=!0,this.Pr.pictureRatioOptimization=!0,this.Pr.minDrawingLength=1,this.Fm=1}OM(t){let e=this.Pr;if(e===null)return;if(e.imageSmoothingEnabled!==void 0){let s=!!e.imageSmoothingEnabled;t.setImageSmoothingEnabled(s)}let i=e.defaultFont;i!=null&&(t.font=i)}getInputOption(t){return this.Tu[t]}setInputOption(t,e){this.Tu[t]=e}oR(){this.Tu=new K,this.Tu.extraTouchArea=10,this.Tu.extraTouchThreshold=10,this.Tu.hasGestureZoom=!0}set(t){return Object.assign(this,t),this}attach(t){return this.setProperties(t)}setProperties(t){return q.e0(this,t),this}static e0(t,e){let i=t instanceof H,s=t instanceof q;for(let n in e){n===""&&f.o("Setting properties requires non-empty property names");let o=t,r=n;if(i||s){let h=n.indexOf(".");if(h>0){let l=n.substring(0,h);i?o=t.findObject(l):(o=t[l],o==null&&(o=t.toolManager[l])),f.Y(o)?r=n.substring(h+1):f.o("Unable to find object named: "+l+" in "+t.toString()+" when trying to set property: "+n)}}if(r[0]!=="_"&&!f.dw(o,r))if(s&&r==="ModelChanged"){t.addModelChangedListener(e[r]);continue}else if(s&&r==="Changed"){t.addChangedListener(e[r]);continue}else if(s&&f.dw(t.toolManager,r))o=t.toolManager;else if(s&&t.YL(r)){t.addDiagramListener(r,e[r]);continue}else if(t instanceof yt&&r==="Changed"){t.addChangedListener(e[r]);continue}else f.o('Trying to set undefined property "'+r+'" on object: '+o.toString());let a=e[n];o[r]=a,r[0]==="_"&&o instanceof dt&&o.addCopyProperty(r)}}bL(){if(this.$l.count!==0&&!(this.undoManager.transactionLevel>1)){for(;this.$l.count>0;){let t=this.$l;this.$l=new pt;let e=t.iterator;for(;e.next();){let i=e.key;i.invalidateOtherJumpOvers(e.value),i.ee()}}this.S()}}S(t){if(t===void 0)this.Ue=!0,this.requestUpdate();else{let e=this.viewportBounds;t.isReal()&&e.intersectsRect(t)&&(this.Ue=!0,this.requestUpdate())}this.D("InvalidateDraw")}invalidateViewport(t,e){if(this.Ue!==!0){if(this.Ue=!0,this.Oc==="svg"){this.maybeUpdate();return}this.getRenderingHint("temporaryPixelRatio")===!0?(this.Bw(),this.maybeUpdate(),this.CP(!0)):this.maybeUpdate()}}aa(){this.Ou=!0}_l(){this.Ic=!0}i0(){this.Du!==!1&&(this.Du=!1,this.UL(this.xt,this.bt))}UL(t,e){this.Ql();let i=this.Vi,s=t*i,n=e*i;this.ft.resize(s,n,t,e)&&(this.Ue=!0,this.Qt.clearContextCache(!0))}VL(){let t=this.ft;if(t===null||this.Iu.isReal())return!0;let e=this.xt,i=this.bt,s=this.St,n=!1,o=this.Kn?this.Wt:0,r=this.ln?this.Wt:0,a=s.clientWidth||e+o,h=s.clientHeight||i+r,l=this.viewportBounds,c=l.x,u=l.y,d=l.width,g=l.height;if((a!==e+o||h!==i+r)&&(this.Kn=!1,this.ln=!1,o=0,r=0,this.xt=a,this.bt=h,this.Du=!0,n=!0,this.Ql()),!this.jn||!this.viewportBounds.isReal())return!0;let p=this.hb,m=this.ab;if(this.Ou=!1,!n&&!this.Kn&&!this.ln&&!this.Ru&&!this.vu)return!0;let y=this.documentBounds,w=0,b=0,v=0,k=0,S=l.width,M=l.height,F=this.$h;this.contentAlignment.isSpot()?(y.width>S&&(w=F.left,b=F.right),y.height>M&&(v=F.top,k=F.bottom)):(w=F.left,b=F.right,v=F.top,k=F.bottom);let T=y.width+w+b,N=y.height+v+k,C=this.scale,R=C,O=T>a/C,B=N>h/C;if(!n&&!this.Kn&&!this.ln&&!O&&!B)return!0;let X=y.x-w,Y=l.x,j=y.right+b,U=l.right+o,nt=y.y-v,at=l.y,tt=y.bottom+k,st=l.bottom+r,et="1px",ut="1px";if(this.scrollMode===1&&(O||B)){if(O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let ot=1;X+1<Y&&(ot=Math.max((Y-X)*C+this.xt,ot)),j>U+1&&(ot=Math.max((j-U)*C+this.xt,ot)),S+o+1<T&&(ot=Math.max((T-S)*C+this.xt,ot)),et=ot.toString()+"px"}if(B&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let ot=1;nt+1<at&&(ot=Math.max((at-nt)*C+this.bt,ot)),tt>st+1&&(ot=Math.max((tt-st)*C+this.bt,ot)),M+r+1<N&&(ot=Math.max((N-M)*C+this.bt,ot)),ut=ot.toString()+"px"}}let gt=et!=="1px",wt=ut!=="1px";if(!(gt&&wt)&&(gt||wt)){if(O=!(T<S+o),B=!(N<M+r),wt&&(U-=this.Wt),gt&&(st-=this.Wt),O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let Mt=1;X+1<Y&&(Mt=Math.max((Y-X)*C+this.xt,Mt)),j>U+1&&(Mt=Math.max((j-U)*C+this.xt,Mt)),S+1<T&&(Mt=Math.max((T-S)*C+this.xt,Mt)),et=Mt.toString()+"px"}gt=et!=="1px";let ot=this.bt;if(gt!==this.ln&&(ot=gt?this.bt-this.Wt:this.bt+this.Wt),B&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let Mt=1;nt+1<at&&(Mt=Math.max((at-nt)*C+ot,Mt)),tt>st+1&&(Mt=Math.max((tt-st)*C+ot,Mt)),M+1<N&&(Mt=Math.max((N-M)*C+ot,Mt)),ut=Mt.toString()+"px"}wt=ut!=="1px"}if(this.Bm&&!(gt!==this.ln||wt!==this.Kn))return(e!==this.xt||i!==this.bt)&&this.maybeUpdate(),!1;if(gt!==this.ln&&(et==="1px"?this.bt=this.bt+this.Wt:this.bt=Math.max(this.bt-this.Wt,1),n=!0),this.ln=gt,m.style.width=et,wt!==this.Kn&&(ut==="1px"?this.xt=this.xt+this.Wt:this.xt=Math.max(this.xt-this.Wt,1),n=!0,this.zu)){let ot=P.l();wt?(t.style.left=this.Wt+"px",this.position=ot.i(this.at.x+this.Wt/this.scale,this.at.y)):(t.style.left="0px",this.position=ot.i(this.at.x-this.Wt/this.scale,this.at.y)),P.e(ot)}n&&this.Ql(),this.Kn=wt,m.style.height=ut,this._x=!0,n&&(this.Du=!0);let Ct=p.scrollLeft;if(this.hasHorizontalScrollbar&&this.allowHorizontalScroll&&(S+1<T?Ct=(this.position.x-X)*C:X+1<Y?Ct=p.scrollWidth-p.clientWidth:j>U+1&&(Ct=this.position.x*C)),this.zu)switch(this.Px){case"negative":Ct=-(p.scrollWidth-Ct-p.clientWidth);break;case"reverse":Ct=p.scrollWidth-Ct-p.clientWidth;break}if(p.scrollLeft=Ct,this.hasVerticalScrollbar&&this.allowVerticalScroll&&(M+1<N?p.scrollTop=(this.position.y-nt)*C:nt+1<at?p.scrollTop=p.scrollHeight-p.clientHeight:tt>st+1&&(p.scrollTop=this.position.y*C)),a=this.xt,h=this.bt,p.style.width=a+(this.Kn?this.Wt:0)+"px",p.style.height=h+(this.ln?this.Wt:0)+"px",e!==a||i!==h||this.animationManager.pi){let ot=z.V(c,u,d,g);return this.onViewportBoundsChanged(ot,this.viewportBounds,R,n),z.e(ot),!1}return!0}add(t){let e=t.diagram;if(e===this)return;e!==null&&f.o("Cannot add part "+t.toString()+" to "+this.toString()+". It is already a part of "+e.toString());let i=this.findLayer(t.layerName);if(i===null&&(i=this.findLayer("")),i===null&&f.o('Cannot add a Part when unable find a Layer named "'+t.layerName+'" and there is no default Layer'),t.layer===i)return;let s=i.Jh(99999999,t,t.diagram===this);s>=0&&this.raiseChangedEvent(3,"parts",i,null,t,null,s),i.isTemporary||this.invalidateDocumentBounds(),t.invalidateLayout(1);let n=t.layerChanged;n!==null&&n(t,null,i)}Jh(t){this.partManager.Jh(t);let e=this;t.Yr(i=>e.KL(i)),t.data||t.Do(),t.hasPlaceholder()&&t.c(),t.data!==null&&t.Yr(i=>e.partManager.IM(i,null)),(t._e()===!0||t.ih()===!0)&&this._m(t),t.jL(!0,this),t.HL()?(t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.requestUpdate()}te(t){t.clearAdornments(),this.partManager.te(t);let e=this;t.data!==null&&t.Yr(i=>e.partManager.EM(i,e)),this.Gn.delete(t),t instanceof _&&this.Mr.delete(t),t.HL()?(t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.requestUpdate()}remove(t){this.UM(t,!0)}UM(t,e){let i=t.layer;if(i===null||i.diagram!==this)return;t.isSelected=!1,t.isHighlighted=!1,t.invalidateLayout(2),e&&t.Xc();let s=i.te(-1,t,!1);s>=0&&this.raiseChangedEvent(4,"parts",i,t,null,s,null);let n=t.layerChanged;n!==null&&n(t,i,null)}removeParts(t,e){if(e===void 0&&(e=!1),Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e&&!n.canDelete()||this.remove(n)}}else{let i=new I;i.addAll(t);let s=i.iterator;for(;s.next();){let n=s.value;e&&!n.canDelete()||this.remove(n)}}}copyParts(t,e,i){i===void 0&&(i=!1);let s=null,n=e||this,o=n.model,r=!1,a=!1;try{o.pm()&&(r=o.copiesParentKeyOfNodeData,o.copiesParentKeyOfNodeData=n.commandHandler.copiesParentKey),(o.mm()||o.Mb())&&(a=o.copiesGroupKeyOfNodeData,o.copiesGroupKeyOfNodeData=n.commandHandler.copiesGroupKey),s=this.partManager.copyParts(t,e,i)}finally{o.pm()&&(o.copiesParentKeyOfNodeData=r),(o.mm()||o.Mb())&&(o.copiesGroupKeyOfNodeData=a)}return s}moveParts(t,e,i,s){if(i===void 0&&(i=!1),s===void 0&&(s=this.s0()),this.toolManager===null)return;let n=new pt;if(t!==null)if(Array.isArray(t))for(let o=0;o<t.length;o++)this.Kr(n,t[o],i,s);else{let o=t.iterator;for(;o.next();)this.Kr(n,o.value,i,s)}else{let o=this.parts;for(;o.next();){let r=o.value;this.Kr(n,r,i,s)}for(o=this.nodes;o.next();){let r=o.value;this.Kr(n,r,i,s)}for(o=this.links;o.next();){let r=o.value;this.Kr(n,r,i,s)}}this.TP(n,e,s,i)}Kr(t,e,i,s,n){if(!t.has(e)&&(n===void 0&&(n=!1),!(i&&!n&&!e.canMove()&&!e.canCopy())))if(s===void 0&&(s=this.s0()),e instanceof rt){if(t.set(e,this.Es(s,e,e.location)),e instanceof ft&&(e.hasPlaceholder()||s.dragsMembers)){let r=e.memberParts;for(;r.next();){let a=r.value;this.Kr(t,a,i,s,s.groupsAlwaysMove)}}let o=e.linksConnected;for(;o.next();){let r=o.value;if(t.has(r))continue;let a=r.fromNode,h=r.toNode;a!==null&&t.has(a)&&h!==null&&t.has(h)&&this.Kr(t,r,i,s)}if(s.dragsTree){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;this.Kr(t,a,i,s)}}}else if(e instanceof _){t.set(e,this.Es(s,e));let o=e.labelNodes;for(;o.next();){let r=o.value;this.Kr(t,r,i,s)}}else e instanceof St||t.set(e,this.Es(s,e,e.location))}TP(t,e,i,s){if(t===null||t.count===0)return;let n=P.l(),o=P.l();o.a(e),isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0);let r=this.db;r||this.JC(t);let a=f.et(),h=f.et(),l=t.iterator,c=P.l();for(;l.next();){let m=l.key,y=l.value;if(m.ke()){let w=this.qL(m,t);if(w!==null)a.push(new tr(m,y,w));else if(!s||m.canMove()){let b=y.point;n.a(b),this.computeMove(m,n.add(o),i,c),m.location=c,y.shifted===void 0&&(y.shifted=new P),y.shifted.a(c.subtract(b))}}else l.key instanceof _&&h.push(new Ut(l.key,l.value))}P.e(c);let u=a.length;for(let m=0;m<u;m++){let y=a[m],w=y.WL.point;n.a(w),y.Nb.shifted===void 0&&(y.Nb.shifted=new P),y.Me.location=n.add(y.Nb.shifted)}let d=P.l(),g=P.l(),p=h.length;for(let m=0;m<p;m++){let y=h[m],w=y.key;if(w instanceof _){if(w.suspendsRouting){w.br=null;let b=w.fromNode,v=w.toNode;if(this.draggedLink!==null&&i.dragsLink){let k=y.value.point;if(w.dragComputation===null){t.set(w,this.Es(i,w,o));let S=o.x-k.x,M=o.y-k.y;w.fr(S,M)}else{let S=P.V(0,0),M=w.getPoint(0);M&&M.isReal()&&S.a(M),c=P.l().a(S).add(o);let F=c;i.isGridSnapEnabled&&(i.isGridSnapRealtime||this.lastInput.up)&&(F=P.l(),this.yS(w,c,F,i)),c.a(w.dragComputation(w,c,F)).subtract(S),t.set(w,this.Es(i,w,c));let T=c.x-k.x,N=c.y-k.y;w.fr(T,N),P.e(S),P.e(c),F!==c&&P.e(F)}}else{if(b!==null){d.a(b.location);let k=t.get(b);k!==null&&d.subtract(k.point)}if(v!==null){g.a(v.location);let k=t.get(v);k!==null&&g.subtract(k.point)}if(b!==null&&v!==null)if(d.equalsApprox(g)){let k=y.value.point,S=n;S.a(d),S.subtract(k),t.set(w,this.Es(i,w,d)),w.fr(S.x,S.y)}else w.suspendsRouting=!1,w.invalidateRoute();else{let k=y.value.point,S;b!==null?S=d:v!==null?S=g:S=o,t.set(w,this.Es(i,w,S));let M=S.x-k.x,F=S.y-k.y;w.fr(M,F)}}}else if(w.fromNode===null||w.toNode===null){let b=y.value.point;t.set(w,this.Es(i,w,o));let v=o.x-b.x,k=o.y-b.y;w.fr(v,k)}}}P.e(n),P.e(o),P.e(d),P.e(g),f.J(a),f.J(h),r||(this.Mi(),this.NP(t))}computeMove(t,e,i,s){if(s===void 0&&(s=new P),s.a(e),t===null)return s;let n=e,o=i.isGridSnapEnabled;o&&(i.isGridSnapRealtime||this.lastInput.up)&&(n=P.l(),this.yS(t,e,n,i));let r=t.dragComputation!==null?t.dragComputation(t,e,n):n,a=t.minLocation,h=a.x;isNaN(h)&&(h=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let l=a.y;isNaN(l)&&(l=o?Math.round(t.location.y*1e3)/1e3:t.location.y);let c=t.maxLocation,u=c.x;isNaN(u)&&(u=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let d=c.y;return isNaN(d)&&(d=o?Math.round(t.location.y*1e3)/1e3:t.location.y),s.i(Math.max(h,Math.min(r.x,u)),Math.max(l,Math.min(r.y,d))),n!==e&&P.e(n),s}s0(){let t=this.toolManager.findTool("Dragging");return t instanceof Dt?t.dragOptions:this.pb}yS(t,e,i,s){if(s===void 0&&(s=this.s0()),i.a(e),t===null)return i;let n=this.grid,o=s.gridSnapCellSize,r=o.width,a=o.height,h=s.gridSnapOrigin,l=h.x,c=h.y,u=s.gridSnapCellSpot;if(n!==null){let g=n.gridCellSize;isNaN(r)&&(r=g.width),isNaN(a)&&(a=g.height);let p=n.gridOrigin;isNaN(l)&&(l=p.x),isNaN(c)&&(c=p.y)}let d=P.V(0,0);return d.setSpot(0,0,r,a,u),L.Dg(e.x,e.y,l+d.x,c+d.y,r,a,i),P.e(d),i}JC(t){if(t===null)return;this.db=!0;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof _&&(i.suspendsRouting=!0)}}NP(t){if(t===null)return;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof _&&(i.suspendsRouting=!1,i.JL()&&i.invalidateRoute())}this.db=!1}get draggedLink(){return this.gb}set draggedLink(t){this.gb!==t&&(this.gb=t,t!==null&&(this.yb=t.fromPort,this.wb=t.toPort))}get RP(){return this.yb}set RP(t){this.yb=t}get vP(){return this.wb}set vP(t){this.wb=t}qL(t,e){let i=t.containingGroup;if(i!==null){let s=this.qL(i,e);if(s!==null||(s=e.get(i),s!==null))return s}return null}Es(t,e,i){if(i===void 0)return new ni(P.xo);let s=t.isGridSnapEnabled;return!t.groupsSnapMembers&&e.containingGroup!==null&&(s=!1),s?new ni(new P(Math.round(i.x*1e3)/1e3,Math.round(i.y*1e3)/1e3)):new ni(i.copy())}BM(t,e){if(t.diagram!==null&&t.diagram!==this&&f.o("Cannot share a Layer with another Diagram: "+t+" of "+t.diagram),e===null?t.diagram!==null&&f.o("Cannot add an existing Layer to this Diagram again: "+t):(e.diagram!==this&&f.o("Existing Layer must be in this Diagram: "+e+" not in "+e.diagram),t===e&&f.o("Cannot move a Layer before or after itself: "+t)),t.diagram===this)return;let i=t.name,s=this.Xt,n=s.count;for(let o=0;o<n;o++)s.elt(o).name===i&&f.o("Cannot add Layer with the name '"+i+"'; a Layer with the same name is already present in this Diagram.")}addLayer(t){this.BM(t,null),t.Mo(this);let e=this.Xt,i=e.count-1;if(!t.isTemporary)for(;i>=0&&e.elt(i).isTemporary;)i--;return e.insertAt(i+1,t),this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,i+1),this.S(),this.invalidateDocumentBounds(),this}addLayerBefore(t,e){this.BM(t,e),t.Mo(this);let i=this.Xt,s=i.indexOf(t);s>=0&&(i.delete(t),this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o,t);break}return this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o),this.S(),s<0&&this.invalidateDocumentBounds(),this}addLayerAfter(t,e){this.BM(t,e),t.Mo(this);let i=this.Xt,s=i.indexOf(t);s>=0&&(i.delete(t),this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o+1,t);break}return this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o+1),this.S(),s<0&&this.invalidateDocumentBounds(),this}Xr(t,e){t.Mo(this),this.Xt.insertAt(e,t)}$L(t){this.Xt.removeAt(t)}removeLayer(t){if(t.diagram!==this&&f.o("Cannot remove a Layer from another Diagram: "+t+" of "+t.diagram),t.name==="")return;let e=this.Xt,i=e.indexOf(t);if(e.delete(t)){let s=t.Ct.copy().iterator;for(;s.next();){let n=s.value,o=n.layerName;o!==t.name?n.layerName=o:n.layerName=""}this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,i,null),this.S(),this.invalidateDocumentBounds()}}findLayer(t){let e=this.layers;for(;e.next();){let i=e.value;if(i.name===t)return i}return null}findRouter(t){for(let e of this.Vc)if(e.name===t)return e;return null}addModelChangedListener(t){return f.k(t,q,"addModelChangedListener:listener"),this.Yn===null&&(this.Yn=new G),this.Yn.add(t),this.model.addChangedListener(t),this}removeModelChangedListener(t){f.k(t,q,"removeModelChangedListener:listener"),this.Yn!==null&&(this.Yn.delete(t),this.Yn.count===0&&(this.Yn=null)),this.model.removeChangedListener(t)}addChangedListener(t){return f.k(t,q,"addChangedListener:listener"),this.Nr===null&&(this.Nr=new G),this.Nr.add(t),this}removeChangedListener(t){f.k(t,q,"removeChangedListener:listener"),this.Nr!==null&&(this.Nr.delete(t),this.Nr.count===0&&(this.Nr=null))}VM(t){if(!this.skipsUndoManager&&!this.model.skipsUndoManager&&this.model.undoManager.handleChanged(t),t.change!==1&&(this.isModified=!0),this.Nr!==null){let e=this.Nr,i=e.length;for(let s=0;s<i;s++)e.elt(s)(t)}}raiseChangedEvent(t,e,i,s,n,o,r){o===void 0&&(o=null),r===void 0&&(r=null);let a=new ii;a.diagram=this,a.change=t,a.propertyName=e,a.object=i,a.oldValue=s,a.oldParam=o,a.newValue=n,a.newParam=r,this.VM(a)}raiseChanged(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}t(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}get animationManager(){return this.ds}get undoManager(){return this.ki.undoManager}get skipsUndoManager(){return this.Lo}set skipsUndoManager(t){f.s(t,"boolean",q,"skipsUndoManager"),this.Lo=t,this.ki.skipsUndoManager=t}get delaysLayout(){return this.Gx}set delaysLayout(t){this.Gx=t}zC(t,e){if(t===null||t.diagram!==this)return;let i=this.fe;try{this.fe=!0;let s=t.change;if(s===2){let n=t.object,o=t.propertyName,r=t.getValue(e);if(t.diagram.model.Z(n,o,r),n instanceof dt){let a=n.part;a!==null&&a.invalidateAdornments()}this.isModified=!0}else if(s===3){let n=t.object,o=t.newParam,r=t.newValue;if(n instanceof H)if(typeof o=="number"&&r instanceof dt){e?n.te(o):n.insertAt(o,r);let a=n.part;a!==null&&a.invalidateAdornments()}else typeof o=="number"&&r instanceof Yt&&(r.isRow?n.ZL(o,e?void 0:r):n.QL(o,e?void 0:r));else if(n instanceof Vt){let a=t.oldParam===!0;typeof o=="number"&&r instanceof Nt&&(e?(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.te(a?o:-1,r,a)):n.Jh(o,r,a))}else n instanceof q?typeof o=="number"&&r instanceof Vt&&(e?this.$L(o):this.Xr(r,o)):f.o("unknown ChangeType.Insert object: "+t.toString());this.isModified=!0}else if(s===4){let n=t.object,o=t.oldParam,r=t.oldValue;if(n instanceof H)typeof o=="number"&&r instanceof dt?e?n.insertAt(o,r):n.te(o):typeof o=="number"&&r instanceof Yt&&(r.isRow?n.ZL(o,e?r:void 0):n.QL(o,e?r:void 0));else if(n instanceof Vt){let a=t.newParam===!0;typeof o=="number"&&r instanceof Nt&&(e?n.Ct.indexOf(r)<0&&n.Jh(o,r,a):(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.te(a?o:-1,r,a)))}else n instanceof q?typeof o=="number"&&r instanceof Vt&&(e?this.Xr(r,o):this.$L(o)):f.o("unknown ChangeType.Remove object: "+t.toString());this.isModified=!0}else s===1||f.o("unknown ChangedEvent: "+t.toString())}finally{this.fe=i}}startTransaction(t){return this.undoManager.startTransaction(t)}commitTransaction(t){return this.undoManager.commitTransaction(t)}rollbackTransaction(){return this.undoManager.rollbackTransaction()}commit(t,e){let i=e;i===void 0&&(i="");let s=this.skipsUndoManager;i===null&&(this.skipsUndoManager=!0,i=""),this.undoManager.startTransaction(i);let n=!1;try{t(this),n=!0}finally{n?this.undoManager.commitTransaction(i):this.undoManager.rollbackTransaction(),this.skipsUndoManager=s}}updateAllTargetBindings(t){this.partManager.updateAllTargetBindings(t)}updateAllThemeBindings(){if(this.partManager.updateAllThemeBindings(),this.Ze!==null){let t=this.Ze.part;t!==null&&t.Do()}}setDivBackground(t){this.div&&(this.div.style.backgroundColor=t)}updateAllRelationshipsFromData(){this.partManager.updateAllRelationshipsFromData()}kb(){let t=this.T,e=this.tt,i=this.at;t.Ri(),e!==1&&t.tt(e),(i.x!==0||i.y!==0)&&t.Fs(-i.x,-i.y)}_L(t,e){let i=this.animationManager;if(this.Ht||this.ys){this.tt=e,this.Ql(),this.S(),this.aa(),i.wL(t,this.tt),this.kb();return}if(this.ft===null){this.tt=e,this.kb();return}this.Ht=!0;let s=this.viewportBounds.copy(),n=this.xt,o=this.bt,r=this.zoomPoint.x,a=this.zoomPoint.y,h=this.contentAlignment;isNaN(r)&&(h.isSide()?h.includesSide(D.LeftSide)?r=0:h.includesSide(D.RightSide)&&(r=n-1):h.isSpot()?r=h.x*(n-1):r=n/2),isNaN(a)&&(h.isSide()?h.includesSide(D.TopSide)?a=0:h.includesSide(D.BottomSide)&&(a=o-1):h.isSpot()?a=h.y*(o-1):a=o/2),this.scaleComputation!==null&&!this.animationManager.defaultAnimation.isAnimating&&(e=this.scaleComputation(this,e)),e<this.minScale&&(e=this.minScale),e>this.maxScale&&(e=this.maxScale);let l=P.V(this.at.x+r/t-r/e,this.at.y+a/t-a/e);this.position=l,P.e(l),this.tt=e,this.Ql(),this.Ht=!1,this.onViewportBoundsChanged(s,this.viewportBounds,t,!1),this.Bs(!1),i.wL(t,this.tt),this.S()}MR(){let t=this.Xt.r;for(let e=0;e<t.length;e++)t[e].NL()}onViewportBoundsChanged(t,e,i,s){if(t.equals(e))return;s===void 0&&(s=!1),s||this.aa(),this._l();let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(t.width!==e.width||t.height!==e.height)&&n.invalidateLayout();let o=this.currentTool;this.Uc===!0&&o instanceof xe&&!this.animationManager.isTicking&&(this.lastInput.documentPoint=this.transformViewToDoc(this.lastInput.viewPoint),o.standardMouseActivity(this)),this.Ht||this.invalidateViewport(t,e),this.th(),this.Bi.scale=i,this.Bi.position.x=t.x,this.Bi.position.y=t.y,this.Bi.bounds.a(t),this.Bi.canvasSize.width=Math.round(t.width*i),this.Bi.canvasSize.height=Math.round(t.height*i),this.Bi.newCanvasSize.width=this.xt,this.Bi.newCanvasSize.height=this.bt,this.Bi.isScroll=s,this.D("ViewportBoundsChanged",this.Bi,t),this.isVirtualized&&this.links.each(r=>{r.isAvoiding&&r.actualBounds.intersectsRect(e)&&r.invalidateRoute()})}th(t){let e=this.Ze;if(e===null||!e.visible||e.part===null||e.layer===null)return;let i=t!==void 0?t:this.sb;if(!i.isReal())return;let s=i.width,n=i.height;if(e.scale=1,e.angle=0,e.layer.isViewportAligned)e.width=s*this.scale,e.height=n*this.scale,e.part.alignment=D.TopLeft;else{e.yi===null&&(e.yi=new gi);let o=e.yi.Gc;if(!o.isReal())return;e.width=s+o.width*2,e.height=n+o.height*2;let r=P.l();L.Dg(i.x,i.y,0,0,o.width,o.height,r),r.offset(-o.width,-o.height),e.part.location=r,P.e(r)}}clearSelection(t){t===void 0&&(t=!1);let e=this.selection;if(e.count===0)return;t||this.D("ChangingSelection",e);let i=e.toArray(),s=i.length;for(let n=0;n<s;n++){let o=i[n];o.isSelected=!1}e.Nt(),e.clear(),e.u(),t||this.D("ChangedSelection",e)}select(t){t!==null&&t.diagram===this&&(!t.isSelected||this.selection.count>1)&&(this.D("ChangingSelection",this.selection),this.clearSelection(!0),t.isSelected=!0,this.D("ChangedSelection",this.selection))}selectCollection(t){if(this.D("ChangingSelection",this.selection),this.clearSelection(!0),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s instanceof Nt||f.o("Diagram.selectCollection given something that is not a Part: "+s),s.isSelected=!0}}else{let e=t.iterator;for(;e.next();){let i=e.value;i instanceof Nt||f.o("Diagram.selectCollection given something that is not a Part: "+i),i.isSelected=!0}}this.D("ChangedSelection",this.selection)}clearHighlighteds(){let t=this.highlighteds;if(t.count>0){let e=t.toArray(),i=e.length;for(let s=0;s<i;s++){let n=e[s];n.isHighlighted=!1}t.Nt(),t.clear(),t.u()}}highlight(t){t!==null&&t.diagram===this&&(!t.isHighlighted||this.highlighteds.count>1)&&(this.clearHighlighteds(),t.isHighlighted=!0)}highlightCollection(t){let e=new I().addAll(t),i=this.highlighteds.copy().removeAll(e).iterator;for(;i.next();){let n=i.value;n.isHighlighted=!1}let s=e.iterator;for(;s.next();){let n=s.value;n instanceof Nt||f.o("Diagram.highlightCollection given something that is not a Part: "+n),n.isHighlighted=!0}}scroll(t,e,i){i===void 0&&(i=1);let s=e==="up"||e==="down",n=0,o=P.l();if(t==="pixel")n=i;else if(t==="line")n=i*(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if(t==="page"){let a=s?this.viewportBounds.height:this.viewportBounds.width;if(a*=this.scale,a!==0){let h=Math.max(a-(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0);n=i*h}}else if(t==="document"){let a=this.documentBounds,h=this.viewportBounds;e==="up"?this.position=o.i(h.x,a.y):e==="left"?this.position=o.i(a.x,h.y):e==="down"?this.position=o.i(h.x,a.bottom-h.height):e==="right"&&(this.position=o.i(a.right-h.width,h.y)),P.e(o);return}else f.o("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+t);n/=this.scale;let r=this.position;e==="up"?this.position=o.i(r.x,r.y-n):e==="down"?this.position=o.i(r.x,r.y+n):e==="left"?this.position=o.i(r.x-n,r.y):e==="right"?this.position=o.i(r.x+n,r.y):f.o("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+e),P.e(o)}scrollToRect(t){let e=this.viewportBounds;if(e.containsRect(t))return;let i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}centerRect(t){let e=this.viewportBounds,i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}transformDocToView(t){return t.copy().T(this.T)}transformViewToDoc(t){return t.copy().Oe(this.T)}$F(t){return t.Oe(this.T)}static None=1;static Uniform=2;static UniformToFill=3;static CycleAll=1;static CycleNotDirected=2;static CycleNotDirectedFast=3;static CycleNotUndirected=4;static CycleDestinationTree=5;static CycleSourceTree=6;static DocumentScroll=1;static InfiniteScroll=2;static TreeParentCollapsed=1;static AllParentsCollapsed=2;static AnyParentsCollapsed=3;get opacity(){return this.$t}set opacity(t){let e=this.$t;e!==t&&(f.s(t,"number",q,"opacity"),(t<0||t>1)&&f.W(t,"0 <= value <= 1",q,"opacity"),this.$t=t,this.t("opacity",e,t),this.S())}get validCycle(){return this.Ex}set validCycle(t){let e=this.Ex;e!==t&&(this.Ex=t,this.t("validCycle",e,t))}get layers(){return this.Xt.iterator}get isModelReadOnly(){let t=this.ki;return t===null?!1:t.isReadOnly}set isModelReadOnly(t){let e=this.ki;e!==null&&(e.isReadOnly=t)}get isReadOnly(){return this.Ao}set isReadOnly(t){let e=this.Ao;e!==t&&(f.s(t,"boolean",q,"isReadOnly"),this.Ao=t,this.t("isReadOnly",e,t))}get isEnabled(){return this.Oi}set isEnabled(t){let e=this.Oi;e!==t&&(f.s(t,"boolean",q,"isEnabled"),this.Oi=t,this.t("isEnabled",e,t))}get allowClipboard(){return this.Yx}set allowClipboard(t){let e=this.Yx;e!==t&&(f.s(t,"boolean",q,"allowClipboard"),this.Yx=t,this.t("allowClipboard",e,t))}get allowCopy(){return this.Rl}set allowCopy(t){let e=this.Rl;e!==t&&(f.s(t,"boolean",q,"allowCopy"),this.Rl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.vl}set allowDelete(t){let e=this.vl;e!==t&&(f.s(t,"boolean",q,"allowDelete"),this.vl=t,this.t("allowDelete",e,t))}get allowDragOut(){return this.Kx}set allowDragOut(t){let e=this.Kx;e!==t&&(f.s(t,"boolean",q,"allowDragOut"),this.Kx=t,this.t("allowDragOut",e,t))}get allowDrop(){return this.jx}set allowDrop(t){let e=this.jx;e!==t&&(f.s(t,"boolean",q,"allowDrop"),this.jx=t,this.t("allowDrop",e,t))}get allowTextEdit(){return this.Ol}set allowTextEdit(t){let e=this.Ol;e!==t&&(f.s(t,"boolean",q,"allowTextEdit"),this.Ol=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.Il}set allowGroup(t){let e=this.Il;e!==t&&(f.s(t,"boolean",q,"allowGroup"),this.Il=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.El}set allowUngroup(t){let e=this.El;e!==t&&(f.s(t,"boolean",q,"allowUngroup"),this.El=t,this.t("allowUngroup",e,t))}get allowInsert(){return this.Hx}set allowInsert(t){let e=this.Hx;e!==t&&(f.s(t,"boolean",q,"allowInsert"),this.Hx=t,this.t("allowInsert",e,t))}get allowLink(){return this.Ul}set allowLink(t){let e=this.Ul;e!==t&&(f.s(t,"boolean",q,"allowLink"),this.Ul=t,this.t("allowLink",e,t))}get allowRelink(){return this.Bl}set allowRelink(t){let e=this.Bl;e!==t&&(f.s(t,"boolean",q,"allowRelink"),this.Bl=t,this.t("allowRelink",e,t))}get allowMove(){return this.Vl}set allowMove(t){let e=this.Vl;e!==t&&(f.s(t,"boolean",q,"allowMove"),this.Vl=t,this.t("allowMove",e,t))}get allowReshape(){return this.zl}set allowReshape(t){let e=this.zl;e!==t&&(f.s(t,"boolean",q,"allowReshape"),this.zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Xl}set allowResize(t){let e=this.Xl;e!==t&&(f.s(t,"boolean",q,"allowResize"),this.Xl=t,this.t("allowResize",e,t))}get allowRotate(){return this.Gl}set allowRotate(t){let e=this.Gl;e!==t&&(f.s(t,"boolean",q,"allowRotate"),this.Gl=t,this.t("allowRotate",e,t))}get allowSelect(){return this.Yl}set allowSelect(t){let e=this.Yl;e!==t&&(f.s(t,"boolean",q,"allowSelect"),this.Yl=t,this.t("allowSelect",e,t))}get allowUndo(){return this.qx}set allowUndo(t){let e=this.qx;e!==t&&(f.s(t,"boolean",q,"allowUndo"),this.qx=t,this.t("allowUndo",e,t))}get allowZoom(){return this.Wx}set allowZoom(t){let e=this.Wx;e!==t&&(f.s(t,"boolean",q,"allowZoom"),this.Wx=t,this.t("allowZoom",e,t))}get hasVerticalScrollbar(){return this.vu}set hasVerticalScrollbar(t){let e=this.vu;e!==t&&(f.s(t,"boolean",q,"hasVerticalScrollbar"),this.vu=t,this.aa(),this.S(),this.t("hasVerticalScrollbar",e,t),this.Bs(!1))}get hasHorizontalScrollbar(){return this.Ru}set hasHorizontalScrollbar(t){let e=this.Ru;e!==t&&(f.s(t,"boolean",q,"hasHorizontalScrollbar"),this.Ru=t,this.aa(),this.S(),this.t("hasHorizontalScrollbar",e,t),this.Bs(!1))}get allowHorizontalScroll(){return this.Jx}set allowHorizontalScroll(t){let e=this.Jx;e!==t&&(f.s(t,"boolean",q,"allowHorizontalScroll"),this.Jx=t,this.t("allowHorizontalScroll",e,t),this.Bs(!1))}get allowVerticalScroll(){return this.$x}set allowVerticalScroll(t){let e=this.$x;e!==t&&(f.s(t,"boolean",q,"allowVerticalScroll"),this.$x=t,this.t("allowVerticalScroll",e,t),this.Bs(!1))}get scrollHorizontalLineChange(){return this.Zx}set scrollHorizontalLineChange(t){let e=this.Zx;e!==t&&(f.s(t,"number",q,"scrollHorizontalLineChange"),t<0&&f.W(t,">= 0",q,"scrollHorizontalLineChange"),this.Zx=t,this.t("scrollHorizontalLineChange",e,t))}get scrollVerticalLineChange(){return this.Qx}set scrollVerticalLineChange(t){let e=this.Qx;e!==t&&(f.s(t,"number",q,"scrollVerticalLineChange"),t<0&&f.W(t,">= 0",q,"scrollVerticalLineChange"),this.Qx=t,this.t("scrollVerticalLineChange",e,t))}get lastInput(){return this._h}set lastInput(t){this._h=t}get previousInput(){return this.Br}set previousInput(t){this.Br=t}get firstInput(){return this.Ym}set firstInput(t){this.Ym=t}get currentCursor(){return this.Ux}set currentCursor(t){if(t===""&&(t=this.Um),this.Ux!==t){f.s(t,"string",q,"currentCursor");let e=this.ft,i=this.St;if(e===null||i===null)return;this.Ux=t;let s=e.style.cursor;e.style.cursor=t,i.style.cursor=t,e.style.cursor===s&&(e.style.cursor="-webkit-"+t,i.style.cursor="-webkit-"+t,e.style.cursor===s&&(e.style.cursor="-moz-"+t,i.style.cursor="-moz-"+t,e.style.cursor===s&&(e.style.cursor=t,i.style.cursor=t)))}}get defaultCursor(){return this.Um}set defaultCursor(t){t===""&&(t="auto");let e=this.Um;e!==t&&(f.s(t,"string",q,"defaultCursor"),this.Um=t,this.t("defaultCursor",e,t))}get click(){return this.Cr}set click(t){let e=this.Cr;e!==t&&(t!==null&&f.k(t,q,"click"),this.Cr=t,this.t("click",e,t))}get doubleClick(){return this.Lr}set doubleClick(t){let e=this.Lr;e!==t&&(t!==null&&f.k(t,q,"doubleClick"),this.Lr=t,this.t("doubleClick",e,t))}get contextClick(){return this.Ar}set contextClick(t){let e=this.Ar;e!==t&&(t!==null&&f.k(t,q,"contextClick"),this.Ar=t,this.t("contextClick",e,t))}get mouseOver(){return this.Tr}set mouseOver(t){let e=this.Tr;e!==t&&(t!==null&&f.k(t,q,"mouseOver"),this.Tr=t,this.t("mouseOver",e,t))}get mouseHover(){return this.Dr}set mouseHover(t){let e=this.Dr;e!==t&&(t!==null&&f.k(t,q,"mouseHover"),this.Dr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.Fr}set mouseHold(t){let e=this.Fr;e!==t&&(t!==null&&f.k(t,q,"mouseHold"),this.Fr=t,this.t("mouseHold",e,t))}get mouseDragOver(){return this.Bx}set mouseDragOver(t){let e=this.Bx;e!==t&&(t!==null&&f.k(t,q,"mouseDragOver"),this.Bx=t,this.t("mouseDragOver",e,t))}get mouseDrop(){return this.Rr}set mouseDrop(t){let e=this.Rr;e!==t&&(this.Rr=t,this.t("mouseDrop",e,t))}get handlesDragDropForTopLevelParts(){return this.Vx}set handlesDragDropForTopLevelParts(t){let e=this.Vx;e!==t&&(f.s(t,"boolean",q,"handlesDragDropForTopLevelParts"),this.Vx=t,this.t("handlesDragDropForTopLevelParts",e,t))}get mouseEnter(){return this.vr}set mouseEnter(t){let e=this.vr;e!==t&&(t!==null&&f.k(t,q,"mouseEnter"),this.vr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.Or}set mouseLeave(t){let e=this.Or;e!==t&&(t!==null&&f.k(t,q,"mouseLeave"),this.Or=t,this.t("mouseLeave",e,t))}get toolTip(){return this.Ir}set toolTip(t){let e=this.Ir;e!==t&&(this.Ir=t,this.t("toolTip",e,t))}get contextMenu(){return this.Er}set contextMenu(t){let e=this.Er;e!==t&&(this.Er=t,this.t("contextMenu",e,t))}get commandHandler(){return this.sM}set commandHandler(t){let e=this.sM;e!==t&&(e&&e.doStop(),this.sM=t,t.Mo(this),t.doStart())}get toolManager(){return this.tM}set toolManager(t){this.tM!==t&&(this.tM=t,t.diagram=this)}get defaultTool(){return this.iM}set defaultTool(t){let e=this.iM;e!==t&&(this.iM=t,t.diagram=this,this.currentTool===e&&(this.currentTool=t))}get currentTool(){return this.eM}set currentTool(t){let e=this.eM;e&&(e.isActive&&e.doDeactivate(),e.cancelWaitAfter(),e.doStop()),t===null&&(t=this.defaultTool),t!==null&&(this.eM=t,t.diagram=this,t.doStart())}get selection(){return this.cM}get maxSelectionCount(){return this.eb}set maxSelectionCount(t){let e=this.eb;if(e!==t)if(f.s(t,"number",q,"maxSelectionCount"),t>=0&&!isNaN(t)){if(this.eb=t,this.t("maxSelectionCount",e,t),!this.undoManager.isUndoingRedoing){let i=this.selection.count-t;if(i>0){this.D("ChangingSelection",this.selection);let s=this.selection.toArray();for(let n=0;n<i;n++)s[n].isSelected=!1;this.D("ChangedSelection",this.selection)}}}else f.W(t,">= 0",q,"maxSelectionCount")}get nodeSelectionAdornmentTemplate(){return this.Xm}set nodeSelectionAdornmentTemplate(t){let e=this.Xm;e!==t&&(this.Xm=t.Et(),this.t("nodeSelectionAdornmentTemplate",e,t))}get groupSelectionAdornmentTemplate(){return this.ob}set groupSelectionAdornmentTemplate(t){let e=this.ob;e!==t&&(this.ob=t.Et(),this.t("groupSelectionAdornmentTemplate",e,t))}get linkSelectionAdornmentTemplate(){return this.rb}set linkSelectionAdornmentTemplate(t){let e=this.rb;e!==t&&(this.rb=t.Et(),this.t("linkSelectionAdornmentTemplate",e,t))}get highlighteds(){return this.fM}get isModified(){let t=this.undoManager;return t.isEnabled?t.currentTransaction!==null?!0:this.Uu&&this.Os!==t.historyIndex:this.Uu}set isModified(t){if(this.Uu!==t){f.s(t,"boolean",q,"isModified"),this.Uu=t;let e=this.undoManager;!t&&e.isEnabled&&(this.Os=e.historyIndex),t||this.tA()}}tA(){let t=this.isModified;this.hM!==t&&(this.hM=t,this.D("Modified"))}get model(){return this.ki}set model(t){let e=this.ki;if(e!==t){this.currentTool.doCancel(),e&&e.undoManager!==t.undoManager&&e.undoManager.isInTransaction&&f.o("Do not replace a Diagram.model while a transaction is in progress."),this.animationManager.stopAnimation(!0);let i=this.IL(!0);this.jn=!1,this.Fu=!0,this.Os=-2,this.xr=!1;let s=this.Ht;this.Ht=!0,this.animationManager.Fl("Model"),e&&(this.Yn!==null&&this.Yn.each(n=>e.removeChangedListener(n)),e.removeChangedListener(this.lM)),this.ki=t,this.partManager=this.vR(this.ki.type),this.initializePartManager(this.partManager);for(let n=0;n<i.length;n++)this.add(i[n]);t.addChangedListener(this.rM),this.partManager.zM(),t.removeChangedListener(this.rM),t.addChangedListener(this.lM),this.Yn!==null&&this.Yn.each(n=>t.addChangedListener(n)),this.Ht=s,this.invalidateDocumentBounds(),this.Ht||this.S(),e&&t.undoManager.copyProperties(e.undoManager)}}get themeManager(){return this.NM}set themeManager(t){let e=this.NM;e!==t&&(e&&e.removeDiagram(this),this.NM=t,t!==null&&t.addDiagram(this))}initializePartManager(t){}static CM(t,e){q.TL.set(t,e)}static get licenseKey(){return q.XM.last()}static set licenseKey(t){q.XM.add(t.replace(/\s/g,""))}static get version(){return q.OR}static XM=new G;static OR="3.0.23";vR(t){let e=q.TL.get(t);return e!==null?new e:new Se}get X(){return this.oM}set X(t){this.oM=t}get xx(){return this.CL}IR(t){if(t.model!==this.model)return;let e=t.change,i=t.propertyName;if(e===1&&i[0]==="S"){if(i==="StartingFirstTransaction"){let s=this,n=this.toolManager;n.mouseDownTools.each(o=>o.diagram=s),n.mouseMoveTools.each(o=>o.diagram=s),n.mouseUpTools.each(o=>o.diagram=s),this.routers.each(o=>o.diagram=s),!this.ys&&!this.jn&&(this.vc=!0,this.Fu&&(this.xr=!0))}else if(i==="StartingUndo"||i==="StartingRedo"){let s=this.animationManager;this.skipsUndoManager||(s.defaultAnimation.isAnimating&&s.stopAnimation(),s.getBundleAnimation().isAnimating&&s.getBundleAnimation().stop()),this.D("ChangingSelection",this.selection)}else if(i==="StartedTransaction"){let s=this.animationManager;s.defaultAnimation.isAnimating&&!this.skipsUndoManager&&s.stopAnimation()}return}if(this.X){this.X=!1;try{if(t.modelChange===""&&e===1){(i==="FinishedUndo"||i==="FinishedRedo")&&(this.D("ChangedSelection",this.selection),this.Mi());let s=this.animationManager;i==="RolledBackTransaction"&&s.stopAnimation(),this.bL(),this.vc=!0,this.maybeUpdate(),(this.undoManager.transactionLevel===0||this.undoManager.transactionLevel===1)&&s.OS(),i==="CommittedTransaction"&&this.undoManager.isJustDiscarded&&(this.Os=Math.min(this.Os,this.undoManager.historyIndex-1)),(i==="CommittedTransaction"||i==="RolledBackTransaction")&&this.undoManager.Ew&&f.ir(()=>{this.isModified=!1},1);let n=t.isTransactionFinished;if(n&&(this.tA(),this.xx.clear(),this.animationManager.OF()),!this.zx&&n&&this.lastInput.targetDiagram){this.zx=!0;let o=this;f.ir(()=>{o.currentTool.standardMouseOver(),o.zx=!1},10)}}}finally{this.X=!0}}}get fe(){return this.nM}set fe(t){this.nM=t}get du(){return this.Xx}set du(t){this.Xx=t}KL(t){let e=t.C.r;for(let i of e)i instanceof zt&&this.GM(i)}GM(t){let e=t.element;if(e===null||!(e instanceof HTMLImageElement)||(e.ts instanceof I&&e.ts.add(this),t.ER(),!e.o0))return;let i=e.getAttribute("src")||"",s=this.Jl.get(i);if(s===null){zt.iA(t,e);let n=[];n.push(t),this.Jl.set(i,n)}else{for(let n=0;n<s.length;n++)if(s[n]===t)return;s.push(t)}}UR(t){let e=t.C.r,i=e.length;for(let s=0;s<i;s++)this.YM(e[s])}YM(t){if(!(t instanceof zt))return;let e=t.element;if(e===null||!(e instanceof HTMLImageElement)||!e.o0)return;let i=e.getAttribute("src")||"",s=this.Jl.get(i);if(s!==null){for(let n=0;n<s.length;n++)if(s[n]===t){s.splice(n,1),s.length===0&&(this.Jl.delete(i),zt.BR(e),e.ts instanceof I&&e.ts.delete(this),zt.clearCache(i));return}}}EL(){zt.clearCache(),this.Jl.clear()}rebuildParts(){this.partManager.rebuildParts()}Lc(t,e){this.ds.Lc(t,e)}Cc(t,e){this.ds.Cc(t,e)}findPartForKey(t){return this.partManager.findPartForKey(t)}findNodeForKey(t){return this.partManager.findNodeForKey(t)}findLinkForKey(t){return this.partManager.findLinkForKey(t)}findPartForData(t){return this.partManager.findPartForData(t)}findNodeForData(t){return this.partManager.findNodeForData(t)}findLinkForData(t){return this.partManager.findLinkForData(t)}findNodesByExample(...t){return this.partManager.findNodesByExample(...t)}findLinksByExample(...t){return this.partManager.findLinksByExample(...t)}get nodeTemplate(){return this.Ur.get("")}set nodeTemplate(t){let e=this.Ur.get("");e!==t&&(this.Ur.set("",t),this.t("nodeTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get nodeTemplateMap(){return this.Ur}set nodeTemplateMap(t){let e=this.Ur;e!==t&&(this.Ur=t,this.t("nodeTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplate(){return this.Qh.get("")}set groupTemplate(t){let e=this.Qh.get("");e!==t&&(this.Qh.set("",t),this.t("groupTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplateMap(){return this.Qh}set groupTemplateMap(t){let e=this.Qh;e!==t&&(this.Qh=t,this.t("groupTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplate(){return this.ql.get("")}set linkTemplate(t){let e=this.ql.get("");e!==t&&(this.ql.set("",t),this.t("linkTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplateMap(){return this.ql}set linkTemplateMap(t){let e=this.ql;e!==t&&(this.ql=t,this.t("linkTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get isMouseCaptured(){return this.aM}set isMouseCaptured(t){let e=this.ft;if(e===null)return;let i=e.Tt;i instanceof SVGElement||(t?(this.lastInput.bubbles=!1,this.Pi(i,"pointermove",this.na,!1),this.Pi(i,"pointerdown",this.Zl,!1),this.Pi(i,"pointerup",this.oa,!1),this.Pi(i,"pointerout",this.ra,!1),this.Pi(i,"pointercancel",this.la,!1),this.Ut(A,"pointermove",this.na,!0),this.Ut(A,"pointerdown",this.Zl,!0),this.Ut(A,"pointerup",this.oa,!0),this.Ut(A,"pointerout",this.ra,!0),this.Ut(A,"pointercancel",this.la,!0),this.Pi(i,"wheel",this.sa,!1),this.Ut(A,"wheel",this.sa,!0),this.Ut(A,"selectstart",this.jh,!1)):(this.Pi(A,"pointermove",this.na,!0),this.Pi(A,"pointerdown",this.Zl,!0),this.Pi(A,"pointerup",this.oa,!0),this.Pi(A,"pointerout",this.ra,!0),this.Pi(A,"pointercancel",this.la,!0),this.Ut(i,"pointermove",this.na,!1),this.Ut(i,"pointerdown",this.Zl,!1),this.Ut(i,"pointerup",this.oa,!1),this.Ut(i,"pointerout",this.ra,!1),this.Ut(i,"pointercancel",this.la,!1),this.Pi(A,"wheel",this.sa,!0),this.Pi(A,"selectstart",this.jh,!1),this.Ut(i,"wheel",this.sa,!1)),this.aM=t)}get position(){return this.at}set position(t){if(this.at.equals(t))return;let e=P.l().a(this.at),i=this.viewportBounds.copy();if(this.at.a(t),this.animationManager.yL(e,this.at),!this.Ht&&!(this.ft===null&&!this.Iu.isReal())){this.Ht=!0;let s=this.scale,n=this.xt/s,o=this.bt/s;this.DM(this.zm,n,o,this.Fc,!1),this.Ht=!1}else this.Ql(),this.kb();if(!this.Ht){let s=this.viewportBounds;this.onViewportBoundsChanged(i,s,this.tt,!1)}P.e(e)}get initialPosition(){return this.Sx}set initialPosition(t){this.Sx.equals(t)||(this.Sx=t.P())}get initialScale(){return this.Mx}set initialScale(t){this.Mx!==t&&(f.s(t,"number",q,"initialScale"),this.Mx=t)}get grid(){return this.Ze===null&&(this.Ze=this.BL()),this.Ze}set grid(t){let e=this.Ze;if(e!==t){e===null&&(this.Ze=this.BL(),e=this.Ze),t.type!==H.Grid&&f.o("Diagram.grid must be a Panel of type Panel.Grid");let i=e.panel;i!==null&&i.remove(e),this.Ze=t,t.name="GRID",i!==null&&i.add(t),this.Eu=!1,this.S(),this.t("grid",e,t)}}get viewportBounds(){return this.sb}Ql(){let t=this.sb,e=this.at,i=this.tt;t.i(e.x,e.y,Math.max(this.xt,0)/i,Math.max(this.bt,0)/i),this._l()}get viewSize(){return this.Iu}set viewSize(t){let e=this.viewSize;if(!e.equals(t)){t=t.P(),this.Iu=t;let i=0,s=0;t.isReal()?(i=t.width,s=t.height):this.St!==null&&(i=this.St.clientWidth||1,s=this.St.clientHeight||1),this.xt=i,this.bt=s,this.Ql(),this.invalidateDocumentBounds(),this.t("viewSize",e,t),this.S()}}get fixedBounds(){return this.Ax}set fixedBounds(t){let e=this.Ax;e.equals(t)||((t.width===-1/0||t.height===1/0||t.height===-1/0)&&f.o("fixedBounds width/height must not be Infinity"),t=t.P(),this.Ax=t,this.invalidateDocumentBounds(),this.t("fixedBounds",e,t))}get scrollMargin(){return this.$h}set scrollMargin(t){typeof t=="number"&&(t=new Lt(t));let e=this.$h;e.equals(t)||(t=t.P(),this.$h=t,this.t("scrollMargin",e,t),this.mu())}get scrollMode(){return this.qh}set scrollMode(t){let e=this.qh;e!==t&&(this.qh=t,t===1&&this.Bs(!1),this.t("scrollMode",e,t),this.aa(),this.S())}get scrollsPageOnFocus(){return this.Tx}set scrollsPageOnFocus(t){let e=this.Tx;e!==t&&(f.s(t,"boolean",q,"scrollsPageOnFocus"),this.Tx=t,this.t("scrollsPageOnFocus",e,t))}get positionComputation(){return this.Dx}set positionComputation(t){let e=this.Dx;e!==t&&(t!==null&&f.k(t,q,"positionComputation"),this.Dx=t,this.Bs(!1),this.t("positionComputation",e,t))}get scaleComputation(){return this.Fx}set scaleComputation(t){let e=this.Fx;e!==t&&(t!==null&&f.k(t,q,"scaleComputation"),this.Fx=t,this._L(this.scale,this.scale),this.t("scaleComputation",e,t))}get documentBounds(){return this.zm}eA(t){this.ta=!1;let e=this.zm;e.equals(t)||(e=e.copy(),this.zm.a(t),this.Bs(!1),this.D("DocumentBoundsChanged",void 0,e),this.aa(),this.S())}ensureBounds(){if(this.ta){let t=z.l();this.eA(this.computeBounds(t)),z.e(t)}}get isVirtualized(){return this.nb}set isVirtualized(t){let e=this.nb;e!==t&&(f.s(t,"boolean",q,"isVirtualized"),this.nb=t,this.t("isVirtualized",e,t))}get scale(){return this.tt}set scale(t){let e=this.tt;e!==t&&this._L(e,t)}get defaultScale(){return this.Km}set defaultScale(t){this.Km=t}get autoScale(){return this.jl}set autoScale(t){let e=this.jl;e!==t&&(this.jl=t,this.t("autoScale",e,t),t!==1&&this.Bs(!1))}get initialAutoScale(){return this.Sr}set initialAutoScale(t){let e=this.Sr;e!==t&&(this.Sr=t,this.t("initialAutoScale",e,t))}get initialViewportSpot(){return this.vx}set initialViewportSpot(t){let e=this.vx;e!==t&&(t.isSpot()||f.o("initialViewportSpot must be a specific Spot: "+t),this.vx=t,this.t("initialViewportSpot",e,t))}get initialDocumentSpot(){return this.Rx}set initialDocumentSpot(t){let e=this.Rx;e!==t&&(t.isSpot()||f.o("initialViewportSpot must be a specific Spot: "+t),this.Rx=t,this.t("initialDocumentSpot",e,t))}get minScale(){return this.Nx}set minScale(t){let e=this.Nx;e!==t&&(t>0?(this.Nx=t,this.t("minScale",e,t),t>this.scale&&(this.scale=t)):f.W(t,"> 0",q,"minScale"))}get maxScale(){return this.Cx}set maxScale(t){let e=this.Cx;e!==t&&(t>0?(this.Cx=t,this.t("maxScale",e,t),t<this.scale&&(this.scale=t)):f.W(t,"> 0",q,"maxScale"))}get zoomPoint(){return this.Lx}set zoomPoint(t){this.Lx.equals(t)||(t=t.P(),this.Lx=t)}get contentAlignment(){return this.Fc}set contentAlignment(t){let e=this.Fc;e.equals(t)||(t=t.P(),this.Fc=t,this.t("contentAlignment",e,t),this.Bs(!1))}get initialContentAlignment(){return this.Om}set initialContentAlignment(t){let e=this.Om;e.equals(t)||(t=t.P(),this.Om=t,this.t("initialContentAlignment",e,t))}get padding(){return this.Zt}set padding(t){typeof t=="number"&&(t=new Lt(t));let e=this.Zt;e.equals(t)||(t=t.P(),this.Zt=t,this.invalidateDocumentBounds(),this.t("padding",e,t))}get partManager(){return this.pM}set partManager(t){let e=this.pM;e!==t&&(t.diagram!==null&&f.o("Cannot share PartManagers between Diagrams: "+t.toString()),e&&e.Mo(null),this.pM=t,t.Mo(this))}get nodes(){return this.partManager.nodes.iterator}get links(){return this.partManager.links.iterator}get parts(){return this.partManager.parts.iterator}findTopLevelNodesAndLinks(){let t=new I,e=this.nodes;for(;e.next();){let s=e.value;s.isTopLevel&&t.add(s)}let i=this.links;for(;i.next();){let s=i.value;s.isTopLevel&&t.add(s)}return t.iterator}findTopLevelGroups(){return this.zr.iterator}get routers(){return this.Vc}doLinkRouting(t){this.Co=!0;let e=this.Vc.r;for(let i=0;i<e.length;i++)e[i].canRoute(t)&&e[i].routeLinks(this.Mr,t);this.Co=!1}get layout(){return this.ie}set layout(t){let e=this.ie;e!==t&&(this.ie=t,t.diagram=this,t.group=null,this.Vr=!0,this.t("layout",e,t),this.requestUpdate())}layoutDiagram(t){this.Mi(),t&&this.Cb(!0),this.ys?this.vM(!1,this.bl||this.Vc.count!==0&&this.Gn.size!==0):(this.vc=!0,this.ur())}Cb(t){let e=this.zr.iterator;for(;e.next();)this.sA(e.value,t);this.layout&&(t?this.layout.isValidLayout=!1:this.layout.invalidateLayout())}sA(t,e){if(t===null)return;let i=t.ca.iterator;for(;i.next();){let s=i.value;this.sA(s,e)}t.layout!==null&&(e?t.layout.isValidLayout=!1:t.layout.invalidateLayout())}vM(t,e){if(this.Gx)return;let i=this.X;this.X=!0;let s="Layout",n=this.undoManager.transactionLevel,o=this.layout,r=this.animationManager;try{n===0&&(this.undoManager.wl=!0,this.startTransaction(s)),n<=1&&!r.defaultAnimation.isAnimating&&!r.pi&&(t||r.Fl(s)),this.Vr=!1;let a=this.zr.iterator;for(;a.next();)this.nA(a.value,t,n,e);let h=!1;if(o.isValidLayout||(!t||o.isRealtime||o.isRealtime===null||n===0?(o.doLayout(this),this.t0(this),h=!0,o.isValidLayout=!0):this.Vr=!0),h||this.t0(this),this.doLinkRouting(this),this.Mr.clear(),this.Zh.size!==0){for(let l=0;l<23&&this.Zh.size!==0;l++){for(a=this.zr.iterator;a.next();)this.oA(a.value);let c=this.Mr;this.Mr=this.Zh,this.Zh=c,this.t0(this),this.doLinkRouting(this)}this.Mr.clear(),this.Zh.clear()}}finally{let a=this.undoManager.wl;n===0&&(this.commitTransaction(s),this.undoManager.wl=!1),a&&(n===0||n===1)&&r.OS(),this.Vr&&(this.Vr=!o.isValidLayout),this.X=i}}nA(t,e,i,s){let n=t.ca.iterator;for(;n.next();)this.nA(n.value,e,i,s);let o=t.layout;o!==null&&!o.isValidLayout?!e||o.isRealtime||i===0?(t.fa=!t.location.isReal(),o.doLayout(t),t.invalidateLayout(32),this.Pb(t),this.t0(t),this.doLinkRouting(t),o.isValidLayout=!0):(this.doLinkRouting(t),this.Vr=!0):s&&this.doLinkRouting(t)}oA(t){let e=t.ca.iterator;for(;e.next();)this.oA(e.value);this.t0(t),this.doLinkRouting(t)}get isTreePathToChildren(){return this.Ox}set isTreePathToChildren(t){let e=this.Ox;if(e!==t&&(f.s(t,"boolean",q,"isTreePathToChildren"),this.Ox=t,this.t("isTreePathToChildren",e,t),!this.undoManager.isUndoingRedoing)){let i=this.nodes;for(;i.next();)i.value.r0()}}findTreeRoots(){let t=new G,e=this.nodes;for(;e.next();){let i=e.value;i.isTopLevel&&i.findTreeParentLink()===null&&t.add(i)}return t.iterator}get treeCollapsePolicy(){return this.Ix}set treeCollapsePolicy(t){let e=this.Ix;e!==t&&(t!==1&&t!==2&&t!==3&&f.o("Unknown Diagram.treeCollapsePolicy: "+t),this.Ix=t,this.t("treeCollapsePolicy",e,t))}get isCollapsingExpanding(){return this._S}set isCollapsingExpanding(t){this._S=t}rR(){let t=new pt,e=new pt;function i(s){let n=s.toLowerCase(),o=new G;t.set(s,o),t.set(n,o),e.set(s,s),e.set(n,s)}i("InitialAnimationStarting"),i("AnimationStarting"),i("AnimationFinished"),i("BackgroundSingleClicked"),i("BackgroundDoubleClicked"),i("BackgroundContextClicked"),i("ClipboardChanged"),i("ClipboardPasted"),i("DocumentBoundsChanged"),i("ExternalObjectsDropped"),i("GainedFocus"),i("InitialLayoutCompleted"),i("LayoutCompleted"),i("LinkDrawn"),i("LinkRelinked"),i("LinkReshaped"),i("LostFocus"),i("Modified"),i("ObjectSingleClicked"),i("ObjectDoubleClicked"),i("ObjectContextClicked"),i("PartCreated"),i("PartResized"),i("PartRotated"),i("SelectionMoved"),i("SelectionCopied"),i("SelectionDeleting"),i("SelectionDeleted"),i("SelectionGrouped"),i("SelectionUngrouped"),i("ChangingSelection"),i("ChangedSelection"),i("SubGraphCollapsed"),i("SubGraphExpanded"),i("TextEdited"),i("ThemeChanged"),i("TreeCollapsed"),i("TreeExpanded"),i("ViewportBoundsChanged"),i("InvalidateDraw"),this.ZS=t,this.QS=e}YL(t){let e=this.QS.get(t);return e!==null?e:this.QS.get(t.toLowerCase())}KM(t){let e=this.ZS.get(t);if(e!==null)return e;let i=t.toLowerCase();if(e=this.ZS.get(i),e!==null)return e;f.o("Unknown DiagramEvent name: "+t)}addDiagramListener(t,e){f.s(t,"string",q,"addDiagramListener:name"),f.k(e,q,"addDiagramListener:listener");let i=this.KM(t);return i!==null&&i.add(e),this}removeDiagramListener(t,e){f.s(t,"string",q,"removeDiagramListener:name"),f.k(e,q,"addDiagramListener:listener");let i=this.KM(t);i!==null&&i.delete(e)}raiseDiagramEvent(t,e,i){this.D(t,e,i)}D(t,e,i){let s=this.KM(t),n=new Wi;n.diagram=this;let o=this.YL(t);o!==null&&(n.name=o),e!==void 0&&(n.subject=e),i!==void 0&&(n.parameter=i);let r=s.length;if(r===1)s.elt(0)(n);else if(r!==0){let a=s.toArray();for(let h=0;h<r;h++){let l=a[h];l(n)}}}isUnoccupied(t,e){return this.getPositions(!1,null,e||null).isUnoccupied(t.x,t.y,t.width,t.height)}computeOccupiedArea(t){return this.isVirtualized?this.viewportBounds.copy():this.ta?this.zL(t):t.a(this.documentBounds)}getPositions(t,e,i){let s=this.Hl;s===null&&(this.Hl=s=new Et(this.avoidanceCellSize));let n=e;if(s.Fo||s.ua!==n||s.jM!==i){if(s.HM=Math.max(s.Yc+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.width)),s.qM=Math.max(s.Yc+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.height)),n!==null&&(n=this.rA(n)),n===null){let o=z.l();this.computeOccupiedArea(o),o.inflate(100,100),s.Lb(o);let r=this.nodes;for(;r.next();){let a=r.value,h=a.layer;h===null||!h.visible||h.isTemporary||this.WM(a,i,o)}z.e(o)}else{if(n.memberParts.count>0){let a=this.computePartsBounds(n.memberParts,!1);a.inflate(20,20),s.Lb(a)}let o=z.l(),r=n.memberParts;for(;r.next();){let a=r.value;a instanceof rt&&this.WM(a,i,o)}z.e(o)}s.ua=n,s.jM=i,s.Fo=!1}else t&&s.lA();return s}get avoidanceCellSize(){return this.uM}set avoidanceCellSize(t){this.Hl=null,this.uM=new Q(Math.max(1,t.width),Math.max(1,t.height))}get avoidanceLimit(){return this.dM}set avoidanceLimit(t){this.dM=Math.max(1,t)}rA(t){return t.canAvoid()?t:t.containingGroup!==null?this.rA(t.containingGroup):null}WM(t,e,i){if(t===e||!t.isVisible())return;let s=t.canAvoid();if(s){let n=t.getAvoidableRect(i);this.Hl.VR(n.x,n.y,n.width,n.height)}if(t instanceof ft&&(!s||t.avoidableMembers)){let n=t.memberParts;for(;n.next();){let o=n.value;o instanceof rt&&this.WM(o,e,i)}}}JM(t){this.Hl!==null&&!this.Hl.Fo&&(t===void 0||t.canAvoid())&&(this.Hl.Fo=!0)}get autoScrollInterval(){return this.Im}set autoScrollInterval(t){let e=this.Im;e!==t&&(this.Im=t,this.t("autoScrollInterval",e,t))}get autoScrollRegion(){return this.Em}set autoScrollRegion(t){typeof t=="number"&&(t=new Lt(t));let e=this.Em;e.equals(t)||(t=t.P(),this.Em=t,this.invalidateDocumentBounds(),this.t("autoScrollRegion",e,t))}doAutoScroll(t){this.Gm.a(t),this.computeAutoScrollPosition(this.Gm).equalsApprox(this.position)?this.stopAutoScroll():this.hA()}hA(){if(this.Rc!==-1)return;let t=this.Im,e=this;this.Rc=f.ir(()=>{if(e.Rc===-1||(e.stopAutoScroll(),e.lastInput.event===null))return;let i=e.computeAutoScrollPosition(e.Gm);if(i.equalsApprox(e.position))return;e.position=i,e.lastInput.documentPoint=e.transformViewToDoc(e.Gm),e.doMouseMove(),e.ta=!0;let s=z.l();e.computeBounds(s),s.unionRect(e.documentBounds),e.eA(s),z.e(s),e.Ue=!0,e.maybeUpdate(),e.hA()},t)}stopAutoScroll(){this.Rc!==-1&&(f.Tg(this.Rc),this.Rc=-1)}computeAutoScrollPosition(t){let e=this.position,i=this.Em;if(i.top<=0&&i.left<=0&&i.right<=0&&i.bottom<=0)return e;let s=this.viewportBounds,n=this.scale,o=z.V(0,0,s.width*n,s.height*n),r=P.V(0,0);if(t.x>=o.x&&t.x<o.x+i.left&&this.allowHorizontalScroll){let a=Math.max(this.scrollHorizontalLineChange,1);a=a|0,r.x-=a,t.x<o.x+i.left/2&&(r.x-=a),t.x<o.x+i.left/4&&(r.x-=4*a)}else if(t.x<=o.x+o.width&&t.x>o.x+o.width-i.right&&this.allowHorizontalScroll){let a=Math.max(this.scrollHorizontalLineChange,1);a=a|0,r.x+=a,t.x>o.x+o.width-i.right/2&&(r.x+=a),t.x>o.x+o.width-i.right/4&&(r.x+=4*a)}if(t.y>=o.y&&t.y<o.y+i.top&&this.allowVerticalScroll){let a=Math.max(this.scrollVerticalLineChange,1);a=a|0,r.y-=a,t.y<o.y+i.top/2&&(r.y-=a),t.y<o.y+i.top/4&&(r.y-=4*a)}else if(t.y<=o.y+o.height&&t.y>o.y+o.height-i.bottom&&this.allowVerticalScroll){let a=Math.max(this.scrollVerticalLineChange,1);a=a|0,r.y+=a,t.y>o.y+o.height-i.bottom/2&&(r.y+=a),t.y>o.y+o.height-i.bottom/4&&(r.y+=4*a)}return r.equalsApprox(P.xo)||(e=new P(e.x+r.x/n,e.y+r.y/n)),z.e(o),P.e(r),e}makeSvg(t){this.Wl.has("SVG")||this.addRenderer("SVG",new Ri(this,A.document));let e=new Ri(this,A.document,!0);t===void 0&&(t={});let i=this;function s(n,o){let r=i.aA(n,"SVG",e),a=r!==null?r.svg:null;return f.it(o)?(o(a),null):a}return this.cA(s,t)}makeSVG(t){return this.makeSvg(t)}addRenderer(t,e){this.Wl.set(t,e)}removeRenderer(t){this.Wl.delete(t)}cacheGroupExternalLinks(t){this.MM=t,t||this.nodes.each(e=>{e instanceof ft&&(e.l0=null)})}cA(t,e){let i=e.callback,s=!0,n=this.Jl.iterator;for(;n.next();)if(!n.value[0].hn){s=!1;break}if(!f.it(i)||s)return t(e,i,this);let o=this;function r(){let l=+new Date;for(s=!0,n.reset();n.next();)if(!n.value[0].hn){s=!1;break}if(s||l-h>a){t(e,i,o);return}A.requestAnimationFrame(r)}let a=e.callbackTimeout||300,h=+new Date;return A.requestAnimationFrame(()=>r()),null}makeImage(t){return q.isUsingDOM()?(t===void 0&&(t={}),t.returnType="Image",this.makeImageData(t)):null}makeImageData(t){return t===void 0&&(t={}),this.cA(this.zR,t)}static img="image";zR(t,e,i){let s=i.aA(t,"canvas",null);if(s===null)return null;let n=s.E.canvas,o=null;if(n!==null){let r=t.returnType;switch(r===void 0?r="string":r=r.toLowerCase(),r){case q.img+"data":o=s.getImageData(0,0,n.width,n.height);break;case q.img:let a=(t.document||document).createElement("img");a.src=n.toDataURL(t.type,t.details),o=a;break;case"blob":{let h=n;return f.it(e)||(o="",f.o('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.')),f.it(h.toBlob)?(h.toBlob(e,t.type,t.details),"toBlob"):(e(null),null)}case"string":default:o=n.toDataURL(t.type,t.details)}}return f.it(e)?(e(o),null):o}static XR=!1;aA(t,e,i){if(this.animationManager.stopAnimation(),this.maybeUpdate(),this.ft===null)return null;f.Y(t)||f.o("properties argument must be an Object.");let s=!1,n=t.size||null,o=t.scale||null;t.scale!==void 0&&isNaN(t.scale)&&(o="NaN");let r=t.maxSize;t.maxSize===void 0&&(s=!0,e==="SVG"?r=new Q(1/0,1/0):r=new Q(2e3,2e3));let a=t.position||null,h=t.parts||null;Array.isArray(h)&&(h=new G(h));let l=t.padding===void 0?1:t.padding,c=t.background||null,u=t.omitTemporary;u===void 0&&(u=!0);let d=t.document||document,g=t.elementFinished||null,p=t.showTemporary;p===void 0&&(p=!u);let m=t.showGrid;m===void 0&&(m=p),n!==null&&isNaN(n.width)&&isNaN(n.height)&&(n=null),typeof l=="number"?l=new Lt(l):l instanceof Lt||f.o("MakeImage padding must be a Margin or a number."),l.left=Math.max(l.left,0),l.right=Math.max(l.right,0),l.top=Math.max(l.top,0),l.bottom=Math.max(l.bottom,0),this.Qt.clearContextCache(!0);let y=new Ue(null,d,void 0,!0),w=y.li;if(!(n||o||h||a))return y.width=this.xt+Math.ceil(l.left+l.right),y.height=this.bt+Math.ceil(l.top+l.bottom),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.jr=d,i.Yu=g,this.Sb(i.li,l,new Q(y.width,y.height),this.tt,this.at,h,c,p,m),i.li):(this.Bu=!1,this.Sb(w,l,new Q(y.width,y.height),this.tt,this.at,h,c,p,m),this.Bu=!0,y.li);let b=this.Km,v=this.documentBounds.copy();if(v.subtractMargin(this.Zt),p){let R=this.Xt.r,O=R.length;for(let B=0;B<O;B++){let X=R[B];if(!X.visible||!X.isTemporary)continue;let Y=X.Ct.r,j=Y.length;for(let U=0;U<j;U++){let nt=Y[U];if(!nt.isInDocumentBounds||!nt.isVisible())continue;let at=nt.actualBounds;at.isReal()&&v.unionRect(at)}}}let k=new P(v.x,v.y);if(h!==null){let R=new z(0,0,0,0),O=!0,B=h.iterator;for(B.reset();B.next();){let X=B.value;if(!(X instanceof Nt))continue;let Y=X.layer;if(Y!==null&&!Y.visible||Y!==null&&!p&&Y.isTemporary||!X.isVisible())continue;let j=X.actualBounds;j.isReal()&&(O?(O=!1,R.a(j)):R.unionRect(j))}v.width=R.width,v.height=R.height,k.x=R.x,k.y=R.y}a!==null&&a.isReal()&&(k=a,o||(o=b));let S=0,M=0;l!==null&&(S=l.left+l.right,M=l.top+l.bottom);let F=0,T=0;n!==null&&(F=n.width,T=n.height,isFinite(F)&&(F=Math.max(0,F-S)),isFinite(T)&&(T=Math.max(0,T-M)));let N=0,C=0;if(n!==null&&o!==null?(o==="NaN"&&(o=b),n.isReal()?(N=F,C=T):isNaN(T)?(N=F,C=v.height*o):(N=v.width*o,C=T)):n!==null?n.isReal()?(o=Math.min(F/v.width,T/v.height),N=F,C=T):isNaN(T)?(o=F/v.width,N=F,C=v.height*o):(o=T/v.height,N=v.width*o,C=T):o!==null?o==="NaN"&&r.isReal()?(o=Math.min((r.width-S)/v.width,(r.height-M)/v.height),o>b?(o=b,N=v.width,C=v.height):(N=r.width,C=r.height)):(N=v.width*o,C=v.height*o):(o=b,N=v.width,C=v.height),l!==null?(N+=S,C+=M):l=new Lt(0),r!==null){let R=r.width,O=r.height;e!=="SVG"&&s&&q.XR,isNaN(R)&&(R=2e3),isNaN(O)&&(O=2e3),isFinite(R)&&(N=Math.min(N,R)),isFinite(O)&&(C=Math.min(C,O))}return y.width=Math.ceil(N),y.height=Math.ceil(C),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.jr=d,i.Yu=g,this.Sb(i.li,l,new Q(Math.ceil(N),Math.ceil(C)),o,k,h,c,p,m),i.li):(this.Bu=!1,this.Sb(w,l,new Q(Math.ceil(N),Math.ceil(C)),o,k,h,c,p,m),this.Bu=!0,y.li)}static Xu=null;static fA="5da73c80a36555d4038e4972187c3cae51fd22";static gw=!1;static Yk=()=>{if(q.fA[5]===void 0&&(Pt.prototype.$e=Pt.prototype.bw),!q.isUsingDOM())return;let t=f.hs("canvas"),e=t.getContext("2d"),i=f.Ts("7ca11abfd022028846");e[i]=f.Ts("398c3597c01238");let s="7ca11abfd7330390",n=[q.fA,f.gw+"4ae6247590da4bb21c324ba3a84e385776",Pt.Yk+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",L.za],o=10,r=0;for(let a=1;a<5;a++)e[f.Ts(s)](f.Ts(n[a-1]),o,a*15+r);e[i]=f.Ts("39f046ebb36e4b");for(let a=1;a<5;a++)e[f.Ts(s)](f.Ts(n[a-1]),o,a*15+r);(n.length!==4||n[0][0]!=="5"||n[3][0]!=="7")&&(Pt.prototype.$e=Pt.prototype.bw),q.Xu=t}}class _o{uA;dA;$M;Ne;constructor(t){if(this.uA=null,this.dA="63ad05bbe23a1786468a4c741b6d2",this.$M="@onz",this.dA===this._tk){this.$M=!0,this.Ne=this.$M;return}this.Ne=null}GR(t,e){let i="f",s=A[f.Ts("76a715b2f73f148a")][f.Ts("72ba13b5")]||"",n=f.Ts;if(this.Ne=!0,!q.isUsingDOM())return;let o=q[n("76a115b6ed251eaf4692")];if(!o){let a=s[n("76ad18b4f73e")];for(let l=s[n("73a612b6fb191d")](n("35e7"))+2;l<a;l++)i+=s[l];let h=i[n("73a612b6fb191d")](n("7da71ca0ad381e90"));this.Ne=!(h>=0&&h<i[n("73a612b6fb191d")](n("35")));return}let r=q.XM.iterator;for(;r.next();){o=r.value;let a=n(o).split(n("39e9"));if(a.length<6)return;let h=n(a[1]).split(".");if(a[4]!=="7da71ca0")return;let l=n(f[n("6cae19")]).split(".");if(!(h[0]>l[0]||h[0]===l[0]&&h[1]>=l[1]))continue;let c="73a612b6fb191d",u=A[n("74a900bae4370f8b51")][n("6fbb13a1c2311e8a57")].toLowerCase(),d=u[n(c)](n("3aad1ab6e022098b4dc4")),g=n(a[2]);if(d>-1){let N=u[n(c)](g.toLowerCase()+"/");if(this.Ne=!(N>-1&&N<d),!this.Ne)return}let p=s[n("76ad18b4f73e")];for(let N=s[n(c)](n("35e7"))+2;N<p;N++)i+=s[N];let m=i[n(c)](g);if(m<0&&g!==n("7da71ca0ad381e90")&&(m=i[n(c)](n("76a715b2ef3e149757"))),m<0&&(m=i[n(c)](n("76a715b2ef3e149757"))),m<0&&(m=i[n(c)](n("2bfa41fdb3784bca12"))),m<0&&(m=s[n(c)](n("7baa19a6f76c1988428554"))),m<0&&(m=s[n(c)](n("7ea902b2b9221e9c57c45767196566"))),this.Ne=!(m>=0&&m<i[n(c)](n("35"))||i[n(c)](n("35"))===-1),!this.Ne||s[n(c)](n("7fb002b6ed25128b4da25b2e"))&&(this.Ne=!(s[n(c)](g)>-1),!this.Ne))return;let y=A[f.Ts("76a715b2f73f148a")][f.Ts("69ad17a1e03e")],w=y[n(c)](n("7fb002b6ed25128b4da25b2e"));if(w>-1&&(this.Ne=!(y[n(c)](g)>w),!this.Ne))return;let b=g;if(b[0]!=="#")continue;let v=f.hs("div"),k=a[0].replace(/[A-Za-z]/g,"");for(;k.length<4;)k+="9";let S=k;k=k.substring(k.length-4);let M="",F=["gsh","gsf"],T=["Header","Background","Display","Feedback"];if(M+=F[parseInt(k.substring(0,1),10)%2],M+=T[parseInt(k.substring(0,1),10)%4],v[n("79a417a0f0181a8946")]=M,A.document[n("78a712aa")]){A.document[n("78a712aa")][n("7bb806b6ed32388c4a875b")](v);let N=A.getComputedStyle(v).getPropertyValue(n("78a704b7e62456904c9b12701b6532a8")),C=A.getComputedStyle(v).getPropertyValue(n("75b817b0ea2202"));if(A.document[n("78a712aa")][n("68ad1bbcf533388c4a875b")](v),!N)continue;let R=A[n("77a902b0eb1b1e804a8a")],O="0."+parseInt(S,10)%100;if(C===O||N.indexOf(parseInt(b[1]+b[2],16))!==-1&&N.indexOf(parseInt(b[3]+b[4],16))!==-1){this.Ne=!1;return}else if(R&&R(n("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches){M="."+M;for(let B=0;B<document.styleSheets.length;B++){let X=document.styleSheets[B].rules||document.styleSheets[B].cssRules;for(let Y in X)if(M===X[Y].selectorText){this.Ne=!1;return}}}}else this.Ne=null,e&&(this.Ne=!1)}}Xu(t){return t.Qt.setTransform(t.Vi,0,0,t.Vi,0,0),t.Qt.commitTransform(),this.Ne===null&&this.GR(t,!0),0<this.Ne&&this!==this.uA}}class ni{ZM;QM;constructor(t){this.ZM=t===void 0?new P:t,this.QM=new P}get point(){return this.ZM}set point(t){this.ZM=t}get shifted(){return this.QM}set shifted(t){this.QM=t}}class tr{Me;WL;Nb;constructor(t,e,i){this.Me=t,this.WL=e,this.Nb=i}}class Qi{isGridSnapEnabled;isGridSnapRealtime;gridSnapCellSize;gridSnapCellSpot;gridSnapOrigin;dragsLink;dragsTree;groupsSnapMembers;groupsAlwaysMove;dragsMembers;constructor(t){this.Ri(),t&&Object.assign(this,t)}Ri(){this.isGridSnapEnabled=!1,this.isGridSnapRealtime=!0,this.gridSnapCellSize=new Q(NaN,NaN).u(),this.gridSnapCellSpot=D.TopLeft,this.gridSnapOrigin=new P(NaN,NaN).u(),this.dragsLink=!1,this.dragsTree=!1,this.groupsSnapMembers=!1,this.groupsAlwaysMove=!0,this.dragsMembers=!0}}class er extends q{constructor(t,e){let i;return t===void 0||typeof t=="string"||A.Element&&t instanceof Element?i=t:f.Y(t)&&(e=t),super(i),this.gA(),e&&this.setProperties(e),this}gA(){this.allowDragOut=!0,this.allowMove=!1,this.isReadOnly=!0,this.contentAlignment=D.TopCenter,this.layout=new ri}setupRouters(){}reset(){super.reset(),this.gA()}}class _i extends q{Ab;Tb;Db;Fb;h0;Kc;Al;_M;t2;Rb;i2;constructor(t,e){let i;return t===void 0||typeof t=="string"||A.Element&&t instanceof Element?i=t:f.Y(t)&&(e=t),super(i),this.animationManager.isEnabled=!1,this.Ht=!0,this.Ab=null,this.Ru=!1,this.vu=!1,this.Tb=!0,this.Db=!0,this.Fb=0,this.h0=!1,this.Kc=null,this.setRenderingHint("drawShadows",!1),this.Al=new Nt({selectable:!0,selectionAdorned:!1,selectionObjectName:"BOXSHAPE",locationObjectName:"BOXSHAPE",resizeObjectName:"BOXSHAPE",cursor:"move"}).add(new ct({name:"BOXSHAPE",fill:"transparent",stroke:"magenta",strokeWidth:2}).theme("stroke","overviewBox")).Et(),this.allowCopy=!1,this.allowDelete=!1,this.allowDrop=!1,this.allowSelect=!0,this.autoScrollRegion=new Lt(0,0,0,0),this.at.i(0,0),this.toolManager.Jt("Dragging",new ir,this.toolManager.mouseMoveTools),this.click=()=>{let s=this.observed;if(s===null)return;let n=s.viewportBounds,o=this.lastInput.documentPoint;s.position=new P(o.x-n.width/2,o.y-n.height/2)},this._M=s=>{this.invalidateDocumentBounds(),this.a0()},this.t2=s=>{this.observed!==null&&(this.invalidateDocumentBounds(),this.S())},this.Rb=s=>{this.updateDelay<1?this.S():this.h0||(this.h0=!0,f.ir(()=>this.redraw(),this.updateDelay))},this.i2=s=>{this.observed!==null&&this.a0()},this.autoScale=2,this.Ht=!1,e&&Object.assign(this,e),this}setupRouters(){}computePixelRatio(){return 1}redraw(){this.h0&&this.updateDelay>=1&&(this.h0=!1,this.YR()),super.redraw()}Ui(){if(this.St===null&&f.o("No div specified"),this.ft===null&&f.o("No canvas specified"),this.ft instanceof Ri||(this.box.JS(),!this.Ue))return;let t=this.observed;if(t===null||t.animationManager.defaultAnimation.isAnimating||!t.Vh)return;this.i0();let e=this.ft,i=this.Qt;if(i.clearContextCache(!0),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.width,e.height),this.updateDelay<1)this.mA();else if(this.Kc!==null){i.drawImage(this.Kc.Tt,0,0);let o=this.T;i.scale(this.Vi,this.Vi),i.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),i.commitTransform()}let s=this.Xt.r,n=s.length;for(let o=0;o<n;o++)s[o].Ui(i,this);this.Ic=!1,this.Ue=!1}YR(){let t=this.ft,e=this.Qt;if(!(t===null||e===null)){if(this.i0(),this.Kc===null){let i=new Ue(null);i.width=t.width,i.height=t.height,this.Kc=i}try{this.ft=this.Kc,this.Qt=this.ft.li,this.Qt.clearContextCache(!0),this.Qt.setTransform(1,0,0,1,0,0),this.Qt.clearRect(0,0,this.ft.width,this.ft.height),this.mA()}finally{this.ft=t,this.Qt=e}}}mA(){let t=this.observed;if(t===null)return;let e=this.drawsTemporaryLayers,i=this.drawsGrid&&e,s=t.grid;if(i&&s!==null&&s.visible&&!(isNaN(s.width)||isNaN(s.height))){let c=z.l().a(this.viewportBounds).unionRect(t.viewportBounds);t.th(c),z.e(c),t.Mi()}let n=this.T,o=this.Qt;o.scale(this.Vi,this.Vi),o.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),o.commitTransform();let r=this.viewportBounds,a=t.Xt.r,h=a.length,l=this.Xt.r;this.ps(l,l.length,this,this.viewportBounds);for(let c=0;c<h;c++)a[c].KF(o,r,this,e,i)}get observed(){return this.Ab}set observed(t){let e=this.Ab;if(t instanceof _i&&f.o("Overview.observed Diagram may not be an Overview itself: "+t),e!==t){if(e!==null&&this.KR(e),this.Ab=t,t!==null&&this.jR(t),this.invalidateDocumentBounds(),t===null){this.Kc=null;let i=this.ft,s=this.Qt;i&&s&&(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,i.width,i.height))}else this.Rb(null),this.a0(),this.S();this.t("observed",e,t)}}get box(){return this.Al}set box(t){let e=this.Al;e!==t&&(t.Et(),this.Al=t,this.remove(e),this.add(this.Al),this.a0(),this.t("box",e,t))}get drawsTemporaryLayers(){return this.Tb}set drawsTemporaryLayers(t){this.Tb!==t&&(this.Tb=t,this.redraw())}get drawsGrid(){return this.Db}set drawsGrid(t){this.Db!==t&&(this.Db=t,this.redraw())}get updateDelay(){return this.Fb}set updateDelay(t){t<0&&(t=0),this.Fb!==t&&(this.Fb=t)}jR(t){t!==null&&(t.addDiagramListener("ViewportBoundsChanged",this._M),t.addDiagramListener("DocumentBoundsChanged",this.t2),t.addDiagramListener("InvalidateDraw",this.Rb),t.addDiagramListener("AnimationFinished",this.i2),this.add(this.box))}KR(t){t!==null&&(this.remove(this.box),t.removeDiagramListener("ViewportBoundsChanged",this._M),t.removeDiagramListener("DocumentBoundsChanged",this.t2),t.removeDiagramListener("InvalidateDraw",this.Rb),t.removeDiagramListener("AnimationFinished",this.i2))}a0(){let t=this.box,e=this.observed;if(e===null)return;this.Ue=!0;let i=e.viewportBounds,s=t.selectionObject,n=Q.l();n.i(i.width,i.height),s.desiredSize=n,Q.e(n);let o=2/this.scale;s instanceof ct&&(s.strokeWidth=o),t.location=new P(i.x-o/2,i.y-o/2),t.isSelected=!0}computeBounds(){let t=this.observed;if(t===null)return z.Fg;let e=t.documentBounds.copy();return e.unionRect(t.viewportBounds),e}invalidateViewport(t,e){this.Ue!==!0&&(this.Ue=!0,this.requestUpdate())}onViewportBoundsChanged(t,e,i,s){this.Ht||(this._l(),this.S(),this.aa(),this.invalidateDocumentBounds(),this.a0(),this.Bi.scale=i,this.Bi.position.x=t.x,this.Bi.position.y=t.y,this.Bi.bounds.a(t),this.Bi.isScroll=s,this.D("ViewportBoundsChanged",this.Bi,t))}}class ir extends Dt{eh;constructor(){super(),this.eh=null}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||!t.allowMove||!t.allowSelect)return!1;let e=t.observed;if(e===null)return!1;let i=t.lastInput;if(!i.left||t.currentTool!==this&&(!this.isBeyondDragSize()||i.isTouchEvent&&i.timestamp-t.firstInput.timestamp<this.delay))return!1;if(this.findDraggablePart()===null){let s=e.viewportBounds;this.eh=new P(s.width/2,s.height/2);let n=t.firstInput.documentPoint;e.position=new P(n.x-this.eh.x,n.y-this.eh.y)}return!0}doActivate(){this.eh=null,super.doActivate()}doUpdateCursor(t){let e=this.diagram,i=e.box;i!==null&&i.cursor&&(e.currentCursor=i.cursor)}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram,n=s.observed;if(n===null)return;let o=s.box;if(o===null)return;if(this.eh===null){let a=s.firstInput.documentPoint,h=o.location;this.eh=new P(a.x-h.x,a.y-h.y)}let r=s.lastInput.documentPoint;n.position=new P(r.x-this.eh.x,r.y-this.eh.y)}}class be{N;e2;s2;o2;l2;h2;a2;c2;f2;nh;u2;vb;Ob;Ib;Eb;d2;Ro;g2;constructor(t){I.Ki(this),this.N=q.um(),this.e2=!0,this.s2=!0,this.o2=!0,this.l2=!1,this.h2=!1,this.a2=!1,this.c2=!1,this.f2=null,this.nh=null,this.u2=1.05,this.vb=NaN,this.Ob=null,this.Ib=NaN,this.Eb=z.Fg,this.d2=!1,this.Ro=null,this.g2=200,t&&Object.assign(this,t)}toString(){return"CommandHandler"}get diagram(){return this.N}Mo(t){this.N=t}doStart(){}doStop(){}doKeyDown(){let t=this.diagram,e=t.lastInput,i=f.tr?e.meta:e.control,s=e.shift,n=e.alt,o=e.commandKey;i&&(o==="Insert"||o==="c")?this.canCopySelection()&&this.copySelection():i&&o==="x"||s&&o==="Delete"?this.canCutSelection()&&this.cutSelection():i&&o==="v"||s&&o==="Insert"?this.canPasteSelection()&&this.pasteSelection():i&&o==="y"||i&&s&&o==="z"||n&&s&&o==="Backspace"?this.canRedo()&&this.redo():i&&o==="z"||n&&o==="Backspace"?this.canUndo()&&this.undo():o==="Delete"||o==="Backspace"?this.canDeleteSelection()&&this.deleteSelection():i&&o==="a"?this.canSelectAll()&&this.selectAll():o==="Escape"?this.canStopCommand()&&this.stopCommand():o==="ArrowUp"?t.allowVerticalScroll&&(i?t.scroll("pixel","up"):t.scroll("line","up")):o==="ArrowDown"?t.allowVerticalScroll&&(i?t.scroll("pixel","down"):t.scroll("line","down")):o==="ArrowLeft"?t.allowHorizontalScroll&&(i?t.scroll("pixel","left"):t.scroll("line","left")):o==="ArrowRight"?t.allowHorizontalScroll&&(i?t.scroll("pixel","right"):t.scroll("line","right")):o==="PageUp"?s&&t.allowHorizontalScroll?t.scroll("page","left"):t.allowVerticalScroll&&t.scroll("page","up"):o==="PageDown"?s&&t.allowHorizontalScroll?t.scroll("page","right"):t.allowVerticalScroll&&t.scroll("page","down"):o==="Home"?i&&t.allowVerticalScroll?t.scroll("document","up"):!i&&t.allowHorizontalScroll&&t.scroll("document","left"):o==="End"?i&&t.allowVerticalScroll?t.scroll("document","down"):!i&&t.allowHorizontalScroll&&t.scroll("document","right"):o==="Space"?this.canScrollToPart()&&this.scrollToPart():o==="Minus"||o==="NumpadSubtract"?this.canDecreaseZoom()&&this.decreaseZoom():o==="Equal"||o==="NumpadAdd"?this.canIncreaseZoom()&&this.increaseZoom():i&&o==="Digit0"?this.canResetZoom()&&this.resetZoom():s&&o==="z"?this.canZoomToFit()&&this.zoomToFit():i&&!s&&o==="g"?this.canGroupSelection()&&this.groupSelection():i&&s&&o==="g"?this.canUngroupSelection()&&this.ungroupSelection():o==="F2"?this.canEditTextBlock()&&this.editTextBlock():o==="ContextMenu"||s&&o==="F10"||i&&s&&o==="Backslash"?this.canShowContextMenu()&&this.showContextMenu():e.bubbles=!0}doKeyUp(){let t=this.diagram.lastInput;t.bubbles=!0}stopCommand(){let t=this.diagram,e=t.currentTool;e instanceof xe&&t.allowSelect&&t.clearSelection(),e!==null&&e.doCancel()}canStopCommand(){return!0}selectAll(){let t=this.diagram;t.S();try{t.currentCursor="wait",t.D("ChangingSelection",t.selection);let e=t.parts;for(;e.next();){let n=e.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let i=t.nodes;for(;i.next();){let n=i.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let s=t.links;for(;s.next();){let n=s.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}}finally{t.D("ChangedSelection",t.selection),t.currentCursor=""}}canSelectAll(){return this.diagram.allowSelect}deleteSelection(){let t=this.diagram;try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),t.startTransaction("Delete"),t.D("SelectionDeleting",t.selection);let e=new I,i=t.selection.iterator;for(;i.next();){let s=i.value;Nt.oh(e,s,!0,this.deletesTree?1/0:0,this.deletesConnectedLinks?null:!1,n=>n.canDelete())}t.removeParts(e,!0),t.D("SelectionDeleted",e)}finally{t.commitTransaction("Delete"),t.D("ChangedSelection",t.selection),t.currentCursor=""}}canDeleteSelection(){let t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowDelete||t.selection.count===0)}copySelection(){let t=this.diagram;try{let e=new I,i=t.selection.iterator;for(;i.next();){let s=i.value;Nt.oh(e,s,!0,this.copiesTree?1/0:0,this.copiesConnectedLinks,n=>n.canCopy())}this.copyToClipboard(e)}finally{}}canCopySelection(){let t=this.diagram;return!(!t.allowCopy||!t.allowClipboard||t.selection.count===0)}cutSelection(){this.copySelection(),this.deleteSelection()}canCutSelection(){let t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowCopy||!t.allowDelete||!t.allowClipboard||t.selection.count===0)}copyToClipboard(t){let e=this.diagram,i=null;if(t===null)q.OL();else{let s=null;try{s=e.copyParts(t,null,!0)}finally{i=new G,s!==null&&i.addAll(s.iteratorValues),q.Zm=i,q.xb=e.model.dataFormat}}e.D("ClipboardChanged",i)}pasteFromClipboard(){let t=new I,e=q.Zm;if(e===null)return t;let i=this.diagram;if(q.xb!==i.model.dataFormat)return t;let s=null;try{s=i.copyParts(e,i,!1)}finally{if(s!==null){let n=s.iterator;for(;n.next();){let o=n.value,r=n.key;o.location.isReal()||(r.location.isReal()?o.location=r.location:!o.position.isReal()&&r.position.isReal()&&(o.position=r.position)),t.add(o)}}}return t}pasteSelection(t){t===void 0&&(t=null);let e=this.diagram;try{e.currentCursor="wait",e.D("ChangingSelection",e.selection),e.startTransaction("Paste");let i=this.pasteFromClipboard();i.count>0&&e.clearSelection(!0);let s=i.iterator;for(;s.next();){let n=s.value;n.isSelected=!0}if(t!==null){let n=e.computePartsBounds(e.selection);if(n.isReal()){let o=this.computeEffectiveCollection(e.selection,e.pb);e.TP(o,new P(t.x-n.centerX,t.y-n.centerY),e.pb,!1)}}e.D("ClipboardPasted",i)}finally{e.commitTransaction("Paste"),e.D("ChangedSelection",e.selection),e.currentCursor=""}}canPasteSelection(t){let e=this.diagram;return!(e.isReadOnly||e.isModelReadOnly||!e.allowInsert||!e.allowClipboard||q.Zm===null||q.Zm.count===0||q.xb!==e.model.dataFormat)}undo(){this.diagram.undoManager.undo()}canUndo(){let t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canUndo()}redo(){this.diagram.undoManager.redo()}canRedo(){let t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canRedo()}decreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canDecreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}increaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canIncreaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}resetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.diagram;t<e.minScale||t>e.maxScale||(e.scale=t)}canResetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.diagram;return t<e.minScale||t>e.maxScale?!1:e.allowZoom}zoomToFit(){let t=this.diagram,e=t.animationManager;e.stopAnimation(),t.redraw();let i=t.position,s=t.scale;e.Fl("Zoom To Fit"),this.isZoomToFitRestoreEnabled&&s===this.Ib&&!isNaN(this.vb)&&this.Ob!==null&&t.documentBounds.equals(this.Eb)?(t.scale=this.vb,t.position=this.Ob,this.Ib=NaN,this.Eb=z.Fg):(this.vb=s,this.Ob=i.copy(),t.zoomToFit(),this.Ib=t.scale,this.Eb=t.documentBounds.copy()),e.OS()}canZoomToFit(){return this.diagram.allowZoom}scrollToPart(t){t===void 0&&(t=null);let e=this.diagram;if(e.ensureBounds(),t===null){try{this.Ro!==null&&(this.Ro.next()?t=this.Ro.value:this.Ro=null)}catch{this.Ro=null}t===null&&(e.highlighteds.count>0?this.Ro=e.highlighteds.iterator:e.selection.count>0&&(this.Ro=e.selection.iterator),this.Ro!==null&&this.Ro.next()&&(t=this.Ro.value))}if(t!==null){let i=e.animationManager;i.Fl("Scroll To Part");let s=this.scrollToPartPause;if(s>0){let n=this.jc(t,[t]);if(n.length===1)e.startTransaction(),e.centerRect(t.actualBounds),e.commitTransaction("Scroll To Part");else{let o=()=>{e.startTransaction();let a=n.pop();for(;n.length>0&&a instanceof rt&&a.isTreeExpanded&&(!(a instanceof ft)||a.isSubGraphExpanded);)a=n.pop();n.length>0?(a instanceof Nt&&e.scrollToRect(a.actualBounds),a instanceof rt&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof ft&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof Nt&&e.centerRect(a.actualBounds),e.removeDiagramListener("LayoutCompleted",r)),e.commitTransaction("Scroll To Part")},r=()=>{f.ir(o,(i.isEnabled?i.duration:0)+s)};e.addDiagramListener("LayoutCompleted",r),o()}}else{let n=e.position.copy();e.centerRect(t.actualBounds),n.equalsApprox(e.position)&&i.stopAnimation()}}}jc(t,e){if(t.isVisible())return e;if(t instanceof St){let i=t.adornedPart;i!==null&&this.jc(i,e)}else if(t instanceof _){let i=t.fromNode;i!==null&&this.jc(i,e);let s=t.toNode;s!==null&&this.jc(s,e)}else{if(t instanceof rt){let s=t.labeledLink;s!==null&&this.jc(s,e);let n=t.findTreeParentNode();n!==null&&(!n.isTreeExpanded&&!n.wasTreeExpanded&&e.push(n),this.jc(n,e))}let i=t.containingGroup;i!==null&&(!i.isSubGraphExpanded&&!i.wasSubGraphExpanded&&e.push(i),this.jc(i,e))}return e}canScrollToPart(t){if(t===void 0&&(t=null),t!==null&&!(t instanceof Nt))return!1;let e=this.diagram;return e.selection.count===0&&e.highlighteds.count===0?!1:e.allowHorizontalScroll&&e.allowVerticalScroll}collapseTree(t){t===void 0&&(t=null);let e=this.diagram,i="Collapse Tree";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new G;if(t!==null&&t.isTreeExpanded)t.collapseTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof rt&&o.isTreeExpanded&&(o.collapseTree(),s.add(o))}}e.D("TreeCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseTree(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof rt)||!t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof rt){if(!s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}expandTree(t){t===void 0&&(t=null);let e=this.diagram,i="Expand Tree";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new G;if(t!==null&&!t.isTreeExpanded)t.expandTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof rt&&(o.isTreeExpanded||(o.expandTree(),s.add(o)))}}e.D("TreeExpanded",s)}finally{e.commitTransaction(i)}}canExpandTree(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof rt)||t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof rt){if(s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}groupSelection(){let t=this.diagram,e=t.model;if(!e.Hc())return;let i=this.archetypeGroupData;if(i===null)return;let s=null;try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),t.startTransaction("Group");let n=new G,o=t.selection.iterator;for(;o.next();){let l=o.value;l.ke()&&l.canGroup()&&n.add(l)}let r=new G,a=n.iterator;for(;a.next();){let l=a.value,c=!1,u=n.iterator;for(;u.next();){let d=u.value;if(l.isMemberOf(d)){c=!0;break}}c||r.add(l)}let h=r.first();if(h!==null){let l=h.containingGroup;if(l!==null)for(;l!==null;){let c=!1,u=r.iterator;for(;u.next();)if(!u.value.isMemberOf(l)){c=!0;break}if(c)l=l.containingGroup;else break}if(i instanceof ft)i.Et(),s=i.copy(),s!==null&&t.add(s);else if(e.isGroupForData(i)){let c=e.copyNodeData(i);f.Y(c)&&(e.addNodeData(c),s=t.findNodeForData(c))}if(s!==null){l!==null&&this.isValidMember(l,s)&&(s.containingGroup=l);let c=r.iterator;for(;c.next();){let u=c.value;this.isValidMember(s,u)&&(u.containingGroup=s)}t.clearSelection(!0),s.isSelected=!0}}t.D("SelectionGrouped",s)}finally{t.commitTransaction("Group"),t.D("ChangedSelection",t.selection),t.currentCursor=""}}canGroupSelection(){let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowGroup||!t.model.Hc()||this.archetypeGroupData===null)return!1;let e=t.selection.iterator;for(;e.next();){let i=e.value;if(i.ke()&&i.canGroup())return!0}return!1}m2(t){let e=f.et();if(Array.isArray(t))t.forEach(n=>{n instanceof _||n instanceof Nt&&e.push(n)});else{let n=t.iterator;for(;n.next();){let o=n.value;o instanceof _||o instanceof Nt&&e.push(o)}}let i=new I,s=e.length;for(let n=0;n<s;n++){let o=e[n],r=!0;for(let a=0;a<s;a++)if(o.isMemberOf(e[a])){r=!1;break}r&&i.add(o)}return f.J(e),i}isValidMember(t,e){if(e===null||t===e||e instanceof _)return!1;let i;return t!==null&&(t===e||t.isMemberOf(e)||(i=t.memberValidation,i!==null&&!i(t,e))||t.data===null&&e.data!==null||t.data!==null&&e.data===null)?!1:(i=this.memberValidation,i!==null?i(t,e):!0)}ungroupSelection(t){t===void 0&&(t=null);let e=this.diagram,i=e.model;if(i.Hc())try{e.currentCursor="wait",e.D("ChangingSelection",e.selection),e.startTransaction("Ungroup");let s=new G;if(t!==null)s.add(t);else{let o=e.selection.iterator;for(;o.next();){let r=o.value;r instanceof ft&&r.canUngroup()&&s.add(r)}}let n=new G;if(s.count>0){e.clearSelection(!0);let o=s.iterator;for(;o.next();){let r=o.value;r.expandSubGraph();let a=r.containingGroup,h=a!==null&&a.data!==null?i.getKeyForNodeData(a.data):void 0;n.addAll(r.memberParts);let l=n.iterator;for(;l.next();){let c=l.value;if(c.isSelected=!0,c instanceof _)continue;let u=c.data;u!==null?i.setGroupForData(u,h):c.containingGroup=a}e.remove(r)}}e.D("SelectionUngrouped",s,n)}finally{e.commitTransaction("Ungroup"),e.D("ChangedSelection",e.selection),e.currentCursor=""}}canUngroupSelection(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowDelete||!e.allowUngroup||!e.model.Hc())return!1;if(t!==null){if(!(t instanceof ft))return!1;if(t.canUngroup())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&s.canUngroup())return!0}}return!1}addTopLevelParts(t,e){let i=this.m2(t),s=!0,n=i.iterator;for(;n.next();){let o=n.value;o.containingGroup!==null&&(!e||this.isValidMember(null,o)?o.containingGroup=null:s=!1)}return s}collapseSubGraph(t){t===void 0&&(t=null);let e=this.diagram,i="Collapse SubGraph";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new G;if(t!==null&&t.isSubGraphExpanded)t.collapseSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ft&&o.isSubGraphExpanded&&(o.collapseSubGraph(),s.add(o))}}e.D("SubGraphCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseSubGraph(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ft)||!t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&s.isSubGraphExpanded)return!0}}return!1}expandSubGraph(t){t===void 0&&(t=null);let e=this.diagram,i="Expand SubGraph",s=new G;try{if(e.startTransaction(i),e.animationManager.Fl(i),t!==null&&!t.isSubGraphExpanded)t.expandSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ft&&(o.isSubGraphExpanded||(o.expandSubGraph(),s.add(o)))}}e.D("SubGraphExpanded",s)}finally{for(let n of s)this.pA(e,n);t&&this.pA(e,t),e.commitTransaction(i)}}pA(t,e){for(let i of e.memberParts)i instanceof rt&&t.Cc(i,e)}canExpandSubGraph(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ft)||t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&!s.isSubGraphExpanded)return!0}}return!1}editTextBlock(t){t===void 0&&(t=null);let e=this.diagram,i=e.toolManager.findTool("TextEditing");if(i!==null){if(t===null){let s=null,n=e.selection.iterator;for(;n.next();){let o=n.value;if(o.canEdit()){s=o;break}}if(s===null)return;t=s.findInVisualTree(o=>o instanceof xt&&o.editable)}t!==null&&(e.currentTool=null,i.textBlock=t,e.currentTool=i)}}canEditTextBlock(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowTextEdit||e.toolManager.findTool("TextEditing")===null)return!1;if(t!==null){if(!(t instanceof xt))return!1;let i=t.part;if(i!==null&&i.canEdit())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s.canEdit()&&(t=s.findInVisualTree(n=>n instanceof xt&&n.editable),t!==null))return!0}}return!1}showContextMenu(t){let e=this.diagram,i=e.toolManager.findTool("ContextMenu");if(i===null)return;t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e);let s=i.findObjectWithContextMenu(t);if(s!==null){let n=e.lastInput,o=null;if(s instanceof dt)o=s.getDocumentPoint(D.Center);else if(!e.viewportBounds.containsPoint(n.documentPoint)){let r=e.viewportBounds;o=new P(r.x+r.width/2,r.y+r.height/2)}if(o!==null){let r=new Ye;r.diagram=e,r.viewPoint=e.transformDocToView(o),r.documentPoint=o,r.button=2,r.up=!0,e.lastInput=r}e.currentTool=i,i.openMenu(!1,s)}}canShowContextMenu(t){let e=this.diagram,i=e.toolManager.findTool("ContextMenu");return!(i===null||(t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e),i.findObjectWithContextMenu(t)===null))}get copiesClipboardData(){return this.e2}set copiesClipboardData(t){f.s(t,"boolean",be,"copiesClipboardData"),this.e2=t}get copiesConnectedLinks(){return this.s2}set copiesConnectedLinks(t){f.s(t,"boolean",be,"copiesConnectedLinks"),this.s2=t}get deletesConnectedLinks(){return this.o2}set deletesConnectedLinks(t){f.s(t,"boolean",be,"deletesConnectedLinks"),this.o2=t}get copiesTree(){return this.l2}set copiesTree(t){f.s(t,"boolean",be,"copiesTree"),this.l2=t}get deletesTree(){return this.h2}set deletesTree(t){f.s(t,"boolean",be,"deletesTree"),this.h2=t}get copiesParentKey(){return this.a2}set copiesParentKey(t){f.s(t,"boolean",be,"copiesParentKey"),this.a2=t}get copiesGroupKey(){return this.c2}set copiesGroupKey(t){f.s(t,"boolean",be,"copiesGroupKey"),this.c2=t}get archetypeGroupData(){return this.f2}set archetypeGroupData(t){t!==null&&f.ec(t,be,"archetypeGroupData");let e=this.diagram;this.f2=t}get memberValidation(){return this.nh}set memberValidation(t){t!==null&&f.k(t,be,"memberValidation"),this.nh=t}get defaultScale(){return this.diagram.defaultScale}set defaultScale(t){this.diagram.defaultScale=t}get zoomFactor(){return this.u2}set zoomFactor(t){t>1||f.o("zoomFactor must be larger than 1.0, not: "+t),this.u2=t}get isZoomToFitRestoreEnabled(){return this.d2}set isZoomToFitRestoreEnabled(t){f.s(t,"boolean",be,"isZoomToFitRestoreEnabled"),this.d2=t}get scrollToPartPause(){return this.g2}set scrollToPartPause(t){this.g2=t}computeEffectiveCollection(t,e){let i=this.diagram,s=i.toolManager.findTool("Dragging"),n=i.currentTool===s;e===void 0&&(e=i.s0());let o=new pt;if(t===null)return o;let r=t.iterator;for(;r.next();){let a=r.value;i.Kr(o,a,n,e)}if(i.draggedLink!==null&&e.dragsLink)return o;for(r=t.iterator;r.next();){let a=r.value;if(a instanceof _){let h=a.fromNode;if(h!==null&&!o.has(h))o.delete(a);else{let l=a.toNode;l!==null&&!o.has(l)&&o.delete(a)}}}return o}}var ws=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Vertical=4]="Vertical",x[x.Horizontal=5]="Horizontal",x[x.Fill=2]="Fill",x))(ws||{}),bs=(x=>(x[x.None=0]="None",x[x.Along=21]="Along",x[x.Plus90=22]="Plus90",x[x.Minus90=23]="Minus90",x[x.Opposite=24]="Opposite",x[x.Upright=25]="Upright",x[x.Plus90Upright=26]="Plus90Upright",x[x.Minus90Upright=27]="Minus90Upright",x[x.Upright45=28]="Upright45",x))(bs||{}),Ln=(x=>(x[x.None=0]="None",x[x.Vertical=1]="Vertical",x[x.Horizontal=2]="Horizontal",x[x.Both=3]="Both",x))(Ln||{});class dt{n;c0;f0;Hr;p;lh;ct;at;se;$t;u0;Vs;Lt;is;qr;hh;wi;da;tt;Gt;Wr;Ni;zi;Ku;hi;ju;Ot;si;Jr;Ub;ah;Hu;constructor(){I.Ki(this),this.n=30723,this.$t=1,this.u0="",this.Vs=null,this.Lt=null,this.at=new P(NaN,NaN).u(),this.is=Q.yw,this.qr=new Pt,this.hh=new Pt,this.wi=null,this.da=1,this.tt=1,this.Gt=0,this.Wr=Lt.Rg,this.se=new z(NaN,NaN,NaN,NaN).u(),this.Ni=new z(NaN,NaN,NaN,NaN).u(),this.zi=new z(0,0,NaN,NaN).u(),this.Ku=null,this.c0=null,this.ct=null,this.hi=D.Default,this.ju=D.Default,this.f0=0,this.Hr=0,this.Ot=null,this.p=null,this.lh=null,this.si=null,this.Ub=null,this.ah=null,this.Jr=null,this.Hu=null}cloneProtected(t){t.n=(this.n|2048|4096)&-32769,t.$t=this.$t,t.u0=this.u0,t.Lt=this.Lt,t.at.a(this.at),t.is=this.is.P(),this.wi!==null?t.wi=this.wi.copy():t.wi=null,t.tt=this.tt,t.Gt=this.Gt,t.Wr=this.Wr.P(),t.se.a(this.se),t.Ni.a(this.Ni),t.zi.a(this.zi),t.c0=this.c0,this.ct!==null&&(t.ct=this.ct.copy()),t.hi=this.hi.P(),t.ju=this.ju.P(),t.f0=this.f0,t.Hr=this.Hr,this.Ot!==null&&(t.Ot=this.Ot.copy()),this.p!==null&&(this.p.fi?t.p=this.p:t.p=this.p.copy()),this.lh!==null&&(t.lh=this.lh.slice()),this.si!==null&&(t.si=this.si.copy())}addCopyProperty(t){let e=this.lh;if(!Array.isArray(e))e=[],this.lh=e;else for(let i=0;i<e.length;i++)if(e[i]===t)return;e.push(t)}vo(t){t.Ku=null,t.Jr=null,t.c()}clone(){let t=new this.constructor;if(this.cloneProtected(t),this.lh!==null)for(let e=0;e<this.lh.length;e++){let i=this.lh[e];t[i]=this[i]}return t}copy(){return this.clone()}rS(){let t=this.Ci;if(t!==null){this.Ci=null;for(let e of t)e.qu()&&(e.isToData?this.themeData(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):e.isToObject?this.themeObject(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter,e.sourceName):e.isToModel?this.themeModel(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):this.theme(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter))}return this}oi(t){t in bs?this.segmentOrientation=t:t in ws?this.stretch=t:f.er(this,t)}toString(){return f.Dn(this.constructor)+"#"+I.as(this)}static None=0;static Default=1;static Fill=2;static Vertical;static Horizontal;static Uniform=6;static UniformToFill=7;static FlipVertical=1;static FlipHorizontal=2;static FlipBoth=3;ch(){this.p!==null&&(this.p.fi=!0)}Kt(){return this.p===null?this.p=new oi:this.p.fi&&(this.p=this.p.copy()),this.p}Be(){if(this.ct===null){let t=new is;t.ga=D.None,t.ma=D.None,t.pa=10,t.ya=10,t.wa=0,t.xa=0,this.ct=t}return this.ct}raiseChangedEvent(t,e,i,s,n,o,r){let a=this.part;if(a!==null){a.qc(t,e,i,s,n,o,r),i===this&&t===2&&this.Wc()&&this.ba(a,e);let h=this.diagram;if(this.ws!==null&&h!==null&&h.Vh&&!h.undoManager.isUndoingRedoing&&!h.animationManager.pu){let l=this.ws.get(e);if(l!==null&&h.animationManager.isEnabled&&!h.animationManager.isTicking){this.Hu===null&&(this.Hu=new pt);let c=h.undoManager.transactionLevel===0;if(l.startCondition===2?c=!0:l.startCondition===3&&(c=!1),c){let u=new Ce;l.XF(u);let d=this.Hu.get(l);d!==null&&d.stop(),this.Hu.set(l,u),u.gx=this,u.XS=l,u.add(this,e,s,n),u.start()}else h.animationManager.getBundleAnimation().add(this,e,s,n)}}if(this instanceof H&&i===a&&a.p2()&&a.data!==null){let l=this.C.r,c=l.length;for(let u=0;u<c;u++){let d=l[u];d instanceof H&&d.Yr(g=>{g.data!==null&&g.p2()&&g.updateTargetBindings(e)})}}}}UF(t){this.Hu.delete(t)}Do(){if(this.diagram!==null&&this.findBindingPanel()===null&&this.Ci!==null){let t=this.diagram.model,e=this.Ci.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=null,n=i.sourceName;i.isToObject&&(s=this.yA(n));let o=this,r=i.targetId;r!==-1&&(o=this.d0(r),o===null)||(n==="/"?s=o.part:n==="."?s=o:n===".."&&(s=o.panel),i.updateTarget(o,s,void 0,t))}}}ba(t,e){let i=this.findBindingPanel();if(i!==null){let s=t.diagram,n=this.Ci.iterator;for(;n.next();){let o=n.value,r=null;if(o.isToObject){if(r=o.wA(i,this),r===null)continue;o.updateSource(this,r,e,null)}else if(o.isToModel)s!==null&&!s.fe&&o.updateSource(this,s.model.modelData,e,i);else if(!o.isToTheme){let a=i.data;if(a===null)continue;s!==null&&!s.fe&&o.updateSource(this,a,e,i)}if(r===this){let a=o.targetId,h=i.d0(a);h!==null&&o.updateTarget(h,r,e,s?.model)}}}}d0(t){return this.Hn===t?this:null}yA(t){let e;return t===""?e=this:t==="/"?e=this:t==="."?e=this:t===".."?e=this:e=this.part.findObject(t),e}get Hn(){return this.p!==null?this.p.Hn:-1}set Hn(t){this.Hn!==t&&(this.p===null&&(this.p=new oi),this.p.Hn=t)}get Ci(){return this.p!==null?this.p.Ci:null}set Ci(t){this.Ci!==t&&(this.p===null&&(this.p=new oi),this.p.Ci=t)}get qn(){return this.p!==null?this.p.qn:null}set qn(t){this.qn!==t&&(this.p===null&&(this.p=new oi),this.p.qn=t)}raiseChanged(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}t(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}Wn(t,e,i,s){let n=this.se;if(n.i(t,e,i,s),this.tt!==1||this.Gt!==0){this.wi===null&&(this.wi=new Pt);let o=this.wi;o.Ri(),this.g0(o,t,e,i,s),o.vg(n)}}xA(t,e,i){return this.pickable===!1?!1:(i.nc(this.T),e?this.intersectsRect(t,i):this.containedInRect(t,i))}bA(t,e,i){if(this.pickable===!1)return!1;let s=this.naturalBounds,n=t.distanceSquaredPoint(e);return i?P.distanceLineSegmentSquared(t.x,t.y,0,0,0,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,0,s.height,s.width,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,s.height,s.width,0)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,0,0,0)<=n:t.distanceSquared(0,0)<=n&&t.distanceSquared(0,s.height)<=n&&t.distanceSquared(s.width,0)<=n&&t.distanceSquared(s.width,s.height)<=n}an(){return!0}containsPoint(t){let e=P.l();e.a(t),this.T.gt(e);let i=this.actualBounds;if(!i.isReal())return P.e(e),!1;let s=this.diagram;if(s!==null&&s.Hm){let o=s.getInputOption("extraTouchThreshold"),r=s.getInputOption("extraTouchArea"),a=r/2,h=this.naturalBounds,l=this.getDocumentScale()*s.scale,c=1/l;if(h.width*l<o&&h.height*l<o){let u=z.contains(i.x-a*c,i.y-a*c,i.width+r*c,i.height+r*c,e.x,e.y);return P.e(e),u}}let n=!1;return(this instanceof St||this instanceof ct?z.contains(i.x-5,i.y-5,i.width+10,i.height+10,e.x,e.y):i.containsPoint(e))&&(this.si&&!this.si.containsPoint(e)?n=!1:this.Lt!==null&&this.zi.containsPoint(t)?n=!0:n=this.fh(t)),P.e(e),n}fh(t){let e=this.naturalBounds;return z.contains(0,0,e.width,e.height,t.x,t.y)}containsRect(t){if(this.angle===0)return this.actualBounds.containsRect(t);let e=this.naturalBounds,i=z.V(0,0,e.width,e.height),s=this.T,n=!1,o=P.V(t.x,t.y);return i.containsPoint(s.$e(o))&&(o.i(t.x,t.bottom),i.containsPoint(s.$e(o))&&(o.i(t.right,t.bottom),i.containsPoint(s.$e(o))&&(o.i(t.right,t.y),i.containsPoint(s.$e(o))&&(n=!0)))),P.e(o),z.e(i),n}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=!1,o=P.V(0,0);return t.containsPoint(s.gt(o))&&(o.i(0,i.height),t.containsPoint(s.gt(o))&&(o.i(i.width,i.height),t.containsPoint(s.gt(o))&&(o.i(i.width,0),t.containsPoint(s.gt(o))&&(n=!0)))),P.e(o),n}intersectsRect(t,e){if(e===void 0&&(e=this.T,this.angle===0))return t.intersectsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=P.V(0,0),o=P.V(0,i.height),r=P.V(i.width,i.height),a=P.V(i.width,0),h=!1;if(t.containsPoint(s.gt(n))||t.containsPoint(s.gt(o))||t.containsPoint(s.gt(r))||t.containsPoint(s.gt(a)))h=!0;else{let l=z.V(0,0,i.width,i.height),c=P.V(t.x,t.y);l.containsPoint(s.$e(c))?h=!0:(c.i(t.x,t.bottom),l.containsPoint(s.$e(c))?h=!0:(c.i(t.right,t.bottom),l.containsPoint(s.$e(c))?h=!0:(c.i(t.right,t.y),l.containsPoint(s.$e(c))&&(h=!0)))),P.e(c),z.e(l),h||(L.Sw(t,n,o)||L.Sw(t,o,r)||L.Sw(t,r,a)||L.Sw(t,a,n))&&(h=!0)}return P.e(n),P.e(o),P.e(r),P.e(a),h}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof D){let i=t,s=this.naturalBounds;return e.i(i.x*s.width+i.offsetX,i.y*s.height+i.offsetY),this.Us.gt(e),e}else return e.set(t),this.Us.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new z);let e=this.naturalBounds,i=this.Us,s=P.V(0,0).T(i);return t.i(s.x,s.y,0,0),s.i(e.width,0).T(i),t.unionNoCheck(s.x,s.y,0,0),s.i(e.width,e.height).T(i),t.unionNoCheck(s.x,s.y,0,0),s.i(0,e.height).T(i),t.unionNoCheck(s.x,s.y,0,0),P.e(s),t}getDocumentAngle(){return this.Us.ZD()}getDocumentScale(){if(this.m0()===!1)return this.da;let t=this.tt;return this.panel!==null?t*this.panel.getDocumentScale():t}getLocalPoint(t,e){return e===void 0&&(e=new P),e.a(t),this.Us.$e(e),e}getNearestIntersectionPoint(t,e,i){return this.Jc(t.x,t.y,e.x,e.y,i)}Jc(t,e,i,s,n){let o=this.T,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,c=o.m11*r,u=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),g=t*a+e*l+u,p=t*h+e*c+d,m=i*a+s*l+u,y=i*h+s*c+d;n.i(0,0);let w=this.naturalBounds,b=L.gl(0,0,w.width,w.height,g,p,m,y,n);return n.T(o),b}ht(t,e,i,s){if(this.To()===!1)return;let n=this.Wr,o=n.right+n.left,r=n.top+n.bottom;t=Math.max(t-o,0),e=Math.max(e-r,0),i=i||0,s=s||0,i=Math.max(i-o,0),s=Math.max(s-r,0);let a=this.angle,h=0,l=this.desiredSize,c=this.p0();a===90||a===270?(t=isFinite(l.height)?l.height+c:t,e=isFinite(l.width)?l.width+c:e):(t=isFinite(l.width)?l.width+c:t,e=isFinite(l.height)?l.height+c:e);let u=i||0,d=s||0,g=this instanceof H;switch(this.zs(!0)){case 0:u=0,d=0,g&&(t=1/0,e=1/0);break;case 2:isFinite(t)&&t>i&&(u=t),isFinite(e)&&e>s&&(d=e);break;case 5:isFinite(t)&&t>i&&(u=t),d=0,g&&(e=1/0);break;case 4:isFinite(e)&&e>s&&(d=e),u=0,g&&(t=1/0);break}let p=this.maxSize,m=this.minSize;u>p.width&&m.width<p.width&&(u=p.width),d>p.height&&m.height<p.height&&(d=p.height),i=Math.max(u,m.width),s=Math.max(d,m.height),p.width<i&&(i=Math.min(m.width,i)),p.height<s&&(s=Math.min(m.height,s)),t=Math.min(p.width,t),e=Math.min(p.height,e),t=Math.max(i,t),e=Math.max(s,e),(a===90||a===270)&&(h=t,t=e,e=h,h=i,i=s,s=h),this.se.Nt(),this.Wu(t,e,i,s),this.se.u(),this.se.isReal()||f.o("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.se.toString()),this.ue(!1)}Wu(t,e,i,s){}Xs(){return!1}Bt(t,e,i,s,n){this.$c();let o=z.l();o.a(this.Ni),this.Ni.Nt(),this._e()===!1?this.Ni.i(t,e,i,s):this.uh(t,e,i,s),this.Ni.u(),n===void 0?this.si=null:this.si=n;let r=!1;if(n!==void 0)r=!0;else{let a=this.panel;if(a!==null&&a.$r()&&(a=a.panel),a!==null){let h=a.zi,l=this.measuredBounds,c=e+l.height,u=t+l.width;if(r=!(0<=t+.05&&u<=h.width+.05&&0<=e+.05&&c<=h.height+.05),this instanceof xt){let d=this.naturalBounds;(this.y0>d.height||this.ui>d.width)&&(r=!0)}}}r?this.n|=256:this.n&=-257,this.Ni.isReal()||f.o("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ni.toString()),this.Ju(o,this.Ni),this.Jn(!1),z.e(o)}uh(t,e,i,s){}commonArrange(t,e,i,s){if(this.Ni.i(t,e,i,s),this.desiredSize.isReal())return;let n=this.se,o=this.Wr,r=o.right+o.left,a=o.top+o.bottom,h=n.width+r,l=n.height+a;i+=r,s+=a;let c=this.zs(!0);switch(h===i&&l===s&&(c=0),c){case 0:(h>i||l>s)&&(this.ue(!0),this.ht(h>i?i:h,l>s?s:l,0,0));break;case 2:this.ue(!0),this.ht(i,s,0,0);break;case 5:this.ue(!0),this.ht(i,l,0,0);break;case 4:this.ue(!0),this.ht(h,s,0,0);break}}Ju(t,e){let i=this.part;i!==null&&i.diagram!==null&&((i.selectionObject===this||i.resizeObject===this||i.rotateObject===this)&&i.w2(!0),this.S(),!t.equalsApproxClose(e)&&(i.dh(),this.w0(i)))}w0(t){this.portId!==null&&(t.w2(!0),t instanceof rt&&t.kA(this))}get shadowVisible(){return this.p!==null?this.p.x0:null}set shadowVisible(t){let e=this.shadowVisible;e!==t&&(this.Kt().x0=t,this.Ve(!0),this.S(),this.t("shadowVisible",e,t))}HR(t,e){let i=this.naturalBounds,s=this.hh,n=s.m11,o=s.m21,r=s.dx,a=s.m12,h=s.m22,l=s.dy,c=0,u=0,d=c,g=u;c=d*n+g*o+r,u=d*a+g*h+l;let p=c,m=u,y=0,w=0;d=i.width+e,g=0,c=d*n+g*o+r,u=d*a+g*h+l;let b=Math.min(p,c),v=Math.min(m,u);y=Math.max(p+y,c)-b,w=Math.max(m+w,u)-v,p=b,m=v,d=i.width+e,g=i.height+e,c=d*n+g*o+r,u=d*a+g*h+l,b=Math.min(p,c),v=Math.min(m,u),y=Math.max(p+y,c)-b,w=Math.max(m+w,u)-v,p=b,m=v,d=0,g=i.height+e,c=d*n+g*o+r,u=d*a+g*h+l,b=Math.min(p,c),v=Math.min(m,u),y=Math.max(p+y,c)-b,w=Math.max(m+w,u)-v,p=b,m=v;let k=t.viewportBounds,S=k.x,M=k.y,F=k.width,T=k.height;return p>F+S||S>y+p||m>T+M||M>w+m}Ui(t,e){if(this.qR(t,e)||!this.visible)return;let i=this.opacity;if(i===0)return;let s=1;i!==1&&(s=t.globalAlpha,t.globalAlpha=s*i);let n="";this.filter!==""&&(n=t.filter,t.filter=this.filter);let o=this.T,r=this.panel;this.m0()===!0&&this.Bb();let a=this.part,h=!1,l=0;if(a&&e.getRenderingHint("drawShadows")&&(h=a.isShadowed,h)){let m=a.shadowOffset;l=Math.max(m.y,m.x)*e.scale*e.Vi}let c=this instanceof H&&this.$r(),u=this.Ni;if(c&&(this.PA(h,t,!1,r),this.WR(t,e),this.SA(h,t,!1,r),this.MA(h,t,!1)),c||!c&&(u.width===0||u.height===0||isNaN(u.x)||isNaN(u.y))){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let d=this.Xs();if(!e.ia&&d&&this.HR(e,l)){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let g=(this.n&256)!==0;if(t.clipInsteadOfFill&&(g=!1),this instanceof xt&&(t.font=this.font),g){let m=r.an()?r.naturalBounds:r.actualBounds,y=Math.max(u.x,m.x),w=Math.max(u.y,m.y),b=Math.min(u.right,m.right)-y,v=Math.min(u.bottom,m.bottom)-w,k=this.si;if(k!==null&&(y=k.x,w=k.y,b=k.width,v=k.height),y>u.width+u.x||u.x>m.width+m.x){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}t.save(),t.beginPath(),t.rect(y,w,b,v),t.clip()}if(d){if(!a.isVisible()){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}if(h){let m=a.shadowOffset;t.shadowsSet(m.x*e.scale*this.scale*e.Vi,m.y*e.scale*this.scale*e.Vi,a.shadowBlur),t.shadowsOn(),t.shadowColor=a.shadowColor}}let p=this.naturalBounds;if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.PA(h,t,d,r),this.Lt!==null&&(t.commitTransform(),this.Vb(t,p,u)),this.SA(h,t,d,r),this.gh(t,e),this.MA(h,t,d),g&&(t.restore(),t.clearContextCache(this instanceof H)),!o.Gk()){let m=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*m,-o.m12*m,-o.m21*m,o.m11*m,m*(o.m21*o.dy-o.m22*o.dx),m*(o.m12*o.dx-o.m11*o.dy))}i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n)}PA(t,e,i,s){t&&this.shadowVisible===!0?e.shadowsOn():t&&this.shadowVisible===!1&&e.shadowsOff(),t&&this.zb(s)&&this.shadowVisible===null&&e.shadowsOff()}SA(t,e,i,s){t&&(this.Lt!==null||this.zb(s))?(this.Xb(!0),this.shadowVisible===null&&e.shadowsOff()):this.Xb(!1)}MA(t,e,i){t&&this.b2()===!0&&e.shadowsOn(),i&&t&&e.shadowsOff()}JR(t,e,i){let s=this.part,n=!1;s&&t.getRenderingHint("drawShadows")&&(n=s.isShadowed),e.clipInsteadOfFill&&(n=!1),this.Xs()&&n&&e.shadowsOn(),n&&this.shadowVisible===!0?e.shadowsOn():n&&this.shadowVisible===!1&&e.shadowsOff();let o=this.panel;if(n&&this.zb(o)&&this.shadowVisible===null&&e.shadowsOff(),e.Zr){let r=t.computePixelRatio(),a=`drop-shadow(${e.shadowOffsetX/r}px ${e.shadowOffsetY/r}px ${e.shadowBlur/r/2}px ${e.shadowColor})`;this.background!==null&&i.Lt.setAttributeNS(null,"filter",a)}return n&&(this.Lt!==null||this.zb(o))?(this.Xb(!0),this.shadowVisible===null&&e.shadowsOff()):this.Xb(!1),n}$R(t,e,i,s){if(i.Zr){let n=e.computePixelRatio(),o=`drop-shadow(${i.shadowOffsetX/n}px ${i.shadowOffsetY/n}px ${i.shadowBlur/n/2}px ${i.shadowColor})`;this.k2(t,o)}s&&this.b2()===!0&&i.shadowsOn(),this.Xs()&&i.shadowsOff()}zb(t){return t===null?!1:(t.$r()&&(t=t.panel),t.b2()||(t.type===H.Auto||t.type===H.Spot)&&t.findMainElement()!==this)}k2(t,e){}Vb(t,e,i){let s=this.p0(),n=e.x,o=e.y,r=e.width+s,a=e.height+s;this.rn(t,this.Lt,!0,!1,e,i),this.Lt instanceof E&&this.Lt.type===3?(t.beginPath(),t.rect(n-s/2,o-s/2,r,a),t.fillContext(this.Lt,!1,null)):t.fillRect(n-s/2,o-s/2,r,a)}NA(t,e){let i=t.ZR(this),s=t.ah!==null?t.ah:t.svg;if(i!==-1)if(i===0)if(s.Lt)s.Lt.after(e);else if(t.type===H.Table){let n=s.getElementsByClassName("gojs-ts"),o=n.length!==0?n[0]:null;o!==null&&o.after(e)}else s.prepend(e);else{for(;i!==0&&!t.elt(i-1).isVisibleObject();)i--;if(i===0)s.prepend(e);else{let n=t.elt(i-1).svg;n!==null?n.after(e):s.appendChild(e)}}}qR(t,e){if(!(t instanceof ue))return!1;if(!this.visible||this.opacity===0)return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let i=this.Ni;if(this.Xs()&&(!this.isVisible()||i.width===0||i.height===0||isNaN(i.x)||isNaN(i.y)))return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let s=this.panel,n=this.$u(t);if(this.Zc(t,e,n))return this.CA(this.svg),this.svg.parentElement!==null?(this.Xs()&&(t.lastDrawnPart=this.svg),!0):(this.Xs()?(t.lastDrawnPart!==null?t.lastDrawnPart.after(this.svg):t.diagramGroup.prepend(this.svg),t.lastDrawnPart=this.svg):s&&this.NA(s,this.svg),!0);if(this.Ve(!1),this.Xs()&&this.isShadowed){let p=this.shadowOffset;t.shadowsSet(p.x*e.scale*this.scale*e.Vi,p.y*e.scale*this.scale*e.Vi,this.shadowBlur),t.shadowsOn(),t.shadowColor=this.shadowColor}this instanceof xt&&(t.font=this.font),t.currentElement=null;let o=this.T,r=this instanceof H,a=this instanceof H?this.$r():!1,h=this.svg;if(this.m0()===!0&&this.Bb(),t.setCurrentTransform(1,0,0,1,0,0),t.outerGroup=!1,n)if(t.outerGroup=!0,r&&a)t.newGroup(1,0,0,1,0,0),this.svg=t.lastCreatedElement;else if(r&&this.isClipping){let p=this.findMainElement(),m=0,y=0;p!==null&&(m=p.actualBounds.x,y=p.actualBounds.y),t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx+m,o.dy+y),this.svg=t.lastCreatedElement,p!==null&&t.createOrUpdateClipGroup(this,p.actualBounds),t.currentElement=t.lastCreatedElement}else r?(t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.svg=t.lastCreatedElement):t.newGroup(1,0,0,1,0,0);let l=this.naturalBounds;r||t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.background!==null&&(r?(a&&t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.Vb(t,l,i),a&&t.setCurrentTransform(1,0,0,1,0,0)):(t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.Vb(t,l,i)),t.currentElement.Lt=t.lastCreatedElement,t.currentElement.prepend(t.lastCreatedElement));let c=this.JR(e,t,t.currentElement);this.gh(t,e),r&&t.endGroup(),t.outerGroup&&t.endGroup();let u=t.surface.Yu,d=r?this.svg:t.currentElement;if(h!==null&&d!==h&&h.parentNode===this.panel.svg){let p=this.svg.getAttribute("filter");return p!==null&&d.setAttribute("filter",p),h.replaceWith(d),this.svg=d,d!==null&&this.b0(t,s,i,d),!0}if(this.svg=d,u!==null&&d===null&&t.dummyGroup(),d===null)return!0;this.b0(t,s,i,d),this.$R(d,e,t,c);let g=this.Xs()?this.opacity*t.globalAlpha:this.opacity;if(g!==1&&d.setAttributeNS(null,"opacity",g.toString()),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),this.Xs()){if(h!==null&&d!==h&&h.parentNode===t.diagramGroup){let p=h.getAttribute("filter");p!==null&&d.setAttribute("filter",p),h.replaceWith(d)}else t.lastDrawnPart?t.lastDrawnPart.after(d):t.diagramGroup.prepend(d);t.lastDrawnPart=d}else s!==null&&this.NA(s,d);return u!==null&&u(this,d),this.CA(d),!0}CA(t){let e=this,i=t.dataset;e instanceof dt&&(e.portId!==null&&(i.portId=e.portId),e instanceof H&&(isNaN(e.itemIndex)||(i.itemIndex=e.itemIndex.toString()),e instanceof Nt&&(i.className=f.Dn(e),e.key!==void 0&&(i.key=e.key.toString()),e.containingGroup!==null&&(i.group=e.containingGroup.key.toString()),e instanceof _&&(e.fromNode!==null&&e.fromNode.key!==void 0&&(i.fromKey=e.fromNode.key.toString()),e.fromPortId!==""&&(i.fromPortId=e.fromPortId),e.toNode!==null&&e.toNode.key!==void 0&&(i.toKey=e.toNode.key.toString()),e.toPortId!==""&&(i.toPortId=e.toPortId)))))}b0(t,e,i,s){let n=(this.n&256)!==0;if(t.clipInsteadOfFill&&(n=!1),!n){s.removeAttributeNS(null,"clip-path");return}let o=e.an()?e.naturalBounds:e.actualBounds,r=Math.max(i.x,o.x),a=Math.max(i.y,o.y),h=Math.min(i.right,o.right)-r,l=Math.min(i.bottom,o.bottom)-a,c=this.si;c!==null&&(r=c.x,a=c.y,h=c.width,l=c.height);let u=new z(r,a,Math.max(h,0),Math.max(l,0));this instanceof H&&this.T.copy().xw().vg(u),s.setAttributeNS(null,"clip-path",`path(' M ${u.x},${u.y} L ${u.width+u.x} ${u.y} L ${u.width+u.x} ${u.height+u.y} L ${u.x} ${u.height+u.y} z') view-box`)}QR(){if(this.svg===null)return;let t=this.svg.innerHTML.match(/url\(#((CLIP|GRAD).+?)\)/g),e=this.svg.ownerDocument;if(t!==null)for(let i of t){let s=e.getElementById(i.split("#")[1].slice(0,-1));s!==null&&s.remove()}this.svg.remove()}WR(t,e){let i=this.Ni,s=this.zi,n=this.Lt;n!==null&&t.commitTransform(),n!==null&&(this.rn(t,n,!0,!1,s,i),n instanceof E&&n.type===3?(t.beginPath(),t.rect(i.x,i.y,i.width,i.height),t.fillContext(n,!1,null)):t.fillRect(i.x,i.y,i.width,i.height)),this.gh(t,e)}gh(t,e){}Qc(){this.Ve(!0)}Zc(t,e,i){let s=this.svg;if(this._R()){if(this.Qc(),this.Ve(!1),s===null)return!1;let c=s.getAttribute("clip-path");if(c!==null&&c.includes("url")){let u=t.svg.getElementById(c.split("#")[1].slice(0,-1));u!==null&&u.remove()}return s.getAttribute("filter")&&s.removeAttribute("filter"),!1}if(s===null)return!1;if(!this.visible)return s.remove(),!1;if(s.nodeName!=="g"&&i||s.nodeName==="g"&&!i)return!1;let n=this.T,o="matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")",r=this instanceof H,a=r?this.$r():!1;if(!(r&&a))if(this instanceof zt){let c=this.Gb;t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),c!==null&&t.amendImageTransform(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]),i?s.lastElementChild.setAttributeNS(null,"transform",t.getCurrentTransform()):s.setAttributeNS(null,"transform",t.getCurrentTransform())}else if(i&&!r)if(this instanceof ct){let c=s.getElementsByTagName("path");for(let u=0;u<c.length;u++)c[u].setAttributeNS(null,"transform",o)}else if(this instanceof xt){let c=s.getElementsByTagName("text"),u=typeof this.stroke=="string"?this.stroke:null;for(let d=0;d<c.length;d++)c[d].setAttributeNS(null,"transform",o),u&&c[d].setAttributeNS(null,"fill",u)}else(s.lastElementChild||s).setAttributeNS(null,"transform",o);else if(r&&this.isClipping&&this.ah){let c=this.findMainElement(),u=c!==null?c.actualBounds.x:0,d=c!==null?c.actualBounds.y:0;this.ah.setAttributeNS(null,"transform","matrix(1,0,0,1,"+-u+", "+-d+")"),s.setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+(n.dx+u)+", "+(n.dy+d)+")")}else s.setAttributeNS(null,"transform",o);let h=this.Xs()?this.opacity*t.globalAlpha:this.opacity;h===1?s.removeAttribute("opacity"):s.setAttributeNS(null,"opacity",h.toString()),t.setCurrentTransform(1,0,0,1,0,0);let l=this.ah?this.ah:this.Ub;if(this.background!==null||l.Lt!==void 0){let c=l.Lt;if(this.background===null)t.removeOldGradient(this,l.Lt,"fill"),l.Lt.remove(),l.Lt=void 0;else{if((a||i&&!(this instanceof H))&&t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),this.Vb(t,this.naturalBounds,this.actualBounds),l.Lt){t.removeOldGradient(this,l.Lt,"fill");let u=l.Lt.getAttribute("filter");u!==null&&t.lastCreatedElement.setAttribute("filter",u),l.Lt.replaceWith(t.lastCreatedElement)}else l.prepend(t.lastCreatedElement);l.Lt=t.lastCreatedElement}c&&t.removeOldGradient(this,c,"fill")}return this.b0(t,this.panel,this.actualBounds,s),!0}$u(t){if(this.background!==null)return!0;let e=(this.n&256)!==0;return t.clipInsteadOfFill&&(e=!1),!!e}static TE(t,e,i,s,n,o,r){let a=.001,h=o.length;t.moveTo(e,i);let l=s-e,c=n-i;l===0&&(l=.001);let u=c/l,d=Math.sqrt(l*l+c*c),g=0,p=!0;a=o[g%h];let m=r!==0;for(;d>=.1;){if(m){for(a=o[g++%h],a-=r;a<0;)a+=o[g++%h],p=!p;m=!1}else a=o[g++%h];a>d&&(a=d);let y=Math.sqrt(a*a/(1+u*u));l<0&&(y=-y),e+=y,i+=u*y,p?t.lineTo(e,i):t.moveTo(e,i),d-=a,p=!p}}rn(t,e,i,s,n,o){let r=1,a=1;if(typeof e=="string"){i?t.fillStyle=e:t.strokeStyle=e;return}else if(e.type===1){i?t.fillStyle=e.color:t.strokeStyle=e.color;return}let h,l=this.p0();r=n.width,a=n.height,s?(r=o.width,a=o.height):i||(r+=l,a+=l);let c=t instanceof Ei;if(c&&e.cn&&(e.type===4||e._c===r&&e.Yb===a))h=e.cn;else{let u=0,d=0,g=0,p=0,m=0,y=0,w=0,b=0;if(s?(w=o.x,b=o.y):i||(w-=l/2,b-=l/2),u=e.start.x*r+e.start.offsetX+w,d=e.start.y*a+e.start.offsetY+b,g=e.end.x*r+e.end.offsetX+w,p=e.end.y*a+e.end.offsetY+b,e.type===2)h=t.createLinearGradient(u,d,g,p);else if(e.type===3)y=isNaN(e.endRadius)?Math.max(r,a)/2:e.endRadius,isNaN(e.startRadius)?(m=0,y=Math.max(r,a)/2):m=e.startRadius,h=t.createRadialGradient(u,d,m,g,p,y);else if(e.type===4)try{h=t.createPattern(e.pattern,"repeat")}catch{h=null}else f.Zi(e.type,"Brush type");if(e.type!==4){let v=e.colorStops;if(v!==null){let k=v.iterator;for(;k.next();)h.addColorStop(k.key,k.value)}}if(c&&(e.cn=h,h!==null&&(e._c=r,e.Yb=a),h===null&&e.type===4&&e._c!==-1)){e._c=-1;let v=this.diagram;v!==null&&e._c===-1&&f.ir(()=>{v.redraw()},600)}}i?t.fillStyle=h:t.strokeStyle=h}isContainedBy(t){return t instanceof H?this.tv(this,t):!1}tv(t,e){if(t===e||e===null)return!1;let i=t.panel;for(;i!==null;){if(i===e)return!0;i=i.panel}return!1}isVisibleObject(){if(!this.visible)return!1;let t=this.panel;return t!==null?t.isVisibleObject():!0}isEnabledObject(){let t=this instanceof H?this:this.panel;for(;t!==null&&t.isEnabled;)t=t.panel;return t===null}get enabledChanged(){return this.p!==null?this.p.k0:null}set enabledChanged(t){let e=this.enabledChanged;e!==t&&(t!==null&&f.k(t,dt,"enabledChanged"),this.Kt().k0=t,this.t("enabledChanged",e,t))}Bb(){if(this.Kb()===!0){let t=this.qr;if(t.Ri(),!this.Ni.isReal()||!this.se.isReal()){this.Zu(!1);return}if(t.Fs(this.Ni.x-this.se.x,this.Ni.y-this.se.y),this.scale!==1||this.angle!==0){let e=this.naturalBounds;this.g0(t,e.x,e.y,e.width,e.height)}this.Zu(!1),this.ka(!0)}if(this.m0()===!0){let t=this.panel;if(t===null)this.hh.set(this.qr),this.da=this.scale;else if(t.Us!==null){let e=this.hh;e.Ri(),t.an()?e.nc(t.hh):t.panel!==null&&e.nc(t.panel.hh),e.nc(this.qr),this.da=this.scale*t.da}this.ka(!1)}}g0(t,e,i,s,n){if(this.tt!==1&&t.tt(this.tt),this.Gt===0)return;let o=P.l();o.setSpot(e,i,s,n,D.Center),t.cs(this.Gt,o.x,o.y),P.e(o)}c(t){if(this.To())return;t===void 0&&(t=!1),this.ue(!0),this.Jn(!0);let e=this.panel;e!==null&&!t&&e.c()}tf(){this.To()||(this.ue(!0),this.Jn(!0))}ef(t){if(this._e())return;let e=this.panel;!t&&e!==null&&e.c(),this.Jn(!0)}$c(){this.Kb()===!1&&(this.Zu(!0),this.ka(!0))}P2(){this.ka(!0)}S(){let t=this.part;t!==null&&t.S()}zs(t){let e=this.stretch,i=this.panel;if(i===null)return this.Oo(e===1?0:e,t);if(i.type===H.Table)return this.P0(i.getRowDefinition(this.row),i.getColumnDefinition(this.column),t);if(i.type===H.Auto&&i.findMainElement()===this)return this.Oo(2,t);if(e===1){if(i.type===H.Spot&&i.findMainElement()===this)return this.Oo(2,t);let s=i.defaultStretch;return s===1?this.Oo(0,t):this.Oo(s,t)}return this.Oo(e,t)}P0(t,e,i){let s=this.stretch;if(s!==1)return this.Oo(s,i);let n=null,o=null;switch(t.stretch){case 1:case 5:break;case 4:o=!0;break;case 2:o=!0;break}switch(e.stretch){case 1:case 4:break;case 5:n=!0;break;case 2:n=!0;break}let r=this.panel.defaultStretch;return n===null&&(n=r===5||r===2),o===null&&(o=r===4||r===2),n===!0&&o===!0?this.Oo(2,i):n===!0?this.Oo(5,i):o===!0?this.Oo(4,i):this.Oo(0,i)}Oo(t,e){if(e)return t;if(t===0)return 0;let i=this.desiredSize;if(i.isReal())return 0;let s=!isNaN(i.width),n=!isNaN(i.height),o=this.angle;if(s)if(o!==90&&o!==270){if(t===5)return 0;if(t===2)return 4}else{if(t===4)return 0;if(t===2)return 5}if(n)if(o!==90&&o!==270){if(t===4)return 0;if(t===2)return 5}else{if(t===5)return 0;if(t===2)return 4}return t}get segmentOrientation(){return this.Ot!==null?this.Ot.S0:0}set segmentOrientation(t){let e=this.segmentOrientation;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.S0=t,this.c(),this.t("segmentOrientation",e,t),t===0&&(this.angle=0))}iv(){this.segmentOrientation=21}get segmentIndex(){return this.Ot!==null?this.Ot.M0:-1/0}set segmentIndex(t){t=Math.round(t);let e=this.segmentIndex;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.M0=t,this.c(),this.t("segmentIndex",e,t))}get segmentFraction(){return this.Ot!==null?this.Ot.N0:0}set segmentFraction(t){t<0?t=0:t>1&&(t=1);let e=this.segmentFraction;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.N0=t,this.c(),this.t("segmentFraction",e,t))}get segmentOffset(){return this.Ot!==null?this.Ot.C0:P.xo}set segmentOffset(t){let e=this.segmentOffset;e.equals(t)||(t=t.P(),this.Ot===null&&(this.Ot=new He),this.Ot.C0=t,this.c(),this.t("segmentOffset",e,t))}get stretch(){return this.p!==null?this.p.$n:1}set stretch(t){let e=this.stretch;e!==t&&(this.Kt().$n=t,this.c(),this.t("stretch",e,t))}get name(){return this.p!==null?this.p.Pt:""}set name(t){let e=this.name;e!==t&&(this.Kt().Pt=t,this.part!==null&&this.part.L0(),this.t("name",e,t))}get opacity(){return this.$t}set opacity(t){t<0?t=0:t>1&&(t=1);let e=this.opacity;if(e!==t){this.$t=t,this.t("opacity",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.S(s.Wh(s.actualBounds))}}get filter(){return this.u0}set filter(t){let e=this.filter;if(e!==t){this.u0=t,this.Ve(!0),this.t("filter",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.S(s.Wh(s.actualBounds))}}get visible(){return(this.n&1)!==0}set visible(t){let e=(this.n&1)!==0;if(e!==t){this.n=this.n^1,this.Qc(),this.t("visible",e,t);let i=this.panel;i!==null?i.c():this.Xs()&&this.Ei(t),this.S(),this.LA()}}get pickable(){return(this.n&2)!==0}set pickable(t){let e=(this.n&2)!==0;e!==t&&(this.n=this.n^2,this.t("pickable",e,t))}get fromLinkableDuplicates(){return(this.n&4)!==0}set fromLinkableDuplicates(t){let e=(this.n&4)!==0;e!==t&&(this.n=this.n^4,this.t("fromLinkableDuplicates",e,t))}get fromLinkableSelfNode(){return(this.n&8)!==0}set fromLinkableSelfNode(t){let e=(this.n&8)!==0;e!==t&&(this.n=this.n^8,this.t("fromLinkableSelfNode",e,t))}get toLinkableDuplicates(){return(this.n&16)!==0}set toLinkableDuplicates(t){let e=(this.n&16)!==0;e!==t&&(this.n=this.n^16,this.t("toLinkableDuplicates",e,t))}get toLinkableSelfNode(){return(this.n&32)!==0}set toLinkableSelfNode(t){let e=(this.n&32)!==0;e!==t&&(this.n=this.n^32,this.t("toLinkableSelfNode",e,t))}get isPanelMain(){return(this.n&64)!==0}set isPanelMain(t){let e=(this.n&64)!==0;e!==t&&(this.n=this.n^64,this.c(),this.t("isPanelMain",e,t))}get isActionable(){return(this.n&128)!==0}set isActionable(t){let e=(this.n&128)!==0;e!==t&&(this.n=this.n^128,this.t("isActionable",e,t))}get background(){return this.Lt}set background(t){let e=this.background;e!==t&&(t!==null&&E.Qu(t,"GraphObject.background"),t instanceof E&&t.u(),this.Lt=t,this.S(),this.t("background",e,t))}b2(){return(this.n&512)!==0}Xb(t){t?this.n|=512:this.n&=-513}Wc(){return(this.n&1024)!==0}S2(t){t?this.n|=1024:this.n&=-1025}Kb(){return(this.n&2048)!==0}Zu(t){t?this.n|=2048:this.n&=-2049}m0(){return(this.n&4096)!==0}ka(t){t?this.n|=4096:this.n&=-4097}To(){return(this.n&8192)!==0}ue(t){t?this.n|=8192:this.n&=-8193}_e(){return(this.n&16384)!==0}Jn(t){t?this.n|=16384:this.n&=-16385}_R(){return(this.n&32768)!==0}Ve(t){t?this.n|=32768:this.n&=-32769}get part(){if(this.Xs())return this;if(this.Jr!==null)return this.Jr;let t=this;for(t=t.panel;t;){if(t instanceof Nt)return this.Jr=t,t;t=t.panel}return null}get svg(){return this.Ub}set svg(t){this.Ub=t}Au(){this.svg=null}get panel(){return this.Vs}Pa(t){this.Vs=t,this.svg!==null&&this.svg.remove()}get layer(){let t=this.part;return t!==null?t.layer:null}get diagram(){let t=this.part;return t!==null?t.diagram:null}get position(){return this.at}set position(t){let e=t.x,i=t.y,s=this.position,n=s.x,o=s.y;n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i))?(t=t.copy(),this.M2(t,n,o)&&this.t("position",new P(n,o),t.copy())):this.N2()}N2(){}M2(t,e,i){return this.at=t,this.ef(),!0}bc(t,e,i){this.at.x===t&&this.at.y===e||(this.at.i(t,e),this.$c())}get actualBounds(){return this.Ni}get scale(){return this.tt}set scale(t){let e=this.scale;e!==t&&(t<=0&&f.o("GraphObject.scale for "+this+" must be greater than zero, not: "+t),this.tt=t,this.c(),this.t("scale",e,t))}get angle(){return this.Gt}set angle(t){let e=this.angle;if(e!==t){if(t=t%360,t<0&&(t+=360),e===t)return;this.Gt=t,this.LA(),this.c(),this.t("angle",e,t)}}get desiredSize(){return this.is}set desiredSize(t){let e=t.width,i=t.height,s=this.desiredSize,n=s.width,o=s.height;if((n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i)))&&(t=t.P(),this.is=t,this.c(),this instanceof ct&&this.ee(),this.t("desiredSize",s,t),this.Wc())){let r=this.part;r!==null&&(this.ba(r,"width"),this.ba(r,"height"))}}get width(){return this.is.width}set width(t){let e=this.is.width;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.is,s=new Q(t,this.is.height).u();if(this.is=s,this.c(),this instanceof ct&&this.ee(),this.t("desiredSize",i,s),this.Wc()){let n=this.part;n!==null&&this.ba(n,"width")}}}get height(){return this.is.height}set height(t){let e=this.is.height;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.is,s=new Q(this.is.width,t).u();if(this.is=s,this.c(),this instanceof ct&&this.ee(),this.t("desiredSize",i,s),this.Wc()){let n=this.part;n!==null&&this.ba(n,"height")}}}get minSize(){return this.p!==null?this.p.pr:Q.sc}set minSize(t){let e=this.minSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=0),isNaN(t.height)&&(t.height=0),t.u(),this.Kt().pr=t,this.c(),this.t("minSize",e,t))}get maxSize(){return this.p!==null?this.p.yr:Q.Bk}set maxSize(t){let e=this.maxSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=1/0),isNaN(t.height)&&(t.height=1/0),t.u(),this.Kt().yr=t,this.c(),this.t("maxSize",e,t))}get measuredBounds(){return this.se}get naturalBounds(){return this.zi}p0(){return 0}get margin(){return this.Wr}set margin(t){typeof t=="number"&&(t=new Lt(t));let e=this.Wr;e.equals(t)||(t=t.P(),this.Wr=t,this.c(),this.t("margin",e,t))}get T(){return this.Kb()===!0&&this.Bb(),this.qr}get Us(){return this.m0()===!0&&this.Bb(),this.hh}trigger(t,e,i){let s=null;return typeof t=="string"?s=new Fi(t,e,i):s=t,s.be=this,this.ws===null&&(this.ws=new pt),this.ws.set(s.propertyName,s),this}get ws(){return this.p!==null?this.p.ws:null}set ws(t){this.ws!==t&&(this.Kt().ws=t)}get gr(){return this.p!==null?this.p.gr:0}set gr(t){this.gr!==t&&(this.Kt().gr=t)}get alignment(){return this.hi}set alignment(t){let e=this.alignment;e.equals(t)||(t.isNoSpot()&&!t.isDefault()&&f.o("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+t),t=t.P(),this.hi=t,this.ef(),this.t("alignment",e,t))}get column(){return this.Hr}set column(t){t=Math.round(t);let e=this.column;e!==t&&(t<0&&f.W(t,">= 0",dt,"column"),this.Hr=t,this.c(),this.t("column",e,t),this.svg!==null&&this.svg.remove())}get columnSpan(){return this.p!==null?this.p.A0:1}set columnSpan(t){t=Math.round(t);let e=this.columnSpan;e!==t&&(t<1&&f.W(t,">= 1",dt,"columnSpan"),this.Kt().A0=t,this.c(),this.t("columnSpan",e,t))}get row(){return this.f0}set row(t){t=Math.round(t);let e=this.row;e!==t&&(t<0&&f.W(t,">= 0",dt,"row"),this.f0=t,this.c(),this.t("row",e,t),this.svg!==null&&this.svg.remove())}get rowSpan(){return this.p!==null?this.p.T0:1}set rowSpan(t){t=Math.round(t);let e=this.rowSpan;e!==t&&(t<1&&f.W(t,">= 1",dt,"rowSpan"),this.Kt().T0=t,this.c(),this.t("rowSpan",e,t))}get spanAllocation(){return this.p!==null?this.p.D0:null}set spanAllocation(t){let e=this.spanAllocation;e!==t&&(t!==null&&f.k(t,dt,"spanAllocation"),this.Kt().D0=t,this.c(),this.t("spanAllocation",e,t))}get alignmentFocus(){return this.ju}set alignmentFocus(t){let e=this.alignmentFocus;e.equals(t)||(t=t.P(),this.ju=t,this.c(),this.t("alignmentFocus",e,t))}get portId(){return this.c0}set portId(t){let e=this.portId;if(e!==t){let i=this.part;i!==null&&!(i instanceof rt)&&f.o("Cannot set portID on a Link: "+t);let s=i;e!==null&&s!==null&&s.C2(this),this.c0=t,t!==null&&s!==null&&(s.fn=!0,s.AA(this)),this.t("portId",e,t)}}Sa(){let t=this.part;if(t instanceof rt&&(this.portId!==null||this===t.port)){let e=t.diagram;e!==null&&!e.undoManager.isUndoingRedoing&&t.kA(this)}}LA(){let t=this.diagram;t===null||t.undoManager.isUndoingRedoing||(this instanceof H?this instanceof rt?this.invalidateConnectedLinks():this.walkVisualTreeFrom(this,e=>{e.Sa()}):this.Sa())}get toSpot(){return this.ct!==null?this.ct.ma:D.None}set toSpot(t){let e=this.toSpot;e.equals(t)||(t=t.P(),this.Be().ma=t,this.t("toSpot",e,t),this.Sa())}get toEndSegmentLength(){return this.ct!==null?this.ct.ya:10}set toEndSegmentLength(t){let e=this.toEndSegmentLength;e!==t&&(t<0&&f.W(t,">= 0",dt,"toEndSegmentLength"),this.Be().ya=t,this.t("toEndSegmentLength",e,t),this.Sa())}get toShortLength(){return this.ct!==null?this.ct.xa:0}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Be().xa=t,this.t("toShortLength",e,t),this.Sa())}get toLinkable(){return this.ct!==null?this.ct.F0:null}set toLinkable(t){let e=this.toLinkable;e!==t&&(this.Be().F0=t,this.t("toLinkable",e,t))}get toMaxLinks(){return this.ct!==null?this.ct.R0:1/0}set toMaxLinks(t){let e=this.toMaxLinks;e!==t&&(t<0&&f.W(t,">= 0",dt,"toMaxLinks"),this.Be().R0=t,this.t("toMaxLinks",e,t))}get fromSpot(){return this.ct!==null?this.ct.ga:D.None}set fromSpot(t){let e=this.fromSpot;e.equals(t)||(t=t.P(),this.Be().ga=t,this.t("fromSpot",e,t),this.Sa())}get fromEndSegmentLength(){return this.ct!==null?this.ct.pa:10}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;e!==t&&(t<0&&f.W(t,">= 0",dt,"fromEndSegmentLength"),this.Be().pa=t,this.t("fromEndSegmentLength",e,t),this.Sa())}get fromShortLength(){return this.ct!==null?this.ct.wa:0}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Be().wa=t,this.t("fromShortLength",e,t),this.Sa())}get fromLinkable(){return this.ct!==null?this.ct.v0:null}set fromLinkable(t){let e=this.fromLinkable;e!==t&&(this.Be().v0=t,this.t("fromLinkable",e,t))}get fromMaxLinks(){return this.ct!==null?this.ct.O0:1/0}set fromMaxLinks(t){let e=this.fromMaxLinks;e!==t&&(t<0&&f.W(t,">= 0",dt,"fromMaxLinks"),this.Be().O0=t,this.t("fromMaxLinks",e,t))}get cursor(){return this.p!==null?this.p.Sl:""}set cursor(t){let e=this.cursor;e!==t&&(f.s(t,"string",dt,"cursor"),this.Kt().Sl=t,this.t("cursor",e,t))}get click(){return this.p!==null?this.p.Cr:null}set click(t){let e=this.click;e!==t&&(t!==null&&f.k(t,dt,"click"),this.Kt().Cr=t,this.t("click",e,t))}get doubleClick(){return this.p!==null?this.p.Lr:null}set doubleClick(t){let e=this.doubleClick;e!==t&&(t!==null&&f.k(t,dt,"doubleClick"),this.Kt().Lr=t,this.t("doubleClick",e,t))}get contextClick(){return this.p!==null?this.p.Ar:null}set contextClick(t){let e=this.contextClick;e!==t&&(t!==null&&f.k(t,dt,"contextClick"),this.Kt().Ar=t,this.t("contextClick",e,t))}get mouseEnter(){return this.p!==null?this.p.vr:null}set mouseEnter(t){let e=this.mouseEnter;e!==t&&(t!==null&&f.k(t,dt,"mouseEnter"),this.Kt().vr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.p!==null?this.p.Or:null}set mouseLeave(t){let e=this.mouseLeave;e!==t&&(t!==null&&f.k(t,dt,"mouseLeave"),this.Kt().Or=t,this.t("mouseLeave",e,t))}get mouseOver(){return this.p!==null?this.p.Tr:null}set mouseOver(t){let e=this.mouseOver;e!==t&&(t!==null&&f.k(t,dt,"mouseOver"),this.Kt().Tr=t,this.t("mouseOver",e,t))}get mouseHover(){return this.p!==null?this.p.Dr:null}set mouseHover(t){let e=this.mouseHover;e!==t&&(t!==null&&f.k(t,dt,"mouseHover"),this.Kt().Dr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.p!==null?this.p.Fr:null}set mouseHold(t){let e=this.mouseHold;e!==t&&(t!==null&&f.k(t,dt,"mouseHold"),this.Kt().Fr=t,this.t("mouseHold",e,t))}get mouseDragEnter(){return this.p!==null?this.p.I0:null}set mouseDragEnter(t){let e=this.mouseDragEnter;e!==t&&(t!==null&&f.k(t,dt,"mouseDragEnter"),this.Kt().I0=t,this.t("mouseDragEnter",e,t))}get mouseDragLeave(){return this.p!==null?this.p.E0:null}set mouseDragLeave(t){let e=this.mouseDragLeave;e!==t&&(t!==null&&f.k(t,dt,"mouseDragLeave"),this.Kt().E0=t,this.t("mouseDragLeave",e,t))}get mouseDrop(){return this.p!==null?this.p.Rr:null}set mouseDrop(t){let e=this.mouseDrop;e!==t&&(t!==null&&f.k(t,dt,"mouseDrop"),this.Kt().Rr=t,this.t("mouseDrop",e,t))}get actionDown(){return this.p!==null?this.p.U0:null}set actionDown(t){let e=this.actionDown;e!==t&&(t!==null&&f.k(t,dt,"actionDown"),this.Kt().U0=t,this.t("actionDown",e,t))}get actionMove(){return this.p!==null?this.p.B0:null}set actionMove(t){let e=this.actionMove;e!==t&&(t!==null&&f.k(t,dt,"actionMove"),this.Kt().B0=t,this.t("actionMove",e,t))}get actionUp(){return this.p!==null?this.p.V0:null}set actionUp(t){let e=this.actionUp;e!==t&&(t!==null&&f.k(t,dt,"actionUp"),this.Kt().V0=t,this.t("actionUp",e,t))}get actionCancel(){return this.p!==null?this.p.z0:null}set actionCancel(t){let e=this.actionCancel;e!==t&&(t!==null&&f.k(t,dt,"actionCancel"),this.Kt().z0=t,this.t("actionCancel",e,t))}get toolTip(){return this.p!==null?this.p.Ir:null}set toolTip(t){let e=this.toolTip;e!==t&&(this.Kt().Ir=t,this.t("toolTip",e,t))}get contextMenu(){return this.p!==null?this.p.Er:null}set contextMenu(t){let e=this.contextMenu;e!==t&&(this.Kt().Er=t,this.t("contextMenu",e,t))}findBindingPanel(){let t=this instanceof H?this:this.panel;for(;t!==null;){if(t.L2())return t;t=t.panel}return null}bind(t,e,i,s){return this.sf(t,e,i,s),this}bindTwoWay(t,e,i,s){return this.sf(t,e,i,s).makeTwoWay(),this}bindModel(t,e,i,s){return this.sf(t,e,i,s).ofModel(),this}bindObject(t,e,i,s,n){return this.sf(t,e,i,s).ofObject(n),this}theme(t,e,i,s,n){return this.mh(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.mh(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.mh(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.mh(t,e,i,s,n).ofModel(),this}sf(t,e,i,s){let n=null;return typeof t=="string"?n=new oe(t,e,i,s):n=t,this.X0(n),n}mh(t,e,i,s,n){let o=null;return typeof t=="string"?o=new pi(t,e,i,s,n):o=t,this.X0(o),o}X0(t){t.be=this;let e=this.findBindingPanel();e!==null&&e.TA()&&f.o("Cannot add a Binding to a template that has already been copied: "+t),this.Ci===null&&(this.Ci=new G),this.Ci.add(t)}set(t){return Object.assign(this,t),this}attach(t){return dt.A2(this,t),this}apply(t){return t(this),this}setProperties(t){return q.e0(this,t),this}static make(t,...e){let i=arguments,s=null,n=null;if(f.it(t))n=t;else if(typeof t=="string"){let r=dt.jb.get(t);f.it(r)?(i=Array.prototype.slice.call(i),s=r(i),f.Y(s)||f.o('GraphObject.make invoked object builder "'+t+'", but it did not return an Object')):n=A.go[t]}s===null&&((n==null||!n.constructor)&&f.o("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+t),s=new n);let o=1;if(s instanceof q&&i.length>1){let r=s,a=i[1];(typeof a=="string"||a instanceof HTMLDivElement)&&(r.AM(a),o++)}for(let r=o;r<i.length;r++){let a=i[r];a===void 0?f.o("Undefined value at argument "+r+" for object being constructed by GraphObject.make: "+s):dt.A2(s,a)}return s}static A2(t,e){if(typeof e=="number")dt.ev(t,e);else if(typeof e=="string")dt.sv(t,e);else if(e instanceof dt)t instanceof H||f.o("A GraphObject can only be added to a Panel, not to: "+t),t.add(e);else if(e instanceof Yt){let i;e.isRow&&f.it(t.getRowDefinition)?i=t.getRowDefinition(e.index):!e.isRow&&f.it(t.getColumnDefinition)&&(i=t.getColumnDefinition(e.index)),i instanceof Yt?i.Hb(e):f.o("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+t)}else if(e instanceof Ft){let i=t;i.type=e}else if(e instanceof oe)t instanceof dt||t instanceof Yt?t.bind(e):f.o("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+t);else if(e instanceof Fi)t instanceof dt?t.trigger(e):f.o("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof $t)t instanceof kt&&t.type===4?t.figures.add(e):f.o("A PathFigure can only be added to a Path Geometry, not to: "+t);else if(e instanceof vt)t instanceof $t?t.segments.add(e):f.o("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof ne)t instanceof q||t instanceof ft?t.layout=e:f.o("A Layout can only be assigned to a Diagram or a Group, not to: "+t);else if(Array.isArray(e))for(let i=0;i<e.length;i++){let s=e[i];dt.A2(t,s)}else f.Y(e)?dt.nv(t,e):f.o('Unknown initializer "'+e+'" for object being constructed by GraphObject.make: '+t)}static sv(t,e){if(t instanceof xt)t.text=e;else if(t instanceof ct)t.figure=e;else if(t instanceof zt)t.source=e;else if(t instanceof H){let i=Ft.es.get(e);i!==null&&(t.type=i)}else if(t instanceof E){let i=f.Uh(qe,e);i!==null?t.type=i:f.o("Unknown Brush type as an argument to GraphObject.make: "+e)}else if(t instanceof kt){let i=f.Uh(ei,e);i!==null&&(t.type=i)}else if(t instanceof vt){let i=f.Uh(Ci,e);i!==null&&(t.type=i)}}static ev(t,e){f.it(t.oi)?t.oi(e):f.er(t,e)}static nv(t,e){if(t instanceof E){let i=new K;for(let s in e){let n=parseFloat(s);isNaN(n)?i[s]=e[s]:t.addColorStop(n,e[s])}q.e0(t,i)}else if(t instanceof Yt){if(e.row!==void 0){let s=e.row;(s==null||s===1/0||isNaN(s)||s<0)&&f.o("Must specify non-negative integer row for RowColumnDefinition "+e+", not: "+s),t.isRow=!0,t.index=s}else if(e.column!==void 0){let s=e.column;(s==null||s===1/0||isNaN(s)||s<0)&&f.o("Must specify non-negative integer column for RowColumnDefinition "+e+", not: "+s),t.isRow=!1,t.index=s}let i=new K;for(let s in e)s==="row"||s==="column"||(i[s]=e[s]);q.e0(t,i)}else q.e0(t,e)}static build(t,e,...i){let s=dt.jb.get(t);if(f.it(s)){let n=s([t].concat(i));if(n instanceof dt)return e&&n.setProperties(e),n}f.o('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')}static defineBuilder(t,e){f.s(t,"string",dt,"defineBuilder:name"),f.k(e,dt,"defineBuilder:func");let i=t.toLowerCase();dt.jb.set(t,e)}static isBuilderDefined(t){return dt.jb.has(t)}static takeBuilderArgument(t,e,i){i===void 0&&(i=null);let s=t[1];return(f.it(i)?i(s):typeof s=="string")?(t.splice(1,1),s):(e===void 0&&f.o("no "+(f.it(i)?"satisfactory":"string")+" argument for GraphObject builder "+t[0]),e)}static jb=new pt}dt.Vertical=4,dt.Horizontal=5,dt.defineBuilder("Button",x=>{let t="#f5f5f5",e="#737373",i="#d4d4d4",s="#737373",n="#a3a3a3",o=2.76142374915397,r=2.761423749153969,a=new H(H.Auto,{isActionable:!0,enabledChanged:(h,l)=>{if(h instanceof H){let c=h.findObject("ButtonBorder");if(c!==null)if(h._buttonFillNormal===void 0&&(h._buttonFillNormal=c.fill),l){let u=null;h.layer!==null&&h.diagram!==null&&h.isVisibleObject()&&(u=h.layer.findObjectAt(h.diagram.lastInput.documentPoint)),u===h||u!==null&&u.isContainedBy(h)?c.fill=h._buttonFillOver:c.fill=h._buttonFillNormal}else c.fill=h._buttonFillDisabled}},cursor:"pointer"}).attach({_buttonFillNormal:void 0,_buttonStrokeNormal:void 0,_buttonFillOver:i,_buttonStrokeOver:s,_buttonFillDisabled:n}).add(new ct("RoundedRectangle",{name:"ButtonBorder",spot1:new D(0,0,o,r),spot2:new D(1,1,-o,-r),parameter1:2,fill:t,stroke:e}));return a.mouseEnter=(h,l,c)=>{if(!l.isEnabledObject()||!(l instanceof H))return;let u=l.findObject("ButtonBorder");u instanceof ct&&(l._buttonFillNormal===void 0&&(l._buttonFillNormal=u.fill),u.fill=l._buttonFillOver,l._buttonStrokeNormal===void 0&&(l._buttonStrokeNormal=u.stroke),u.stroke=l._buttonStrokeOver)},a.mouseLeave=(h,l,c)=>{if(!l.isEnabledObject()||!(l instanceof H))return;let u=l.findObject("ButtonBorder");u instanceof ct&&(l._buttonFillNormal!==void 0&&(u.fill=l._buttonFillNormal),l._buttonStrokeNormal!==void 0&&(u.stroke=l._buttonStrokeNormal))},a}),dt.defineBuilder("TreeExpanderButton",x=>{let t=dt.build("Button");return t.attach({_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine",visible:!1}),t.add(new ct("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:Q.nu}).bindObject("figure","isTreeExpanded",(e,i)=>{let s=i.panel;return e?s._treeExpandedFigure:s._treeCollapsedFigure})),t.bindObject("visible","isTreeLeaf",e=>!e),t.click=(e,i)=>{let s=i.part;if(s instanceof St&&(s=s.adornedPart),!(s instanceof rt))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isTreeExpanded){if(!o.canCollapseTree(s))return}else if(!o.canExpandTree(s))return;e.handled=!0,s.isTreeExpanded?o.collapseTree(s):o.expandTree(s)},t}),dt.defineBuilder("SubGraphExpanderButton",x=>{let t=dt.build("Button");return t.attach({_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"}),t.add(new ct("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:Q.nu}).bindObject("figure","isSubGraphExpanded",(e,i)=>{let s=i.panel;return e?s._subGraphExpandedFigure:s._subGraphCollapsedFigure})),t.click=(e,i)=>{let s=i.part;if(s instanceof St&&(s=s.adornedPart),!(s instanceof ft))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isSubGraphExpanded){if(!o.canCollapseSubGraph(s))return}else if(!o.canExpandSubGraph(s))return;e.handled=!0,s.isSubGraphExpanded?o.collapseSubGraph(s):o.expandSubGraph(s)},t}),dt.defineBuilder("ToolTip",x=>new St(H.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).add(new ct("RoundedRectangle",{name:"Border",parameter1:1,fill:"#f5f5f5",strokeWidth:0,spot1:new D(0,0,4,6),spot2:new D(1,1,-4,-4)}))),dt.defineBuilder("ContextMenu",x=>new St(H.Vertical,{background:"#f5f5f5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).bindObject("background","",t=>t.adornedPart!==null&&t.hasPlaceholder()?null:"#f5f5f5")),dt.defineBuilder("ContextMenuButton",x=>{let t=dt.build("Button");t.stretch=5;let e=t.findObject("ButtonBorder");return e instanceof ct&&(e.figure="Rectangle",e.strokeWidth=0,e.spot1=new D(0,0,4,6),e.spot2=new D(1,1,-4,-4)),t}),dt.defineBuilder("PanelExpanderButton",x=>{let t=dt.takeBuilderArgument(x,"COLLAPSIBLE"),e=dt.build("Button");e.attach({_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8","ButtonBorder.fill":"rgba(0, 0, 0, 0)",_buttonFillNormal:"rgba(0, 0, 0, 0)","ButtonBorder.stroke":null,_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null}),e.add(new ct({name:"ButtonIcon",strokeWidth:2}).bindObject("geometryString","visible",s=>s?e._buttonExpandedFigure:e._buttonCollapsedFigure,void 0,t));let i=e.findObject("ButtonBorder");return i instanceof ct&&(i.stroke=null,i.fill="rgba(0, 0, 0, 0)"),e.click=(s,n)=>{if(!(n instanceof H))return;let o=n.diagram;if(o===null||o.isReadOnly)return;let r=n.findBindingPanel();if(r===null&&(r=n.part),r!==null){let a=r.findObject(t);a!==null&&(s.handled=!0,o.startTransaction("Collapse/Expand Panel"),a.visible=!a.visible,o.commitTransaction("Collapse/Expand Panel"))}},e}),dt.defineBuilder("CheckBoxButton",x=>{let t=dt.takeBuilderArgument(x),e=dt.build("Button",{desiredSize:new Q(14,14)});e.attach({"ButtonBorder.spot1":new D(0,0,1,1),"ButtonBorder.spot2":new D(1,1,-1,-1)});let i=new ct({name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:2,geometryStretch:6,visible:!1});return t!==""&&i.bindTwoWay("visible",t),e.add(i),e.click=(s,n)=>{if(!(n instanceof H))return;let o=s.diagram;if(o===null||o.isReadOnly||t!==""&&o.model.isReadOnly)return;s.handled=!0;let r=n.findObject("ButtonIcon");o.startTransaction("checkbox"),r!==null&&(r.visible=!r.visible),f.it(n._doClick)&&n._doClick(s,n),o.commitTransaction("checkbox")},e}),dt.defineBuilder("CheckBox",x=>{let t=dt.takeBuilderArgument(x),e=dt.build("CheckBoxButton",{name:"Button",isActionable:!1,margin:new Lt(0,1,0,0)},t),i=new H("Horizontal",{isActionable:!0,cursor:e.cursor,margin:new Lt(1),mouseEnter:e.mouseEnter,mouseLeave:e.mouseLeave,click:e.click}).attach({_buttonFillNormal:e._buttonFillNormal,_buttonStrokeNormal:e._buttonStrokeNormal,_buttonFillOver:e._buttonFillOver,_buttonStrokeOver:e._buttonStrokeOver,_buttonFillDisabled:e._buttonFillDisabled,_buttonClick:e.click});return i.add(e),e.mouseEnter=null,e.mouseLeave=null,e.click=null,i});class oi{fi;Pt;Hn;Ci;qn;Gs;Sl;Cr;Lr;Ar;vr;Or;Tr;Dr;Fr;I0;E0;Rr;U0;B0;V0;z0;Ir;Er;k0;D0;ws;pr;yr;$n;T0;A0;gr;x0;G0;Y0;constructor(){this.fi=!1,this.Pt="",this.Hn=-1,this.Ci=null,this.qn=null,this.Gs=null,this.Sl="",this.Cr=null,this.Lr=null,this.Ar=null,this.vr=null,this.Or=null,this.Tr=null,this.Dr=null,this.Fr=null,this.I0=null,this.E0=null,this.Rr=null,this.U0=null,this.B0=null,this.V0=null,this.z0=null,this.Ir=null,this.Er=null,this.k0=null,this.D0=null,this.ws=null,this.pr=Q.sc,this.yr=Q.Bk,this.$n=1,this.T0=1,this.A0=1,this.gr=0,this.x0=null,this.G0=null,this.Y0="category"}copy(){let t=new oi;return t.Pt=this.Pt,t.Hn=this.Hn,t.Ci=this.Ci,t.Gs=this.Gs,t.Sl=this.Sl,t.Cr=this.Cr,t.Lr=this.Lr,t.Ar=this.Ar,t.vr=this.vr,t.Or=this.Or,t.Tr=this.Tr,t.Dr=this.Dr,t.Fr=this.Fr,t.I0=this.I0,t.E0=this.E0,t.Rr=this.Rr,t.U0=this.U0,t.B0=this.B0,t.V0=this.V0,t.z0=this.z0,t.Ir=this.Ir,t.Er=this.Er,t.k0=this.k0,t.D0=this.D0,t.ws=this.ws,t.pr=this.pr.P(),t.yr=this.yr.P(),t.$n=this.$n,t.T0=this.T0,t.A0=this.A0,t.gr=this.gr,t.x0=this.x0,t.G0=this.G0,t.Y0=this.Y0,t}}class ts{m;constructor(){this.m=[1,0,0,1,0,0]}copy(){let t=new ts;return t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5],t}translate(t,e){this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e}scale(t,e){this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e}rotate(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return;this.translate(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m[0]*s+this.m[2]*n,r=this.m[1]*s+this.m[3]*n,a=this.m[0]*-n+this.m[2]*s,h=this.m[1]*-n+this.m[3]*s;this.m[0]=o,this.m[1]=r,this.m[2]=a,this.m[3]=h,this.translate(-e,-i)}}class Oi{type;x1;y1;r1;x2;y2;r2;colors;pattern;constructor(t){this.type=t,this.x1=0,this.y1=0,this.r1=0,this.x2=0,this.y2=0,this.r2=0,this.colors=[],this.pattern=null}addColorStop(t,e){this.colors.push({offset:t,color:e})}}class Ri{Tt;li;jr;Yu;T2;constructor(t,e,i){let s=e===void 0?A.document:e;this.jr=s,this.T2="http://www.w3.org/2000/svg";let n="http://www.w3.org/2000/xmlns/";s!==void 0&&(this.Tt=this.makeElement("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.style.letterSpacing="normal",this.style.wordSpacing="normal",i||(this.style.position="absolute"),this.Tt.setAttributeNS(n,"xmlns",this.T2),this.Tt.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink")),this.Yu=null,this.li=new ue(this,i)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",this.Tt.setAttributeNS(null,"width",i+"px"),this.Tt.setAttributeNS(null,"height",s+"px"),this.Tt.setAttributeNS(null,"viewBox","0 0 "+i+" "+s),this.li.D2.firstElementChild.setAttributeNS(null,"width",i+"px"),this.li.D2.firstElementChild.setAttributeNS(null,"height",s+"px"),!0):!1}makeElement(t,e,i){let s=this.jr.createElementNS(this.T2,t);if(f.Y(e))for(let n in e)s.setAttributeNS(n==="href"?"http://www.w3.org/1999/xlink":"",n,e[n]);return i!==void 0&&(s.textContent=i),s}getBoundingClientRect(){return this.Tt.getBoundingClientRect()}focus(){this.Tt.focus()}get width(){return this.Tt.width.baseVal.value}set width(t){this.Tt.setAttribute("width",t+"px")}get height(){return this.Tt.height.baseVal.value}set height(t){this.Tt.setAttribute("height",t+"px")}dispose(){this.jr=null}get style(){return this.Tt.style}}class ue{nf;of;un;Li;ze;fillStyle;font;globalAlpha;lineCap;lineDashOffset;lineJoin;lineWidth;miterLimit;shadowBlur;shadowColor;shadowOffsetX;shadowOffsetY;strokeStyle;textAlign;imageSmoothingEnabled;clipInsteadOfFill;lastCreatedElement;rf;lf;surface;svg;D2;DA;qb;Io;ph;Ma;currentElement;clipPathGroup;diagramGroup;lastDrawnPart;currentPath;outerGroup;pathAttributes;Zr;kr;filter;partClipRect;constructor(t,e){if(this.surface=t,this.svg=t.Tt,this.rf=[],this.lf=[],this.fillStyle="#000000",this.font="10px sans-serif",this.globalAlpha=1,this.lineCap="butt",this.lineDashOffset=0,this.lineJoin="miter",this.lineWidth=1,this.miterLimit=10,this.shadowBlur=0,this.shadowColor="rgba(0, 0, 0, 0)",this.shadowOffsetX=0,this.shadowOffsetY=0,this.Zr=!1,this.strokeStyle="#000000",this.textAlign="start",this.clipInsteadOfFill=!1,this.nf=0,this.of=0,this.un=0,this.lastCreatedElement=null,this.currentElement=null,this.Li=[],this.pathAttributes={},this.qb=!1,this.Io=null,this.ph=0,this.ze=new ts,t.jr===null||t.jr===void 0)return;this.clipPathGroup=this.newGroup2(),this.diagramGroup=this.newGroup2("gojs-diagram"),this.lastDrawnPart=null,this.currentPath=null;let i=I.mw++,s=this.makeElement("clipPath",{id:"mainClip"+i}),n={x:0,y:0,width:t.width,height:t.height};s.appendChild(this.makeElement("rect",n)),this.D2=s,this.svg.appendChild(this.clipPathGroup),this.clipPathGroup.appendChild(this.diagramGroup),this.svg.appendChild(s),this.clipPathGroup.setAttributeNS(null,"clip-path","url(#mainClip"+i+")"),this.DA={},this.kr=!!e,this.filter="",this.partClipRect=null}setDiagramPosScale(t,e,i,s,n,o){this.diagramGroup===void 0?this.newGroup(t,e,i,s,n,o):this.diagramGroup.setAttribute("transform","matrix("+t+", "+e+", "+i+", "+s+", "+n+", "+o+")")}resetInnerSVG(){this.diagramGroup!==null&&(this.diagramGroup.innerHTML="")}arc(t,e,i,s,n,o,r,a){let h=2*Math.PI,l=1e-6,c=h-l,u=i*Math.cos(s),d=i*Math.sin(s),g=t+u,p=e+d,m=o?0:1,y=o?s-n:n-s;(Math.abs(r-g)>l||Math.abs(a-p)>l)&&this.Li.push(["L",g,+p]),y<0&&(y=y%h+h),y>c?(this.Li.push(["A",i,i,0,1,m,t-u,e-d]),this.Li.push(["A",i,i,0,1,m,g,p])):y>l&&this.Li.push(["A",i,i,0,+(y>=Math.PI),m,t+i*Math.cos(n),e+i*Math.sin(n)])}beginPath(){this.Li=[],this.pathAttributes={stroke:"none",fill:"none"}}endPath(t){this.ov(this.Li,this.ze,t||0)}bezierCurveTo(t,e,i,s,n,o){this.Li.push(["C",t,e,i,s,n,o])}clearRect(t,e,i,s){}clip(){this.pathAttributes.clipPath=!0}closePath(){this.Li.push(["z"])}createLinearGradient(t,e,i,s){let n=new Oi("linear");return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}createPattern(t,e){let i="";t instanceof HTMLCanvasElement&&(i=t.toDataURL()),t instanceof HTMLImageElement&&(i=t.getAttribute("src"));let s=this.DA;if(s[i])return"url(#"+s[i]+")";let n="PATTERN"+I.mw++,o={width:t.width,height:t.height,id:n,patternUnits:"userSpaceOnUse"},r={x:0,y:0,width:t.width,height:t.height,href:i},a=this.makeElement("pattern",o);return a.appendChild(this.makeElement(q.img,r)),this.svg.appendChild(a),s[i]=n,"url(#"+n+")"}createRadialGradient(t,e,i,s,n,o){let r=new Oi("radial");return r.x1=t,r.y1=e,r.r1=i,r.x2=s,r.y2=n,r.r2=o,r}amendImageTransform(t,e,i,s,n,o,r,a){let h=r/i,l=a/s;(n!==0||o!==0)&&this.ze.translate(n,o),(h!==1||l!==1)&&this.ze.scale(h,l),(t!==0||e!==0)&&this.ze.translate(-t,-e)}drawImage(t,e,i,s,n,o,r,a,h){let l="";t instanceof HTMLCanvasElement&&(l=t.toDataURL()),t instanceof HTMLImageElement&&(l=t.getAttribute("src"));let c=t instanceof HTMLImageElement?t.naturalWidth:t.width,u=t instanceof HTMLImageElement?t.naturalHeight:t.height;s===void 0&&(o=e,r=i,a=s=c,h=n=u),s=s||0,n=n||0,o=o||0,r=r||0,a=a||0,h=h||0,this.amendImageTransform(e,i,s,n,o,r,a,h);let d={x:0,y:0,width:c||s,height:u||n,href:l};!L.z(s,a)||!L.z(n,h)?d.preserveAspectRatio="none":l.toLowerCase().indexOf(".svg")===-1&&l.toLowerCase().indexOf("data:image/svg")===-1&&(d.preserveAspectRatio="xMidYMid slice"),(e!==0||i!==0||s!==c||n!==u)&&(s+=e,n+=i,d["clip-path"]=`path('M ${e},${i} L ${s} ${i} L ${s} ${n} L ${e} ${n} z')`),this.processCommon(q.img,d,this.ze),this._u(q.img,d)}fill(t,e){t&&(this.pathAttributes["fill-rule"]="evenodd"),this.setFill(this.pathAttributes)}fillContext(t,e,i){this.clipInsteadOfFill?this.clip():this.fill(e,i)}createOrUpdateClipGroup(t,e){let i=this.newGroup(1,0,0,1,-e.x,-e.y);i.setAttributeNS(null,"class","spotClip"),t.ah=i}fillRect(t,e,i,s){this.addRect("fill",[t,e,i,s],this.ze)}fillBackground(t,e,i,s){let n={x:t,y:e,width:i,height:s};this.processCommon("fill",n,this.ze),this.setFill(n),this.svg.prepend(this.makeElement("rect",n))}fillText(t,e,i){this.addText("fill",[t,e,i],this.ze)}lineTo(t,e){this.Li.push(["L",t,e])}moveTo(t,e){this.Li.push(["M",t,e])}quadraticCurveTo(t,e,i,s){this.Li.push(["Q",t,e,i,s])}rect(t,e,i,s){this.Li.push(["M",t,e],["L",t+i,e],["L",t+i,e+s],["L",t,e+s],["z"])}restore(){this.ze=this.rf.pop(),this.Li=this.rf.pop();let t=this.rf.pop();this.fillStyle=t.fillStyle,this.font=t.font,this.globalAlpha=t.globalAlpha,this.lineCap=t.lineCap,this.lineDashOffset=t.lineDashOffset,this.lineJoin=t.lineJoin,this.lineWidth=t.lineWidth,this.miterLimit=t.miterLimit,this.shadowBlur=t.shadowBlur,this.shadowColor=t.shadowColor,this.shadowOffsetX=t.shadowOffsetX,this.shadowOffsetY=t.shadowOffsetY,this.strokeStyle=t.strokeStyle,this.textAlign=t.textAlign,this.partClipRect=t.partClipRect}save(){let t={fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign,partClipRect:this.partClipRect};this.rf.push(t);let e=[];for(let i=0;i<this.Li.length;i++)e.push(this.Li[i]);this.rf.push(e),this.rf.push(this.ze.copy())}setTransform(t,e,i,s,n,o){t===1&&e===0&&i===0&&s===1&&n===0&&o===0||this.newGroup(t,e,i,s,n,o)}setCurrentTransform(t,e,i,s,n,o){this.ze.m=[t,e,i,s,n,o]}getCurrentTransform(){let t=this.ze.m;return"matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}scale(t,e){this.ze.scale(t,e)}translate(t,e){this.ze.translate(t,e)}transform(t,e,i,s,n,o){}commitTransform(){}stroke(){this.setStroke(this.pathAttributes)}strokeContext(){this.clipInsteadOfFill||this.stroke()}strokeRect(t,e,i,s){this.addRect("stroke",[t,e,i,s],this.ze)}makeElement(t,e,i){return this.surface.makeElement(t,e,i)}_u(t,e,i){let s=this.makeElement(t,e,i);return this.currentElement!==null?this.currentElement.appendChild(s):this.currentElement=s,this.lastCreatedElement=s,s}processCommon(t,e,i){if(t==="fill"?this.setFill(e):t==="stroke"&&this.setStroke(e),i!==null){let s=i.m;e.transform="matrix("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+", "+s[4]+", "+s[5]+")"}}setFill(t){if(this.fillStyle instanceof Oi){t.fill=this.addGradient(this.fillStyle,!0);return}if(/^rgba\(/.test(this.fillStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.fill="rgb("+e[1]+","+e[2]+","+e[3]+")",t["fill-opacity"]=e[4]}else t.fill=this.fillStyle}setFillOrStrokeInPlace(t,e){let i=e?"fill":"stroke";if(this.fillStyle instanceof Oi){t.setAttributeNS(null,"fill",this.addGradient(this.fillStyle,!0));return}if(/^rgba\(/.test(this.fillStyle)){let s=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.setAttributeNS(null,i,"rgb("+s[1]+","+s[2]+","+s[3]+")"),t.setAttributeNS(null,i+"-opacity",s[4])}else t.setAttributeNS(null,i,this.fillStyle)}setStroke(t){if(this.strokeStyle instanceof Oi)t.stroke=this.addGradient(this.strokeStyle,!1);else if(/^rgba\(/.test(this.strokeStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.strokeStyle);t.stroke="rgb("+e[1]+","+e[2]+","+e[3]+")",t["stroke-opacity"]=e[4]}else t.stroke=this.strokeStyle;t["stroke-width"]=this.lineWidth,t["stroke-linecap"]=this.lineCap,t["stroke-linejoin"]=this.lineJoin,t["stroke-miterlimit"]=this.miterLimit,this.qb&&(t["stroke-dasharray"]=this.Io.toString(),t["stroke-dashoffset"]=this.ph)}addGradient(t,e){let i="",s=this.currentPath!==null?this.currentPath.getAttribute(e?"fill":"stroke"):null;if(s!==null&&s.indexOf("GRAD")!==-1){i=s.split("#")[1].slice(0,-1);let h=this.svg.getElementById(i);h!==null&&h.remove()}else i="GRAD"+I.mw++;let n;if(t.type==="linear"){let h={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,id:i,gradientUnits:"userSpaceOnUse"};n=this.makeElement("linearGradient",h)}else if(t.type==="radial"){let h={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,r1:t.r1,r2:t.r2,id:i};n=this.makeElement("radialGradient",h)}else f.o("invalid gradient");let o=t.colors,r=o.length,a=[];for(let h=0;h<r;h++){let l=o[h],c=l.color,u={offset:l.offset,"stop-color":c};if(/^rgba\(/.test(c)){let d=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(c);u["stop-color"]="rgb("+d[1]+","+d[2]+","+d[3]+")",u["stop-opacity"]=d[4]}a.push(u)}a.sort((h,l)=>h.offset>l.offset?1:-1);for(let h=0;h<r;h++)n.appendChild(this.makeElement("stop",a[h]));return this.svg.appendChild(n),"url(#"+i+")"}addRect(t,e,i){let s={x:e[0],y:e[1],width:e[2],height:e[3]};this.processCommon(t,s,i),this._u("rect",s)}addText(t,e,i){let s=this.textAlign;s==="left"?s="start":s==="right"?s="end":s==="center"&&(s="middle");let n={x:e[1],y:e[2],style:"font: "+this.font,"text-anchor":s};this.processCommon(t,n,i),this._u("text",n,e[0])}ov(t,e,i){let s=this.rv(t),n=this.pathAttributes;if(n.clipPath){this.lf.length>1&&this.lf[this.lf.length-2].setAttributeNS(null,"clip-path",'path("'+s+'") view-box');return}if(n.d=s,this.processCommon("",n,e),this.currentPath!==null){let o=this.currentPath;if(o.nodeName!=="g")for(let r in n)r!=="transform"&&o.setAttributeNS(null,r,n[r]);else{let r=o.getElementsByTagName("path");for(let a in n)a!=="transform"&&r[i].setAttributeNS(null,a,n[a])}}else this._u("path",n)}rv(t){let e=[];for(let i=0;i<t.length;i++){let s=t[i].slice(),n=[s.shift()];if(n[0]==="A")n.push(s.shift()+","+s.shift(),s.shift(),s.shift()+","+s.shift(),s.shift()+","+s.shift());else for(;s.length;)n.push(s.shift()+","+s.shift());e.push(n.join(" "))}return e.join(" ")}newGroup(t,e,i,s,n,o){let r=new ts;r.m=[t,e,i,s,n,o];let a={};this.processCommon("g",a,r);let h=this._u("g",a);return this.lf.push(h),h}newGroup2(t){let e={};t&&(e.class=t);let i=this._u("g",e);return this.lf.push(i),i}endGroup(){return this.lf.pop()}dummyGroup(){return this.newGroup2(),this.endGroup()}shadowsSet(t,e,i){this.nf=t,this.of=e,this.un=i}shadowsOff(){this.Zr=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.Zr=!0,this.shadowOffsetX=this.nf,this.shadowOffsetY=this.of,this.shadowBlur=this.un}enableDash(t,e){this.qb=!0,this.Io=t,this.ph=e}disableDash(){this.qb=!1}clearContextCache(t){}setImageSmoothingEnabled(t){}rotate(t){this.ze.rotate(t*57.2958,0,0)}getImageData(t,e,i,s){return null}measureText(t){return null}removeOldGradient(t,e,i){let s=e.getAttribute(i);if(s===null)return;let n=s.split("#");if(n.length===1)return;let o=this.svg.getElementById(n[1].slice(0,-1));if(o!==null){let r=new RegExp(o.id,"g");this.svg.innerHTML.match(r).length===1&&o.remove()}}removePartFromView(t){t.svg!==null&&t.svg.parentNode===this.diagramGroup&&t.svg.remove()}}class Ue{Tt;li;jr;Yu;constructor(t,e,i,s){let n=e===void 0?A.document:e;this.jr=n,this.Yu=null;let o=n.createElement("canvas");o.tabIndex=0,this.Tt=o,this.li=new Ei(o,i,s),q.Qe.set(o,t)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",!0):!1}toDataURL(t,e){return this.Tt.toDataURL(t,e)}getBoundingClientRect(){return this.Tt.getBoundingClientRect()}focus(){this.Tt.focus()}get width(){return this.Tt.width}set width(t){this.Tt.width=t}get height(){return this.Tt.height}set height(t){this.Tt.height=t}dispose(){q.Qe.delete(this.Tt),this.jr=null}get style(){return this.Tt.style}}class Ei{E;Wb;Jb;$b;clipInsteadOfFill;nf;of;un;Ma;Zr;kr;constructor(t,e,i){this.E=t.getContext?t.getContext("2d",e):null,this.E===null&&f.o("Browser does not support HTML Canvas Element"),this.Wb="",this.Jb="",this.$b="",this.clipInsteadOfFill=!1,this.nf=0,this.of=0,this.un=0,this.Zr=!1,this.Ma=new Pt,this.kr=!!i}createOrUpdateClipGroup(t,e){}setImageSmoothingEnabled(t){this.E.imageSmoothingEnabled=t}get fillStyle(){return this.E.fillStyle}set fillStyle(t){this.$b!==t&&(this.E.fillStyle=t,this.$b=t)}get font(){return this.E.font}set font(t){this.Wb!==t&&(this.E.font=t,this.Wb=t)}get globalAlpha(){return this.E.globalAlpha}set globalAlpha(t){this.E.globalAlpha=t}get lineCap(){return this.E.lineCap}set lineCap(t){this.E.lineCap=t}get lineDashOffset(){return this.E.lineDashOffset}set lineDashOffset(t){this.E.lineDashOffset=t}get lineJoin(){return this.E.lineJoin}set lineJoin(t){this.E.lineJoin=t}get lineWidth(){return this.E.lineWidth}set lineWidth(t){this.E.lineWidth=t}get miterLimit(){return this.E.miterLimit}set miterLimit(t){this.E.miterLimit=t}get shadowBlur(){return this.E.shadowBlur}set shadowBlur(t){this.E.shadowBlur=t}get shadowColor(){return this.E.shadowColor}set shadowColor(t){this.E.shadowColor=t}get shadowOffsetX(){return this.E.shadowOffsetX}set shadowOffsetX(t){this.E.shadowOffsetX=t}get shadowOffsetY(){return this.E.shadowOffsetY}set shadowOffsetY(t){this.E.shadowOffsetY=t}get strokeStyle(){return this.E.strokeStyle}set strokeStyle(t){this.Jb!==t&&(this.E.strokeStyle=t,this.Jb=t)}get textAlign(){return this.E.textAlign}set textAlign(t){this.E.textAlign=t}get imageSmoothingEnabled(){return this.E.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.E.imageSmoothingEnabled=t}get filter(){return this.E.filter}set filter(t){t===""?this.E.filter="none":this.E.filter=t}arc(t,e,i,s,n,o,r,a){this.E.arc(t,e,i,s,n,o)}beginPath(){this.E.beginPath()}endPath(){}bezierCurveTo(t,e,i,s,n,o){this.E.bezierCurveTo(t,e,i,s,n,o)}clearRect(t,e,i,s){this.commitTransform(),this.E.clearRect(t,e,i,s)}clip(t){t?this.E.clip(t):this.E.clip()}closePath(){this.E.closePath()}createLinearGradient(t,e,i,s){return this.E.createLinearGradient(t,e,i,s)}createPattern(t,e){return this.E.createPattern(t,e)}createRadialGradient(t,e,i,s,n,o){return this.E.createRadialGradient(t,e,i,s,n,o)}drawImage(t,e,i,s,n,o,r,a,h){s===void 0?this.E.drawImage(t,e,i):this.E.drawImage(t,e,i,s,n,o,r,a,h)}fill(t,e){e?this.E.fill(e,t?"evenodd":"nonzero"):this.E.fill(t?"evenodd":"nonzero")}fillRect(t,e,i,s){this.E.fillRect(t,e,i,s)}fillBackground(t,e,i,s){this.E.fillRect(t,e,i,s)}fillText(t,e,i){this.E.fillText(t,e,i)}getImageData(t,e,i,s){return this.E.getImageData(t,e,i,s)}lineTo(t,e){this.E.lineTo(t,e)}measureText(t){return this.E.measureText(t)}moveTo(t,e){this.E.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.E.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.E.rect(t,e,i,s)}restore(){this.E.restore()}save(){this.commitTransform(),this.E.save()}rotate(t){this.Ma.cs(t*57.2958,0,0)}setTransform(t,e,i,s,n,o){this.Ma.setTo(t,e,i,s,n,o)}scale(t,e){this.Ma.tt(t,e)}translate(t,e){this.Ma.Fs(t,e)}stroke(t){t?this.E.stroke(t):this.E.stroke()}transform(t,e,i,s,n,o){if(t===1&&e===0&&i===0&&s===1&&n===0&&o===0)return;let r=this.Ma,a=r.m11*t+r.m21*e,h=r.m12*t+r.m22*e,l=r.m11*i+r.m21*s,c=r.m12*i+r.m22*s;r.dx=r.m11*n+r.m21*o+r.dx,r.dy=r.m12*n+r.m22*o+r.dy,r.m11=a,r.m12=h,r.m21=l,r.m22=c}commitTransform(){let t=this.Ma;this.E.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy)}fillContext(t,e,i){this.radialFill(t,e,i)||this.fillOrClip(e,i)}radialFill(t,e,i){if(!(t instanceof E)||t.type!==3)return!1;let s=t._c,n=t.Yb;return n>s?(this.scale(s/n,1),this.translate((n-s)/2,0)):s>n&&(this.scale(1,n/s),this.translate(0,(s-n)/2)),this.fillOrClip(e,i),n>s?(this.translate(-(n-s)/2,0),this.scale(1/(s/n),1)):s>n&&(this.translate(0,-(s-n)/2),this.scale(1,1/(n/s))),!0}strokeContext(){this.clipInsteadOfFill||this.stroke()}fillOrClip(t,e){this.clipInsteadOfFill?this.clip(e):this.fill(t,e)}shadowsSet(t,e,i){this.nf=t,this.of=e,this.un=i}shadowsOff(){this.Zr=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.Zr=!0,this.shadowOffsetX=this.nf,this.shadowOffsetY=this.of,this.shadowBlur=this.un}enableDash(t,e){let i=this.E;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=e)}disableDash(){let t=this.E;t.setLineDash!==void 0&&(t.setLineDash(Ei.EmptyArray),t.lineDashOffset=0)}clearContextCache(t){t&&(this.Wb=""),this.Jb="",this.$b=""}removePartFromView(t){}static EmptyArray=Object.freeze([])}var qe=(x=>(x[x.Solid=1]="Solid",x[x.Linear=2]="Linear",x[x.Radial=3]="Radial",x[x.Pattern=4]="Pattern",x))(qe||{}),Tn=(x=>(x[x.Lab=1]="Lab",x[x.HSL=2]="HSL",x[x.Oklch=3]="Oklch",x))(Tn||{});class fi{n0;n1;n2;n3;constructor(){this.n0=0,this.n1=0,this.n2=0,this.n3=0}}class E{h;H;Na;ei;gs;K0;j0;Eo;H0;cn;_c;Yb;constructor(t,e){if(I.Ki(this),this.h=!1,t===void 0)this.H=1,this.Na="black";else if(typeof t=="string"){let s=f.Uh(qe,t);s!==null?(this.H=s,this.Na="black"):(this.H=1,this.Na=t)}else Object.keys(qe).hasOwnProperty(t)?(this.H=t,this.Na="black"):typeof t=="object"&&(this.H=1,e=t);let i=this.H;if(i===2?(this.ei=D.TopCenter,this.gs=D.BottomCenter):i===3?(this.ei=D.Center,this.gs=D.Center):(this.ei=D.None,this.gs=D.None),this.K0=0,this.j0=NaN,this.Eo=null,this.H0=null,this.cn=null,this._c=0,this.Yb=0,e){let s={};for(let n in e)isFinite(parseFloat(n))?this.addColorStop(parseFloat(n),e[n]):s[n]=e[n];Object.assign(this,s)}}copy(){let t=new E;return t.H=this.H,t.Na=this.Na,t.ei=this.ei.P(),t.gs=this.gs.P(),t.K0=this.K0,t.j0=this.j0,this.Eo!==null&&(t.Eo=this.Eo.copy()),t.H0=this.H0,t}u(){return this.h=!0,this.Eo!==null&&this.Eo.u(),this}oi(t){t in qe?this.type=t:f.er(this,t)}toString(){let t="Brush(";if(this.type===1)t+=this.color;else if(this.type===2?t+="Linear ":this.type===3?t+="Radial ":this.type===4?t+="Pattern ":t+="(unknown) ",t+=this.start+" "+this.end,this.colorStops!==null){let e=this.colorStops.iterator;for(;e.next();){let i=e.key,s=e.value;t+=" "+i+":"+s}}return t+=")",t}addColorStop(t,e){return this.h&&f.L(this),(typeof t!="number"||!isFinite(t)||t>1||t<0)&&f.W(t,"0 <= loc <= 1",E,"addColorStop:loc"),f.s(e,"string",E,"addColorStop:color"),this.Eo===null&&(this.Eo=new pt),this.Eo.set(t,e),this.H===1&&(this.type=2),this.cn=null,this}get type(){return this.H}set type(t){this.h&&f.L(this,t),this.H=t,this.start.isNoSpot()&&(t===2?this.start=D.TopCenter:t===3&&(this.start=D.Center)),this.end.isNoSpot()&&(t===2?this.end=D.BottomCenter:t===3&&(this.end=D.Center)),this.cn=null}get color(){return this.Na}set color(t){this.h&&f.L(this,t),this.Na=t,this.cn=null}get start(){return this.ei}set start(t){this.h&&f.L(this,t),this.ei=t.P(),this.cn=null}get end(){return this.gs}set end(t){this.h&&f.L(this,t),this.gs=t.P(),this.cn=null}get startRadius(){return this.K0}set startRadius(t){this.h&&f.L(this,t),t<0&&f.W(t,">= zero",E,"startRadius"),this.K0=t,this.cn=null}get endRadius(){return this.j0}set endRadius(t){this.h&&f.L(this,t),t<0&&f.W(t,">= zero",E,"endRadius"),this.j0=t,this.cn=null}get colorStops(){return this.Eo}set colorStops(t){this.h&&f.L(this,t),this.Eo=t,this.cn=null}get pattern(){return this.H0}set pattern(t){this.h&&f.L(this,t),this.H0=t,this.cn=null}static randomColor(t,e){t===void 0&&(t=128),e===void 0&&(e=Math.max(t,255));let i=Math.abs(e-t),s=Math.floor(t+Math.random()*i).toString(16),n=Math.floor(t+Math.random()*i).toString(16),o=Math.floor(t+Math.random()*i).toString(16);return s.length<2&&(s="0"+s),n.length<2&&(n="0"+n),o.length<2&&(o="0"+o),"#"+s+n+o}static isValidColor(t){return A.CSS?A.CSS.supports("color",t):!0}static lighten(t){return E.lightenBy(t)}lightenBy(t,e){this.h&&f.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)E.No(this.color),this.color=E.td(i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)E.No(n.value),this.addColorStop(n.key,E.td(i,s))}return this}static lightenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return E.No(t),E.td(s,n)}static darken(t){return E.darkenBy(t)}darkenBy(t,e){this.h&&f.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)E.No(this.color),this.color=E.td(-i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)E.No(n.value),this.addColorStop(n.key,E.td(-i,s))}return this}static darkenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return E.No(t),E.td(-s,n)}static mix(t,e,i){E.No(t);let s=E.G.n0,n=E.G.n1,o=E.G.n2,r=E.G.n3;E.No(e),i===void 0&&(i=.5);let a=Math.round((E.G.n0-s)*i+s),h=Math.round((E.G.n1-n)*i+n),l=Math.round((E.G.n2-o)*i+o),c=Math.round((E.G.n3-r)*i+r);return`rgba(${a}, ${h}, ${l}, ${c})`}isDark(){if(this.type===1)return E.isDark(this.color);if((this.type===2||this.type===3)&&this.colorStops!==null){let t=this.colorStops;if(this.type===3)return E.isDark(t.first().value);if(t.get(.5)!==null)return E.isDark(t.get(.5));if(t.count===2){let a=t.toArray();return E.isDark(E.mix(a[0].value,a[1].value))}let e=t.iterator,i=-1,s=-1,n=1,o=1;for(;e.next();){let a=e.key,h=Math.abs(.5-e.key);n>o&&h<n?(i=a,n=h):o>=n&&h<o&&(s=a,o=h)}if(i>s){let a=i;i=s,s=a,a=n,n=o,o=a}let r=s-i;return E.isDark(E.mix(t.get(i),t.get(s),1-o/r))}return!1}static isDark(t){return t?t instanceof E?t.isDark():(E.No(t),(299*E.G.n0+587*E.G.n1+114*E.G.n2)/1e3<128):!1}static td(t,e){switch(e){case 1:return E.lv(),E.Zn.n0=Math.min(100,Math.max(0,E.Zn.n0+100*t)),E.hv(),"rgba("+E.G.n0+", "+E.G.n1+", "+E.G.n2+", "+E.G.n3+")";case 2:return E.jS(),E.Ii.n2=Math.min(100,Math.max(0,E.Ii.n2+100*t)),"hsla("+E.Ii.n0+", "+E.Ii.n1+"%, "+E.Ii.n2+"%, "+E.Ii.n3+")";case 3:return E.av(),E.Qn.n0=Math.min(100,Math.max(0,E.Qn.n0+100*t)),E.cv(),"rgba("+E.G.n0+", "+E.G.n1+", "+E.G.n2+", "+E.G.n3+")";default:f.o("Unknown color space: "+e)}}static No(t){E.q0===!1&&(E.q0=!0,E._n=q.isUsingDOM()?new Ue(null,void 0,{willReadFrequently:!0}).li:null);let e=E._n;if(e===null)return;e.clearRect(0,0,1,1),e.fillStyle="#000000";let i=e.fillStyle;if(e.fillStyle=t,e.fillStyle!==i){e.fillRect(0,0,1,1);let s=e.getImageData(0,0,1,1).data;E.G.n0=s[0],E.G.n1=s[1],E.G.n2=s[2],E.G.n3=s[3]/255}else{e.fillStyle="#FFFFFF";let s=e.fillStyle;e.fillStyle=t,e.fillStyle,E.G.n0=0,E.G.n1=0,E.G.n2=0,E.G.n3=1}}static jS(){let t=E.G.n0/255,e=E.G.n1/255,i=E.G.n2/255,s=Math.max(t,e,i),n=Math.min(t,e,i),o=s-n,r,a,h=(s+n)/2;if(o===0)r=a=0;else{switch(s){case t:r=(e-i)/o%6;break;case e:r=(i-t)/o+2;break;case i:r=(t-e)/o+4;break}r*=60,r<0&&(r+=360),a=o/(1-Math.abs(2*h-1))}E.Ii.n0=Math.round(r),E.Ii.n1=Math.round(a*100),E.Ii.n2=Math.round(h*100),E.Ii.n3=E.G.n3}static DE(){let t=E.Ii.n0,e=E.Ii.n1/100,i=E.Ii.n2/100,s,n,o,r=(1-Math.abs(2*i-1))*e,a=t/60,h=r*(1-Math.abs(a%2-1));a>=0&&a<1?(s=r,n=h,o=0):a>=1&&a<2?(s=h,n=r,o=0):a>=2&&a<3?(s=0,n=r,o=h):a>=3&&a<4?(s=0,n=h,o=r):a>=4&&a<5?(s=h,n=0,o=r):a>=5&&a<6&&(s=r,n=0,o=h);let l=i-.5*r;s+=l,n+=l,o+=l,E.G.n0=Math.round(s*255),E.G.n1=Math.round(n*255),E.G.n2=Math.round(o*255),E.G.n3=E.Ii.n3}static lv(){E.FA(),E.fv()}static hv(){E.uv(),E.RA()}static F2(t){return t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}static R2(t){return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}static FA(){let t=E.F2(E.G.n0),e=E.F2(E.G.n1),i=E.F2(E.G.n2);E.Dt.n0=.4124564*t+.3575761*e+.1804375*i,E.Dt.n1=.2126729*t+.7151522*e+.072175*i,E.Dt.n2=.0193339*t+.119192*e+.9503041*i,E.Dt.n3=E.G.n3}static RA(){let t=3.2404542*E.Dt.n0+-1.5371385*E.Dt.n1+-.4985314*E.Dt.n2,e=-.969266*E.Dt.n0+1.8760108*E.Dt.n1+.041556*E.Dt.n2,i=.0556434*E.Dt.n0+-.2040259*E.Dt.n1+1.0572252*E.Dt.n2;E.G.n0=E.R2(t)*255,E.G.n1=E.R2(e)*255,E.G.n2=E.R2(i)*255,E.G.n3=E.Dt.n3,E.G.n0=Math.round(E.G.n0),E.G.n0>255?E.G.n0=255:E.G.n0<0&&(E.G.n0=0),E.G.n1=Math.round(E.G.n1),E.G.n1>255?E.G.n1=255:E.G.n1<0&&(E.G.n1=0),E.G.n2=Math.round(E.G.n2),E.G.n2>255?E.G.n2=255:E.G.n2<0&&(E.G.n2=0)}static v2=216/24389;static Zb=24389/27;static ed=[95.047,100,108.883];static O2(t){return t>E.v2?Math.pow(t,1/3):(E.Zb*t+16)/116}static fv(){let t=E.O2(E.Dt.n0*100/E.ed[0]),e=E.O2(E.Dt.n1*100/E.ed[1]),i=E.O2(E.Dt.n2*100/E.ed[2]);E.Zn.n0=116*e-16,E.Zn.n1=500*(t-e),E.Zn.n2=200*(e-i),E.Zn.n3=E.Dt.n3}static vA(t){let e=t*t*t;return e>E.v2?e:(116*t-16)/E.Zb}static uv(){let t=(E.Zn.n0+16)/116,e=E.Zn.n1/500+t,i=t-E.Zn.n2/200;E.Dt.n0=E.ed[0]/100*E.vA(e),E.Dt.n1=E.ed[1]/100*(E.Zn.n0>E.Zb*E.v2?Math.pow(t,3):E.Zn.n0/E.Zb),E.Dt.n2=E.ed[2]/100*E.vA(i),E.Dt.n3=E.Zn.n3}static dv(){let t=.8190224*E.Dt.n0+.3619062*E.Dt.n1+-.1288737*E.Dt.n2,e=.03298366*E.Dt.n0+.9292868*E.Dt.n1+.03614466*E.Dt.n2,i=.04817719*E.Dt.n0+.2642395*E.Dt.n1+.6335478*E.Dt.n2;t=Math.cbrt(t),e=Math.cbrt(e),i=Math.cbrt(i),E.ai.n0=.2104542*t+.7936177*e+-.004072046*i,E.ai.n1=1.977998*t+-2.428592*e+.4505937*i,E.ai.n2=.02590403*t+.7827717*e+-.8086757*i,E.ai.n3=E.Dt.n3,E.ai.n0*=100}static gv(){E.ai.n0/=100;let t=.9999999*E.ai.n0+.3963377*E.ai.n1+.2158037*E.ai.n2,e=1.000000009*E.ai.n0+-.1055613*E.ai.n1+-.06385417*E.ai.n2,i=1.00000005*E.ai.n0+-.08948418*E.ai.n1+-1.291485*E.ai.n2;t=t**3,e=e**3,i=i**3,E.Dt.n0=1.2268798*t+-.5578149*e+.281391*i,E.Dt.n1=-.04057576*t+1.112286*e+-.07171106*i,E.Dt.n2=-.07637294*t+-.4214933*e+1.586924*i,E.Dt.n3=E.ai.n3}static mv(){let t=Math.atan2(E.ai.n2,E.ai.n1)*180/Math.PI;E.Qn.n0=E.ai.n0,E.Qn.n1=Math.sqrt(E.ai.n1**2+E.ai.n2**2),E.Qn.n2=t>=0?t:t+360,E.Qn.n3=E.ai.n3}static pv(){E.ai.n0=E.Qn.n0,E.ai.n1=E.Qn.n1*Math.cos(E.Qn.n2*Math.PI/180),E.ai.n2=E.Qn.n1*Math.sin(E.Qn.n2*Math.PI/180),E.ai.n3=E.Qn.n3}static av(){E.FA(),E.dv(),E.mv()}static cv(){E.pv(),E.gv(),E.RA()}static Qu(t,e){typeof t=="string"||t instanceof E||f.o("Value for "+e+" must be a color string or a Brush, not "+t)}static Solid=1;static Linear=2;static Radial=3;static Pattern=4;static Lab=1;static HSL=2;static _n=null;static q0=!1;static G=new fi;static Ii=new fi;static Dt=new fi;static Zn=new fi;static ai=new fi;static Qn=new fi}class Ft{Pt="Base";static es=new pt;static dn(t,e){e.name=t,Ft.es.set(t,e)}get name(){return this.Pt}set name(t){this.Pt=t}constructor(){}get classType(){return H}measure(t,e,i,s,n,o,r){}measureElement(t,e,i,s,n){t.ht(e,i,s,n)}arrange(t,e,i){}arrangeElement(t,e,i,s,n,o){t.Bt(e,i,s,n,o)}remeasureObject(t){t.tf()}Ui(t,e,i){}}class sr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=t.Uo();for(let l=0;l<a;l++){let c=s[l];if(!c.visible&&c!==h)continue;let u=c.margin,d=u.right+u.left,g=u.top+u.bottom;c.ht(e,i,o,r);let p=c.measuredBounds,m=Math.max(p.width+d,0),y=Math.max(p.height+g,0),w=c.position.x,b=c.position.y;if(isFinite(w)||(w=0),isFinite(b)||(b=0),c instanceof ct&&c.isGeometryPositioned){let v=c.strokeWidth/2;w-=v,b-=v}n.unionNoCheck(w,b,m,y)}}arrange(t,e,i){let s=e.length,n=t.padding,o=i.x-n.left,r=i.y-n.top;for(let a=0;a<s;a++){let h=e[a],l=h.measuredBounds,c=h.margin,u=h.position.x,d=h.position.y,g=isNaN(u)?-o:u-o,p=isNaN(d)?-r:d-r;if(h instanceof ct&&h.isGeometryPositioned){let m=h.strokeWidth/2;g-=m,p-=m}h.visible&&h.Bt(g+c.left,p+c.top,l.width,l.height)}}}Ft.dn("Position",new sr);class nr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=t.Uo();for(let u=0;u<a;u++){let d=s[u];if(!d.visible&&d!==l)continue;let g=d.zs(!1);if(g!==0&&g!==5){h.push(d);continue}d.ht(1/0,i,0,r);let p=d.margin,m=d.measuredBounds,y=Math.max(m.width+p.right+p.left,0),w=Math.max(m.height+p.top+p.bottom,0);n.Fn(n.width+y,Math.max(n.height,w))}let c=h.length;t.desiredSize.height?i=Math.min(t.desiredSize.height,t.maxSize.height):n.height!==0&&(i=Math.min(n.height,t.maxSize.height));for(let u=0;u<c;u++){let d=h[u];if(!d.visible&&d!==l)continue;let g=d.margin,p=g.right+g.left,m=g.top+g.bottom;d.ht(1/0,i,0,r);let y=d.measuredBounds,w=Math.max(y.width+p,0),b=Math.max(y.height+m,0);n.width+=w,n.height=Math.max(n.height,b)}f.J(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.top,r=t.isOpposite,a=r?i.width:n.left;for(let h=0;h<s;h++){let l=o,c=e[h];if(!c.visible)continue;let u=c.measuredBounds,d=c.margin,g=d.top+d.bottom,p=o+n.bottom,m=u.height,y=c.zs(!1);(isNaN(c.desiredSize.height)&&y===2||y===4)&&(m=Math.max(i.height-g-p,0));let w=m+g+p,b=c.alignment;b.isDefault()&&(b=t.defaultAlignment),b.isSpot()||(b=D.Center),r&&(a-=u.width+d.left+d.right),c.Bt(a+b.offsetX+d.left,l+b.offsetY+d.top+(i.height*b.y-w*b.y),u.width,m),r||(a+=u.width+d.left+d.right)}}}Ft.dn("Horizontal",new nr);class or extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=t.Uo();for(let u=0;u<a;u++){let d=s[u];if(!d.visible&&d!==l)continue;let g=d.zs(!1);if(g!==0&&g!==4){h.push(d);continue}d.ht(e,1/0,o,0);let p=d.margin,m=d.measuredBounds,y=Math.max(m.width+p.right+p.left,0),w=Math.max(m.height+p.top+p.bottom,0);n.Fn(Math.max(n.width,y),n.height+w)}let c=h.length;t.desiredSize.width?e=Math.min(t.desiredSize.width,t.maxSize.width):n.width!==0&&(e=Math.min(n.width,t.maxSize.width));for(let u=0;u<c;u++){let d=h[u];if(!d.visible&&d!==l)continue;let g=d.margin,p=g.right+g.left,m=g.top+g.bottom;d.ht(e,1/0,o,0);let y=d.measuredBounds,w=Math.max(y.width+p,0),b=Math.max(y.height+m,0);n.width=Math.max(n.width,w),n.height+=b}f.J(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=t.isOpposite,a=r?i.height:n.top;for(let h=0;h<s;h++){let l=o,c=e[h];if(!c.visible)continue;let u=c.measuredBounds,d=c.margin,g=d.left+d.right,p=o+n.right,m=u.width,y=c.zs(!1);(isNaN(c.desiredSize.width)&&y===2||y===5)&&(m=Math.max(i.width-g-p,0));let w=m+g+p,b=c.alignment;b.isDefault()&&(b=t.defaultAlignment),b.isSpot()||(b=D.Center),r&&(a-=u.height+d.bottom+d.top),c.Bt(l+b.offsetX+d.left+(i.width*b.x-w*b.x),a+b.offsetY+d.top,m,u.height),r||(a+=u.height+d.bottom+d.top)}}}Ft.dn("Vertical",new or);class es extends Ft{constructor(){super()}static OA=!1;measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,c=0,u=0,d=l.right+l.left,g=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,m=p.width,y=p.height,w=Math.max(m+d,0),b=Math.max(y+g,0),v=t.isClipping;v&&h.p0()!==0&&!es.OA&&(es.OA=!0,f.ni("Main Shape for Spot Panel with isClipping = true must have a zero strokeWidth: "+t.toString()));let k=z.V(-l.left,-l.top,w,b),S=z.V(0,0,m,y);this.I2(h,S,!0),m=S.width,y=S.height;let M=!0,F=t.Uo(),T;for(let N=0;N<a;N++){let C=s[N],R=e,O=i;if(C===h||!C.visible&&C!==F)continue;l=C.margin;let B=l.left,X=l.top;switch(c=l.right+l.left,u=l.top+l.bottom,T=C.zs(!1),T){case 2:R=m,O=y,c=0,u=0,B=0,X=0;break;case 5:R=m,c=0,B=0;break;case 4:O=y,u=0,X=0;break}C.ht(R,O,0,0),p=C.measuredBounds,w=Math.max(p.width+c,0),b=Math.max(p.height+u,0);let Y=C.alignment;Y.isDefault()&&(Y=t.defaultAlignment),Y.isSpot()||(Y=D.Center);let j=C.alignmentFocus;j.isDefault()&&(j=D.Center);let U=null;C instanceof H&&C.to!==""&&(U=C.findObject(C.to),U===C&&(U=null));let nt=S.x-B,at=S.y-X;if(U!==null){C.Bt(0,0,p.width,p.height);let tt=U.actualBounds,st=P.V(tt.x+(j.x*tt.width-j.offsetX),tt.y+(j.y*tt.height-j.offsetY));for(U=U.panel;U!==C;)U.T.gt(st),U=U.panel;nt+=Y.x*m+Y.offsetX-st.x,at+=Y.y*y+Y.offsetY-st.y,P.e(st)}else nt+=Y.x*m+Y.offsetX-(j.x*p.width+j.offsetX),at+=Y.y*y+Y.offsetY-(j.y*p.height+j.offsetY);M?(M=!1,n.i(nt,at,w,b)):n.unionNoCheck(nt,at,w,b)}switch(M?n.a(k):v?n.intersect(S.x,S.y,S.width,S.height):n.unionNoCheck(k.x,k.y,k.width,k.height),z.e(k),z.e(S),T=h.stretch,T===1&&(T=h.zs(!1)),T){case 0:return;case 2:if(!isFinite(e)&&!isFinite(i))return;break;case 5:if(!isFinite(e))return;break;case 4:if(!isFinite(i))return;break}p=h.measuredBounds,m=p.width,y=p.height,w=Math.max(m+d,0),b=Math.max(y+g,0),l=h.margin,S=z.V(-l.left,-l.top,w,b),this.I2(h,S,!0),m=S.width,y=S.height;for(let N=0;N<a;N++){let C=s[N];if(C===h||!C.visible&&C!==F)continue;l=C.margin,c=l.right+l.left,u=l.top+l.bottom,p=C.measuredBounds,w=Math.max(p.width+c,0),b=Math.max(p.height+u,0);let R=C.alignment;R.isDefault()&&(R=t.defaultAlignment),R.isSpot()||(R=D.Center);let O=C.alignmentFocus;O.isDefault()&&(O=D.Center),M?(M=!1,n.i(R.x*m+R.offsetX-(O.x*p.width+O.offsetX)-l.left,R.y*y+R.offsetY-(O.y*p.height+O.offsetY)-l.top,w,b)):n.unionNoCheck(R.x*m+R.offsetX-(O.x*p.width+O.offsetX)-l.left,R.y*y+R.offsetY-(O.y*p.height+O.offsetY)-l.top,w,b)}M?n.a(k):v?n.intersect(S.x,S.y,S.width,S.height):n.unionNoCheck(k.x,k.y,k.width,k.height),z.e(S)}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=o.width,a=o.height,h=t.padding,l=h.left,c=h.top,u=l-i.x,d=c-i.y;n.Bt(u,d,r,a);let g=z.V(0,0,r,a);this.I2(n,g,!1);for(let p=0;p<s;p++){let m=e[p];if(m===n)continue;let y=m.measuredBounds,w=y.width,b=y.height,v=m.alignment;v.isDefault()&&(v=t.defaultAlignment),v.isSpot()||(v=D.Center);let k=m.alignmentFocus;k.isDefault()&&(k=D.Center);let S=null;if(m instanceof H&&m.to!==""&&(S=m.findObject(m.to),S===m&&(S=null)),S!==null){let M=S.actualBounds,F=P.V(M.x+(k.x*M.width-k.offsetX),M.y+(k.y*M.height-k.offsetY));for(S=S.panel;S!==m;)S.T.gt(F),S=S.panel;u=v.x*g.width+v.offsetX-F.x,d=v.y*g.height+v.offsetY-F.y,P.e(F)}else u=v.x*g.width+v.offsetX-(k.x*w+k.offsetX),d=v.y*g.height+v.offsetY-(k.y*b+k.offsetY);u+=g.x-i.x,d+=g.y-i.y,m.visible&&m.Bt(l+u,c+d,w,b)}z.e(g)}I2(t,e,i){let s=null;if(t instanceof H&&t.to!==""&&(s=t.findObject(t.to),s===t&&(s=null)),s!==null)for(i&&t.Bt(0,0,e.width,e.height),e.a(s.actualBounds),s=s.panel;s!==t;)s.T.vg(e),s=s.panel}}Ft.dn("Spot",new es);class rr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,c=e,u=i,d=l.right+l.left,g=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,m=0,y=null;h instanceof ct&&(y=h,m=y.strokeWidth*y.scale);let w=Math.max(p.width+d,0),b=Math.max(p.height+g,0),v=t.E2(h),k=v.x*w+v.offsetX,S=v.y*b+v.offsetY,M=t.U2(h),F=M.x*w+M.offsetX,T=M.y*b+M.offsetY;isFinite(e)&&(c=Math.max(Math.abs(k-F)-m,0)),isFinite(i)&&(u=Math.max(Math.abs(S-T)-m,0));let N=0,C=0;o>0&&(N=Math.max(Math.abs(v.x*o+v.offsetX-(M.x*o+M.offsetX))-m,0)),r>0&&(C=Math.max(Math.abs(v.y*r+v.offsetY-(M.y*r+M.offsetY))-m,0));let R=Q.l();R.i(0,0);let O=t.Uo();for(let j=0;j<a;j++){let U=s[j];if(U===h||!U.visible&&U!==O)continue;l=U.margin;let nt=l.right+l.left,at=l.top+l.bottom;U.ht(c,u,N,C),p=U.measuredBounds,w=Math.max(p.width+nt,0),b=Math.max(p.height+at,0),R.i(Math.max(w,R.width),Math.max(b,R.height))}if(a===1){p=h.measuredBounds,n.width=w,n.height=b,Q.e(R);return}v=t.E2(h),M=t.U2(h);let B=0,X=0;M.x!==v.x&&M.y!==v.y&&(B=R.width/Math.abs(M.x-v.x),X=R.height/Math.abs(M.y-v.y)),Q.e(R),m=0,y!==null&&(m=y.strokeWidth*y.scale,y.aS()===6&&(B=X=Math.max(B,X))),B+=Math.abs(v.offsetX)+Math.abs(M.offsetX)+m,X+=Math.abs(v.offsetY)+Math.abs(M.offsetY)+m;let Y=h.stretch;switch(Y===1&&(Y=h.zs(!1)),Y){case 0:o=0,r=0;break;case 2:isFinite(e)&&(B=e),isFinite(i)&&(X=i);break;case 5:isFinite(e)&&(B=e),r=0;break;case 4:o=0,isFinite(i)&&(X=i);break}h.tf(),h.ht(B,X,o,r),n.width=h.measuredBounds.width+d,n.height=h.measuredBounds.height+g}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=z.l();r.i(0,0,1,1);let a=n.margin,h=a.left,l=a.top,c=t.padding,u=c.left,d=c.top,g=h,p=l,m=o.width,y=o.height;n.Bt(u+g,d+p,m,y);let w=t.E2(n),b=t.U2(n),v=0+w.x*o.width+w.offsetX,k=0+w.y*o.height+w.offsetY,S=0+b.x*o.width+b.offsetX,M=0+b.y*o.height+b.offsetY;r.x=v,r.y=k,r.unionNoCheck(S,M,0,0),r.x+=h+u,r.y+=l+d;for(let F=0;F<s;F++){let T=e[F];if(T===n)continue;let N=T.measuredBounds;a=T.margin;let C=Math.max(N.width+a.right+a.left,0),R=Math.max(N.height+a.top+a.bottom,0),O=T.alignment;O.isDefault()&&(O=t.defaultAlignment),O.isSpot()||(O=D.Center),g=r.width*O.x+O.offsetX-C*O.x+a.left+r.x,p=r.height*O.y+O.offsetY-R*O.y+a.top+r.y,m=r.width,y=r.height,T.visible&&(z.contains(r.x,r.y,r.width,r.height,g,p,N.width,N.height)?T.Bt(g,p,N.width,N.height):T.Bt(g,p,N.width,N.height,new z(r.x,r.y,r.width,r.height)))}z.e(r)}}Ft.dn("Auto",new rr);class ar extends Ft{constructor(){super(),this.name="Table"}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=f.et();for(let lt=0;lt<a;lt++){let J=s[lt],mt=J instanceof H?J:null;if(mt!==null&&mt.$r()&&J.visible){l.push(mt);let At=mt.C.r,Qt=At.length;for(let Ht=0;Ht<Qt;Ht++){let Jt=At[Ht];mt.type===H.TableRow?Jt.row=J.row:mt.type===H.TableColumn&&(Jt.column=J.column),h.push(Jt)}}else h.push(J)}a=h.length,a===0&&(t.getRowDefinition(0),t.getColumnDefinition(0));let c=[];for(let lt=0;lt<a;lt++){let J=h[lt];J.visible&&(J.ue(!0),J.Jn(!0),c[J.row]||(c[J.row]=[]),c[J.row][J.column]||(c[J.row][J.column]=[]),c[J.row][J.column].push(J))}f.J(h);let u=f.et(),d=f.et(),g=f.et(),p={count:0},m={count:0},y=e,w=i,b=t.Xe,v=t.Ge,k=null;a=b.length;for(let lt=0;lt<a;lt++)k=b[lt],k!==void 0&&(k.actual=0,k.Ai=0);a=v.length;for(let lt=0;lt<a;lt++)k=v[lt],k!==void 0&&(k.actual=0,k.Ai=0);let S=c.length,M=0;for(let lt=0;lt<S;lt++)c[lt]&&(M=Math.max(M,c[lt].length));let F=Math.min(t.topIndex,S-1),T=Math.min(t.leftIndex,M-1),N=0,C;S=c.length;let R=t.Uo();for(let lt=0;lt<S;lt++){if(!c[lt])continue;M=c[lt].length;let J=t.getRowDefinition(lt);J.actual=0,J.Ai=0;for(let mt=0;mt<M;mt++){if(!c[lt][mt])continue;let At=t.getColumnDefinition(mt);u[mt]===void 0&&(At.actual=0,At.Ai=0,u[mt]=!0);let Qt=c[lt][mt],Ht=Qt.length;for(let Jt=0;Jt<Ht;Jt++){let Zt=Qt[Jt];if(!Zt.visible&&Zt!==R)continue;let Te=Zt.rowSpan>1,ye=Zt.columnSpan>1;(Te||ye)&&!(lt<F)&&!(mt<T)&&d.push(Zt);let ke=Zt.margin,_t=ke.right+ke.left,se=ke.top+ke.bottom;C=Zt.P0(J,At,!1);let Pe=Zt.desiredSize,Ot=!isNaN(Pe.width),Ie=!isNaN(Pe.height);if(C!==0&&!(Ot&&Ie)&&!(lt<F)&&!(mt<T)&&(!ye&&p[mt]===void 0&&(C===2||C===5)&&(p[mt]=-1,p.count++),!Te&&m[lt]===void 0&&(C===2||C===4)&&(m[lt]=-1,m.count++),!Te&&!ye&&g.push(Zt)),Zt.ht(1/0,1/0,0,0),lt<F||mt<T)continue;let ce=Zt.measuredBounds,De=Math.max(ce.width+_t,0),je=Math.max(ce.height+se,0);if(Zt.rowSpan===1&&(C===0||C===5)){k=t.getRowDefinition(lt);let Fe=k.computeEffectiveSpacing(),zi=k._===0;N=Math.max(je-k.actual,0),N+(zi?Fe:0)>w&&(N=Math.max(w-Fe,0)),k.Ai=k.Ai+N,k.actual=k._+N,w=Math.max(w-(N+(zi?Fe:0)),0)}if(Zt.columnSpan===1&&(C===0||C===4)){k=t.getColumnDefinition(mt);let Fe=k.computeEffectiveSpacing(),zi=k._===0;N=Math.max(De-k.actual,0),N+(zi?Fe:0)>y&&(N=Math.max(y-Fe,0)),k.Ai=k.Ai+N,k.actual=k._+N,y=Math.max(y-(N+(zi?Fe:0)),0)}(Te||ye)&&Zt.tf()}}}f.J(u);let O=0,B=0;a=t.columnCount;for(let lt=0;lt<a;lt++){let J=v[lt];J!==void 0&&(O+=isNaN(J.de)?J.Ai:J.de,J.Ai!==0&&(O+=J.computeEffectiveSpacing()))}a=t.rowCount;for(let lt=0;lt<a;lt++){let J=b[lt];J!==void 0&&(B+=isNaN(J.de)?J.Ai:J.de,J.Ai!==0&&(B+=J.computeEffectiveSpacing()))}y=Math.max(e-O,0),w=Math.max(i-B,0);let X=w,Y=y;a=g.length;for(let lt=0;lt<a;lt++){let J=g[lt],mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column),Qt=J.measuredBounds,Ht=J.margin,Jt=Ht.right+Ht.left,Zt=Ht.top+Ht.bottom;At.Ai===0&&p[J.column]!==void 0?p[J.column]=Math.max(Qt.width+Jt,p[J.column]):p[J.column]=null,mt.Ai===0&&m[J.row]!==void 0?m[J.row]=Math.max(Qt.height+Zt,m[J.row]):m[J.row]=null}let j=0,U=0,nt;for(nt in m)nt!=="count"&&(j+=m[nt]);for(nt in p)nt!=="count"&&(U+=p[nt]);let at=Q.l();for(let lt=0;lt<a;lt++){let J=g[lt];if(!J.visible&&J!==R)continue;let mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column),Qt=0;isFinite(At.width)?Qt=At.width:(isFinite(y)&&p[J.column]!==null?U===0?Qt=At.actual+y:Qt=p[J.column]/U*Y:p[J.column]!==null?Qt=y:Qt=At.actual||y,Qt=Math.max(0,Qt-At.computeEffectiveSpacing()));let Ht=0;switch(isFinite(mt.height)?Ht=mt.height:(isFinite(w)&&m[J.row]!==null?j===0?Ht=mt.actual+w:Ht=m[J.row]/j*X:m[J.row]!==null?Ht=w:Ht=mt.actual||w,Ht=Math.max(0,Ht-mt.computeEffectiveSpacing())),at.i(Math.max(At.minimum,Math.min(Qt,At.maximum)),Math.max(mt.minimum,Math.min(Ht,mt.maximum))),C=J.P0(mt,At,!1),C){case 5:at.height=Math.max(at.height,mt.actual+w);break;case 4:at.width=Math.max(at.width,At.actual+y);break}let Jt=J.margin,Zt=Jt.right+Jt.left,Te=Jt.top+Jt.bottom;J.tf();let ye=At.minimum,ke=mt.minimum,_t=J.measuredBounds;_t.width===0&&p[J.column]!==null&&(ye=Math.max(ye,p[J.column])),_t.height===0&&m[J.row]!==null&&(ke=Math.max(ye,m[J.row])),J.ht(at.width,at.height,ye,ke);let se=J.measuredBounds,Pe=Math.max(se.width+Zt,0),Ot=Math.max(se.height+Te,0);isFinite(y)&&(Pe=Math.min(Pe,at.width)),isFinite(w)&&(Ot=Math.min(Ot,at.height));let Ie=0;Ie=mt.actual,mt.actual=Math.max(mt.actual,Ot),mt.Ai=Math.max(mt.Ai,Ot),N=mt.actual-Ie,w=Math.max(w-N,0),m[J.row]===null&&(X=Math.max(X-N,0)),Ie=At.actual,At.actual=Math.max(At.actual,Pe),At.Ai=Math.max(At.Ai,Pe),N=At.actual-Ie,y=Math.max(y-N,0),p[J.column]===null&&(Y=Math.max(Y-N,0))}f.J(g);let tt=Q.l(),st=f.et(),et=f.et();if(a=d.length,a!==0)for(let lt=0;lt<S;lt++){if(!c[lt])continue;M=c[lt].length;let J=t.getRowDefinition(lt);st[lt]=J.actual;for(let mt=0;mt<M;mt++){if(!c[lt][mt])continue;let At=t.getColumnDefinition(mt);et[mt]=At.actual}}for(let lt=0;lt<a;lt++){let J=d[lt];if(!J.visible&&J!==R)continue;let mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column);switch(at.i(Math.max(At.minimum,Math.min(e,At.maximum)),Math.max(mt.minimum,Math.min(i,mt.maximum))),C=J.P0(mt,At,!1),C){case 2:et[At.index]!==0&&(at.width=Math.min(at.width,et[At.index])),st[mt.index]!==0&&(at.height=Math.min(at.height,st[mt.index]));break;case 5:et[At.index]!==0&&(at.width=Math.min(at.width,et[At.index]));break;case 4:st[mt.index]!==0&&(at.height=Math.min(at.height,st[mt.index]));break}isFinite(At.width)&&(at.width=At.width),isFinite(mt.height)&&(at.height=mt.height),tt.i(0,0);let Qt=At.minimum,Ht=mt.minimum;for(let Ot=1;Ot<J.rowSpan&&!(J.row+Ot>=t.rowCount);Ot++)k=t.getRowDefinition(J.row+Ot),N=0,C===2||C===4?N=Math.max(k.minimum,st[J.row+Ot]===0?k.maximum:Math.min(st[J.row+Ot],k.maximum)):N=Math.max(k.minimum,isNaN(k.de)?k.maximum:Math.min(k.de,k.maximum)),tt.height+=N,Ht+=k.minimum;for(let Ot=1;Ot<J.columnSpan&&!(J.column+Ot>=t.columnCount);Ot++)k=t.getColumnDefinition(J.column+Ot),N=0,C===2||C===5?N=Math.max(k.minimum,et[J.column+Ot]===0?k.maximum:Math.min(et[J.column+Ot],k.maximum)):N=Math.max(k.minimum,isNaN(k.de)?k.maximum:Math.min(k.de,k.maximum)),tt.width+=N,Qt+=k.minimum;at.width+=tt.width,at.height+=tt.height;let Jt=J.margin,Zt=Jt.right+Jt.left,Te=Jt.top+Jt.bottom;J.ht(at.width,at.height,Qt,Ht);let ye=J.measuredBounds,ke=Math.max(ye.width+Zt,0),_t=Math.max(ye.height+Te,0),se=0;for(let Ot=0;Ot<J.rowSpan&&!(J.row+Ot>=t.rowCount);Ot++)k=t.getRowDefinition(J.row+Ot),se+=k.total||0;if(se<_t){let Ot=_t-se,Ie=_t-se;if(J.spanAllocation!==null){let ce=J.spanAllocation;for(let De=0;De<J.rowSpan&&!(Ot<=0||J.row+De>=t.rowCount);De++){k=t.getRowDefinition(J.row+De);let je=k._||0,Fe=ce(J,k,Ie);k.actual=Math.min(k.maximum,je+Fe),k._!==je&&(Ot-=k._-je)}}for(;Ot>0;){let ce=k._||0;if(isNaN(k.height)&&k.maximum>ce&&(k.actual=Math.min(k.maximum,ce+Ot),k._!==ce&&(Ot-=k._-ce)),k.index===0)break;k=t.getRowDefinition(k.index-1)}}let Pe=0;for(let Ot=0;Ot<J.columnSpan&&!(J.column+Ot>=t.columnCount);Ot++)k=t.getColumnDefinition(J.column+Ot),Pe+=k.total||0;if(Pe<ke){let Ot=ke-Pe,Ie=ke-Pe;if(J.spanAllocation!==null){let ce=J.spanAllocation;for(let De=0;De<J.columnSpan&&!(Ot<=0||J.column+De>=t.columnCount);De++){k=t.getColumnDefinition(J.column+De);let je=k._||0,Fe=ce(J,k,Ie);k.actual=Math.min(k.maximum,je+Fe),k._!==je&&(Ot-=k._-je)}}for(;Ot>0;){let ce=k._||0;if(isNaN(k.width)&&k.maximum>ce&&(k.actual=Math.min(k.maximum,ce+Ot),k._!==ce&&(Ot-=k._-ce)),k.index===0)break;k=t.getColumnDefinition(k.index-1)}}}f.J(d),Q.e(tt),Q.e(at),st!==void 0&&f.J(st),et!==void 0&&f.J(et);let ut=0,gt=0,wt=t.desiredSize,Ct=t.maxSize;C=t.zs(!0),O=0,B=0;let ot=0,Mt=0;a=t.columnCount;for(let lt=0;lt<a;lt++)if(v[lt]!==void 0){if(k=t.getColumnDefinition(lt),isFinite(k.width)){ot+=k.width,ot+=k.computeEffectiveSpacing();continue}else if(k.Qb()===2){ot+=k._,ot+=k.computeEffectiveSpacing();continue}k._!==0&&(O+=k._,O+=k.computeEffectiveSpacing())}isFinite(wt.width)?ut=Math.min(wt.width,Ct.width):C!==0&&isFinite(e)?ut=e:ut=O,ut=Math.max(ut,isFinite(e)?Math.min(o,e):o),ut=Math.max(ut-ot,0);let bt=O===0?1:Math.max(ut/O,1);for(let lt=0;lt<a;lt++)v[lt]!==void 0&&(k=t.getColumnDefinition(lt),!isFinite(k.width)&&k.Qb()!==2&&(k.actual=k._*bt),k.position=n.width,k._!==0&&(n.width+=k._,n.width+=k.computeEffectiveSpacing()));a=t.rowCount;for(let lt=0;lt<a;lt++)if(b[lt]!==void 0){if(k=t.getRowDefinition(lt),isFinite(k.height)){Mt+=k.height,Mt+=k.computeEffectiveSpacing();continue}else if(k.Qb()===2){Mt+=k._,Mt+=k.computeEffectiveSpacing();continue}k._!==0&&(B+=k._,B+=k.computeEffectiveSpacing())}isFinite(wt.height)?gt=Math.min(wt.height,Ct.height):C!==0&&isFinite(i)?gt=i:gt=B,gt=Math.max(gt,isFinite(i)?Math.min(r,i):r),gt=Math.max(gt-Mt,0);let Gt=B===0?1:Math.max(gt/B,1);for(let lt=0;lt<a;lt++)b[lt]!==void 0&&(k=t.getRowDefinition(lt),!isFinite(k.height)&&k.Qb()!==2&&(k.actual=k._*Gt),k.position=n.height,k._!==0&&(n.height+=k._,n.height+=k.computeEffectiveSpacing()));a=l.length;for(let lt=0;lt<a;lt++){let J=l[lt],mt=0,At=0;J.type===H.TableRow?(mt=n.width,k=t.getRowDefinition(J.row),At=k.actual):(k=t.getColumnDefinition(J.column),mt=k.actual,At=n.height),J.measuredBounds.i(0,0,mt,At),J.ue(!1)}f.J(l),t.yh=c}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=n.top,a=t.yh;if(a===null)return;let h=0,l=0,c=a.length,u=0;for(let T=0;T<c;T++)a[T]&&(u=Math.max(u,a[T].length));let d=t.Xe,g=t.Ge,p=0,m=0,y=Math.min(t.topIndex,c-1);if(d.length>0){for(;y!==c&&(d[y]===void 0||d[y]._===0);)y++;y=Math.max(Math.min(y,c-1),0),p=-d[y].position}let w=Math.min(t.leftIndex,u-1);if(g.length>0){for(;w!==u&&(g[w]===void 0||g[w]._===0);)w++;w=Math.max(Math.min(w,u-1),0),m=-g[w].position}let b=0,v=0;for(;b!==c&&d[b]===void 0;)b++;for(;v!==c&&g[v]===void 0;)v++;let k=t.part,S=t.getRowDefinition(b),M=t.getColumnDefinition(v);for(let T=0;T<e.length;T++){let N=e[T];if(!(N instanceof H&&N.visible&&N.$r()))continue;N.type===H.TableRow?(S=t.getRowDefinition(N.row),M=t.getColumnDefinition(v)):(S=t.getRowDefinition(b),M=t.getColumnDefinition(N.column)),l=S.position+p+r,S._!==0&&(l+=S.computeEffectiveSpacingTop(Math.max(b,y))),h=M.position+m+o,M._!==0&&(h+=M.computeEffectiveSpacingTop(Math.max(v,w)));let C=N.measuredBounds;N.$c(),N.actualBounds.Nt();let R=N.actualBounds,O=z.V(R.x,R.y,R.width,R.height);if(R.x=N.type===H.TableRow?o:h,R.y=N.type===H.TableColumn?r:l,R.width=C.width,R.height=C.height,N.actualBounds.u(),N.Jn(!1),O.equalsApproxClose(R)){z.e(O);continue}k!==null&&(k.dh(),N.w0(k)),z.e(O)}let F=Q.l();for(let T=0;T<c;T++){if(!a[T])continue;u=a[T].length;let N=t.getRowDefinition(T);l=N.position+p+r,N._!==0&&(l+=N.computeEffectiveSpacingTop(Math.max(b,y)));for(let C=0;C<u;C++){if(!a[T][C])continue;let R=t.getColumnDefinition(C);h=R.position+m+o,R._!==0&&(h+=R.computeEffectiveSpacingTop(Math.max(v,w)));let O=a[T][C],B=O.length;for(let X=0;X<B;X++){let Y=O[X],j=Y.measuredBounds;F.i(0,0);for(let _t=1;_t<Y.rowSpan&&!(T+_t>=t.rowCount);_t++){let se=t.getRowDefinition(T+_t);se._!==0&&(F.height+=se.total)}for(let _t=1;_t<Y.columnSpan&&!(C+_t>=t.columnCount);_t++){let se=t.getColumnDefinition(C+_t);se._!==0&&(F.width+=se.total)}let U=R._+F.width,nt=N._+F.height,at=h,tt=l,st=U,et=nt,ut=h,gt=l,wt=U,Ct=nt;h+U>i.width&&(wt=Math.max(i.width-h,0)),l+nt>i.height&&(Ct=Math.max(i.height-l,0));let ot=Y.alignment,Mt=0,bt=0,Gt=0,lt=0;if(ot.isDefault()){ot=t.defaultAlignment,ot.isSpot()||(ot=D.Center),Mt=ot.x,bt=ot.y,Gt=ot.offsetX,lt=ot.offsetY;let _t=R.alignment,se=N.alignment;_t.isSpot()&&(Mt=_t.x,Gt=_t.offsetX),se.isSpot()&&(bt=se.y,lt=se.offsetY)}else Mt=ot.x,bt=ot.y,Gt=ot.offsetX,lt=ot.offsetY;(isNaN(Mt)||isNaN(bt))&&(Mt=.5,bt=.5,Gt=0,lt=0);let J=j.width,mt=j.height,At=Y.margin,Qt=At.left+At.right,Ht=At.top+At.bottom,Jt=Y.P0(N,R,!1);isNaN(Y.desiredSize.width)&&(Jt===2||Jt===5)&&(J=Math.max(U-Qt,0)),isNaN(Y.desiredSize.height)&&(Jt===2||Jt===4)&&(mt=Math.max(nt-Ht,0));let Zt=Y.maxSize,Te=Y.minSize;J=Math.min(Zt.width,J),mt=Math.min(Zt.height,mt),J=Math.max(Te.width,J),mt=Math.max(Te.height,mt);let ye=J+Qt,ke=mt+Ht;at+=st*Mt-ye*Mt+Gt+At.left,tt+=et*bt-ke*bt+lt+At.top,Y.visible&&(z.contains(ut,gt,wt,Ct,at,tt,j.width,j.height)?Y.Bt(at,tt,J,mt):Y.Bt(at,tt,J,mt,new z(ut,gt,wt,Ct)))}}}Q.e(F);for(let T=0;T<s;T++){let N=e[T],C=N instanceof H?N:null;if(C!==null&&C.$r()){let R=N.actualBounds;N.naturalBounds.Nt(),N.naturalBounds.i(0,0,R.width,R.height),N.naturalBounds.u()}}}}Ft.dn("Table",new ar);class hr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Ft.dn("TableRow",new hr);class lr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Ft.dn("TableColumn",new lr);class cr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){s.length!==1&&f.o("Viewbox Panel must contain exactly one GraphObject.");let a=s[0];a.tt=1,a.tf(),a.ht(1/0,1/0,o,r);let h=a.measuredBounds,l=a.margin,c=l.right+l.left,u=l.top+l.bottom;if(isFinite(e)||isFinite(i)){let d=a.scale,g=h.width,p=h.height,m=Math.max(e-c,0),y=Math.max(i-u,0),w=1;t.viewboxStretch===6?(g!==0&&p!==0&&(w=Math.min(m/g,y/p)),w===0&&(w=1e-4),a.tt*=w):(g!==0&&p!==0&&(w=Math.max(m/g,y/p)),w===0&&(w=1e-4),a.tt*=w),d!==a.scale&&(a.ue(!0),a.ht(1/0,1/0,o,r))}h=a.measuredBounds,n.width=isFinite(e)?e:Math.max(h.width+c,0),n.height=isFinite(i)?i:Math.max(h.height+u,0)}arrange(t,e,i){let s=e[0],n=s.measuredBounds,o=s.margin,r=o.right+o.left,a=o.top+o.bottom,h=Math.max(n.width+r,0),l=Math.max(n.height+a,0),c=s.alignment;c.isDefault()&&(c=t.defaultAlignment),c.isSpot()||(c=D.Center),s.Bt(i.width*c.x-h*c.x+c.offsetX,i.height*c.y-l*c.y+c.offsetY,n.width,n.height)}}Ft.dn("Viewbox",new cr);class ur extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){t.yi===null&&(t.yi=new gi),this.yv(t),this.wv(t)}arrange(t,e,i){}Ui(t,e,i){let s=t.naturalBounds,n=s.width,o=s.height;e.save(),e.beginPath(),e.rect(0,0,n,o),e.clip(),e.endPath(),this.xv(t,e,i),e.restore(),e.clearContextCache(!1)}xv(t,e,i){let s=t.getDocumentScale()*i.scale;s<=0&&(s=1);let n=t.gridCellSize,o=n.width,r=n.height,a=t.naturalBounds,h=t.actualBounds,l=a.width,c=a.height,u=Math.ceil(l/o),d=Math.ceil(c/r),g=t.gridOrigin,p=g.x,m=g.y,y=t.yi.W0,w=t.C.r,b=w.length;for(let v=0;v<b;v++){let k=w[v];if(!k.visible)continue;let S=k.interval||1,M=Math.abs(S);if(o*M*s<2)continue;let F=k.segmentIndex;(!isFinite(F)||isNaN(F))&&(F=0),F<0&&(F=M-Math.min(-F,M)),F=Math.round(F%M);let T=k.opacity,N=1;if(T!==1){if(T===0)continue;N=e.globalAlpha,e.globalAlpha=N*T}let C=y[v],R=!1,O=k.strokeDashArray;if(O!==null&&(R=!0,e.enableDash(O,k.strokeDashOffset)),k.stroke!==null&&k.strokeWidth>0&&(k.figure==="LineV"||k.figure==="LineH")){if(e.lineWidth=k.strokeWidth,t.rn(e,k.stroke,!1,!1,a,h),e.beginPath(),k.figure==="LineV"){let B=Math.floor((p-o)/o);for(let X=B;X<=B+u;X++){let Y=X*o+p;0<=Y&&Y<=l&&this._b(X,S,F,C)&&(e.moveTo(Y,0),e.lineTo(Y,c))}}else if(k.figure==="LineH"){let B=Math.floor((m-r)/r);for(let X=B;X<=B+d;X++){let Y=X*r+m;0<=Y&&Y<=c&&this._b(X,S,F,C)&&(e.moveTo(0,Y),e.lineTo(l,Y))}}e.stroke(),e.endPath()}else if(k.fill!==null){if(t.rn(e,k.fill,!0,!1,a,h),k.figure==="BarV"){let B=k.width;isNaN(B)&&(B=o);let X=Math.floor((p-o)/o);for(let Y=X;Y<=X+u;Y++){let j=Y*o+p;0<=j+B&&j<=l&&this._b(Y,S,F,C)&&e.fillRect(j,0,B,c)}}else if(k.figure==="BarH"){let B=k.height;isNaN(B)&&(B=r);let X=Math.floor((m-r)/r);for(let Y=X;Y<=X+d;Y++){let j=Y*r+m;0<=j+B&&j<=c&&this._b(Y,S,F,C)&&e.fillRect(0,j,l,B)}}}R&&e.disableDash(),T!==1&&(e.globalAlpha=N)}}_b(t,e,i,s){if(e<0)return t%e===i;if(t%e!==i)return!1;let n=s.length;for(let o=0;o<n;o++){let r=s[o];if(t%r===i)return!1}return!0}wv(t){let e=[],i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(a<0)continue;let h=o.figure,l=this.B2(h);for(let c=0;c<s;c++){if(c===n)continue;let u=i[c];if(!u.visible)continue;let d=u.figure;if(this.B2(d)!==l)continue;let g=u.interval;g>a&&r.push(g)}}t.yi.W0=e}B2(t){return t==="LineV"||t==="BarV"}yv(t){let e=1,i=1,s=t.C.r,n=s.length;for(let a=0;a<n;a++){let h=s[a],l=Math.abs(h.interval);l<2||(this.B2(h.figure)?i=i*l/L.FC(i,l):e=e*l/L.FC(e,l))}let o=t.gridCellSize,r=t.yi;r.Gc.isReal()?r.Gc.i(i*o.width,e*o.height):r.Gc=new Q(i*o.width,e*o.height)}}Ft.dn("Grid",new ur);class dr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(!(t instanceof St||t instanceof _))return;let h=null,l=null;if(t instanceof _&&(h=t),t instanceof St&&(l=t,h=l.adornedPart,t.hf===null&&(t.hf=[])),!(h instanceof _))return;let c=h;if(a===0){t.naturalBounds.Fn(0,0),t.measuredBounds.i(0,0,0,0);return}let u=t instanceof St?null:h.path,d=h.routeBounds,g=t.Bo;g.i(0,0,d.width,d.height);let p=c.points,m=h.pointsCount;l!==null?l.sd(!1):h!==null&&h.sd(!1);let y=d.width,w=d.height,b=t.hf;if(b.length=0,u!==null){this.measureLinkPath(t,y,w,u);let M=u.measuredBounds;g.unionRect(M),b.push(M)}let v=Pt.l(),k=P.l(),S=P.l();for(let M=0;M<a;M++){let F=s[M];if(F===u)continue;let T=F.measuredBounds;if(F.isPanelMain&&F instanceof ct){this.measureLinkPath(t,y,w,F),T=F.measuredBounds,g.unionRect(T),b.push(T);continue}if(m<2){F.ht(1/0,1/0,0,0),T=F.measuredBounds,g.unionRect(T),b.push(T);continue}let N=F.segmentIndex,C=F.segmentFraction,R=F.alignmentFocus;R.isNoSpot()&&(R=D.Center);let O=F.segmentOrientation,B=F.segmentOffset,X=0,Y=0,j=0,U=0;if(isNaN(N)){let ot=c.ot,Mt=f.et();ot.getPointAndAngleAlongPath(C,Mt);let bt=P.V(Mt[0],Mt[1]);U=Mt[2],O!==0&&(j=c.computeAngle(F,O,U),F.Gt=j,F.ue(!0),F.Jn(!0)),X=bt.x,Y=bt.y,P.e(bt),f.J(Mt)}else if(N<-m||N>=m){let ot=P.l();c.IA(ot),U=c.midAngle,O!==0&&(j=c.computeAngle(F,O,U),F.Gt=j,F.ue(!0),F.Jn(!0)),X=ot.x-d.x,Y=ot.y-d.y,P.e(ot)}else{let ot,Mt,bt=0;if(N>=0?(ot=p.elt(N),Mt=N<m-1?p.elt(N+1):ot):(bt=m+N,ot=p.elt(bt),Mt=bt>0?p.elt(bt-1):ot),U=0,ot.equalsApprox(Mt)){let Gt,lt;N>=0?(Gt=N>0?p.elt(N-1):ot,lt=N<m-2?p.elt(N+2):Mt):(Gt=bt<m-1?p.elt(bt+1):ot,lt=bt>1?p.elt(bt-2):Mt);let J=Gt.distanceSquaredPoint(ot),mt=Mt.distanceSquaredPoint(lt);J>mt+10?U=N>=0?Gt.directionPoint(ot):ot.directionPoint(Gt):mt>J+10?U=N>=0?Mt.directionPoint(lt):lt.directionPoint(Mt):U=N>=0?Gt.directionPoint(lt):lt.directionPoint(Gt)}else U=N>=0?ot.directionPoint(Mt):Mt.directionPoint(ot);O!==0&&(j=c.computeAngle(F,O,U),F.Gt=j,F.ue(!0),F.Jn(!0)),X=ot.x+(Mt.x-ot.x)*C-d.x,Y=ot.y+(Mt.y-ot.y)*C-d.y}F.ht(1/0,1/0,0,0),T=F.measuredBounds;let nt=F.naturalBounds,at=0;F instanceof ct&&(at=F.strokeWidth);let tt=nt.width+at,st=nt.height+at;v.Ri(),v.Fs(-T.x,-T.y),v.tt(F.scale,F.scale),v.cs(O===0?F.angle:U,tt/2,st/2),(O===22||O===26)&&v.cs(90,tt/2,st/2),(O===23||O===27)&&v.cs(-90,tt/2,st/2),O===28&&(U>45&&U<135||U>225&&U<315)&&v.cs(-U,tt/2,st/2);let et=new z(0,0,tt,st);k.setRectSpot(et,R),v.gt(k);let ut=-k.x+at/2*F.scale,gt=-k.y+at/2*F.scale;S.a(B);let wt=isNaN(B.x),Ct=isNaN(B.y);if(wt||Ct){let ot=tt/2+3,Mt=st/2+3,bt=U>=45&&U<=135,Gt=U>=225&&U<=315;O===0&&(bt||Gt)?(S.x=Ct?ot:B.y,S.y=wt?Mt:B.x,bt?N>=0||isNaN(N)&&C<.5||wt&&(S.y=-Mt):Gt&&((N>=0||isNaN(N)&&C<.5)&&wt&&(S.y=-Mt),Ct&&(S.x=-ot))):(wt&&(N>=0||isNaN(N)&&C<.5?S.x=ot:S.x=-ot),Ct&&(S.y=-Mt),S.rotate(U))}else S.rotate(U);X+=S.x,Y+=S.y,et.i(X+ut,Y+gt,T.width,T.height),b.push(et),g.unionRect(et)}if(h!==null){let M=h.labelNodes;for(;M.next();)M.value.ht(1/0,1/0)}t.Bo=g,t.position.i(d.x+g.x,d.y+g.y),n.Fn(g.width||0,g.height||0),Pt.e(v),P.e(k),P.e(S)}arrange(t,e,i){let s=e.length;if(!(t instanceof St||t instanceof _))return;let n=t,o=null;t instanceof St&&(o=t,n=o.adornedPart);let r=t,a=t instanceof St?null:n.path,h=t.hf;if(h.length!==0){let d=0;if(a!==null&&d<h.length){let g=h[d];d++,a.Bt(g.x-r.Bo.x,g.y-r.Bo.y,g.width,g.height)}for(let g=0;g<s;g++){let p=e[g];if(p!==a&&d<h.length){let m=h[d];d++,p.Bt(m.x-r.Bo.x,m.y-r.Bo.y,m.width,m.height)}}}let l=n.points,c=l.count;if(c>=2&&r instanceof _){let d=r.labelNodes;for(;d.next();){let g=d.value;r.bv(g,c,l)}}o!==null?o.sd(!1):n.sd(!1);let u=t.EA(P.l());t.location.i(t.position.x+u.x,t.position.y+u.y),P.e(u)}measureLinkPath(t,e,i,s){if(s.To()===!1)return;let n=s.strokeWidth;if(n===0&&t instanceof St&&t.type===H.Link&&t.adornedObject instanceof ct&&(n=t.adornedObject.strokeWidth),n=n*s.tt,t instanceof _&&t.ot!==null){let o=t.geometry.bounds;s.Wn(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else if(t instanceof St&&t.adornedPart.ot!==null){let o=t.adornedPart.ot.bounds;s.Wn(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else s.Wn(-(n/2),-(n/2),e+n,i+n);s.kv(),s.ue(!1)}}Ft.dn("Link",new dr);class fr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=t.findMainElement();t.Ye=[];let h=a.margin,l=h.right+h.left,c=h.top+h.bottom;a.ht(e,i,o,r);let u=a.measuredBounds,d=u.width,g=u.height,p=Math.max(d+l,0),m=Math.max(g+c,0),y=new z(-h.left,-h.top,p,m);t.Ye.push(y),n.a(y),this.determineGraduatedMarks(t,a);let w=t.xs;if(w===null)return;let b=s.length;for(let v=0;v<b;v++){let k=s[v],S=w[v];!k.visible||k===a||S.length===0||(k instanceof ct?this.measureGraduatedTicks(t,k,S,n):k instanceof xt&&this.measureGraduatedLabels(t,k,S,n),k.ue(!1))}}arrange(t,e,i){if(t.Ye===null)return;let s=t.findMainElement(),n=t.xs;if(n===null)return;let o=t.Ye,r=0,a=o[r];r++,s!==null&&s.Bt(a.x-i.x,a.y-i.y,a.width,a.height);let h=e.length;for(let l=0;l<h;l++){let c=e[l],u=n[l];!c.visible||c===s||u.length===0||(a=o[r],r++,c.Bt(a.x-i.x,a.y-i.y,a.width,a.height))}t.Ye=null}measureGraduatedTicks(t,e,i,s){let n=e.alignmentFocus;n.isNoSpot()&&(n=D.TopCenter);let o=e.angle;e.Gt=0,e.ht(1/0,1/0,0,0),e.Gt=o;let r=e.measuredBounds,a=r.width,h=r.height,l=z.V(0,0,a,h),c=P.l();c.setRectSpot(l,n),z.e(l);let u=-c.x,d=-c.y,g=new z,p=i.length;for(let m=0;m<p;m++){let y=i[m],w=y.pt.x,b=y.pt.y,v=y.angle;for(let k=0;k<4;k++){switch(k){case 0:c.i(u,d);break;case 1:c.i(u+a,d);break;case 2:c.i(u,d+h);break;case 3:c.i(u+a,d+h);break}c.rotate(v+e.angle),c.offset(w,b),m===0&&k===0?g.i(c.x,c.y,0,0):g.unionPoint(c),c.offset(-w,-b),c.rotate(-v-e.angle)}}P.e(c),t.Ye!==null&&t.Ye.push(g),s.unionNoCheck(g.x,g.y,g.width,g.height)}measureGraduatedLabels(t,e,i,s){t.Pe===null&&(t.Pe=new xt);let n=t.Pe;this.UA(e,n);let o=e.alignmentFocus;o.isNoSpot()&&(o=D.TopCenter);let r=e.segmentOrientation,a=e.segmentOffset,h=new z,l=0,c=0,u=0,d=0,g=0,p=i.length;for(let m=0;m<p;m++){let y=i[m];l=y.pt.x,c=y.pt.y,u=y.angle,d=e.angle,g=e.angle,r!==0&&(r===21||r===25?g=u+e.angle:g=u,d=_.computeAngle(r,g)),n.Gt=d,n.text=y.text||"",n.ht(1/0,1/0,0,0);let w=n.measuredBounds,b=n.naturalBounds,v=b.width,k=b.height,S=Pt.l();S.Ri(),S.Fs(-w.x,-w.y),S.tt(n.scale,n.scale),S.cs(g,v/2,k/2),(r===22||r===26)&&S.cs(90,v/2,k/2),(r===23||r===27)&&S.cs(-90,v/2,k/2),r===28&&(u>45&&u<135||u>225&&u<315)&&S.cs(-u,v/2,k/2);let M=z.V(0,0,v,k),F=P.l();F.setRectSpot(M,o),S.gt(F);let T=-F.x,N=-F.y,C=P.l();C.a(a),isNaN(C.x)&&(C.x=v/2+3),isNaN(C.y)&&(C.y=-(k/2+3)),C.rotate(u),l+=C.x+T,c+=C.y+N;let R=new z(l,c,w.width,w.height),O=new z(w.x,w.y,w.width,w.height),B=new z(b.x,b.y,b.width,b.height);y.labelAngle=d,y.lineCount=n.lineCount,y.lines=n.getMetrics(),y.actualBounds=R,y.measuredBounds=O,y.naturalBounds=B,m===0?h.a(R):h.unionRect(R),P.e(C),P.e(F),z.e(M),Pt.e(S)}t.Ye!==null&&t.Ye.push(h),s.unionNoCheck(h.x,h.y,h.width,h.height)}determineGraduatedMarks(t,e){let i=e.geometry,s=e.strokeWidth,n=i.flattenedSegments,o=i.flattenedLengths,r=i.flattenedTotalLength,a=n.length,h=0,l=0,c=f.et();for(let b=0;b<a;b++){let v=n[b],k=[];h=0,l=0;let S=v.length;for(let M=0;M<S;M+=2){let F=v[M],T=v[M+1];if(M===0){h=F,l=T;continue}let N=Math.atan2(T-l,F-h)*180/Math.PI;N<0&&(N+=360),k.push(N),h=F,l=T}c.push(k)}let u=this.Pv(t),d=t.C.r,g=d.length,p=0,m=0,y=r;t.xs=[];let w;for(let b=0;b<g;b++){let v=d[b];if(w=[],!v.visible||v===e){t.xs.push(w);continue}let k=Math.abs(v.interval),S=t.graduatedTickUnit;if(S*k*r/t.graduatedRange<2&&v.graduatedSkip===null){t.xs.push(w);continue}let M=o[0][0],F=0,T=0;m=r*v.graduatedStart-1e-4,y=r*v.graduatedEnd+1e-4;let N=S*k,C=t.graduatedTickBase;if(C<t.graduatedMin){let X=(t.graduatedMin-C)/N;X=X%1===0?X:Math.floor(X+1),C+=X*N}else if(C>t.graduatedMin+N){let X=Math.floor((C-t.graduatedMin)/N);C-=X*N}let R=u[b],O=C,B=t.graduatedMax*1e-6;for(let X=1;C<=t.graduatedMax+B;X++){if(this.Sv(t,C-t.graduatedTickBase,R)&&(C>t.graduatedMax&&(C=t.graduatedMax),(v.graduatedSkip===null||v instanceof xt&&!v.graduatedSkip(C,v)||v instanceof ct&&!v.graduatedSkip(C,v))&&(p=(C-t.graduatedMin)*r/t.graduatedRange,p>r&&(p=r),m<=p&&p<=y))){let Y=c[F][T],j=o[F][T];for(;F<o.length;){for(;p>M&&T<o[F].length-1;)T++,Y=c[F][T],j=o[F][T],M+=j;if(p<=M)break;F++,T=0,Y=c[F][T],j=o[F][T],M+=j}let U=n[F],nt=U[T*2],at=U[T*2+1],tt=U[T*2+2],st=U[T*2+3],et=(p-(M-j))/j,ut=new P(nt+(tt-nt)*et+s/2-i.bounds.x,at+(st-at)*et+s/2-i.bounds.y);if(ut.scale(e.scale,e.scale),Y=this.Mv(Y,et,U,c[F],T),v instanceof xt){let gt="";v.graduatedFunction!==null?(gt=v.graduatedFunction(C,v),gt=gt!=null?gt.toString():""):gt=(+C.toFixed(2)).toString(),gt!==""&&w.push({pt:ut,angle:Y,text:gt})}else w.push({pt:ut,angle:Y})}C=O+X*N}t.xs.push(w)}f.J(c)}Mv(t,e,i,s,n){if(e<.5005&&e>.4995)return t;let o=t;if(e<.5?n>0?o=s[n-1]:L.z(i[0],i[i.length-2])&&L.z(i[1],i[i.length-1])&&(o=s[s.length-1]):e>.5&&(n+1<s.length?o=s[n+1]:L.z(i[0],i[i.length-2])&&L.z(i[1],i[i.length-1])&&(o=s[0])),t!==o){let r=Math.abs(t-o);if(r>180&&(t<o?t+=360:o+=360,r=Math.abs(t-o)),e<5e-4||e>.9995)return(t+o)/2%360;if(r<10){let a=1-Math.abs(.5-e);return(t*a+o*(1-a))%360}}return t}Pv(t){if(t.ss===null){let e=[],i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(!(a<0))for(let h=0;h<s;h++){if(h===n)continue;let l=i[h];if(!l.visible||o.constructor!==l.constructor)continue;let c=l.interval;c>a&&r.push(c)}}t.ss=e}return t.ss}Sv(t,e,i){let s=i.length;for(let n=0;n<s;n++){let o=i[n]*t.graduatedTickUnit,r=e%o,a=t.graduatedTickUnit*1e-6;if(r<a&&r>-a)return!1}return!0}Ui(t,e,i){let s=i.ia;i.ia=!0;let n=t.naturalBounds,o=n.width,r=n.height,a=e instanceof ue;e.save(),e.beginPath(),e.rect(-1,-1,o+1,r+1),e.clip(),e.endPath();let h=t.findMainElement();h.Ui(e,i);let l=t.getDocumentScale()*i.scale;l<=0&&(l=1);let c=h.actualBounds,u=t.C.r,d=t.xs,g=u.length;for(let p=0;p<g;p++){let m=u[p],y=d[p],w=y.length;if(!(!m.visible||m===h||y.length===0)){if(m instanceof ct){if(t.graduatedTickUnit*m.interval*h.geometry.flattenedTotalLength/t.graduatedRange*l<2&&m.graduatedSkip===null)continue;let b=m.measuredBounds,v=m.strokeWidth*m.scale,k=m.alignmentFocus;k.isNoSpot()&&(k=D.TopCenter);for(let S=0;S<w;S++){let M=y[S].pt,F=y[S].angle;this.Nv(m,M,c,F,b,v,k),m.Ui(e,i),a&&(t.svg.appendChild(m.svg),m.svg=null),m.qr.Ri()}}else if(m instanceof xt){t.Pe===null&&(t.Pe=new xt);let b=t.Pe;this.UA(m,b),b.V2=!0;for(let v=0;v<w;v++){let k=y[v];if(k.actualBounds&&k.measuredBounds&&k.naturalBounds){b.Cv(k);let S=k.actualBounds;b.Bt(S.x,S.y,S.width,S.height),this.Lv(b,c,S,k.measuredBounds,k.naturalBounds),b.Jr=m.part,b.Vs=m.panel,b.Ui(e,i),b.Vs=null,b.Jr=null,a&&(t.svg.appendChild(b.svg),b.svg=null)}}}}}i.ia=s,e.restore(),e.clearContextCache(!0)}Nv(t,e,i,s,n,o,r){let a=t.qr;a.Ri(),a.Fs(e.x+i.x,e.y+i.y),a.cs(s+t.angle,0,0),a.Fs(-n.width*r.x+r.offsetX+o/2,-n.height*r.y+r.offsetY+o/2),a.tt(t.scale,t.scale),t.Zu(!1),t.hh.set(t.qr),t.da=t.scale,t.ka(!1)}Lv(t,e,i,s,n){let o=t.qr;o.Ri(),o.Fs(i.x+e.x,i.y+e.y),o.Fs(-s.x,-s.y),t.g0(o,n.x,n.y,n.width,n.height),t.Zu(!1),t.hh.set(t.qr),t.da=t.scale,t.ka(!1)}UA(t,e){e.Av(t)}}Ft.dn("Graduated",new fr);var Dn=(x=>(x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(Dn||{});class H extends dt{H;C;Zt;nd;Bn;Qr;to;Bo;z2;F;od;st;yi;_t;rd;wh;Ys;constructor(t,e){if(super(),this.H=null,t===void 0)this.H=H.Position;else if(typeof t=="string"){let i=Ft.es.get(t);i!==null&&(this.H=i)}else t instanceof Ft?this.H=t:t&&(this.H=H.Position,e=t);this.H===null&&f.o("Panel type not specified or PanelLayout not loaded: "+t),this.n|=4194304|(this.H===H.Grid?1048576:0),this.C=new G,this.Zt=Lt.Rg,this.nd=D.Default,this.Bn=1,this.Qr=null,this.to="",this.Bo=new z(NaN,NaN,NaN,NaN),this.z2=null,this.F=null,this.od=6,this.yi=null,this.st=null,this._t=null,this.rd=NaN,this.wh=null,this.Ys=null,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.H=this.H,t.Zt=this.Zt.P(),t.nd=this.nd.P(),t.Bn=this.Bn,t.to=this.to,t.Bo.a(this.Bo),this.F!==null&&(t.F=this.F.copy(t)),t.od=this.od,this.st!==null&&(t.st=this.st.copy()),this.yi!==null&&(t.yi=this.yi.copy()),t._t=this._t,t.rd=this.rd,t.wh=this.wh}vo(t){super.vo(t),t.C=this.C;let e=t.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n.Vs=t}t.Qr=null}copy(){let t=super.copy();if(t!==null){let e=this.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].copy();t.Tv(n)}return t}else return null}toString(){return"Panel("+this.type.name+")#"+I.as(this)}get type(){return this.H}set type(t){let e=this.H;e!==t&&(this.H=t,this.af=this.H===H.Grid,this.c(),this.t("type",e,t))}get elements(){return this.C.iterator}get naturalBounds(){return this.zi}get padding(){return this.Zt}set padding(t){typeof t=="number"?(t<0&&f.W(t,">= 0",H,"padding"),t=new Lt(t)):(t.left<0&&f.W(t.left,">= 0",H,"padding:value.left"),t.right<0&&f.W(t.right,">= 0",H,"padding:value.right"),t.top<0&&f.W(t.top,">= 0",H,"padding:value.top"),t.bottom<0&&f.W(t.bottom,">= 0",H,"padding:value.bottom"));let e=this.Zt;e.equals(t)||(t=t.P(),this.Zt=t,this.c(),this.t("padding",e,t))}get defaultAlignment(){return this.nd}set defaultAlignment(t){let e=this.nd;e.equals(t)||(t=t.P(),this.nd=t,this.c(),this.t("defaultAlignment",e,t))}get defaultStretch(){return this.Bn}set defaultStretch(t){let e=this.Bn;e!==t&&(this.Bn=t,this.c(),this.t("defaultStretch",e,t))}get defaultSeparatorPadding(){return this.F!==null?this.F.J0:Lt.Rg}set defaultSeparatorPadding(t){typeof t=="number"&&(t=new Lt(t));let e=this.defaultSeparatorPadding;e.equals(t)||(t=t.P(),this.F===null&&(this.F=new le),this.F.J0=t,this.c(),this.t("defaultSeparatorPadding",e,t))}get defaultRowSeparatorStroke(){return this.F!==null?this.F.$0:null}set defaultRowSeparatorStroke(t){let e=this.defaultRowSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof E)&&(t instanceof E&&t.u(),this.F===null&&(this.F=new le),this.F.$0=t,this.S(),this.t("defaultRowSeparatorStroke",e,t))}get defaultRowSeparatorStrokeWidth(){return this.F!==null?this.F.Z0:1}set defaultRowSeparatorStrokeWidth(t){let e=this.defaultRowSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.F===null&&(this.F=new le),this.F.Z0=t,this.c(),this.t("defaultRowSeparatorStrokeWidth",e,t))}get defaultRowSeparatorDashArray(){return this.F!==null?this.F.Q0:null}set defaultRowSeparatorDashArray(t){let e=this.defaultRowSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",H,"defaultRowSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("defaultRowSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.F===null&&(this.F=new le),this.F.Q0=t,this.S(),this.t("defaultRowSeparatorDashArray",e,t)}}get defaultColumnSeparatorStroke(){return this.F!==null?this.F._0:null}set defaultColumnSeparatorStroke(t){let e=this.defaultColumnSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof E)&&(t instanceof E&&t.u(),this.F===null&&(this.F=new le),this.F._0=t,this.S(),this.t("defaultColumnSeparatorStroke",e,t))}get defaultColumnSeparatorStrokeWidth(){return this.F!==null?this.F.tp:1}set defaultColumnSeparatorStrokeWidth(t){let e=this.defaultColumnSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.F===null&&(this.F=new le),this.F.tp=t,this.c(),this.t("defaultColumnSeparatorStrokeWidth",e,t))}get defaultColumnSeparatorDashArray(){return this.F!==null?this.F.ip:null}set defaultColumnSeparatorDashArray(t){let e=this.defaultColumnSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",H,"defaultColumnSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("defaultColumnSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.F===null&&(this.F=new le),this.F.ip=t,this.S(),this.t("defaultColumnSeparatorDashArray",e,t)}}get yh(){return this.F!==null?this.F.yh:null}set yh(t){this.F===null&&(this.F=new le),this.F.yh=t}get viewboxStretch(){return this.od}set viewboxStretch(t){let e=this.od;e!==t&&(this.od=t,this.c(),this.t("viewboxStretch",e,t))}get gridCellSize(){return this.yi!==null?this.yi.ld:Q.xC}set gridCellSize(t){this.yi===null&&(this.yi=new gi);let e=this.yi.ld;if(!e.equals(t)){(!t.isReal()||t.width===0||t.height===0)&&f.o("Invalid Panel.gridCellSize: "+t),this.yi.ld=t.P();let i=this.diagram;i!==null&&this===i.grid&&i.th(),this.S(),this.t("gridCellSize",e,t)}}get gridOrigin(){return this.yi!==null?this.yi.hd:P.xo}set gridOrigin(t){this.yi===null&&(this.yi=new gi);let e=this.yi.hd;if(!e.equals(t)){t.isReal()||f.o("Invalid Panel.gridOrigin: "+t),this.yi.hd=t.P();let i=this.diagram;i!==null&&this===i.grid&&i.th(),this.S(),this.t("gridOrigin",e,t)}}get graduatedMin(){return this.st!==null?this.st.ep:0}set graduatedMin(t){let e=this.graduatedMin;if(e!==t&&(this.st===null&&(this.st=new Re),this.st.ep=t,this.c(),this.t("graduatedMin",e,t),this.Wc())){let i=this.part;i!==null&&this.ba(i,"graduatedRange")}}get graduatedMax(){return this.st!==null?this.st.sp:100}set graduatedMax(t){let e=this.graduatedMax;if(e!==t&&(this.st===null&&(this.st=new Re),this.st.sp=t,this.c(),this.t("graduatedMax",e,t),this.Wc())){let i=this.part;i!==null&&this.ba(i,"graduatedRange")}}get graduatedRange(){return this.graduatedMax-this.graduatedMin}get graduatedTickUnit(){return this.st!==null?this.st.np:10}set graduatedTickUnit(t){let e=this.graduatedTickUnit;e!==t&&t>0&&(this.st===null&&(this.st=new Re),this.st.np=t,this.c(),this.t("graduatedTickUnit",e,t))}get graduatedTickBase(){return this.st!==null?this.st.op:0}set graduatedTickBase(t){let e=this.graduatedTickBase;e!==t&&(this.st===null&&(this.st=new Re),this.st.op=t,this.c(),this.t("graduatedTickBase",e,t))}get xs(){return this.st!==null?this.st.xs:null}set xs(t){this.st!==null?this.st.xs=t:t!==null&&(this.st=new Re,this.st.xs=t)}get Ye(){return this.st!==null?this.st.Ye:null}set Ye(t){this.st!==null?this.st.Ye=t:t!==null&&(this.st=new Re,this.st.Ye=t)}get ss(){return this.st!==null?this.st.ss:null}set ss(t){this.st!==null?this.st.ss=t:t!==null&&(this.st=new Re,this.st.ss=t)}get Pe(){return this.st!==null?this.st.Pe:null}set Pe(t){this.st!==null?this.st.Pe=t:t!==null&&(this.st=new Re,this.st.Pe=t)}w0(t){super.w0(t);let e=this.C.r,i=e.length;for(let s=0;s<i;s++)e[s].w0(t)}gh(t,e){if(this.H===H.Grid){t.commitTransform(),this.H.Ui(this,t,e);return}if(this.H===H.Graduated){t.commitTransform(),this.H.Ui(this,t,e);return}if(this.H===H.Table)if(t.commitTransform(),t instanceof ue){let r=t.currentElement;t.currentElement=t.newGroup2("gojs-ts"),this.X2(t,e),t.endGroup(),t.currentElement=r}else this.X2(t,e);let i=this.isClipping&&this.H===H.Spot;i&&t.save();let s=this.findMainElement(),n=this.C.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];i&&a===s&&(t.clipInsteadOfFill=!0),a.Ui(t,e),i&&a===s&&(t.clipInsteadOfFill=!1)}i&&(t.restore(),t.clearContextCache(!0))}X2(t,e){t.lineCap="butt";let i=this.rowCount>0?this.Xe:null,s=this.columnCount>0?this.Ge:null;i!==null&&this.t1(t,e,!0,i,!0),s!==null&&this.t1(t,e,!1,s,!0),i!==null&&this.BA(t,!0,i),s!==null&&this.BA(t,!1,s),i!==null&&this.t1(t,e,!0,i,!1),s!==null&&this.t1(t,e,!1,s,!1)}BA(t,e,i){let s=i.length,n=this.actualBounds,o=this.naturalBounds,r=!0;for(let a=0;a<s;a++){let h=i[a];if(h===void 0||h.actual===0)continue;if(r){r=!1;continue}if(e){if(h.position>o.height)continue}else if(h.position>o.width)continue;let l=h.separatorStrokeWidth;isNaN(l)&&(l=e?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let c=h.separatorStroke;if(c===null&&(c=e?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),l===0||c===null)continue;this.rn(t,c,!1,!1,o,n);let u=!1,d=h.separatorDashArray;d===null&&(d=e?this.defaultRowSeparatorDashArray:this.defaultColumnSeparatorDashArray),d!==null&&(u=!0,t.enableDash(d,0)),t.beginPath();let g=h.position+l;e?g>o.height&&(l-=g-o.height):g>o.width&&(l-=g-o.width);let p=h.position+l/2;t.lineWidth=l;let m=this.Zt;if(e){p+=m.top;let y=m.left,w=o.width-m.right;t.moveTo(y,p),t.lineTo(w,p)}else{p+=m.left;let y=m.top,w=o.height-m.bottom;t.moveTo(p,y),t.lineTo(p,w)}t.stroke(),t.endPath(),u&&t.disableDash()}}t1(t,e,i,s,n){let o=s.length,r=this.actualBounds,a=this.naturalBounds,h=this.VA(!0),l=this.VA(!1);for(let c=0;c<o;c++){let u=s[c];if(u===void 0||u.background===null||u.coversSeparators===n||u.actual===0)continue;let d=i?r.height:r.width;if(u.position>d)continue;let g=u.computeEffectiveSpacing(),p=u.separatorStrokeWidth;isNaN(p)&&(p=i?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let m=u.separatorStroke;m===null&&(m=i?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),(m===null||u.index===(i?h:l))&&(p=0),g-=p;let y=u.position+p,w=g+u.actual;if(y+w>d&&(w=d-y),w<=0)continue;let b=this.Zt;this.rn(t,u.background,!0,!1,a,r),i?t.fillRect(b.left,y+b.top,r.width-(b.left+b.right),w):t.fillRect(y+b.left,b.top,w,r.height-(b.top+b.bottom))}}VA(t){let e=t?this.rowCount:this.columnCount;for(let i=0;i<e;i++){let s=t?this.Xe[i]:this.Ge[i];if(s!==void 0)return s.index}return 0}Qc(){let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Qc();this.Ve(!0)}Zc(t,e,i){let s=this.svg;if(s===null)return!1;if(this.type===H.Table){let r=s.getElementsByClassName("gojs-ts"),a=r.length!==0?r[0]:null;a!==null&&(a.innerHTML=""),t.currentElement=a,this.X2(t,e),t.currentElement=null}else{if(this.H===H.Grid||this.H===H.Graduated)return s.innerHTML="",s.remove(),!1;if(this.H===H.Spot&&this.isClipping)return s.innerHTML="",s.remove(),this.ah=null,this.Qc(),!1}if(!super.Zc(t,e,i))return!1;let n=this.C.r,o=n.length;for(let r=0;r<o;r++)n[r].Ui(t,e);return!0}$u(t){return!0}b0(t,e,i,s){if(!this.isClipping){if(this.Xs()&&t.partClipRect!==null){let n=t.partClipRect,o=this.C.r,r=0,a=0;for(let h=0;h<o.length;h++){if(!o[h].isVisibleObject())continue;let l=o[h].actualBounds;r=h===0?l.x:Math.min(l.x,r),a=h===0?l.y:Math.min(l.y,a)}s.setAttributeNS(null,"clip-path",`path('M ${n.x-i.x-r},${n.y-i.y-a} l ${n.width} 0 l 0 ${n.height} l -${n.width} 0 z')`);return}super.b0(t,e,i,s)}}Jc(t,e,i,s,n){let o=this.an(),r=this.T,a=1/(r.m11*r.m22-r.m12*r.m21),h=r.m22*a,l=-r.m12*a,c=-r.m21*a,u=r.m11*a,d=a*(r.m21*r.dy-r.m22*r.dx),g=a*(r.m12*r.dx-r.m11*r.dy);if(this.background!==null){let p=t*h+e*c+d,m=t*l+e*u+g,y=i*h+s*c+d,w=i*l+s*u+g;n.i(0,0);let b=this.naturalBounds,v=L.gl(0,0,b.width,b.height,p,m,y,w,n);return n.T(r),v}else{o||(h=1,l=0,c=0,u=1,d=0,g=0);let p=t*h+e*c+d,m=t*l+e*u+g,y=i*h+s*c+d,w=i*l+s*u+g;n.i(y,w);let b=(y-p)**2+(w-m)**2,v=!1,k=this.C.r,S=k.length,M=P.l(),F=null,T=1/0,N=null,C=this.isClipping&&this.H===H.Spot;C&&(N=P.l(),F=this.findMainElement(),v=F.Jc(p,m,y,w,N),v&&(T=(p-N.x)**2+(m-N.y)**2));for(let R=0;R<S;R++){let O=k[R];if(!O.visible||O===F||!O.Jc(p,m,y,w,M))continue;v=!0;let B=(p-M.x)**2+(m-M.y)**2;B<b&&(b=B,n.set(M))}return C&&(T>b&&n.set(N),P.e(N)),P.e(M),o&&n.T(r),v}}Au(){let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Au();super.Au()}c(t){if(this.To())return;super.c(t);let e=null;(this.H===H.Auto||this.H===H.Link)&&(e=this.findMainElement());let i=this.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if((o===e||o.isPanelMain)&&o.c(!0),o.desiredSize.isReal())continue;let r=o.zs(!1);!(o instanceof ve)&&!(o instanceof H)&&!(o instanceof xt)&&r===0||o.c(!0)}}tf(){if(this.To())return;this.ue(!0),this.Jn(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].tf()}$c(){if(this.Kb()===!1){this.Zu(!0),this.ka(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].P2()}}P2(){this.ka(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].P2()}Wu(t,e,i,s){let n=this.Bo;n.i(0,0,0,0);let o=this.desiredSize,r=this.minSize;i===void 0&&(i=r.width,s=r.height),i=Math.max(i,r.width),s=Math.max(s,r.height);let a=this.maxSize;isNaN(o.width)||(t=Math.min(o.width,a.width)),isNaN(o.height)||(e=Math.min(o.height,a.height)),t=Math.max(i,t),e=Math.max(s,e);let h=this.Zt;t=Math.max(t-h.left-h.right,0),e=Math.max(e-h.top-h.bottom,0);let l=this.C.r;this.H.measure(this,t,e,l,n,i,s);let c=n.width+h.left+h.right,u=n.height+h.top+h.bottom;isFinite(o.width)&&(c=o.width),isFinite(o.height)&&(u=o.height),c=Math.min(a.width,c),u=Math.min(a.height,u),c=Math.max(r.width,c),u=Math.max(r.height,u),c=Math.max(i,c),u=Math.max(s,u),n.Fn(c,u),this.naturalBounds.Fn(c,u),this.Wn(0,0,c,u)}findMainElement(){if(this.Qr===null){let t=this.C.r,e=t.length;if(e===0)return null;for(let i=0;i<e;i++){let s=t[i];if(s.isPanelMain===!0)return this.Qr=s,s}this.Qr=t[0]}return this.Qr}Uo(){return this.part!==null?this.part.locationObject:null}get panelLayoutState(){return this.z2}set panelLayoutState(t){this.z2=t}uh(t,e,i,s){let n=this.C.r;if(this.actualBounds.i(t,e,i,s),!this.desiredSize.isReal()){let o=this.zs(!0),r=this.measuredBounds,a=r.width,h=r.height,l=this.Wr,c=l.left+l.right,u=l.top+l.bottom;switch(a===i&&h===s&&(o=0),o){case 0:(a>i||h>s)&&(this.c(),this.ht(a>i?i:a,h>s?s:h,0,0));break;case 2:this.c(!0),this.ht(i+c,s+u,0,0);break;case 5:this.c(!0),this.ht(i+c,h+u,0,0);break;case 4:this.c(!0),this.ht(a+c,s+u,0,0);break}}this.H.arrange(this,n,this.Bo)}fh(t){let e=this.naturalBounds,i=this.Uo();if(z.contains(0,0,e.width,e.height,t.x,t.y)){let s=this.C.r,n=s.length,o=P.V(0,0);for(let r=n;r--;){let a=s[r];if(!(!a.visible&&a!==i)&&(o.set(t).Oe(a.T),a.containsPoint(o)))return P.e(o),!0}return P.e(o),this.Lt!==null}return!1}d0(t){if(this.Hn===t)return this;let e=this.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].d0(t);if(n!==null)return n}return null}walkVisualTreeFrom(t,e){if(e(this,t),t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++)this.walkVisualTreeFrom(i[n],e)}}Yr(t){this.zA(this,t)}zA(t,e){e(t);let i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o instanceof H&&this.zA(o,e)}}Dv(t){this.XA(this,t)}XA(t,e){if(e(t),t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++)this.XA(i[n],e)}}findInVisualTree(t){return this.GA(this,t)}GA(t,e){if(e(t))return t;if(t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=this.GA(i[n],e);if(o!==null)return o}}return null}findObject(t){if(this.name===t)return this;let e=this.C.r,i=e.length;this.Fv()&&(i=this.rp());for(let s=0;s<i;s++){let n=e[s];if(n instanceof H){let o=n.findObject(t);if(o!==null)return o}if(n.name===t)return n}return null}YA(){let t=this.C.r,e=t.length,i=0;for(let s=0;s<e;s++){let n=t[s];n instanceof H?i=Math.max(i,n.YA()):n instanceof ct&&(i=Math.max(i,n.Rv()))}return i}an(){return!(this.type===H.TableRow||this.type===H.TableColumn)}$r(){return this.type===H.TableRow||this.type===H.TableColumn}kL(t,e,i){if(this.pickable===!1||(e===void 0&&(e=null),i===void 0&&(i=null),this._e()))return null;let s=this.naturalBounds,n=1/this.getDocumentScale(),o=this.an(),r=o?t:P.V(t.x,t.y).Oe(this.T),a=this.diagram,h=10,l=5;if(a!==null&&(h=a.getInputOption("extraTouchArea"),l=h/2),z.contains(-(l*n),-(l*n),s.width+h*n,s.height+h*n,r.x,r.y)){if(!this.af){let u=this.C.r,d=u.length,g=P.l(),p=this.isClipping&&this.H===H.Spot,m=p?this.findMainElement():null;if(p&&(m.an()?g.set(t).Oe(m.T):g.set(t),!m.containsPoint(g)))return P.e(g),o||P.e(r),null;let y=this.Uo();for(let w=d;w--;){let b=u[w];if(!b.visible&&b!==y||(b.an()?g.set(t).Oe(b.T):g.set(t),p&&b===m))continue;let v=null;if(b instanceof H?v=b.kL(g,e,i):b.pickable===!0&&b.containsPoint(g)&&(v=b),v!==null&&(e!==null&&(v=e(v)),v!==null&&(i===null||i(v))))return P.e(g),o||P.e(r),v}P.e(g)}if(this.background===null)return o||P.e(r),null;let c=z.contains(0,0,s.width,s.height,r.x,r.y)?this:null;return o||P.e(r),c}return o||P.e(r),null}PL(t,e,i,s){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let n=this.naturalBounds,o=this.an(),r=o?t:P.V(t.x,t.y).Oe(this.T),a=this.$r(),h=z.contains(0,0,n.width,n.height,r.x,r.y);if(a||h){if(!this.af){let l=this.C.r,c=l.length,u=P.l(),d=this.Uo();for(let g=c;g--;){let p=l[g];if(!p.visible&&p!==d)continue;p.an()?u.set(t).Oe(p.T):u.set(t);let m=p,y=p instanceof H?p:null;if(y!==null?y.PL(u,e,i,s):m.containsPoint(u)){if(m.pickable===!1)continue;e!==null&&(m=e(m)),m!==null&&(i===null||i(m))&&s.add(m)}}P.e(u)}return o||P.e(r),h&&this.background!==null}return o||P.e(r),!1}Tm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r=o;if(r===void 0&&(r=Pt.l(),r.Ri()),r.nc(this.T),this.containedInRect(t,r))return this.G2(e,i,n),o===void 0&&Pt.e(r),!0;if(this.intersectsRect(t,r)){if(!this.af){let a=this.Uo(),h=this.C.r,l=h.length;for(let c=l;c--;){let u=h[c];if(!u.visible&&u!==a)continue;let d=u.actualBounds,g=this.naturalBounds;if(d.x>g.width||d.y>g.height||d.x+d.width<0||d.y+d.height<0)continue;let p=u,m=u instanceof H?u:null,y=Pt.l();y.set(r),(m!==null?m.Tm(t,e,i,s,n,y):p.xA(t,s,y))&&(e!==null&&(p=e(p)),p!==null&&(i===null||i(p))&&n.add(p)),Pt.e(y)}}return o===void 0&&Pt.e(r),s}return o===void 0&&Pt.e(r),!1}G2(t,e,i){let s=this.C.r,n=s.length;for(let o=n;o--;){let r=s[o];if(!r.visible)continue;let a=r.actualBounds,h=this.naturalBounds;if(a.x>h.width||a.y>h.height||a.x+a.width<0||a.y+a.height<0)continue;r instanceof H&&r.G2(t,e,i);let l=r;t!==null&&(l=t(l)),l!==null&&(e===null||e(l))&&i.add(l)}}SL(t,e,i,s,n,o){if(this.pickable===!1)return!1;i===void 0&&(i=null),s===void 0&&(s=null);let r=this.naturalBounds,a=this.an(),h=a?t:P.V(t.x,t.y).Oe(this.T),l=a?e:P.V(e.x,e.y).Oe(this.T),c=h.distanceSquaredPoint(l),u=h.x>0&&h.x<r.width&&h.y>0&&h.y<r.height||P.distanceLineSegmentSquared(h.x,h.y,0,0,0,r.height)<=c||P.distanceLineSegmentSquared(h.x,h.y,0,r.height,r.width,r.height)<=c||P.distanceLineSegmentSquared(h.x,h.y,r.width,r.height,r.width,0)<=c||P.distanceLineSegmentSquared(h.x,h.y,r.width,0,0,0)<=c,d=h.distanceSquared(0,0)<=c&&h.distanceSquared(0,r.height)<=c&&h.distanceSquared(r.width,0)<=c&&h.distanceSquared(r.width,r.height)<=c;if(a||(P.e(h),P.e(l)),u){if(!this.af){let g=P.l(),p=P.l(),m=this.Uo(),y=this.C.r,w=y.length;for(let b=w;b--;){let v=y[b];if(!v.visible&&v!==m)continue;let k=v.actualBounds,S=this.naturalBounds;if(a&&(k.x>S.width||k.y>S.height||k.x+k.width<0||k.y+k.height<0))continue;if(v.an()){let T=v.T;g.set(t).Oe(T),p.set(e).Oe(T)}else g.set(t),p.set(e);let M=v,F=v instanceof H?v:null;(F!==null?F.SL(g,p,i,s,n,o):M.bA(g,p,n))&&(i!==null&&(M=i(M)),M!==null&&(s===null||s(M))&&o.add(M))}P.e(g),P.e(p)}return n?u:d}return!1}E2(t){let e=null;if(t instanceof ct){e=t.spot1,e===D.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot1)}return e===null&&(e=D.TopLeft),e}U2(t){let e=null;if(t instanceof ct){e=t.spot2,e===D.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot2)}return e===null&&(e=D.BottomRight),e}add(...t){for(let e=0;e<t.length;e++)this.insertAt(this.C.count,t[e]);return this}elt(t){return this.C.elt(t)}insertAt(t,e){e instanceof Nt&&f.o("Cannot add a Part to a Panel: "+e+"; use a Panel instead"),(this===e||this.isContainedBy(e))&&(this===e&&f.o("Cannot make a Panel contain itself: "+this.toString()),f.o("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+e.toString()));let i=e.panel;if(i!==null&&i!==this&&f.o("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+e.toString()+", already contained by "+i.toString()+", cannot be shared by this Panel: "+this.toString()),this.H===H.Grid&&!(e instanceof ct)&&f.o("Can only add Shapes to a Grid Panel, not: "+e),this.H===H.Graduated&&!(e instanceof ct||e instanceof xt)&&f.o("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+e),e.Pa(this),e.Jr=null,this.itemArray!==null){let r=e.data;f.Y(r)&&(this.Ys===null&&(this.Ys=new pt),this.Ys.set(r,e))}let s=this.C,n=-1;if(i===this){let r=-1,a=this.C.r,h=a.length;for(let l=0;l<h;l++)if(a[l]===e){r=l;break}if(r!==-1){if(r===t||r+1>=s.count&&t>=s.count)return;s.removeAt(r),n=r}else f.o("element "+e.toString()+" has panel "+i.toString()+" but is not contained by it.")}(t<0||t>s.count)&&(t=s.count),s.insertAt(t,e),(t===0||e.isPanelMain)&&(this.Qr=null),this.To()||this.c(),e.c(!1),e.portId!==null?this.fn=!0:e instanceof H&&e.fn===!0&&(this.fn=!0),this.ss=null,this.isEnabledObject()||this.i1(e,!1);let o=this.part;if(o!==null){o.L0(),o.cf(),this.fn&&o instanceof rt&&(o.fn=!0),o.fn&&o instanceof rt&&(o.ne=null);let r=this.diagram;if(r!==null&&r.undoManager.isUndoingRedoing)return;n!==-1&&o.raiseChangedEvent(4,"elements",this,e,null,n,null),o.raiseChangedEvent(3,"elements",this,null,e,null,t)}}get fn(){return(this.n&8388608)!==0}set fn(t){(this.n&8388608)!==0!==t&&(this.n=this.n^8388608)}p2(){return(this.n&16777216)!==0}Y2(t){t?this.n|=16777216:this.n&=-16777217}Tv(t){t.Pa(this),t.Jr=null;let e=this.C,i=e.count;e.insertAt(i,t);let s=this.part;if(s!==null){s.L0(),t.portId!==null&&s instanceof rt&&(s.fn=!0);let n=this.diagram;if(n!==null&&n.undoManager.isUndoingRedoing)return;s.raiseChangedEvent(3,"elements",this,null,t,null,i)}}ZR(t){let e=this.C.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}return s}remove(t){let e=this.C.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}s!==-1&&this.te(s,!0)}removeAt(t){t>=0&&this.te(t,!0)}te(t,e){let i=this.C,s=i.elt(t);if(s.Jr=null,s.Pa(null),this.Ys!==null){let o=s.data;f.Y(o)&&this.Ys.delete(o)}i.removeAt(t),this.ue(!1),this.c(),this.Qr===s&&(this.Qr=null),this.ss=null;let n=this.part;if(n!==null){n.L0(),n.cf(),n.invalidateAdornments(),n instanceof rt&&(s instanceof H?s.walkVisualTreeFrom(s,(r,a)=>n.C2(a,e)):n.C2(s,e));let o=this.diagram;if(o!==null&&o.undoManager.isUndoingRedoing)return;n.raiseChangedEvent(4,"elements",this,s,null,t,null)}}get Xe(){return this.F===null&&(this.F=new le),this.F.Xe}get rowCount(){return this.F===null?0:this.Xe.length}getRowDefinition(t){t<0&&f.W(t,">= 0",H,"getRowDefinition:idx"),t=Math.round(t);let e=this.Xe;if(e[t]===void 0){let i=new Yt;i.Pa(this),i.isRow=!0,i.index=t,e[t]=i,this.raiseChangedEvent(3,"rowdefs",this,null,i,null,t)}return e[t]}removeRowDefinition(t){if(t<0&&f.W(t,">= 0",H,"removeRowDefinition:idx"),this.rowCount===0)return;t=Math.round(t);let e=this.Xe,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"rowdefs",this,i,null,t,null),this.c()}}ZL(t,e){let i=this.Xe;if(!(t<0)){if(i[t]=e instanceof Yt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.c()}}get Ge(){return this.F===null&&(this.F=new le),this.F.Ge}get columnCount(){return this.F===null?0:this.Ge.length}getColumnDefinition(t){t<0&&f.W(t,">= 0",H,"getColumnDefinition:idx"),t=Math.round(t);let e=this.Ge;if(e[t]===void 0){let i=new Yt;i.Pa(this),i.isRow=!1,i.index=t,e[t]=i,this.raiseChangedEvent(3,"coldefs",this,null,i,null,t)}return e[t]}removeColumnDefinition(t){if(t<0&&f.W(t,">= 0",H,"removeColumnDefinition:idx"),this.columnCount===0)return;t=Math.round(t);let e=this.Ge,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"coldefs",this,i,null,t,null),this.c()}}QL(t,e){let i=this.Ge;if(!(t<0)){if(i[t]=e instanceof Yt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.c()}}addRowColumnDefinition(t){let e=null;return t.isRow?e=this.getRowDefinition(t.index):t.isRow||(e=this.getColumnDefinition(t.index)),e&&e.Hb(t),this}addRowDefinition(t,e){let i=this.getRowDefinition(t);return i&&i.Hb(new Yt(e)),this}addColumnDefinition(t,e){let i=this.getColumnDefinition(t);return i&&i.Hb(new Yt(e)),this}get rowSizing(){return this.F!==null?this.F.lp:3}set rowSizing(t){let e=this.rowSizing;e!==t&&(this.F===null&&(this.F=new le),this.F.lp=t,this.c(),this.t("rowSizing",e,t))}get columnSizing(){return this.F!==null?this.F.hp:3}set columnSizing(t){let e=this.columnSizing;e!==t&&(this.F===null&&(this.F=new le),this.F.hp=t,this.c(),this.t("columnSizing",e,t))}get topIndex(){return this.F!==null?this.F.ap:0}set topIndex(t){let e=this.topIndex;e!==t&&((!isFinite(t)||t<0)&&f.o("Panel.topIndex must be greater than zero and a real number, not: "+t),this.F===null&&(this.F=new le),this.F.ap=t,this.c(),this.t("topIndex",e,t))}get leftIndex(){return this.F!==null?this.F.cp:0}set leftIndex(t){let e=this.leftIndex;e!==t&&((!isFinite(t)||t<0)&&f.o("Panel.leftIndex must be greater than zero and a real number, not: "+t),this.F===null&&(this.F=new le),this.F.cp=t,this.c(),this.t("leftIndex",e,t))}findRowForLocalY(t){if(t<0||this.type!==H.Table||this.rowCount===0)return-1;let e=0,i=this.Xe,s=i.length,n=this.topIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}findColumnForLocalX(t){if(t<0||this.type!==H.Table||this.columnCount===0)return-1;let e=0,i=this.Ge,s=i.length,n=this.leftIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}graduatedPointForValue(t,e){if(e===void 0&&(e=new P(NaN,NaN)),this.type!==H.Graduated)return e.i(NaN,NaN),e;t=Math.min(Math.max(t,this.graduatedMin),this.graduatedMax);let i=this.findMainElement();return i.geometry.getPointAlongPath((t-this.graduatedMin)/this.graduatedRange,e),i.T.gt(e)}graduatedValueForPoint(t){if(this.type!==H.Graduated)return NaN;let e=this.findMainElement();return e.T.$e(t),e.geometry.getFractionForPoint(t)*this.graduatedRange+this.graduatedMin}get data(){return this._t}set data(t){let e=this._t;if(e!==t){let i=this instanceof Nt&&!(this instanceof St);i&&f.s(t,"object",H,"data"),this.Et(),this._t=t;let s=this.diagram;if(s!==null)if(i)s.partManager.vv(this,e,t);else{let n=this.panel;n!==null&&n.Ys!==null&&(e!==null&&n.Ys.delete(e),t!==null&&n.Ys.set(t,this))}if(this.t("data",e,t),s!==null&&s.undoManager.isUndoingRedoing)return;t!==null&&this.updateTargetBindings()}}get itemIndex(){return this.rd}set itemIndex(t){let e=this.rd;e!==t&&(this.rd=t,this.t("itemIndex",e,t))}get Gs(){return this.p!==null?this.p.Gs:null}set Gs(t){this.Ci!==t&&(this.p===null&&(this.p=new oi),this.p.Gs=t)}L2(){return this.Gs!==null}TA(){let t=this.Gs;return t!==null&&t.h}freezeBindings(){return this.Et()}Et(){let t=this.Gs;if(t===null)this.data!==null&&f.o("Template cannot have .data be non-null: "+this),this.Gs=t=new G;else if(t.h)return this;let e=new G;this.Y2(!1),this.walkVisualTreeFrom(this,(n,o)=>{o.ch();let r=o.Ci;if(r!==null){o.S2(!1);let a=r.iterator;for(;a.next();){let h=a.value;h.mode===2&&o.S2(!0);let l=h.sourceName;if(h.isToObject){l==="/"&&n.Y2(!0);let c=h.wA(n,o);c!==null&&(e.add(c),c.qn===null&&(c.qn=new G),c.qn.add(h))}t.add(h)}}if(o instanceof H&&o.type===H.Table){if(o.rowCount>0){let a=o.Xe,h=a.length;for(let l=0;l<h;l++){let c=a[l];if(c!==void 0&&c.bs!==null){let u=c.bs.iterator;for(;u.next();){let d=u.value;d.be=c,d.ad=2,d.ff=c.index,t.add(d)}}}}if(o.columnCount>0){let a=o.Ge,h=a.length;for(let l=0;l<h;l++){let c=a[l];if(c!==void 0&&c.bs!==null){let u=c.bs.iterator;for(;u.next();){let d=u.value;d.be=c,d.ad=1,d.ff=c.index,t.add(d)}}}}}});let i=e.iterator;for(;i.next();){let n=i.value;if(n.qn!==null){n.S2(!0);let o=n.qn.iterator;for(;o.next();){let r=o.value;n.Ci===null&&(n.Ci=new G),n.Ci.add(r)}}n.qn=null}let s=t.iterator;for(;s.next();){let n=s.value,o=n.be;if(o!==null){n.be=null;let r=n.targetProperty,a=r.indexOf(".");if(a>0&&o instanceof H){let h=r.substring(0,a),l=r.substring(a+1),c=o.findObject(h);c!==null?(o=c,n.targetProperty=l):(f.ni('Warning: unable to find GraphObject named "'+h+'" for Binding: '+n.toString()),o=null)}if(o instanceof Yt){let h=I.as(o.panel);n.targetId=h===void 0?-1:h,o.panel.Hn=n.targetId}else if(o instanceof dt){let h=I.as(o);n.targetId=h===void 0?-1:h,o.Hn=n.targetId}else f.o("Unknown type of binding target: "+o);n.check(o)}}return t.u(),this instanceof Nt&&this.ke()&&this.ensureBounds(),this}static FE=!1;copyTemplate(t){t===void 0&&(t=!1);let e=this.copy();return e.Dv(i=>{i instanceof H&&(i.Gs=null,i._t=null);let s=i.Ci;s!==null&&(i.Ci=null,s.each(o=>i.bind(o.copy())));let n=i.ws;n!==null&&(i.ws=null,n.each(o=>i.trigger(o.value.copy())))}),t&&e.Et(),e}updateTargetBindings(t){let e=this.Gs;if(e===null)return;t===void 0&&(t="");let i=this.diagram?.model,s=e.iterator;for(;s.next();){let n=s.value,o=this.KA(n,t);if(o===null)continue;let{data:r,elt:a}=o;n.isToTheme&&this.diagram===null||a!==void 0&&n.updateTarget(a,r,void 0,i)}}Do(){if(this.diagram!==null)if(this.L2()){let t=this.diagram.model,e=this.Gs.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=this.KA(i);if(s===null)continue;let{data:n,elt:o}=s;o!==void 0&&i.updateTarget(o,n,void 0,t)}}else{let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Do()}}KA(t,e=""){let i=t.sourceProperty;if(e!==""&&i!==""&&i!==e)return null;let s=t.targetProperty;if(t.converter===null&&s==="")return null;let n=this.data,o=t.sourceName;if(t.isToObject){if(n=this.yA(o),n===null)return null}else if(t.isToModel){let l=this.diagram;if(l===null)return null;n=l.model.modelData}let r=this,a=t.targetId;if(a!==-1){if(r=this.d0(a),r===null)return null}else t.be!==null&&(r=t.be);o==="/"?n=r.part:o==="."?n=r:o===".."&&(n=r.panel);let h=t.ad;if(h!==0){if(!(r instanceof H))return null;h===1?r=r.getColumnDefinition(t.ff):h===2&&(r=r.getRowDefinition(t.ff))}return{data:n,elt:r}}get itemArray(){return this.wh}set itemArray(t){let e=this.wh;if(e!==t||t!==null&&this.Ov(t)){let i=this.diagram;if(e!==t&&(i!==null&&e!==null&&i.partManager.EM(this,i),this.wh=t,i!==null&&t!==null&&i.partManager.IM(this,i)),this.t("itemArray",e,t),i!==null&&i.undoManager.isUndoingRedoing)return;this.jA(e,t)}}findItemPanelForData(t){return t==null||this.Ys===null?null:(f.ec(t,H,"findItemPanelForData"),this.Ys.get(t))}Ov(t){let e=this.C.r,i=e.length,s=t.length,n=0,o=null;for(;n<i&&(o=e[n],!(o instanceof H)||o.data===null);)n++,o=e[n];if(i-n!==s)return!0;if(o===null)return s>0;let r=0;for(;n<i&&r<s;){if(o=e[n],!(o instanceof H)||o.data!==t[r])return!0;n++,r++}return!1}rp(){if(this.type===H.Spot||this.type===H.Auto)return Math.min(this.C.length,1);if(this.type===H.Link){let t=this.C,e=t.length,i=0;for(;i<e;i++){let s=t.elt(i);if(!(s instanceof ct)||!s.isPanelMain)return i}return i}if(this.type===H.Table&&this.C.length>0){let t=this.C.elt(0);if(t.isPanelMain&&t instanceof H&&t.$r())return 1}return 0}rebuildItemElements(){let t=this.rp();for(;this.C.length>t;)this.te(this.C.length-1,!1);this.jA(null,this.itemArray)}jA(t,e){let i=this.rp(),s=e;if(s===null||s.length===0){for(;this.C.length>i;)this.te(this.C.length-1,!1);return}if(this.C.length<=i){let n=s.length;for(let o=0;o<n;o++)this.e1(s[o],o,!0)}else{let n=i;for(let r=0;r<s.length;r++,n++){let a=s[r],h=n<this.C.length?this.C.elt(n):null;if(h instanceof H){if(h.data!==a){let l=this.K2(h.data,r),c=this.K2(a,r),u=c!==l;if(!u){let d=this.j2(h.data,r,l);u=this.j2(a,r,c)!==d}u?(this.te(n,!1),this.e1(a,r,!1)):h.data=a}}else this.e1(a,r,!1)}for(;n<this.C.length;)this.te(n,!1);this.Qr=null,this.H2(i,0),this.To()||this.c(),this.ss=null,this.isEnabledObject()||this.i1(this,!1);let o=this.part;o!==null&&(o.L0(),o.cf(),this.fn&&o instanceof rt&&(o.fn=!0),o.fn&&o instanceof rt&&(o.ne=null))}}e1(t,e,i){if(t==null||e<0)return null;let s=this.K2(t,e),n=this.j2(t,e,s);if(n!==null){n.Et();let o=n.copy();if(o.p2()){let a=this.findBindingPanel();a!==null&&a.Y2(!0)}f.Y(t)&&(this.Ys===null&&(this.Ys=new pt),this.Ys.set(t,o));let r=e+this.rp();return this.insertAt(r,o),i&&(o._t=t,this.H2(r,e),o._t=null),o.data=t,o}return null}Iv(t){if(t<0)return;let e=t+this.rp();this.te(e,!0),this.H2(e,t)}H2(t,e){let i=this.C,s=t,n=e;for(;s<i.length;){let o=i.elt(s);o instanceof H&&o.Ev(s,n),s++,n++}}Ev(t,e){this.type===H.TableRow?this.row=t:this.type===H.TableColumn&&(this.column=t),this.itemIndex=e}Fv(){return this.wh!==null||this.itemTemplateMap!==null}get itemTemplate(){return this.itemTemplateMap===null?null:this.itemTemplateMap.get("")}set itemTemplate(t){if(this.itemTemplateMap===null){if(t===null)return;this.itemTemplateMap=new pt}let e=this.itemTemplateMap.get("");if(e!==t){(t instanceof Nt||t.isPanelMain)&&f.o("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+t),this.itemTemplateMap.set("",t),this.t("itemTemplate",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemTemplateMap(){return this.p!==null?this.p.G0:null}set itemTemplateMap(t){let e=this.itemTemplateMap;if(e!==t){let i=t.iterator;for(;i.next();){let n=i.value}this.Kt().G0=t,this.t("itemTemplateMap",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemCategoryProperty(){return this.p!==null?this.p.Y0:"category"}set itemCategoryProperty(t){let e=this.itemCategoryProperty;e!==t&&(typeof t!="string"&&!f.it(t)&&f.Zi(t,"string or function",H,"itemCategoryProperty"),this.Kt().Y0=t,this.t("itemCategoryProperty",e,t))}K2(t,e){if(t===null)return"";let i=this.itemCategoryProperty,s="";if(f.it(i))s=i(t);else if(typeof i=="string"&&f.Y(t)){if(i==="")return"";let n=this.diagram,o=n!==null?n.model:null;o?s=o.yt(t,i):s=yt.yt(t,i)}else return"";if(s===void 0)return"";if(typeof s=="string")return s;f.o("Panel.getCategoryForItemData found a non-string category for "+t+": "+s)}static HA=!1;static qA=null;j2(t,e,i){let s=this.itemTemplateMap,n=null;return s!==null&&(n=s.get(i)),n===null&&(s!==null&&(n=s.get("")),n===null&&(H.HA||(H.HA=!0,f.ni('No item template Panel found for category "'+i+'" on '+this),f.ni(" Using default item template."),H.qA=new H().add(new xt().bind("text","",f.toString).theme("stroke","text"))),n=H.qA)),n}get af(){return(this.n&1048576)!==0}set af(t){let e=(this.n&1048576)!==0;e!==t&&(f.s(t,"boolean",H,"isAtomic"),this.n=this.n^1048576,this.t("isAtomic",e,t))}get isClipping(){return(this.n&2097152)!==0}set isClipping(t){let e=(this.n&2097152)!==0;e!==t&&(this.Qc(),this.n=this.n^2097152,this instanceof ft&&(this.si=null),this.c(),this.t("isClipping",e,t))}get isOpposite(){return(this.n&33554432)!==0}set isOpposite(t){let e=(this.n&33554432)!==0;e!==t&&(this.n=this.n^33554432,this.c(),this.t("isOpposite",e,t))}get isEnabled(){return(this.n&4194304)!==0}set isEnabled(t){let e=(this.n&4194304)!==0;if(e!==t){let i=this.panel===null||this.panel.isEnabledObject();this.n=this.n^4194304,this.t("isEnabled",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;i&&this.i1(this,t)}}i1(t,e){let i=t.enabledChanged;if(i!==null&&i(t,e),t instanceof H){let s=t.C.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];e&&r instanceof H&&!r.isEnabled||this.i1(r,e)}}}get alignmentFocusName(){return this.to}set alignmentFocusName(t){let e=this.to;e!==t&&(this.to=t,this.c(),this.t("alignmentFocusName",e,t))}static definePanelLayout(t,e){Ft.dn(t,e)}static isBuilderDefined(t){return Ft.es.has(t)}static Position=Ft.es.get("Position");static Horizontal=Ft.es.get("Horizontal");static Vertical=Ft.es.get("Vertical");static Spot=Ft.es.get("Spot");static Auto=Ft.es.get("Auto");static Table=Ft.es.get("Table");static Viewbox=Ft.es.get("Viewbox");static TableRow=Ft.es.get("TableRow");static TableColumn=Ft.es.get("TableColumn");static Link=Ft.es.get("Link");static Grid=Ft.es.get("Grid");static Graduated=Ft.es.get("Graduated")}H.definePanelLayout=H.definePanelLayout;class Re{ep;sp;np;op;xs;Ye;ss;Pe;constructor(){this.ep=0,this.sp=100,this.np=10,this.op=0,this.xs=null,this.Ye=null,this.ss=null,this.Pe=null}copy(){let t=new Re;return t.ep=this.ep,t.sp=this.sp,t.np=this.np,t.op=this.op,t.xs=this.xs,t.Ye=this.Ye,t.ss=this.ss,t.Pe=this.Pe,t}}class gi{ld;hd;Gc;W0;constructor(){this.ld=Q.xC,this.hd=P.xo,this.Gc=Q.yw,this.W0=[]}copy(){let t=new gi;return t.ld=this.ld.copy(),t.hd=this.hd.copy(),t.Gc=this.Gc.copy(),t.W0=this.W0,t}}class le{Xe;Ge;lp;hp;ap;cp;J0;Z0;$0;Q0;tp;_0;ip;yh;constructor(){this.Xe=[],this.Ge=[],this.lp=3,this.hp=3,this.ap=0,this.cp=0,this.J0=Lt.Rg,this.Z0=1,this.$0=null,this.Q0=null,this.tp=1,this._0=null,this.ip=null,this.yh=null}copy(t){let e=new le,i=this.Xe,s=i.length,n=e.Xe;for(let h=0;h<s;h++){if(i[h]===void 0)continue;let l=i[h].copy();l.Pa(t),n[h]=l}let o=this.Ge,r=o.length,a=e.Ge;for(let h=0;h<r;h++){if(o[h]===void 0)continue;let l=o[h].copy();l.Pa(t),a[h]=l}return e.lp=this.lp,e.hp=this.hp,e.ap=this.ap,e.cp=this.cp,e.J0=this.J0.P(),e.Z0=this.Z0,e.$0=this.$0,e.Q0=this.Q0,e.tp=this.tp,e._0=this._0,e.ip=this.ip,e.yh=this.yh,e}}var vs=(x=>(x[x.Default=1]="Default",x[x.None=2]="None",x[x.ProportionalExtra=3]="ProportionalExtra",x))(vs||{});class Yt{Vs;fp;At;Ca;La;hi;at;cd;$n;_r;fd;ud;Aa;Lt;dd;bs;_;Ai;de;constructor(t){I.Ki(this),this.Vs=null,this.fp=!0,this.At=0,this.de=NaN,this.Ca=0,this.La=1/0,this.hi=D.Default,this._=0,this.Ai=0,this.at=0,this.bs=null,this.cd=1,this.$n=1,this._r=null,this.fd=null,this.ud=NaN,this.Aa=null,this.Lt=null,this.dd=!1,t&&(Object.assign(this,t),t.column!==void 0?(this.isRow=!1,this.index=t.column):t.row!==void 0&&(this.isRow=!0,this.index=t.row))}copy(){let t=new Yt;return t.fp=this.fp,t.At=this.At,t.de=this.de,t.Ca=this.Ca,t.La=this.La,t.hi=this.hi,t._=this._,t.Ai=this.Ai,t.at=this.at,t.$n=this.$n,t.cd=this.cd,this._r===null?t._r=null:t._r=this._r.P(),t.fd=this.fd,t.ud=this.ud,t.Aa=null,this.Aa!==null&&(t.separatorDashArray=this.Aa.slice()),t.Lt=this.Lt,t.dd=this.dd,t.bs=this.bs,t}Hb(t){t.isRow?t.height!==void 0&&(this.height=t.height):t.width!==void 0&&(this.width=t.width),t.minimum!==void 0&&(this.minimum=t.minimum),t.maximum!==void 0&&(this.maximum=t.maximum),t.alignment!==void 0&&(this.alignment=t.alignment),t.stretch!==void 0&&(this.stretch=t.stretch),t.sizing!==void 0&&(this.sizing=t.sizing),t.separatorPadding!==void 0&&(this.separatorPadding=t.separatorPadding),t.separatorStroke!==void 0&&(this.separatorStroke=t.separatorStroke),t.separatorStrokeWidth!==void 0&&(this.separatorStrokeWidth=t.separatorStrokeWidth),t.separatorDashArray!==void 0&&(this.Aa=t.separatorDashArray),t.background!==void 0&&(this.background=t.background),t.coversSeparators!==void 0&&(this.coversSeparators=t.coversSeparators),t.bs!==void 0&&(this.bs=t.bs)}oi(t){t in vs?this.sizing=t:f.er(this,t)}toString(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+I.as(this)}static Default=1;static None=2;static ProportionalExtra=3;Pa(t){this.Vs=t}computeEffectiveSpacingTop(t){let e=0,i=this.Vs;if(this.index!==t){let n=this.separatorStroke;n===null&&i!==null&&(n=this.isRow?i.defaultRowSeparatorStroke:i.defaultColumnSeparatorStroke),n!==null&&(e=this.separatorStrokeWidth,isNaN(e)&&(i!==null?e=this.isRow?i.defaultRowSeparatorStrokeWidth:i.defaultColumnSeparatorStrokeWidth:e=0))}let s=this._r;if(s===null)if(i!==null)s=i.defaultSeparatorPadding;else return e;return e+(this.isRow?s.top:s.left)}computeEffectiveSpacing(){let t=0,e=this.Vs,i=0,s=this.isRow;if(e!==null&&e.type===H.Table){let o=s?e.Xe.length:e.Ge.length;for(let r=0;r<o;r++){let a=s?e.Xe[r]:e.Ge[r];if(a!==void 0&&a._!==0){i=a.index;break}}}if(this.index!==i){let o=this.separatorStroke;o===null&&e!==null&&(o=s?e.defaultRowSeparatorStroke:e.defaultColumnSeparatorStroke),o!==null&&(t=this.separatorStrokeWidth,isNaN(t)&&(e!==null?t=s?e.defaultRowSeparatorStrokeWidth:e.defaultColumnSeparatorStrokeWidth:t=0))}let n=this._r;if(n===null)if(e!==null)n=e.defaultSeparatorPadding;else return t;return t+(this.isRow?n.top+n.bottom:n.left+n.right)}t(t,e,i,s,n){let o=this.Vs;if(o!==null&&(o.raiseChangedEvent(2,t,this,e,i,s,n),this.bs!==null)){let r=o.diagram;if(r!==null&&!r.fe){let a=o.findBindingPanel();if(a!==null){let h=a.data;if(h!==null){let l=this.bs.iterator;for(;l.next();)l.value.updateSource(this,h,t,a)}}}}}get panel(){return this.Vs}get isRow(){return this.fp}set isRow(t){this.fp=t}get index(){return this.At}set index(t){this.At=t}get height(){return this.de}set height(t){let e=this.de;e!==t&&(t<0&&f.W(t,">= 0",Yt,"height"),this.de=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("height",e,t))}get width(){return this.de}set width(t){let e=this.de;e!==t&&(t<0&&f.W(t,">= 0",Yt,"width"),this.de=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("width",e,t))}get minimum(){return this.Ca}set minimum(t){let e=this.Ca;e!==t&&((t<0||!isFinite(t))&&f.W(t,">= 0",Yt,"minimum"),this.Ca=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("minimum",e,t))}get maximum(){return this.La}set maximum(t){let e=this.La;e!==t&&(t<0&&f.W(t,">= 0",Yt,"maximum"),this.La=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("maximum",e,t))}get alignment(){return this.hi}set alignment(t){let e=this.hi;e.equals(t)||(this.hi=t.P(),this.panel!==null&&this.panel.c(),this.t("alignment",e,t))}get stretch(){return this.$n}set stretch(t){let e=this.$n;e!==t&&(this.$n=t,this.panel!==null&&this.panel.c(),this.t("stretch",e,t))}get separatorPadding(){return this._r}set separatorPadding(t){typeof t=="number"&&(t=new Lt(t));let e=this._r;(t===null||e===null||!e.equals(t))&&(t!==null&&(t=t.P()),this._r=t,this.panel!==null&&this.panel.c(),this.t("separatorPadding",e,t))}get separatorStroke(){return this.fd}set separatorStroke(t){let e=this.fd;e!==t&&(t!==null&&E.Qu(t,"RowColumnDefinition.separatorStroke"),t instanceof E&&t.u(),this.fd=t,this.panel!==null&&this.panel.c(),this.t("separatorStroke",e,t))}get separatorStrokeWidth(){return this.ud}set separatorStrokeWidth(t){let e=this.ud;e!==t&&(this.ud=t,this.panel!==null&&this.panel.c(),this.t("separatorStrokeWidth",e,t))}get separatorDashArray(){return this.Aa}set separatorDashArray(t){let e=this.Aa;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",Yt,"separatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("separatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Aa=t,this.panel!==null&&this.panel.S(),this.t("separatorDashArray",e,t)}}get background(){return this.Lt}set background(t){let e=this.Lt;e!==t&&(t!==null&&E.Qu(t,"RowColumnDefinition.background"),t instanceof E&&t.u(),this.Lt=t,this.panel!==null&&this.panel.S(),this.t("background",e,t))}get coversSeparators(){return this.dd}set coversSeparators(t){let e=this.dd;e!==t&&(f.s(t,"boolean",Yt,"coversSeparators"),this.dd=t,this.panel!==null&&this.panel.S(),this.t("coversSeparators",e,t))}get sizing(){return this.cd}set sizing(t){let e=this.cd;e!==t&&(this.cd=t,this.panel!==null&&this.panel.c(),this.t("sizing",e,t))}Qb(){if(this.sizing===1){let t=this.Vs;return this.isRow?t.rowSizing:t.columnSizing}return this.sizing}get actual(){return this._}set actual(t){isNaN(this.de)?this._=Math.max(Math.min(this.La,t),this.Ca):this._=Math.max(Math.min(this.La,this.de),this.Ca)}get measured(){return this.Ai}set measured(t){this.Ai=t}get total(){return this._+this.computeEffectiveSpacing()}get position(){return this.at}set position(t){this.at=t}bind(t,e,i,s){return this.sf(t,e,i,s),this}bindTwoWay(t,e,i,s){let n=this.sf(t,e,i,s);return s===void 0&&n.makeTwoWay(),this}theme(t,e,i,s,n){return this.mh(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.mh(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.mh(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.mh(t,e,i,s,n).ofModel(),this}sf(t,e,i,s){let n;return typeof t=="string"?n=new oe(t,e,i,s):n=t,this.X0(n),n}mh(t,e,i,s,n){let o;return typeof t=="string"?o=new pi(t,e,i,s,n):o=t,this.X0(o),o}X0(t){t.be=this;let e=this.panel;if(e!==null){let i=e.findBindingPanel();i!==null&&i.TA()&&f.o("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+t+" on "+e)}this.bs===null&&(this.bs=new G),this.bs.add(t)}}class ct extends dt{ot;ks;gd;Ta;ji;Vo;Io;jt;md;pd;K;constructor(t,e){super(),this.ot=null,this.ks=null,this.gd="None",this.Ta="black",this.ji="black",this.Vo=1,this.Io=null,this.jt=null,this.md=NaN,this.pd=NaN,this.K=null,typeof t=="string"?this.figure=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.ot=this.ot,t.ks=this.ks,t.gd=this.gd,t.Ta=this.Ta,t.ji=this.ji,t.Vo=this.Vo,this.Io!==null&&(t.Io=this.Io.slice()),this.jt!==null&&(this.jt.fi?t.jt=this.jt:t.jt=this.jt.copy()),t.md=this.md,t.pd=this.pd,this.K!==null&&(t.K=this.K.copy())}Da(){return this.jt===null?this.jt=new ks:this.jt.fi&&(this.jt=this.jt.copy()),this.jt}ch(){super.ch(),this.jt!==null&&(this.jt.fi=!0)}oi(t){t in ms?this.geometryStretch=t:super.oi(t)}toString(){return"Shape("+(this.figure!=="None"?this.figure:this.toArrow!=="None"?this.toArrow:this.fromArrow)+")#"+I.as(this)}Uv(t,e){let i=this.pathPattern;i.ht(1/0,1/0);let s=i.measuredBounds;i.Bt(0,0,s.width,s.height);let n=this.geometry;t.save(),t.beginPath();let o=f.et();if(n.type===1)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.endY),this.yd(t,e,o,i);else if(n.type===4){let r=n.figures.iterator;for(;r.next();){let a=r.value;o.length=0,o.push(a.startX),o.push(a.startY);let h=a.startX,l=a.startY,c=h,u=l,d=a.segments.r,g=d.length;for(let p=0;p<g;p++){let m=d[p];switch(m.type){case 1:this.yd(t,e,o,i),o.length=0,o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY,c=h,u=l;break;case 2:o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY;break;case 3:L.vn(h,l,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,o),h=m.endX,l=m.endY;break;case 4:L.Og(h,l,m.point1X,m.point1Y,m.endX,m.endY,.5,o),h=m.endX,l=m.endY;break;case 5:{let y=m.bo(a),w=y.length;if(w===0){o.push(m.centerX),o.push(m.centerY),h=m.centerX,l=m.centerY;break}for(let b=0;b<w;b++){let v=y[b];L.vn(h,l,v[2],v[3],v[4],v[5],v[6],v[7],.5,o),h=v[6],l=v[7]}break}case 6:{let y=m.Bh(a,h,l),w=y.length;if(w===0){o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY;break}for(let b=0;b<w;b++){let v=y[b];L.vn(h,l,v[2],v[3],v[4],v[5],v[6],v[7],.5,o),h=v[6],l=v[7]}break}default:f.o("Segment not of valid type: "+m.type)}m.isClosed&&(o.push(c),o.push(u),this.yd(t,e,o,i))}this.yd(t,e,o,i)}}else if(n.type===2)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.startY),o.push(n.endX),o.push(n.endY),o.push(n.startX),o.push(n.endY),o.push(n.startX),o.push(n.startY),this.yd(t,e,o,i);else if(n.type===3){let r=new $t;r.startX=n.endX,r.startY=(n.startY+n.endY)/2;let a=new vt(5);a.startAngle=0,a.sweepAngle=360,a.centerX=(n.startX+n.endX)/2,a.centerY=(n.startY+n.endY)/2,a.radiusX=Math.abs(n.startX-n.endX)/2,a.radiusY=Math.abs(n.startY-n.endY)/2,r.add(a);let h=a.bo(r),l=h.length;if(l===0)o.push(a.centerX),o.push(a.centerY);else{let c=r.startX,u=r.startY;for(let d=0;d<l;d++){let g=h[d];L.vn(c,u,g[2],g[3],g[4],g[5],g[6],g[7],.5,o),c=g[6],u=g[7]}}this.yd(t,e,o,i)}f.J(o),t.restore(),t.clearContextCache(!1)}Bv(t){let e=t.measuredBounds.width;return t instanceof ct&&(e-=t.strokeWidth),e<1&&(e=1),e}yd(t,e,i,s){let n=i.length;if(n<4)return;let o=s.measuredBounds,r=Math.max(1,o.width),a=o.height,h=i[0],l=i[1],c=0,u=0,d=0,g=0,p=0,m=0,y=0,w=0,b=f.et();for(let C=2;C<n;C+=2)c=i[C],u=i[C+1],d=c-h,g=u-l,d===0&&(d=.001),p=g/d,m=Math.atan2(g,d),y=Math.sqrt(d*d+g*g),b.push([d,m,p,y]),w+=y,h=c,l=u;h=i[0],l=i[1];let v=this.Bv(s),k=v,S=r/2,M=S!==0,F=0,T=b[F];d=T[0],m=T[1],p=T[2],y=T[3];let N=0;for(;w>=.1;){if(N===0&&(M?(k=v,k-=S,w-=S,M=!1):k=v,k===0&&(k=1)),k>w){k=w,f.J(b);return}k>y?(N=k-y,k=y):N=0;let C=Math.sqrt(k*k/(1+p*p));if(d<0&&(C=-C),h+=C,l+=p*C,t.translate(h,l),t.rotate(m),t.translate(-(r/2),-(a/2)),N===0&&s.gh(t,e),t.translate(r/2,a/2),t.rotate(-m),t.translate(-h,-l),w-=k,y-=k,N!==0){if(F++,F===b.length){f.J(b);return}T=b[F],d=T[0],m=T[1],p=T[2],y=T[3],k=N}}f.J(b)}gh(t,e){let i=t instanceof ue,s=this.ji,n=this.Ta;if(s===null&&n===null)return;let o=this.ot;if(o===null)return;t.commitTransform();let r=this.actualBounds,a=this.naturalBounds;n!==null&&this.rn(t,n,!0,!1,a,r);let h=this.part,l=this.Vo;s!==null&&l===0&&h!==null&&(this.isPanelMain||h.findMainElement()===this)&&(l=h.Vv()),l===0&&(s=null),s!==null&&l!==0&&(this.rn(t,s,!1,!1,a,r),t.lineWidth=l,t.lineJoin=this.strokeJoin,t.lineCap=this.strokeCap,t.miterLimit=this.strokeMiterLimit);let c=!1;h&&e.getRenderingHint("drawShadows")&&(c=h.isShadowed),t.Zr===!1&&(c=!1);let u=!0;s!==null&&(n===null||n==="transparent")&&(u=!1);let d=!1,g=this.strokeDashArray;if(g!==null&&(d=!0,t.enableDash(g,this.strokeDashOffset)),o.type===1)t.beginPath(),t.moveTo(o.startX,o.startY),t.lineTo(o.endX,o.endY),s!==null&&t.strokeContext(),t.endPath();else if(o.type===2){let p=o.startX,m=o.startY,y=o.endX,w=o.endY,b=Math.min(p,y),v=Math.min(m,w),k=Math.abs(y-p),S=Math.abs(w-m);t.beginPath(),t.rect(b,v,k,S),n!==null&&t.fillContext(n,!1,null),s!==null&&(u&&c&&t.shadowsOff(),t.strokeContext(),u&&c&&t.shadowsOn()),t.endPath()}else if(o.type===3){let p=o.startX,m=o.startY,y=o.endX,w=o.endY,b=Math.abs(y-p)/2,v=Math.abs(w-m)/2,k=Math.min(p,y)+b,S=Math.min(m,w)+v;t.beginPath(),t.moveTo(k,S-v),t.bezierCurveTo(k+L.Rn*b,S-v,k+b,S-L.Rn*v,k+b,S),t.bezierCurveTo(k+b,S+L.Rn*v,k+L.Rn*b,S+v,k,S+v),t.bezierCurveTo(k-L.Rn*b,S+v,k-b,S+L.Rn*v,k-b,S),t.bezierCurveTo(k-b,S-L.Rn*v,k-L.Rn*b,S-v,k,S-v),t.closePath(),n!==null&&t.fillContext(n,!1,null),s!==null&&(u&&c&&t.shadowsOff(),t.strokeContext(),u&&c&&t.shadowsOn()),t.endPath()}else if(o.type===4){let p=o.figures,m=p.length;for(let y=0;y<m;y++){let w=p.r[y];i?(t.beginPath(),this.buildPath(t,w)):w.Ee===null&&(w.Ee=new Path2D,this.buildPath(w.Ee,w));let b=w.isFilled;c?w.isShadowed?(b===!0&&n!=="transparent"&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&(b&&u&&t.shadowsOff(),t.stroke(w.Ee),b&&u&&t.shadowsOn())):(t.shadowsOff(),b&&n!=="transparent"&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&t.stroke(w.Ee),t.shadowsOn()):(b&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&t.stroke(w.Ee)),t.endPath(y)}}d&&t.disableDash(),this.pathPattern!==null&&this.Uv(t,e)}buildPath(t,e){t.moveTo(e.startX,e.startY);let i=e.segments.r,s=i.length,n=null;for(let o=0;o<s;o++){let r=i[o];switch(r.type){case 1:t.moveTo(r.endX,r.endY);break;case 2:t.lineTo(r.endX,r.endY);break;case 3:t.bezierCurveTo(r.point1X,r.point1Y,r.point2X,r.point2Y,r.endX,r.endY);break;case 4:t.quadraticCurveTo(r.point1X,r.point1Y,r.endX,r.endY);break;case 5:if(r.radiusX===r.radiusY){let a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY,l=Math.PI/180;t.arc(r.point1X,r.point1Y,r.radiusX,r.startAngle*l,(r.startAngle+r.sweepAngle)*l,r.sweepAngle<0,a,h)}else{let a=r.bo(e),h=a.length;if(h===0){t.lineTo(r.centerX,r.centerY);break}for(let l=0;l<h;l++){let c=a[l];l===0&&t.lineTo(c[0],c[1]),t.bezierCurveTo(c[2],c[3],c[4],c[5],c[6],c[7])}}break;case 6:{let a=0,h=0,l;if(n!==null&&n.type===5){l=n.bo(e);let u=l.length;if(u===0){t.lineTo(r.endX,r.endY);break}let d=l[u-1]||null;d!==null&&(a=d[6],h=d[7])}else a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY;l=r.Bh(e,a,h);let c=l.length;if(c===0){t.lineTo(r.endX,r.endY);break}for(let u=0;u<c;u++){let d=l[u];t.bezierCurveTo(d[2],d[3],d[4],d[5],d[6],d[7])}break}}r.isClosed&&t.closePath(),n=r}}Zc(t,e,i){if(!super.Zc(t,e,i)||this.ji===null&&this.Ta===null||this.ot===null||this.pathPattern!==null)return!1;let s=this.svg.getElementsByTagName("path");return this.geometry.figures.length!==s.length?!1:(t.currentPath=this.svg,this.gh(t,e),t.currentPath=null,!0)}$u(t){return this.geometry!==null&&this.geometry.figures.length>1||this.pathPattern!==null?!0:super.$u(t)}k2(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("path");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof D){let i=t;i.isNoSpot()&&f.o("getDocumentPoint Spot must be a real, specific Spot, not: "+i.toString());let s=this.naturalBounds,n=this.strokeWidth;return e.i(i.x*(s.width+n)-n/2+s.x+i.offsetX,i.y*(s.height+n)-n/2+s.y+i.offsetY),this.Us.gt(e),e}else return e.set(t),this.Us.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new z);let e=this.naturalBounds,i=this.Us,s=z.V(e.x,e.y,e.width,e.height),n=this.strokeWidth;s.inflate(n/2,n/2);let o=P.V(s.x,s.y).T(i);return t.i(o.x,o.y,0,0),o.i(s.right,s.y).T(i),t.unionNoCheck(o.x,o.y,0,0),o.i(s.right,s.bottom).T(i),t.unionNoCheck(o.x,o.y,0,0),o.i(s.x,s.bottom).T(i),t.unionNoCheck(o.x,o.y,0,0),z.e(s),P.e(o),t}fh(t,e){let i=this.geometry;if(i===null||this.fill===null&&this.stroke===null)return!1;let s=i.bounds,n=this.strokeWidth/2;i.type===1&&!e&&(n+=2);let o=z.l();if(o.a(s),o.inflate(n+2,n+2),!o.containsPoint(t))return z.e(o),!1;let r=n+1e-4;if(i.type===1){if(this.stroke===null)return!1;let a=(i.startX-i.endX)*(t.x-i.endX)+(i.startY-i.endY)*(t.y-i.endY),h=(i.endX-i.startX)*(t.x-i.startX)+(i.endY-i.startY)*(t.y-i.startY);return a<0||h<0?!1:(z.e(o),L.vi(i.startX,i.startY,i.endX,i.endY,n,t.x,t.y))}else if(i.type===2){let a=i.startX,h=i.startY,l=i.endX,c=i.endY;if(o.x=Math.min(a,l),o.y=Math.min(h,c),o.width=Math.abs(l-a),o.height=Math.abs(c-h),this.fill===null){if(o.inflate(-r,-r),o.containsPoint(t))return z.e(o),!1;o.inflate(r,r)}this.stroke!==null&&o.inflate(n,n);let u=o.containsPoint(t);return z.e(o),u}else if(i.type===3){let a=i.startX,h=i.startY,l=i.endX,c=i.endY,u=Math.min(a,l),d=Math.min(h,c),g=Math.abs(l-a),p=Math.abs(c-h),m=g/2,y=p/2;if(u=t.x-(u+m),d=t.y-(d+y),this.fill===null){if(m-=r,y-=r,m<=0||y<=0||u*u/(m*m)+d*d/(y*y)<=1)return z.e(o),!1;m+=r,y+=r}return this.stroke!==null&&(m+=r,y+=r),z.e(o),m<=0||y<=0?!1:u*u/(m*m)+d*d/(y*y)<=1}else{if(i.type===4)return z.e(o),this.fill===null?i.UC(t.x,t.y,n):i.qk(t,n,this.strokeWidth>1,e);f.o("Unknown Geometry type: "+i.type)}}Wu(t,e,i,s){let n=this.desiredSize,o=this.Vo;t=Math.max(t,0),e=Math.max(e,0);let r;if(this.ks!==null)r=this.geometry.bounds;else{let p=this.figure,m=ct.q2[p];if(m===void 0){let y=L.In[p];typeof y=="string"&&(y=L.In[y]),f.it(y)?(m=y(null,100,100),ct.q2[p]=m):f.o("Unsupported Figure: "+p)}r=m.bounds}let a=r.width,h=r.height,l=r.width,c=r.height;switch(this.zs(!0)){case 0:i=0,s=0;break;case 2:l=Math.max(t-o,0),c=Math.max(e-o,0);break;case 5:l=Math.max(t-o,0),s=0;break;case 4:i=0,c=Math.max(e-o,0);break}isFinite(n.width)&&(l=n.width),isFinite(n.height)&&(c=n.height);let u=this.maxSize,d=this.minSize;i=Math.max(i-o,d.width),s=Math.max(s-o,d.height),l=Math.min(u.width,l),c=Math.min(u.height,c),l=isFinite(l)?Math.max(i,l):Math.max(a,i),c=isFinite(c)?Math.max(s,c):Math.max(h,s);let g=this.aS();switch(g){case 0:break;case 2:a=l,h=c;break;case 6:{let p=Math.min(l/a,c/h);isFinite(p)||(p=1),a=a*p,h=h*p;break}default:f.o(g+" is not a valid geometryStretch.")}if(this.ks!==null){a===0&&(a=.001),h===0&&(h=.001);let p=(this.ks!==null?this.ks:this.ot).cF(a,h);this.ot=p}else(this.ot===null||!L.z(this.ot.rc,t-o)||!L.z(this.ot.lc,e-o))&&(this.ot=ct.zv(this,a,h));r=this.ot.bounds,t===1/0||e===1/0?this.Wn(r.x-o/2,r.y-o/2,t===0&&a===0?0:r.width+o,e===0&&h===0?0:r.height+o):this.Wn(-(o/2),-(o/2),l+o,c+o),n.isReal()?(l=n.width,c=n.height,l=Math.min(u.width,l),c=Math.min(u.height,c),l=Math.max(d.width,l),c=Math.max(d.height,c),this.zi.i(0,0,l,c)):this.zi.a(r)}aS(){let t=this.geometryStretch;return this.ks!==null?t===1?2:t:t===1?ct.q2[this.figure].defaultStretch:t}uh(t,e,i,s){this.commonArrange(t,e,i,s)}getNearestIntersectionPoint(t,e,i){return this.Jc(t.x,t.y,e.x,e.y,i)}Jc(t,e,i,s,n){let o=this.T,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,c=o.m11*r,u=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),g=t*a+e*l+u,p=t*h+e*c+d,m=i*a+s*l+u,y=i*h+s*c+d,w=this.Vo/2,b=this.ot;b===null&&(this.ht(1/0,1/0),b=this.ot);let v=b.bounds,k=!1;if(b.type===1)if(this.strokeWidth<=1.5)k=L.On(b.startX,b.startY,b.endX,b.endY,g,p,m,y,n);else{let S=0,M=0;if(b.startX===b.endX)S=w,M=0;else{let R=(b.endY-b.startY)/(b.endX-b.startX);M=w/Math.sqrt(1+R*R),S=M*R}let F=f.et(),T=new P;L.On(b.startX+S,b.startY+M,b.endX+S,b.endY+M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.startX-S,b.startY-M,b.endX-S,b.endY-M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.startX+S,b.startY+M,b.startX-S,b.startY-M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.endX+S,b.endY+M,b.endX-S,b.endY-M,g,p,m,y,T)&&F.push(T);let N=F.length;if(N===0)return f.J(F),!1;k=!0;let C=1/0;for(let R=0;R<N;R++){let O=F[R],B=(O.x-g)**2+(O.y-p)**2;B<C&&(C=B,n.x=O.x,n.y=O.y)}f.J(F)}else if(b.type===2)k=L.gl(v.x-w,v.y-w,v.x+v.width+w,v.y+v.height+w,g,p,m,y,n);else if(b.type===3){let S=z.V(v.x,v.y,v.width,v.height).inflate(w,w);k=this.Xv(S,g,p,m,y,n),z.e(S)}else if(b.type===4){let S=0,M=0,F=0,T=0,N=P.l(),C=m-g,R=y-p,O=C*C+R*R,B=g,X=p;if(O>0&&v.contains(B,X)&&(N.x=B,N.y=X,this.containsPoint(N)))for(C!==0&&Math.abs(C)<.5?(R*=.5/C,C=.5):R!==0&&Math.abs(R)<.5&&(C*=.5/R,R=.5),B-=C,X-=R;v.contains(B,X);)B-=C,X-=R;let Y=.6;n.x=m,n.y=y;for(let at=0;at<b.figures.count;at++){let tt=b.figures.r[at],st=tt.isFilled?B:g,et=tt.isFilled?X:p,ut=tt.segments;S=tt.startX,M=tt.startY;let gt=S,wt=M;for(let Ct=0;Ct<ut.count;Ct++){let ot=ut.r[Ct],Mt=ot.type;F=ot.endX,T=ot.endY;let bt=!1;switch(Mt){case 1:gt=F,wt=T;break;case 2:bt=this.s1(S,M,F,T,st,et,m,y,N);break;case 3:{bt=L.Ig(S,M,ot.point1X,ot.point1Y,ot.point2X,ot.point2Y,F,T,st,et,m,y,Y,N);break}case 4:{bt=L.Ig(S,M,S+2/3*(ot.point1X-S),M+2/3*(ot.point1Y-M),F+2/3*(ot.point1X-F),T+2/3*(ot.point1Y-T),F,T,st,et,m,y,Y,N);break}case 5:case 6:{let Gt=ot.type===5?ot.bo(tt):ot.Bh(tt,S,M),lt=Gt.length;if(lt===0){bt=this.s1(S,M,ot.type===5?ot.centerX:ot.endX,ot.type===5?ot.centerY:ot.endY,st,et,m,y,N);break}let J=null;for(let mt=0;mt<lt;mt++){if(J=Gt[mt],mt===0&&this.s1(S,M,J[0],J[1],st,et,m,y,N)){let At=this.o1(st,et,N,O,n);At<O&&(O=At,k=!0)}if(L.Ig(J[0],J[1],J[2],J[3],J[4],J[5],J[6],J[7],st,et,m,y,Y,N)){let At=this.o1(st,et,N,O,n);At<O&&(O=At,k=!0)}}F=J[6],T=J[7];break}default:f.o("Unknown Segment type: "+Mt)}if(S=F,M=T,bt){let Gt=this.o1(st,et,N,O,n);Gt<O&&(O=Gt,k=!0)}if(ot.isClosed&&(F=gt,T=wt,this.s1(S,M,F,T,st,et,m,y,N))){let Gt=this.o1(st,et,N,O,n);Gt<O&&(O=Gt,k=!0)}}}let j=i-t,U=s-e,nt=Math.sqrt(j*j+U*U);nt!==0&&(j/=nt,U/=nt),n.x-=j*w,n.y-=U*w,P.e(N)}else f.o("Unknown Geometry type: "+b.type);return k?(this.T.gt(n),!0):!1}o1(t,e,i,s,n){let o=i.x-t,r=i.y-e,a=o*o+r*r;return a<s?(n.x=i.x,n.y=i.y,a):s}s1(t,e,i,s,n,o,r,a,h){if(L.z(t,i)&&L.z(e,s)||L.z(n,r)&&L.z(o,a))return!1;let l=!1,c=(n-r)*(e-s)-(o-a)*(t-i);if(c===0)return!1;if(h.x=((n*a-o*r)*(t-i)-(n-r)*(t*s-e*i))/c,h.y=((n*a-o*r)*(e-s)-(o-a)*(t*s-e*i))/c,(t>i?t-i:i-t)<(e>s?e-s:s-e)){let u=e<s?e:s,d=e<s?s:e;(h.y>u||L.z(h.y,u))&&(h.y<d||L.z(h.y,d))&&(l=!0)}else{let u=t<i?t:i,d=t<i?i:t;(h.x>u||L.z(h.x,u))&&(h.x<d||L.z(h.x,d))&&(l=!0)}return l}Gv(t,e,i){return this.pickable===!1?!1:(i.nc(this.T),e?this.Yv(t,i):this.containedInRect(t,i))}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.ot;i===null&&(this.ht(1/0,1/0),i=this.ot);let s=i.bounds,n=this.strokeWidth/2,o=!1,r=P.l();return r.i(s.x-n,s.y-n),t.containsPoint(e.gt(r))&&(r.i(s.x-n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.i(s.right+n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.i(s.right+n,s.y-n),t.containsPoint(e.gt(r))&&(o=!0)))),P.e(r),o}intersectsRect(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.T,t.containsRect(this.actualBounds)))return!0;let i=Pt.l();i.set(e),i.xw();let s=t.left,n=t.right,o=t.top,r=t.bottom,a=P.l();if(a.i(s,o),i.gt(a),this.fh(a,!0)||(a.i(n,o),i.gt(a),this.fh(a,!0))||(a.i(s,r),i.gt(a),this.fh(a,!0))||(a.i(n,r),i.gt(a),this.fh(a,!0)))return P.e(a),!0;let h=P.l(),l=P.l();i.set(e),i.CC(this.T),i.xw(),h.x=n,h.y=o,h.T(i),a.x=s,a.y=o,a.T(i);let c=!1;return this.Fa(a,h,l)?c=!0:(a.x=n,a.y=r,a.T(i),this.Fa(a,h,l)?c=!0:(h.x=s,h.y=r,h.T(i),this.Fa(a,h,l)?c=!0:(a.x=s,a.y=o,a.T(i),this.Fa(a,h,l)&&(c=!0)))),P.e(a),Pt.e(i),P.e(h),P.e(l),c}Fa(t,e,i){if(!this.getNearestIntersectionPoint(t,e,i))return!1;let s=t.x,n=t.y,o=e.x,r=e.y,a=i.x,h=i.y;if(s===o){let l=0,c=0;return n<r?(l=n,c=r):(l=r,c=n),h>=l&&h<=c}else{let l=0,c=0;return s<o?(l=s,c=o):(l=o,c=s),a>=l&&a<=c}}Yv(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.T,t.containsRect(this.actualBounds)))return!0;let i=t.left,s=t.right,n=t.top,o=t.bottom,r=P.l(),a=P.l(),h=P.l(),l=Pt.l();l.set(e),l.CC(this.T),l.xw(),a.x=s,a.y=n,a.T(l),r.x=i,r.y=n,r.T(l);let c=!1;return this.Fa(r,a,h)?c=!0:(r.x=s,r.y=o,r.T(l),this.Fa(r,a,h)?c=!0:(a.x=i,a.y=o,a.T(l),this.Fa(r,a,h)?c=!0:(r.x=i,r.y=n,r.T(l),this.Fa(r,a,h)&&(c=!0)))),Pt.e(l),P.e(r),P.e(a),P.e(h),c}bA(t,e,i){if(i&&this.fill!==null&&this.fh(t,!0))return!0;let s=t.distanceSquaredPoint(e),n=s;this.strokeWidth>1.5&&(s=this.strokeWidth/2+Math.sqrt(s),s*=s);let o=this.ot;if(o===null&&(this.ht(1/0,1/0),o=this.ot,o===null))return!1;if(!i){let u=o.bounds,d=u.x,g=u.y,p=u.x+u.width,m=u.y+u.height;if(P.distanceSquared(t.x,t.y,d,g)<=s&&P.distanceSquared(t.x,t.y,p,g)<=s&&P.distanceSquared(t.x,t.y,d,m)<=s&&P.distanceSquared(t.x,t.y,p,m)<=s)return!0}function r(u,d){let g=u.length;for(let p=0;p<g;p+=2)if(d.distanceSquared(u[p],u[p+1])>s)return!0;return!1}let a=o.startX,h=o.startY,l=o.endX,c=o.endY;if(o.type===1){let u=P.distanceLineSegmentSquared(t.x,t.y,a,h,l,c),d=(l-a)*(t.x-a)+(c-h)*(t.y-h),g=(a-l)*(t.x-l)+(h-c)*(t.y-c),p=d>=0&&g>=0?s:n;return u<=p}else if(o.type===2){let u=!1;return i&&(u=P.distanceLineSegmentSquared(t.x,t.y,a,h,a,c)<=s||P.distanceLineSegmentSquared(t.x,t.y,a,h,l,h)<=s||P.distanceLineSegmentSquared(t.x,t.y,l,h,l,c)<=s||P.distanceLineSegmentSquared(t.x,t.y,a,c,l,c)<=s),u}else if(o.type===3){let u=(a+l)/2,d=(h+c)/2,g=t.x-u,p=t.y-d,m=Math.abs(l-a)/2,y=Math.abs(c-h)/2;if(m===0||y===0)return P.distanceLineSegmentSquared(t.x,t.y,a,h,l,c)<=s;if(i){let w=L.iF(m,y,g,p);return w*w<=s}else return!(P.distanceSquared(g,p,-m,0)>=s||P.distanceSquared(g,p,0,-y)>=s||P.distanceSquared(g,p,0,y)>=s||P.distanceSquared(g,p,m,0)>=s)}else if(o.type===4){let u=o.bounds,d=u.x,g=u.y,p=u.x+u.width,m=u.y+u.height;if(t.x>p&&t.x<d&&t.y>m&&t.y<g&&P.distanceLineSegmentSquared(t.x,t.y,d,g,d,m)>s&&P.distanceLineSegmentSquared(t.x,t.y,d,g,p,g)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,m,d,m)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,m,p,g)>s)return!1;let y=Math.sqrt(s);if(i){if(this.fill===null?o.UC(t.x,t.y,y):o.qk(t,y,!0,!1))return!0}else{let w=o.figures;for(let b=0;b<w.count;b++){let v=w.r[b],k=v.startX,S=v.startY;if(t.distanceSquared(k,S)>s)return!1;let M=v.segments.r,F=M.length;for(let T=0;T<F;T++){let N=M[T];switch(N.type){case 1:case 2:if(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s)return!1;break;case 3:{let C=f.et();L.vn(k,S,N.point1X,N.point1Y,N.point2X,N.point2Y,N.endX,N.endY,.8,C);let R=r(C,t);if(f.J(C),R||(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s))return!1;break}case 4:{let C=f.et();L.Og(k,S,N.point1X,N.point1Y,N.endX,N.endY,.8,C);let R=r(C,t);if(f.J(C),R||(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s))return!1;break}case 5:case 6:{let C=N.type===5?N.bo(v):N.Bh(v,k,S),R=C.length;if(R===0){if(k=N.type===5?N.centerX:N.endX,S=N.type===5?N.centerY:N.endY,t.distanceSquared(k,S)>s)return!1;break}let O=null,B=f.et();for(let X=0;X<R;X++)if(O=C[X],B.length=0,L.vn(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],.8,B),r(B,t))return f.J(B),!1;f.J(B),O!==null&&(k=O[6],S=O[7]);break}default:f.o("Unknown Segment type: "+N.type)}}}return!0}}return!1}Xv(t,e,i,s,n,o){if(t.width===0)return L.On(t.x,t.y,t.x,t.y+t.height,e,i,s,n,o);if(t.height===0)return L.On(t.x,t.y,t.x+t.width,t.y,e,i,s,n,o);{let r=t.width/2,a=t.height/2,h=t.x+r,l=t.y+a,c=9999;if(e!==s&&(c=(i-n)/(e-s)),Math.abs(c)<9999){let u=i-l-c*(e-h);if(r*r*(c*c)+a*a-u*u<0)return o.x=NaN,o.y=NaN,!1;let d=Math.sqrt(r*r*(c*c)+a*a-u*u),g=(-(r*r*c*u)+r*a*d)/(a*a+r*r*(c*c))+h,p=(-(r*r*c*u)-r*a*d)/(a*a+r*r*(c*c))+h,m=c*(g-h)+u+l,y=c*(p-h)+u+l,w=Math.abs((e-g)**2)+Math.abs((i-m)**2),b=Math.abs((e-p)**2)+Math.abs((i-y)**2);w<b?(o.x=g,o.y=m):(o.x=p,o.y=y)}else{let u=a*a,d=r*r,g=e-h,p=u-u/d*(g*g);if(p<0)return o.x=NaN,o.y=NaN,!1;let m=Math.sqrt(p),y=l+m,w=l-m,b=Math.abs(y-i),v=Math.abs(w-i);b<v?(o.x=e,o.y=y):(o.x=e,o.y=w)}return!0}}Rv(){return this.Vo/2*this.strokeMiterLimit*this.getDocumentScale()}get geometry(){return this.ot!==null?this.ot:this.ks}set geometry(t){let e=this.ot,i=this.ks;if(e===t)return;t!==null?(this.ot=t.u(),this.ks=this.ot):(this.ot=null,this.ks=null);let s=this.part;if(s!==null&&s.cf(),this.c(),this.t("geometry",e||i,t),this.Wc()){let n=this.part;n!==null&&this.ba(n,"geometryString")}}get geometryString(){return this.geometry===null?"":this.geometry.toString()}set geometryString(t){let e=kt.parse(t),i=e.normalize();this.geometry=e;let s=P.V(-i.x,-i.y);this.position=s,P.e(s)}get isGeometryPositioned(){return(this.n&1048576)!==0}set isGeometryPositioned(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.c(),this.t("isGeometryPositioned",e,t))}ee(){this.ot=null}get fill(){return this.Ta}set fill(t){let e=this.Ta;e!==t&&(t!==null&&E.Qu(t,"Shape.fill"),t instanceof E&&t.u(),this.Ta=t,this.S(),this.t("fill",e,t))}get stroke(){return this.ji}set stroke(t){let e=this.ji;e!==t&&(t!==null&&E.Qu(t,"Shape.stroke"),t instanceof E&&t.u(),this.ji=t,this.S(),this.t("stroke",e,t))}get strokeWidth(){return this.Vo}set strokeWidth(t){let e=this.Vo;if(e!==t)if(t>=0){this.Vo=t,this.c();let i=this.part;i!==null&&i.cf(),this.t("strokeWidth",e,t)}else f.W(t,"value >= 0",ct,"strokeWidth:value")}p0(){return this.Vo}get strokeCap(){return this.jt!==null?this.jt.dp:"butt"}set strokeCap(t){let e=this.strokeCap;e!==t&&(typeof t=="string"&&(t==="butt"||t==="round"||t==="square")?(this.Da().dp=t,this.S(),this.t("strokeCap",e,t)):f.W(t,'"butt", "round", or "square"',ct,"strokeCap"))}get strokeJoin(){return this.jt!==null?this.jt.gp:"miter"}set strokeJoin(t){let e=this.strokeJoin;e!==t&&(typeof t=="string"&&(t==="miter"||t==="bevel"||t==="round")?(this.Da().gp=t,this.S(),this.t("strokeJoin",e,t)):f.W(t,'"miter", "bevel", or "round"',ct,"strokeJoin"))}get strokeMiterLimit(){return this.jt!==null?this.jt.mp:10}set strokeMiterLimit(t){let e=this.strokeMiterLimit;if(e!==t&&t>=1){this.Da().mp=t,this.S();let i=this.part;i!==null&&i.cf(),this.t("strokeMiterLimit",e,t)}}get strokeDashArray(){return this.Io}set strokeDashArray(t){let e=this.Io;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",ct,"strokeDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(!(o>=0)||!isFinite(o))&&f.o("strokeDashArray:value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Io=t,this.S(),this.t("strokeDashArray",e,t)}}get strokeDashOffset(){return this.jt!==null?this.jt.ph:0}set strokeDashOffset(t){let e=this.strokeDashOffset;e!==t&&t>=0&&(this.Da().ph=t,this.S(),this.t("strokeDashOffset",e,t))}get figure(){return this.gd}set figure(t){let e=this.gd;if(e!==t){let i=L.In[t];if(f.it(i)?i=t:(i=L.In[t.toLowerCase()],i||f.o("Unknown Shape.figure: "+t)),e!==i){let s=this.part;s!==null&&s.cf(),this.gd=i,this.ks=null,this.ee(),this.c(),this.t("figure",e,i)}}}get toArrow(){return this.Ot!==null?this.Ot.pp:"None"}set toArrow(t){let e=this.toArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=ct.WA(t);i===null?f.o("Unknown Shape.toArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new He),this.Ot.pp=i,this.ks=null,this.ee(),this.c(),this.JA(i),this.t("toArrow",e,i))}}get fromArrow(){return this.Ot!==null?this.Ot.yp:"None"}set fromArrow(t){let e=this.fromArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=ct.WA(t);i===null?f.o("Unknown Shape.fromArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new He),this.Ot.yp=i,this.ks=null,this.ee(),this.c(),this.JA(i),this.t("fromArrow",e,i))}}JA(t){let e=this.diagram;if(e!==null&&e.undoManager.isUndoingRedoing)return;this.iv();let i=D.MiddleRight;this.toArrow!=="None"?(this.segmentIndex=-1,this.alignmentFocus=i):this.fromArrow!=="None"&&(this.segmentIndex=0,this.alignmentFocus=new D(1-i.x,i.y))}get spot1(){return this.jt!==null?this.jt.En:D.Default}set spot1(t){let e=this.spot1;e.equals(t)||(t=t.P(),this.Da().En=t,this.c(),this.t("spot1",e,t))}get spot2(){return this.jt!==null?this.jt.Un:D.Default}set spot2(t){let e=this.spot2;e.equals(t)||(t=t.P(),this.Da().Un=t,this.c(),this.t("spot2",e,t))}get parameter1(){return this.md}set parameter1(t){let e=this.md;e!==t&&(this.md=t,this.ee(),this.c(),this.t("parameter1",e,t))}get parameter2(){return this.pd}set parameter2(t){let e=this.pd;e!==t&&(this.pd=t,this.ee(),this.c(),this.t("parameter2",e,t))}get naturalBounds(){return this.zi}kv(){let t=this.desiredSize;if(!t.isReal()&&this.ot!==null){let e=this.ot.bounds;this.zi.a(e)}else this.zi.i(0,0,t.width,t.height)}get pathPattern(){return this.jt!==null?this.jt.wp:null}set pathPattern(t){let e=this.pathPattern;e!==t&&(this.Da().wp=t,this.S(),this.t("pathPattern",e,t))}get geometryStretch(){return this.jt!==null?this.jt.xp:1}set geometryStretch(t){let e=this.geometryStretch;e!==t&&(this.Da().xp=t,this.c(),this.t("geometryStretch",e,t))}get interval(){return this.K!==null?this.K.uf:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new Ae),this.K.uf=t;let i=this.diagram;i!==null&&this.panel===i.grid&&i.th(),this.c();let s=this.panel;s!==null&&(s.ss=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.df:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.df=t,this.c(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.gf:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.gf=t,this.c(),this.t("graduatedEnd",e,t))}get graduatedSkip(){return this.K!==null?this.K.mf:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&f.k(t,ct,"graduatedSkip"),this.K===null&&(this.K=new Ae),this.K.mf=t,this.c(),this.t("graduatedSkip",e,t))}static zv(t,e,i){let s=null;if(t.toArrow!=="None")s=ct.gn[t.toArrow];else if(t.fromArrow!=="None")s=ct.gn[t.fromArrow];else{let n=L.In[t.figure];typeof n=="string"&&(n=L.In[n]),n===void 0&&f.o("Unknown Shape.figure: "+t.figure),s=n(t,e,i),s.rc=e,s.lc=i}if(s===null){let n=L.In.Rectangle;f.it(n)&&(s=n(t,e,i))}return s}static getFigureGenerators(){let t=new pt;for(let e in L.In){if(e===e.toLowerCase())continue;let i=L.In[e];t.set(e,i)}return t.u(),t}static defineFigureGenerator(t,e){f.s(t,"string",ct,"defineFigureGenerator:name"),typeof e=="string"||f.k(e,ct,"defineFigureGenerator:func");let i=t.toLowerCase(),s=L.In;s[t]=e,s[i]=t}static isFigureDefined(t){return L.In.has(t)}static getArrowheadGeometries(){let t=new pt;for(let e in L.Bg)if(ct.gn[e]===void 0){let i=kt.parse(L.Bg[e],!1);ct.gn[e]=i;let s=e.toLowerCase();s!==e&&(ct.gn[s]=e)}for(let e in ct.gn){if(e===e.toLowerCase())continue;let i=ct.gn[e];i instanceof kt&&t.set(e,i)}return t.u(),t}static defineArrowheadGeometry(t,e){f.s(t,"string",ct,"defineArrowheadGeometry:name");let i=null;typeof e=="string"?(f.s(e,"string",ct,"defineArrowheadGeometry:pathstr"),i=kt.parse(e,!1)):i=e;let s=t.toLowerCase();(s==="none"||t===s)&&f.o("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+t);let n=ct.gn;n[t]=i,n[s]=t}static isArrowheadDefined(t){return ct.gn.has(t)}static gn=new K;static q2=new K;static WA(t){let e=ct.gn[t];if(e===void 0){let i=t.toLowerCase();if(i==="none")return"None";if(e=ct.gn[i],e===void 0){let s=null;for(let n in L.Bg)if(n.toLowerCase()===i){s=n;break}if(s!==null){let n=kt.parse(L.Bg[s],!1);return ct.gn[s]=n,i!==s&&(ct.gn[i]=s),s}}}return typeof e=="string"?e:e instanceof kt?t:null}}class ks{fi;dp;gp;mp;ph;wp;xp;En;Un;constructor(){this.fi=!1,this.dp="butt",this.gp="miter",this.mp=10,this.ph=0,this.wp=null,this.xp=1,this.En=D.Default,this.Un=D.Default}copy(){let t=new ks;return t.dp=this.dp,t.gp=this.gp,t.mp=this.mp,t.ph=this.ph,t.wp=this.wp,t.xp=this.xp,t.En=this.En.P(),t.Un=this.Un.P(),t}}var Ss=(x=>(x[x.None=0]="None",x[x.Fit=1]="Fit",x[x.DesiredSize=2]="DesiredSize",x[x.BreakAll=3]="BreakAll",x))(Ss||{}),Fn=(x=>(x[x.Clip=0]="Clip",x[x.Ellipsis=1]="Ellipsis",x))(Fn||{}),Ps=(x=>(x[x.Trim=0]="Trim",x[x.None=1]="None",x))(Ps||{});class xt extends dt{ri;ji;mn;ge;ui;y0;wd;K;rt;Dl;io;pn;Ce;Ti;yn;constructor(t,e){return super(),xt.q0===!1&&(xt.q0=!0,xt._n=q.isUsingDOM()?new Ue(null).li:null),this.n|=2097152,this.ri="",this.ji="black",this.mn="13px sans-serif",this.ge=0,this.ui=0,this.y0=0,this.wd=null,this.K=null,this.rt=null,this.Dl=0,this.io=null,this.pn=0,this.Ce=null,this.Ti=null,this.yn=null,typeof t=="string"?this.text=t:t&&Object.assign(this,t),e&&Object.assign(this,e),this}cloneProtected(t){super.cloneProtected(t),t.ri=this.ri,t.ji=this.ji,t.mn=this.mn,t.ge=this.ge,t.ui=this.ui,t.y0=this.y0,t.wd=this.wd,this.K!==null&&(t.K=this.K.copy()),this.rt!==null&&(this.rt.fi?t.rt=this.rt:t.rt=this.rt.copy()),t.Dl=this.Dl,t.io=this.io,t.pn=this.pn,t.Ce=this.Ce,t.Ti=this.Ti,t.yn=this.yn}wn(){return this.rt===null?this.rt=new Ms:this.rt.fi&&(this.rt=this.rt.copy()),this.rt}ch(){super.ch(),this.rt!==null&&(this.rt.fi=!0)}Av(t){this.n=t.n|2048|4096,this.$t=t.opacity,this.Lt=t.background,this.is=t.desiredSize.P(),this.minSize=t.minSize.P(),this.maxSize=t.maxSize.P(),t.wi!==null?this.wi=t.wi.copy():this.wi=null,this.tt=t.scale,this.Gt=t.angle,this.stretch=t.stretch,this.Wr=t.margin.P(),this.hi=t.alignment.P(),this.ju=t.alignmentFocus.P(),this.segmentFraction=t.segmentFraction,this.segmentOffset=t.segmentOffset.P(),this.segmentOrientation=t.segmentOrientation,t.si!==null&&(this.si=t.si.copy()),this.shadowVisible=t.shadowVisible,this.ri=t.ri,this.ji=t.ji,this.mn=t.mn,this.K!==null&&(this.K=t.K.copy()),t.rt!==null&&(t.rt.fi?this.rt=t.rt:this.rt=t.rt.copy()),this.Dl=t.Dl}Cv(t){if(this.ri=t.text||"",this.Gt=t.labelAngle||0,this.ge=t.lineCount||0,this.Kv(t.lines),t.naturalBounds&&(this.zi=t.naturalBounds),t.actualBounds){let e=t.actualBounds;this.Bt(e.x,e.y,e.width,e.height)}}oi(t){t in Ss?this.wrap=t:super.oi(t)}toString(){return this.ri.length>22?'TextBlock("'+this.ri.substring(0,20)+'"...)':'TextBlock("'+this.ri+'")'}static getEllipsis(){return xt.bp}static setEllipsis(t){xt.bp=t,xt.l1=new K,xt.W2=0}static getBaseline(){return xt.h1}static setBaseline(t){xt.h1=t}static h1=null;static getUnderline(){return xt.a1}static setUnderline(t){xt.a1=t}static a1=null;static None=0;static WrapFit=1;static WrapDesiredSize=2;static WrapBreakAll=3;static OverflowClip=0;static OverflowEllipsis=1;static FormatTrim=0;static FormatNone=1;c(){super.c(),this.Ve(!0)}get font(){return this.mn}set font(t){let e=this.mn;e!==t&&(this.mn=t,this.io=null,this.c(),this.t("font",e,t))}static isValidFont(t){return A.CSS?A.CSS.supports("font",t):!0}get text(){return this.ri}set text(t){let e=this.ri;t!=null?t=t.toString():t="",e!==t&&(this.ri=t,this.c(),this.t("text",e,t))}get textAlign(){return this.rt!==null?this.rt.kp:"start"}set textAlign(t){let e=this.textAlign;e!==t&&(t==="start"||t==="end"||t==="left"||t==="right"||t==="center")&&(this.wn().kp=t,this.S(),this.t("textAlign",e,t))}get flip(){return this.rt!==null?this.rt.eo:0}set flip(t){let e=this.flip;e!==t&&(this.wn().eo=t,this.S(),this.t("flip",e,t))}get verticalAlignment(){return this.rt!==null?this.rt.tl:D.Top}set verticalAlignment(t){let e=this.verticalAlignment;e.equals(t)||(t=t.P(),this.wn().tl=t,this.ef(),this.t("verticalAlignment",e,t))}get naturalBounds(){if(!this.zi.isReal()){let t=Q.l();this.J2(this.ri,999999,t);let e=t.width;Q.e(t);let i=this.$A(e),s=this.desiredSize;isNaN(s.width)||(e=s.width),isNaN(s.height)||(i=s.height),this.zi.Fn(e,i)}return this.zi}get isMultiline(){return(this.n&2097152)!==0}set isMultiline(t){let e=(this.n&2097152)!==0;e!==t&&(this.n=this.n^2097152,this.c(),this.t("isMultiline",e,t))}get isUnderline(){return(this.n&4194304)!==0}set isUnderline(t){let e=(this.n&4194304)!==0;e!==t&&(this.n=this.n^4194304,this.Ve(!0),this.S(),this.t("isUnderline",e,t))}get isStrikethrough(){return(this.n&8388608)!==0}set isStrikethrough(t){let e=(this.n&8388608)!==0;e!==t&&(this.n=this.n^8388608,this.Ve(!0),this.S(),this.t("isStrikethrough",e,t))}get wrap(){return this.rt!==null?this.rt.Pp:2}set wrap(t){let e=this.wrap;e!==t&&(this.wn().Pp=t,this.c(),this.t("wrap",e,t))}get overflow(){return this.rt!==null?this.rt.Sp:0}set overflow(t){let e=this.overflow;e!==t&&(this.wn().Sp=t,this.c(),this.t("overflow",e,t))}get isOverflowed(){return(this.n&16777216)!==0}$2(t){t?this.n|=16777216:this.n&=-16777217}get stroke(){return this.ji}set stroke(t){let e=this.ji;e!==t&&(t!==null&&E.Qu(t,"TextBlock.stroke"),t instanceof E&&t.u(),this.ji=t,typeof t!="string"&&this.Qc(),this.S(),this.t("stroke",e,t))}get lineCount(){return this.ge}get lineHeight(){return this.Mp()}get editable(){return(this.n&1048576)!==0}set editable(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.t("editable",e,t))}get V2(){return(this.n&33554432)!==0}set V2(t){this.n=this.n^33554432}get textEditor(){return this.rt!==null?this.rt.Np:null}set textEditor(t){let e=this.textEditor;e!==t&&(this.wn().Np=t,this.t("textEditor",e,t))}get errorFunction(){return this.rt!==null?this.rt.ns:null}set errorFunction(t){let e=this.errorFunction;e!==t&&(t!==null&&f.k(t,xt,"errorFunction"),this.wn().ns=t,this.t("errorFunction",e,t))}get interval(){return this.K!==null?this.K.uf:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new Ae),this.K.uf=t,this.c();let i=this.panel;i!==null&&(i.ss=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.df:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.df=t,this.c(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.gf:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.gf=t,this.c(),this.t("graduatedEnd",e,t))}get graduatedFunction(){return this.K!==null?this.K.Cp:null}set graduatedFunction(t){let e=this.graduatedFunction;e!==t&&(t!==null&&f.k(t,xt,"graduatedFunction"),this.K===null&&(this.K=new Ae),this.K.Cp=t,this.c(),this.t("graduatedFunction",e,t))}get graduatedSkip(){return this.K!==null?this.K.mf:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&f.k(t,xt,"graduatedSkip"),this.K===null&&(this.K=new Ae),this.K.mf=t,this.c(),this.t("graduatedSkip",e,t))}gh(t,e){if(this.ji===null||this.ri.length===0||this.mn===null)return;let i=this.naturalBounds,s=this.actualBounds,n=i.width,o=i.height,r=this.Mp(),a=t.textAlign=this.textAlign,h=e.zu;a==="start"?a=h?"right":"left":a==="end"&&(a=h?"left":"right");let l=this.isUnderline,c=this.isStrikethrough;this.rn(t,this.ji,!0,!1,i,s),(l||c)&&this.rn(t,this.ji,!1,!1,i,s);let u=0,d=0,g=n,p=!1;e.Qt===t&&!(e.Qt instanceof ue)&&!this.V2&&e.getRenderingHint("textGreeking")===!0&&r*this.da*e.scale<3&&(p=!0);let m=this.spacingAbove,y=this.spacingBelow;switch(this.flip){case 0:break;case 2:t.translate(n,0),t.scale(-1,1);break;case 1:t.translate(0,o),t.scale(1,-1);break;case 3:t.translate(n,o),t.scale(-1,-1);break}t.commitTransform();let w=this.ge,b=(m+r+y)*w;if(o>b){let v=this.verticalAlignment;d=v.y*o-v.y*b+v.offsetY}if(w===1&&this.yn!==null){let v=this.ui;v>g&&(v=g),d+=m,this.ZA(this.yn,t,u,d,g,r,v,p,a,l,c)}else if(this.Ce!==null&&this.Ti!==null)for(let v=0;v<w;v++){let k=this.Ce[v];k>g&&(k=g),d+=m,this.ZA(this.Ti[v],t,u,d,g,r,k,p,a,l,c),d+=r+y}switch(this.flip){case 0:break;case 2:t.scale(-1,1),t.translate(-n,0);break;case 1:t.scale(1,-1),t.translate(0,-o);break;case 3:t.scale(-1,-1),t.translate(-n,-o);break}}ZA(t,e,i,s,n,o,r,a,h,l,c){let u=0;if(a){h==="left"?u=0:h==="right"?u=n-r:h==="center"&&(u=(n-r)/2);let p=e.globalAlpha;e.globalAlpha=p/2,e.fillRect(i+u,s+o/4,r,o/2),e.globalAlpha=p;return}h==="left"?u=0:h==="right"?u=n:h==="center"&&(u=n/2);let d=xt.h1!==null?xt.h1(this,o):o*.75;e.fillText(t,i+u,s+d);let g=o/20|0;if(g===0&&(g=1),h==="right"?u-=r:h==="center"&&(u-=r/2),l){let p=xt.a1!==null?xt.a1(this,o):o*.8;this.QA(i+u,s+p,i+u+r,s+p,g,e),e instanceof ue&&e.lastCreatedElement.classList.add("gojs-td")}if(c){let p=s+o-o/2.2|0;g%2!==0&&(p+=.5),this.QA(i+u,p,i+u+r,p,g,e),e instanceof ue&&e.lastCreatedElement.classList.add("gojs-td")}}QA(t,e,i,s,n,o){o.beginPath(),o.lineWidth=n,o.moveTo(t,e),o.lineTo(i,s),o.stroke(),o.endPath()}Zc(t,e,i){if(!super.Zc(t,e,i))return!1;if(this.rn(t,this.ji,!0,!1,this.naturalBounds,this.actualBounds),i){if(this.svg.getElementsByTagName("text").length===0)return!0;let s=this.svg.getElementsByClassName("gojs-td");for(let n=0;n<s.length;n++)t.setFillOrStrokeInPlace(s[n],!1)}else this.jv(this.svg,this.text,t);return!0}jv(t,e,i){t.innerHTML=e,i.setFillOrStrokeInPlace(t,!0)}$u(t){return this.lineCount>1||this.isUnderline||this.isStrikethrough?!0:super.$u(t)}k2(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("text");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}Hv(){this.pn=0,this.ui=0,this.io=null,this.Ce=null,this.Ti=null,this.yn=null}Wu(t,e,i,s){let n=this.ge;this.Dl=t,this.$2(!1);let o=this.mn;xt._n!==null&&xt._A!==o&&(xt._n.font=o,xt._A=o),this.Hv();let r=0,a=0;isNaN(this.desiredSize.width)?(r=this.qv(),r=Math.min(r,t/this.scale)):r=this.desiredSize.width,this.panel!==null&&(r=Math.min(r,this.panel.maxSize.width)),a=this.$A(r),isNaN(this.desiredSize.height)?a=Math.min(a,e/this.scale):a=this.desiredSize.height,this.Wv(t,a),(this.wrap===1||isNaN(this.desiredSize.width))&&(r=isNaN(t)?this.ui:Math.min(t,this.ui)),r=Math.max(i,r),a=Math.max(s,a),this.zi.Fn(r,a),this.Wn(0,0,r,a),this.svg!==null&&n!==this.ge&&this.Ve(!0)}uh(t,e,i,s){this.commonArrange(t,e,i,s)}xn(t,e){this.yn===null?(this.yn=t,this.ui=e):((this.Ti===null||this.Ce===null)&&(this.Ti=[],this.Ce=[],this.Ti.push(this.yn),this.Ce.push(this.ui)),this.Ti.push(t),this.Ce.push(e),this.Ti.length>this.maxLines&&(this.n|=16777216))}J2(t,e,i){let s=this.formatting===0;s&&(t=t.trim());let n=0,o=0,r=0,a=this.mn,h=this.spacingAbove+this.spacingBelow,l=Math.max(0,this.Mp()+h),c=this.overflow===1?this.tT(a):0;if(this.ge>=this.maxLines){i!==null&&i.i(0,l);return}let u=t;if(this.wrap===0){if(this.pn=1,o=this.getStringWidth(t),c===0||o<=e){this.ui=Math.max(this.ui,o),this.xn(t,this.ui),i!==null&&i.i(o,l);return}let g=this.xd(u);u=u.substring(g.length);let p=this.xd(u);for(o=this.getStringWidth(g+p),r=0;p.length>0&&o<=e;){g+=p,u=u.substring(p.length),p=this.xd(u),r=o;let m=g+p;s&&(m=m.trim()),o=this.getStringWidth(m)}for(s&&(p=p.trim()),g+=p,e=Math.max(1,e-c);this.getStringWidth(g)>e&&g.length>1;)g=g.substring(0,g.length-1);this.$2(!0),g+=xt.bp,r=this.getStringWidth(g),this.ui=r,this.xn(g,r),i!==null&&i.i(r,l);return}let d=0;for(u.length===0&&(d=1,this.xn(u,0));u.length>0;){let g=this.xd(u);for(u=u.substring(g.length);this.getStringWidth(g)>e;){let y=1;for(o=this.getStringWidth(g.substring(0,y)),r=0;o<=e;)y++,r=o,o=this.getStringWidth(g.substring(0,y));let w=0;y===1?(w=o,n=Math.max(n,o)):(w=r,n=Math.max(n,r)),y--,y<1&&(y=1);let b=g.substring(0,y);if(this.xn(b,w),d++,g=g.substring(y),this.ge+d>this.maxLines)break}let p=this.xd(u);for(o=this.getStringWidth(g+p),r=0;p.length>0&&o<=e;){g+=p,u=u.substring(p.length),p=this.xd(u),r=o;let y=g+p;s&&(y=y.trim()),o=this.getStringWidth(y)}if(s&&(g=g.trim()),g==="")continue;g[g.length-1]==="\xAD"&&(g=g.substring(0,g.length-1)+"\u2010");let m=0;if(p.length===0?(m=o,n=Math.max(n,o)):(r=this.getStringWidth(g),m=r,n=Math.max(n,r)),this.xn(g,m),d++,this.ge+d>this.maxLines)break}this.pn=Math.min(this.maxLines-this.ge,d),this.ui=Math.max(this.ui,n),i!==null&&i.i(this.ui,l*this.pn)}Wv(t,e){if(this.ui===0||this.Ce===null||this.Ti===null||this.overflow!==1)return;let i=this.mn,s=this.overflow===1?this.tT(i):0,n=this.spacingAbove+this.spacingBelow,o=Math.max(0,this.Mp()+n),r=Math.min(this.maxLines-1,Math.max(Math.floor(e/o+.01)-1,0));if(r+1>=this.Ti.length)return;this.$2(!0);let a=this.Ti[r],h=Math.max(1,t-s);for(;this.getStringWidth(a)>h&&a.length>1;)a=a.substring(0,a.length-1);a+=xt.bp;let l=this.getStringWidth(a);this.Ti[r]=a,this.Ti=this.Ti.slice(0,r+1),this.Ce[r]=l,this.Ce=this.Ce.slice(0,r+1),this.pn=this.Ti.length,this.ui=Math.max(this.ui,l),this.ge=this.pn,this.ge===1&&(this.yn=this.Ti[0])}xd(t){if(this.wrap===3)return t.substring(0,1);let e=t.length,i=0,s=xt.Jv;for(;i<e&&!s.test(t.charAt(i));)i++;for(this.formatting===1&&(e=Math.min(e,i+1));i<e&&s.test(t.charAt(i));)i++;return i>=t.length?t:t.substring(0,i)}getStringWidth(t){return xt._n===null?t.length*8:xt._n.measureText(t).width}Mp(){if(this.io!==null)return this.io;let t=this.mn,e=0;return xt._n===null?(e=16,this.io=e,e):(xt.Z2[t]!==void 0&&xt.iT<5e3?e=xt.Z2[t]:(e=xt._n.measureText("M").width*1.3,xt.Z2[t]=e,xt.iT++),this.io=e,e)}tT(t){if(xt._n===null)return 6;let e=0;return xt.l1[t]!==void 0&&xt.W2<5e3?e=xt.l1[t]:(e=xt._n.measureText(xt.bp).width,xt.l1[t]=e,xt.W2++),e}c1(t,e){return t.indexOf(`
10
+ `,e)}$A(t){let e=this.ri.replace(/\r\n/g,`
11
+ `).replace(/\r/g,`
12
+ `),i=this.spacingAbove+this.spacingBelow,s=Math.max(0,this.Mp()+i);if(e.length===0)return this.ui=0,this.ge=1,s;if(!this.isMultiline){let h=this.c1(e,0);h>=0&&(e=e.substring(0,h))}let n=0;this.ge=0;let o=0,r=-1,a=!1;for(;!a;){if(r=this.c1(e,o),r===-1&&(r=e.length,a=!0),o<=r){let h=e.substring(o,r);if(this.wrap!==0){this.pn=0;let l=Q.l();this.J2(h,t,l),n+=l.height,Q.e(l),this.ge+=this.pn}else this.J2(h,t,null),n+=s,this.ge++;this.ge===this.maxLines&&(a=!0)}o=r+1}return this.y0=n,n}qv(){let t=this.ri.replace(/\r\n/g,`
13
+ `).replace(/\r/g,`
14
+ `);if(t.length===0)return 8;if(this.isMultiline){let e=0,i=0,s=!1;for(;!s;){let n=this.c1(t,i);n===-1&&(n=t.length,s=!0);let o=t.substring(i,n);this.formatting===0&&(o=o.trim()),e=Math.max(e,this.getStringWidth(o)),i=n+1}return e}else{let e=this.c1(t,0);return e>=0&&(t=t.substring(0,e)),this.getStringWidth(t)}}get textValidation(){return this.rt!==null?this.rt.Tl:null}set textValidation(t){let e=this.textValidation;e!==t&&(t!==null&&f.k(t,xt,"textValidation"),this.wn().Tl=t,this.t("textValidation",e,t))}get textEdited(){return this.rt!==null?this.rt.Lp:null}set textEdited(t){let e=this.textEdited;e!==t&&(t!==null&&f.k(t,xt,"textEdited"),this.wn().Lp=t,this.t("textEdited",e,t))}get spacingAbove(){return this.rt!==null?this.rt.Ap:0}set spacingAbove(t){let e=this.spacingAbove;e!==t&&(this.wn().Ap=t,this.c(),this.t("spacingAbove",e,t))}get spacingBelow(){return this.rt!==null?this.rt.Tp:0}set spacingBelow(t){let e=this.spacingBelow;e!==t&&(this.wn().Tp=t,this.c(),this.t("spacingBelow",e,t))}get formatting(){return this.rt!==null?this.rt.Dp:0}set formatting(t){let e=this.formatting;e!==t&&(this.wn().Dp=t,this.c(),this.t("formatting",e,t))}get maxLines(){return this.rt!==null?this.rt.Fp:1/0}set maxLines(t){let e=this.maxLines;e!==t&&(t=Math.floor(t),t<=0&&f.W(t,"> 0",xt,"maxLines"),this.wn().Fp=t,this.c(),this.t("maxLines",e,t))}getMetrics(){return[this.ui,this.Dl,this.io,this.pn,this.Ce,this.Ti,this.yn]}Kv(t){t!==void 0&&(this.ui=t[0],this.Dl=t[1],this.io=t[2],this.pn=t[3],this.Ce=t[4],this.Ti=t[5],this.yn=t[6])}get metrics(){return{arrSize:this.Ce!==null?this.Ce:[this.ui],arrText:this.Ti!==null?this.Ti:[this.yn],maxLineWidth:this.ui,fontHeight:this.io}}get choices(){return this.wd}set choices(t){let e=this.wd;e!==t&&(this.wd=t,this.t("choices",e,t))}static Jv=new RegExp("[ \u200B\xAD]");static Z2=new K;static iT=0;static l1=new K;static W2=0;static bp="...";static _A="";static _n=null;static q0=!1}class Ms{fi;ns;eo;Dp;Fp;Sp;Ap;Tp;kp;Lp;Np;Tl;tl;Pp;constructor(){this.fi=!1,this.ns=null,this.eo=0,this.Dp=0,this.Fp=1/0,this.Sp=0,this.Ap=0,this.Tp=0,this.kp="start",this.Lp=null,this.Np=null,this.Tl=null,this.tl=D.Top,this.Pp=2}copy(){let t=new Ms;return t.ns=this.ns,t.eo=this.eo,t.Dp=this.Dp,t.Fp=this.Fp,t.Sp=this.Sp,t.Ap=this.Ap,t.Tp=this.Tp,t.kp=this.kp,t.Lp=this.Lp,t.Np=this.Np,t.Tl=this.Tl,t.tl=this.tl,t.Pp=this.Pp,t}}class Ae{uf;df;gf;Cp;mf;constructor(){this.uf=1,this.df=0,this.gf=1,this.Cp=null,this.mf=null}copy(){let t=new Ae;return t.uf=this.uf,t.df=this.df,t.gf=this.gf,t.Cp=this.Cp,t.mf=this.mf,t}}var Ns=(x=>(x[x.None=0]="None",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(Ns||{});class zt extends dt{il;dt;el;pf;ns;sl;yf;eo;wf;xf;Gb;constructor(t,e){super(),this.n|=2097152,this.il=null,this.dt="",this.el=z.$D,this.pf=2,this.ns=null,this.sl=null,this.yf=D.Center,this.eo=0,this.wf=null,this.xf=null,this.Gb=null,typeof t=="string"?this.source=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.dt=this.dt,t.element=this.il,t.el=this.el.P(),t.pf=this.pf,t.eo=this.eo,t.ns=this.ns,t.sl=this.sl,t.yf=this.yf.P(),t.xf=this.xf}oi(t){t in Ns?this.imageStretch=t:super.oi(t)}toString(){return"Picture("+this.source+")#"+I.as(this)}get bf(){return(this.n&1048576)!==0}set bf(t){this.bf!==t&&(this.n=this.n^1048576)}get Rp(){return(this.n&2097152)!==0}set Rp(t){this.Rp!==t&&(this.n=this.n^2097152)}get hn(){return(this.n&4194304)!==0}set hn(t){this.hn!==t&&(this.n=this.n^4194304)}static clearCache(t){t===void 0&&(t=""),f.s(t,"string",zt,"clearCache:url"),t!==""?zt.vp[t]&&(delete zt.vp[t],zt.f1--):(zt.vp=new K,zt.f1=0)}static iA(t,e){e.eT||(e.u1=i=>{zt.$v(e,i),t.desiredSize.isReal()||(t.ue(!1),t.c())},e.d1=i=>zt.Zv(e,i),e.addEventListener("load",e.u1),e.addEventListener("error",e.d1),e.eT=!0)}static BR(t){t.u1&&t.removeEventListener("load",t.u1),t.d1&&t.removeEventListener("error",t.d1),delete t.u1,delete t.d1,delete t.eT}get element(){return this.il}set element(t){let e=this.il;if(this.Ve(!0),e!==t){this.bf=t instanceof HTMLCanvasElement;let i=t instanceof HTMLImageElement;t!==null&&!(i||t instanceof HTMLVideoElement||this.bf)&&f.o("Picture.element must be an instance of Image, Canvas, or Video, not: "+t);let s=this.diagram;s!==null&&s.YM(this),this.il=t,t!==null&&i&&t.ts===void 0&&(t.ts=new I),s!==null&&i&&s.GM(this),this.t("element",e,t),this.S()}}ER(){let t=this.il;if(t===null)return;let e=this.desiredSize.isReal();(this.bf||t.complete===!0)&&(t.o0&&(t.Op instanceof Event&&this.ns!==null?this.ns(this,t.Op):t.hn===!0&&!t.Op&&this.sl!==null&&t.Q2&&this.sl(this,t.Q2)),t.hn=!0),t.hn&&e&&this.diagram!==null&&this.diagram.Vu.add(this)}Qv(){if(this.il===null){this.wf=!1;return}let t=new Ue(null).li;try{t.drawImage(this.il,0,0)}catch{this.Rp=!1}try{t.getImageData(0,0,1,1).data[3]&&(this.wf=!1),this.wf=!1}catch{this.wf=!0}}get source(){return this.dt}set source(t){let e=this.dt;if(e!==t){this.Ve(!0),f.s(t,"string",zt,"source"),this.dt=t;let i=zt.vp;if(!q.isUsingDOM()){this.t("source",e,t);return}let s=null;if(i[t]!==void 0)s=i[t];else if(t!==""){zt.f1>30&&(zt.clearCache(),i=zt.vp),s=f.hs("img"),s.o0=!0,zt.iA(this,s);let n=this.xf;n!==null&&(s.crossOrigin=n(this)),s.src=t,i[t]=s,zt.f1++}this.element=s,s!==null&&s.__goCache===void 0&&(s.__goCache=new gr),this.c(),this.S(),this.t("source",e,t)}}static $v(t,e){t.hn=!0,t.Op=!1;let i,s=t.ts.copy();if(s==null)return;let n=s.iterator;for(;n.next();){let o=n.value;o.S();let r=t.getAttribute("src")||"",a=o.Jl.get(r);if(a===null)continue;let h=a.length;for(let l=0;l<h;l++)i=a[l],i.desiredSize.isReal()||o.Vu.add(i),i.Ve(!0),o.requestUpdate(),t.o0&&(t.Q2===void 0&&(t.Q2=e),i.sl!==null&&i.sl(i,e))}t.ts.clear()}static Zv(t,e){t.Op=e;let i,s=t.ts.copy();if(s==null)return;let n=s.iterator;for(;n.next();){let o=n.value,r=t.getAttribute("src")||"",a=o.Jl.get(r);if(a===null)continue;let h=a.length,l=f.et();for(let c=0;c<h;c++)l.push(a[c]);if(t.o0)for(let c=0;c<h;c++)i=l[c],i.ns!==null&&i.ns(i,e);f.J(l)}t.ts.clear()}reloadSource(){if(this.source==="")return;zt.clearCache(this.source);let t=this.source;this.source="",this.source=t}redraw(){this.S(),this.Ve(!0)}get sourceCrossOrigin(){return this.xf}set sourceCrossOrigin(t){if(this.xf!==t&&(t!==null&&f.k(t,zt,"sourceCrossOrigin"),this.xf=t,this.element!==null)){let e=this.element.getAttribute("src");t===null&&typeof e=="string"?this.element.crossOrigin=null:t!==null&&(this.element.crossOrigin=t(this)),this.element.src=e}}get sourceRect(){return this.el}set sourceRect(t){let e=this.el;e.equals(t)||(t=t.P(),this.el=t,this.S(),this.t("sourceRect",e,t))}get imageStretch(){return this.pf}set imageStretch(t){let e=this.pf;e!==t&&(this.pf=t,this.S(),this.t("imageStretch",e,t))}get flip(){return this.eo}set flip(t){let e=this.eo;e!==t&&(this.eo=t,this.S(),this.t("flip",e,t))}get imageAlignment(){return this.yf}set imageAlignment(t){let e=this.yf;e.equals(t)||(t=t.P(),this.yf=t,this.S(),this.t("imageAlignment",e,t))}get errorFunction(){return this.ns}set errorFunction(t){let e=this.ns;e!==t&&(t!==null&&f.k(t,zt,"errorFunction"),this.ns=t,this.t("errorFunction",e,t))}get successFunction(){return this.sl}set successFunction(t){let e=this.sl;e!==t&&(t!==null&&f.k(t,zt,"successFunction"),this.sl=t,this.t("successFunction",e,t))}gh(t,e){let i=this.il;if(i===null)return;let s=i.getAttribute("src");if(i instanceof HTMLImageElement&&(s===null||s==="")||i.Op instanceof Event&&t instanceof Ei)return;let n=t instanceof ue,o=this.naturalBounds,r=0,a=0,h=this.bf,l=h?+i.width:i.naturalWidth,c=h?+i.height:i.naturalHeight;if(l===void 0&&i.videoWidth&&(l=i.videoWidth),c===void 0&&i.videoHeight&&(c=i.videoHeight),l===0||c===0)return;let u=l,d=c;this.sourceRect.isReal()&&(r=this.el.x,a=this.el.y,l=this.el.width,c=this.el.height);let g=l,p=c,m=this.pf,y=this.yf;switch(m){case 0:if(this.sourceRect.isReal())break;g>=o.width&&(r=r+y.offsetX+(g*y.x-o.width*y.x)),p>=o.height&&(a=a+y.offsetY+(p*y.y-o.height*y.y)),l=Math.min(o.width,g),c=Math.min(o.height,p);break;case 2:g=o.width,p=o.height;break;case 6:case 7:let O=0;m===6?(O=Math.min(o.height/p,o.width/g),g*=O,p*=O):m===7&&(O=Math.max(o.height/p,o.width/g),g*=O,p*=O,g>=o.width&&(r=(r+y.offsetX+(g*y.x-o.width*y.x)/g)*l),p>=o.height&&(a=(a+y.offsetY+(p*y.y-o.height*y.y)/p)*c),l*=1/(g/o.width),c*=1/(p/o.height),g=o.width,p=o.height);break}let w=l*c,b=this.getDocumentScale()*e.scale,v=g*b,k=p*b,S=v*k,M=w/S,F=i.__goCache,T=null,N=zt._v;if(!n){if(i.hn&&F!==void 0&&u<8e3&&d<8e3&&S>4&&M>N*N){F.Vt===null&&(F.sT(4,u,d,i),F.sT(16,u,d,i));let O=F.Vt,B=O.length;for(let X=0;X<B&&O[X].bd*O[X].bd<M;X++)T=O[X]}if(!e.Bu&&(this.wf===null&&this.Qv(),this.wf))return}let C=g<o.width?y.offsetX+(o.width*y.x-g*y.x):0,R=p<o.height?y.offsetY+(o.height*y.y-p*y.y):0;switch(this.flip){case 0:break;case 2:t.translate(Math.min(o.width,g),0),t.scale(-1,1);break;case 1:t.translate(0,Math.min(o.height,p)),t.scale(1,-1);break;case 3:t.translate(Math.min(o.width,g),Math.min(o.height,p)),t.scale(-1,-1);break}if(t.commitTransform(),e.getRenderingHint("pictureRatioOptimization")&&!e.ia&&F!==void 0&&T!==null&&T.bd!==1){t.save();let O=T.bd;try{t.drawImage(T.dt,r/O,a/O,Math.min(T.dt.width,l/O),Math.min(T.dt.height,c/O),C,R,Math.min(o.width,g),Math.min(o.height,p)),t instanceof ue&&(this.Gb=[r/O,a/O,Math.min(T.dt.width,l/O),Math.min(T.dt.height,c/O),C,R,Math.min(o.width,g),Math.min(o.height,p)])}catch{this.Rp=!1}t.restore()}else try{t.drawImage(i,r,a,l,c,C,R,Math.min(o.width,g),Math.min(o.height,p)),t instanceof ue&&(this.Gb=[r,a,l,c,C,R,Math.min(o.width,g),Math.min(o.height,p)])}catch{this.Rp=!1}switch(this.flip){case 0:break;case 2:t.scale(-1,1),t.translate(-Math.min(o.width,g),0);break;case 1:t.scale(1,-1),t.translate(0,-Math.min(o.height,p));break;case 3:t.scale(-1,-1),t.translate(-Math.min(o.width,g),-Math.min(o.height,p));break}}get naturalBounds(){return this.zi}Wu(t,e,i,s){let n=this.desiredSize,o=this.zs(!0),r=this.il,a=this.bf,h=0,l=0;(a||!this.hn&&r&&r.complete)&&(this.hn=!0),r===null?(isFinite(n.width)||(t=i),isFinite(n.height)||(e=s)):(h=a?+r.width:r.naturalWidth,l=a?+r.height:r.naturalHeight),!isFinite(n.width)&&o!==2&&o!==5?r!==null&&this.hn!==!1&&(this.sourceRect.isReal()?t=this.sourceRect.width:t=h):(isFinite(t)||(this.sourceRect.isReal()?t=this.sourceRect.width:r!==null&&(t=h)),i=0),!isFinite(n.height)&&o!==2&&o!==4?r!==null&&this.hn!==!1&&(this.sourceRect.isReal()?e=this.sourceRect.height:e=l):(isFinite(e)||(this.sourceRect.isReal()?e=this.sourceRect.height:r!==null&&(e=l)),s=0),isFinite(n.width)&&(t=n.width),isFinite(n.height)&&(e=n.height);let c=this.maxSize,u=this.minSize;i=Math.max(i||0,u.width),s=Math.max(s||0,u.height),t=Math.min(c.width,t),e=Math.min(c.height,e),t=Math.max(i,t),e=Math.max(s,e),r!==null&&!r.complete&&(isFinite(t)||(t=0),isFinite(e)||(e=0)),this.zi.Fn(t,e),this.Wn(0,0,t,e)}uh(t,e,i,s){this.commonArrange(t,e,i,s)}static vp=new K;static f1=0;static _v=4}class gr{Vt;constructor(){this.Vt=null}sT(t,e,i,s){this.Vt===null&&(this.Vt=[]);let n=new Ue(null),o=n.li,r=1/t;if(n.width=e/t,n.height=i/t,n.width===0||n.height===0)return;let a=new mr(n.Tt,t),h=s,l=1;if(this.Vt.length>0){let c=this.Vt[this.Vt.length-1];h=c.dt,l=c.bd}o.setTransform(r*l,0,0,r*l,0,0),o.commitTransform(),o.drawImage(h,0,0),this.Vt.push(a)}}class mr{dt;bd;constructor(t,e){this.dt=t,this.bd=e}}class Ke{bi;Yg;constructor(){this.Yg=new kt,this.bi=null}Ri(t){t!==null?(this.Yg=t,t.figures.clear()):this.Yg=new kt,this.bi=null}hu(t,e,i,s,n,o){if(s!==void 0&&s===!0){let r=new vt(1);r.endX=t,r.endY=e,this.bi.segments.add(r)}else this.bi=new $t,this.bi.startX=t,this.bi.startY=e,this.bi.isFilled=i,this.bi.isEvenOdd=o||!1,this.Yg.figures.add(this.bi);n!==void 0&&(this.bi.isShadowed=n)}rF(){let t=this.bi.segments.length;t>0&&this.bi.segments.elt(t-1).close()}lF(){this.bi.segments.length>0&&(this.bi.isFilled=!0)}hF(t){this.bi.isShadowed=t}RE(t){this.bi.isEvenOdd=t}sF(t,e,i){i===void 0&&(i=!1);let s=new vt(1);s.endX=t,s.endY=e,i&&s.close(),this.bi.segments.add(s)}lr(t,e,i){i===void 0&&(i=!1);let s=new vt(2);s.endX=t,s.endY=e,i&&s.close(),this.bi.segments.add(s)}hr(t,e,i,s,n,o,r){r===void 0&&(r=!1);let a=new vt(3);a.point1X=t,a.point1Y=e,a.point2X=i,a.point2Y=s,a.endX=n,a.endY=o,r&&a.close(),this.bi.segments.add(a)}Nw(t,e,i,s,n){n===void 0&&(n=!1);let o=new vt(4);o.point1X=t,o.point1Y=e,o.endX=i,o.endY=s,n&&o.close(),this.bi.segments.add(o)}nF(t,e,i,s,n,o,r){o===void 0&&(o=0),r===void 0&&(r=!1);let a=new vt(5);a.startAngle=t,a.sweepAngle=e,a.centerX=i,a.centerY=s,a.radiusX=n,o!==0?a.radiusY=o:a.radiusY=n,r&&a.close(),this.bi.segments.add(a)}oF(t,e,i,s,n,o,r,a){a===void 0&&(a=!1);let h=new vt(6,o,r,t,e,i,s,n);a&&h.close(),this.bi.segments.add(h)}static _2=null;static vC(t){let e=Ke._2;if(e!==null)return Ke._2=null,e.Ri(t),e;{let i=new Ke;return i.Ri(t),i}}static OC(t){Ke._2=t}}{let x=function(n,o){let r=n.toLowerCase(),a=L.In;a[n]=o,a[r]=n};x("Rectangle",(n,o,r)=>{let a="r"+o+","+r,h=L.or[a];return h!==void 0||(h=new kt(2),h.endX=o,h.endY=r,L.rr<L.Vg&&(L.or[a]=h,L.rr++)),h}),x("Square",(n,o,r)=>{let a="s"+o+","+r,h=L.or[a];return h!==void 0||(h=new kt(2),h.endX=o,h.endY=r,h.defaultStretch=6,L.rr<L.Vg&&(L.or[a]=h,L.rr++)),h});let t=(n,o,r,a,h)=>{(isNaN(a)||a<0)&&(a=5),isNaN(h)&&(h=15);let l="rr"+o+","+r+","+a+","+h,c=L.or[l];if(c!==void 0)return c;let u=a;(h&1)===1?(u=Math.min(u,(h&2)===2?o/3:o),u=Math.min(u,(h&8)===8?r/3:r)):u=0;let d=new $t(u,0,!0);c=new kt().add(d);let g=D.TopLeft.copy(),p=D.BottomRight.copy();if((h&2)===2){let m=a;m=Math.min(m,(h&1)===1?o/3:o),m=Math.min(m,(h&4)===4?r/3:r);let y=m*L.Rn;d.add(new vt(2,o-m,0)).add(new vt(3,o,m,o-y,0,o,y)),g.offsetY=y,p.offsetX=-y}else d.add(new vt(2,o,0));if((h&4)===4){let m=a;m=Math.min(m,(h&8)===8?o/3:o),m=Math.min(m,(h&2)===2?r/3:r);let y=m*L.Rn;d.add(new vt(2,o,r-m)).add(new vt(3,o-m,r,o,r-y,o-y,r)),p.offsetX=-y,p.offsetY=-y}else d.add(new vt(2,o,r));if((h&8)===8){let m=a;m=Math.min(m,(h&4)===4?o/3:o),m=Math.min(m,(h&1)===1?r/3:r);let y=m*L.Rn;d.add(new vt(2,m,r)).add(new vt(3,0,r-m,y,r,0,r-y)),g.offsetX=y,p.offsetY=-y}else d.add(new vt(2,0,r));if((h&1)===1){let m=u*L.Rn;d.add(new vt(2,0,u)).add(new vt(3,u,0,0,m,m,0).close()),g.offsetX=m,g.offsetY=m}else d.add(new vt(2,0,0).close());return c.spot1=g,c.spot2=p,L.rr<L.Vg&&(L.or[l]=c,L.rr++),c};x("RoundedRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN,h=n?n.parameter2:NaN;return t(n,o,r,a,h)}),x("Border","RoundedRectangle"),x("RoundedTopRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,3)}),x("RoundedBottomRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,12)}),x("RoundedLeftRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,9)}),x("RoundedRightRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,6)}),x("Ellipse",(n,o,r)=>{let a="e"+o+","+r,h=L.or[a];return h!==void 0||(h=new kt(3),h.endX=o,h.endY=r,h.spot1=D.zk,h.spot2=D.Xk,L.rr<L.Vg&&(L.or[a]=h,L.rr++)),h}),x("Circle",(n,o,r)=>{let a="c"+o+","+r,h=L.or[a];return h!==void 0||(h=new kt(3),h.endX=o,h.endY=r,h.spot1=D.zk,h.spot2=D.Xk,h.defaultStretch=6,L.rr<L.Vg&&(L.or[a]=h,L.rr++)),h}),x("TriangleRight",(n,o,r)=>new kt().add(new $t(0,0).add(new vt(2,o,.5*r)).add(new vt(2,0,r).close())).setSpots(0,.25,.5,.75)),x("TriangleDown",(n,o,r)=>new kt().add(new $t(0,0).add(new vt(2,o,0)).add(new vt(2,.5*o,r).close())).setSpots(.25,0,.75,.5)),x("TriangleLeft",(n,o,r)=>new kt().add(new $t(o,r).add(new vt(2,0,.5*r)).add(new vt(2,o,0).close())).setSpots(.5,.25,1,.75)),x("TriangleUp",(n,o,r)=>new kt().add(new $t(o,r).add(new vt(2,0,r)).add(new vt(2,.5*o,0).close())).setSpots(.25,.5,.75,1)),x("Triangle","TriangleUp"),x("Diamond",(n,o,r)=>new kt().add(new $t(.5*o,0).add(new vt(2,0,.5*r)).add(new vt(2,.5*o,r)).add(new vt(2,o,.5*r).close())).setSpots(.25,.25,.75,.75)),x("LineH",(n,o,r)=>{let a=new kt(1);return a.startX=0,a.startY=r/2,a.endX=o,a.endY=r/2,a}),x("LineV",(n,o,r)=>{let a=new kt(1);return a.startX=o/2,a.startY=0,a.endX=o/2,a.endY=r,a}),x("None","Rectangle"),x("BarH","Rectangle"),x("BarV","Rectangle"),x("MinusLine","LineH"),x("PlusLine",(n,o,r)=>new kt().add(new $t(0,r/2,!1).add(new vt(2,o,r/2)).add(new vt(1,o/2,0)).add(new vt(2,o/2,r)))),x("XLine",(n,o,r)=>new kt().add(new $t(0,r,!1).add(new vt(2,o,0)).add(new vt(1,0,0)).add(new vt(2,o,r)))),x("LineRight",(n,o,r)=>new kt().add(new $t(.25*o,0,!1).add(new vt(2,.75*o,.5*r)).add(new vt(2,.25*o,r)))),x("LineDown",(n,o,r)=>new kt().add(new $t(0,.25*r,!1).add(new vt(2,.5*o,.75*r)).add(new vt(2,o,.25*r)))),x("LineLeft",(n,o,r)=>new kt().add(new $t(.75*o,0,!1).add(new vt(2,.25*o,.5*r)).add(new vt(2,.75*o,r)))),x("LineUp",(n,o,r)=>new kt().add(new $t(0,.75*r,!1).add(new vt(2,.5*o,.25*r)).add(new vt(2,o,.75*r)))),x("Capsule",(n,o,r)=>{let a=new kt;if(o<r){let h=o/2,l=new $t(0,h,!0);a.add(l),l.add(new vt(5,180,180,h,h,h,h)),l.add(new vt(2,o,r-h)),l.add(new vt(5,0,180,h,r-h,h,h)),l.add(new vt(2,0,h));let c=isFinite(n.parameter1)?n.parameter1:o*.156;return a.spot1=new D(0,0,0,c),a.spot2=new D(1,1,0,-c),a}else if(o>r){let h=r/2,l=new $t(h,0,!0);a.add(l),l.add(new vt(2,o-h,0)),l.add(new vt(5,270,180,o-h,h,h,h)),l.add(new vt(2,h,r)),l.add(new vt(5,90,180,h,h,h,h));let c=isFinite(n.parameter1)?n.parameter1:r*.156;return a.spot1=new D(0,0,c,0),a.spot2=new D(1,1,-c,0),a}else return a.type=3,a.endX=o,a.endY=r,a.spot1=D.zk,a.spot2=D.Xk,a});let e=(n,o)=>new $t(n,o,!1,!1),i=(n,o,r)=>n.add(new vt(2,o,r)),s=(n,o,r)=>n.add(new vt(1,o,r));x("Borders",(n,o,r)=>{let a=n?n.parameter1:NaN;isNaN(a)?a=10:a=a&15;let h=new kt,l;return a===10?(l=e(o,0),i(l,o,r),s(l,0,r),i(l,0,0)):a===5?(l=e(0,0),i(l,o,0),s(l,o,r),i(l,0,r)):a===1?(l=e(0,0),i(l,o,0),s(l,o,r)):a===2?(l=e(o,0),i(l,o,r)):a===4?(l=e(o,r),i(l,0,r)):a===8?(l=e(0,r),i(l,0,0),s(l,o,r)):a===3?(l=e(0,0),i(l,o,0),i(l,o,r)):a===6?(l=e(o,0),i(l,o,r),i(l,0,r)):a===12?(l=e(o,r),i(l,0,r),i(l,0,0)):a===9?(l=e(0,r),i(l,0,0),i(l,o,0)):a===7?(l=e(0,0),i(l,o,0),i(l,o,r),i(l,0,r)):a===14?(l=e(o,0),i(l,o,r),i(l,0,r),i(l,0,0)):a===13?(l=e(o,r),i(l,0,r),i(l,0,0),i(l,o,0)):a===11?(l=e(0,r),i(l,0,0),i(l,o,0),i(l,o,r)):a===15?(l=e(0,0),i(l,o,0),i(l,o,r),i(l,0,r),l.add(new vt(2,0,0).close())):(l=e(0,0),s(l,o,r)),h.add(l),h})}L.Bg={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",BackwardOpenTriangleLine:"m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};var On=(x=>(x[x.None=0]="None",x[x.Added=1]="Added",x[x.Removed=2]="Removed",x[x.Shown=4]="Shown",x[x.Hidden=8]="Hidden",x[x.NodeSized=16]="NodeSized",x[x.GroupLayout=32]="GroupLayout",x[x.NodeReplaced=64]="NodeReplaced",x[x.Standard=127]="Standard",x[x.All=16777215]="All",x))(On||{});class Nt extends H{w;zo;j;nl;ol;Xo;ri;Go;xh;Ks;Yo;kd;WS;nT;Ip;Ep;constructor(t,e){let i;t===void 0||t instanceof Ft||typeof t=="string"?i=t:t&&(e=t),super(i),this.w=2408959,this.zo="",this.j=null,this.nl="",this.ol=null,this.Xo=null,this.ri="",this.Go=null,this.xh=null,this.Ks=new P(NaN,NaN).u(),this.Yo=null,this.kd=NaN,this.WS=-1,this.nT=new z,this.Ip=null,this.Ep=NaN,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.w=this.w&-4097|16384|32768,t.zo=this.zo,this.j!==null&&(this.j.fi?t.j=this.j:t.j=this.j.copy()),t.nl=this.nl,t.Xo=null,t.ri=this.ri,t.Ks.a(this.Ks),t.kd=this.kd}vo(t){super.vo(t),t.dh(),t.ol=null,t.Yo=null,t.Ip=null}toString(){let t=f.Dn(this.constructor)+"#"+I.as(this);return this.data!==null&&(t+="("+f.toString(this.data)+")"),t}static LayoutNone=0;static LayoutAdded=1;static LayoutRemoved=2;static LayoutShown=4;static LayoutHidden=8;static LayoutNodeSized=16;static LayoutGroupLayout=32;static LayoutNodeReplaced=64;static LayoutStandard=127;static LayoutAll=16777215;Hi(){return this.j===null?this.j=new Cs:this.j.fi&&(this.j=this.j.copy()),this.j}ch(){super.ch(),this.j!==null&&(this.j.fi=!0)}qc(t,e,i,s,n,o,r){let a=this.diagram;a!==null&&(t===3&&e==="elements"?n instanceof H?n.Yr(h=>{a.partManager.IM(h,a)}):n instanceof zt&&a.GM(n):t===4&&e==="elements"&&(n instanceof H?n.Yr(h=>a.partManager.EM(h,a)):n instanceof zt&&a.YM(n)),a.raiseChangedEvent(t,e,i,s,n,o,r))}updateTargetBindings(t){if(super.updateTargetBindings(t),this.data===null)return;let e=this.C.r,i=e.length;for(let n=0;n<i;n++){let o=e[n];o instanceof H&&o.Yr(r=>{r.data!==null&&r.updateTargetBindings()})}let s=this.adornments;for(;s.next();)s.value.updateTargetBindings(t)}Do(){if(super.Do(),this.L2()){let e=this.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n instanceof H&&n.Yr(o=>o.Do())}}let t=this.adornments;for(;t.next();)t.value.Do()}updateRelationshipsFromData(){this.data!==null&&this.diagram?.partManager.updateRelationshipsFromData(this)}get key(){let t=this.diagram;if(t!==null)return t.model.getKeyForNodeData(this.data)}get adornments(){return this.Xo===null?W.instance:this.Xo.iteratorValues}findAdornment(t){let e=this.Xo;return e===null?null:e.get(t)}addAdornment(t,e){if(e===null)return;let i=null,s=this.Xo;if(s!==null&&(i=s.get(t)),i!==e){if(i!==null){let o=i.diagram;o!==null&&o.remove(i)}s===null&&(s=new pt,this.Xo=s),e.zo!==t&&(e.category=t),s.set(t,e);let n=this.diagram;if(n!==null){n.add(e);let o=e.adornedObject;if(o!==null){let r=o.findBindingPanel();r!==null&&(e.data=r.data)}}}}removeAdornment(t){let e=this.Xo;if(e===null)return;let i=e.get(t);if(i!==null){let s=i.diagram;s!==null&&(s.remove(i),i.data=null)}e.delete(t),e.count===0&&(this.Xo=null)}clearAdornments(){let t=this.Xo;if(t===null)return;let e=f.et(),i=t.iterator;for(;i.next();){let n=i.key;e.push(n)}let s=e.length;for(let n=0;n<s;n++)this.removeAdornment(e[n]);f.J(e)}updateAdornments(){let t=this.diagram;if(t===null)return;this.tO(t),this.iO(t);let e=this.adornments;for(;e.next();){let i=e.value;i.c(),i.hasPlaceholder()&&i.placeholder?.c()}for(e=this.adornments;e.next();)e.value.updateTargetBindings()}invalidateAdornments(){let t=this.diagram;t!==null&&(t._l(),this.oT()!==!0&&this.rT(!0))}JS(){this.oT()!==!1&&(this.updateAdornments(),this.rT(!1))}tO(t){let e="Selection";if(this.isSelected&&this.selectionAdorned){let i=this.selectionObject;if(i!==null&&this.actualBounds.isReal()&&this.isVisible()&&i.isVisibleObject()&&i.actualBounds.isReal()){let s=this.findAdornment(e);if(s===null){let n=this.selectionAdornmentTemplate;n===null&&(this.Cl()?n=t.linkSelectionAdornmentTemplate:this instanceof ft?n=t.groupSelectionAdornmentTemplate:n=t.nodeSelectionAdornmentTemplate),s=n.copy(),s!==null&&(this.Cl()&&this.selectionObject===this.path&&(s.type=H.Link),s.adornedObject=i)}if(s!==null){s.type===H.Link&&s.c(),this.addAdornment(e,s);return}}}this.removeAdornment(e)}iO(t){let e=this;t.toolManager.mouseDownTools.each(i=>{i.isEnabled&&i.updateAdornments(e)}),t.toolManager.updateAdornments(e)}HS(t){this.Go=t,t===null&&this.QR()}get layer(){return this.Go}get diagram(){let t=this.Go;return t==null?null:t.diagram}get layerName(){return this.nl}set layerName(t){let e=this.nl;if(e===t)return;let i=this.diagram;if(i!==null&&(i.findLayer(t)===null||i.partManager.addsToTemporaryLayer))return;this.nl=t,i!==null&&i.invalidateDocumentBounds(),this.t("layerName",e,t);let s=this.layer;if(s===null||s.name===t||(i=s.diagram,i===null))return;let n=i.findLayer(t);if(n===null||n===s)return;let o=s.te(-1,this,!0);o>=0&&i.raiseChangedEvent(4,"parts",s,this,null,o,!0),o=n.Jh(99999999,this,!0),s.visible!==n.visible&&this.Ei(n.visible),o>=0&&i.raiseChangedEvent(3,"parts",n,null,this,!0,o);let r=this.layerChanged;if(r===null)return;let a=i.X;i.X=!0,r(this,s,n),i.X=a}get layerChanged(){return this.j!==null?this.j.Up:null}set layerChanged(t){let e=this.layerChanged;e!==t&&(t!==null&&f.k(t,Nt,"layerChanged"),this.Hi().Up=t,this.t("layerChanged",e,t))}get zOrder(){return this.kd}set zOrder(t){let e=this.kd;if(e===t)return;this.kd=t;let i=this.layer;i!==null&&i.kx(-1,this),this.t("zOrder",e,t);let s=this.diagram;s!==null&&s.S()}eO(){let t=this.layer;t!==null&&t.kx(-1,this)}g1(){if(this.ih()!==!1)return;this.tN(!0),this.$c();let t=this.diagram;t!==null&&(t._m(this),t.requestUpdate())}lT(){if(this.w|=2097152,this.ih()===!1)return;let t=this.position,e=this.location;(!e.isReal()||!t.isReal())&&this.hT(t,e);let i=this.Ni,s=z.l().a(i);i.Nt(),i.x=t.x,i.y=t.y,i.u(),this.Ju(s,i),z.e(s),this.tN(!1),this.$c()}Wn(t,e,i,s){let n=this.se;n.i(t,e,i,s),this.wi===null&&(this.wi=new Pt);let o=this.wi;o.Ri(),this.g0(o,t,e,i,s),this.wi=o,o.Gk()||o.vg(n)}g0(t,e,i,s,n){if(this.tt!==1&&t.tt(this.tt),this.Gt===0)return;let o=D.Center;this.locationSpot.isSpot()&&(o=this.locationSpot);let r=P.l();if(this.locationObject!==this){let a=this.locationObject,h=a.naturalBounds;r.setSpot(h.x,h.y,h.width,h.height,o),a.wi!==null&&a.wi.gt(r),r.offset(-a.measuredBounds.x,-a.measuredBounds.y);let l=a.panel;for(;l!==null&&l!==this;)l.wi!==null&&l.wi.gt(r),r.offset(-l.measuredBounds.x,-l.measuredBounds.y),l=l.panel}else r.setSpot(e,i,s,n,o);t.cs(this.Gt,r.x,r.y),P.e(r)}get locationObject(){if(this.Yo===null)if(this instanceof St&&this.type!==H.Link&&this.hasPlaceholder())this.Yo=this.placeholder;else{let t=this.locationObjectName;if(t!==""){let e=this.findObject(t);e!==null?this.Yo=e:this.Yo=this}else this.Yo=this}return this.Yo?.visible?this.Yo:this}get minLocation(){return this.j!==null?this.j.Bp:P.mC}set minLocation(t){let e=this.minLocation;e.equals(t)||(t=t.P(),this.Hi().Bp=t,this.t("minLocation",e,t))}get maxLocation(){return this.j!==null?this.j.Vp:P.pC}set maxLocation(t){let e=this.maxLocation;e.equals(t)||(t=t.P(),this.Hi().Vp=t,this.t("maxLocation",e,t))}get locationObjectName(){return this.j!==null?this.j.zp:""}set locationObjectName(t){let e=this.locationObjectName;e!==t&&(this.Hi().zp=t,this.Yo=null,this.c(),this.t("locationObjectName",e,t))}get locationSpot(){return this.j!==null?this.j.Xp:D.TopLeft}set locationSpot(t){let e=this.locationSpot;e.equals(t)||(t=t.P(),this.Hi().Xp=t,this.c(),this.t("locationSpot",e,t))}move(t,e){e===!0?this.location=t:this.position=t}moveTo(t,e,i){let s=P.V(t,e);this.move(s,i),P.e(s)}isVisible(){if(!this.visible)return!1;let t=this.layer;if(t!==null){if(!t.visible)return!1;let i=t.diagram;if(i!==null&&i.animationManager.lx(this))return!0}let e=this.containingGroup;return!(e!==null&&(!e.isSubGraphExpanded||!e.isVisible()))}Ei(t){let e=this.diagram;t?(this.invalidateLayout(4),this.invalidateAdornments(),e!==null&&e._m(this)):(this.invalidateLayout(8),this.clearAdornments()),this.dh(),e!==null&&(e.invalidateDocumentBounds(),e.S())}findObject(t){if(this.name===t)return this;let e=this.Ip;if(e===null&&(this.Ip=e=new pt),e.get(t)!==null)return e.get(t);let i=super.findObject(t);return i!==null?(e.set(t,i),i):(e.set(t,null),null)}L0(){this.Ip=null}getRelativePoint(t,e,i){i===void 0&&(i=new P);let s=e.isNoSpot()?D.Center:e,n=t.naturalBounds;if(i.i(n.width*s.x+s.offsetX,n.height*s.y+s.offsetY),t===null||t===this)return i;t.T.gt(i);let o=t.panel;for(;o!==null&&o!==this;)o.T.gt(i),o=o.panel;return this.wi!==null&&this.wi.gt(i),i.offset(-this.se.x,-this.se.y),i}getDocumentBounds(t){return t===void 0&&(t=new z),t.a(this.actualBounds)}ensureBounds(){this.ht(1/0,1/0),this.Bt()}EA(t){let e=this.locationSpot,i=this.locationObject,s=i.naturalBounds;s.isReal()||(s=z.Fg);let n=i instanceof ct?i.strokeWidth:0;if(t.setSpot(0,0,s.width+n,s.height+n,e),i!==this){t.offset(-n/2,-n/2),i.T.gt(t);let o=i.panel;for(;o!==null&&o!==this;)o.T.gt(t),o=o.panel}return this.wi!==null&&this.wi.gt(t),t.offset(-this.se.x,-this.se.y),t}Wh(t,e){let i=e===void 0?this.nT:e,s=this.sO(),n=s*2;if(!this.isShadowed)return i.i(t.x-1-s,t.y-1-s,t.width+2+n,t.height+2+n),i;let o=t.x,r=t.y,a=t.width,h=t.height,l=this.shadowBlur,c=this.shadowOffset;return a+=l,h+=l,o-=l/2,r-=l/2,c.x>0?a+=c.x:(o+=c.x,a-=c.x),c.y>0?h+=c.y:(r+=c.y,h-=c.y),i.i(o-1,r-1,a+2,h+2),i}Vv(){return this.type===H.Link&&this instanceof St&&this.category==="Selection"&&this.adornedObject instanceof ct&&this.adornedPart.findMainElement()===this.adornedObject?this.adornedObject.strokeWidth:0}sO(){return isNaN(this.Ep)&&(this.Ep=this.YA()),this.Ep}cf(){this.Ep=NaN}Bt(){if(this._e()===!1){this.lT();return}this.Jn(!1);let t=this.Ni,e=z.l();e.a(t);let i=this.Nl();this.uh(0,0,this.se.width,this.se.height);let s=this.position;this.hT(s,this.location),t.Nt(),t.x=s.x,t.y=s.y,t.u(),this.Ju(e,t),e.equals(t)?this.ps(i):this.ke()&&(!L.f(e.width,t.width)||!L.f(e.height,t.height))&&this.WS>=0&&this.invalidateLayout(16),z.e(e),this.tN(!1)}Ju(t,e){let i=this.diagram;if(i===null)return;let s=!1;if(i.ta===!1&&t.isReal()){let n=z.l();n.a(i.documentBounds),n.subtractMargin(i.padding),t.x>n.x&&t.y>n.y&&t.right<n.right&&t.bottom<n.bottom&&e.x>n.x&&e.y>n.y&&e.right<n.right&&e.bottom<n.bottom&&(s=!0),z.e(n)}(this.nO()===!0||!t.equals(e))&&this.jL(s,i),i.S(),!(!t.isReal()&&!e.isReal()||t.equalsApproxClose(e))&&(this instanceof rt&&!i.undoManager.isUndoingRedoing&&this.invalidateConnectedLinks(),this.dh())}get location(){return this.Ks}set location(t){let e=t.x,i=t.y,s=this.Ks;(s.x!==e&&(!isNaN(s.x)||!isNaN(e))||s.y!==i&&(!isNaN(s.y)||!isNaN(i)))&&(t=t.copy(),this.oO(t,s)&&this.t("location",s,t.copy()))}oO(t,e){if(this.Cl())return!1;if(this.Ks=t,this.w|=2097152,this._e()===!1){this.g1();let i=this.at;if(i.isReal()){let s=this.diagram;if(s===null||s.animationManager.isTicking||!s.undoManager.isUndoingRedoing){let n=i.copy();i.i(i.x+(t.x-e.x),i.y+(t.y-e.y)),this.aT(s,i,n.x,n.y),this.t("position",n,i.copy())}}}return!0}M2(t,e,i){if(this.Cl()||!t.isReal())return!1;let s=this.diagram;if(s!==null&&this.aT(s,t,e,i),this.at=t,this.w&=-2097153,this.Ks.isReal()&&(s===null||s.animationManager.isTicking||!s.undoManager.isUndoingRedoing)){let n=this.Ks;this.Ks=new P(n.x+(t.x-e),n.y+(t.y-i)),this.t("location",n,this.Ks.copy())}return this.ih()===!1&&this._e()===!1&&(this.g1(),this.lT()),!0}aT(t,e,i,s){if(t===null||this instanceof St)return;let n=t.animationManager;n.pi&&n.gL(this,new P(i,s),e,!1)}bc(t,e,i){let s=this.Ks,n=this.at;if(i){if(s.x===t&&s.y===e)return;this.ih()||this._e()?n.i(NaN,NaN):n.i(n.x+t-s.x,n.y+e-s.y),s.i(t,e)}else{if(n.x===t&&n.y===e)return;s.i(s.x+t-n.x,s.y+e-n.y),n.i(t,e)}this.g1()}N2(){this.w&=-2097153,this.g1()}hT(t,e){let i=this.EA(P.l()),s=this.diagram,n=e.isReal(),o=t.isReal();n&&o?this.w&2097152?this.cT(t,e,s,i):this.fT(t,e,s,i):n?this.cT(t,e,s,i):o&&this.fT(t,e,s,i),this.w|=2097152,P.e(i),this.$c()}cT(t,e,i,s){let n=t.x,o=t.y;if(t.i(e.x-s.x,e.y-s.y),i!==null){let r=i.animationManager,a=r.defaultAnimation.isAnimating;!a&&r.pi&&!(this instanceof St)&&r.gL(this,new P(n,o),t,!1),!a&&!(t.x===n&&t.y===o)&&this.t("position",new P(n,o),t.copy())}}fT(t,e,i,s){let n=e.copy();e.i(t.x+s.x,t.y+s.y),!e.equals(n)&&i!==null&&this.t("location",n,e.copy())}jL(t,e){this.w2(!1),this instanceof rt&&e.JM(this),!this.layer.isTemporary&&!t&&e.invalidateDocumentBounds();let i=this.Ni,s=e.viewportBounds;s.isReal()?this.Nl()?(i.intersectsRectPlus(s,10)||this.ps(!1),this.updateAdornments()):this.isVisible()&&i.intersectsRect(s)?(this.ps(!0),this.updateAdornments()):this.invalidateAdornments():e.Ic=!0}Gr(){return!0}ke(){return!0}Cl(){return!1}Xs(){return!0}hasPlaceholder(){return!1}get category(){return this.zo}set category(t){let e=this.zo;if(e===t)return;this.svg!==null&&(this.svg.remove(),this.Ve(!0));let i=this.diagram,s=this.data,n=null;if(i!==null&&s!==null&&!(this instanceof St)){let o=i.model.undoManager;o.isEnabled&&!o.isUndoingRedoing&&(n=this.clone(),n.C.addAll(this.C))}if(this.zo=t,this.t("category",e,t),i!==null&&s!==null&&!(this instanceof St)){let o=i.model;if(o.undoManager.isUndoingRedoing)return;if(this.Cl()){i.partManager.setLinkCategoryForData(s,t);let r=i.partManager.findLinkTemplateForCategory(t);if(r!==null){r.Et();let a=r.copy();a!==null&&this.iN(a,e,t)}}else{o!==null&&o.setCategoryForNodeData(s,t);let r=i.partManager.findTemplateForNodeData(s,t);if(r!==null){r.Et();let a=r.copy();if(a!==null&&!(a instanceof _)){let h=this.location.copy();this.iN(a,e,t),this.location.isReal()||(this.location=h)}}}if(n!==null){let r=this.clone();r.C.addAll(this.C),this.t("self",n,r)}}else if(this instanceof St){let o=this.adornedPart;if(o!==null){let r=o.Xo;r!==null&&r.delete(e),o.addAdornment(this.category,this)}}}get self(){return this}set self(t){this.iN(t,this.category,t.category)}static uT=!1;iN(t,e,i){t.constructor!==this.constructor&&(Nt.uT||(Nt.uT=!0,f.ni('Should not change the class of the Part when changing category from "'+e+'" to "'+i+'"'),f.ni(" Old class: "+f.Dn(this.constructor)+", new class: "+f.Dn(t.constructor)+", part: "+this.toString()))),this.clearAdornments();let s=this.data,n=this.layerName,o=this.isSelected,r=this.isHighlighted,a=!0,h=!0,l=!1;this instanceof rt&&(a=this.isTreeLeaf,h=this.isTreeExpanded,l=this.wasTreeExpanded),t.vo(this),t.cloneProtected(this),this.zo=i,this.svg!==null&&(this.svg.remove(),this.svg=null,this.Ve(!0)),this.c(),this.S();let c=this.diagram,u=!0;c!==null&&(u=c.skipsUndoManager,c.skipsUndoManager=!0),this._t=s,this.w=o?this.w|4096:this.w&-4097,this.w=r?this.w|524288:this.w&-524289,this instanceof rt&&(this.v=a?this.v|4:this.v&-5,this.v=h?this.v|1:this.v&-2,this.v=l?this.v|2:this.v&-3),s!==null&&this.updateTargetBindings();let d=this.layerName;d!==n&&(this.nl=n,this.layerName=d),c!==null&&(c.skipsUndoManager=u),this.ke()&&this.invalidateLayout(64)}canCopy(){if(!this.copyable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowCopy)return!1;let e=t.diagram;return e===null?!0:!!e.allowCopy}canDelete(){if(!this.deletable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowDelete)return!1;let e=t.diagram;return e===null?!0:!!e.allowDelete}canEdit(){if(!this.textEditable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowTextEdit)return!1;let e=t.diagram;return e===null?!0:!!e.allowTextEdit}canGroup(){if(!this.groupable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowGroup)return!1;let e=t.diagram;return e===null?!0:!!e.allowGroup}canMove(){if(!this.movable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowMove)return!1;let e=t.diagram;return e===null?!0:!!e.allowMove}canReshape(){if(!this.reshapable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowReshape)return!1;let e=t.diagram;return e===null?!0:!!e.allowReshape}canResize(){if(!this.resizable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowResize)return!1;let e=t.diagram;return e===null?!0:!!e.allowResize}canRotate(){if(!this.rotatable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRotate)return!1;let e=t.diagram;return e===null?!0:!!e.allowRotate}canSelect(){if(!this.selectable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowSelect)return!1;let e=t.diagram;return e===null?!0:!!e.allowSelect}get copyable(){return(this.w&1)!==0}set copyable(t){let e=(this.w&1)!==0;e!==t&&(this.w=this.w^1,this.t("copyable",e,t))}get deletable(){return(this.w&2)!==0}set deletable(t){let e=(this.w&2)!==0;e!==t&&(this.w=this.w^2,this.t("deletable",e,t))}get textEditable(){return(this.w&4)!==0}set textEditable(t){let e=(this.w&4)!==0;e!==t&&(this.w=this.w^4,this.t("textEditable",e,t),this.invalidateAdornments())}get groupable(){return(this.w&8)!==0}set groupable(t){let e=(this.w&8)!==0;e!==t&&(this.w=this.w^8,this.t("groupable",e,t))}get movable(){return(this.w&16)!==0}set movable(t){let e=(this.w&16)!==0;e!==t&&(this.w=this.w^16,this.t("movable",e,t))}get selectionAdorned(){return(this.w&32)!==0}set selectionAdorned(t){let e=(this.w&32)!==0;e!==t&&(this.w=this.w^32,this.t("selectionAdorned",e,t),this.invalidateAdornments())}get isInDocumentBounds(){return(this.w&64)!==0}set isInDocumentBounds(t){let e=(this.w&64)!==0;if(e!==t){this.w=this.w^64;let i=this.diagram;i!==null&&i.invalidateDocumentBounds(),this.t("isInDocumentBounds",e,t)}}get isLayoutPositioned(){return(this.w&128)!==0}set isLayoutPositioned(t){let e=(this.w&128)!==0;e!==t&&(this.w=this.w^128,this.t("isLayoutPositioned",e,t),this.invalidateLayout(t?4:8))}get selectable(){return(this.w&256)!==0}set selectable(t){let e=(this.w&256)!==0;e!==t&&(this.w=this.w^256,this.t("selectable",e,t),this.invalidateAdornments())}get reshapable(){return(this.w&512)!==0}set reshapable(t){let e=(this.w&512)!==0;e!==t&&(this.w=this.w^512,this.t("reshapable",e,t),this.invalidateAdornments())}get resizable(){return(this.w&1024)!==0}set resizable(t){let e=(this.w&1024)!==0;e!==t&&(this.w=this.w^1024,this.t("resizable",e,t),this.invalidateAdornments())}get rotatable(){return(this.w&2048)!==0}set rotatable(t){let e=(this.w&2048)!==0;e!==t&&(this.w=this.w^2048,this.t("rotatable",e,t),this.invalidateAdornments())}get isSelected(){return(this.w&4096)!==0}set isSelected(t){let e=(this.w&4096)!==0;if(e!==t){let i=this.diagram;if(t){if(!this.canSelect())return;if(i!==null){let o=i.maxSelectionCount;if(i.selection.count>=o)return}}this.w=this.w^4096;let s=!1;if(i!==null){s=i.skipsUndoManager,i.skipsUndoManager=!0;let o=i.selection;o.Nt(),t?o.add(this):o.delete(this),o.u()}this.t("isSelected",e,t),this.invalidateAdornments();let n=this.selectionChanged;n!==null&&n(this),i!==null&&(i.requestUpdate(),i.skipsUndoManager=s)}}get isHighlighted(){return(this.w&524288)!==0}set isHighlighted(t){let e=(this.w&524288)!==0;if(e!==t){this.w=this.w^524288;let i=this.diagram;if(i!==null){let n=i.highlighteds;n.Nt(),t?n.add(this):n.delete(this),n.u()}this.t("isHighlighted",e,t),this.S();let s=this.highlightedChanged;s!==null&&s(this)}}get isShadowed(){return(this.w&8192)!==0}set isShadowed(t){let e=(this.w&8192)!==0;e!==t&&(this.w=this.w^8192,this.Ve(!0),this.t("isShadowed",e,t),this.S())}oT(){return(this.w&16384)!==0}rT(t){t?this.w|=16384:this.w&=-16385}ih(){return(this.w&32768)!==0}tN(t){t?this.w|=32768:this.w&=-32769}nO(){return(this.w&65536)!==0}w2(t){t?this.w|=65536:this.w&=-65537}Nl(){return(this.w&131072)!==0}ps(t){t?this.w|=131072:this.w&=-131073}dT(){return(this.w&1048576)!==0}m1(t){t?this.w|=1048576:this.w&=-1048577}get isAnimated(){return(this.w&262144)!==0}set isAnimated(t){let e=(this.w&262144)!==0;e!==t&&(this.w=this.w^262144,this.t("isAnimated",e,t))}get highlightedChanged(){return this.j!==null?this.j.Gp:null}set highlightedChanged(t){let e=this.highlightedChanged;e!==t&&(t!==null&&f.k(t,Nt,"highlightedChanged"),this.Hi().Gp=t,this.t("highlightedChanged",e,t))}get selectionObjectName(){return this.j!==null?this.j.Yp:""}set selectionObjectName(t){let e=this.selectionObjectName;e!==t&&(this.Hi().Yp=t,this.ol=null,this.t("selectionObjectName",e,t))}get selectionAdornmentTemplate(){return this.j!==null?this.j.Kp:null}set selectionAdornmentTemplate(t){let e=this.selectionAdornmentTemplate;e!==t&&(t!==null&&t.Et(),this.Hi().Kp=t,this.t("selectionAdornmentTemplate",e,t))}get selectionObject(){if(this.ol===null){let t=this.selectionObjectName;if(t!==null&&t!==""){let e=this.findObject(t);e!==null?this.ol=e:this.ol=this}else if(this instanceof _){let e=this.path;e!==null?this.ol=e:this.ol=this}else this.ol=this}return this.ol}get selectionChanged(){return this.j!==null?this.j.jp:null}set selectionChanged(t){let e=this.selectionChanged;e!==t&&(t!==null&&f.k(t,Nt,"selectionChanged"),this.Hi().jp=t,this.t("selectionChanged",e,t))}get resizeAdornmentTemplate(){return this.j!==null?this.j.Hp:null}set resizeAdornmentTemplate(t){let e=this.resizeAdornmentTemplate;e!==t&&(this.Hi().Hp=t!==null?t.Et():null,this.t("resizeAdornmentTemplate",e,t))}get resizeObjectName(){return this.j!==null?this.j.qp:""}set resizeObjectName(t){let e=this.resizeObjectName;e!==t&&(this.Hi().qp=t,this.t("resizeObjectName",e,t))}get resizeObject(){let t=this.resizeObjectName;if(t!==""){let e=this.findObject(t);if(e!==null)return e}return this}get resizeCellSize(){return this.j!==null?this.j.Wp:Q.yw}set resizeCellSize(t){let e=this.resizeCellSize;e.equals(t)||(t=t.P(),this.Hi().Wp=t,this.t("resizeCellSize",e,t))}get rotateAdornmentTemplate(){return this.j!==null?this.j.Jp:null}set rotateAdornmentTemplate(t){let e=this.rotateAdornmentTemplate;e!==t&&(this.Hi().Jp=t!==null?t.Et():null,this.t("rotateAdornmentTemplate",e,t))}get rotateObjectName(){return this.j!==null?this.j.$p:""}set rotateObjectName(t){let e=this.rotateObjectName;e!==t&&(this.Hi().$p=t,this.t("rotateObjectName",e,t))}get rotateObject(){let t=this.rotateObjectName;if(t!==""){let e=this.findObject(t);if(e!==null)return e}return this}get rotationSpot(){return this.j!==null?this.j.Zp:D.Default}set rotationSpot(t){let e=this.rotationSpot;e.equals(t)||(t=t.P(),this.Hi().Zp=t,this.t("rotationSpot",e,t))}get text(){return this.ri}set text(t){let e=this.ri;e!==t&&(this.ri=t,this.t("text",e,t))}get containingGroup(){return this.xh}set containingGroup(t){if(this.ke()){let e=this.xh;if(e!==t){t!==null&&(this===t||t.isMemberOf(this))&&(this===t&&f.o("Cannot make a Group a member of itself: "+this.toString()),f.o("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+t.toString())),this.invalidateLayout(2);let i=this.diagram;if(e!==null?e.eN(this):this instanceof ft&&i!==null&&i.zr.delete(this),this.xh=t,t!==null?t.sN(this):this instanceof ft&&i!==null&&i.zr.add(this),this.invalidateLayout(1),i!==null&&i.X){let n=this.data,o=i.model;if(n!==null&&o.Hc()){let r=t!==null?t.data:null;o.setGroupForData(n,o.getKeyForNodeData(r))}}let s=this.containingGroupChanged;if(s!==null){let n=!0;i!==null&&(n=i.X,i.X=!0),s(this,e,t),i!==null&&(i.X=n)}if(this instanceof ft){let n=new I;Nt.oh(n,this,!0,0,!0);let o=n.iterator;for(;o.next();){let r=o.value;if(r instanceof rt){let a=r.linksConnected;for(;a.next();)a.value.Pd()}}}if(this instanceof rt){let n=this.linksConnected;for(;n.next();)n.value.Pd();let o=this.labeledLink;o!==null&&o.Pd()}this.t("containingGroup",e,t),t!==null&&t.eO()}}else f.o("cannot set the Part.containingGroup of a Link or Adornment")}dh(){let t=this.containingGroup;t!==null&&(t.hasPlaceholder()&&t.placeholder?.c(),t.c(),t.invalidateConnectedLinks())}S(){let t=this.diagram;t!==null&&!this._e()&&!this.ih()&&this.isVisible()&&this.Ni.isReal()&&t.S(this.Wh(this.Ni))}c(){if(this.To())return;super.c();let t=this.diagram;t!==null&&(t._m(this),this instanceof rt&&this.labeledLink!==null&&this.labeledLink.ef(),t.requestUpdate(!0))}ef(t){if(this._e())return;let e=this.diagram;e!==null&&(e._m(this),this instanceof rt&&this.invalidateConnectedLinks(),e.requestUpdate()),this.Jn(!0)}Rm(t){if(!t){let e=this.xh;e!==null&&e.sN(this)}}vm(t){if(!t){let e=this.xh;e!==null&&e.eN(this)}}Xc(){let t=this.data;if(t!==null){let e=this.diagram;if(e!==null){let i=e.model;i!==null&&i.removeNodeData(t)}}}get containingGroupChanged(){return this.j!==null?this.j.Qp:null}set containingGroupChanged(t){let e=this.containingGroupChanged;e!==t&&(t!==null&&f.k(t,Nt,"containingGroupChanged"),this.Hi().Qp=t,this.t("containingGroupChanged",e,t))}findSubGraphLevel(){return this.nN(this)}nN(t){let e=t.containingGroup;if(e!==null)return 1+this.nN(e);if(t instanceof rt){let i=t.labeledLink;if(i!==null)return this.nN(i)}return 0}findTopLevelPart(){return this.oN(this)}oN(t){let e=t.containingGroup;if(e!==null)return this.oN(e);if(t instanceof rt){let i=t.labeledLink;if(i!==null)return this.oN(i)}return t}get isTopLevel(){return!(this.containingGroup!==null||this instanceof rt&&this.labeledLink!==null)}isMemberOf(t){return t instanceof ft?this.rN(this,t):!1}rN(t,e){if(t===e||e===null)return!1;let i=t.containingGroup;if(i!==null&&(i===e||this.rN(i,e)))return!0;if(t instanceof rt){let s=t.labeledLink;if(s!==null)return this.rN(s,e)}return!1}findCommonContainingGroup(t){if(t===null)return null;if(this===t)return this.containingGroup;let e=this;for(;e!==null;){if(e instanceof ft&&e.m1(!0),e instanceof rt){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}let i=null;for(e=t;e!==null;){if(e.dT()){i=e;break}if(e instanceof rt){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}for(e=this;e!==null;){if(e instanceof ft&&e.m1(!1),e instanceof rt){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}return i}get layoutConditions(){return this.j!==null?this.j._p:127}set layoutConditions(t){let e=this.layoutConditions;e!==t&&(this.Hi()._p=t,this.t("layoutConditions",e,t))}canLayout(){if(!this.isLayoutPositioned||!this.isVisible())return!1;let t=this.layer;return!(t!==null&&t.isTemporary||this instanceof rt&&this.isLinkLabel)}rO(t){if(!this.isLayoutPositioned||!(t&this.layoutConditions))return!1;let e=this.layer;if(e!==null&&e.isTemporary||this instanceof rt&&this.isLinkLabel)return!1;let i=this.diagram;return!(i!==null&&i.undoManager.isUndoingRedoing)}invalidateLayout(t){if(t===void 0&&(t=16777215),!this.rO(t))return;let e=this.xh;if(e!==null){let i=e.layout;i!==null?i.invalidateLayout():e.invalidateLayout(t)}else{let i=this.diagram;if(i!==null){let s=i.layout;s!==null&&s.invalidateLayout()}}}HL(){if(!this.isVisible())return!1;let t=this.layer;return!(t!==null&&t.isTemporary)}static oh(t,e,i,s,n,o){if(o===void 0&&(o=null),!t.has(e)&&!(o!==null&&!o(e))&&!(e instanceof St)){if(t.add(e),e instanceof rt){if(i&&e instanceof ft){let r=e.memberParts;for(;r.next();){let a=r.value;Nt.oh(t,a,i,s,n,o)}}if(n!==!1){let r=e.linksConnected;for(;r.next();){let a=r.value;if(t.has(a))continue;let h=a.fromNode,l=a.toNode,c=h===null||t.has(h),u=l===null||t.has(l);(n?c&&u:c||u)&&Nt.oh(t,a,i,s,n,o)}}if(s>1){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;Nt.oh(t,a,i,s-1,n,o)}}}else if(e instanceof _){let r=e.labelNodes;for(;r.next();){let a=r.value;Nt.oh(t,a,i,s,n,o)}}}}get dragComputation(){return this.j!==null?this.j.ty:null}set dragComputation(t){let e=this.dragComputation;e!==t&&(t!==null&&f.k(t,Nt,"dragComputation"),this.Hi().ty=t,this.t("dragComputation",e,t))}get shadowOffset(){return this.j!==null?this.j.iy:P.yC}set shadowOffset(t){let e=this.shadowOffset;e.equals(t)||(t=t.P(),this.Hi().iy=t,this.S(),this.t("shadowOffset",e,t))}get shadowColor(){return this.j!==null?this.j.ey:"gray"}set shadowColor(t){let e=this.shadowColor;e!==t&&(this.Hi().ey=t,this.S(),this.t("shadowColor",e,t))}get shadowBlur(){return this.j!==null?this.j.un:4}set shadowBlur(t){let e=this.shadowBlur;e!==t&&(this.Hi().un=t,this.S(),this.t("shadowBlur",e,t))}}class Cs{fi;Up;Qp;Kp;Yp;jp;Gp;Hp;qp;Wp;Jp;$p;Zp;zp;Xp;Bp;Vp;ty;_p;iy;ey;un;constructor(){this.fi=!1,this.Up=null,this.Qp=null,this.Kp=null,this.Yp="",this.jp=null,this.Gp=null,this.Hp=null,this.qp="",this.Wp=Q.yw,this.Jp=null,this.$p="",this.Zp=D.Default,this.zp="",this.Xp=D.TopLeft,this.Bp=P.mC,this.Vp=P.pC,this.ty=null,this._p=127,this.iy=P.yC,this.ey="gray",this.un=4}copy(){let t=new Cs;return t.Up=this.Up,t.Qp=this.Qp,t.Kp=this.Kp,t.Yp=this.Yp,t.jp=this.jp,t.Gp=this.Gp,t.Hp=this.Hp,t.qp=this.qp,t.Wp=this.Wp.P(),t.Jp=this.Jp,t.$p=this.$p,t.Zp=this.Zp.P(),t.zp=this.zp,t.Xp=this.Xp.P(),t.Bp=this.Bp.P(),t.Vp=this.Vp.P(),t.ty=this.ty,t._p=this._p,t.iy=this.iy.P(),t.ey=this.ey,t.un=this.un,t}}class St extends Nt{us;Ft;nS;oS;hf;constructor(t,e){let i;t===void 0||t instanceof Ft||typeof t=="string"?i=t:t&&(e=t),super(i),this.w&=-257,this.nl="Adornment",this.us=null,this.nS=0,this.oS=!1,this.Ft=null,this.hf=null,e&&Object.assign(this,e)}toString(){let t=this.adornedPart;return"Adornment("+this.category+")"+(t!==null?t.toString():"")}updateRelationshipsFromData(){}sd(t){let e=this.adornedObject;if(!(e instanceof ct))return;let i=e.part;if(!(i instanceof _))return;let s=i.path,n=s.geometry;i.sd(t),n=s.geometry;let o=this.C.r,r=o.length;for(let a=0;a<r;a++){let h=o[a];h.isPanelMain&&h instanceof ct&&(h.ot=n)}}hasPlaceholder(){return this.Ft!==null&&this.Ft.isVisibleObject()}get placeholder(){return this.Ft}get adornedObject(){return this.us}set adornedObject(t){let e=this.adornedPart,i=null;t!==null&&(i=t.part),e!==null&&(t===null||e!==i)&&e.removeAdornment(this.category),this.us=t,i!==null&&i.addAdornment(this.category,this)}get adornedPart(){let t=this.us;return t!==null?t.part:null}Gr(){let t=this.us;if(t===null)return!0;let e=t.part;return e===null||!e._e()}ke(){return!1}get containingGroup(){return null}qc(t,e,i,s,n,o,r){if(t===3&&e==="elements"){if(n instanceof ve)this.Ft===null&&(this.Ft=n);else if(n instanceof H){let a=n.findInVisualTree(h=>h instanceof ve);a instanceof ve&&this.Ft===null&&(this.Ft=a)}}else t===4&&e==="elements"&&this.Ft!==null&&(s===this.Ft?this.Ft=null:s instanceof H&&this.Ft.isContainedBy(s)&&(this.Ft=null));super.qc(t,e,i,s,n,o,r)}updateAdornments(){}Xc(){}}var Rn=(x=>(x[x.None=0]="None",x[x.Evenly=1]="Evenly",x[x.Packed=2]="Packed",x))(Rn||{});class rt extends Nt{v;Rt;kf;rl;bh;ne;ti;constructor(t,e){let i;t===void 0||t instanceof Ft||typeof t=="string"?i=t:t&&(e=t),super(i),this.v=13,this.Rt=null,this.ti=new G,this.kf=null,this.rl=null,this.ne=null,this.bh=!1,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.v=this.v,this.Rt!==null&&(this.Rt.fi?t.Rt=this.Rt:t.Rt=this.Rt.copy())}vo(t){super.vo(t),t.invalidateConnectedLinks(),t.rl=this.rl,t.ne=null}static SpreadingNone=0;static SpreadingEvenly=1;static SpreadingPacked=2;ll(){return this.Rt===null?this.Rt=new As:this.Rt.fi&&(this.Rt=this.Rt.copy()),this.Rt}ch(){super.ch(),this.Rt!==null&&(this.Rt.fi=!0)}gT(t){t!==null&&(this.rl===null&&(this.rl=new I),this.rl.add(t))}mT(t){t!==null&&this.rl!==null&&this.rl.delete(t)}pT(t,e,i){if(t===null||this.rl===null)return null;let s=this.rl.iterator;for(;s.next();){let n=s.value;if(n.ny===this&&n.p1===t&&n.lN===e&&n.hN===i||n.ny===t&&n.p1===this&&n.lN===i&&n.hN===e)return n}return null}invalidateLinkBundle(t,e,i){e==null&&(e=""),i==null&&(i="");let s=this.pT(t,e,i);s!==null&&s.Sd()}qc(t,e,i,s,n,o,r){t===3&&e==="elements"?this.ne=null:t===4&&e==="elements"&&(this.ne=null),super.qc(t,e,i,s,n,o,r)}invalidateConnectedLinks(t){let e=this.linksConnected;for(;e.next();){let i=e.value;t!==void 0&&t.has(i)||(this.qi(i.fromPort),this.qi(i.toPort),i.invalidateRoute())}}kA(t){let e=this.linksConnected;for(;e.next();){let i=e.value;i.fromPort!==t&&i.toPort!==t||(this.qi(i.fromPort),this.qi(i.toPort),i.invalidateRoute())}}qi(t){if(t===null)return;let e=t.Ku;e!==null&&e.Sd();let i=t.part,s=i.containingGroup;s!==null&&!i.isVisible()&&s.qi(s.port)}Gr(){return!0}get portSpreading(){return this.Rt!==null?this.Rt.ly:1}set portSpreading(t){let e=this.portSpreading;if(e!==t){this.ll().ly=t,this.t("portSpreading",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.invalidateConnectedLinks()}}get avoidable(){return(this.v&8)!==0}set avoidable(t){let e=(this.v&8)!==0;if(e!==t){this.v=this.v^8;let i=this.diagram;i!==null&&i.JM(this),this.t("avoidable",e,t)}}get avoidableMargin(){return this.Rt!==null?this.Rt.hy:Lt.SC}set avoidableMargin(t){typeof t=="number"&&(t=new Lt(t));let e=this.avoidableMargin;if(!e.equals(t)){t=t.P(),this.ll().hy=t;let i=this.diagram;i!==null&&i.JM(this),this.t("avoidableMargin",e,t)}}canAvoid(){return this.avoidable&&!this.isLinkLabel}getAvoidableRect(t){return t.set(this.actualBounds),t.addMargin(this.avoidableMargin),t}findVisibleNode(){let t=this;for(;t!==null&&!t.isVisible();)t=t.containingGroup;return t}isVisible(){if(!super.isVisible())return!1;let t=!0,e=1,i=this.diagram;if(i!==null){if(i.animationManager.lx(this))return!0;t=i.isTreePathToChildren,e=i.treeCollapsePolicy}if(e===1){let n=this.findTreeParentNode();if(n!==null&&!n.isTreeExpanded)return!1}else if(e===2){let n=t?this.findLinksInto():this.findLinksOutOf(),o=!1,r=!1;for(;n.next();){let a=n.value;if(a.isTreeLink){o=!0;let h=t?a.fromNode:a.toNode;if(h&&h.isTreeExpanded){r=!0;break}}}if(o&&!r)return!1}else if(e===3){let n=t?this.findLinksInto():this.findLinksOutOf(),o=!1,r=!1;for(;n.next();){let a=n.value;if(a.isTreeLink){o=!0;let h=t?a.fromNode:a.toNode;if(h&&!h.isTreeExpanded){r=!0;break}}}if(o&&r)return!1}let s=this.labeledLink;return s!==null?s.isVisible():!0}Ei(t){super.Ei(t);let e=this.linksConnected;for(;e.next();){let i=e.value;if(t&&this.containingGroup!==null){let s=i.getOtherNode(this);s!==null&&!s.isMemberOf(this.containingGroup)&&i.invalidateRoute()}i.Ei(t)}}get linksConnected(){return this.ti.iterator}findExternalTreeLinksConnected(){let t=new I,e=new I;return this.yT(this,t,e),e.iterator}yT(t,e,i){if(t===null||e.has(t))return;e.add(t);let s=!0,n=this.diagram;n!==null&&(s=n.isTreePathToChildren),t.linksConnected.each(o=>{o.isTreeLink?(s?o.fromNode===t:o.toNode===t)&&this.yT(s?o.toNode:o.fromNode,e,i):i.add(o)})}findLinksConnected(t){if(t===void 0&&(t=null),t===null)return this.ti.iterator;let e=new it(this.ti),i=this;return e.predicate=s=>s.fromNode===i&&s.fromPortId===t||s.toNode===i&&s.toPortId===t,e}findLinksOutOf(t){t===void 0&&(t=null);let e=new it(this.ti),i=this;return e.predicate=s=>s.fromNode!==i?!1:t===null?!0:s.fromPortId===t,e}findLinksInto(t){t===void 0&&(t=null);let e=new it(this.ti),i=this;return e.predicate=s=>s.toNode!==i?!1:t===null?!0:s.toPortId===t,e}findNodesConnected(t){t===void 0&&(t=null);let e=null,i=null,s=this.ti.iterator;for(;s.next();){let n=s.value;if(n.fromNode===this){if(t===null||n.fromPortId===t){let o=n.toNode;e!==null?e.add(o):i!==null&&i!==o?(e=new I,e.add(i),e.add(o)):i=o}}else if(n.toNode===this&&(t===null||n.toPortId===t)){let o=n.fromNode;e!==null?e.add(o):i!==null&&i!==o?(e=new I,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new $(i):W.instance}findNodesOutOf(t){t===void 0&&(t=null);let e=null,i=null,s=this.ti.iterator;for(;s.next();){let n=s.value;if(n.fromNode===this&&(t===null||n.fromPortId===t)){let o=n.toNode;e!==null?e.add(o):i!==null&&i!==o?(e=new I,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new $(i):W.instance}findNodesInto(t){t===void 0&&(t=null);let e=null,i=null,s=this.ti.iterator;for(;s.next();){let n=s.value;if(n.toNode===this&&(t===null||n.toPortId===t)){let o=n.fromNode;e!==null?e.add(o):i!==null&&i!==o?(e=new I,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new $(i):W.instance}findLinksBetween(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);let s=new it(this.ti),n=this;return s.predicate=o=>o.fromNode===n&&o.toNode===t&&(e===null||o.fromPortId===e)&&(i===null||o.toPortId===i)||o.fromNode===t&&o.toNode===n&&(i===null||o.fromPortId===i)&&(e===null||o.toPortId===e),s}findLinksTo(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);let s=new it(this.ti),n=this;return s.predicate=o=>!(o.fromNode!==n||o.toNode!==t||e!==null&&o.fromPortId!==e||i!==null&&o.toPortId!==i),s}get linkConnected(){return this.Rt!==null?this.Rt.ay:null}set linkConnected(t){let e=this.linkConnected;e!==t&&(t!==null&&f.k(t,rt,"linkConnected"),this.ll().ay=t,this.t("linkConnected",e,t))}get linkDisconnected(){return this.Rt!==null?this.Rt.cy:null}set linkDisconnected(t){let e=this.linkDisconnected;e!==t&&(t!==null&&f.k(t,rt,"linkDisconnected"),this.ll().cy=t,this.t("linkDisconnected",e,t))}get linkValidation(){return this.Rt!==null?this.Rt.Ml:null}set linkValidation(t){let e=this.linkValidation;e!==t&&(t!==null&&f.k(t,rt,"linkValidation"),this.ll().Ml=t,this.t("linkValidation",e,t))}w1(t,e){this.qi(e);let i=this.ti.has(t);if(i||this.ti.add(t),!i||t.fromNode===t.toNode){let s=this.linkConnected;if(s!==null){let n=!0,o=this.diagram;o!==null&&(n=o.X,o.X=!0),s(this,t,e),o!==null&&(o.X=n)}}if(!i){if(!t.isTreeLink)return;let s=t.fromNode,n=t.toNode;if(s!==null&&n!==null&&s!==n){let o=!0,r=this.diagram;r!==null&&(o=r.isTreePathToChildren);let a=o?n:s,h=o?s:n;if(a.bh||(a.bh=h),h.isTreeLeaf){if(r!==null&&r.undoManager.isUndoingRedoing)return;o?s===h&&(h.isTreeLeaf=!1):n===h&&(h.isTreeLeaf=!1)}}}}b1(t,e){this.qi(e);let i=this.ti.delete(t),s=null;if(i||t.toNode===t.fromNode){let n=this.linkDisconnected;if(s=this.diagram,n!==null){let o=!0;s!==null&&(o=s.X,s.X=!0),n(this,t,e),s!==null&&(s.X=o)}}if(i){if(!t.isTreeLink)return;let n=!0;s!==null&&(n=s.isTreePathToChildren);let o=n?t.toNode:t.fromNode,r=n?t.fromNode:t.toNode;if(o!==null&&(o.bh=!1),r!==null&&!r.isTreeLeaf)if(r.ti.count===0){if(r.bh=null,s!==null&&s.undoManager.isUndoingRedoing)return;r.isTreeLeaf=!0}else r.r0()}}r0(){if(this.bh=!1,this.ti.count===0)return;let t=!0,e=this.diagram;if(e!==null&&e.undoManager.isUndoingRedoing)return;e!==null&&(t=e.isTreePathToChildren);let i=this.ti.iterator;for(;i.next();){let s=i.value;if(s.isTreeLink){if(t){if(s.fromNode===this){this.isTreeLeaf=!1;return}}else if(s.toNode===this){this.isTreeLeaf=!1;return}}}this.isTreeLeaf=!0}updateRelationshipsFromData(){let t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)}Rm(t){if(super.Rm(t),!t){this.r0();let e=this.kf;e!==null&&e.wT(this)}}vm(t){if(super.vm(t),!t){let e=this.kf;e!==null&&e.xT(this)}}Xc(){if(this.ti.count>0){let t=this.diagram;if(t!==null){let e=t.commandHandler!==null?t.commandHandler.deletesConnectedLinks:!0,i=this.ti.copy().iterator;for(;i.next();){let s=i.value;e?t.remove(s):(s.fromNode===this&&(s.fromNode=null),s.toNode===this&&(s.toNode=null))}}}this.labeledLink=null,super.Xc()}get isLinkLabel(){return this.kf!==null}get labeledLink(){return this.kf}set labeledLink(t){let e=this.kf;if(e!==t){let i=this.diagram,s=this.data;if(e!==null){if(e.xT(this),i!==null&&s!==null&&!i.undoManager.isUndoingRedoing){let n=e.data,o=i.model;if(n!==null&&o.Ra()){let r=o.getKeyForNodeData(s);r!==void 0&&o.removeLabelKeyForLinkData(n,r)}}this.containingGroup=null}if(this.kf=t,t!==null){if(t.wT(this),i!==null&&s!==null&&!i.undoManager.isUndoingRedoing){let n=t.data,o=i.model;if(n!==null&&o.Ra()){let r=o.getKeyForNodeData(s);r!==void 0&&o.addLabelKeyForLinkData(n,r)}}this.containingGroup=t.containingGroup}this.ef(),this.t("labeledLink",e,t)}}findVisiblePort(t){let e=t;for(;e!==null&&(!e.actualBounds.isReal()||!e.isVisibleObject());)e=e.panel;return e===null?this.port:e}findPort(t){if(this.ne===null){if(t===""&&this.fn===!1)return this;this.bT()}let e=this.ne.get(t);return e!==null||t!==""&&(e=this.ne.get(""),e!==null)?e:this}get port(){return this.findPort("")}get ports(){return this.ne===null&&this.bT(),this.ne.iteratorValues}bT(){this.ne===null?this.ne=new pt:this.ne.clear(),this.walkVisualTreeFrom(this,(t,e)=>t.AA(e)),this.ne.count===0&&this.ne.set("",this)}AA(t){let e=t.portId;e!==null&&this.ne!==null&&this.ne.set(e,t)}C2(t,e){let i=t.portId;if(i!==null){this.ne!==null&&this.ne.delete(i);let s=this.diagram;if(s!==null&&e){let n=null,o=this.findLinksConnected(i);for(;o.next();){let r=o.value;n===null&&(n=f.et()),n.push(r)}if(n!==null){for(let r=0;r<n.length;r++){let a=n[r];s.remove(a)}f.J(n)}}}}isInTreeOf(t){if(t===null||t===this)return!1;let e=!0,i=this.diagram;i!==null&&(e=i.isTreePathToChildren);let s=this,n=t,o;if(e)for(;s!==n;){o=null;let r=s.ti.iterator;for(;r.next();){let a=r.value;if(a.isTreeLink&&(o=a.fromNode,o!==s&&o!==this))break}if(o===this||o===null||o===s)return!1;s=o}else for(;s!==n;){o=null;let r=s.ti.iterator;for(;r.next();){let a=r.value;if(a.isTreeLink&&(o=a.toNode,o!==s&&o!==this))break}if(o===this||o===null||o===s)return!1;s=o}return!0}findTreeRoot(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=this,s;if(t)for(;;){s=null;let n=i.ti.iterator;for(;n.next();){let o=n.value;if(o.isTreeLink&&(s=o.fromNode,s!==i&&s!==this))break}if(s===this)return this;if(s===null||s===i)return i;i=s}else for(;;){s=null;let n=i.ti.iterator;for(;n.next();){let o=n.value;if(o.isTreeLink&&(s=o.toNode,s!==i&&s!==this))break}if(s===this)return this;if(s===null||s===i)return i;i=s}}findCommonTreeParent(t){if(t===null)return null;if(this===t)return this;let e=this;for(;e!==null;)e.m1(!0),e=e.findTreeParentNode();let i=null;for(e=t;e!==null;){if(e.dT()){i=e;break}e=e.findTreeParentNode()}for(e=this;e!==null;)e.m1(!1),e=e.findTreeParentNode();return i}findTreeParentLink(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=this.ti.iterator;if(t)for(;i.next();){let s=i.value;if(s.isTreeLink&&s.fromNode!==this)return s}else for(;i.next();){let s=i.value;if(s.isTreeLink&&s.toNode!==this)return s}return null}findTreeParentNode(){let t=this.bh;if(t===null)return null;if(t instanceof rt)return t;let e=this.diagram,i=e!==null?e.isTreePathToChildren:!0,s=this.ti.iterator;for(;s.next();){let n=s.value;if(!n.isTreeLink)continue;let o=i?n.fromNode:n.toNode;if(o!==this)return this.bh=o,o}return this.bh=null,null}findTreeParentChain(){function t(i,s){s.add(i);let n=i.findTreeParentLink();if(n!==null){s.add(n);let o=i.findTreeParentNode();if(o===null)return;t(o,s)}}let e=new I;return t(this,e),e}findTreeLevel(){return this.lO(this)}lO(t){let e=0,i=t.findTreeParentNode();for(;i!==null&&i!==t;)i=i.findTreeParentNode(),e++;return e}findTreeChildrenLinks(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=new it(this.ti),s=this;return t?i.predicate=n=>!(!n.isTreeLink||n.fromNode!==s):i.predicate=n=>!(!n.isTreeLink||n.toNode!==s),i}findTreeChildrenNodes(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=null,s=null,n=this.ti.iterator;if(t)for(;n.next();){let o=n.value;if(o.isTreeLink&&o.fromNode===this){let r=o.toNode;i!==null?i.add(r):s!==null&&s!==r?(i=new G,i.add(s),i.add(r)):s=r}}else for(;n.next();){let o=n.value;if(o.isTreeLink&&o.toNode===this){let r=o.fromNode;i!==null?i.add(r):s!==null&&s!==r?(i=new G,i.add(s),i.add(r)):s=r}}return i!==null?i.iterator:s!==null?new $(s):W.instance}findTreeParts(t){t===void 0&&(t=1/0),f.s(t,"number",rt,"findTreeParts:level");let e=new I;return Nt.oh(e,this,!1,t,!0),e}collapseTree(t){t===void 0&&(t=1),t<1&&(t=1);let e=this.diagram;if(e===null||e.isCollapsingExpanding)return;e.isCollapsingExpanding=!0;let i=new I;i.add(this),this.kT(i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===1),e.isCollapsingExpanding=!1}kT(t,e,i,s,n,o){if(i>1){let r=e?this.findLinksOutOf():this.findLinksInto();for(;r.next();){let a=r.value;if(!a.isTreeLink)continue;let h=a.getOtherNode(this);h!==null&&h!==this&&!t.has(h)&&(t.add(h),h.kT(t,e,i-1,s,n,o))}}else this.PT(t,e,s,n,o)}PT(t,e,i,s,n){let o=s===this?!0:this.isTreeExpanded,r=e?this.findLinksOutOf():this.findLinksInto();for(;r.next();){let a=r.value;if(!a.isTreeLink)continue;let h=a.getOtherNode(this);if(h!==null&&h!==this){let l=t.has(h);if(l||t.add(h),o){let c=e?h.findNodesInto():h.findNodesOutOf(),u=this;c.all(d=>d===u||!d.isTreeExpanded)&&i.Lc(h,s),h.dh(),h.Ei(!1)}h.isTreeExpanded&&(h.wasTreeExpanded=h.isTreeExpanded,l||h.PT(t,e,i,s,n))}}this.isTreeExpanded=!1}expandTree(t){t===void 0&&(t=2),t<2&&(t=2);let e=this.diagram;if(e===null||e.isCollapsingExpanding)return;e.isCollapsingExpanding=!0;let i=new I;i.add(this),this.ST(i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===1),e.isCollapsingExpanding=!1}ST(t,e,i,s,n,o){let r=n===this?!1:this.isTreeExpanded,a=e?this.findLinksOutOf():this.findLinksInto();for(;a.next();){let h=a.value;if(!h.isTreeLink)continue;r||h.Se||h.invalidateRoute();let l=h.getOtherNode(this);if(l!==null&&l!==this&&!t.has(l)){if(t.add(l),!r){l.Ei(!0),l.dh();let c=e?l.findNodesInto():l.findNodesOutOf(),u=this;c.all(d=>d===u||!d.isTreeExpanded)&&s.Cc(l,n)}(i>2||l.wasTreeExpanded)&&(l.wasTreeExpanded=!1,l.ST(t,e,i-1,s,n,o))}}this.isTreeExpanded=!0}get isTreeExpanded(){return(this.v&1)!==0}set isTreeExpanded(t){let e=(this.v&1)!==0;if(e!==t){this.v=this.v^1;let i=this.diagram;this.t("isTreeExpanded",e,t);let s=this.treeExpandedChanged;if(s!==null){let n=!0;i!==null&&(n=i.X,i.X=!0),s(this),i!==null&&(i.X=n)}if(i!==null&&i.undoManager.isUndoingRedoing){this.Ei(t);return}t?this.expandTree():this.collapseTree()}}get wasTreeExpanded(){return(this.v&2)!==0}set wasTreeExpanded(t){let e=(this.v&2)!==0;e!==t&&(this.v=this.v^2,this.t("wasTreeExpanded",e,t))}get treeExpandedChanged(){return this.Rt!==null?this.Rt.fy:null}set treeExpandedChanged(t){let e=this.treeExpandedChanged;e!==t&&(t!==null&&f.k(t,rt,"treeExpandedChanged"),this.ll().fy=t,this.t("treeExpandedChanged",e,t))}get isTreeLeaf(){return(this.v&4)!==0}set isTreeLeaf(t){let e=(this.v&4)!==0;e!==t&&(this.v=this.v^4,this.t("isTreeLeaf",e,t))}get isTreeRoot(){return this.findTreeParentLink()===null}}class As{fi;ay;cy;Ml;fy;hy;ly;uy;gy;nh;my;constructor(){this.fi=!1,this.ay=null,this.cy=null,this.Ml=null,this.fy=null,this.hy=Lt.SC,this.ly=1,this.uy=null,this.gy=null,this.nh=null,this.my=null}copy(){let t=new As;return t.ay=this.ay,t.cy=this.cy,t.Ml=this.Ml,t.fy=this.fy,t.hy=this.hy.P(),t.ly=this.ly,t.uy=this.uy,t.gy=this.gy,t.nh=this.nh,t.my=this.my,t}}var Ls=(x=>(x[x.None=0]="None",x[x.End=17]="End",x[x.Scale=18]="Scale",x[x.Stretch=19]="Stretch",x))(Ls||{}),Ts=(x=>(x[x.Normal=1]="Normal",x[x.Orthogonal=2]="Orthogonal",x[x.AvoidsNodes=6]="AvoidsNodes",x[x.AvoidsNodesStraight=7]="AvoidsNodesStraight",x))(Ts||{}),Ds=(x=>(x[x.None=0]="None",x[x.Bezier=9]="Bezier",x[x.JumpGap=10]="JumpGap",x[x.JumpOver=11]="JumpOver",x))(Ds||{});class _ extends Nt{Mt;so;no;Md;oo;ro;Nd;Pf;Cd;Ld;Ad;va;Td;js;xi;hl;br;Sf;Ko;aN;cN;k1;fN;uN;Oa;P1;ot;jo;static Ia=null;static Ea=null;hf;dN;gN;constructor(t){super(H.Link),this.Mt=8,this.so=null,this.no="",this.Md=null,this.oo=null,this.ro="",this.Nd=null,this.Pf=0,this.Cd=0,this.Ld=0,this.Ad=NaN,this.va=1,this.Td=.5,this.js=null,this.xi=new G().u(),this.hl=null,this.br=null,this.Sf=new z,this.ot=new kt,this.Ko=null,this.jo=null,this.aN=null,this.cN=null,this.dN=0,this.gN=0,this.k1=new P,this.fN=null,this.uN=null,this.Oa=null,this.P1=NaN,this.ct=null,this.hf=[],t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Mt=this.Mt&-113,t.no=this.no,t.Md=this.Md,t.ro=this.ro,t.Nd=this.Nd,t.Pf=this.Pf,t.Cd=this.Cd,t.Ld=this.Ld,t.Ad=this.Ad,t.va=this.va,t.Td=this.Td,this.ct!==null&&(t.ct=this.ct.copy())}vo(t){super.vo(t),this.no=t.no,this.ro=t.ro,t.hl=null,t.invalidateRoute(),t.jo=this.jo;let e=t.fromPort;e!==null&&t.fromNode.qi(e);let i=t.toPort;i!==null&&t.toNode.qi(i)}oi(t){t in Ts||t in Ds||t in Ls?_.mN(t)?this.routing=t:t===9||t===10||t===11?this.curve=t:t===17||t===18||t===19?this.adjusting=t:t===1||t===0||f.o("Unknown Link enum value for a Link property: "+t):super.oi(t)}static Normal=1;static Orthogonal=2;static AvoidsNodes=6;static AvoidsNodesStraight=7;static None=0;static Bezier=9;static JumpGap=10;static JumpOver=11;static End=17;static Scale=18;static Stretch=19;static OrientAlong=21;static OrientPlus90=22;static OrientMinus90=23;static OrientOpposite=24;static OrientUpright=25;static OrientPlus90Upright=26;static OrientMinus90Upright=27;static OrientUpright45=28;static hO=8;static aO=16;static cO=14;static Ua=8;Be(){return this.ct===null&&(this.ct=new is),this.ct}bv(t,e,i){let s=t.segmentIndex,n=t.segmentFraction,o=t.alignmentFocus,r=t.segmentOrientation,a=t.segmentOffset,h=0,l=0,c=0,u=0;if(isNaN(s)){let T=this.ot,N=f.et();T.getPointAndAngleAlongPath(n,N);let C=P.V(N[0],N[1]);if(C.add(this.getPoint(0)),T.type===1)C.offset(-T.startX,-T.startY);else{let R=T.figures.first();C.offset(-R.startX,-R.startY)}u=N[2],r!==0&&(c=this.computeAngle(t,r,u),t.angle=c),h=C.x,l=C.y,P.e(C),f.J(N)}else if(s<-e||s>=e){let T=P.l();this.IA(T),u=this.midAngle,r!==0&&(c=this.computeAngle(t,r,u),t.angle=c),h=T.x,l=T.y,P.e(T)}else{let T,N,C=0;if(s>=0?(T=i.r[s],N=s<e-1?i.r[s+1]:T):(C=e+s,T=i.r[C],N=C>0?i.r[C-1]:T),T.equalsApprox(N)){let R,O;s>=0?(R=s>0?i.r[s-1]:T,O=s<e-2?i.r[s+2]:N):(R=C<e-1?i.r[C+1]:T,O=C>1?i.r[C-2]:N);let B=R.distanceSquaredPoint(T),X=N.distanceSquaredPoint(O);B>X+10?u=s>=0?R.directionPoint(T):T.directionPoint(R):X>B+10?u=s>=0?N.directionPoint(O):O.directionPoint(N):u=s>=0?R.directionPoint(O):O.directionPoint(R)}else u=s>=0?T.directionPoint(N):N.directionPoint(T);r!==0&&(c=this.computeAngle(t,r,u),t.angle=c),h=T.x+(N.x-T.x)*n,l=T.y+(N.y-T.y)*n}if(o.isNone()){t.location=new P(h,l);return}else o.isNoSpot()&&(o=D.Center);let d=Pt.l();d.Ri(),d.tt(t.scale,t.scale),d.cs(t.angle,0,0);let g=t.naturalBounds,p=z.V(0,0,g.width,g.height),m=P.l();m.setRectSpot(p,o),d.gt(m);let y=-m.x,w=-m.y,b=g.width,v=g.height,k=P.l();k.a(a);let S=isNaN(a.x),M=isNaN(a.y);if(S||M){let T=b/2+3,N=v/2+3,C=u>=45&&u<=135,R=u>=225&&u<=315;r===0&&(C||R)?(k.x=M?T:a.y,k.y=S?N:a.x,C?s>=0||isNaN(s)&&n<.5||S&&(k.y=-N):R&&((s>=0||isNaN(s)&&n<.5)&&S&&(k.y=-N),M&&(k.x=-T))):(S&&(s>=0||isNaN(s)&&n<.5?k.x=T:k.x=-T),M&&(k.y=-N),k.rotate(u))}else k.rotate(u);h+=k.x,l+=k.y,d.vg(p),y+=p.x,w+=p.y;let F=P.V(h+y,l+w);t.move(F),P.e(F),P.e(k),P.e(m),z.e(p),Pt.e(d)}Gr(){let t=this.fromNode;if(t!==null){let i=t.findVisibleNode();if(i!==null&&(t=i),t._e()||t.ih())return!1}let e=this.toNode;if(e!==null){let i=e.findVisibleNode();if(i!==null&&(e=i),e._e()||e.ih())return!1}return!0}M2(t,e,i){return!1}N2(){}ke(){return!1}computeAngle(t,e,i){return _.computeAngle(e,i)}static computeAngle(t,e){let i=0;switch(t){default:case 0:i=0;break;case 21:i=e;break;case 22:i=e+90;break;case 23:i=e-90;break;case 24:i=e+180;break;case 25:i=L.Ug(e),i>90&&i<270&&(i-=180);break;case 26:i=L.Ug(e+90),i>90&&i<270&&(i-=180);break;case 27:i=L.Ug(e-90),i>90&&i<270&&(i-=180);break;case 28:if(i=L.Ug(e),i>45&&i<135||i>225&&i<315)return 0;i>90&&i<270&&(i-=180);break}return L.Ug(i)}get fromNode(){return this.so}set fromNode(t){let e=this.so;if(e!==t){let i=this.fromPort;e!==null&&(this.oo!==e&&e.b1(this,i),this.yy(),this.invalidateLayout(2)),this.so=t,t!==null&&this.Ei(t.isVisible()),this.Ko=null,this.invalidateRoute();let s=this.diagram;s!==null&&s.X&&s.partManager.setFromNodeForLink(this,t,e);let n=this.fromPort,o=this.fromPortChanged;if(o!==null){let r=!0;s!==null&&(r=s.X,s.X=!0),o(this,i,n),s!==null&&(s.X=r)}t!==null&&(this.oo!==t&&t.w1(this,n),this.wy(),this.invalidateLayout(1)),this.t("fromNode",e,t),this.Pd()}}get fromPortId(){return this.no}set fromPortId(t){let e=this.no;if(e!==t){let i=this.fromPort;i!==null&&this.fromNode?.qi(i),this.yy(),this.no=t;let s=this.fromPort;s!==null&&this.fromNode?.qi(s);let n=this.diagram;if(n!==null){let o=this.data,r=n.model;o!==null&&r.Ra()&&r.setFromPortIdForLinkData(o,t)}if(i!==s){this.Ko=null,this.invalidateRoute();let o=this.fromPortChanged;if(o!==null){let r=!0;n!==null&&(r=n.X,n.X=!0),o(this,i,s),n!==null&&(n.X=r)}}this.wy(),this.t("fromPortId",e,t)}}get fromPort(){let t=this.so;if(t===null)return null;let e=this.no;return t.findPort(e)}get fromPortChanged(){return this.Md}set fromPortChanged(t){let e=this.Md;e!==t&&(t!==null&&f.k(t,_,"fromPortChanged"),this.Md=t,this.t("fromPortChanged",e,t))}get toNode(){return this.oo}set toNode(t){let e=this.oo;if(e!==t){let i=this.toPort;e!==null&&(this.so!==e&&e.b1(this,i),this.yy(),this.invalidateLayout(2)),this.oo=t,t!==null&&this.Ei(t.isVisible()),this.Ko=null,this.invalidateRoute();let s=this.diagram;s!==null&&s.X&&s.partManager.setToNodeForLink(this,t,e);let n=this.toPort,o=this.toPortChanged;if(o!==null){let r=!0;s!==null&&(r=s.X,s.X=!0),o(this,i,n),s!==null&&(s.X=r)}t!==null&&(this.so!==t&&t.w1(this,n),this.wy(),this.invalidateLayout(1)),this.t("toNode",e,t),this.Pd()}}get toPortId(){return this.ro}set toPortId(t){let e=this.ro;if(e!==t){let i=this.toPort;i!==null&&this.toNode?.qi(i),this.yy(),this.ro=t;let s=this.toPort;s!==null&&this.toNode?.qi(s);let n=this.diagram;if(n!==null){let o=this.data,r=n.model;o!==null&&r.Ra()&&r.setToPortIdForLinkData(o,t)}if(i!==s){this.Ko=null,this.invalidateRoute();let o=this.toPortChanged;if(o!==null){let r=!0;n!==null&&(r=n.X,n.X=!0),o(this,i,s),n!==null&&(n.X=r)}}this.wy(),this.t("toPortId",e,t)}}get toPort(){let t=this.oo;if(t===null)return null;let e=this.ro;return t.findPort(e)}get toPortChanged(){return this.Nd}set toPortChanged(t){let e=this.Nd;e!==t&&(t!==null&&f.k(t,_,"toPortChanged"),this.Nd=t,this.t("toPortChanged",e,t))}get fromSpot(){return this.ct!==null?this.ct.ga:D.Default}set fromSpot(t){let e=this.fromSpot;if(!e.equals(t)){if(t=t.P(),this.Be().ga=t,this.t("fromSpot",e,t),e.isSide()||t.isSide()){let i=this.fromNode;i!==null&&i.qi(this.fromPort)}this.invalidateRoute()}}get fromEndSegmentLength(){return this.ct!==null?this.ct.pa:NaN}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;if(e!==t){if(t<0&&f.W(t,">= 0",_,"fromEndSegmentLength"),this.Be().pa=t,this.t("fromEndSegmentLength",e,t),this.computeSpot(!0,this.fromPort).isSide()){let i=this.fromNode;i!==null&&i.qi(this.fromPort)}this.invalidateRoute()}}get fromShortLength(){return this.ct!==null?this.ct.wa:NaN}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Be().wa=t,this.ee(),this.t("fromShortLength",e,t))}get toSpot(){return this.ct!==null?this.ct.ma:D.Default}set toSpot(t){let e=this.toSpot;if(!e.equals(t)){if(t=t.P(),this.Be().ma=t,this.t("toSpot",e,t),e.isSide()||t.isSide()){let i=this.toNode;i!==null&&i.qi(this.toPort)}this.invalidateRoute()}}get toEndSegmentLength(){return this.ct!==null?this.ct.ya:NaN}set toEndSegmentLength(t){let e=this.toEndSegmentLength;if(e!==t){if(t<0&&f.W(t,">= 0",_,"toEndSegmentLength"),this.Be().ya=t,this.t("toEndSegmentLength",e,t),this.computeSpot(!1,this.toPort).isSide()){let i=this.toNode;i!==null&&i.qi(this.toPort)}this.invalidateRoute()}}get toShortLength(){return this.ct!==null?this.ct.xa:NaN}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Be().xa=t,this.ee(),this.t("toShortLength",e,t))}Pd(){let t=this.fromNode,e=this.toNode,i=null;if(t!==null?e!==null?i=t.findCommonContainingGroup(e):i=t.containingGroup:e!==null?i=e.containingGroup:i=null,this.fO(i),this.isLabeledLink){let s=this.labelNodes;for(;s.next();){let n=s.value;n.containingGroup=i}}}fO(t){let e=this.xh;if(e!==t){e!==null&&e.eN(this),this.xh=t,t!==null&&t.sN(this);let i=this.containingGroupChanged;if(i!==null){let s=!0,n=this.diagram;n!==null&&(s=n.X,n.X=!0),i(this,e,t),n!==null&&(n.X=s)}this.Se&&(this.fN===e||this.uN===e)&&this.invalidateRoute()}}dh(){let t=this.containingGroup;t!==null&&this.fromNode!==t&&this.toNode!==t&&t.computesBoundsIncludingLinks&&super.dh()}getOtherNode(t){let e=this.fromNode;return t===e?this.toNode:e}getOtherPort(t){let e=this.fromPort;return t===e?this.toPort:e}get isLabeledLink(){return this.js===null?!1:this.js.count>0}get labelNodes(){return this.js===null?W.instance:this.js.iterator}wT(t){this.js===null&&(this.js=new I),this.js.add(t),this.c()}xT(t){this.js!==null&&(this.js.delete(t),this.c())}Rm(t){if(super.Rm(t),this.Ba()&&this.invalidateOtherJumpOvers(this.actualBounds),!t){let e=this.so,i=null;e!==null&&(i=this.fromPort,e.w1(this,i));let s=this.oo,n=null;s!==null&&(n=this.toPort,(s!==e||n!==i)&&s.w1(this,n)),this.wy()}}vm(t){if(super.vm(t),this.Ba()&&this.invalidateOtherJumpOvers(this.actualBounds),!t){let e=this.so,i=null;e!==null&&(i=this.fromPort,e.b1(this,i));let s=this.oo,n=null;s!==null&&(n=this.toPort,(s!==e||n!==i)&&s.b1(this,n)),this.yy()}}Xc(){if(this.Se=!0,this.js!==null){let t=this.diagram;if(t!==null){let e=this.js.copy().iterator;for(;e.next();){let i=e.value;t.remove(i)}}}if(this.data!==null){let t=this.diagram;t!==null&&t.partManager.pN(this)}}updateRelationshipsFromData(){if(this.data===null)return;let t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)}move(t,e){let i=e?this.location:this.position,s=i.x;isNaN(s)&&(s=0);let n=i.y;isNaN(n)&&(n=0);let o=t.x-s,r=t.y-n;if(e===!0)super.move(t,!1);else{let h=P.V(i.x+o,i.y+r);super.move(h,!1),P.e(h)}this.fr(o,r);let a=this.labelNodes;for(;a.next();){let h=a.value,l=h.position;h.moveTo(l.x+o,l.y+r)}}get relinkableFrom(){return(this.Mt&1)!==0}set relinkableFrom(t){let e=(this.Mt&1)!==0;e!==t&&(this.Mt=this.Mt^1,this.t("relinkableFrom",e,t),this.invalidateAdornments())}get relinkableTo(){return(this.Mt&2)!==0}set relinkableTo(t){let e=(this.Mt&2)!==0;e!==t&&(this.Mt=this.Mt^2,this.t("relinkableTo",e,t),this.invalidateAdornments())}canRelinkFrom(){if(!this.relinkableFrom)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRelink)return!1;let e=t.diagram;return!(e!==null&&!e.allowRelink)}canRelinkTo(){if(!this.relinkableTo)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRelink)return!1;let e=t.diagram;return!(e!==null&&!e.allowRelink)}get resegmentable(){return(this.Mt&4)!==0}set resegmentable(t){let e=(this.Mt&4)!==0;e!==t&&(this.Mt=this.Mt^4,this.t("resegmentable",e,t),this.invalidateAdornments())}get isTreeLink(){return(this.Mt&8)!==0}set isTreeLink(t){let e=(this.Mt&8)!==0;e!==t&&(this.Mt=this.Mt^8,this.t("isTreeLink",e,t),this.fromNode!==null&&this.fromNode.r0(),this.toNode!==null&&this.toNode.r0())}get path(){let t=this.findMainElement();return t instanceof ct?t:null}get routeBounds(){return this.updateRoute(),this.uO(this.Sf)}uO(t){let e=1/0,i=1/0,s=this.pointsCount;if(s===0)return t.i(NaN,NaN,0,0),t;if(s===1){let n=this.getPoint(0);e=Math.min(n.x,e),i=Math.min(n.y,i),t.i(n.x,n.y,0,0)}else if(s===2){let n=this.getPoint(0),o=this.getPoint(1);e=Math.min(n.x,o.x),i=Math.min(n.y,o.y),t.i(n.x,n.y,0,0),t.unionPoint(o)}else if(this.computeCurve()===9&&s>=3&&!this.isOrthogonal){let n=this.getPoint(0);if(e=n.x,i=n.y,t.i(e,i,0,0),s===3){let o=this.getPoint(1);e=Math.min(o.x,e),i=Math.min(o.y,i);let r=this.getPoint(2);e=Math.min(r.x,e),i=Math.min(r.y,i),L.ou(n.x,n.y,o.x,o.y,o.x,o.y,r.x,r.y,.5,t)}else for(let o=3;o<s;o+=3){let r=this.getPoint(o-2);o+3>=s&&(o=s-1);let a=this.getPoint(o-1),h=this.getPoint(o);L.ou(n.x,n.y,r.x,r.y,a.x,a.y,h.x,h.y,.5,t),e=Math.min(h.x,e),i=Math.min(h.y,i),n=h}}else{let n=this.getPoint(0),o=this.getPoint(1);e=Math.min(n.x,o.x),i=Math.min(n.y,o.y),t.i(n.x,n.y,0,0),t.unionPoint(o);for(let r=2;r<s;r++){let a=this.getPoint(r);e=Math.min(a.x,e),i=Math.min(a.y,i),t.unionPoint(a)}}return this.k1.i(e-t.x,i-t.y),t}get midPoint(){return this.updateRoute(),this.computeMidPoint(new P)}IA(t){return this.updateRoute(),this.computeMidPoint(t)}computeMidPoint(t){let e=this.pointsCount;if(e===0)return t.a(P.Ik),t;if(e===1)return t.a(this.getPoint(0)),t;if(e===2){let l=this.getPoint(0),c=this.getPoint(1);return t.i((l.x+c.x)/2,(l.y+c.y)/2),t}if(this.isOrthogonal&&(this.computeCorner()>=15||this.computeCurve()===9)){this.ot.getPointAlongPath(.5,t),t.add(this.getPoint(0));let l=this.ot.figures.first();return t.offset(-l.startX,-l.startY),t}if(this.computeCurve()===9){if(e===3){let u=this.getPoint(0),d=this.getPoint(1),g=this.getPoint(2);return L.TC(u.x,u.y,d.x,d.y,d.x,d.y,g.x,g.y,t),t}let l=(e-1)/3|0,c=(l/2|0)*3;if(l%2===1){let u=this.getPoint(c),d=this.getPoint(c+1),g=this.getPoint(c+2),p=this.getPoint(c+3);return L.TC(u.x,u.y,d.x,d.y,g.x,g.y,p.x,p.y,t),t}else return t.a(this.getPoint(c)),t}let i=this.flattenedLengths,s=this.flattenedTotalLength,n=0,o=0,r=0;for(;n<s/2&&o<e&&(r=i[o],!(n+r>s/2));)n+=r,o++;let a=this.getPoint(o),h=this.getPoint(o+1);if(Math.abs(a.x-h.x)<1)a.y>h.y?t.i(a.x,a.y-(s/2-n)):t.i(a.x,a.y+(s/2-n));else if(Math.abs(a.y-h.y)<1)a.x>h.x?t.i(a.x-(s/2-n),a.y):t.i(a.x+(s/2-n),a.y);else{let l=(s/2-n)/r,c=l*(h.x-a.x),u=l*(h.y-a.y);t.i(a.x+c,a.y+u)}return t}get midAngle(){return this.updateRoute(),this.computeMidAngle()}computeMidAngle(){let t=this.pointsCount;if(t<2)return NaN;if(t===2){let h=this.getPoint(0),l=this.getPoint(1);return h.directionPoint(l)}if(this.isOrthogonal&&(this.computeCorner()>=15||this.computeCurve()===9))return this.ot.getAngleAlongPath(.5);if(this.computeCurve()===9&&t>=4){let h=(t-1)/3|0,l=(h/2|0)*3;if(h%2===1){l=Math.floor(l);let c=this.getPoint(l),u=this.getPoint(l+1),d=this.getPoint(l+2),g=this.getPoint(l+3);return L._D(c.x,c.y,u.x,u.y,d.x,d.y,g.x,g.y)}else if(l>0&&l+1<t){let c=this.getPoint(l-1),u=this.getPoint(l+1);return c.directionPoint(u)}}let e=this.flattenedLengths,i=this.flattenedTotalLength,s=0,n=0,o=0;for(;s<i/2&&n<t&&(o=e[n],!(s+o>i/2));)s+=o,n++;let r=this.getPoint(n),a=this.getPoint(n+1);if(Math.abs(r.x-a.x)<1&&Math.abs(r.y-a.y)<1){if(n>0&&n+2<t){let h=this.getPoint(n-1),l=this.getPoint(n+2);return h.directionPoint(l)}}else{if(Math.abs(r.x-a.x)<1)return r.y>a.y?270:90;if(Math.abs(r.y-a.y)<1)return r.x>a.x?180:0}return r.directionPoint(a)}get flattenedLengths(){return this.Oa!==null?this.Oa:(this.Se||this.S1(),this.dO())}get flattenedTotalLength(){let t=this.P1;if(isNaN(t)){let e=this.flattenedLengths,i=e.length;t=0;for(let s=0;s<i;s++)t+=e[s];this.P1=t}return t}dO(){this.Oa===null?this.Oa=[]:this.Oa.length=0;let t=this.Oa,e=this.pointsCount;for(let i=0;i<e-1;i++){let s=0,n=this.getPoint(i),o=this.getPoint(i+1);L.z(n.x,o.x)?(s=o.y-n.y,s<0&&(s=-s),t.push(s)):L.z(n.y,o.y)?(s=o.x-n.x,s<0&&(s=-s),t.push(s)):(s=Math.sqrt(n.distanceSquaredPoint(o)),t.push(s))}return t}get points(){return this.xi}set points(t){let e=this.xi;if(e===t)return;let i=null;if(Array.isArray(t)){let n=t,o=n.length%2===0;if(o){for(let r=0;r<n.length;r++)if(typeof n[r]!="number"||isNaN(n[r])){o=!1;break}}if(o){i=new G;for(let r=0;r<n.length/2;r++){let a=new P(n[r*2],n[r*2+1]).u();i.add(a)}}else{let r=!0;for(let a=0;a<n.length;a++){let h=n[a];if(!f.Y(h)||typeof h.x!="number"||isNaN(h.x)||typeof h.y!="number"||isNaN(h.y)){r=!1;break}}if(r){i=new G;for(let a=0;a<n.length;a++){let h=n[a];i.add(new P(h.x,h.y).u())}}}}else if(t instanceof G){i=t.copy();let n=i.iterator;for(;n.next();)n.value.u()}else f.o("Link.points value is not an instance of List or Array: "+t);if(i===null)return;i.u(),this.xi=i,this.ee(),this.S1();let s=this.diagram;s!==null&&(!s.Vh&&!s.undoManager.isUndoingRedoing&&s.xx.add(this),s.animationManager.pi&&s.animationManager.VS(this,i)),this.t("points",e,i)}get pointsCount(){return this.xi.count}getPoint(t){return this.xi.r[t]}setPoint(t,e){this.xi.setElt(t,e)}setPointAt(t,e,i){this.xi.setElt(t,new P(e,i))}insertPoint(t,e){this.xi.insertAt(t,e)}insertPointAt(t,e,i){this.xi.insertAt(t,new P(e,i))}addPoint(t){this.xi.add(t)}addPointAt(t,e){this.xi.add(new P(t,e))}removePoint(t){this.xi.removeAt(t)}clearPoints(){this.xi.clear()}fr(t,e){if(t===0&&e===0)return;if(this.pointsCount===0){this.defaultFromPoint&&this.defaultFromPoint.offset(t,e),this.defaultToPoint&&this.defaultToPoint.offset(t,e);return}let i=this.Se,s=new G,n=this.xi.iterator;for(;n.next();){let a=n.value;s.add(new P(a.x+t,a.y+e).u())}s.u();let o=this.xi;this.xi=s;let r=this.diagram;isNaN(t)||isNaN(e)||r!==null&&r.animationManager.pi?this.c():(this.Ks.i(this.Ks.x+t,this.Ks.y+e),this.at.i(this.at.x+t,this.at.y+e),this.ef()),i?this.S1():(this.defaultFromPoint&&(this.defaultFromPoint=this.getPoint(0)),this.defaultToPoint&&(this.defaultToPoint=this.getPoint(this.pointsCount-1))),r!==null&&r.animationManager.pi&&r.animationManager.VS(this,s),this.t("points",o,s)}startRoute(){this.hl===null&&(this.hl=this.xi,this.xi=this.xi.copy())}commitRoute(){if(this.hl===null)return;let t=this.hl,e=this.xi,i=1/0,s=1/0,n=t.r,o=n.length;for(let u=0;u<o;u++){let d=n[u];i=Math.min(d.x,i),s=Math.min(d.y,s)}let r=1/0,a=1/0,h=e.r,l=h.length;for(let u=0;u<l;u++){let d=h[u];r=Math.min(d.x,r),a=Math.min(d.y,a),d.u()}if(e.u(),l===o)for(let u=0;u<l;u++){let d=n[u],g=h[u];if(d.x-i!==g.x-r||d.y-s!==g.y-a){this.ee();break}}else this.ee();this.hl=null;let c=this.diagram;c!==null&&c.animationManager.pi&&c.animationManager.VS(this,e),this.S1(),this.t("points",t,e)}rollbackRoute(){this.hl!==null&&(this.xi=this.hl,this.hl=null)}BF(){this.br!==null&&(this.points=this.br,this.br=null)}S1(){if(this.xi.count===0){this.Se=!1;return}this.Se=!0,this.Oa=null,this.P1=NaN,this.defaultFromPoint=this.getPoint(0),this.defaultToPoint=this.getPoint(this.pointsCount-1),this.M1(!1)}invalidateRoute(){if(this.suspendsRouting)return;let t=this.path;if(t===null)return;let e=this.diagram;if(e){if(e.xx.has(this)||e.undoManager.isUndoingRedoing)return;let i=e.animationManager;if(i.isTicking&&!i.isAnimating)return;this.br!==null&&!i.isTicking&&(this.br=null)}this.Se=!1,this.c(),t.c()}get Se(){return(this.Mt&16)!==0}set Se(t){(this.Mt&16)!==0!==t&&(this.Mt=this.Mt^16)}get suspendsRouting(){return(this.Mt&32)!==0}set suspendsRouting(t){(this.Mt&32)!==0!==t&&(this.Mt=this.Mt^32)}get xy(){return(this.Mt&64)!==0}set xy(t){(this.Mt&64)!==0!==t&&(this.Mt=this.Mt^64)}get yN(){return(this.Mt&512)!==0}set yN(t){(this.Mt&512)!==0!==t&&(this.Mt=this.Mt^512)}get defaultFromPoint(){return this.aN}set defaultFromPoint(t){this.aN=t!==null?t.copy():null}get defaultToPoint(){return this.cN}set defaultToPoint(t){this.cN=t!==null?t.copy():null}updateRoute(){if(this.Se||this.xy)return;let t=!0;try{this.xy=!0,this.startRoute(),t=this.computePoints()}catch{this.xy=!1,this.rollbackRoute()}finally{this.xy=!1,t?this.commitRoute():this.rollbackRoute()}}computePoints(){let t=this.diagram;if(t===null)return!1;let e=this.fromNode,i=null;if(e===null?(_.Ia||(_.Ia=new rt,_.Ia.desiredSize=Q.sc,_.Ia.ensureBounds()),this.defaultFromPoint&&(_.Ia.location=this.defaultFromPoint,_.Ia.ensureBounds(),e=_.Ia,i=_.Ia)):i=this.fromPort,i!==null&&!e.isVisible()){let p=e.findVisibleNode();p!==null&&p!==e?(e=p,i=p.port):e=p}if(this.fN=e,e===null||!e.location.isReal()||i===null||(i=e.findVisiblePort(i),i===null))return!1;let s=this.toNode,n=null;if(s===null?(_.Ea||(_.Ea=new rt,_.Ea.desiredSize=Q.sc,_.Ea.ensureBounds()),this.defaultToPoint&&(_.Ea.location=this.defaultToPoint,_.Ea.ensureBounds(),s=_.Ea,n=_.Ea)):n=this.toPort,n!==null&&!s.isVisible()){let p=s.findVisibleNode();p!==null&&p!==s?(s=p,n=p.port):s=p}if(this.uN=s,s===null||!s.location.isReal()||n===null||(n=s.findVisiblePort(n),n===null))return!1;let o=this.pointsCount,r=this.computeSpot(!0,i),a=this.computeSpot(!1,n),h=this.Dd(r),l=this.Dd(a),c=i===n&&i!==null,u=this.isOrthogonal,d=this.curve===9;c&&!u?(d=!0,this.Ko=!0):this.Ko=!1;let g=this.computeAdjusting()===0||c;if(!u&&!c&&h&&l){let p=!1;if(!g&&o>=3){let m=this.getLinkPoint(e,i,r,!0,!1,s,n),y=this.getLinkPoint(s,n,a,!1,!1,e,i);p=this.adjustPoints(0,m,o-1,y),p&&(m=this.getLinkPoint(e,i,r,!0,!1,s,n),y=this.getLinkPoint(s,n,a,!1,!1,e,i),this.adjustPoints(0,m,o-1,y))}p||(this.clearPoints(),d?this.gO(e,i,r,s,n,a):this.mO(e,i,r,s,n,a))}else{let p=this.isAvoiding;g&&(u&&p||c)&&this.clearPoints();let m=c?this.computeCurviness():0,y=this.getLinkPoint(e,i,r,!0,u,s,n),w=0,b=0,v=0;if(u||!h||c){let C=this.computeEndSegmentLength(e,i,r,!0);if(v=this.getLinkDirection(e,i,y,r,!0,u,s,n),c&&(h||r.equals(a)||!u&&r.x+a.x===1&&r.y+a.y===1)&&(v-=u?90:30,m<0&&(v-=180)),v<0?v+=360:v>=360&&(v-=360),c&&(C+=Math.abs(m)*(u?1:2)),v===0?w=C:v===90?b=C:v===180?w=-C:v===270?b=-C:(w=C*Math.cos(v*Math.PI/180),b=C*Math.sin(v*Math.PI/180)),r.isNoSpot()&&c){let R=i.getDocumentPoint(D.Center,P.l()),O=P.V(R.x+w*1e3,R.y+b*1e3);this.getLinkPointFromPoint(e,i,R,O,!0,y),P.e(R),P.e(O)}}let k=this.getLinkPoint(s,n,a,!1,u,e,i),S=0,M=0,F=0;if(u||!l||c){let C=this.computeEndSegmentLength(s,n,a,!1);if(F=this.getLinkDirection(s,n,k,a,!1,u,e,i),c&&(l||r.equals(a)||!u&&r.x+a.x===1&&r.y+a.y===1)&&(F+=u?0:30,m<0&&(F+=180)),F<0?F+=360:F>=360&&(F-=360),c&&(C+=Math.abs(m)*(u?1:2)),F===0?S=C:F===90?M=C:F===180?S=-C:F===270?M=-C:(S=C*Math.cos(F*Math.PI/180),M=C*Math.sin(F*Math.PI/180)),a.isNoSpot()&&c){let R=n.getDocumentPoint(D.Center,P.l()),O=P.V(R.x+S*1e3,R.y+M*1e3);this.getLinkPointFromPoint(s,n,R,O,!1,k),P.e(R),P.e(O)}}let T=y;(u||!h||c)&&(T=new P(y.x+w,y.y+b));let N=k;(u||!l||c)&&(N=new P(k.x+S,k.y+M)),!g&&!u&&h&&o>3&&this.adjustPoints(0,y,o-2,N)?this.setPoint(o-1,k):!g&&!u&&l&&o>3&&this.adjustPoints(1,T,o-1,k)?this.setPoint(0,y):!g&&(u?o>=6:o>4)&&this.adjustPoints(1,T,o-2,N)?(this.setPoint(0,y),this.setPoint(o-1,k)):(this.clearPoints(),this.addPoint(y),(u||!h||c)&&this.addPoint(T),u&&this.addOrthoPoints(T,v,N,F,e,s),(u||!l||c)&&this.addPoint(N),this.addPoint(k))}return t.addInvalidRoute(this),!0}wN(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?(e.x>=t.x?e.x=t.x+9e9:e.x=t.x-9e9,e.y=t.y):(e.y>=t.y?e.y=t.y+9e9:e.y=t.y-9e9,e.x=t.x),e}getLinkPointFromPoint(t,e,i,s,n,o){if(o===void 0&&(o=new P),t===null||e===null)return o.a(i),o;if(!t.isVisible()){let d=t.findVisibleNode();d!==null&&d!==t&&(t=d,e=t.port)}let r=0,a=0,h=0,l=0,c=null,u=e.panel;if(u!==null&&!u.an()&&(u=u.panel),u===null)r=s.x,a=s.y,h=i.x,l=i.y;else{c=u.Us;let d=1/(c.m11*c.m22-c.m12*c.m21),g=c.m22*d,p=-c.m12*d,m=-c.m21*d,y=c.m11*d,w=d*(c.m21*c.dy-c.m22*c.dx),b=d*(c.m12*c.dx-c.m11*c.dy);r=s.x*g+s.y*m+w,a=s.x*p+s.y*y+b,h=i.x*g+i.y*m+w,l=i.x*p+i.y*y+b}return e.Jc(r,a,h,l,o),c!==null&&o.T(c),o}pO(t,e){let i=t.Ku;return i!==null?i.MT(e):null}N1(t){if(t===null)return null;let e=t.Ku;return e===null&&(e=new Fs(t.part,t),t.Ku=e),e.MT(this)}getLinkPoint(t,e,i,s,n,o,r,a){if(a===void 0&&(a=new P),i.isSpot()&&!this.Dd(i))return e.getDocumentPoint(i,a),a;if(i.isSide()){let c=this.N1(e);if(c!==null){let u=c.Fd;if(a.a(u),n&&this.routing===7){let d=this.N1(r);if(d!==null&&c.Mf<d.Mf){let g=P.l(),p=P.l(),m=new z(e.getDocumentPoint(D.TopLeft,g),e.getDocumentPoint(D.BottomRight,p)),y=this.computeSpot(!s,r),w=this.getLinkPoint(o,r,y,!s,n,t,e,p);(i.includesSide(D.LeftSide)||i.includesSide(D.RightSide))&&w.y>=m.y&&w.y<=m.y+m.height?a.y=w.y:(i.includesSide(D.TopSide)||i.includesSide(D.BottomSide))&&w.x>=m.x&&w.x<=m.x+m.width&&(a.x=w.x),P.e(g),P.e(p)}}return a}}let h=e.getDocumentPoint(this.C1(i,s),P.l()),l=null;if(this.pointsCount>(n?6:2))l=s?this.getPoint(1):this.getPoint(this.pointsCount-2),n&&(l=this.wN(h,l.copy()));else{let c=this.computeSpot(!s,r),u=P.l();l=r.getDocumentPoint(this.C1(c,!s),u),n&&(l=this.wN(h,l)),P.e(u)}return this.getLinkPointFromPoint(t,e,h,l,s,a),P.e(h),a}getLinkDirection(t,e,i,s,n,o,r,a){let h=this.yO(t,e,i,s,n,o,r,a);if(r&&s.isNoSpot()&&r.isMemberOf(t)&&(h+=180,h>=360&&(h-=360)),this.Dd(s)||e===null)return h;let l=e.getDocumentAngle();return l===0||(45<=l&&l<135?h+=90:135<=l&&l<225?h+=180:225<=l&&l<315&&(h+=270),h>=360&&(h-=360)),h}yO(t,e,i,s,n,o,r,a){if(s.isSpot())return s.x>s.y?s.x>1-s.y?0:s.x<1-s.y?270:315:s.x<s.y?s.x>1-s.y?90:s.x<1-s.y?180:135:s.x<.5?225:s.x>.5?45:0;if(s.isSide()){let u=this.N1(e);if(u!==null)switch(u.me){case 1:return 270;case 2:return 180;default:case 4:return 0;case 8:return 90}else return s.includesSide(D.TopSide)?270:s.includesSide(D.BottomSide)?90:s.includesSide(D.LeftSide)?180:0}if(e===null||a===null)return 0;let h=e.getDocumentPoint(D.Center,P.l()),l=null;if(this.pointsCount>(o?6:2))l=n?this.getPoint(1):this.getPoint(this.pointsCount-2),o?l=this.wN(h,l.copy()):l=i;else{let u=P.l();l=a.getDocumentPoint(D.Center,u),P.e(u)}let c=0;return Math.abs(l.x-h.x)>Math.abs(l.y-h.y)?l.x>=h.x?c=0:c=180:l.y>=h.y?c=90:c=270,P.e(h),c}computeEndSegmentLength(t,e,i,s){if(e!==null&&i.isSide()){let o=this.N1(e);if(o!==null)return o.L1}let n=NaN;return s?n=this.fromEndSegmentLength:n=this.toEndSegmentLength,e!==null&&isNaN(n)&&(s?n=e.fromEndSegmentLength:n=e.toEndSegmentLength),isNaN(n)&&(n=10),n}computeSpot(t,e){return e===void 0&&(e=null),t?this.wO(e||this.fromPort):this.xO(e||this.toPort)}wO(t){if(t===null)return D.Center;let e=this.fromSpot;return e.isDefault()&&(e=t.fromSpot),e===D.Default?D.None:e}xO(t){if(t===null)return D.Center;let e=this.toSpot;return e.isDefault()&&(e=t.toSpot),e===D.Default?D.None:e}Dd(t){return t===D.None||t.x===.5&&t.y===.5}C1(t,e){return t.x===.5&&t.y===.5?t:D.Center}computeOtherPoint(t,e){if(this.computeAdjusting()!==0&&this.pointsCount>4)return this.computeMidPoint(new P);{let i=this.pO(e,this);return i!==null?i.Fd:e.getDocumentPoint(D.Center)}}computeShortLength(t){if(t){let e=this.fromShortLength;if(isNaN(e)){let i=this.fromPort;i!==null&&(e=i.fromShortLength)}return isNaN(e)?0:e}else{let e=this.toShortLength;if(isNaN(e)){let i=this.toPort;i!==null&&(e=i.toShortLength)}return isNaN(e)?0:e}}Tm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r;if(o===void 0?(r=Pt.l(),r.Ri()):r=o,r.nc(this.T),this.containedInRect(t,r))return this.G2(e,i,n),o===void 0&&Pt.e(r),!0;if(this.intersectsRect(t,r)){let a=!1;if(!this.af){let h=this.C.r,l=h.length;for(let c=l;c--;){let u=h[c];if(!u.visible&&u!==this.locationObject)continue;let d=u.actualBounds,g=this.naturalBounds;if(d.x>g.width||d.y>g.height||d.x+d.width<0||d.y+d.height<0)continue;let p=u,m=Pt.l();if(m.set(r),p instanceof H?a=p.Tm(t,e,i,s,n,m):this.path===p?p instanceof ct&&(a=p.Gv(t,s,m)):a=p.xA(t,s,m),a){let y=p;e!==null&&(y=e(p)),y&&(i===null||i(y))&&n.add(y)}Pt.e(m)}}return o===void 0&&Pt.e(r),a||this.background!==null}return o===void 0&&Pt.e(r),!1}get isOrthogonal(){return(this.va&2)===2}static mN(t){return(t&2)===2}get isAvoiding(){return(this.va&4)===4}computeCurve(){if(this.Ko===null){let t=this.fromPort,e=t!==null&&t===this.toPort,i=this.isOrthogonal;this.Ko=e&&!i}return this.Ko?9:this.curve}computeCorner(){if(this.curve===9)return 0;let t=this.corner;return(isNaN(t)||t<0)&&(t=10),t}findMidLabel(){let t=this.path,e=this.C.r,i=e.length;for(let n=0;n<i;n++){let o=e[n];if(!(o===t||o.isPanelMain)&&(o.segmentIndex===-1/0||isNaN(o.segmentIndex)))return o}let s=this.labelNodes;for(;s.next();){let n=s.value;if(n.segmentIndex===-1/0||isNaN(n.segmentIndex))return n}return null}computeSpacing(){if(!this.isVisible())return 0;let t=_.cO;t=Math.max(t,this.computeThickness());let e=this.fromPort,i=this.toPort;if(e!==null&&i!==null){let s=this.findMidLabel();if(s!==null){let n=s.naturalBounds,o=s.margin,r=isNaN(n.width)?30:n.width*s.scale+o.left+o.right,a=isNaN(n.height)?14:n.height*s.scale+o.top+o.bottom,h=s.segmentOrientation;if(h===21||h===25||h===24)t=Math.max(t,a);else if(h===23||h===27||h===22||h===26)t=Math.max(t,r);else{let l=e.getDocumentPoint(D.Center).directionPoint(i.getDocumentPoint(D.Center))/180*Math.PI;t=Math.max(t,Math.abs(Math.sin(l)*r)+Math.abs(Math.cos(l)*a)+1)}this.curve===9&&(t*=1.333)}}return t}arrangeBundledLinks(t,e){if(e)for(let i=0;i<t.length;i++){let s=t[i];s.computeAdjusting()===0&&s.invalidateRoute()}}computeCurviness(){let t=this.curviness;if(isNaN(t)){t=_.aO;let e=this.jo;if(e!==null){let i=f.et(),s=0,n=e.Hs;for(let r=0;r<n.length;r++){let a=n[r].computeSpacing();i.push(a),s+=a}let o=-s/2;for(let r=0;r<n.length;r++){if(n[r]===this){t=o+i[r]/2;break}o+=i[r]}e.ny===this.fromNode&&(t=-t),f.J(i)}}return t}computeThickness(){if(!this.isVisible())return 0;let t=this.path;return t!==null?Math.max(t.strokeWidth,1):1}hasCurviness(){return!isNaN(this.curviness)||this.jo!==null}mO(t,e,i,s,n,o){let r=this.getLinkPoint(t,e,i,!0,!1,s,n),a=this.getLinkPoint(s,n,o,!1,!1,t,e);if(this.hasCurviness()){let h=a.x-r.x,l=a.y-r.y,c=this.computeCurviness(),u=c,d=r.x+h/2,g=r.y+l/2,p=d,m=g;if(L.f(l,0))h>0?m-=u:m+=u;else{let y=-h/l,w=Math.sqrt(u*u/(y*y+1));c<0&&(w=-w),p=(l<0?-1:1)*w+d,m=y*(p-d)+g}this.addPoint(r),this.addPointAt(p,m),this.addPoint(a)}else{this.addPoint(r),this.addPoint(a);let h=z.l();e.getDocumentBounds(h);let l=h.containsPoint(a);n.getDocumentBounds(h);let c=h.containsPoint(r);if(l||c){let u=e.getDocumentPoint(this.C1(i,!0),new P);this.setPoint(0,this.getLinkPointFromPoint(t,e,u,a,!0,u));let d=n.getDocumentPoint(this.C1(o,!1),new P);this.setPoint(1,this.getLinkPointFromPoint(s,n,d,r,!1,d))}z.e(h)}}gO(t,e,i,s,n,o){let r=this.getLinkPoint(t,e,i,!0,!1,s,n),a=this.getLinkPoint(s,n,o,!1,!1,t,e),h=a.x-r.x,l=a.y-r.y,c=this.computeCurviness(),u=0,d=0,g=r.x+h/3,p=r.y+l/3,m=g,y=p;L.f(l,0)?h>0?y-=c:y+=c:(u=-h/l,d=Math.sqrt(c*c/(u*u+1)),c<0&&(d=-d),m=(l<0?-1:1)*d+g,y=u*(m-g)+p),g=r.x+2*h/3,p=r.y+2*l/3;let w=g,b=p;L.f(l,0)?h>0?b-=c:b+=c:(w=(l<0?-1:1)*d+g,b=u*(w-g)+p),this.clearPoints(),this.addPoint(r),this.addPointAt(m,y),this.addPointAt(w,b),this.addPoint(a),this.setPoint(0,this.getLinkPoint(t,e,i,!0,!1,s,n)),this.setPoint(3,this.getLinkPoint(s,n,o,!1,!1,t,e))}adjustPoints(t,e,i,s){let n=this.computeAdjusting();if(this.isOrthogonal){if(n===18)return!1;n===19&&(n=17)}switch(n){case 18:return this.bO(t,e,i,s);case 19:return this.kO(t,e,i,s);case 17:return this.PO(t,e,i,s);default:return!1}}bO(t,e,i,s){let n=this.getPoint(t),o=this.getPoint(i);if(n.equalsApprox(e)&&o.equalsApprox(s))return!0;let r=n.x,a=n.y,h=o.x,l=o.y,c=h-r,u=l-a,d=Math.sqrt(c*c+u*u);if(L.z(d,0))return!0;let g=0;L.z(c,0)?u<0?g=-Math.PI/2:g=Math.PI/2:(g=Math.atan(u/Math.abs(c)),c<0&&(g=Math.PI-g));let p=e.x,m=e.y,y=s.x,w=s.y,b=y-p,v=w-m,k=Math.sqrt(b*b+v*v),S=0;L.z(b,0)?v<0?S=-Math.PI/2:S=Math.PI/2:(S=Math.atan(v/Math.abs(b)),b<0&&(S=Math.PI-S));let M=k/d,F=S-g;this.setPoint(t,e);for(let T=t+1;T<i;T++){let N=this.getPoint(T);c=N.x-r,u=N.y-a;let C=Math.sqrt(c*c+u*u);if(L.z(C,0))continue;let R=0;L.z(c,0)?u<0?R=-Math.PI/2:R=Math.PI/2:(R=Math.atan(u/Math.abs(c)),c<0&&(R=Math.PI-R));let O=R+F,B=C*M,X=p+B*Math.cos(O),Y=m+B*Math.sin(O);this.setPointAt(T,X,Y)}return this.setPoint(i,s),!0}kO(t,e,i,s){let n=this.getPoint(t),o=this.getPoint(i);if(n.equalsApprox(e)&&o.equalsApprox(s))return!0;let r=n.x,a=n.y,h=o.x,l=o.y,c=(h-r)**2+(l-a)**2,u=e.x,d=e.y,g=s.x,p=s.y,m=0,y=1;g-u!==0?(m=(p-d)/(g-u),y=Math.sqrt(1+1/(m*m))):m=9e9,this.setPoint(t,e);for(let w=t+1;w<i;w++){let b=this.getPoint(w),v=b.x,k=b.y,S=.5;c!==0&&(S=((r-v)*(r-h)+(a-k)*(a-l))/c);let M=r+S*(h-r),F=a+S*(l-a),T=Math.sqrt((v-M)**2+(k-F)**2);k<m*(v-M)+F&&(T=-T),m>0&&(T=-T);let N=u+S*(g-u),C=d+S*(p-d);if(m!==0){let R=N+T/y,O=C-(R-N)/m;this.setPointAt(w,R,O)}else this.setPointAt(w,N,C+T)}return this.setPoint(i,s),!0}PO(t,e,i,s){if(this.isOrthogonal){let n=this.getPoint(t),o=this.getPoint(t+1),r=this.getPoint(t+2),a=o.x,h=o.y,l=a,c=h;L.f(n.y,o.y)?L.f(o.x,r.x)?h=e.y:L.f(o.y,r.y)&&(a=e.x):L.f(n.x,o.x)&&(L.f(o.y,r.y)?a=e.x:L.f(o.x,r.x)&&(h=e.y)),this.setPointAt(t+1,a,h),n=this.getPoint(i),o=this.getPoint(i-1),r=this.getPoint(i-2);let u=o.x,d=o.y,g=u,p=d;if(L.f(n.y,o.y)?L.f(o.x,r.x)?d=s.y:L.f(o.y,r.y)&&(u=s.x):L.f(n.x,o.x)&&(L.f(o.y,r.y)?u=s.x:L.f(o.x,r.x)&&(d=s.y)),this.setPointAt(i-1,u,d),this.JL())return this.setPointAt(t+1,l,c),this.setPointAt(i-1,g,p),!1}return this.setPoint(t,e),this.setPoint(i,s),!0}addOrthoPoints(t,e,i,s,n,o){e<0?e+=360:e>=360&&(e-=360),s<0?s+=360:s>=360&&(s-=360);let r=s;e>=315||e<45?e=0:45<=e&&e<135?e=90:135<=e&&e<225?e=180:e=270,s>=315||s<45?s=0:45<=s&&s<135?s=90:135<=s&&s<225?s=180:s=270;let a=t,h=i,l=n.actualBounds.copy(),c=o.actualBounds.copy();if(!l.isReal()||!c.isReal())return;l.inflate(_.Ua,_.Ua),c.inflate(_.Ua,_.Ua),l.unionPoint(t),c.unionPoint(i);let u=P.l(),d=P.l();e===0?h.x>a.x||s===270&&h.y<a.y&&c.right>a.x||s===90&&h.y>a.y&&c.right>a.x?(u.i(h.x,a.y),d.i(h.x,(a.y+h.y)/2),s===180?(u.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1),d.x=u.x,d.y=h.y):s===270&&h.y<a.y||s===90&&h.y>a.y?(a.x<c.left?u.x=this.computeMidOrthoPosition(a.x,a.y,c.left,h.y,!1):a.x<c.right&&(s===270&&a.y<c.top||s===90&&a.y>c.bottom)?u.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):u.x=c.right,d.x=u.x,d.y=h.y):s===0&&a.x<c.left&&a.y>c.top&&a.y<c.bottom&&(u.x=a.x,a.y<h.y?u.y=Math.min(h.y,c.top):u.y=Math.max(h.y,c.bottom),d.y=u.y)):(u.i(a.x,h.y),d.i((a.x+h.x)/2,h.y),(s===180||s===90&&h.y<l.top||s===270&&h.y>l.bottom)&&(s===180&&(c.containsPoint(a)||l.containsPoint(h))?u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):h.y<a.y&&(s===180||s===90)?u.y=this.computeMidOrthoPosition(a.x,l.top,h.x,Math.max(h.y,c.bottom),!0):h.y>a.y&&(s===180||s===270)&&(u.y=this.computeMidOrthoPosition(a.x,l.bottom,h.x,Math.min(h.y,c.top),!0)),d.x=h.x,d.y=u.y),u.y>l.top&&u.y<l.bottom&&(h.x>=l.left&&h.x<=a.x||a.x<=c.right&&a.x>=h.x?(s===90||s===270)&&(u.i(Math.max((a.x+h.x)/2,a.x),a.y),d.i(u.x,h.y)):(s===270||(s===0||s===180)&&h.y<a.y?u.y=Math.min(h.y,s===0?l.top:Math.min(l.top,c.top)):u.y=Math.max(h.y,s===0?l.bottom:Math.max(l.bottom,c.bottom)),d.x=h.x,d.y=u.y))):e===180?h.x<a.x||s===270&&h.y<a.y&&c.left<a.x||s===90&&h.y>a.y&&c.left<a.x?(u.i(h.x,a.y),d.i(h.x,(a.y+h.y)/2),s===0?(u.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1),d.x=u.x,d.y=h.y):s===270&&h.y<a.y||s===90&&h.y>a.y?(a.x>c.right?u.x=this.computeMidOrthoPosition(a.x,a.y,c.right,h.y,!1):a.x>c.left&&(s===270&&a.y<c.top||s===90&&a.y>c.bottom)?u.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):u.x=c.left,d.x=u.x,d.y=h.y):s===180&&a.x>c.right&&a.y>c.top&&a.y<c.bottom&&(u.x=a.x,a.y<h.y?u.y=Math.min(h.y,c.top):u.y=Math.max(h.y,c.bottom),d.y=u.y)):(u.i(a.x,h.y),d.i((a.x+h.x)/2,h.y),(s===0||s===90&&h.y<l.top||s===270&&h.y>l.bottom)&&(s===0&&(c.containsPoint(a)||l.containsPoint(h))?u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):h.y<a.y&&(s===0||s===90)?u.y=this.computeMidOrthoPosition(a.x,l.top,h.x,Math.max(h.y,c.bottom),!0):h.y>a.y&&(s===0||s===270)&&(u.y=this.computeMidOrthoPosition(a.x,l.bottom,h.x,Math.min(h.y,c.top),!0)),d.x=h.x,d.y=u.y),u.y>l.top&&u.y<l.bottom&&(h.x<=l.right&&h.x>=a.x||a.x>=c.left&&a.x<=h.x?(s===90||s===270)&&(u.i(Math.min((a.x+h.x)/2,a.x),a.y),d.i(u.x,h.y)):(s===270||(s===0||s===180)&&h.y<a.y?u.y=Math.min(h.y,s===180?l.top:Math.min(l.top,c.top)):u.y=Math.max(h.y,s===180?l.bottom:Math.max(l.bottom,c.bottom)),d.x=h.x,d.y=u.y))):e===90?h.y>a.y||s===180&&h.x<a.x&&c.bottom>a.y||s===0&&h.x>a.x&&c.bottom>a.y?(u.i(a.x,h.y),d.i((a.x+h.x)/2,h.y),s===270?(u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0),d.x=h.x,d.y=u.y):s===180&&h.x<a.x||s===0&&h.x>a.x?(a.y<c.top?u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,c.top,!0):a.y<c.bottom&&(s===180&&a.x<c.left||s===0&&a.x>c.right)?u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):u.y=c.bottom,d.x=h.x,d.y=u.y):s===90&&a.y<c.top&&a.x>c.left&&a.x<c.right&&(a.x<h.x?u.x=Math.min(h.x,c.left):u.x=Math.max(h.x,c.right),u.y=a.y,d.x=u.x)):(u.i(h.x,a.y),d.i(h.x,(a.y+h.y)/2),(s===270||s===0&&h.x<l.left||s===180&&h.x>l.right)&&(s===270&&(c.containsPoint(a)||l.containsPoint(h))?u.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):h.x<a.x&&(s===270||s===0)?u.x=this.computeMidOrthoPosition(l.left,a.y,Math.max(h.x,c.right),h.y,!1):h.x>a.x&&(s===270||s===180)&&(u.x=this.computeMidOrthoPosition(l.right,a.y,Math.min(h.x,c.left),h.y,!1)),d.x=u.x,d.y=h.y),u.x>l.left&&u.x<l.right&&(h.y>=l.top&&h.y<=a.y||a.y<=c.bottom&&a.y>=h.y?(s===0||s===180)&&(u.i(a.x,Math.max((a.y+h.y)/2,a.y)),d.i(h.x,u.y)):(s===180||(s===90||s===270)&&h.x<a.x?u.x=Math.min(h.x,s===90?l.left:Math.min(l.left,c.left)):u.x=Math.max(h.x,s===90?l.right:Math.max(l.right,c.right)),d.x=u.x,d.y=h.y))):h.y<a.y||s===180&&h.x<a.x&&c.top<a.y||s===0&&h.x>a.x&&c.top<a.y?(u.i(a.x,h.y),d.i((a.x+h.x)/2,h.y),s===90?(u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0),d.x=h.x,d.y=u.y):s===180&&h.x<a.x||s===0&&h.x>=a.x?(a.y>c.bottom?u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,c.bottom,!0):a.y>c.top&&(s===180&&a.x<c.left||s===0&&a.x>c.right)?u.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):u.y=c.top,d.x=h.x,d.y=u.y):s===270&&a.y>c.bottom&&a.x>c.left&&a.x<c.right&&(a.x<h.x?u.x=Math.min(h.x,c.left):u.x=Math.max(h.x,c.right),u.y=a.y,d.x=u.x)):(u.i(h.x,a.y),d.i(h.x,(a.y+h.y)/2),(s===90||s===0&&h.x<l.left||s===180&&h.x>l.right)&&(s===90&&(c.containsPoint(a)||l.containsPoint(h))?u.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):h.x<a.x&&(s===90||s===0)?u.x=this.computeMidOrthoPosition(l.left,a.y,Math.max(h.x,c.right),h.y,!1):h.x>a.x&&(s===90||s===180)&&(u.x=this.computeMidOrthoPosition(l.right,a.y,Math.min(h.x,c.left),h.y,!1)),d.x=u.x,d.y=h.y),u.x>l.left&&u.x<l.right&&(h.y<=l.bottom&&h.y>=a.y||a.y>=c.top&&a.y<=h.y?(s===0||s===180)&&(u.i(a.x,Math.min((a.y+h.y)/2,a.y)),d.i(h.x,u.y)):(s===180||(s===90||s===270)&&h.x<a.x?u.x=Math.min(h.x,s===270?l.left:Math.min(l.left,c.left)):u.x=Math.max(h.x,s===270?l.right:Math.max(l.right,c.right)),d.x=u.x,d.y=h.y))),this.yN=s!==r,this.dN=e,this.gN=s,this.addPoint(u.copy()),this.addPoint(d.copy()),P.e(u),P.e(d)}computeMidOrthoPosition(t,e,i,s,n){let o=0;return this.hasCurviness()&&!this.computeSpot(!0,this.fromPort).isSide()&&!this.computeSpot(!1,this.toPort).isSide()&&(o=this.computeCurviness()),n?(e+s)/2+o:(t+i)/2+o}JL(){if(this.diagram===null||!this.isAvoiding||this.diagram.animationManager.isTicking)return!1;let t=this.points.r,e=t.length;if(e<4)return!1;let i=this.diagram.getPositions(!1,this.containingGroup,null);for(let s=1;s<e-2;s++){let n=t[s],o=t[s+1];if(!i.isUnoccupied(Math.min(n.x,o.x),Math.min(n.y,o.y),Math.abs(n.x-o.x),Math.abs(n.y-o.y)))return!0}return!1}findClosestSegment(t){let e=t.x,i=t.y,s=this.getPoint(0),n=this.getPoint(1),o=P.distanceLineSegmentSquared(e,i,s.x,s.y,n.x,n.y),r=0;for(let a=1;a<this.pointsCount-1;a++){s=this.getPoint(a+1);let h=P.distanceLineSegmentSquared(e,i,n.x,n.y,s.x,s.y);n=s,h<o&&(r=a,o=h)}return r}ee(){this.kh=!1,this.c()}get kh(){return(this.Mt&128)!==0}set kh(t){(this.Mt&128)!==0!==t&&(this.Mt=this.Mt^128)}get geometry(){if(!this.kh){if(this.updateRoute(),this.pointsCount<2)return this.kh=!0,this.ot;this.ot=this.makeGeometry()}return this.ot}sd(t){if(!t){if(this.Se===!1)return;let n=this.findMainElement();if(this.kh&&(n===null||n.geometry!==null))return}this.pointsCount<2?this.kh=!0:this.ot=this.makeGeometry();let e=this.path;if(e===null)return;e.ot=this.ot;let i=this.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o!==e&&o.isPanelMain&&o instanceof ct&&(o.ot=this.ot)}}SO(t){return this.Ba()&&t.$l.has(this)&&(this.Sf.width!==0||this.Sf.height!==0)&&(t.animationManager.isAnimating||t.currentTool!==t.toolManager)}makeGeometry(){let t=this.ot,e=this.pointsCount,i=!1,s=this.diagram;s!==null&&this.SO(s)&&(i=!0);let n=0,o=0,r=this.getPoint(0).copy(),a=r.copy(),h=this.xi.r,l=this.computeCurve();if(l===9&&e>=3&&!L.z(this.smoothness,0))if(e===3){let c=this.getPoint(1);n=Math.min(r.x,c.x),o=Math.min(r.y,c.y),c=this.getPoint(2),n=Math.min(n,c.x),o=Math.min(o,c.y)}else if(this.isOrthogonal){for(let c=0;c<e;c++){let u=h[c];a.x=Math.min(u.x,a.x),a.y=Math.min(u.y,a.y)}n=a.x,o=a.y}else{for(let c=3;c<e;c+=3){c+3>=e&&(c=e-1);let u=this.getPoint(c);a.x=Math.min(u.x,a.x),a.y=Math.min(u.y,a.y)}n=a.x,o=a.y}else{for(let c=0;c<e;c++){let u=h[c];a.x=Math.min(u.x,a.x),a.y=Math.min(u.y,a.y)}n=a.x,o=a.y}if(n-=this.k1.x,o-=this.k1.y,r.x-=n,r.y-=o,e===2&&!this.Ba()){let c=this.getPoint(1).copy();return c.x-=n,c.y-=o,this.computeShortLength(!0)!==0&&(r=this.Nf(r,!0,a)),this.computeShortLength(!1)!==0&&(c=this.Nf(c,!1,a)),t.type=1,t.startX=r.x,t.startY=r.y,t.endX=c.x,t.endY=c.y,this.kh=!0,t}else{t.type=4;let c=Ke.vC(t);if(this.computeShortLength(!0)!==0&&(r=this.Nf(r,!0,a)),c.hu(r.x,r.y,!1,!1),l===9&&e>=3&&!L.z(this.smoothness,0))if(e===3){let u=this.getPoint(1),d=u.x-n,g=u.y-o,p=this.getPoint(2).copy();p.x-=n,p.y-=o,this.computeShortLength(!1)!==0&&(p=this.Nf(p,!1,a)),c.hr(d,g,d,g,p.x,p.y)}else if(this.isOrthogonal){let u=P.V(n,o),d=P.l();d.a(this.getPoint(1));let g=P.V(n,o),p=P.V(n,o),m=this.getPoint(0),y=null,w=this.smoothness/3;for(let S=1;S<this.pointsCount-1;S++){y=this.getPoint(S);let M=m,F=y,T=this.getPoint(this.xN(y,S,!1));L.z(M.x,F.x)&&L.z(F.x,T.x)||L.z(M.y,F.y)&&L.z(F.y,T.y)||(this.MO(M,F,T,w,g,p),(S===1||S===2&&L.z(m.x,this.getPoint(0).x)&&L.z(m.y,this.getPoint(0).y))&&(d.x=(m.x+y.x)*.5,d.y=(m.y+y.y)*.5),c.hr(d.x-n,d.y-o,g.x-n,g.y-o,y.x-n,y.y-o),u.set(g),d.set(p),m=y)}let b=m.x,v=m.y,k=this.getPoint(this.pointsCount-1);this.computeShortLength(!1)!==0&&(k=this.Nf(k.copy(),!1,P.xo)),b=.5*(b+k.x),v=.5*(v+k.y),c.hr(p.x-n,p.y-o,b-n,v-o,k.x-n,k.y-o),P.e(u),P.e(d),P.e(g),P.e(p)}else for(let u=3;u<e;u+=3){let d=this.getPoint(u-2);u+3>=e&&(u=e-1);let g=this.getPoint(u-1),p=this.getPoint(u);u===e-1&&this.computeShortLength(!1)!==0&&(p=this.Nf(p.copy(),!1,P.xo)),c.hr(d.x-n,d.y-o,g.x-n,g.y-o,p.x-n,p.y-o)}else{let u=P.l();u.a(this.getPoint(0));let d=P.l();d.a(u);let g=this.computeCorner(),p=1,m=0;for(;p<e;){p=this.xN(u,p,p>1);let y=this.getPoint(p);if(p>=e-1){if(!u.equals(y))this.computeShortLength(!1)!==0&&(y=this.Nf(y.copy(),!1,P.xo)),this.xn(c,-n,-o,u,y,i);else if(m===0)for(p=1;p<e;)d.a(u),y=this.getPoint(p++),this.xn(c,-n,-o,u,y,i),u.a(y);break}m=this.xN(y,p+1,p<e-3);let w=this.getPoint(m);this.NO(c,-n,-o,u,y,w,u,d,g,i),d.a(y),p=m}P.e(u)}return Ke.OC(c),this.kh=!0,t}}A1(t,e,i,s){let n=i-t;if(isNaN(n)||n===1/0||n===-1/0)return NaN;n<0&&(n=-n);let o=s-e;return isNaN(o)||o===1/0||o===-1/0?NaN:(o<0&&(o=-o),L.z(n,0)?o:L.z(o,0)?n:Math.sqrt(n*n+o*o))}MO(t,e,i,s,n,o){isNaN(s)&&(s=this.smoothness/3);let r=t.x,a=t.y,h=e.x,l=e.y,c=i.x,u=i.y,d=s*this.A1(r,a,h,l),g=s*this.A1(h,l,c,u);if(L.z(a,l)&&L.z(h,c)&&(h>r?u>l?(n.x=h-d,n.y=l-d,o.x=h+g,o.y=l+g):(n.x=h-d,n.y=l+d,o.x=h+g,o.y=l-g):u>l?(n.x=h+d,n.y=l-d,o.x=h-g,o.y=l+g):(n.x=h+d,n.y=l+d,o.x=h-g,o.y=l-g)),L.z(r,h)&&L.z(l,u)&&(l>a?c>h?(n.x=h-d,n.y=l-d,o.x=h+g,o.y=l+g):(n.x=h+d,n.y=l-d,o.x=h-g,o.y=l+g):c>h?(n.x=h-d,n.y=l+d,o.x=h+g,o.y=l-g):(n.x=h+d,n.y=l+d,o.x=h-g,o.y=l-g)),L.z(r,h)&&L.z(h,c)||L.z(a,l)&&L.z(l,u)){let p=.5*(r+c),m=.5*(a+u);n.x=p,n.y=m,o.x=p,o.y=m}}Nf(t,e,i){let s=this.pointsCount;if(s<2)return t;if(e){let n=this.getPoint(1),o=n.x-i.x,r=n.y-i.y,a=this.A1(t.x,t.y,o,r);if(a===0)return t;let h=s===2?a*.5:a,l=this.computeShortLength(!0);l>h&&(l=h);let c=l*(o-t.x)/a,u=l*(r-t.y)/a;t.x+=c,t.y+=u}else{let n=this.getPoint(s-2),o=n.x-i.x,r=n.y-i.y,a=this.A1(t.x,t.y,o,r);if(a===0)return t;let h=s===2?a*.5:a,l=this.computeShortLength(!1);l>h&&(l=h);let c=l*(t.x-o)/a,u=l*(t.y-r)/a;t.x-=c,t.y-=u}return t}xN(t,e,i){let s=this.pointsCount,n=t;for(;L.z(t.x,n.x)&&L.z(t.y,n.y);){if(e>=s)return s-1;n=this.getPoint(e++)}if(!L.z(t.x,n.x)&&!L.z(t.y,n.y))return e-1;let o=n;for(;L.z(t.x,n.x)&&L.z(n.x,o.x)&&(!i||(t.y>=n.y?n.y>=o.y:n.y<=o.y))||L.z(t.y,n.y)&&L.z(n.y,o.y)&&(!i||(t.x>=n.x?n.x>=o.x:n.x<=o.x));){if(e>=s)return s-1;o=this.getPoint(e++)}return e-2}NO(t,e,i,s,n,o,r,a,h,l){if(L.f(s.y,n.y)&&L.f(n.x,o.x)){let c=Math.min(h,Math.abs(n.x-a.x)/2),u=Math.min(c,Math.abs(o.y-n.y)/2);if(c=u,L.f(c,0)){this.xn(t,e,i,s,n,l),r.a(n);return}let d=n.x,g=n.y,p=d,m=g;n.x>s.x?(d=n.x-c,o.y>n.y?m=n.y+u:m=n.y-u):(d=n.x+c,o.y>n.y?m=n.y+u:m=n.y-u);let y=P.V(d,g);this.xn(t,e,i,s,y,l),P.e(y),t.Nw(n.x+e,n.y+i,p+e,m+i),r.i(p,m)}else if(L.f(s.x,n.x)&&L.f(n.y,o.y)){let c=Math.min(h,Math.abs(n.y-a.y)/2),u=Math.min(c,Math.abs(o.x-n.x)/2);if(c=u,L.f(u,0)){this.xn(t,e,i,s,n,l),r.a(n);return}let d=n.x,g=n.y,p=d,m=g;n.y>s.y?(g=n.y-c,o.x>n.x?p=n.x+u:p=n.x-u):(g=n.y+c,o.x>n.x?p=n.x+u:p=n.x-u);let y=P.V(d,g);this.xn(t,e,i,s,y,l),P.e(y),t.Nw(n.x+e,n.y+i,p+e,m+i),r.i(p,m)}else this.xn(t,e,i,s,n,l),r.a(n)}computeJumpLength(){return 10}xn(t,e,i,s,n,o){if(o||!this.Ba())t.lr(n.x+e,n.y+i);else{let r=this.computeJumpLength(),a=r/2,h=[],l=0;this.isVisible()&&(l=this.CO(s,n,h));let c=s.x,u=s.y;if(l>0){if(L.f(s.y,n.y))if(s.x<n.x){let d=0;for(;d<l;){let g=Math.max(s.x,Math.min(h[d++]-a,n.x-r));t.lr(g+e,n.y+i),c=g+e,u=n.y+i;let p=Math.min(g+r,n.x);for(;d<l;){let b=h[d];if(b<p+r)d++,p=Math.min(b+a,n.x);else break}let m=n.y-r+i,y=p+e,w=n.y+i;this.curve===10?t.hu(y,w,!1,!1):t.hr(c,m,y,m,y,w),c=y,u=w}}else{let d=l-1;for(;d>=0;){let g=Math.min(s.x,Math.max(h[d--]+a,n.x+r));t.lr(g+e,n.y+i),c=g+e,u=n.y+i;let p=Math.max(g-r,n.x);for(;d>=0;){let b=h[d];if(b>p-r)d--,p=Math.max(b-a,n.x);else break}let m=n.y-r+i,y=p+e,w=n.y+i;this.curve===10?t.hu(y,w,!1,!1):t.hr(c,m,y,m,y,w),c=y,u=w}}else if(L.f(s.x,n.x))if(s.y<n.y){let d=0;for(;d<l;){let g=Math.max(s.y,Math.min(h[d++]-a,n.y-r));t.lr(n.x+e,g+i),c=n.x+e,u=g+i;let p=Math.min(g+r,n.y);for(;d<l;){let b=h[d];if(b<p+r)d++,p=Math.min(b+a,n.y);else break}let m=n.x-r+e,y=n.x+e,w=p+i;this.curve===10?t.hu(y,w,!1,!1):t.hr(m,u,m,w,y,w),c=y,u=w}}else{let d=l-1;for(;d>=0;){let g=Math.min(s.y,Math.max(h[d--]+a,n.y+r));t.lr(n.x+e,g+i),c=n.x+e,u=g+i;let p=Math.max(g-r,n.y);for(;d>=0;){let b=h[d];if(b>p-r)d--,p=Math.max(b-a,n.y);else break}let m=n.x-r+e,y=n.x+e,w=p+i;this.curve===10?t.hu(y,w,!1,!1):t.hr(m,u,m,w,y,w),c=y,u=w}}}t.lr(n.x+e,n.y+i)}}CO(t,e,i){let s=this.diagram;if(s===null||t.equals(e))return 0;let n=s.layers;for(;n.next();){let o=n.value;if(o!==null&&o.visible){let r=o.qS(),a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!(l instanceof _))continue;if(l===this)return i.length>0&&i.sort((d,g)=>d-g),i.length;if(!l.isVisible()||!l.Ba())continue;let c=l.routeBounds;if(!c.isReal()||!this.routeBounds.intersectsRect(c)||this.usesSamePort(l))continue;let u=l.path;u!==null&&u.isVisibleObject()&&this.LO(t,e,i,l)}}}return i.length>0&&i.sort((o,r)=>o-r),i.length}LO(t,e,i,s){let n=L.f(t.y,e.y),o=s.pointsCount,r=s.getPoint(0),a=P.l();for(let h=1;h<o;h++){let l=s.getPoint(h);if(h<o-1){let c=s.getPoint(h+1);if(r.y===l.y&&l.y===c.y){if(l.x>r.x&&c.x>=l.x||l.x<r.x&&c.x<=l.x)continue}else if(r.x===l.x&&l.x===c.x&&(l.y>r.y&&c.y>=l.y||l.y<r.y&&c.y<=l.y))continue}this.AO(t,e,r,l,a)&&(n?i.push(a.x):i.push(a.y)),r=l}P.e(a)}AO(t,e,i,s,n){let o=t.x,r=t.y,a=e.x,h=e.y,l=i.x,c=i.y,u=s.x,d=s.y;if(L.f(o,a)){if(!L.f(r,h)&&L.f(c,d)&&Math.min(r,h)<c&&Math.max(r,h)>c&&Math.min(l,u)<o&&Math.max(l,u)>o&&!L.f(l,u))return n.x=o,n.y=c,!0}else if(L.f(r,h)&&L.f(l,u)&&Math.min(o,a)<l&&Math.max(o,a)>l&&Math.min(c,d)<r&&Math.max(c,d)>r&&!L.f(c,d))return n.x=l,n.y=r,!0;return n.x=0,n.y=0,!1}get firstPickIndex(){return this.pointsCount<=2?0:this.isOrthogonal||!this.Dd(this.computeSpot(!0))?1:0}get lastPickIndex(){let t=this.pointsCount;return t===0?0:t<=2?t-1:this.isOrthogonal||!this.Dd(this.computeSpot(!1))?t-2:t-1}Ba(){let t=this.curve;return t===11||t===10}M1(t){if(t||this.Ba()){let e=this.diagram;e!==null&&!e.animationManager.isTicking&&!e.$l.has(this)&&(this.Sf.width!==0||this.Sf.height!==0)&&e.$l.set(this,this.Sf.copy())}}invalidateOtherJumpOvers(t){let e=this.layer;if(e===null||!e.visible||e.isTemporary)return;let i=e.diagram;if(i===null||i.animationManager.isTicking)return;let s=!1,n=i.layers;for(;n.next();){let o=n.value;if(o.visible){if(o===e){s=!0;let r=!1,a=o.qS(),h=a.length;for(let l=0;l<h;l++){let c=a[l];c instanceof _&&(c===this?r=!0:r&&this.NT(c,t))}}else if(s){let r=o.qS(),a=r.length;for(let h=0;h<a;h++){let l=r[h];l instanceof _&&this.NT(l,t)}}}}}NT(t,e){if(t===null||!t.kh||!t.Se||!t.Ba())return;let i=t.routeBounds;i.isReal()&&(!this.routeBounds.intersectsRect(i)&&!e.intersectsRect(i)||this.usesSamePort(t)||t.ee())}usesSamePort(t){let e=this.pointsCount,i=t.pointsCount;if(e>0&&i>0){let s=this.getPoint(0),n=t.getPoint(0);if(s.equalsApprox(n))return!0;let o=this.getPoint(e-1),r=t.getPoint(i-1);if(o.equalsApprox(r)||s.equalsApprox(r)||o.equalsApprox(n))return!0}else if(this.fromNode===t.fromNode||this.toNode===t.toNode||this.fromNode===t.toNode||this.toNode===t.fromNode)return!0;return!1}isVisible(){if(!super.isVisible())return!1;let t=this.containingGroup,e=!0,i=this.diagram;i!==null&&(e=i.isTreePathToChildren);let s=this.fromNode;if(s!==null){if(this.isTreeLink&&e&&!s.isTreeExpanded)return!1;if(s===t)return!0;let o=s;for(;o!==null;){if(o.labeledLink===this)return!0;o=o.containingGroup}let r=s.findVisibleNode();if(r===null||r===t)return!1}let n=this.toNode;if(n!==null){if(this.isTreeLink&&!e&&!n.isTreeExpanded)return!1;if(n===t)return!0;let o=n;for(;o!==null;){if(o.labeledLink===this)return!0;o=o.containingGroup}let r=n.findVisibleNode();if(r===null||r===t)return!1}return!0}Ei(t){if(super.Ei(t),t&&this.M1(!1),this.jo!==null&&this.jo.Sd(),this.js!==null){let e=this.js.iterator;for(;e.next();)e.value.Ei(t)}}get adjusting(){return this.Pf}set adjusting(t){let e=this.Pf;e!==t&&(this.Pf=t,this.t("adjusting",e,t))}computeAdjusting(){return this.isAvoiding&&this.diagram!==null&&this.diagram.animationManager.defaultAnimation.isAnimating?17:this.Pf}get corner(){return this.Cd}set corner(t){let e=this.Cd;e!==t&&(this.Cd=t,this.ee(),this.t("corner",e,t))}get curve(){return this.Ld}set curve(t){let e=this.Ld;e!==t&&(this.Ld=t,this.invalidateRoute(),this.ee(),this.M1(e===10||e===11||t===10||t===11),this.t("curve",e,t))}get curviness(){return this.Ad}set curviness(t){let e=this.Ad;e!==t&&(this.Ad=t,this.invalidateRoute(),this.ee(),this.t("curviness",e,t))}get routing(){return this.va}set routing(t){let e=this.va;e!==t&&(this.va=t,this.isAvoiding&&this.diagram!==null&&(this.diagram.Vm=!0),this.Ko=null,this.invalidateRoute(),this.M1(_.mN(e)||_.mN(t)),this.t("routing",e,t))}get smoothness(){return this.Td}set smoothness(t){let e=this.Td;e!==t&&(this.Td=t,this.ee(),this.t("smoothness",e,t))}wy(){let t=this.so;if(t===null)return;let e=this.oo;if(e===null||!isNaN(this.curviness))return;let i=this.no,s=this.ro,n=null,o=null,r=t.ti.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];!(l.so===t&&l.no===i&&l.oo===e&&l.ro===s)&&!(l.so===e&&l.no===s&&l.oo===t&&l.ro===i)||(o===null?o=l:(n===null&&(n=[],n.push(o)),n.push(l)))}if(n!==null){let h=t.pT(e,i,s);h===null&&(h=new pr(t,i,e,s),t.gT(h),e.gT(h)),h.Hs=n;for(let l=0;l<n.length;l++){let c=n[l];c.jo=h}h.Sd()}}yy(){let t=this.jo;if(t!==null){if(!isNaN(this.curviness))return;this.jo=null;let e=t.Hs.indexOf(this);e>=0&&(t.Hs.splice(e,1),t.Sd())}}Cl(){return!0}get key(){let t=this.diagram;if(!(t===null||!t.model.Ra()))return t.model.getKeyForLinkData(this.data)}}class pr{Fo;Is;ny;lN;p1;hN;Hs;constructor(t,e,i,s){I.Ki(this),this.Fo=!1,this.Is=!1,this.ny=t,this.lN=e,this.p1=i,this.hN=s,this.Hs=[]}Sd(){if(!this.Fo){let t=this.Hs;if(t.length>0){let e=t[0].diagram;e!==null&&(e.wM.add(this),this.Is=e.undoManager.isUndoingRedoing)}}this.Fo=!0}RM(){if(this.Fo){this.Fo=!1;let t=this.Hs;if(t.length>0){let e=t[0],i=e.diagram,s=i===null||i.Vh&&!this.Is;this.Is=!1,e.arrangeBundledLinks(t,s),t.length===1&&(e.jo=null,t.length=0)}t.length===0&&(this.ny.mT(this),this.p1.mT(this))}}}class Et{oe;re;Va;za;di;gi;Vt;Ph;Sh;ua;jM;Fo;by;Yc;HM;qM;constructor(t){I.Ki(this),this.ua=null,this.jM=null,this.Fo=!0,this.by=!1,this.oe=1,this.re=1,this.Va=-1,this.za=-1,this.di=t.width,this.gi=t.height,this.Vt=[],this.Ph=0,this.Sh=0,this.Yc=11,this.HM=this.Yc*2,this.qM=this.Yc*2}static qs=0;static Xa=1;static Rd=999999;static bN=Et.Rd+1;static kN=Et.Rd+2;Lb(t){if(t.width<=0||t.height<=0)return;let e=t.x,i=t.y,s=t.x+t.width,n=t.y+t.height;this.oe=Math.floor((e-this.di)/this.di)*this.di,this.re=Math.floor((i-this.gi)/this.gi)*this.gi,this.Va=Math.ceil((s+2*this.di)/this.di)*this.di,this.za=Math.ceil((n+2*this.gi)/this.gi)*this.gi;let o=1+(Math.ceil((this.Va-this.oe)/this.di)|0),r=1+(Math.ceil((this.za-this.re)/this.gi)|0);if(this.Vt.length===0||this.Ph<o-1||this.Sh<r-1){let a=[];for(let h=0;h<=o;h++)a[h]=new Uint32Array(r);this.Vt=a,this.Ph=o-1,this.Sh=r-1}this.TO(Et.bN)}get bounds(){return new z(this.oe,this.re,this.Va-this.oe,this.za-this.re)}get cellWidth(){return this.di}set cellWidth(t){t>0&&t!==this.di&&(this.di=t,this.Lb(this.bounds))}get cellHeight(){return this.gi}set cellHeight(t){t>0&&t!==this.gi&&(this.gi=t,this.Lb(this.bounds))}vd(t,e){return this.oe<=t&&t<=this.Va&&this.re<=e&&e<=this.za}lo(t,e){if(!this.vd(t,e))return Et.bN;t-=this.oe,t/=this.di,e-=this.re,e/=this.gi;let i=t|0,s=e|0;return this.Vt[i][s]}VR(t,e,i,s){if(!this.vd(t,e))return;let n=(t-this.oe)/this.di|0,o=(e-this.re)/this.gi|0,r=(t+i-this.oe)/this.di|0,a=(e+s-this.re)/this.gi|0,h=Math.min(r,this.Ph),l=Math.min(a,this.Sh);for(let c=n;c<=h;c++){let u=this.Vt[c];if(u.fill)u.fill(Et.qs,o,l+1);else for(let d=o;d<=l;d++)u[d]=Et.qs}}TO(t){for(let e=0;e<=this.Ph;e++){let i=this.Vt[e];if(i.fill)i.fill(t);else for(let s=0;s<=this.Sh;s++)i[s]=t}}lA(){for(let t=0;t<=this.Ph;t++){let e=this.Vt[t];for(let i=0;i<=this.Sh;i++)e[i]>=Et.Xa&&(e[i]=Et.bN)}}DO(t,e){return this.lo(t,e)===Et.qs}isUnoccupied(t,e,i,s){if(t>this.Va||t+i<this.oe||e>this.za||e+s<this.re)return!0;let n=(t-this.oe)/this.di|0,o=(e-this.re)/this.gi|0,r=Math.max(0,i)/this.di+1|0,a=Math.max(0,s)/this.gi+1|0;if(n<0&&(r+=n,n=0),o<0&&(a+=o,o=0),r<0||a<0)return!0;let h=Math.min(n+r-1,this.Ph)|0,l=Math.min(o+a-1,this.Sh)|0;for(let c=n;c<=h;c++){let u=this.Vt[c];for(let d=o;d<=l;d++)if(u[d]===Et.qs)return!1}return!0}maxAvoidsLinksSpaceH(t,e,i,s){if(t>this.Va||e<this.oe||i>this.za||i<this.re)return 0;let n=(t-this.oe)/this.di|0,o=(e-this.oe)/this.di|0,r=(i-this.re)/this.gi|0,a=s/this.gi+1|0,h;for(h=0;h<a/2;h++){let l=!1;for(let c=n;c<=o;c++)if(this.Vt[c][r+h]===Et.qs||this.Vt[c][r-h]===Et.qs){l=!0;break}if(l)return Math.max(0,(2*h-1)*this.gi)}return s}maxAvoidsLinksSpaceV(t,e,i,s){if(t>this.za||e<this.re||i>this.Va||i<this.oe)return 0;let n=(t-this.re)/this.gi|0,o=(e-this.re)/this.gi|0,r=(i-this.oe)/this.di|0,a=s/this.di+1|0,h;for(h=0;h<a/2;h++){let l=!1;for(let c=n;c<=o;c++)if(this.Vt[r+h][c]===Et.qs||this.Vt[r-h][c]===Et.qs){l=!0;break}if(l)return Math.max(0,(2*h-1)*this.di)}return s}FO(t,e,i,s,n,o,r,a){t=t|0,e=e|0;let h=this.Vt[t][e];if(h>=Et.Xa&&h<Et.Rd)for(s?e+=i:t+=i,h+=1;n<=t&&t<=o&&r<=e&&e<=a;){let l=this.Vt[t][e];if(h>=l)break;this.Vt[t][e]=h,h+=1,s?e+=i:t+=i}return s?e:t}ho(t,e,i,s,n,o,r,a){if(t<n||t>o||e<r||e>a)return;let h=this.FO(t,e,i,s,n,o,r,a);if(s)if(i>0)for(let l=e+i;l<h;l+=i)this.ho(t,l,1,!s,n,o,r,a),this.ho(t,l,-1,!s,n,o,r,a);else for(let l=e+i;l>h;l+=i)this.ho(t,l,1,!s,n,o,r,a),this.ho(t,l,-1,!s,n,o,r,a);else if(i>0)for(let l=t+i;l<h;l+=i)this.ho(l,e,1,!s,n,o,r,a),this.ho(l,e,-1,!s,n,o,r,a);else for(let l=t+i;l>h;l+=i)this.ho(l,e,1,!s,n,o,r,a),this.ho(l,e,-1,!s,n,o,r,a)}T1(t,e,i,s,n,o,r,a,h,l){let c=t|0,u=e|0,d=Et.qs,g=Et.Xa;for(this.Vt[c][u]=g;d===Et.qs&&c>r&&c<a&&u>h&&u<l;)g+=1,this.Vt[c][u]=g,o?u+=n:c+=n,d=this.Vt[c][u];return o?u:c}D1(t,e,i,s,n,o,r,a,h,l){let c=i|0,u=s|0,d=Et.qs,g=Et.Rd;for(this.Vt[c][u]=g;d===Et.qs&&c>r&&c<a&&u>h&&u<l;)this.Vt[c][u]=g,o?u+=n:c+=n,d=this.Vt[c][u]}CT(t,e,i,s,n,o){this.by=!1;let r=t.x,a=t.y;if(!this.vd(r,a))return;r-=this.oe,r/=this.di,a-=this.re,a/=this.gi;let h=i.x,l=i.y;if(!this.vd(h,l))return;if(h-=this.oe,h/=this.di,l-=this.re,l/=this.gi,Math.abs(r-h)<=1&&Math.abs(a-l)<=1){this.by=!0;return}let c=n.x,u=n.y,d=n.x+n.width,g=n.y+n.height;c-=this.oe,c/=this.di,u-=this.re,u/=this.gi,d-=this.oe,d/=this.di,g-=this.re,g/=this.gi;let p=Math.max(0,Math.min(this.Ph,c|0)),m=Math.min(this.Ph,Math.max(0,d|0)),y=Math.max(0,Math.min(this.Sh,u|0)),w=Math.min(this.Sh,Math.max(0,g|0)),b=0,v=90,k=270,S=this.Vt,M=r|0,F=a|0,T=h|0,N=l|0,C=e===b||e===v?1:-1,R=e===v||e===k;S[M][F]===Et.qs?(this.T1(M,F,T,N,C,R,p,m,y,w),this.T1(M,F,T,N,1,!R,p,m,y,w),this.T1(M,F,T,N,-1,!R,p,m,y,w)):this.T1(M,F,T,N,C,R,M,F,M,F),S[T][N]===Et.qs?(this.D1(M,F,T,N,s===b||s===v?1:-1,s===v||s===k,p,m,y,w),this.D1(M,F,T,N,1,!(s===v||s===k),p,m,y,w),this.D1(M,F,T,N,-1,!(s===v||s===k),p,m,y,w)):this.D1(M,F,T,N,C,R,T,N,T,N);let O=f.et();if(o&&this.LT(T,N,s,M,F,O)){(O[0]!==T||O[1]!==N)&&(O.unshift(N),O.unshift(T)),(O[O.length-2]!==M||O[O.length-1]!==F)&&(O.push(M),O.push(F));let B=Et.Xa,X=O[O.length-2],Y=O[O.length-1];S[X][Y]=B++;for(let j=O.length-4;j>=0;j-=2){X=O[j+2],Y=O[j+3];let U=O[j],nt=O[j+1];for(;U>X?X++:U<X?X--:nt>Y?Y++:nt<Y&&Y--,S[X][Y]=B++,!(X===U&&Y===nt););}}else this.ho(M,F,1,!1,p,m,y,w),this.ho(M,F,-1,!1,p,m,y,w),this.ho(M,F,1,!0,p,m,y,w),this.ho(M,F,-1,!0,p,m,y,w);f.J(O)}LT(t,e,i,s,n,o){let r=this.Vt,a=t,h=e;for(;;){if(a===s&&h===n)return!0;let l=a,c=h;if(i===0)if(l<s)l++;else break;else if(i===90)if(c<n)c++;else break;else if(i===180)if(l>s)l--;else break;else if(c>n)c--;else break;let u=r[l][c];if(u===0||u===Et.kN)break;a=l,h=c}for(;;){let l=i,c=a,u=h;i===0?u<n?(l=90,u++):u>n&&(l=270,u--):i===90?c<s?(l=0,c++):c>s&&(l=180,c--):i===180?u<n?(l=90,u++):u>n&&(l=270,u--):c<s?(l=0,c++):c>s&&(l=180,c--);let d=r[c][u];if(l!==i&&d!==0&&d!==Et.kN){if(o.push(a),o.push(h),this.LT(a,h,l,s,n,o))return!0;o.pop(),o.pop()}if(r[a][h]=Et.kN,i===0){if(a===t)return!1;a--}else if(i===90){if(h===e)return!1;h--}else if(i===180){if(a===t)return!1;a++}else{if(h===e)return!1;h++}}}}class Fs{Me;al;os;Od;constructor(t,e){I.Ki(this),this.Me=t,this.al=e,this.os=[],this.Od=!1}toString(){let t=this.os,e=this.Me.toString()+" "+t.length.toString()+":";for(let i=0;i<t.length;i++){let s=t[i];s!==null&&(e+=`
15
+ `+s.toString())}return e}RO(t,e,i,s){let n=e.offsetY;switch(n){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}let o=i;switch(n){case 9:return o>180?270:90;case 6:return o>90&&o<=270?180:0}let r=Math.atan2(t.height,t.width)*180/Math.PI;switch(n){case 3:return o>r&&o<=180+r?180:270;case 5:return o>180-r&&o<=360-r?270:0;case 12:return o>r&&o<=180+r?90:0;case 10:return o>180-r&&o<=360-r?180:90;case 7:return o>90&&o<=180+r?180:o>180+r&&o<=360-r?270:0;case 13:return o>180&&o<=360-r?270:o>r&&o<=180?90:0;case 14:return o>r&&o<=180-r?90:o>180-r&&o<=270?180:0;case 11:return o>180-r&&o<=180+r?180:o>180+r?270:90}return s&&n!==15&&(o-=15,o<0&&(o+=360)),o>r&&o<180-r?90:o>=180-r&&o<=180+r?180:o>180+r&&o<360-r?270:0}Sd(){this.os.length=0}MT(t){let e=this.os;e.length===0&&(this.vO(),e=this.os);for(let i=0;i<e.length;i++){let s=e[i];if(s!==null&&s.Ke===t)return s}return null}vO(){if(!this.Od){let t=this.Od;this.Od=!0;let e,i=null,s=this.Me,n=s instanceof ft?s:null;if(n!==null&&!n.isSubGraphExpanded){if(!n.actualBounds.isReal())return this.Od=t,this.os;i=n,e=i.findExternalLinksConnected()}else s.isTreeExpanded?e=s.findLinksConnected(this.al.portId):e=s.findExternalTreeLinksConnected();this.os.length=0;let o=0,r=this.al.getDocumentPoint(D.TopLeft,P.l()),a=this.al.getDocumentPoint(D.BottomRight,P.l()),h=z.V(r.x,r.y,0,0);h.unionPoint(a),P.e(r),P.e(a);let l=P.V(h.x+h.width/2,h.y+h.height/2),c=this.al.getDocumentAngle(),u=e.iterator;for(;u.next();){let m=u.value;if(!m.isVisible()||m.fromPort===m.toPort)continue;let y=m.fromPort===this.al||m.fromNode!==null&&i!==null&&m.fromNode.isMemberOf(i),w=m.computeSpot(y,this.al);if(!w.isSide())continue;let b;if(y?b=m.toPort:b=m.fromPort,b===null)continue;let v=b.part;if(v===null)continue;let k=v.findVisibleNode();k!==null&&k!==v&&(v=k,b=v.port);let S=m.computeOtherPoint(v,b),M=l.directionPoint(S);M-=c,M<0?M+=360:M>=360&&(M-=360);let F=this.RO(h,w,M,m.isOrthogonal),T=0;F===0?(T=4,M>180&&(M-=360)):F===90?(T=8,M>270&&(M-=360)):F===180?T=2:(T=1,M<90&&(M+=360));let N=this.os[o];N===void 0?(N=new yr(m,M,T),this.os[o]=N):(N.Ke=m,N.Gt=M,N.me=T),N.F1.set(S),o++}P.e(l),this.OO();let d=this.os.length,g=-1,p=0;for(o=0;o<d;o++){let m=this.os[o];m!==void 0&&(m.me!==g&&(g=m.me,p=0),m.Id=p,p++)}for(g=-1,p=0,o=d-1;o>=0;o--){let m=this.os[o];m!==void 0&&(m.me!==g&&(g=m.me,p=m.Id+1),m.Mf=p)}this.IO(this.os),this.EO(this.os),this.Od=t,z.e(h)}return this.os}UO(t,e){return t===e?0:t===null?-1:e===null?1:t.me<e.me?-1:t.me>e.me?1:t.Gt<e.Gt?-1:t.Gt>e.Gt?1:0}OO(){this.os.sort(Fs.prototype.UO)}IO(t){let e=this.al,i=this.Me.portSpreading,s=P.l(),n=P.l(),o=P.l(),r=P.l();e.getDocumentPoint(D.TopLeft,s),e.getDocumentPoint(D.TopRight,n),e.getDocumentPoint(D.BottomRight,o),e.getDocumentPoint(D.BottomLeft,r);let a=0,h=0,l=0,c=0;if(i===2)for(let b=0;b<t.length;b++){let v=t[b];if(v===null)continue;let k=v.Ke.computeThickness();switch(v.me){case 8:l+=k;break;case 2:c+=k;break;case 1:a+=k;break;default:case 4:h+=k;break}}let u=0,d=0,g=1,p=n,m=o,y=0,w=0;for(let b=0;b<t.length;b++){let v=t[b];if(v===null)continue;if(u!==v.me){switch(u=v.me,u){case 8:p=o,m=r;break;case 2:p=r,m=s;break;case 1:p=s,m=n;break;default:case 4:p=n,m=o;break}switch(y=m.x-p.x,w=m.y-p.y,u){case 8:l>Math.abs(y)?(g=Math.abs(y)/l,l=Math.abs(y)):g=1;break;case 2:c>Math.abs(w)?(g=Math.abs(w)/c,c=Math.abs(w)):g=1;break;case 1:a>Math.abs(y)?(g=Math.abs(y)/a,a=Math.abs(y)):g=1;break;default:case 4:h>Math.abs(w)?(g=Math.abs(w)/h,h=Math.abs(w)):g=1;break}d=0}let k=v.Fd;if(i===2){let S=v.Ke.computeThickness();switch(S*=g,k.set(p),u){case 8:k.x=p.x+y/2+l/2-d-S/2;break;case 2:k.y=p.y+w/2+c/2-d-S/2;break;case 1:k.x=p.x+y/2-a/2+d+S/2;break;default:case 4:k.y=p.y+w/2-h/2+d+S/2;break}d+=S}else{let S=.5;i===1&&(S=(v.Id+1)/(v.Mf+1)),k.x=p.x+y*S,k.y=p.y+w*S}}P.e(s),P.e(n),P.e(o),P.e(r)}EO(t){for(let e=0;e<t.length;e++){let i=t[e];i!==null&&(i.L1=this.BO(i))}}BO(t){let e=t.Ke,i=e.fromPort===this.al,s=e.computeEndSegmentLength(this.Me,this.al,D.None,i),n=t.Id;if(n<0)return s;let o=t.Mf;if(o<=1||!e.isOrthogonal)return s;let r=t.F1,a=t.Fd;(t.me===2||t.me===8)&&(n=o-1-n);let h=_.hO,l=t.me===2||t.me===4;return(l?r.y<a.y:r.x<a.x)?s+n*h:(l?r.y===a.y:r.x===a.x)?s:s+(o-1-n)*h}}class yr{Ke;Gt;me;F1;Id;Mf;Fd;L1;constructor(t,e,i){this.Ke=t,this.Gt=e,this.me=i,this.F1=new P,this.Id=0,this.Mf=0,this.Fd=new P,this.L1=0}toString(){return this.Ke.toString()+" "+this.Gt.toString()+" "+this.me.toString()+":"+this.Id.toString()+"/"+this.Mf.toString()+" "+this.Fd.toString()+" "+this.L1.toString()+" "+this.F1.toString()}}class is{ga;ma;pa;ya;wa;xa;v0;F0;O0;R0;constructor(){this.ga=D.Default,this.ma=D.Default,this.pa=NaN,this.ya=NaN,this.wa=NaN,this.xa=NaN,this.v0=null,this.F0=null,this.O0=1/0,this.R0=1/0}copy(){let t=new is;return t.ga=this.ga.P(),t.ma=this.ma.P(),t.pa=this.pa,t.ya=this.ya,t.wa=this.wa,t.xa=this.xa,t.v0=this.v0,t.F0=this.F0,t.O0=this.O0,t.R0=this.R0,t}}class He{M0;N0;C0;S0;pp;yp;constructor(){this.M0=-1/0,this.N0=0,this.C0=P.xo,this.S0=0,this.pp="None",this.yp="None"}copy(){let t=new He;return t.M0=this.M0,t.N0=this.N0,t.C0=this.C0.P(),t.S0=this.S0,t.pp=this.pp,t.yp=this.yp,t}}class ft extends rt{Ed;Ft;ca;l0;si;ie;constructor(t,e){let i;t===void 0||t instanceof Ft||typeof t=="string"?i=t:t&&(e=t),super(i),this.v=this.v|4608,this.Ed=new I,this.Ft=null,this.ie=new ne,this.ie.group=this,this.ca=new I,this.l0=null,this.si=null,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),this.v=this.v&-32769;let e=t.findInVisualTree(i=>i instanceof ve);e instanceof ve?t.Ft=e:t.Ft=null,this.ie!==null?(t.ie=this.ie.copy(),t.ie.group=t):(t.ie!==null&&(t.ie.group=null),t.ie=null),this.si!==null&&(t.si=this.si.copy())}vo(t){super.vo(t);let e=t.findSubGraphParts(),i=t.memberParts;for(;i.next();){let s=i.value;if(s.c(),s.invalidateLayout(8),s.clearAdornments(),s instanceof rt)s.invalidateConnectedLinks(e);else if(s instanceof _){let n=s.labelNodes;for(;n.next();)n.value.invalidateConnectedLinks(e)}}}qc(t,e,i,s,n,o,r){if(t===3&&e==="elements"){if(n instanceof ve)this.Ft===null?this.Ft=n:this.Ft!==n&&f.o("Cannot insert a second Placeholder into the visual tree of a Group.");else if(n instanceof H){let a=n.findInVisualTree(h=>h instanceof ve);a instanceof ve&&(this.Ft===null?this.Ft=a:this.Ft!==a&&f.o("Cannot insert a second Placeholder into the visual tree of a Group."))}}else t===4&&e==="elements"&&this.Ft!==null&&(s===this.Ft?this.Ft=null:s instanceof H&&this.Ft.isContainedBy(s)&&(this.Ft=null));super.qc(t,e,i,s,n,o,r)}Ju(t,e){if(super.Ju(t,e),this.isClipping&&this.type!==H.Spot&&this.isSubGraphExpanded){let i=this.resizeObject;i instanceof H&&(i=i.findMainElement()),this.si===null&&(this.si=new z),i.getDocumentBounds(this.si),i instanceof ct&&this.si.inflate(-i.strokeWidth,-i.strokeWidth)}}uh(t,e,i,s){this.hasPlaceholder()&&(this.Yo=this.placeholder),super.uh(t,e,i,s)}ensureBounds(){this.isSubGraphExpanded&&this.memberParts.each(t=>{t.ensureBounds()}),super.ensureBounds()}Gr(){if(!super.Gr())return!1;let t=this.memberParts;for(;t.next();){let e=t.value;if(e instanceof rt){if(!e.isVisible())continue;if(e._e())return!1}else if(e instanceof _){if(!e.isVisible())continue;if(e._e()&&e.fromNode!==this&&e.toNode!==this)return!1}}return!0}hasPlaceholder(){return this.Ft!==null&&this.Ft.isVisibleObject()&&this.isSubGraphExpanded}get placeholder(){return this.Ft}get computesBoundsAfterDrag(){return(this.v&2048)!==0}set computesBoundsAfterDrag(t){let e=(this.v&2048)!==0;e!==t&&(this.v=this.v^2048,this.t("computesBoundsAfterDrag",e,t))}get computesBoundsIncludingLinks(){return(this.v&4096)!==0}set computesBoundsIncludingLinks(t){let e=(this.v&4096)!==0;e!==t&&(this.v=this.v^4096,this.t("computesBoundsIncludingLinks",e,t))}get computesBoundsIncludingLocation(){return(this.v&8192)!==0}set computesBoundsIncludingLocation(t){let e=(this.v&8192)!==0;e!==t&&(this.v=this.v^8192,this.t("computesBoundsIncludingLocation",e,t))}get handlesDragDropForMembers(){return(this.v&16384)!==0}set handlesDragDropForMembers(t){let e=(this.v&16384)!==0;e!==t&&(this.v=this.v^16384,this.t("handlesDragDropForMembers",e,t))}get avoidableMembers(){return(this.v&131072)!==0}set avoidableMembers(t){let e=(this.v&131072)!==0;e!==t&&(this.v=this.v^131072,this.t("avoidableMembers",e,t))}get memberParts(){return this.Ed.iterator}sN(t){if(this.Ed.add(t)){t instanceof ft&&this.ca.add(t);let i=this.memberAdded;if(i!==null){let s=!0,n=this.diagram;n!==null&&(s=n.X,n.X=!0),i(this,t),n!==null&&(n.X=s)}(!this.isVisible()||!this.isSubGraphExpanded)&&t.Ei(!1)}if(t instanceof _&&!this.computesBoundsIncludingLinks)return;let e=this.Ft;e===null&&(e=this),e.c()}eN(t){if(this.Ed.delete(t)){t instanceof ft&&this.ca.delete(t);let i=this.memberRemoved;if(i!==null){let s=!0,n=this.diagram;n!==null&&(s=n.X,n.X=!0),i(this,t),n!==null&&(n.X=s)}(!this.isVisible()||!this.isSubGraphExpanded)&&t.Ei(!0)}if(t instanceof _&&!this.computesBoundsIncludingLinks)return;let e=this.Ft;e===null&&(e=this),e.c()}Xc(){if(this.Ed.count>0){let t=this.diagram;if(t!==null){let e=this.Ed.copy().iterator;for(;e.next();){let i=e.value;t.remove(i)}}}super.Xc()}get layout(){return this.ie}set layout(t){let e=this.ie;if(e!==t){t!==null&&t.diagram!==null&&t.diagram.layout===t&&f.o("A layout cannot be both the Diagram.layout and a Group.layout: "+t),e!==null&&(e.diagram=null,e.group=null),this.ie=t;let i=this.diagram;t!==null&&(t.diagram=i,t.group=this),i!==null&&(i.Vr=!0),this.t("layout",e,t),i!==null&&i.requestUpdate()}}get memberAdded(){return this.Rt!==null?this.Rt.uy:null}set memberAdded(t){let e=this.memberAdded;e!==t&&(t!==null&&f.k(t,ft,"memberAdded"),this.ll().uy=t,this.t("memberAdded",e,t))}get memberRemoved(){return this.Rt!==null?this.Rt.gy:null}set memberRemoved(t){let e=this.memberRemoved;e!==t&&(t!==null&&f.k(t,ft,"memberRemoved"),this.ll().gy=t,this.t("memberRemoved",e,t))}get memberValidation(){return this.Rt!==null?this.Rt.nh:null}set memberValidation(t){let e=this.memberValidation;e!==t&&(t!==null&&f.k(t,ft,"memberValidation"),this.ll().nh=t,this.t("memberValidation",e,t))}canAddMembers(t){let e=this.diagram;if(e===null)return!1;let i=e.commandHandler,s=i.m2(t).iterator;for(;s.next();){let n=s.value;if(!i.isValidMember(this,n))return!1}return!0}addMembers(t,e){let i=this.diagram;if(i===null)return!1;let s=i.commandHandler,n=s.m2(t),o=!0,r=n.iterator;for(;r.next();){let a=r.value;!e||s.isValidMember(this,a)?a.containingGroup=this:o=!1}return o}get ungroupable(){return(this.v&256)!==0}set ungroupable(t){let e=(this.v&256)!==0;e!==t&&(this.v=this.v^256,this.t("ungroupable",e,t))}canUngroup(){if(!this.ungroupable)return!1;let t=this.layer;if(t===null||!t.allowUngroup)return!1;let e=t.diagram;return!(e!==null&&!e.allowUngroup)}invalidateConnectedLinks(t){let e=this.VO();if(super.invalidateConnectedLinks(t),e)return;this.GL(!0);let i=this.findExternalLinksConnected();for(;i.next();){let s=i.value;if(t!==void 0&&t.has(s))continue;let n=s.fromNode;if(n!==null&&n!==this&&n.isMemberOf(this)&&!n.isVisible())n.qi(s.fromPort),n.qi(s.toPort),s.invalidateRoute();else{let o=s.toNode;o!==null&&o!==this&&o.isMemberOf(this)&&!o.isVisible()&&(o.qi(s.fromPort),o.qi(s.toPort),s.invalidateRoute())}}}findExternalLinksConnected(){let t=this.diagram!==null&&this.diagram.MM;if(t&&this.l0!==null)return this.l0.iterator;let e=this.findSubGraphParts();e.add(this);let i=new I,s=e.iterator;for(;s.next();){let n=s.value;if(!(n instanceof rt))continue;let o=n.linksConnected;for(;o.next();){let r=o.value;e.has(r)||i.add(r)}}return t&&(this.l0=i),i.iterator}findExternalNodesConnected(){let t=this.findSubGraphParts();t.add(this);let e=new I,i=t.iterator;for(;i.next();){let s=i.value;if(!(s instanceof rt))continue;let n=s.linksConnected;for(;n.next();){let o=n.value,r=o.fromNode;r!==null&&(!t.has(r)||r===this)&&e.add(r);let a=o.toNode;a!==null&&(!t.has(a)||a===this)&&e.add(a)}}return e.iterator}vE(){function t(i,s){i!==null&&(s.add(i),t(i.containingGroup,s))}let e=new I;return t(this,e),e}findSubGraphParts(){let t=new I;return Nt.oh(t,this,!0,0,!0),t.delete(this),t}Ei(t){super.Ei(t);let e=this.memberParts;for(;e.next();)e.value.Ei(t)}collapseSubGraph(){let t=this.diagram;if(t===null||t.isCollapsingExpanding)return;t.isCollapsingExpanding=!0;let e=this.findSubGraphParts();this.AT(e,t,this),t.isCollapsingExpanding=!1}AT(t,e,i){let s=this.memberParts;for(;s.next();){let n=s.value;if(n.Ei(!1),n instanceof ft&&n.isSubGraphExpanded&&(n.wasSubGraphExpanded=n.isSubGraphExpanded,n.AT(t,e,i)),n instanceof rt)n.invalidateConnectedLinks(t),e.Lc(n,i);else if(n instanceof _){let o=n.labelNodes;for(;o.next();)o.value.invalidateConnectedLinks(t)}}this.isSubGraphExpanded=!1}expandSubGraph(){let t=this.diagram;if(t===null||t.isCollapsingExpanding)return;t.isCollapsingExpanding=!0;let e=this.findSubGraphParts();this.TT(e,t,this),t.isCollapsingExpanding=!1}TT(t,e,i){let s=this.memberParts;for(;s.next();){let n=s.value;if(n.Ei(!0),n instanceof ft&&n.wasSubGraphExpanded&&(n.wasSubGraphExpanded=!1,n.TT(t,e,i)),n instanceof rt)n.invalidateConnectedLinks(t);else if(n instanceof _){let o=n.labelNodes;for(;o.next();)o.value.invalidateConnectedLinks(t)}}this.isSubGraphExpanded=!0}get isSubGraphExpanded(){return(this.v&512)!==0}set isSubGraphExpanded(t){let e=(this.v&512)!==0;if(e!==t){this.v=this.v^512;let i=this.diagram;this.t("isSubGraphExpanded",e,t);let s=this.subGraphExpandedChanged;if(s!==null){let n=!0;i!==null&&(n=i.X,i.X=!0),s(this),i!==null&&(i.X=n)}if(i!==null&&i.undoManager.isUndoingRedoing){this.Ft!==null&&this.Ft.c(),this.memberParts.each(n=>n.updateAdornments());return}t?this.expandSubGraph():this.collapseSubGraph()}}get wasSubGraphExpanded(){return(this.v&1024)!==0}set wasSubGraphExpanded(t){let e=(this.v&1024)!==0;e!==t&&(this.v=this.v^1024,this.t("wasSubGraphExpanded",e,t))}get subGraphExpandedChanged(){return this.Rt!==null?this.Rt.my:null}set subGraphExpandedChanged(t){let e=this.subGraphExpandedChanged;e!==t&&(t!==null&&f.k(t,ft,"subGraphExpandedChanged"),this.ll().my=t,this.t("subGraphExpandedChanged",e,t))}move(t,e){e===void 0&&(e=!1);let i=e?this.location:this.position,s=i.x,n=i.y,o=t.x,r=t.y;if((s===o||isNaN(s)&&isNaN(o))&&(n===r||isNaN(n)&&isNaN(r)))return;let a=o-(isNaN(s)?0:s),h=r-(isNaN(n)?0:n),l=P.l();super.move(t,e);let c=new I,u=this.findSubGraphParts().iterator;for(;u.next();){let d=u.value;d instanceof _&&(d.suspendsRouting&&c.add(d),!(!d.Se&&(d.fromNode===this||d.toNode===this))&&(d.suspendsRouting=!0))}for(u.reset();u.next();){let d=u.value;if(d.Cl()||d instanceof rt&&d.isLinkLabel)continue;let g=d.position,p=d.location;g.isReal()?(l.x=g.x+a,l.y=g.y+h,d.position=l):p.isReal()&&(l.x=p.x+a,l.y=p.y+h,d.location=l)}for(u.reset();u.next();){let d=u.value;if(!(d instanceof _)||(d.suspendsRouting=c.has(d),!d.Se&&(d.fromNode===this||d.toNode===this)))continue;let g=d.position;l.x=g.x+a,l.y=g.y+h,l.isReal()?d.move(l):d.invalidateRoute()}P.e(l)}VO(){return(this.v&65536)!==0}GL(t){(this.v&65536)!==0!==t&&(this.v=this.v^65536)}get fa(){return(this.v&32768)!==0}set fa(t){(this.v&32768)!==0!==t&&(this.v=this.v^32768)}}class ve extends dt{Zt;Ud;constructor(t){super(),this.Zt=Lt.Rg,this.Ud=new z(NaN,NaN,NaN,NaN),t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Zt=this.Zt.P(),t.Ud=this.Ud.copy()}fh(t){if(this.background===null)return!1;let e=this.naturalBounds;return z.contains(0,0,e.width,e.height,t.x,t.y)}Wu(t,e,i,s){let n=this.part;if((n===null||!(n instanceof ft)&&!(n instanceof St))&&f.o("Placeholder is not inside a Group or Adornment."),n instanceof ft){let o=this.computeBorder(this.Ud),r=this.minSize,a=isFinite(r.width)?Math.max(r.width,o.width):o.width,h=isFinite(r.height)?Math.max(r.height,o.height):o.height,l=this.zi;l.Fn(a||0,h||0),this.Wn(0,0,l.width,l.height);let c=n.memberParts,u=!1;for(;c.next();)if(c.value.isVisible()){u=!0;break}let d=n.diagram;if(u&&d!==null&&!d.animationManager.US(n)&&!isNaN(o.x)&&!isNaN(o.y)){let g=P.l();g.setRectSpot(o,n.locationSpot),n.location=g,P.e(g)}}else{let o=n,r=this.zi,a=this.Zt,h=a.left+a.right,l=a.top+a.bottom,c=o.adornedObject,u=c.getDocumentAngle();o.angle=u;let d=0;c instanceof ct&&(d=c.strokeWidth);let g=c.getDocumentScale(),p=c.naturalBounds,m=(p.width+d)*g,y=(p.height+d)*g;if(o.type!==H.Link){let w=o.category==="Selection"?D.TopLeft:o.locationSpot,b=c.getDocumentPoint(w,P.l());o.location=b,P.e(b)}if(!isNaN(m)&&!isNaN(y))r.Fn(m+h||0,y+l||0),this.Wn(-a.left,-a.top,r.width,r.height);else{let w=c.getDocumentPoint(D.TopLeft,P.l()),b=z.V(w.x,w.y,0,0);b.unionPoint(c.getDocumentPoint(D.BottomRight,w)),b.unionPoint(c.getDocumentPoint(D.TopRight,w)),b.unionPoint(c.getDocumentPoint(D.BottomLeft,w)),r.Fn(b.width+h||0,b.height+l||0),this.Wn(-a.left,-a.top,r.width,r.height),P.e(w),z.e(b)}}}uh(t,e,i,s){this.actualBounds.i(t,e,i,s)}computeBorder(t){let e=this.part,i=e.diagram,s=i===null||!i.animationManager.isAnimating;if(i!==null&&e instanceof ft&&!e.layer.isTemporary&&e.computesBoundsAfterDrag&&this.Ud.isReal()){let a=i.toolManager.findTool("Dragging");if(a===i.currentTool){let h=a.computeBorder(e,this.Ud,t);if(h!==null)return h}}let n=z.l(),o=this.computeMemberBounds(n),r=this.Zt;return e instanceof ft&&!e.isSubGraphExpanded?t.i(o.x-r.left,o.y-r.top,0,0):t.i(o.x-r.left,o.y-r.top,Math.max(o.width+r.left+r.right,0),Math.max(o.height+r.top+r.bottom,0)),z.e(n),s&&e instanceof ft&&e.computesBoundsIncludingLocation&&e.location.isReal()&&t.unionPoint(e.location),t}computeMemberBounds(t){if(!(this.part instanceof ft))return t.i(0,0,0,0),t;let e=this.part,i=1/0,s=1/0,n=-1/0,o=-1/0,r=e.memberParts;for(;r.next();){let a=r.value;if(!a.isVisible()||a instanceof _&&(!e.computesBoundsIncludingLinks||a.To()||a.fromNode===e||a.toNode===e))continue;let h=a.actualBounds;h.left<i&&(i=h.left),h.top<s&&(s=h.top),h.right>n&&(n=h.right),h.bottom>o&&(o=h.bottom)}if(!isFinite(i)||!isFinite(s)){let a=e.location;t.i(a.x,a.y,0,0)}else t.i(i,s,n-i,o-s);return t}get padding(){return this.Zt}set padding(t){typeof t=="number"&&(t=new Lt(t));let e=this.Zt;e.equals(t)||(t=t.P(),this.Zt=t,this.t("padding",e,t),this.c())}}class ne{N;ua;Bd;wr;Vd;zd;Co;cl;Xd;Gd;ao;constructor(t){I.Ki(this),this.N=null,this.ua=null,this.Bd=!0,this.wr=!0,this.Vd=!1,this.zd=new P(0,0).u(),this.Co=!0,this.cl=null,this.Xd=null,this.Gd=!1,this.ao=null,t&&Object.assign(this,t)}cloneProtected(t){t.Bd=this.Bd,t.wr=this.wr,t.Vd=this.Vd,t.zd.a(this.zd),t.Co=this.Co,t.cl=this.cl,t.Xd=this.Xd,t.Gd=!0}copy(){let t=new this.constructor;return this.cloneProtected(t),t}oi(t){f.er(this,t)}toString(){let t=f.Dn(this.constructor);return t+="(",this.group!==null&&(t+=" in "+this.group),this.diagram!==null&&(t+=" for "+this.diagram),t+=")",t}get diagram(){return this.N}set diagram(t){this.N=t}get group(){return this.ua}set group(t){this.ua!==t&&(this.ua=t,t!==null&&(this.N=t.diagram))}get isOngoing(){return this.Bd}set isOngoing(t){this.Bd!==t&&(f.s(t,"boolean",ne,"isOngoing"),this.Bd=t)}get isInitial(){return this.wr}set isInitial(t){f.s(t,"boolean",ne,"isInitial"),this.wr=t,t||(this.Gd=!0)}get isViewportSized(){return this.Vd}set isViewportSized(t){this.Vd!==t&&(f.s(t,"boolean",ne,"isViewportSized"),this.Vd=t,t&&this.invalidateLayout())}get isRouting(){return this.Co}set isRouting(t){this.Co!==t&&(f.s(t,"boolean",ne,"isRouting"),this.Co=t)}get isRealtime(){return this.cl}set isRealtime(t){this.cl!==t&&(t!==null&&f.s(t,"boolean",ne,"isRealtime"),this.cl=t)}get isValidLayout(){return this.Gd}set isValidLayout(t){if(this.Gd!==t&&(f.s(t,"boolean",ne,"isValidLayout"),this.Gd=t,!t)){let e=this.diagram;e!==null&&(e.Vr=!0)}}invalidateLayout(){if(this.isValidLayout){let t=this.diagram;if(t===null||t.undoManager.isUndoingRedoing)return;let e=t.animationManager;if(e.isTicking)return;e.defaultAnimation.isAnimating&&e.stopAnimation(),(this.isOngoing&&t.Vh||this.isInitial&&!t.Vh)&&(this.isValidLayout=!1,t.requestUpdate())}}get network(){return this.ao}set network(t){this.ao!==t&&(this.ao=t,t!==null&&(t.layout=this))}createNetwork(){return new We(this)}makeNetwork(t){let e=this.createNetwork();return t instanceof q?(e.addParts(t.nodes,!0),e.addParts(t.links,!0)):t instanceof ft?e.addParts(t.memberParts):e.addParts(t.iterator),e}updateParts(){this.isValidLayout=!0;let t=this.diagram;if(t===null&&this.network!==null){let e=this.network.vertexes.iterator;for(;e.next();){let i=e.value.node;if(i!==null&&(t=i.diagram,t!==null))break}}try{t!==null&&t.startTransaction("Layout"),this.commitLayout()}finally{t!==null&&t.commitTransaction("Layout")}}commitLayout(){if(this.network===null)return;let t=this.network.vertexes.iterator;for(;t.next();)t.value.commit();if(this.isRouting){let e=this.network.edges.iterator;for(;e.next();)e.value.commit()}}doLayout(t){let e=new I;if(t instanceof q?(this.Mh(e,t.nodes,!0,this.fa,!0,!1,!0),this.Mh(e,t.parts,!0,this.fa,!0,!1,!0)):t instanceof ft?this.Mh(e,t.memberParts,!1,this.fa,!0,!1,!0):e.addAll(t.iterator),e.count>0){let i=this.diagram;i!==null&&i.startTransaction("Layout"),this.doMinimalNoNetworkLayout(e),i!==null&&i.commitTransaction("Layout")}this.isValidLayout=!0}doMinimalNoNetworkLayout(t){let e=t.count,i=Math.ceil(Math.sqrt(e));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);let s=this.arrangementOrigin.x,n=this.arrangementOrigin.y,o=s,r=n,a=0,h=0,l=t.iterator;for(;l.next();){let c=l.value;c.ensureBounds();let u=c.measuredBounds,d=u.width,g=u.height;c.moveTo(o,r),c instanceof ft&&(c.fa=!1),o+=Math.max(d,50)+20,h=Math.max(h,Math.max(g,50)),a>=i-1?(a=0,o=s,r+=h+20,h=0):a++}}fa(t){return!!(!t.location.isReal()&&!t.position.isReal()||t instanceof ft&&t.fa)}Mh(t,e,i,s,n,o,r){let a=e.iterator;for(;a.next();){let h=a.value;if(!(i&&!h.isTopLevel)&&!(s!==null&&!s(h))&&h.canLayout())if(n&&h instanceof rt){if(h.isLinkLabel)continue;h instanceof ft&&h.layout===null?this.Mh(t,h.memberParts,!1,s,n,o,r):(h.ensureBounds(),t.add(h))}else o&&h instanceof _?t.add(h):r&&h.ke()&&!(h instanceof rt)&&(h.ensureBounds(),t.add(h))}}getLayoutBounds(t,e){let i=this.boundsComputation;return i!==null?(e||(e=new z),i(t,this,e)):!e&&t.margin.equalTo(0,0,0,0)?t.actualBounds:(e||(e=new z),e.set(t.actualBounds),e.addMargin(t.margin),e)}get boundsComputation(){return this.Xd}set boundsComputation(t){this.Xd!==t&&(t!==null&&f.k(t,ne,"boundsComputation"),this.Xd=t,this.invalidateLayout())}collectParts(t){let e=new I;return t instanceof q?(this.Mh(e,t.nodes,!0,null,!0,!0,!0),this.Mh(e,t.links,!0,null,!0,!0,!0),this.Mh(e,t.parts,!0,null,!0,!0,!0)):t instanceof ft?this.Mh(e,t.memberParts,!1,null,!0,!0,!0):this.Mh(e,t.iterator,!1,null,!0,!0,!0),e}get arrangementOrigin(){return this.zd}set arrangementOrigin(t){this.zd.equals(t)||(this.zd.a(t),this.invalidateLayout())}initialOrigin(t){let e=this.group;if(e!==null)if(e.hasPlaceholder()){let i=e.placeholder,s=i.getDocumentPoint(D.TopLeft);(isNaN(s.x)||isNaN(s.y))&&s.set(t);let n=i.padding;return s.x+=n.left,s.y+=n.top,s}else{let i=e.position.copy();return(isNaN(i.x)||isNaN(i.y))&&i.set(t),i}return t}}class We{ie;co;bn;ky;Py;constructor(t){I.Ki(this),this.ie=t,this.co=new I,this.bn=new I,this.ky=new pt,this.Py=new pt}clear(){if(this.co){let t=this.co.iterator;for(;t.next();)t.value.clear()}if(this.bn){let t=this.bn.iterator;for(;t.next();)t.value.clear()}this.co=new I,this.bn=new I,this.ky=new pt,this.Py=new pt}toString(t){t===void 0&&(t=0);let e="LayoutNetwork"+(this.layout!==null?"("+this.layout.toString()+")":"");if(t<=0)return e;if(e+=" vertexes: "+this.co.count+" edges: "+this.bn.count,t>1){let i=this.co.iterator;for(;i.next();){let n=i.value;e+=`
16
+ `+n.toString(t-1)}let s=this.bn.iterator;for(;s.next();){let n=s.value;e+=`
17
+ `+n.toString(t-1)}}return e}get layout(){return this.ie}set layout(t){t!==null&&(this.ie=t)}get vertexes(){return this.co}get edges(){return this.bn}createVertex(){return new $e(this)}createEdge(){return new mi(this)}addParts(t,e,i){if(t===null)return;e===void 0&&(e=!1),f.s(e,"boolean",We,"addParts:toplevelonly"),i===void 0&&(i=null),i===null&&(i=n=>{if(n instanceof rt)return!n.isLinkLabel;if(n instanceof _){let o=n.fromNode;if(o===null||o.isLinkLabel)return!1;let r=n.toNode;return!(r===null||r.isLinkLabel)}return!1});let s=t.iterator;for(;s.next();){let n=s.value;if(n instanceof rt&&!(e&&!n.isTopLevel)&&n.canLayout()&&i(n))if(n instanceof ft&&n.layout===null)this.addParts(n.memberParts,!1);else{if(this.findVertex(n)!==null)continue;let o=this.createVertex();o.node=n,this.addVertex(o)}}for(s.reset();s.next();){let n=s.value;if(!(n instanceof _)||e&&!n.isTopLevel||!n.canLayout()||!i(n)||this.findEdge(n)!==null)continue;let o=n.fromNode,r=n.toNode;if(o===null||r===null||o===r)continue;let a=this.findGroupVertex(o),h=this.findGroupVertex(r);this.linkVertexes(a,h,n)}}findGroupVertex(t){let e=t.findVisibleNode();if(e===null)return null;let i=this.findVertex(e);if(i!==null)return i;let s=e.containingGroup;for(;s!==null;){if(i=this.findVertex(s),i!==null)return i;s=s.containingGroup}return null}addVertex(t){this.co.add(t);let e=t.node;e!==null&&this.ky.set(e,t),t.network=this}addNode(t){let e=this.findVertex(t);return e===null&&(e=this.createVertex(),e.node=t,this.addVertex(e)),e}deleteVertex(t){if(this.DT(t)){let e=t.Ho;for(let i=e.count-1;i>=0;i--){let s=e.elt(i);this.deleteEdge(s)}e=t.qo;for(let i=e.count-1;i>=0;i--){let s=e.elt(i);this.deleteEdge(s)}}}DT(t){let e=this.co.delete(t);if(e){let i=t.node;i!==null&&this.ky.delete(i)}return e}deleteNode(t){let e=this.findVertex(t);e!==null&&this.deleteVertex(e)}findVertex(t){return this.ky.get(t)}addEdge(t){this.PN(t);let e=t.toVertex;e!==null&&e.addSourceEdge(t);let i=t.fromVertex;i!==null&&i.addDestinationEdge(t)}PN(t){this.bn.add(t);let e=t.link;e!==null&&this.findEdge(e)===null&&this.Py.set(e,t),t.network=this}addLink(t){let e=t.fromNode,i=t.toNode,s=this.findEdge(t);return s===null?(s=this.createEdge(),s.link=t,e!==null&&(s.fromVertex=this.addNode(e)),i!==null&&(s.toVertex=this.addNode(i)),this.addEdge(s)):(e!==null?s.fromVertex=this.addNode(e):s.fromVertex=null,i!==null?s.toVertex=this.addNode(i):s.toVertex=null),s}deleteEdge(t){let e=t.toVertex;e!==null&&e.deleteSourceEdge(t);let i=t.fromVertex;i!==null&&i.deleteDestinationEdge(t),this.SN(t)}SN(t){let e=this.bn.delete(t);if(e){let i=t.link;i!==null&&this.Py.delete(i)}return e}deleteLink(t){let e=this.findEdge(t);e!==null&&this.deleteEdge(e)}findEdge(t){return this.Py.get(t)}linkVertexes(t,e,i){if(t===null||e===null)return null;if(t.network===this&&e.network===this){let s=this.createEdge();return s.link=i,s.fromVertex=t,s.toVertex=e,this.addEdge(s),s}return null}reverseEdge(t){let e=t.fromVertex,i=t.toVertex;e===null||i===null||(e.deleteDestinationEdge(t),i.deleteSourceEdge(t),t.reverseEdge(),e.addSourceEdge(t),i.addDestinationEdge(t))}deleteSelfEdges(){let t=f.et(),e=this.bn.iterator;for(;e.next();){let s=e.value;s.fromVertex===s.toVertex&&t.push(s)}let i=t.length;for(let s=0;s<i;s++)this.deleteEdge(t[s]);f.J(t)}deleteArtificialVertexes(){let t=f.et(),e=this.co.iterator;for(;e.next();){let o=e.value;o.node===null&&o.data===null&&t.push(o)}let i=t.length;for(let o=0;o<i;o++)this.deleteVertex(t[o]);let s=f.et(),n=this.bn.iterator;for(;n.next();){let o=n.value;o.link===null&&o.data===null&&s.push(o)}i=s.length;for(let o=0;o<i;o++)this.deleteEdge(s[o]);f.J(t),f.J(s)}deleteUselessEdges(){let t=f.et(),e=this.bn.iterator;for(;e.next();){let s=e.value;(s.fromVertex===null||s.toVertex===null)&&t.push(s)}let i=t.length;for(let s=0;s<i;s++)this.deleteEdge(t[s]);f.J(t)}isSingleton(t){return!(t.Ho.count>0||t.qo.count>0)}splitIntoSubNetworks(t){t===void 0&&(t=!0),t&&(this.deleteArtificialVertexes(),this.deleteUselessEdges(),this.deleteSelfEdges());let e=new G,i=!0;for(;i;){i=!1;let s=this.co.iterator;for(;s.next();){let n=s.value;if(this.isSingleton(n))continue;let o=this.layout.createNetwork();e.add(o),this.zO(o,n),i=!0;break}}return e.sort((s,n)=>s===null||n===null||s===n?0:n.vertexes.count-s.vertexes.count),e}zO(t,e){if(e===null)return;let i=new G;for(i.add(e);i.count>0;){let s=i.first();if(i.removeAt(0),!s||s.network===t)continue;this.DT(s),t.addVertex(s);let n=s.sourceEdges;for(;n.next();){let o=n.value;o.network!==t&&(this.SN(o),t.PN(o),o.fromVertex&&i.add(o.fromVertex))}for(n=s.destinationEdges;n.next();){let o=n.value;o.network!==t&&(this.SN(o),t.PN(o),o.toVertex&&i.add(o.toVertex))}}}findAllParts(){let t=new I,e=this.co.iterator;for(;e.next();){let s=e.value;s.node&&t.add(s.node)}let i=this.bn.iterator;for(;i.next();){let s=i.value;s.link&&t.add(s.link)}return t}}class $e{ao;_t;Me;Le;je;Ho;qo;constructor(t){I.Ki(this),this.ao=t,this.Le=new z(0,0,10,10).u(),this.je=new P(5,5).u(),this._t=null,this.Me=null,this.Ho=new G,this.qo=new G}clear(){this._t=null,this.Me=null,this.Ho=new G,this.qo=new G}toString(t){t===void 0&&(t=0);let e="LayoutVertex#"+I.as(this);if(t>0&&(e+=this.node!==null?"("+this.node.toString()+")":"",t>1)){let i="",s=!0,n=this.Ho.iterator;for(;n.next();){let r=n.value;s?s=!1:i+=",",i+=r.toString(0)}let o="";for(s=!0,n=this.qo.iterator;n.next();){let r=n.value;s?s=!1:o+=",",o+=r.toString(0)}e+=" sources: "+i+" destinations: "+o}return e}get fo(){return this.Ho.dC}get Wo(){return this.qo.dC}get data(){return this._t}set data(t){if(this._t=t,t!==null&&t.bounds){let e=t.bounds,i=e.x,s=e.y,n=e.width,o=e.height;this.je.i(n/2,o/2),this.Le.i(i,s,n,o)}}get node(){return this.Me}set node(t){if(this.Me!==t){if(this.Me=t,t===null)return;t.ensureBounds();let e=this.network.layout,i=z.l(),s=e.getLayoutBounds(t,i),n=s.x,o=s.y,r=s.width,a=s.height;if(isNaN(n)&&(n=0),isNaN(o)&&(o=0),this.Le.i(n,o,r,a),z.e(i),!(t instanceof ft)){let h=t.locationObject.getDocumentPoint(D.Center);if(h.isReal()){this.je.i(h.x-n,h.y-o);return}}this.je.i(r/2,a/2)}}get bounds(){return this.Le}set bounds(t){this.Le.equals(t)||this.Le.a(t)}get focus(){return this.je}set focus(t){this.je.equals(t)||this.je.a(t)}get centerX(){return this.Le.x+this.je.x}set centerX(t){let e=this.Le;e.x+this.je.x!==t&&(e.Nt(),e.x=t-this.je.x,e.u())}get centerY(){return this.Le.y+this.je.y}set centerY(t){let e=this.Le;e.y+this.je.y!==t&&(e.Nt(),e.y=t-this.je.y,e.u())}get focusX(){return this.je.x}set focusX(t){let e=this.je;e.x!==t&&(e.Nt(),e.x=t,e.u())}get focusY(){return this.je.y}set focusY(t){let e=this.je;e.y!==t&&(e.Nt(),e.y=t,e.u())}get x(){return this.Le.x}set x(t){let e=this.Le;e.x!==t&&(e.Nt(),e.x=t,e.u())}get y(){return this.Le.y}set y(t){let e=this.Le;e.y!==t&&(e.Nt(),e.y=t,e.u())}get width(){return this.Le.width}set width(t){let e=this.Le;e.width!==t&&(e.Nt(),e.width=t,e.u())}get height(){return this.Le.height}set height(t){let e=this.Le;e.height!==t&&(e.Nt(),e.height=t,e.u())}commit(){let t=this._t;if(t!==null){let i=this.bounds,s=t.bounds;f.Y(s)?(s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height):t.bounds=i.copy();return}let e=this.node;if(e!==null){let i=this.bounds;if(!(e instanceof ft)){let s=z.l();e.ensureBounds();let n=this.network.layout.getLayoutBounds(e,s),o=e.locationObject.getDocumentPoint(D.Center);if(n.isReal()&&o.isReal()){e.moveTo(i.x+this.focusX-(o.x-n.x)+e.margin.left,i.y+this.focusY-(o.y-n.y+e.margin.top)),z.e(s);return}z.e(s)}e.moveTo(i.x+e.margin.left,i.y+e.margin.top)}}addSourceEdge(t){t!==null&&(this.Ho.has(t)||this.Ho.add(t))}deleteSourceEdge(t){t!==null&&this.Ho.delete(t)}addDestinationEdge(t){t!==null&&(this.qo.has(t)||this.qo.add(t))}deleteDestinationEdge(t){t!==null&&this.qo.delete(t)}get network(){return this.ao}set network(t){this.ao=t}get sourceVertexes(){let t=new I,e=this.sourceEdges;for(;e.next();){let i=e.value;i.fromVertex&&t.add(i.fromVertex)}return t.iterator}get destinationVertexes(){let t=new I,e=this.destinationEdges;for(;e.next();){let i=e.value;i.toVertex&&t.add(i.toVertex)}return t.iterator}get vertexes(){let t=new I,e=this.sourceEdges;for(;e.next();){let i=e.value;i.fromVertex&&t.add(i.fromVertex)}for(e=this.destinationEdges;e.next();){let i=e.value;i.toVertex&&t.add(i.toVertex)}return t.iterator}get sourceEdges(){return this.Ho.iterator}get destinationEdges(){return this.qo.iterator}get edges(){let t=new G,e=this.sourceEdges;for(;e.next();){let i=e.value;t.add(i)}for(e=this.destinationEdges;e.next();){let i=e.value;t.add(i)}return t.iterator}get edgesCount(){return this.Ho.count+this.qo.count}static standardComparer(t,e){let i=t.Me,s=e.Me;if(i)if(s){let n=i.text,o=s.text;return n<o?-1:n>o?1:0}else return 1;else return s!==null?-1:0}static smartComparer(t,e){if(t!==null)if(e!==null){let i=t.Me,s=e.Me;if(i!==null)if(s!==null){let n=i.text.toLocaleLowerCase(),o=s.text.toLocaleLowerCase(),r=n.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),a=o.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),h=0;for(;h<r.length;h++)if(a[h]!==""&&a[h]!==void 0){let l=parseFloat(r[h]),c=parseFloat(a[h]);if(isNaN(l))if(isNaN(c)){if(r[h].localeCompare(a[h])!==0)return r[h].localeCompare(a[h]);continue}else return 1;else{if(isNaN(c))return-1;if(l-c!==0)return l-c;continue}}else{if(r[h]==="")continue;return 1}return a[h]!==""&&a[h]!==void 0?-1:0}else return 1;else return s!==null?-1:0}else return 1;else return e!==null?-1:0}}class mi{ao;_t;Ke;He;qe;constructor(t){I.Ki(this),this.ao=t,this._t=null,this.Ke=null,this.He=null,this.qe=null}clear(){this._t=null,this.Ke=null,this.He=null,this.qe=null}toString(t){t===void 0&&(t=0);let e="LayoutEdge#"+I.as(this);return t>0&&(e+=this.Ke!==null?"("+this.Ke.toString()+")":"",t>1&&(e+=" "+(this.He?this.He.toString():"null")+" --> "+(this.qe?this.qe.toString():"null"))),e}reverseEdge(){let t=this.He;this.He=this.qe,this.qe=t}commit(){}getOtherVertex(t){return this.qe===t?this.He:this.He===t?this.qe:null}get network(){return this.ao}set network(t){this.ao=t}get data(){return this._t}set data(t){this._t!==t&&(this._t=t)}get link(){return this.Ke}set link(t){this.Ke!==t&&(this.Ke=t)}get fromVertex(){return this.He}set fromVertex(t){this.He!==t&&(this.He=t)}get toVertex(){return this.qe}set toVertex(t){this.qe!==t&&(this.qe=t)}}var Os=(x=>(x[x.Position=0]="Position",x[x.Location=1]="Location",x))(Os||{}),Rs=(x=>(x[x.LeftToRight=10]="LeftToRight",x[x.RightToLeft=11]="RightToLeft",x))(Rs||{}),Es=(x=>(x[x.Forwards=20]="Forwards",x[x.Reverse=21]="Reverse",x[x.Ascending=22]="Ascending",x[x.Descending=23]="Descending",x))(Es||{});class ri extends ne{Yd;Kd;Po;kn;hi;Xi;pe;ye;constructor(t){super(),this.isViewportSized=!0,this.Yd=NaN,this.Kd=NaN,this.Po=new Q(NaN,NaN).u(),this.kn=new Q(10,10).u(),this.hi=1,this.Xi=10,this.pe=22,this.ye=ri.standardComparer,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Yd=this.Yd,t.Kd=this.Kd,t.Po.a(this.Po),t.kn.a(this.kn),t.hi=this.hi,t.Xi=this.Xi,t.pe=this.pe,t.ye=this.ye}oi(t){t in Es?this.sorting=t:t in Rs?this.arrangement=t:t in Os?this.alignment=t:super.oi(t)}doLayout(t){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);let e=this.collectParts(t),i=this.diagram,s=e.copy().iterator;for(;s.next();){let g=s.value;if(g.Cl()&&(g.fromNode!==null||g.toNode!==null)){e.delete(g);continue}if(g.ensureBounds(),g instanceof ft){let p=g.memberParts;for(;p.next();){let m=p.value;e.delete(m)}}}let n=e.toArray();if(n.length===0)return;switch(this.sorting){case 20:break;case 21:n.reverse();break;case 22:n.sort(this.comparer);break;case 23:n.sort(this.comparer),n.reverse();break}let o=this.wrappingColumn;isNaN(o)&&(o=0);let r=this.wrappingWidth;if(isNaN(r)&&i!==null){let g=i.viewportBounds,p=i.padding;r=Math.max(g.width-p.left-p.right,0)}else r=Math.max(this.wrappingWidth,0);o<=0&&r<=0&&(o=1);let a=this.spacing.width;isFinite(a)||(a=0);let h=this.spacing.height;isFinite(h)||(h=0),i!==null&&i.startTransaction("Layout");let l=[];switch(this.alignment){case 0:this.XO(n,r,o,a,h,l);break;case 1:this.GO(n,r,o,a,h,l);break}let c=0,u=0,d=0;for(let g=0;g<l.length;g++){let p=l[g];c=Math.min(c,p.x),u=Math.min(u,p.y),d=Math.max(d,p.x+p.width)}this.arrangement===11?this.commitLayers(l,new P(c+a/2-(d+c),u-h/2)):this.commitLayers(l,new P(c-a/2,u-h/2)),i!==null&&i.commitTransaction("Layout"),this.isValidLayout=!0}XO(t,e,i,s,n,o){let r=z.l(),a=Math.max(this.cellSize.width,1);if(!isFinite(a)){a=0;for(let y=0;y<t.length;y++){let w=t[y],b=this.getLayoutBounds(w,r);a=Math.max(a,b.width)}}a+=s,a=Math.max(a,1);let h=Math.max(this.cellSize.height,1);if(!isFinite(h)){h=0;for(let y=0;y<t.length;y++){let w=t[y],b=this.getLayoutBounds(w,r);h=Math.max(h,b.height)}}h+=n,h=Math.max(h,1);let l=this.arrangement,c=this.arrangementOrigin.x,u=this.arrangementOrigin.y,d=c,g=u,p=0,m=0;for(let y=0;y<t.length;y++){let w=t[y],b=this.getLayoutBounds(w,r),v=Math.ceil((b.width+s)/a),k=Math.ceil((b.height+n)/h),S=v*a,M=k*h,F=0;switch(l){case 11:F=Math.abs(d-b.width);break;default:F=d+b.width;break}(i>0&&p>i-1||e>0&&p>0&&F-c>e)&&(o.push(new z(0,g,e+s,m)),p=0,d=c,g+=m,m=0),m=Math.max(m,M);let T=0;switch(l){case 11:T=-b.width;break;default:T=0;break}switch(w.moveTo(d+T+w.margin.left,g+w.margin.top),l){case 11:d-=S;break;default:d+=S;break}p++}o.push(new z(0,g,e+s,m)),z.e(r)}GO(t,e,i,s,n,o){let r=z.l(),a=Math.max(this.cellSize.width,1),h=0,l=0,c=0,u=P.l();for(let T=0;T<t.length;T++){let N=t[T],C=this.getLayoutBounds(N,r),R=N.getRelativePoint(N.locationObject,N.locationSpot,u);h=Math.max(h,R.x),l=Math.max(l,C.width-R.x),c=Math.max(c,R.y)}let d=this.arrangement;switch(d){case 11:h+=s;break;default:l+=s;break}isFinite(a)?a=Math.max(a+s,1):a=Math.max(h+l,1);let g=this.arrangementOrigin.x,p=this.arrangementOrigin.y,m=g,y=p,w=0;e>=h&&(e-=h);let b=0,v=0,k=Math.max(this.cellSize.height,1);c=0;let S=0,M=!0,F=P.l();for(let T=0;T<t.length;T++){let N=t[T],C=this.getLayoutBounds(N,r),R=N.getRelativePoint(N.locationObject,N.locationSpot,u);if(w>0)switch(d){case 11:{let B=(m-g-(C.width-R.x))/a;L.z(Math.round(B),B)?B=Math.round(B):B=Math.floor(B),m=B*a+g;break}default:{let B=(m-g+R.x)/a;L.z(Math.round(B),B)?B=Math.round(B):B=Math.ceil(B),m=B*a+g;break}}else switch(d){case 11:b=m+R.x+C.width;break;default:b=m-R.x;break}let O=0;switch(d){case 11:O=-(m+R.x)+b;break;default:O=m+C.width-R.x-b;break}if(i>0&&w>i-1||e>0&&w>0&&O>e){o.push(new z(0,M?y-c:y,e+s,S+c+n));for(let B=0;B<w&&T!==w;B++){let X=t[T-w+B],Y=X.getRelativePoint(X.locationObject,X.locationSpot,F);X.moveTo(X.position.x,X.position.y+c-Y.y)}S+=n,M?y+=S:y+=S+c,c=0,S=0,w=0,m=g,M=!1}switch(m===g&&(d===11?v=Math.max(v,C.width-R.x):v=Math.min(v,-R.x)),c=Math.max(c,R.y),S=Math.max(S,C.height-R.y),isFinite(k)&&(S=Math.max(S,Math.max(C.height,k)-R.y)),M?N.moveTo(m-R.x,y-R.y):N.moveTo(m-R.x,y),d){case 11:m-=R.x+s;break;default:m+=C.width-R.x+s;break}w++}if(o.push(new z(0,y,e+s,(M?S:S+c)+n)),t.length!==w)for(let T=0;T<w;T++){let N=t[t.length-w+T],C=N.getRelativePoint(N.locationObject,N.locationSpot,u);N.moveTo(N.position.x,N.position.y+c-C.y)}if(P.e(u),P.e(F),d===11)for(let T=0;T<o.length;T++){let N=o[T];N.width+=v,N.x-=v}else for(let T=0;T<o.length;T++){let N=o[T];N.x>v&&(N.width+=N.x-v,N.x=v)}z.e(r)}commitLayers(t,e){}get wrappingWidth(){return this.Yd}set wrappingWidth(t){this.Yd!==t&&(f.s(t,"number",ri,"wrappingWidth"),(t>0||isNaN(t))&&(this.Yd=t,this.isViewportSized=isNaN(t),this.invalidateLayout()))}get wrappingColumn(){return this.Kd}set wrappingColumn(t){this.Kd!==t&&(f.s(t,"number",ri,"wrappingColumn"),(t>0||isNaN(t))&&(this.Kd=t,this.invalidateLayout()))}get cellSize(){return this.Po}set cellSize(t){this.Po.equals(t)||(this.Po.a(t),this.invalidateLayout())}get spacing(){return this.kn}set spacing(t){this.kn.equals(t)||(this.kn.a(t),this.invalidateLayout())}get alignment(){return this.hi}set alignment(t){this.hi!==t&&(t===1||t===0)&&(this.hi=t,this.invalidateLayout())}get arrangement(){return this.Xi}set arrangement(t){this.Xi!==t&&(t===10||t===11)&&(this.Xi=t,this.invalidateLayout())}get sorting(){return this.pe}set sorting(t){this.pe!==t&&(t===20||t===21||t===22||t===23)&&(this.pe=t,this.invalidateLayout())}get comparer(){return this.ye}set comparer(t){this.ye!==t&&(f.k(t,ri,"comparer"),this.ye=t,this.invalidateLayout())}static standardComparer(t,e){let i=t.text,s=e.text;return i<s?-1:i>s?1:0}static smartComparer(t,e){if(t!==null)if(e!==null){let i=t.text.toLocaleLowerCase(),s=e.text.toLocaleLowerCase(),n=i.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),o=s.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),r=0;for(;r<n.length;r++)if(o[r]!==""&&o[r]!==void 0){let a=parseFloat(n[r]),h=parseFloat(o[r]);if(isNaN(a))if(isNaN(h)){if(n[r].localeCompare(o[r])!==0)return n[r].localeCompare(o[r]);continue}else return 1;else{if(isNaN(h))return-1;if(a-h!==0)return a-h;continue}}else{if(n[r]==="")continue;return 1}return o[r]!==""&&o[r]!==void 0?-1:0}else return 1;else return e!==null?-1:0}static Position=0;static Location=1;static LeftToRight=10;static RightToLeft=11;static Forward=20;static Reverse=21;static Ascending=22;static Descending=23}class Se{jd;Hs;Ct;uo;Hd;qd;N;MN;constructor(){this.jd=new I,this.Hs=new I,this.Ct=new I,this.uo=new pt,this.Hd=new pt,this.qd=new pt,this.N=null,this.MN=!1}clear(){this.jd.clear(),this.Hs.clear(),this.Ct.clear(),this.uo.clear(),this.Hd.clear(),this.qd.clear()}Mo(t){this.N=t}Jh(t){if(t instanceof rt){if(this.jd.add(t),t instanceof ft){let i=t.containingGroup;i===null?this.diagram.zr.add(t):i.ca.add(t);let s=t.layout;s!==null&&(s.diagram=this.diagram)}}else t instanceof _?(this.Hs.add(t),t.isAvoiding&&(this.diagram.Vm=!0)):t instanceof St||this.Ct.add(t);let e=t.data;e!==null&&(t instanceof St||(t instanceof _?this.FT(e,t):this.uo.set(e,t)))}te(t){if(t.clearAdornments(),t instanceof rt){if(this.jd.delete(t),t instanceof ft){let i=t.containingGroup;i===null?this.diagram.zr.delete(t):i.ca.delete(t);let s=t.layout;s!==null&&(s.diagram=null)}}else t instanceof _?this.Hs.delete(t):t instanceof St||this.Ct.delete(t);let e=t.data;e!==null&&(t instanceof St||(t instanceof _?this.RT(e,t):this.uo.delete(e)))}FT(t,e){this.Hd.set(t,e)}RT(t,e){this.Hd.delete(t)}rebuildParts(){let t=this.diagram;if(t===null)return;let e=t.nodeTemplateMap.iterator;for(;e.next();){let d=e.value,g=e.key;(!d.ke()||d instanceof ft)&&f.o(`Invalid node template in Diagram.nodeTemplateMap: template for "${g}" must be a Node or a simple Part, not a Group or Link: ${d}`)}let i=t.groupTemplateMap.iterator;for(;i.next();){let d=i.value,g=i.key;d instanceof ft||f.o(`Invalid group template in Diagram.groupTemplateMap: template for "${g}" must be a Group, not a normal Node or Link: ${d}`)}let s=t.linkTemplateMap.iterator;for(;s.next();){let d=s.value,g=s.key;d instanceof _||f.o(`Invalid link template in Diagram.linkTemplateMap: template for "${g}" must be a Link, not a normal Node or simple Part: ${d}`)}let n=f.et(),o=t.selection.iterator;for(;o.next();){let d=o.value.data;d&&n.push(d)}let r=f.et(),a=t.highlighteds.iterator;for(;a.next();){let d=a.value.data;d&&r.push(d)}let h=f.et(),l=this.nodes.iterator;for(;l.next();){let d=l.value;d.data!==null&&(h.push(d.data),h.push(d.location))}let c=this.links.iterator;for(;c.next();){let d=c.value;d.data!==null&&(h.push(d.data),h.push(d.location))}let u=this.parts.iterator;for(;u.next();){let d=u.value;d.data!==null&&(h.push(d.data),h.push(d.location))}this.vT(),this.zM();for(let d=0;d<n.length;d++){let g=this.findPartForData(n[d]);g!==null&&(g.isSelected=!0)}for(let d=0;d<r.length;d++){let g=this.findPartForData(r[d]);g!==null&&(g.isHighlighted=!0)}for(let d=0;d<h.length;d+=2){let g=this.findPartForData(h[d]);g!==null&&(g.location=h[d+1])}f.J(n),f.J(r),f.J(h)}zM(){let t=this.diagram.model;this.Sy(t.nodeDataArray)}Sy(t,e){let i=this.diagram.model;t.forEach(s=>{i.containsNodeData(s)&&this.OT(s,!1)}),t.forEach(s=>{i.containsNodeData(s)&&this.R1(s)}),e!==!1&&this.diagram.Cb(!1)}OT(t,e){if(t==null||this.diagram.undoManager.isUndoingRedoing||this.uo.has(t))return null;e===void 0&&(e=!0);let i=this.YO(t);return i!==null&&e&&this.R1(t),i}YO(t){if(t==null||this.diagram.undoManager.isUndoingRedoing||this.uo.has(t))return null;let e=this.KO(t),i=this.findTemplateForNodeData(t,e);if(i!==null){i.Et();let s=i.copy();if(s!==null){let n=this.diagram.fe;return this.diagram.fe=!0,s.zo=e,s._t=t,this.addsToTemporaryLayer&&(s.nl="Tool"),this.diagram.add(s),s._t=null,s.data=t,this.diagram.fe=n,s}}return null}insertLink(t,e,i,s){return null}R1(t){}KO(t){return this.diagram.model.getCategoryForNodeData(t)}static IT=!1;static ET=!1;findTemplateForNodeData(t,e){let i=this.diagram,s=i.model,n=s.Hc()&&s.isGroupForData(t),o=null;return n?(o=i.groupTemplateMap.get(e),o===null&&(o=i.groupTemplateMap.get(""),o===null&&(Se.ET||(Se.ET=!0,f.ni('No Group template found for category "'+e+'"'),f.ni(" Using default group template")),o=i.yM))):(o=i.nodeTemplateMap.get(e),o===null&&(o=i.nodeTemplateMap.get(""),o===null&&(Se.IT||(Se.IT=!0,f.ni('No Node template found for category "'+e+'"'),f.ni(" Using default node template")),o=i.gM))),o}getLinkCategoryForData(t){return""}setLinkCategoryForData(t,e){}setFromNodeForLink(t,e,i){}setToNodeForLink(t,e,i){}static UT=!1;findLinkTemplateForCategory(t){let e=this.diagram,i=e.linkTemplateMap.get(t);return i===null&&(i=e.linkTemplateMap.get(""),i===null&&(Se.UT||(Se.UT=!0,f.ni('No Link template found for category "'+t+'"'),f.ni(" Using default link template")),i=e.mM)),i}vv(t,e,i){t instanceof _?(e!==null&&this.RT(e,t),i!==null&&this.FT(i,t)):t instanceof Nt&&(e!==null&&this.uo.delete(e),i!==null&&this.uo.set(i,t))}vT(){let t=this.diagram.model;this.NN(t.nodeDataArray)}NN(t){t.forEach(e=>{this.v1(e)})}v1(t){let e=this.findPartForData(t);e!==null&&(this.diagram.UM(e,!1),this.CN(e))}CN(t){}pN(t){}findPartForKey(t){if(t==null)return null;let e=this.diagram.model.findNodeDataForKey(t);return e!==null?this.uo.get(e):null}findNodeForKey(t){if(t==null)return null;let e=this.diagram.model.findNodeDataForKey(t);if(e===null)return null;let i=this.uo.get(e);return i instanceof rt?i:null}findLinkForKey(t){return null}findPartForData(t){if(t===null)return null;let e=this.uo.get(t);return e!==null||(e=this.Hd.get(t)),e}findNodeForData(t){if(t===null)return null;let e=this.uo.get(t);return e instanceof rt?e:null}findLinkForData(t,e){return t===null?null:this.Hd.get(t)}findNodesByExample(...t){let e=new I,i=this.jd.iterator;for(;i.next();){let s=i.value,n=s.data;if(n!==null)for(let o=0;o<arguments.length;o++){let r=arguments[o];if(f.Y(r)&&this.LN(n,r)){e.add(s);break}}}return e.iterator}findLinksByExample(...t){let e=new I,i=this.Hs.iterator;for(;i.next();){let s=i.value,n=s.data;if(n!==null)for(let o=0;o<arguments.length;o++){let r=arguments[o];if(f.Y(r)&&this.LN(n,r)){e.add(s);break}}}return e.iterator}LN(t,e){for(let i in e){let s=t[i],n=e[i];if(Array.isArray(n)){if(!Array.isArray(s))return!1;let o=s,r=n;if(o.length<r.length)return!1;for(let a=0;a<o.length;a++){let h=o[a],l=r[a];if(l!==void 0&&!this.BT(h,l))return!1}}else if(!this.BT(s,n))return!1}return!0}BT(t,e){if(f.it(e)){if(!e(t))return!1}else if(e instanceof RegExp){if(!t||!e.test(t.toString()))return!1}else if(f.Y(t)&&f.Y(e)){if(!this.LN(t,e))return!1}else if(t!==e)return!1;return!0}doModelDataChanged(t){if(t.model===this.diagram.model&&this.diagram.X){this.diagram.X=!1;try{let e=t.change;t.modelChange===""&&t.object!==null&&e===2&&this.My(t.object,t.propertyName)}finally{this.diagram.X=!0}}}doModelChanged(t){let e=this.diagram;if(!e||t.model!==e.model)return;let i=t.change;if(e.IR(t),!!e.X){e.X=!1;try{let s=t.modelChange;if(s!=="")if(i===2){if(s==="nodeCategory"){let n=t.object;if(n!==null){let o=this.findPartForData(n),r=t.newValue;o!==null&&typeof r=="string"&&(o.category=r)}}else if(s==="nodeDataArray"){let n=t.oldValue;this.NN(n);let o=t.newValue;this.Sy(o)}e.isModified=!0}else if(i===3){let n=t.newValue;s==="nodeDataArray"&&f.Y(n)&&this.OT(n),e.isModified=!0}else if(i===4){let n=t.oldValue;s==="nodeDataArray"&&f.Y(n)&&this.v1(n),e.isModified=!0}else i===1&&(s==="SourceChanged"?t.object!==null?this.My(t.object,t.propertyName):(this.updateAllRelationshipsFromData(),this.updateAllTargetBindings()):s==="ModelDisplaced"&&this.rebuildParts());else if(i===2){let n=t.propertyName,o=t.object,r=e.model;o===r?(n==="nodeKeyProperty"||n==="nodeCategoryProperty")&&(e.undoManager.isUndoingRedoing||this.rebuildParts()):o!==null&&this.My(o,n),e.isModified=!0}else(i===3||i===4)&&(this.jO(t,e.model),e.isModified=!0)}finally{e.X=!0}}}updateAllTargetBindings(t){t===void 0&&(t="");let e=this.parts.iterator;for(;e.next();)e.value.updateTargetBindings(t);for(e=this.nodes.iterator;e.next();)e.value.updateTargetBindings(t);for(e=this.links.iterator;e.next();)e.value.updateTargetBindings(t)}updateAllThemeBindings(){let t=this.parts.iterator;for(;t.next();)t.value.Do();for(t=this.nodes.iterator;t.next();)t.value.Do();for(t=this.links.iterator;t.next();)t.value.Do()}updateAllRelationshipsFromData(){let t=this.diagram.model,e=new I,i=t.nodeDataArray;for(let o=0;o<i.length;o++){let r=i[o];e.add(r)}let s=[];this.nodes.each(o=>{o.data!==null&&!e.has(o.data)&&s.push(o.data)}),this.parts.each(o=>{o.data!==null&&!e.has(o.data)&&s.push(o.data)}),s.forEach(o=>t.VT(o,!1));for(let o=0;o<i.length;o++){let r=i[o];this.findPartForData(r)===null&&t.zT(r,!1)}this.XT();let n=this.parts.iterator;for(;n.next();)n.value.updateRelationshipsFromData();for(n=this.nodes.iterator;n.next();)n.value.updateRelationshipsFromData();for(n=this.links.iterator;n.next();)n.value.updateRelationshipsFromData()}XT(){}updateRelationshipsFromData(t){}My(t,e){if(typeof e=="string"){let i=this.findPartForData(t);if(i!==null)i.updateTargetBindings(e);else{let s=this.HO(t);if(s!==null&&s.length>0){for(let o=0;o<s.length;o++)s[o].updateTargetBindings(e);let n=s[0].part;if(n!==null){let o=n.adornments;for(;o.next();)o.value.updateTargetBindings(e)}f.J(s)}}t===this.diagram.model.modelData&&this.updateAllTargetBindings(e)}}HO(t){let e=null,i=this.qd.iterator;for(;i.next();){let s=i.value;for(let n=0;n<s.length;n++){let o=s[n].findItemPanelForData(t);o!==null&&(e===null&&(e=f.et()),e.push(o))}if(e!==null)break}return e}AN(t){return this.qd.get(t)}jO(t,e){let i=t.object;if(!Array.isArray(i))return;let s=t.change===3,n=s?t.newParam:t.oldParam,o=s?t.newValue:t.oldValue,r=this.AN(i);if(Array.isArray(r))for(let a=0;a<r.length;a++){let h=r[a];s?h.e1(o,n,!0):h.Iv(n)}}IM(t,e){e!==null&&t.Yr(s=>e.KL(s));let i=t.wh;if(Array.isArray(i)){let s=this.AN(i);if(s===null)this.qd.set(i,[t]);else{for(let n=0;n<s.length;n++)if(s[n]===t)return;s.push(t)}}}EM(t,e){t.Yr(s=>e.UR(s));let i=t.wh;if(Array.isArray(i)){let s=this.AN(i);if(s!==null){for(let n=0;n<s.length;n++)if(s[n]===t){s.splice(n,1),s.length===0&&this.qd.delete(i);return}}}}copyParts(t,e,i){i===void 0&&(i=!1);let s=new pt;if(Array.isArray(t))for(let o=0;o<t.length;o++)this.O1(t[o],e,s,i);else{let o=t.iterator;for(;o.next();)this.O1(o.value,e,s,i)}if(e!==null){let o=e.model,r=e.s0().dragsLink,a=new I,h=new pt,l=s.iterator;for(;l.next();){let c=l.value;if(c instanceof _)!r&&(c.fromNode===null||c.toNode===null)&&a.add(c);else if(c instanceof rt&&c.data!==null){if(o.pm()){let u=c,d=l.key,g=d.findTreeParentNode();if(g!==null){let p=s.get(g);if(p!==null){o.setParentKeyForNodeData(u.data,o.getKeyForNodeData(p.data));let m=e.findLinkForData(u.data),y=d.findTreeParentLink();y!==null&&m!==null&&h.set(y,m)}}}else if(o.Mb()){let u=c,d=l.key,g=o.isRelatedKeysPathTo?d.findNodesOutOf():d.findNodesInto();for(;g.next();){let p=g.value,m=s.get(p);if(m!==null){o.addRelatedKeyForNodeData(u.data,m.key);let y=e.partManager.findLinkForData(u.data,m.key),w=this.findLinkForData(d.data,p.key);w!==null&&y!==null&&h.set(w,y)}else o.removeRelatedKeyForNodeData(u.data,p.key)}}}}if(a.count>0&&e.removeParts(a,!1),h.count>0){let c=h.iterator;for(;c.next();){let u=c.key,d=c.value;s.set(u,d)}}}if(e!==null&&this.diagram!==null){let o=e.model,r=o.afterCopyFunction;if(r!==null){let a=new pt;s.each(l=>{l.key.data!==null&&a.set(l.key.data,l.value.data)});let h=this.diagram.model;r(a,o,h)}}let n=s.iterator;for(;n.next();)n.value.updateTargetBindings();return s}O1(t,e,i,s){if(t===null||s&&!t.canCopy())return null;if(i.has(t))return i.get(t);let n=this.TN(t,e);if(!(n instanceof Nt))return null;if(n.isSelected=!1,n.isHighlighted=!1,i.set(t,n),t instanceof rt){let o=t.linksConnected;for(;o.next();){let r=o.value;if(r.fromNode===t){let a=i.get(r);a!==null&&(a.fromNode=n)}if(r.toNode===t){let a=i.get(r);a!==null&&(a.toNode=n)}}if(t instanceof ft&&n instanceof ft){let r=t.memberParts;for(;r.next();){let a=r.value,h=this.O1(a,e,i,s);h instanceof _||h!==null&&(h.containingGroup=n)}}}else if(t instanceof _&&n instanceof _){let o=t.fromNode;if(o!==null){let h=i.get(o);h!==null&&(n.fromNode=h)}let r=t.toNode;if(r!==null){let h=i.get(r);h!==null&&(n.toNode=h)}let a=t.labelNodes;for(;a.next();){let h=a.value,l=this.O1(h,e,i,s);l!==null&&l instanceof rt&&(l.labeledLink=n)}}return n}TN(t,e){let i=null,s=t.data;if(s!==null&&e!==null){let n=e.model;if(!(t instanceof _)){let o=n.copyNodeData(s);f.Y(o)&&(n.addNodeData(o),i=e.findPartForData(o))}}else if(t.Et(),i=t.copy(),i!==null){let n=this.diagram;if(e!==null)e.add(i);else if(s!==null&&n!==null&&n.commandHandler!==null&&n.commandHandler.copiesClipboardData){let o=n.model,r=null;i instanceof _||(r=o.copyNodeData(s)),f.Y(r)&&(i.data=r)}}return i}get nodes(){return this.jd}get links(){return this.Hs}get parts(){return this.Ct}get diagram(){return this.N}get addsToTemporaryLayer(){return this.MN}set addsToTemporaryLayer(t){this.MN=t}}class xr extends Se{zM(){let t=this.diagram.model;this.Sy(t.nodeDataArray),this.GT(t.linkDataArray)}Sy(t){super.Sy(t,!1);let e=this.links.iterator;for(;e.next();)e.value.Pd();this.diagram.Cb(!1)}GT(t){t.forEach(e=>{this.YT(e)}),this.diagram.Cb(!1)}YT(t){if(t==null||this.diagram.undoManager.isUndoingRedoing||this.findLinkForData(t))return null;let e=this.getLinkCategoryForData(t),i=this.findLinkTemplateForCategory(e);if(i!==null){i.Et();let s=i.copy();if(s!==null){let n=this.diagram.fe;this.diagram.fe=!0,s.zo=e,s._t=t;let o=this.diagram.model,r=o.I1(t,!0);r!==""&&(s.fromPortId=r);let a=o.Ae(t,!0);if(a!==void 0){let u=this.findNodeForKey(a);u instanceof rt&&(s.fromNode=u)}let h=o.I1(t,!1);h!==""&&(s.toPortId=h);let l=o.Ae(t,!1);if(l!==void 0){let u=this.findNodeForKey(l);u instanceof rt&&(s.toNode=u)}let c=o.getLabelKeysForLinkData(t);return Array.isArray(c)&&c.forEach(u=>{let d=this.findNodeForKey(u);d!==null&&(d.labeledLink=s)}),this.addsToTemporaryLayer&&(s.nl="Tool"),this.diagram.add(s),s._t=null,s.data=t,this.diagram.fe=n,s}}return null}vT(){let t=this.diagram.model;this.KT(t.linkDataArray),this.NN(t.nodeDataArray)}KT(t){t.forEach(e=>{this.v1(e)})}getLinkCategoryForData(t){return this.diagram.model.getCategoryForLinkData(t)}setLinkCategoryForData(t,e){return this.diagram.model.setCategoryForLinkData(t,e)}setFromNodeForLink(t,e){let i=this.diagram.model,s=e!==null?e.data:null;i.setFromKeyForLinkData(t.data,i.getKeyForNodeData(s))}setToNodeForLink(t,e){let i=this.diagram.model,s=e!==null?e.data:null;i.setToKeyForLinkData(t.data,i.getKeyForNodeData(s))}pN(t){this.diagram.model.removeLinkData(t.data)}findPartForKey(t){let e=super.findPartForKey(t);if(e===null){let i=this.diagram.model.findLinkDataForKey(t);if(i!==null)return this.findLinkForData(i)}return e}findLinkForKey(t){if(t==null)return null;let e=this.diagram.model.findLinkDataForKey(t);return e!==null?this.findLinkForData(e):null}doModelChanged(t){if(super.doModelChanged(t),!this.diagram)return;let e=this.diagram;if(t.model!==e.model)return;let i=t.change;if(e.X){e.X=!1;try{let s=t.modelChange;if(s!==""){if(i===2){if(s==="linkFromKey"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue,a=this.findNodeForKey(r);o.fromNode=a}}else if(s==="linkToKey"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue,a=this.findNodeForKey(r);o.toNode=a}}else if(s==="linkFromPortId"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue;typeof r=="string"&&(o.fromPortId=r)}}else if(s==="linkToPortId"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue;typeof r=="string"&&(o.toPortId=r)}}else if(s==="nodeGroupKey"){let n=t.object,o=this.findPartForData(n);if(o!==null){let r=t.newValue;if(r!==void 0){let a=this.findNodeForKey(r);a instanceof ft?o.containingGroup=a:o.containingGroup=null}else o.containingGroup=null}}else if(s==="linkLabelKeys"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.oldValue,a=t.newValue;Array.isArray(r)&&r.forEach(h=>{if(a.indexOf(h)>=0)return;let l=this.findNodeForKey(h);l!==null&&(l.labeledLink=null)}),Array.isArray(a)&&a.forEach(h=>{let l=this.findNodeForKey(h);l!==null&&(l.labeledLink=o)})}}else if(s==="linkCategory"){let n=t.object,o=this.findLinkForData(n),r=t.newValue;o!==null&&typeof r=="string"&&(o.category=r)}else if(s==="linkDataArray"){let n=t.oldValue;this.KT(n);let o=t.newValue;this.GT(o)}e.isModified=!0}else if(i===3){let n=t.newValue;if(s==="linkDataArray"&&f.Y(n))this.YT(n);else if(s==="linkLabelKeys"&&t.model.isKeyType(n)){let o=t.object,r=this.findLinkForData(o),a=this.findNodeForKey(n);r!==null&&a!==null&&(a.labeledLink=r)}e.isModified=!0}else if(i===4){let n=t.oldValue;if(s==="linkDataArray"&&f.Y(n))this.v1(n);else if(s==="linkLabelKeys"&&t.model.isKeyType(n)){let o=this.findNodeForKey(n);o!==null&&(o.labeledLink=null)}e.isModified=!0}}else if(i===2){let n=t.propertyName,o=t.object,r=e.model;o===r&&(n==="linkFromKeyProperty"||n==="linkToKeyProperty"||n==="linkFromPortIdProperty"||n==="linkToPortIdProperty"||n==="linkLabelKeysProperty"||n==="nodeIsGroupProperty"||n==="nodeGroupKeyProperty"||n==="linkCategoryProperty")&&(e.undoManager.isUndoingRedoing||this.rebuildParts()),e.isModified=!0}}finally{e.X=!0}}}XT(){let t=this.diagram.model,e=new I,i=t.linkDataArray;i.forEach(n=>{e.add(n)});let s=[];this.links.each(n=>{n.data!==null&&!e.has(n.data)&&s.push(n.data)}),s.forEach(n=>{t.jT(n,!1)}),i.forEach(n=>{this.findLinkForData(n)===null&&t.HT(n,!1)})}updateRelationshipsFromData(t){let e=t.data;if(e===null)return;let i=t.diagram;if(i===null)return;let s=i.model;if(t instanceof _){let n=s.Ae(e,!0),o=i.findNodeForKey(n);t.fromNode=o,n=s.Ae(e,!1),o=i.findNodeForKey(n),t.toNode=o;let r=s.getLabelKeysForLinkData(e);if(r.length>0||t.labelNodes.count>0){if(r.length===1&&t.labelNodes.count===1){let u=r[0],d=t.labelNodes.first();if(s.getKeyForNodeData(d.data)===u)return}let a=new I().addAll(r),h=new I;t.labelNodes.each(u=>{if(u.data!==null){let d=s.getKeyForNodeData(u.data);d!==void 0&&h.add(d)}});let l=h.copy();l.removeAll(a);let c=a.copy();if(c.removeAll(h),l.count>0||c.count>0){let u=t;l.each(d=>{let g=i.findNodeForKey(d);g!==null&&g.labeledLink===u&&(g.labeledLink=null)}),c.each(d=>{let g=i.findNodeForKey(d);g!==null&&g.labeledLink!==u&&(g.labeledLink=u)})}}}else if(!(t instanceof St)){let n=s.getGroupKeyForNodeData(e),o=i.findPartForKey(n);(o===null||o instanceof ft)&&(t.containingGroup=o)}}R1(t){let e=this.diagram.model,i=e.getKeyForNodeData(t);if(i!==void 0){let s=e.Ny(i),n=this.findPartForData(t);if(s!==null&&n!==null){let r=s.iterator;for(;r.next();){let a=r.value;if(e.containsNodeData(a)){if(n instanceof ft&&e.getGroupKeyForNodeData(a)===i){let h=this.findPartForData(a);h!==null&&(h.containingGroup=n)}}else{let h=this.findLinkForData(a);if(h!==null&&n instanceof rt){e.Ae(a,!0)===i&&(h.fromNode=n),e.Ae(a,!1)===i&&(h.toNode=n);let l=e.getLabelKeysForLinkData(a);Array.isArray(l)&&l.some(c=>c===i?(n.labeledLink=h,!0):!1)}}}e.Ws(i)}let o=e.getGroupKeyForNodeData(t);if(o!==void 0){let r=this.findNodeForKey(o);r instanceof ft&&(n.containingGroup=r)}}}CN(t){let e=this.diagram.model;if(t instanceof rt){let i=e.getKeyForNodeData(t.data);if(i!==void 0){let s=t.linksConnected;for(;s.next();){let n=s.value;e.Js(i,n.data)}if(t.isLinkLabel){let n=t.labeledLink;n!==null&&e.Js(i,n.data)}if(t instanceof ft){let n=t.memberParts;for(;n.next();){let o=n.value.data;e.containsNodeData(o)&&e.Js(i,o)}}}}}TN(t,e){let i=super.TN(t,e);if(t instanceof _){let s=t.data;if(s!==null&&e!==null){let n=e.model,o=n.copyLinkData(s);f.Y(o)&&(n.addLinkData(o),i=e.findLinkForData(o))}else if(i!==null){let n=this.diagram;if(s!==null&&n!==null&&n.commandHandler!==null&&n.commandHandler.copiesClipboardData){let o=n.model.copyLinkData(s);f.Y(o)&&(i.data=o)}}}return i}insertLink(t,e,i,s){let n=this.diagram,o=n.model,r=n.toolManager.findTool("Linking"),a="";t!==null&&(e===null&&(e=t),a=e.portId,a===null&&(a=""));let h="";i!==null&&(s===null&&(s=i),h=s.portId,h===null&&(h=""));let l=r.archetypeLinkData;if(l instanceof _){l.Et();let c=l.copy();if(c!==null){c.fromNode=t,c.fromPortId=a,c.toNode=i,c.toPortId=h,n.add(c);let u=r.archetypeLabelNodeData;if(u instanceof rt){u.Et();let d=u.copy();d!==null&&(d.labeledLink=c,n.add(d))}return c}}else if(l!==null){let c=o.copyLinkData(l);if(f.Y(c)){t!==null&&o.Wd(c,o.getKeyForNodeData(t.data),!0),o.Jd(c,a,!0),i!==null&&o.Wd(c,o.getKeyForNodeData(i.data),!1),o.Jd(c,h,!1),o.addLinkData(c);let u=r.archetypeLabelNodeData;if(u!==null&&!(u instanceof rt)){let d=o.copyNodeData(u);if(f.Y(d)){o.addNodeData(d);let g=o.getKeyForNodeData(d);g!==void 0&&o.addLabelKeyForLinkData(c,g)}}return n.findLinkForData(c)}}return null}}class wr extends Se{Nh=null;E1(t,e){if(t===null||e===null||e.findTreeParentLink()!==null)return null;let i=this.diagram.toolManager.findTool("Linking"),s=t,n=e;if(this.diagram.isTreePathToChildren){if(i!==null&&i.yu(s,n,null,!0))return null}else if(s=e,n=t,i!==null&&i.yu(s,n,null,!0))return null;let o=this.getLinkCategoryForData(e.data),r=this.findLinkTemplateForCategory(o);if(r!==null){r.Et();let a=r.copy();if(a!==null){let h=this.diagram.fe;return this.diagram.fe=!0,a.zo=o,a._t=e.data,a.fromNode=s,a.toNode=n,this.diagram.add(a),a._t=null,a.data=e.data,this.diagram.fe=h,a}}return null}getLinkCategoryForData(t){return this.diagram.model.getParentLinkCategoryForNodeData(t)}setLinkCategoryForData(t,e){this.diagram.model.setParentLinkCategoryForNodeData(t,e)}setFromNodeForLink(t,e,i){let s=this.diagram.model;i===void 0&&(i=null);let n=e!==null?e.data:null;if(this.diagram.isTreePathToChildren)s.setParentKeyForNodeData(t.data,s.getKeyForNodeData(n));else{let o=this.Nh;this.Nh=t,i!==null&&s.setParentKeyForNodeData(i.data,void 0);let r=t.toNode!==null?t.toNode.data:null;s.setParentKeyForNodeData(n,s.getKeyForNodeData(r)),this.Nh=o}}setToNodeForLink(t,e,i){let s=this.diagram.model;i===void 0&&(i=null);let n=e!==null?e.data:null;if(this.diagram.isTreePathToChildren){let o=this.Nh;this.Nh=t,i!==null&&s.setParentKeyForNodeData(i.data,void 0);let r=t.fromNode!==null?t.fromNode.data:null;s.setParentKeyForNodeData(n,s.getKeyForNodeData(r)),this.Nh=o}else s.setParentKeyForNodeData(t.data,s.getKeyForNodeData(n))}pN(t){this.diagram.model.setParentKeyForNodeData(t.data,void 0)}findLinkForKey(t){if(t==null)return null;let e=this.diagram.model.findNodeDataForKey(t);return e!==null?this.findLinkForData(e):null}doModelChanged(t){if(super.doModelChanged(t),!this.diagram)return;let e=this.diagram;if(t.model!==e.model)return;let i=t.change;if(e.X){e.X=!1;try{let s=t.modelChange;if(s!==""){if(i===2){if(s==="nodeParentKey"){let n=t.object,o=t.newValue,r=this.findNodeForKey(o),a=this.findNodeForData(n);if(this.Nh!==null)r!==null&&(this.Nh.data=n,this.Nh.category=this.getLinkCategoryForData(n));else if(a!==null){let h=a.findTreeParentLink();h!==null?r===null?e.remove(h):e.isTreePathToChildren?h.fromNode=r:h.toNode=r:this.E1(r,a)}}else if(s==="parentLinkCategory"){let n=t.object,o=this.findNodeForData(n),r=t.newValue;if(o!==null&&typeof r=="string"){let a=o.findTreeParentLink();a!==null&&(a.category=r)}}e.isModified=!0}}else if(i===2){let n=t.propertyName,o=t.object,r=e.model;o===r&&n==="nodeParentKeyProperty"&&(e.undoManager.isUndoingRedoing||this.rebuildParts()),e.isModified=!0}}finally{e.X=!0}}}updateRelationshipsFromData(t){let e=t.data;if(e===null)return;let i=t.diagram;if(i===null)return;let s=i.model;if(t instanceof rt){let n=s.getParentKeyForNodeData(e),o=i.findNodeForKey(n),r=t.findTreeParentNode();if(o!==r){let a=t.findTreeParentLink();o!==null?a!==null?i.isTreePathToChildren?a.fromNode=o:a.toNode=o:this.E1(o,t):a!==null&&i.UM(a,!1)}}}My(t,e){if(super.My(t,e),typeof e=="string"&&this.findPartForData(t)!==null){let i=this.findLinkForData(t);i!==null&&i.updateTargetBindings(e)}}R1(t){let e=this.diagram.model,i=e.getKeyForNodeData(t);if(i!==void 0){let s=e.Ny(i),n=this.findPartForData(t);if(s!==null&&n!==null){let r=s.iterator;for(;r.next();){let a=r.value;if(e.containsNodeData(a)&&n instanceof rt&&e.getParentKeyForNodeData(a)===i){let h=this.findNodeForData(a);this.E1(n,h)}}e.Ws(i)}let o=e.getParentKeyForNodeData(t);if(o!==void 0&&n instanceof rt){let r=this.findNodeForKey(o);this.E1(r,n)}}}CN(t){let e=this.diagram.model;if(t instanceof rt){let i=e.getKeyForNodeData(t.data),s=this.findLinkForData(t.data);if(s!==null){s.isSelected=!1,s.isHighlighted=!1;let r=s.layer;if(r!==null){let a=r.te(-1,s,!1);a>=0&&this.diagram.raiseChangedEvent(4,"parts",r,s,null,a,null);let h=s.layerChanged;h!==null&&h(s,r,null)}}let n=this.diagram.isTreePathToChildren,o=t.linksConnected;for(;o.next();){let r=o.value,a=(n?r.toNode:r.fromNode).data;e.containsNodeData(a)&&e.Js(i,a)}}}insertLink(t,e,i,s){let n=this.diagram.model,o=t,r=i;if(this.diagram.isTreePathToChildren||(o=i,r=t),o!==null&&r!==null){let a=o.data,h=r.data;return n.setParentKeyForNodeData(h,n.getKeyForNodeData(a)),r.findTreeParentLink()}return null}}var ss=(x=>(x[x.OneWay=1]="OneWay",x[x.TwoWay=2]="TwoWay",x))(ss||{});class oe{n;DN;Ga;Cf;Ch;Lf;Af;Tf;U1;be;ad;ff;constructor(t,e,i,s){I.Ki(this),t===void 0?t="":f.s(t,"string",oe,"constructor:targetprop"),e===void 0?e=t:f.s(e,"string",oe,"constructor:sourceprop"),i===void 0?i=null:i!==null&&f.k(i,oe,"constructor:conv"),this.DN=-1,this.be=null,this.Ga=t,this.ad=0,this.ff=0,this.Cf=null,this.Ch=e,this.Lf=i,s===void 0?(this.Af=1,this.Tf=null):(this.Af=2,this.Tf=s),this.U1=new I,this.n=2}copy(){let t=new this.constructor;return this.cloneProtected(t),t}cloneProtected(t){t.Ga=this.Ga,t.ad=this.ad,t.ff=this.ff,t.Cf=this.Cf,t.Ch=this.Ch,t.Lf=this.Lf,t.Af=this.Af,t.Tf=this.Tf,t.n=this.n&-2}static OneWay=1;static TwoWay=2;static parseEnum(t,e){return f.k(t,oe,"parseEnum:ctor"),i=>{let s=parseInt(i);return isNaN(s)&&(s=f.Uh(t,i),s===null)?e:s}}oi(t){t in ss?this.mode=t:f.er(this,t)}static toString(t){return f.toString(t)}toString(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(this.targetId!==-1?" "+this.targetId:"")+" "+ss[this.mode]+")"}u(){return this.n=this.n|1,this}get targetId(){return this.DN}set targetId(t){this.h&&f.L(this),this.DN=t}get targetProperty(){return this.Ga}set targetProperty(t){this.h&&f.L(this),f.s(t,"string",oe,"targetProperty"),this.Ga=t}get sourceProperty(){return this.Ch}set sourceProperty(t){this.h&&f.L(this),f.s(t,"string",oe,"sourceProperty"),this.Ch=t}get h(){return(this.n&1)!==0}get isToData(){return(this.n&2)!==0}get isToObject(){return(this.n&4)!==0}get isToModel(){return(this.n&8)!==0}get isToTheme(){return(this.n&16)!==0}get FN(){return this.isToTheme&&!(this.isToData||this.isToObject||this.isToModel)}qu(){return!1}get sourceName(){return this.Cf}set sourceName(t){this.h&&f.L(this),t!==null&&f.s(t,"string",oe,"sourceName"),this.Cf=t,t!==null?this.n=this.n&-3|4:this.n=this.n|2}get converter(){return this.Lf}set converter(t){this.h&&f.L(this),t!==null&&f.k(t,oe,"converter"),this.Lf=t}get backConverter(){return this.Tf}set backConverter(t){this.h&&f.L(this),t!==null&&f.k(t,oe,"backConverter"),this.Tf=t}get mode(){return this.Af}set mode(t){this.h&&f.L(this),this.isToTheme&&t===2&&f.o("Theme Bindings cannot be TwoWay."),this.Af=t}makeTwoWay(t){return this.isToTheme&&f.o("Theme Bindings cannot be TwoWay."),this.mode=2,t&&(f.k(t,oe,"makeTwoWay"),this.backConverter=t),this}ofObject(t){return this.h&&f.L(this),t===void 0&&(t=""),this.sourceName=t,this}ofModel(){return this.h&&f.L(this),this.n=this.n&-3&-5|8,this.Cf=null,this}wA(t,e){let i=this.sourceName,s=null;return i===null||i===""?s=t:i==="/"?s=e.part:i==="."?s=e:i===".."?s=e.panel:s=t.findObject(i),s}check(t){let e=this.Ga,i=this.Ch,s=this.Lf;(this.qu()&&s===null&&this.Lh===null&&e===""||s===null&&e==="")&&f.ni("Binding error: target property is the empty string: "+this.toString()),this.qu()&&this.FN&&i===""&&s===null&&this.Lh===null&&f.ni("Binding error: theme bindings require a source property when not using a converter: "+this.toString()),t&&typeof e=="string"&&(!f.it(["setAttribute"])&&e.length>0&&e[0]!=="_"&&!f.dw(t,e)?f.ni("Binding error: undefined target property: "+e+" on "+t.toString()):e==="name"&&t instanceof dt&&f.ni("Binding error: cannot modify GraphObject.name on "+t.toString()))}updateTarget(t,e,i,s){let n=this.Ch;if(i!==void 0&&n!==""&&n!==i)return;let o=this.Ga,r=this.Lf,a=e;if(n!==""&&!this.FN&&(s?a=s.yt(e,n):a=yt.yt(e,n)),a===void 0)return;let h=t.diagram?.themeManager;if(r===null){if(o!==""){if(this.qu()&&(a=this.qT(h,a,t,o),a===void 0))return;s?s.Z(t,o,a):(e instanceof dt||e instanceof Yt)&&yt.Z(t,o,a)}}else try{if(o!==""){let l=r(a,t);if(this.qu()&&(l=this.qT(h,l,t,o),l===void 0))return;s?s.Z(t,o,l):(e instanceof dt||e instanceof Yt)&&yt.Z(t,o,l)}else r(a,t)}catch{}}updateSource(t,e,i,s){if(this.Af!==2)return;let n=this.Ga;if(i!==void 0&&n!==i)return;let o=this.Ch,r=this.Tf,a=s!==null?s.diagram:null,h=a!==null?a.model:null,l=t;if(n!==""&&(h?l=h.yt(t,n):l=yt.yt(t,n)),l!==void 0&&!this.U1.has(t))try{if(this.U1.add(t),r===null){if(o!=="")h!==null?h.setDataProperty(e,o,l):(e instanceof dt||e instanceof Yt)&&(e[o]=l);else if(h!==null&&s!==null&&s.itemIndex>=0&&s.panel!==null&&Array.isArray(s.panel.itemArray)){let c=s.itemIndex,u=s.panel.itemArray;h.removeArrayItem(u,c),h.insertArrayItem(u,c,l)}}else try{if(o!==""){let c=r(l,e,h);h!==null?h.setDataProperty(e,o,c):(e instanceof dt||e instanceof Yt)&&(e[o]=c)}else{let c=r(l,e,h);if(c!==void 0&&h!==null&&s!==null&&s.itemIndex>=0&&s.panel!==null&&Array.isArray(s.panel.itemArray)){let u=s.itemIndex,d=s.panel.itemArray;h.removeArrayItem(d,u),h.insertArrayItem(d,u,c)}}}catch{}}finally{this.U1.delete(t)}}}class pi extends oe{Cy;Lh;Ya;constructor(t,e,i,s,n){super(t,e,s),i==null&&(i=""),n===void 0&&(n=null),this.Cy=i,this.Lh=n,this.Ya=null,this.n=16}cloneProtected(t){super.cloneProtected(t),t.Cy=this.Cy,t.Lh=this.Lh,t.Ya=this.Ya}qu(){return!0}get themeSource(){return this.Cy}set themeSource(t){this.h&&f.L(this),t!==null&&f.s(t,"string",pi,"themeSource"),this.Cy=t,this.Ya=null,t!==null?this.n=this.n|16:this.n=this.n&-17}get themeConverter(){return this.Lh}set themeConverter(t){this.h&&f.L(this),t!==null&&f.k(t,pi,"themeConverter"),this.Lh=t}ofData(){return this.h&&f.L(this),this.n=this.n|2,this.Cf=null,this}qT(t,e,i,s){if(!t||(this.FN&&(e=this.Ch),!e&&e!==0))return;let n=this.themeSource;this.Ya!==null?n=this.Ya:typeof n=="string"&&n.includes(".")&&(this.Ya=n.split("."),n=this.Ya);let o=t.findValue(e,n,s);return o===void 0&&f.ni(`Theme warning: ${e} could not be found when setting target property ${s}.`),f.it(this.Lh)&&(o=this.Lh(o,i)),o}}class yt{Pt;$d;Ao;RN;Te;mi;Ah;Df;Ff;Zd;Qd;_d;tg;Ly;Ka;Jo;Ay;Lo;B1;constructor(t,e){if(I.Ki(this),this.Pt="",this.$d="",this.Ao=!1,this.RN={},this.Te=[],this.mi=new pt,this.Ah="key",this.Df=null,this.Ff=null,this.Zd=!1,this.Qd=!1,this._d=!1,this.tg=null,this.Ly=100,this.Ka="category",this.Jo=new pt,this.Ay=[],this.Lo=!1,this.B1=null,this.undoManager=new $i,t!==void 0&&(Array.isArray(t)?this.nodeDataArray=t:e=t),e){Object.assign(this,e);let i=e.Changed;i&&(delete this.Changed,this.addChangedListener(i))}}cloneProtected(t){t.Pt=this.Pt,t.$d=this.$d,t.Ao=this.Ao,t.Ah=this.Ah,t.Df=this.Df,t.Ff=this.Ff,t.Zd=this.Zd,t.Qd=this.Qd,t._d=this._d,t.tg=this.tg,t.Ly=this.Ly,t.Ka=this.Ka}copy(){let t=new this.constructor;return this.cloneProtected(t),t}clear(){this.Te=[],this.mi.clear(),this.Jo.clear(),this.undoManager.clear()}toString(t){if(t===void 0&&(t=0),t>1)return this.toJson();{let e=(this.name!==""?this.name:"")+" Model";if(t>0){e+=`
18
+ node data:`;let i=this.nodeDataArray,s=i.length;for(let n=0;n<s;n++){let o=i[n];e+=" "+this.getKeyForNodeData(o)+":"+f.toString(o)}}return e}}toIncrementalData(t){t.change!==1&&f.o("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+t.toString());let e=t.object;if(!t.isTransactionFinished||!(e instanceof Ai))return null;let i=this.WT(e);return this.vN(e,t.propertyName==="FinishedUndo",i)}vN(t,e,i){let s=this,n=!1,o=new I,r=new I,a=new I;t.changes.each(d=>{if(d.model===s){if(d.modelChange==="nodeDataArray")d.change===3?o.add(d.newValue):d.change===4&&a.add(d.oldValue);else if(s.containsNodeData(d.object))r.add(d.object);else if(d.change===2&&(s.modelData===d.object||d.propertyName==="modelData"))n=!0;else if(d.object!==null)if(i.has(d.object))i.get(d.object).each(g=>{s.containsNodeData(g)&&r.add(g)});else{if(d.object instanceof yt||s.Ra()&&s.containsLinkData(d.object))return;s.JT(d.object).each(g=>{r.add(g)})}}});let h=new I;o.each(d=>{h.add(s.getKeyForNodeData(d)),e||r.add(d)});let l=new I;a.each(d=>{l.add(s.getKeyForNodeData(d)),e&&r.add(d)});let c=s.cloneDeep(r.toArray()),u=null;return n&&(u===null&&(u={}),u.modelData=this.cloneDeep(this.modelData)),h.count>0&&(u===null&&(u={}),e?u.removedNodeKeys=h.toArray():u.insertedNodeKeys=h.toArray()),c.length>0&&(u===null&&(u={}),u.modifiedNodeData=c),l.count>0&&(u===null&&(u={}),e?u.insertedNodeKeys=l.toArray():u.removedNodeKeys=l.toArray()),u}cloneDeep(t){return this.ig(t,!0)}ig(t,e,i,s){if(!f.Y(t))return t;i||(i=new pt);let n=i.get(t);if(n)return n;let o;if(Array.isArray(t)){o=[],i.set(t,o);for(let r=0;r<t.length;r++){let a=t[r];o.push(this.ig(a,!1,i,s))}}else if(t instanceof P||t instanceof Q||t instanceof z||t instanceof Lt||t instanceof D)o=t.copy(),i.set(t,o);else{if(t instanceof E||t instanceof kt)return t;if(t instanceof G)o=new G().addAll(this.ig(t.toArray(),!1,i,s)),i.set(t,o);else if(t instanceof I)o=new I().addAll(this.ig(t.toArray(),!1,i,s)),i.set(t,o);else if(t instanceof pt)o=new pt().addAll(this.ig(t.toArray(),!1,i,s)),i.set(t,o);else if(t instanceof Date)o=new Date(t),i.set(t,o);else if(t instanceof RegExp)o=new RegExp(t),i.set(t,o),o.lastIndex=t.lastIndex;else if(yt.ON(null,"",t))o=t;else if(f.it(t.copy))o=t.copy(),i.set(t,o);else{o={},i.set(t,o);for(let r in t){if(r==="__gohashid")continue;let a=t[r];o[r]=this.ig(a,!1,i,s)}}}return o}De(t){return JSON.stringify(t).replace(/[\u007F-\uFFFF]/g,e=>{let i="0000"+e.charCodeAt(0).toString(16);return"\\u"+i.substring(i.length-4)})}eg(){let t="";return this.name!==""&&(t+=`,
19
+ "name": `+this.De(this.name)),this.dataFormat!==""&&(t+=`,
20
+ "dataFormat": `+this.De(this.dataFormat)),this.isReadOnly&&(t+=`,
21
+ "isReadOnly": `+this.isReadOnly),this.nodeKeyProperty!=="key"&&typeof this.nodeKeyProperty=="string"&&(t+=`,
22
+ "nodeKeyProperty": `+this.De(this.nodeKeyProperty)),this.copiesArrays&&(t+=`,
23
+ "copiesArrays": true`),this.copiesArrayObjects&&(t+=`,
24
+ "copiesArrayObjects": true`),this.copiesKey&&(t+=`,
25
+ "copiesKey": true`),this.pointsDigits!==100&&(t+=`,
26
+ "pointsDigits": `+this.pointsDigits.toString()),this.nodeCategoryProperty!=="category"&&typeof this.nodeCategoryProperty=="string"&&(t+=`,
27
+ "nodeCategoryProperty": `+this.De(this.nodeCategoryProperty)),t}Ty(t){t.name&&(this.name=t.name),t.dataFormat&&(this.dataFormat=t.dataFormat),t.isReadOnly&&(this.isReadOnly=!0),t.nodeKeyProperty&&(this.nodeKeyProperty=t.nodeKeyProperty),t.copiesArrays&&(this.copiesArrays=!0),t.copiesArrayObjects&&(this.copiesArrayObjects=!0),t.copiesKey!==void 0&&(this.copiesKey=t.copiesKey),t.pointsDigits!==void 0&&(this.pointsDigits=parseInt(t.pointsDigits)),t.nodeCategoryProperty&&(this.nodeCategoryProperty=t.nodeCategoryProperty)}$T(){let t=this.modelData;return`,
28
+ "modelData": `+this.ZT(t)}QT(t){let e=t.modelData;f.Y(e)&&(this.replaceJsonObjects(e),this.modelData=e)}IN(){let t=this.modelData,e=!1;for(let s in t)if(!this.V1(t,s,t[s])){e=!0;break}let i="";return e&&(i=this.$T()),i+`,
29
+ "nodeDataArray": `+this.Th(this.nodeDataArray,!0)}EN(t){this.QT(t);let e=t.nodeDataArray;Array.isArray(e)&&(this.replaceJsonObjects(e),this.nodeDataArray=e)}UN(t,e,i){if(t===e)return!0;if(typeof t!=typeof e||f.it(t)||f.it(e))return!1;if(Array.isArray(t)&&Array.isArray(e)){if(i.get(t)===e)return!0;if(i.set(t,e),t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!this.UN(t[s],e[s],i))return!1;return!0}else if(f.Y(t)&&f.Y(e)){if(i.get(t)===e)return!0;i.set(t,e);for(let s in t){let n=t[s];if(this.V1(t,s,n))continue;let o=e[s];if(o===void 0||!this.UN(n,o,i))return!1}for(let s in e){let n=e[s];if(this.V1(e,s,n))continue;let o=t[s];if(o===void 0||!this.UN(o,n,i))return!1}return!0}return!1}static _T=`,
30
+ "insertedNodeKeys": `;static qO=`,
31
+ "modifiedNodeData": `;static tD=`,
32
+ "removedNodeKeys": `;WT(t){let e=new pt,i=(s,n)=>{let o=n.part;if(!o)return;let r=o.data;if(s===r)return;let a=e.get(s);a===null?(a=new I,a.add(r),e.set(s,a)):a.add(r)};return t.changes.each(s=>{if(s.diagram!==null){let n=s.change;if(n===2){let o=s.object.panel;if(o){let r=o.data;r&&i(r,o)}}else if(n===3||n===4){let o=s.object,r=o.itemArray;r&&i(r,o)}}}),e}JT(t){let e=new I;for(let i=0;i<this.nodeDataArray.length;i++){let s=this.nodeDataArray[i];this.z1(t,s,s,e)}return e}z1(t,e,i,s){if(Array.isArray(e))for(let n=0;n<e.length;n++){let o=e[n];if(o===t)return s.add(i),!0;if(this.z1(t,o,i,s))return!0}else if(f.Y(e)&&Object.getPrototypeOf(e)===Object.prototype)for(let n in e){let o=e[n];if(o===t)return s.add(i),!0;if(this.z1(t,o,i,s))return!0}return!1}BN(t,e,i){let s=this,n=!1,o=new I,r=new I,a=new I;t.changes.each(u=>{if(u.model===s){if(u.modelChange==="nodeDataArray")u.change===3?o.add(u.newValue):u.change===4&&a.add(u.oldValue);else if(s.containsNodeData(u.object))r.add(u.object);else if(u.change===2&&(s.modelData===u.object||u.propertyName==="modelData"))n=!0;else if(u.object!==null)if(i.has(u.object))i.get(u.object).each(d=>{s.containsNodeData(d)&&r.add(d)});else{if(u.object instanceof yt||s.Ra()&&s.containsLinkData(u.object))return;s.JT(u.object).each(d=>{r.add(d)})}}});let h=new I;o.each(u=>{h.add(s.getKeyForNodeData(u)),e||r.add(u)});let l=new I;a.each(u=>{l.add(s.getKeyForNodeData(u)),e&&r.add(u)});let c="";return n&&(c+=this.$T()),h.count>0&&(c+=(e?yt.tD:yt._T)+this.Th(h.toArray(),!0)),r.count>0&&(c+=yt.qO+this.Th(r.toArray(),!0)),l.count>0&&(c+=(e?yt._T:yt.tD)+this.Th(l.toArray(),!0)),c}Dy(t){(t.name!==void 0&&t.name!==this.name||t.dataFormat!==void 0&&t.dataFormat!==this.dataFormat||t.isReadOnly!==void 0&&t.isReadOnly!==this.isReadOnly||t.nodeKeyProperty!==void 0&&t.nodeKeyProperty!==this.nodeKeyProperty||t.copiesArrays!==void 0&&t.copiesArrays!==this.copiesArrays||t.copiesArrayObjects!==void 0&&t.copiesArrayObjects!==this.copiesArrayObjects||t.copiesKey!==void 0&&t.copiesKey!==this.copiesKey||t.nodeCategoryProperty!==void 0&&t.nodeCategoryProperty!==this.nodeCategoryProperty)&&f.o("applyIncrementalJson cannot change Model properties"),this.QT(t);let e=t.insertedNodeKeys,i=t.modifiedNodeData,s=new pt;if(Array.isArray(i))for(let o=0;o<i.length;o++){let r=i[o],a=this.getKeyForNodeData(r);a!=null&&s.set(a,r)}if(Array.isArray(e)){let o=e.length;for(let r=0;r<o;r++){let a=e[r],h=this.findNodeDataForKey(a);h===null&&(h=s.get(a)||this.copyNodeData({}),this.setKeyForNodeData(h,a),this.addNodeData(h))}}if(Array.isArray(i)){let o=i.length;for(let r=0;r<o;r++){let a=i[r],h=this.getKeyForNodeData(a),l=this.findNodeDataForKey(h);if(l!==null){for(let c in a)c==="__gohashid"||c===this.nodeKeyProperty||(this.mm()||this.Mb())&&c===this.nodeIsGroupProperty||this.setDataProperty(l,c,a[c]);this.sg(a,l)}}}let n=t.removedNodeKeys;if(Array.isArray(n)){let o=n.length;for(let r=0;r<o;r++){let a=n[r],h=this.findNodeDataForKey(a);h!==null&&this.removeNodeData(h)}}}toIncrementalJson(t,e){t.change!==1&&f.o("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+t.toString());let i=t.object;if(!t.isTransactionFinished||!(i instanceof Ai))return'{ "incremental": 0 }';e===void 0&&(e=f.Dn(this));let s=this.WT(i),n=this.BN(i,t.propertyName==="FinishedUndo",s);return'{ "class": '+this.De(e)+', "incremental": 1'+this.eg()+n+"}"}toIncrementalJSON(t,e){return this.toIncrementalJson(t,e)}toJson(t){return t===void 0&&(t=f.Dn(this)),'{ "class": '+this.De(t)+this.eg()+this.IN()+"}"}toJSON(t){return this.toJson(t)}applyIncrementalJson(t){let e=null;if(typeof t=="string")try{e=A.JSON.parse(t)}catch{}else f.Y(t)?e=t:f.o("Unable to modify a Model from: "+t);let i=e.incremental;typeof i!="number"&&f.o("Unable to apply non-incremental changes to Model: "+t),i!==0&&(this.startTransaction("applyIncrementalJson"),this.Dy(e),this.commitTransaction("applyIncrementalJson"))}applyIncrementalJSON(t){return this.applyIncrementalJson(t)}static fromJson(t,e){e===void 0&&(e=null);let i=null;if(typeof t=="string")try{i=A.JSON.parse(t)}catch{}else f.Y(t)?i=t:f.o("Unable to construct a Model from: "+t);if(e===null){let s=yt.WO(i);s===null||s instanceof yt?e=s:f.o("Unable to construct a Model of declared class: "+i.class)}return e===null&&(e=yt.iD()),e.Ty(i),e.EN(i),e}static fromJSON(t,e){return this.fromJson(t,e)}static iD(){return new yt}static WO(t){let e=null,i=t.class;if(typeof i=="string")try{let s=null;i.indexOf("go.")===0?s=yt.VN(i.substring(3)):(s=yt.VN(i),s===null&&(s=A[i])),f.it(s)&&(e=new s)}catch{}return e}replaceJsonObjects(t){if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];f.Y(s)&&this.eD(t,i,this.replaceJsonObjects(s))}}else if(f.Y(t)){for(let e in t){let i=t[e];if(f.Y(i)){let s=this.replaceJsonObjects(i);if(t[e]=s,e==="points"&&Array.isArray(s)){let n=s.length%2===0;for(let o=0;o<s.length;o++)if(typeof s[o]!="number"){n=!1;break}if(n){let o=new G;for(let r=0;r<s.length/2;r++)o.add(new P(s[r*2],s[r*2+1]));o.u(),t[e]=o}}}}return this.JO(t)}return t}writeJsonValue(t){return t===void 0?"undefined":t===null?"null":t===!0?"true":t===!1?"false":typeof t=="string"?this.De(t):typeof t=="number"?t===1/0?"9e9999":t===-1/0?"-9e9999":isNaN(t)?'{"class":"NaN"}':t.toString():t instanceof Boolean?this.writeJsonValue(t.valueOf()):t instanceof String?this.writeJsonValue(t.valueOf()):t instanceof Number?this.writeJsonValue(t.valueOf()):t instanceof Date?'{"class":"Date", "value":"'+t.toJSON()+'"}':Array.isArray(t)?this.Th(t):f.Y(t)?this.ZT(t):f.it(t)?"null":'"'+t.toString()+'"'}Th(t,e){e===void 0&&(e=!1);let i=t.length;if(i<=0)return"[]";let s=new V;s.add("["),e&&i>1&&s.add(`
33
+ `);for(let n=0;n<i;n++){let o=t[n];o!==void 0&&(n>0&&(s.add(","),e&&s.add(`
34
+ `)),s.add(this.writeJsonValue(o)))}return e&&i>1&&s.add(`
35
+ `),s.add("]"),s.toString()}V1(t,e,i){return!!(i===void 0||e==="__gohashid"||e[0]==="_"||f.it(i))}Gi(t){return isNaN(t)?"NaN":t===1/0?"9e9999":t===-1/0?"-9e9999":t}ZT(t){let e=t;if(e instanceof P)t={class:"go.Point",x:this.Gi(e.x),y:this.Gi(e.y)};else if(e instanceof Q)t={class:"go.Size",width:this.Gi(e.width),height:this.Gi(e.height)};else if(e instanceof z)t={class:"go.Rect",x:this.Gi(e.x),y:this.Gi(e.y),width:this.Gi(e.width),height:this.Gi(e.height)};else if(e instanceof Lt)t={class:"go.Margin",top:this.Gi(e.top),right:this.Gi(e.right),bottom:this.Gi(e.bottom),left:this.Gi(e.left)};else if(e instanceof D)e.isSpot()?t={class:"go.Spot",x:this.Gi(e.x),y:this.Gi(e.y),offsetX:this.Gi(e.offsetX),offsetY:this.Gi(e.offsetY)}:t={class:"go.Spot",enum:e.toString()};else if(e instanceof E){if(t={class:"go.Brush",type:qe[e.type]},e.type===1?t.color=e.color:(e.type===2||e.type===3)&&(t.start=e.start,t.end=e.end,e.type===3&&(e.startRadius!==0&&(t.startRadius=this.Gi(e.startRadius)),isNaN(e.endRadius)||(t.endRadius=this.Gi(e.endRadius)))),e.colorStops!==null){let n={},o=e.colorStops.iterator;for(;o.next();){let r=o.key,a=o.value;n[r]=a}t.colorStops=n}}else if(e instanceof kt)t={class:"go.Geometry",type:ei[e.type]},e.startX!==0&&(t.startX=this.Gi(e.startX)),e.startY!==0&&(t.startY=this.Gi(e.startY)),e.endX!==0&&(t.endX=this.Gi(e.endX)),e.endY!==0&&(t.endY=this.Gi(e.endY)),e.spot1.equals(D.TopLeft)||(t.spot1=e.spot1),e.spot2.equals(D.BottomRight)||(t.spot2=e.spot2),e.type===4&&(t.path=kt.stringify(e));else if(yt.ON(null,"",e))return"{}";let i="{",s=!0;for(let n in t){let o=this.yt(t,n);if(!this.V1(t,n,o))if(s?s=!1:i+=",",i+=this.De(n)+":",n==="points"&&o instanceof G){let r=o,a="[",h=r.iterator;for(;h.next();){let l=h.value;a.length>1&&(a+=","),a+=this.sD(l.x),a+=",",a+=this.sD(l.y)}a+="]",i+=a}else i+=this.writeJsonValue(o)}return i+="}",i}sD(t){if(t===1/0)return"9e9999";if(t===-1/0)return"-9e9999";if(isNaN(t))return"0";let e=this.pointsDigits;return e>16?t.toString():t.toFixed(e)}get pointsDigits(){return this.Ly}set pointsDigits(t){t<0?t=0:t>100&&(t=100),this.Ly=t}Yi(t){return typeof t=="number"?t:t==="NaN"?NaN:t==="9e9999"?1/0:t==="-9e9999"?-1/0:parseFloat(t)}JO(t){if(!f.Y(t))return t;let e=t.class||"";if(typeof e!="string"||e==="")return t;if(e==="NaN")return NaN;if(e==="Date")return new Date(t.value);if(e.indexOf("go.")!==0)return t;e=e.substring(3);let i=t;if(e==="Point")i=new P(this.Yi(t.x),this.Yi(t.y));else if(e==="Size")i=new Q(this.Yi(t.width),this.Yi(t.height));else if(e==="Rect")i=new z(this.Yi(t.x),this.Yi(t.y),this.Yi(t.width),this.Yi(t.height));else if(e==="Margin")i=new Lt(this.Yi(t.top),this.Yi(t.right),this.Yi(t.bottom),this.Yi(t.left));else if(e==="Spot")typeof t.enum=="string"?i=D.parse(t.enum):i=new D(this.Yi(t.x),this.Yi(t.y),this.Yi(t.offsetX),this.Yi(t.offsetY));else if(e==="Brush"){let s=new E;s.type=f.Uh(qe,t.type)??1,typeof t.color=="string"&&(s.color=t.color),t.start instanceof D&&(s.start=t.start),t.end instanceof D&&(s.end=t.end),typeof t.startRadius=="number"&&(s.startRadius=this.Yi(t.startRadius)),typeof t.endRadius=="number"&&(s.endRadius=this.Yi(t.endRadius));let n=t.colorStops;if(f.Y(n))for(let o in n){let r=parseFloat(o);s.addColorStop(r,n[o])}i=s}else if(e==="Geometry"){let s=null;typeof t.path=="string"?s=kt.parse(t.path):s=new kt,s.type=f.Uh(ei,t.type)??1,typeof t.startX=="number"&&(s.startX=this.Yi(t.startX)),typeof t.startY=="number"&&(s.startY=this.Yi(t.startY)),typeof t.endX=="number"&&(s.endX=this.Yi(t.endX)),typeof t.endY=="number"&&(s.endY=this.Yi(t.endY)),t.spot1 instanceof D&&(s.spot1=t.spot1),t.spot2 instanceof D&&(s.spot2=t.spot2),i=s}else if(e==="EnumValue"){let s=t.classType;s.indexOf("go.")===0&&(s=s.substring(3));let n=yt.VN(s);f.it(n)&&(i=f.Uh(n,t.name))}return i}get name(){return this.Pt}set name(t){let e=this.Pt;e!==t&&(f.s(t,"string",yt,"name"),this.Pt=t,this.t("name",e,t))}get dataFormat(){return this.$d}set dataFormat(t){let e=this.$d;e!==t&&(f.s(t,"string",yt,"dataFormat"),this.$d=t,this.t("dataFormat",e,t))}get isReadOnly(){return this.Ao}set isReadOnly(t){let e=this.Ao;e!==t&&(f.s(t,"boolean",yt,"isReadOnly"),this.Ao=t,this.t("isReadOnly",e,t))}get modelData(){return this.RN}set modelData(t){let e=this.modelData;e!==t&&(f.ec(t,yt,"modelData"),this.containsNodeData(t)&&f.o("Model.modelData Object must not be used by the rest of the model: "+t),this.RN=t,this.t("modelData",e,t),this.updateTargetBindings(t))}addChangedListener(t){return f.k(t,yt,"addChangedListener:listener"),this.Ay.push(t),this}removeChangedListener(t){f.k(t,yt,"removeChangedListener:listener");let e=this.Ay.indexOf(t);e>=0&&this.Ay.splice(e,1)}VM(t){this.skipsUndoManager||this.undoManager.handleChanged(t),this.nD(t)}nD(t){this.Ay.forEach(e=>e(t))}dF(t){this.nD(t)}raiseChangedEvent(t,e,i,s,n,o,r){this.vt("",t,e,i,s,n,o,r)}raiseChanged(t,e,i,s,n){this.vt("",2,t,this,e,i,s,n)}t(t,e,i,s,n){this.vt("",2,t,this,e,i,s,n)}raiseDataChanged(t,e,i,s,n,o){this.vt("",2,e,t,i,s,n,o)}vt(t,e,i,s,n,o,r,a){r===void 0&&(r=null),a===void 0&&(a=null);let h=new ii;h.model=this,h.change=e,h.modelChange=t,h.propertyName=i,h.object=s,h.oldValue=n,h.oldParam=r,h.newValue=o,h.newParam=a,this.VM(h)}get undoManager(){return this.B1}set undoManager(t){let e=this.B1;e!==t&&(e!==null&&e.removeModel(this),this.B1=t,t!==null&&t.addModel(this))}get skipsUndoManager(){return this.Lo}set skipsUndoManager(t){f.s(t,"boolean",yt,"skipsUndoManager"),this.Lo=t}changeState(t,e){if(t!==null&&t.model===this)if(t.change===2){let i=t.object,s=t.propertyName,n=t.getValue(e);if(s===this.nodeKeyProperty&&this.containsNodeData(i)){let o=t.getValue(!e);o!==void 0&&this.mi.delete(o),n!==void 0&&this.mi.set(n,i)}this.Z(i,s,n)}else if(t.change===3){let i=t.newParam;if(t.modelChange==="nodeDataArray"){let s=t.newValue;if(f.Y(s)&&typeof i=="number"){let n=this.getKeyForNodeData(s);e?(this.Te[i]===s&&this.go(this.Te,i),n!==void 0&&this.mi.delete(n)):(this.Te[i]!==s&&this.$o(this.Te,i,s),n!==void 0&&this.mi.set(n,s))}}else if(t.modelChange===""){let s=t.object;if(s&&!Array.isArray(s)&&t.propertyName&&(s=this.yt(s,t.propertyName)),Array.isArray(s)&&typeof i=="number"){let n=t.newValue;e?this.go(s,i):this.$o(s,i,n)}}else f.o("unknown ChangeType.Insert modelChange: "+t.toString())}else if(t.change===4){let i=t.oldParam;if(t.modelChange==="nodeDataArray"){let s=t.oldValue;if(f.Y(s)&&typeof i=="number"){let n=this.getKeyForNodeData(s);e?(this.Te[i]!==s&&this.$o(this.Te,i,s),n!==void 0&&this.mi.set(n,s)):(this.Te[i]===s&&this.go(this.Te,i),n!==void 0&&this.mi.delete(n))}}else if(t.modelChange===""){let s=t.object;if(s&&!Array.isArray(s)&&t.propertyName&&(s=this.yt(s,t.propertyName)),Array.isArray(s)&&typeof i=="number"){let n=t.oldValue;e?this.$o(s,i,n):this.go(s,i)}}else f.o("unknown ChangeType.Remove modelChange: "+t.toString())}else t.change===1||f.o("unknown ChangedEvent: "+t.toString())}startTransaction(t){return this.undoManager.startTransaction(t)}commitTransaction(t){return this.undoManager.commitTransaction(t)}rollbackTransaction(){return this.undoManager.rollbackTransaction()}commit(t,e){let i=e;i===void 0&&(i="");let s=this.skipsUndoManager;i===null&&(this.skipsUndoManager=!0,i=""),this.undoManager.startTransaction(i);let n=!1;try{t(this),n=!0}finally{n?this.undoManager.commitTransaction(i):this.undoManager.rollbackTransaction(),this.skipsUndoManager=s}}updateTargetBindings(t,e){e===void 0&&(e=""),this.vt("SourceChanged",1,e,t,null,null)}get nodeKeyProperty(){return this.Ah}set nodeKeyProperty(t){let e=this.Ah;e!==t&&(this.Pn(t,yt,"nodeKeyProperty"),t===""&&f.o("Model.nodeKeyProperty may not be the empty string"),this.mi.count>0&&f.o("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Ah=t,this.t("nodeKeyProperty",e,t))}Pn(t,e,i){typeof t!="string"&&!f.it(t)&&f.Zi(t,"string or function",e,i)}getKeyForNodeData(t){if(t===null)return;let e=this.Ah;if(e==="")return;let i=this.yt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;f.o("Key value for node data "+t+" is not a number or a string: "+i)}}setKeyForNodeData(t,e){if((e==null||!this.isKeyType(e))&&f.Zi(e,"number or string",yt,"setKeyForNodeData:key"),t===null)return;let i=this.Ah;if(i==="")return;if(!this.containsNodeData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);if(s!==e){if(this.findNodeDataForKey(e)!==null)return;this.Z(t,i,e),s!==void 0&&this.mi.delete(s),this.mi.set(e,t),this.vt("nodeKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i),this.Fy(s,e)}}get makeUniqueKeyFunction(){return this.Df}set makeUniqueKeyFunction(t){let e=this.Df;e!==t&&(t!==null&&f.k(t,yt,"makeUniqueKeyFunction"),this.Df=t,this.t("makeUniqueKeyFunction",e,t))}isKeyType(t){return typeof t=="number"||typeof t=="string"}containsNodeData(t){if(t===null)return!1;let e=this.getKeyForNodeData(t);return e===void 0?!1:this.mi.get(e)===t}findNodeDataForKey(t){return t===null&&f.o("Model.findNodeDataForKey:key must not be null"),t===void 0||!this.isKeyType(t)?null:this.mi.get(t)}get nodeDataArray(){return this.Te}set nodeDataArray(t){let e=this.Te;if(e!==t){this.zN(t,yt,"nodeDataArray"),this.mi.clear(),this.XN();let i=t.length;for(let o=0;o<i;o++){let r=t[o];f.Y(r)||f.o("Model.nodeDataArray must only contain Objects, not: "+r),r===this.modelData&&f.o("nodeDataArray Objects must not be the shared Model.modelData")}this.Te=t;let s=new G;for(let o=0;o<i;o++){let r=t[o],a=this.getKeyForNodeData(r);a===void 0||this.mi.get(a)!==null?s.add(r):this.mi.set(a,r)}let n=s.iterator;for(;n.next();){let o=n.value;this.makeNodeDataKeyUnique(o);let r=this.getKeyForNodeData(o);r!==void 0&&this.mi.set(r,o)}this.vt("nodeDataArray",2,"nodeDataArray",this,e,t);for(let o=0;o<i;o++){let r=t[o];this.ng(r),this.og(r)}}}X1(t){return t===void 0?!1:this.mi.has(t)}makeNodeDataKeyUnique(t){if(t===null)return;let e=this.Ah;if(e==="")return;let i=this.getKeyForNodeData(t);if(i!==void 0&&!this.X1(i))return;let s=this.Df;if(s!==null&&(i=s(this,t),i!=null&&!this.X1(i))){this.Z(t,e,i);return}if(typeof i=="string"){let n=2;for(;this.X1(i+n);)n++;this.Z(t,e,i+n)}else if(i===void 0||typeof i=="number"){let n=-this.mi.count-1;for(;this.X1(n);)n--;this.Z(t,e,n)}}addNodeData(t){t!==null&&(t===this.modelData&&f.o("Model.addNodeData cannot add the shared Model.modelData Object"),this.containsNodeData(t)||this.zT(t,!0))}zT(t,e){let i=this.getKeyForNodeData(t);if(i===void 0)this.makeNodeDataKeyUnique(t),i=this.getKeyForNodeData(t);else{if(this.mi.get(i)===t)return;this.makeNodeDataKeyUnique(t),i=this.getKeyForNodeData(t)}i===void 0&&f.o("Model.makeNodeDataKeyUnique failed on "+t+". Data not added to Model."),this.mi.set(i,t);let s=null;e&&(s=this.Te.length,this.$o(this.Te,s,t)),this.vt("nodeDataArray",3,"nodeDataArray",this,null,t,null,s),this.ng(t),this.og(t)}addNodeDataCollection(t){if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.addNodeData(t[i])}else{let e=t.iterator;for(;e.next();){let i=e.value;this.addNodeData(i)}}}removeNodeData(t){t!==null&&this.VT(t,!0)}VT(t,e){let i=this.getKeyForNodeData(t);i!==void 0&&this.mi.delete(i);let s=null;if(e){if(s=this.Te.indexOf(t),s<0)return;this.go(this.Te,s)}this.vt("nodeDataArray",4,"nodeDataArray",this,t,null,s,null),this.Ry(t)}removeNodeDataCollection(t){if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.removeNodeData(t[i])}else{let e=t.iterator;for(;e.next();){let i=e.value;this.removeNodeData(i)}}}mergeNodeDataArray(t){if(t===this.nodeDataArray||!Array.isArray(t))return;let e=new I;e.addAll(this.mi.iteratorKeys);let i=new I,s=t.length;for(let o=0;o<s;o++){let r=t[o],a=this.getKeyForNodeData(r);if(a!==void 0){i.add(a);let h=this.findNodeDataForKey(a);if(h===r)continue;if(h!==null)this.assignAllDataProperties(h,r),this.sg(r,h);else{let l=this.cloneDeep(r);this.setKeyForNodeData(l,a),this.addNodeData(l)}}else{let h=this.cloneDeep(r);this.addNodeData(h),i.add(this.getKeyForNodeData(h))}}let n=e.iterator;for(;n.next();){let o=n.value;if(!i.has(o)){let r=this.findNodeDataForKey(o);r&&this.removeNodeData(r)}}}Fy(t,e){if(e===void 0)return;let i=this.Ny(t);i instanceof I&&this.Jo.set(e,i)}XN(){}ng(t){}og(t){}Ry(t){}Js(t,e){if(t===void 0)return;let i=this.Jo.get(t);i===null&&(i=new I,this.Jo.set(t,i)),i.add(e)}Ws(t,e){if(t===void 0)return;let i=this.Jo.get(t);i instanceof I&&(e==null?this.Jo.delete(t):(i.delete(e),i.count===0&&this.Jo.delete(t)))}Ny(t){if(t===void 0)return null;let e=this.Jo.get(t);return e instanceof I?e:null}OE(t){t===void 0?this.Jo.clear():this.Jo.delete(t)}get copyNodeDataFunction(){return this.Ff}set copyNodeDataFunction(t){let e=this.Ff;e!==t&&(t!==null&&f.k(t,yt,"copyNodeDataFunction"),this.Ff=t,this.t("copyNodeDataFunction",e,t))}get copiesArrays(){return this.Zd}set copiesArrays(t){let e=this.Zd;e!==t&&(t!==null&&f.s(t,"boolean",yt,"copiesArrays"),this.Zd=t,this.t("copiesArrays",e,t))}get copiesArrayObjects(){return this.Qd}set copiesArrayObjects(t){let e=this.Qd;e!==t&&(t!==null&&f.s(t,"boolean",yt,"copiesArrayObjects"),this.Qd=t,this.t("copiesArrayObjects",e,t))}get copiesKey(){return this._d}set copiesKey(t){let e=this._d;e!==t&&(t!==null&&f.s(t,"boolean",yt,"copiesKey"),this._d=t,this.t("copiesKey",e,t))}copyNodeData(t){if(t===null)return null;let e=null,i=this.Ff;return i!==null?e=i(t,this):e=this.G1(t,!0),f.Y(e),e}G1(t,e){if(f.Y(t))if(Array.isArray(t))if(this.copiesArrays){let i=t,s=[];for(let n=0;n<i.length;n++){let o=i[n],r=this.G1(o,this.copiesArrayObjects);s.push(r)}return s}else return t;else{if(t instanceof P||t instanceof Q||t instanceof z||t instanceof Lt||t instanceof D)return t.copy();if(e){let i=t,s=i.constructor,n=s?new s:{},o=!this.copiesKey&&typeof this.nodeKeyProperty=="string"?this.nodeKeyProperty:null;for(let r in i){if(r==="__gohashid"){n.__gohashid=void 0;continue}if(r===o){n[o]=void 0;continue}let a=this.yt(i,r);if(!f.Y(a))n[r]=a;else if(yt.ON(i,r,a))this.Z(n,r,a);else{let h=this.G1(a,!1);this.Z(n,r,h)}}return n}else return t}else return t}get afterCopyFunction(){return this.tg}set afterCopyFunction(t){let e=this.tg;e!==t&&(t!==null&&f.k(t,yt,"afterCopyFunction"),this.tg=t,this.t("afterCopyFunction",e,t))}static ON(t,e,i){let s=f.Dn(i);return i instanceof yt||i instanceof $i||i instanceof Ai||i instanceof ii||i instanceof dt||i instanceof Yt||i instanceof q||i instanceof EventTarget||s==="Layer"||s==="RowColumnDefinition"||s.indexOf("Animation")>=0||s.indexOf("Tool")>=0||s.indexOf("CommandHandler")>=0||s.indexOf("Layout")>=0}static oD=!1;setDataProperty(t,e,i){if(this.containsNodeData(t)){if(e===this.nodeKeyProperty){this.setKeyForNodeData(t,i);return}else if(e===this.nodeCategoryProperty){this.setCategoryForNodeData(t,i);return}}else!yt.oD&&t instanceof dt&&(yt.oD=!0,f.ni('Model.setDataProperty is modifying a GraphObject, "'+t.toString()+'"'),f.ni(" Is that really your intent?"));let s=this.yt(t,e);s!==i&&(this.Z(t,e,i),this.raiseDataChanged(t,e,s,i))}set(t,e,i){this.setDataProperty(t,e,i)}assignAllDataProperties(t,e){if(!e)return;let i=this.containsNodeData(t);for(let s in e)s!=="__gohashid"&&(i&&s===this.nodeKeyProperty||this.setDataProperty(t,s,e[s]))}addArrayItem(t,e){this.insertArrayItem(t,-1,e)}insertArrayItem(t,e,i){e<0&&(e=t.length),t=this.$o(t,e,i),this.vt("",3,"",t,null,i,null,e)}removeArrayItem(t,e){e===void 0&&(e=-1),t===this.Te&&f.o("Model.removeArrayItem should not be called on the Model.nodeDataArray"),e===-1&&(e=t.length-1);let i=t[e];t=this.go(t,e),this.vt("",4,"",t,i,null,e,null)}get nodeCategoryProperty(){return this.Ka}set nodeCategoryProperty(t){let e=this.Ka;e!==t&&(this.Pn(t,yt,"nodeCategoryProperty"),this.Ka=t,this.t("nodeCategoryProperty",e,t))}getCategoryForNodeData(t){if(t===null)return"";let e=this.Ka;if(e==="")return"";let i=this.yt(t,e);if(i===void 0)return"";if(typeof i=="string")return i;f.o("getCategoryForNodeData found a non-string category for "+t+": "+i)}setCategoryForNodeData(t,e){if(f.s(e,"string",yt,"setCategoryForNodeData:cat"),t===null)return;let i=this.Ka;if(i==="")return;if(!this.containsNodeData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);s===void 0&&(s=""),s!==e&&(this.Z(t,i,e),this.vt("nodeCategory",2,i,t,s,e))}sg(t,e){this.setCategoryForNodeData(e,this.getCategoryForNodeData(t))}get type(){return"Model"}pm(){return!1}mm(){return!1}Mb(){return!1}Ra(){return!1}zw(){return!1}Hc(){return!1}static LM(){return new yt}yt(t,e){return yt.yt(t,e)}static yt(t,e){if(!t||!e)return null;let i;try{f.it(e)?i=e(t):f.it(t.getAttribute)?(i=t.getAttribute(e),i===null&&(i=void 0)):i=t[e]}catch{}return i}Z(t,e,i){yt.Z(t,e,i)}static Z(t,e,i){if(!(!t||!e)){try{f.it(e)?e(t,i):f.it(t.setAttribute)?t.setAttribute(e,i):t[e]=i}catch{}return t}}zN(t,e,i){Array.isArray(t)||f.Zi(t,"Array",e,i)}eD(t,e,i){return t[e]=i,t}$o(t,e,i){return e>=t.length?t.push(i):t.splice(e,0,i),t}go(t,e){return e>=t.length?t.pop():t.splice(e,1),t}static VN(t){return yt.GN[t]?yt.GN[t]:A.go!==void 0&&A.go[t]?A.go[t]:null}static fl(t,e){yt.GN[e]=t}static GN={}}yt.fromJSON=yt.fromJson=yt.fromJson,yt.fl(E,"Brush"),yt.fl(kt,"Geometry"),yt.fl(Lt,"Margin"),yt.fl(P,"Point"),yt.fl(z,"Rect"),yt.fl(Q,"Size"),yt.fl(D,"Spot"),yt.fl(yt,"Model");class Xt extends yt{Ps;Zo;Di;Dh;Rf;vf;Ll;mo;po;ja;Ha;qa;$s;Of;Sn;rg;constructor(t,e,i){if(super(),this.Ps=[],this.Zo=new I,this.Di=new pt,this.Dh="",this.Rf=null,this.vf=null,this.Ll=null,this.mo="from",this.po="to",this.ja="",this.Ha="",this.qa="category",this.$s="",this.Of="isGroup",this.Sn="group",this.rg=!1,e!==void 0&&(this.linkDataArray=e),t!==void 0&&(Array.isArray(t)?this.nodeDataArray=t:i=t),i){Object.assign(this,i);let s=i.Changed;s&&(delete this.Changed,this.addChangedListener(s))}}cloneProtected(t){super.cloneProtected(t),t.Dh=this.Dh,t.Rf=this.Rf,t.vf=this.vf,t.mo=this.mo,t.po=this.po,t.ja=this.ja,t.Ha=this.Ha,t.qa=this.qa,t.$s=this.$s,t.Of=this.Of,t.Sn=this.Sn,t.rg=this.rg}clear(){this.Ps=[],this.Di.clear(),this.Zo.clear(),super.clear()}toString(t){if(t===void 0&&(t=0),t>=2)return this.toJson();{let e=(this.name!==""?this.name:"")+" GraphLinksModel";if(t>0){e+=`
36
+ node data:`;let i=this.nodeDataArray,s=i.length,n=0;for(n=0;n<s;n++){let o=i[n];e+=" "+this.getKeyForNodeData(o)+":"+oe.toString(o)}for(e+=`
37
+ link data:`,i=this.linkDataArray,s=i.length,n=0;n<s;n++){let o=i[n];e+=" "+this.Ae(o,!0)+"-->"+this.Ae(o,!1)}}return e}}vN(t,e,i){if(this.linkKeyProperty===""){let u=this.skipsUndoManager;this.skipsUndoManager=!0,this.linkKeyProperty="key",this.skipsUndoManager=u}let s=super.vN(t,e,i),n=this,o=new I,r=new I,a=new I;t.changes.each(u=>{if(u.model===n){if(u.modelChange==="linkDataArray")u.change===3?o.add(u.newValue):u.change===4&&a.add(u.oldValue);else if(n.containsLinkData(u.object))r.add(u.object);else if(u.object!==null)if(u.object!==null&&i.has(u.object))i.get(u.object).each(d=>{n.containsLinkData(d)&&r.add(d)});else{if(u.object instanceof yt||n.containsNodeData(u.object))return;n.rD(u.object).each(d=>r.add(d))}}});let h=new I;o.each(u=>{h.add(n.getKeyForLinkData(u)),e||r.add(u)});let l=new I;a.each(u=>{l.add(n.getKeyForLinkData(u)),e&&r.add(u)});let c=n.cloneDeep(r.toArray());return h.count>0&&(s===null&&(s={}),e?s.removedLinkKeys=h.toArray():s.insertedLinkKeys=h.toArray()),c.length>0&&(s===null&&(s={}),s.modifiedLinkData=c),l.count>0&&(s===null&&(s={}),e?s.insertedLinkKeys=l.toArray():s.removedLinkKeys=l.toArray()),s}eg(){let t=super.eg(),e="";return this.linkCategoryProperty!=="category"&&typeof this.linkCategoryProperty=="string"&&(e+=`,
38
+ "linkCategoryProperty": `+this.De(this.linkCategoryProperty)),this.linkKeyProperty!==""&&typeof this.linkKeyProperty=="string"&&(e+=`,
39
+ "linkKeyProperty": `+this.De(this.linkKeyProperty)),this.linkFromKeyProperty!=="from"&&typeof this.linkFromKeyProperty=="string"&&(e+=`,
40
+ "linkFromKeyProperty": `+this.De(this.linkFromKeyProperty)),this.linkToKeyProperty!=="to"&&typeof this.linkToKeyProperty=="string"&&(e+=`,
41
+ "linkToKeyProperty": `+this.De(this.linkToKeyProperty)),this.linkFromPortIdProperty!==""&&typeof this.linkFromPortIdProperty=="string"&&(e+=`,
42
+ "linkFromPortIdProperty": `+this.De(this.linkFromPortIdProperty)),this.linkToPortIdProperty!==""&&typeof this.linkToPortIdProperty=="string"&&(e+=`,
43
+ "linkToPortIdProperty": `+this.De(this.linkToPortIdProperty)),this.linkLabelKeysProperty!==""&&typeof this.linkLabelKeysProperty=="string"&&(e+=`,
44
+ "linkLabelKeysProperty": `+this.De(this.linkLabelKeysProperty)),this.nodeIsGroupProperty!=="isGroup"&&typeof this.nodeIsGroupProperty=="string"&&(e+=`,
45
+ "nodeIsGroupProperty": `+this.De(this.nodeIsGroupProperty)),this.nodeGroupKeyProperty!=="group"&&typeof this.nodeGroupKeyProperty=="string"&&(e+=`,
46
+ "nodeGroupKeyProperty": `+this.De(this.nodeGroupKeyProperty)),t+e}Ty(t){super.Ty(t),t.linkKeyProperty&&(this.linkKeyProperty=t.linkKeyProperty),t.linkFromKeyProperty&&(this.linkFromKeyProperty=t.linkFromKeyProperty),t.linkToKeyProperty&&(this.linkToKeyProperty=t.linkToKeyProperty),t.linkFromPortIdProperty&&(this.linkFromPortIdProperty=t.linkFromPortIdProperty),t.linkToPortIdProperty&&(this.linkToPortIdProperty=t.linkToPortIdProperty),t.linkCategoryProperty&&(this.linkCategoryProperty=t.linkCategoryProperty),t.linkLabelKeysProperty&&(this.linkLabelKeysProperty=t.linkLabelKeysProperty),t.nodeIsGroupProperty&&(this.nodeIsGroupProperty=t.nodeIsGroupProperty),t.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=t.nodeGroupKeyProperty)}IN(){let t=super.IN(),e=`,
47
+ "linkDataArray": `+this.Th(this.linkDataArray,!0);return t+e}EN(t){super.EN(t);let e=t.linkDataArray;Array.isArray(e)&&(this.replaceJsonObjects(e),this.linkDataArray=e)}lD=`,
48
+ "insertedLinkKeys": `;$O=`,
49
+ "modifiedLinkData": `;hD=`,
50
+ "removedLinkKeys": `;rD(t){let e=new I;for(let i=0;i<this.linkDataArray.length;i++){let s=this.linkDataArray[i];this.z1(t,s,s,e)}return e}BN(t,e,i){if(this.linkKeyProperty===""){let u=this.skipsUndoManager;this.skipsUndoManager=!0,this.linkKeyProperty="key",this.skipsUndoManager=u}let s=super.BN(t,e,i),n=this,o=new I,r=new I,a=new I;t.changes.each(u=>{if(u.model===n){if(u.modelChange==="linkDataArray")u.change===3?o.add(u.newValue):u.change===4&&a.add(u.oldValue);else if(n.containsLinkData(u.object))r.add(u.object);else if(u.object!==null)if(u.object!==null&&i.has(u.object))i.get(u.object).each(d=>{n.containsLinkData(d)&&r.add(d)});else{if(u.object instanceof yt||n.containsNodeData(u.object))return;n.rD(u.object).each(d=>r.add(d))}}});let h=new I;o.each(u=>{h.add(n.getKeyForLinkData(u)),e||r.add(u)});let l=new I;a.each(u=>{l.add(n.getKeyForLinkData(u)),e&&r.add(u)});let c=s;return h.count>0&&(c+=(e?this.hD:this.lD)+this.Th(h.toArray(),!0)),r.count>0&&(c+=this.$O+this.Th(r.toArray(),!0)),l.count>0&&(c+=(e?this.lD:this.hD)+this.Th(l.toArray(),!0)),c}Dy(t){(t.linkCategoryProperty!==void 0&&t.linkCategoryProperty!==this.linkCategoryProperty||t.linkKeyProperty!==void 0&&t.linkKeyProperty!==this.linkKeyProperty||t.linkFromKeyProperty!==void 0&&t.linkFromKeyProperty!==this.linkFromKeyProperty||t.linkToKeyProperty!==void 0&&t.linkToKeyProperty!==this.linkToKeyProperty||t.linkFromPortIdProperty!==void 0&&t.linkFromPortIdProperty!==this.linkFromPortIdProperty||t.linkToPortIdProperty!==void 0&&t.linkToPortIdProperty!==this.linkToPortIdProperty||t.linkLabelKeysProperty!==void 0&&t.linkLabelKeysProperty!==this.linkLabelKeysProperty||t.nodeIsGroupProperty!==void 0&&t.nodeIsGroupProperty!==this.nodeIsGroupProperty||t.nodeGroupKeyProperty!==void 0&&t.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&f.o("applyIncrementalJson cannot change Model properties"),super.Dy(t);let e=t.insertedLinkKeys;if(Array.isArray(e)){let n=e.length;for(let o=0;o<n;o++){let r=e[o],a=this.findLinkDataForKey(r);a===null&&(a=this.copyLinkData({}),this.setKeyForLinkData(a,r),this.addLinkData(a))}}let i=t.modifiedLinkData;if(Array.isArray(i)){let n=i.length;for(let o=0;o<n;o++){let r=i[o],a=this.getKeyForLinkData(r),h=this.findLinkDataForKey(a);if(h!==null){for(let l in r)l==="__gohashid"||l===this.linkKeyProperty||this.setDataProperty(h,l,r[l]);this.aD(r,h)}}}let s=t.removedLinkKeys;if(Array.isArray(s)){let n=s.length;for(let o=0;o<n;o++){let r=s[o],a=this.findLinkDataForKey(r);a!==null&&this.removeLinkData(a)}}}changeState(t,e){if(!(t===null||t.model!==this)){if(t.change===2){let i=t.object,s=t.propertyName;if(s===this.linkKeyProperty&&this.containsLinkData(i)){let n=t.getValue(e),o=t.getValue(!e);o!==void 0&&this.Di.delete(o),n!==void 0&&this.Di.set(n,i),this.Z(i,s,n);return}}else if(t.change===3){let i=t.newParam;if(t.modelChange==="linkDataArray"){let s=t.newValue;if(f.Y(s)&&typeof i=="number"){let n=this.getKeyForLinkData(s);e?(this.Zo.delete(s),this.Ps[i]===s&&this.go(this.linkDataArray,i),n!==void 0&&this.Di.delete(n)):(this.Zo.add(s),this.Ps[i]!==s&&this.$o(this.Ps,i,s),n!==void 0&&this.Di.set(n,s))}return}else if(t.modelChange==="linkLabelKeys"){let s=t.object,n=this.getLabelKeysForLinkData(s);Array.isArray(n)&&typeof i=="number"&&(e?(i=n.indexOf(t.newValue),i>=0&&this.go(n,i)):n.indexOf(t.newValue)<0&&this.$o(n,i,t.newValue));return}}else if(t.change===4){let i=t.oldParam;if(t.modelChange==="linkDataArray"){let s=t.oldValue;if(f.Y(s)&&typeof i=="number"){let n=this.getKeyForLinkData(s);e?(this.Zo.add(s),this.Ps[i]!==s&&this.$o(this.Ps,i,s),n!==void 0&&this.Di.set(n,s)):(this.Zo.delete(s),this.Ps[i]===s&&this.go(this.linkDataArray,i),n!==void 0&&this.Di.delete(n))}return}else if(t.modelChange==="linkLabelKeys"){let s=t.object,n=this.getLabelKeysForLinkData(s);Array.isArray(n)&&typeof i=="number"&&(e?n.indexOf(t.oldValue)<0&&this.$o(n,i,t.oldValue):(i=n.indexOf(t.oldValue),i>=0&&this.go(n,i)));return}}super.changeState(t,e)}}get archetypeNodeData(){return this.Ll}set archetypeNodeData(t){let e=this.Ll;e!==t&&(t!==null&&f.ec(t,Xt,"archetypeNodeData"),this.Ll=t,this.t("archetypeNodeData",e,t))}YN(t){if(t===void 0)return;let e=this.Ll;if(e!==null){let i=this.findNodeDataForKey(t);i===null&&(i=this.copyNodeData(e),this.Z(i,this.nodeKeyProperty,t),this.addNodeData(i))}return t}get linkFromKeyProperty(){return this.mo}set linkFromKeyProperty(t){let e=this.mo;e!==t&&(this.Pn(t,Xt,"linkFromKeyProperty"),this.mo=t,this.t("linkFromKeyProperty",e,t))}getFromKeyForLinkData(t){return this.Ae(t,!0)}setFromKeyForLinkData(t,e){this.Wd(t,e,!0)}get linkToKeyProperty(){return this.po}set linkToKeyProperty(t){let e=this.po;e!==t&&(this.Pn(t,Xt,"linkToKeyProperty"),this.po=t,this.t("linkToKeyProperty",e,t))}getToKeyForLinkData(t){return this.Ae(t,!1)}setToKeyForLinkData(t,e){this.Wd(t,e,!1)}Ae(t,e){if(t===null)return;let i=e?this.mo:this.po;if(i==="")return;let s=this.yt(t,i);if(s!==void 0){if(this.isKeyType(s))return s;f.o((e?"FromKey":"ToKey")+" value for link data "+t+" is not a number or a string: "+s)}}Wd(t,e,i){if(e===null&&(e=void 0),e!==void 0&&!this.isKeyType(e)&&f.Zi(e,"number or string",Xt,i?"setFromKeyForLinkData:key":"setToKeyForLinkData:key"),t===null)return;let s=i?this.mo:this.po;if(s==="")return;if(e=this.YN(e),!this.containsLinkData(t)){this.Z(t,s,e);return}let n=this.yt(t,s);n!==e&&(this.Ws(n,t),this.Z(t,s,e),this.findNodeDataForKey(e)===null&&this.Js(e,t),this.vt(i?"linkFromKey":"linkToKey",2,s,t,n,e),typeof s=="string"&&this.updateTargetBindings(t,s))}get linkFromPortIdProperty(){return this.ja}set linkFromPortIdProperty(t){let e=this.ja;e!==t&&(this.Pn(t,Xt,"linkFromPortIdProperty"),this.ja=t,this.t("linkFromPortIdProperty",e,t))}getFromPortIdForLinkData(t){return this.I1(t,!0)}setFromPortIdForLinkData(t,e){this.Jd(t,e,!0)}get linkToPortIdProperty(){return this.Ha}set linkToPortIdProperty(t){let e=this.Ha;e!==t&&(this.Pn(t,Xt,"linkToPortIdProperty"),this.Ha=t,this.t("linkToPortIdProperty",e,t))}getToPortIdForLinkData(t){return this.I1(t,!1)}setToPortIdForLinkData(t,e){this.Jd(t,e,!1)}I1(t,e){if(t===null)return"";let i=e?this.ja:this.Ha;if(i==="")return"";let s=this.yt(t,i);return s===void 0?"":s}Jd(t,e,i){if(f.s(e,"string",Xt,i?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname"),t===null)return;let s=i?this.ja:this.Ha;if(s==="")return;if(!this.containsLinkData(t)){this.Z(t,s,e);return}let n=this.yt(t,s);n===void 0&&(n=""),n!==e&&(this.Z(t,s,e),this.vt(i?"linkFromPortId":"linkToPortId",2,s,t,n,e),typeof s=="string"&&this.updateTargetBindings(t,s))}get linkLabelKeysProperty(){return this.$s}set linkLabelKeysProperty(t){let e=this.$s;e!==t&&(this.Pn(t,Xt,"linkLabelKeysProperty"),this.$s=t,this.t("linkLabelKeysProperty",e,t))}getLabelKeysForLinkData(t){if(t===null)return Xt.EmptyArray;let e=this.$s;if(e==="")return Xt.EmptyArray;let i=this.yt(t,e);return i===void 0?Xt.EmptyArray:i}setLabelKeysForLinkData(t,e){if(this.zN(e,Xt,"setLabelKeysForLinkData:arr"),t===null)return;let i=this.$s;if(i==="")return;if(!this.containsLinkData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);if(s===void 0&&(s=Xt.EmptyArray),s!==e){if(Array.isArray(s)){let o=s.length;for(let r=0;r<o;r++){let a=s[r];this.Ws(a,t)}}this.Z(t,i,e);let n=e.length;for(let o=0;o<n;o++){let r=e[o];this.findNodeDataForKey(r)===null&&this.Js(r,t)}this.vt("linkLabelKeys",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i)}}addLabelKeyForLinkData(t,e){if(e==null||(this.isKeyType(e)||f.Zi(e,"number or string",Xt,"addLabelKeyForLinkData:key"),t===null))return;let i=this.$s;if(i==="")return;let s=this.yt(t,i);if(s===void 0){let n=[];n.push(e),this.setLabelKeysForLinkData(t,n)}else if(Array.isArray(s)){let n=s.indexOf(e);if(n>=0)return;n=s.length,s.push(e),this.containsLinkData(t)&&(this.findNodeDataForKey(e)===null&&this.Js(e,t),this.vt("linkLabelKeys",3,i,t,null,e,null,n))}else f.o(i+" property is not an Array; cannot addLabelKeyForLinkData: "+t)}removeLabelKeyForLinkData(t,e){if(e==null||(this.isKeyType(e)||f.Zi(e,"number or string",Xt,"removeLabelKeyForLinkData:key"),t===null))return;let i=this.$s;if(i==="")return;let s=this.yt(t,i);if(Array.isArray(s)){let n=s.indexOf(e);if(n<0)return;this.go(s,n),this.containsLinkData(t)&&(this.Ws(e,t),this.vt("linkLabelKeys",4,i,t,e,null,n,null))}else s!==void 0&&f.o(i+" property is not an Array; cannot removeLabelKeyforLinkData: "+t)}get linkDataArray(){return this.Ps}set linkDataArray(t){let e=this.Ps;if(e!==t){this.zN(t,Xt,"linkDataArray"),this.Di.clear();let i=t.length;for(let n=0;n<i;n++){let o=t[n];f.Y(o)||f.o("GraphLinksModel.linkDataArray must only contain Objects, not: "+o)}if(this.Ps=t,this.linkKeyProperty!==""){let n=new G;for(let r=0;r<i;r++){let a=t[r],h=this.getKeyForLinkData(a);h===void 0||this.Di.get(h)!==null?n.add(a):this.Di.set(h,a)}let o=n.iterator;for(;o.next();){let r=o.value;this.makeLinkDataKeyUnique(r);let a=this.getKeyForLinkData(r);a!==void 0&&this.Di.set(a,r)}}let s=new I;for(let n=0;n<i;n++){let o=t[n];s.add(o)}this.Zo=s,this.vt("linkDataArray",2,"linkDataArray",this,e,t);for(let n=0;n<i;n++){let o=t[n];this.KN(o)}}}get linkKeyProperty(){return this.Dh}set linkKeyProperty(t){let e=this.Dh;if(e!==t){this.Pn(t,Xt,"linkKeyProperty"),this.Dh=t,this.Di.clear();let i=this.linkDataArray.length;for(let s=0;s<i;s++){let n=this.linkDataArray[s],o=this.getKeyForLinkData(n);o===void 0&&(this.makeLinkDataKeyUnique(n),o=this.getKeyForLinkData(n)),o!==void 0&&this.Di.set(o,n)}this.t("linkKeyProperty",e,t)}}getKeyForLinkData(t){if(t===null)return;let e=this.Dh;if(e==="")return;let i=this.yt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;f.o("Key value for link data "+t+" is not a number or a string: "+i)}}setKeyForLinkData(t,e){if((e==null||!this.isKeyType(e))&&f.Zi(e,"number or string",Xt,"setKeyForLinkData:key"),t===null)return;let i=this.Dh;if(i==="")return;if(!this.containsLinkData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);if(s!==e){if(this.findLinkDataForKey(e)!==null)return;this.Z(t,i,e),s!==void 0&&this.Di.delete(s),this.Di.set(e,t),this.vt("linkKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i)}}get makeUniqueLinkKeyFunction(){return this.Rf}set makeUniqueLinkKeyFunction(t){let e=this.Rf;e!==t&&(t!==null&&f.k(t,Xt,"makeUniqueLinkKeyFunction"),this.Rf=t,this.t("makeUniqueLinkKeyFunction",e,t))}findLinkDataForKey(t){return t===null&&f.o("GraphLinksModel.findLinkDataForKey:key must not be null"),t===void 0||!this.isKeyType(t)?null:this.Di.get(t)}Y1(t){return t===void 0?!1:this.Di.has(t)}makeLinkDataKeyUnique(t){if(t===null)return;let e=this.Dh;if(e==="")return;let i=this.getKeyForLinkData(t);if(i!==void 0&&!this.Y1(i))return;let s=this.Rf;if(s!==null&&(i=s(this,t),i!=null&&!this.Y1(i))){this.Z(t,e,i);return}if(typeof i=="string"){let n=2;for(;this.Y1(i+n);)n++;this.Z(t,e,i+n)}else if(i===void 0||typeof i=="number"){let n=-this.Di.count-1;for(;this.Y1(n);)n--;this.Z(t,e,n)}}containsLinkData(t){return t===null?!1:this.Zo.has(t)}addLinkData(t){t!==null&&(this.containsLinkData(t)||this.HT(t,!0))}HT(t,e){if(this.linkKeyProperty!==""){let s=this.getKeyForLinkData(t);if(s===void 0)this.makeLinkDataKeyUnique(t),s=this.getKeyForLinkData(t);else{if(this.Di.get(s)===t)return;this.makeLinkDataKeyUnique(t),s=this.getKeyForLinkData(t)}s===void 0&&f.o("GraphLinksModel.makeLinkDataKeyUnique failed on "+t+". Data not added to model."),this.Di.set(s,t)}this.Zo.add(t);let i=null;e&&(i=this.Ps.length,this.$o(this.Ps,i,t)),this.vt("linkDataArray",3,"linkDataArray",this,null,t,null,i),this.KN(t)}addLinkDataCollection(t){if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.addLinkData(t[i])}else{let e=t.iterator;for(;e.next();){let i=e.value;this.addLinkData(i)}}}removeLinkData(t){t!==null&&this.jT(t,!0)}jT(t,e){this.Zo.delete(t);let i=this.getKeyForLinkData(t);i!==void 0&&this.Di.delete(i);let s=null;if(e){if(s=this.Ps.indexOf(t),s<0)return;this.go(this.Ps,s)}this.vt("linkDataArray",4,"linkDataArray",this,t,null,s,null),this.ZO(t)}removeLinkDataCollection(t){if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.removeLinkData(t[i])}else{let e=t.iterator;for(;e.next();){let i=e.value;this.removeLinkData(i)}}}mergeLinkDataArray(t){if(this.linkKeyProperty===""&&f.o("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed."),t===this.linkDataArray||!Array.isArray(t))return;let e=new I;e.addAll(this.Di.iteratorKeys);let i=new I,s=t.length;for(let o=0;o<s;o++){let r=t[o],a=this.getKeyForLinkData(r);if(a!==void 0){i.add(a);let h=this.findLinkDataForKey(a);if(h===r)continue;if(h!==null)this.assignAllDataProperties(h,r),this.aD(r,h);else{let l=this.cloneDeep(r);this.setKeyForLinkData(l,a),this.addLinkData(l)}}else{let h=this.cloneDeep(r);this.addLinkData(h),i.add(this.getKeyForLinkData(h))}}let n=e.iterator;for(;n.next();){let o=n.value;if(!i.has(o)){let r=this.findLinkDataForKey(o);r&&this.removeLinkData(r)}}}KN(t){let e=this.Ae(t,!0);e=this.YN(e),this.findNodeDataForKey(e)===null&&this.Js(e,t),e=this.Ae(t,!1),e=this.YN(e),this.findNodeDataForKey(e)===null&&this.Js(e,t);let i=this.getLabelKeysForLinkData(t);if(Array.isArray(i)){let s=i.length;for(let n=0;n<s;n++)e=i[n],this.findNodeDataForKey(e)===null&&this.Js(e,t)}}ZO(t){let e=this.Ae(t,!0);this.Ws(e,t),e=this.Ae(t,!1),this.Ws(e,t);let i=this.getLabelKeysForLinkData(t);if(Array.isArray(i)){let s=i.length;for(let n=0;n<s;n++)e=i[n],this.Ws(e,t)}}get copyLinkDataFunction(){return this.vf}set copyLinkDataFunction(t){let e=this.vf;e!==t&&(t!==null&&f.k(t,Xt,"copyLinkDataFunction"),this.vf=t,this.t("copyLinkDataFunction",e,t))}copyLinkData(t){if(t===null)return null;let e=null,i=this.vf;return i!==null?e=i(t,this):e=this.G1(t,!0),f.Y(e)&&(this.mo!==""&&this.Z(e,this.mo,void 0),this.po!==""&&this.Z(e,this.po,void 0),this.$s!==""&&this.Z(e,this.$s,[])),e}get nodeIsGroupProperty(){return this.Of}set nodeIsGroupProperty(t){let e=this.Of;e!==t&&(this.Pn(t,Xt,"nodeIsGroupProperty"),this.Of=t,this.t("nodeIsGroupProperty",e,t))}isGroupForNodeData(t){if(t===null)return!1;let e=this.Of;return e===""?!1:!!this.yt(t,e)}isGroupForData(t){return this.isGroupForNodeData(t)}get nodeGroupKeyProperty(){return this.Sn}set nodeGroupKeyProperty(t){let e=this.Sn;e!==t&&(this.Pn(t,Xt,"nodeGroupKeyProperty"),this.Sn=t,this.t("nodeGroupKeyProperty",e,t))}get copiesGroupKeyOfNodeData(){return this.rg}set copiesGroupKeyOfNodeData(t){this.rg!==t&&(f.s(t,"boolean",Xt,"copiesGroupKeyOfNodeData"),this.rg=t)}getGroupKeyForNodeData(t){if(t===null)return;let e=this.Sn;if(e==="")return;let i=this.yt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;f.o("GroupKey value for node data "+t+" is not a number or a string: "+i)}}getGroupForData(t){return this.getGroupKeyForNodeData(t)}setGroupKeyForNodeData(t,e){if(e===null&&(e=void 0),e!==void 0&&!this.isKeyType(e)&&f.Zi(e,"number or string",Xt,"setGroupKeyForNodeData:key"),t===null)return;let i=this.Sn;if(i==="")return;if(!this.containsNodeData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);s!==e&&(this.Ws(s,t),this.Z(t,i,e),this.findNodeDataForKey(e)===null&&this.Js(e,t),this.vt("nodeGroupKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}setGroupForData(t,e){this.setGroupKeyForNodeData(t,e)}copyNodeData(t){if(t===null)return null;let e=super.copyNodeData(t);return!this.copiesGroupKeyOfNodeData&&this.Sn!==""&&this.yt(e,this.Sn)!==void 0&&this.Z(e,this.Sn,void 0),e}setDataProperty(t,e,i){if(this.containsNodeData(t)){if(e===this.nodeKeyProperty){this.setKeyForNodeData(t,i);return}else if(e===this.nodeCategoryProperty){this.setCategoryForNodeData(t,i);return}else if(e===this.nodeGroupKeyProperty){this.setGroupKeyForNodeData(t,i);return}}else if(this.containsLinkData(t)){if(e===this.linkFromKeyProperty){this.Wd(t,i,!0);return}else if(e===this.linkToKeyProperty){this.Wd(t,i,!1);return}else if(e===this.linkFromPortIdProperty){this.Jd(t,i,!0);return}else if(e===this.linkToPortIdProperty){this.Jd(t,i,!1);return}else if(e===this.linkKeyProperty){this.setKeyForLinkData(t,i);return}else if(e===this.linkCategoryProperty){this.setCategoryForLinkData(t,i);return}else if(e===this.linkLabelKeysProperty){this.setLabelKeysForLinkData(t,i);return}}let s=this.yt(t,e);s!==i&&(this.Z(t,e,i),this.raiseDataChanged(t,e,s,i))}assignAllDataProperties(t,e){if(!e)return;let i=this.containsNodeData(t),s=this.containsLinkData(t);for(let n in e)if(n!=="__gohashid"&&!(i&&n===this.nodeKeyProperty)){if(i&&n===this.nodeIsGroupProperty&&this.yt(t,n)===e[n]||s&&n===this.linkKeyProperty)continue;this.setDataProperty(t,n,e[n])}}Fy(t,e){super.Fy(t,e);let i=this.mi.iterator;for(;i.next();){let n=i.value;this.jN(n,t,e)}let s=this.Zo.iterator;for(;s.next();){let n=s.value;this.QO(n,t,e)}}jN(t,e,i){if(this.getGroupKeyForNodeData(t)===e){let s=this.Sn;this.Z(t,s,i),this.vt("nodeGroupKey",2,s,t,e,i),typeof s=="string"&&this.updateTargetBindings(t,s)}}QO(t,e,i){if(this.Ae(t,!0)===e){let n=this.mo;this.Z(t,n,i),this.vt("linkFromKey",2,n,t,e,i),typeof n=="string"&&this.updateTargetBindings(t,n)}if(this.Ae(t,!1)===e){let n=this.po;this.Z(t,n,i),this.vt("linkToKey",2,n,t,e,i),typeof n=="string"&&this.updateTargetBindings(t,n)}let s=this.getLabelKeysForLinkData(t);if(Array.isArray(s)){let n=s.length,o=this.$s;for(let r=0;r<n;r++)s[r]===e&&(this.eD(s,r,i),this.vt("linkLabelKeys",3,o,t,e,i,r,r))}}XN(){super.XN();let t=this.linkDataArray,e=t.length;for(let i=0;i<e;i++){let s=t[i];this.KN(s)}}ng(t){super.ng(t);let e=this.getKeyForNodeData(t),i=this.Ny(e);if(i!==null){let s=f.et(),n=i.iterator;for(;n.next();){let o=n.value;if(this.containsNodeData(o)){if(this.getGroupKeyForNodeData(o)===e){let r=this.Sn;this.vt("nodeGroupKey",2,r,o,e,e),typeof r=="string"&&this.updateTargetBindings(o,r),s.push(o)}}else{if(this.Ae(o,!0)===e){let a=this.mo;this.vt("linkFromKey",2,a,o,e,e),typeof a=="string"&&this.updateTargetBindings(o,a),s.push(o)}if(this.Ae(o,!1)===e){let a=this.po;this.vt("linkToKey",2,a,o,e,e),typeof a=="string"&&this.updateTargetBindings(o,a),s.push(o)}let r=this.getLabelKeysForLinkData(o);if(Array.isArray(r)){let a=r.length,h=this.$s;for(let l=0;l<a;l++)r[l]===e&&(this.vt("linkLabelKeys",3,h,o,e,e,l,l),s.push(o))}}}for(let o=0;o<s.length;o++)this.Ws(e,s[o]);f.J(s)}}og(t){super.og(t);let e=this.getGroupKeyForNodeData(t);this.findNodeDataForKey(e)===null&&this.Js(e,t)}Ry(t){super.Ry(t);let e=this.getGroupKeyForNodeData(t);this.Ws(e,t)}get linkCategoryProperty(){return this.qa}set linkCategoryProperty(t){let e=this.qa;e!==t&&(this.Pn(t,Xt,"linkCategoryProperty"),this.qa=t,this.t("linkCategoryProperty",e,t))}getCategoryForLinkData(t){if(t===null)return"";let e=this.qa;if(e==="")return"";let i=this.yt(t,e);if(i===void 0)return"";if(typeof i=="string")return i;f.o("getCategoryForLinkData found a non-string category for "+t+": "+i)}getLinkCategoryForData(t){return this.getCategoryForLinkData(t)}setCategoryForLinkData(t,e){if(f.s(e,"string",Xt,"setCategoryForLinkData:cat"),t===null)return;let i=this.qa;if(i==="")return;if(!this.containsLinkData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);s===void 0&&(s=""),s!==e&&(this.Z(t,i,e),this.vt("linkCategory",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}setLinkCategoryForData(t,e){this.setCategoryForLinkData(t,e)}sg(t,e){super.sg(t,e),this.setGroupKeyForNodeData(e,this.getGroupKeyForNodeData(t))}aD(t,e){this.setCategoryForLinkData(e,this.getCategoryForLinkData(t)),this.setFromKeyForLinkData(e,this.getFromKeyForLinkData(t)),this.setToKeyForLinkData(e,this.getToKeyForLinkData(t)),this.setLabelKeysForLinkData(e,this.getLabelKeysForLinkData(t)),this.setFromPortIdForLinkData(e,this.getFromPortIdForLinkData(t)),this.setToPortIdForLinkData(e,this.getToPortIdForLinkData(t))}get type(){return"GraphLinksModel"}mm(){return!0}Ra(){return!0}zw(){return!0}Hc(){return!0}static EmptyArray=Object.freeze([])}yt.fl(Xt,"GraphLinksModel"),yt.iD=()=>new Xt,yt.LM=()=>new Xt;class Je extends yt{Mn;lg;Wa;constructor(t,e){if(super(),this.Mn="parent",this.lg=!1,this.Wa="parentLinkCategory",t!==void 0&&(Array.isArray(t)?this.nodeDataArray=t:e=t),e){Object.assign(this,e);let i=e.Changed;i&&(delete this.Changed,this.addChangedListener(i))}}cloneProtected(t){super.cloneProtected(t),t.Mn=this.Mn,t.lg=this.lg,t.Wa=this.Wa}toString(t){if(t===void 0&&(t=0),t>=2)return this.toJson();{let e=(this.name!==""?this.name:"")+" TreeModel";if(t>0){e+=`
51
+ node data:`;let i=this.nodeDataArray,s=i.length;for(let n=0;n<s;n++){let o=i[n];e+=" "+this.getKeyForNodeData(o)+":"+oe.toString(o)}}return e}}eg(){let t=super.eg(),e="";return this.nodeParentKeyProperty!=="parent"&&typeof this.nodeParentKeyProperty=="string"&&(e+=`,
52
+ "nodeParentKeyProperty": `+this.De(this.nodeParentKeyProperty)),t+e}Ty(t){super.Ty(t),t.nodeParentKeyProperty&&(this.nodeParentKeyProperty=t.nodeParentKeyProperty)}Dy(t){t.nodeParentKeyProperty!==void 0&&t.nodeParentKeyProperty!==this.nodeParentKeyProperty&&f.o("applyIncrementalJson cannot change Model properties"),super.Dy(t)}maybeEnsureLinkReference(t){return t}get nodeParentKeyProperty(){return this.Mn}set nodeParentKeyProperty(t){let e=this.Mn;e!==t&&(this.Pn(t,Je,"nodeParentKeyProperty"),this.Mn=t,this.t("nodeParentKeyProperty",e,t))}get copiesParentKeyOfNodeData(){return this.lg}set copiesParentKeyOfNodeData(t){this.lg!==t&&(f.s(t,"boolean",Je,"copiesParentKeyOfNodeData"),this.lg=t)}getParentKeyForNodeData(t){if(t===null)return;let e=this.Mn;if(e==="")return;let i=this.yt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;f.o("ParentKey value for node data "+t+" is not a number or a string: "+i)}}setParentKeyForNodeData(t,e){if(e===null&&(e=void 0),e!==void 0&&!this.isKeyType(e)&&f.Zi(e,"number or string",Je,"setParentKeyForNodeData:key"),t===null)return;let i=this.Mn;if(i==="")return;if(e=this.maybeEnsureLinkReference(e),!this.containsNodeData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);s!==e&&(this.Ws(s,t),this.Z(t,i,e),this.findNodeDataForKey(e)===null&&this.Js(e,t),this.vt("nodeParentKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}get parentLinkCategoryProperty(){return this.Wa}set parentLinkCategoryProperty(t){let e=this.Wa;e!==t&&(this.Pn(t,Je,"parentLinkCategoryProperty"),this.Wa=t,this.t("parentLinkCategoryProperty",e,t))}get linkCategoryProperty(){return this.parentLinkCategoryProperty}set linkCategoryProperty(t){this.parentLinkCategoryProperty=t}getParentLinkCategoryForNodeData(t){if(t===null)return"";let e=this.Wa;if(e==="")return"";let i=this.yt(t,e);if(i===void 0)return"";if(typeof i=="string")return i;f.o("getParentLinkCategoryForNodeData found a non-string category for "+t+": "+i)}getLinkCategoryForData(t){return this.getParentLinkCategoryForNodeData(t)}setParentLinkCategoryForNodeData(t,e){if(f.s(e,"string",Je,"setParentLinkCategoryForNodeData:cat"),t===null)return;let i=this.Wa;if(i==="")return;if(!this.containsNodeData(t)){this.Z(t,i,e);return}let s=this.yt(t,i);s===void 0&&(s=""),s!==e&&(this.Z(t,i,e),this.vt("parentLinkCategory",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}setLinkCategoryForData(t,e){this.setParentLinkCategoryForNodeData(t,e)}copyNodeData(t){if(t===null)return null;let e=super.copyNodeData(t);return!this.copiesParentKeyOfNodeData&&this.Mn!==""&&this.yt(e,this.Mn)!==void 0&&this.Z(e,this.Mn,void 0),e}setDataProperty(t,e,i){if(this.containsNodeData(t)){if(e===this.nodeKeyProperty){this.setKeyForNodeData(t,i);return}else if(e===this.nodeCategoryProperty){this.setCategoryForNodeData(t,i);return}else if(e===this.nodeParentKeyProperty){this.setParentKeyForNodeData(t,i);return}else if(e===this.parentLinkCategoryProperty){this.setParentLinkCategoryForNodeData(t,i);return}}let s=this.yt(t,e);s!==i&&(this.Z(t,e,i),this.raiseDataChanged(t,e,s,i))}Fy(t,e){super.Fy(t,e);let i=this.mi.iterator;for(;i.next();){let s=i.value;this.jN(s,t,e)}}jN(t,e,i){if(this.getParentKeyForNodeData(t)===e){let s=this.Mn;this.Z(t,s,i),this.vt("nodeParentKey",2,s,t,e,i),typeof s=="string"&&this.updateTargetBindings(t,s)}}ng(t){super.ng(t);let e=this.getKeyForNodeData(t),i=this.Ny(e);if(i!==null){let s=f.et(),n=i.iterator;for(;n.next();){let o=n.value;if(this.containsNodeData(o)&&this.getParentKeyForNodeData(o)===e){let r=this.Mn;this.vt("nodeParentKey",2,r,o,e,e),typeof r=="string"&&this.updateTargetBindings(o,r),s.push(o)}}for(let o=0;o<s.length;o++)this.Ws(e,s[o]);f.J(s)}}og(t){super.og(t);let e=this.getParentKeyForNodeData(t);e=this.maybeEnsureLinkReference(e),this.findNodeDataForKey(e)===null&&this.Js(e,t)}Ry(t){super.Ry(t);let e=this.getParentKeyForNodeData(t);this.Ws(e,t)}sg(t,e){super.sg(t,e),this.setParentLinkCategoryForNodeData(e,this.getParentLinkCategoryForNodeData(t)),this.setParentKeyForNodeData(e,this.getParentKeyForNodeData(t))}get type(){return"TreeModel"}pm(){return!0}zw(){return!0}}yt.fl(Je,"TreeModel");var Is=(x=>(x[x.ConstantSpacing=0]="ConstantSpacing",x[x.ConstantDistance=1]="ConstantDistance",x[x.ConstantAngle=2]="ConstantAngle",x[x.Packed=3]="Packed",x))(Is||{}),Bs=(x=>(x[x.Clockwise=10]="Clockwise",x[x.Counterclockwise=11]="Counterclockwise",x[x.BidirectionalLeft=12]="BidirectionalLeft",x[x.BidirectionalRight=13]="BidirectionalRight",x))(Bs||{}),Vs=(x=>(x[x.Forwards=20]="Forwards",x[x.Reverse=21]="Reverse",x[x.Ascending=22]="Ascending",x[x.Descending=23]="Descending",x[x.Optimized=24]="Optimized",x))(Vs||{}),zs=(x=>(x[x.Pythagorean=30]="Pythagorean",x[x.Circular=31]="Circular",x))(zs||{});class Ze extends ne{le;If;K1;hg;j1;Fh;HN;qN;WN;Ss;vy;Oy;Ja;Iy;cD;ag;cg;fg;Ef;Xi;b;pe;ye;kn;ug;constructor(t){super(),this.le=0,this.If=0,this.K1=0,this.hg=360,this.j1=0,this.Fh=0,this.HN=new P,this.qN=30,this.WN=0,this.Ss=0,this.vy=0,this.Oy=new En,this.Ja=0,this.Iy=0,this.cD=600,this.ag=NaN,this.cg=1,this.fg=0,this.Ef=360,this.Xi=0,this.b=10,this.pe=24,this.ye=$e.standardComparer,this.kn=6,this.ug=30,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.ag=this.ag,t.cg=this.cg,t.fg=this.fg,t.Ef=this.Ef,t.Xi=this.Xi,t.b=this.b,t.pe=this.pe,t.ye=this.ye,t.kn=this.kn,t.ug=this.ug}oi(t){t in Vs?this.sorting=t:t in Bs?this.direction=t:t in Is?this.arrangement=t:t in zs?this.nodeDiameterFormula=t:super.oi(t)}createNetwork(){return new In(this)}_O(t,e,i){t=this.tI(t);let s=this.j1,n=this.qN,o=this.le,r=this.If,a=this.K1,h=this.hg,l=this.Fh,c=this.WN,u=this.Ss,d=this.vy;if(s=this.arrangement,n=this.nodeDiameterFormula,o=this.radius,(!isFinite(o)||o<=0)&&(o=NaN),r=this.aspectRatio,(!isFinite(r)||r<=0)&&(r=1),a=this.startAngle,isFinite(a)||(a=0),h=this.sweepAngle,(!isFinite(h)||h>360||h<1)&&(h=360),l=this.spacing,isFinite(l)||(l=NaN),s===3&&n===31?s=0:s===3&&n!==31&&(n=31,s=this.arrangement),(this.direction===12||this.direction===13)&&this.sorting!==24){for(let m=0;!(m>=t.length||(e.add(t.elt(m)),m+1>=t.length));m+=2)i.add(t.elt(m+1));this.direction===12?(this.arrangement===3&&e.reverse(),t=new G,t.addAll(e),t.addAll(i)):(this.arrangement===3&&i.reverse(),t=new G,t.addAll(i),t.addAll(e))}let g=t.length;c=0;let p=0;for(let m=0;m<t.length;m++){let y=a+h*p*(this.direction===10?1:-1)/g,w=t.elt(m).diameter;isNaN(w)&&(w=t.elt(m).Rh(y)),h<360&&(m===0||m===t.length-1)&&(w/=2),c+=w,p++}if(isNaN(o)||s===3){if(isNaN(l)&&(l=6),s!==0&&s!==3){let m=-1/0;for(let y=0;y<g;y++){let w=t.elt(y),b=t.elt(y===g-1?0:y+1);isNaN(w.diameter)&&w.Rh(0),isNaN(b.diameter)&&b.Rh(0),m=Math.max(m,(w.diameter+b.diameter)/2)}if(d=m+l,s===2){let y=2*Math.PI/g,w=(m+l)/y;r>1?(o=w,u=o*r):(u=w,o=u)}else o=this.H1(d*(h>=360?g:g-1),r,a*Math.PI/180,h*Math.PI/180)}else o=this.H1(c+(h>=360?g:g-1)*(s!==3?l:l*1.6),r,a*Math.PI/180,h*Math.PI/180);u=o*r}else{u=o*r;let m=this.JN(o,u,a*Math.PI/180,h*Math.PI/180);if(isNaN(l))s===0&&(l=(m-c)/(h>=360?g:g-1));else if(s===0){let y=(m-c)/(h>=360?g:g-1);y<l?(o=this.H1(c+l*(h>=360?g:g-1),r,a*Math.PI/180,h*Math.PI/180),u=o*r):l=y}else{let y=-1/0;for(let v=0;v<g;v++){let k=t.elt(v),S=t.elt(v===g-1?0:v+1);isNaN(k.diameter)&&k.Rh(0),isNaN(S.diameter)&&S.Rh(0),y=Math.max(y,(k.diameter+S.diameter)/2)}let w=y+l,b=this.H1(w*(h>=360?g:g-1),r,a*Math.PI/180,h*Math.PI/180);b>o?(o=b,u=o*r,d=w):d=m/(h>=360?g:g-1)}}return this.j1=s,this.qN=n,this.le=o,this.If=r,this.K1=a,this.hg=h,this.Fh=l,this.WN=c,this.Ss=u,this.vy=d,t}doLayout(t){this.network===null&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);let e=this.network.vertexes;if(e.count<=1){if(e.count===1){let d=e.first();d.centerX=0,d.centerY=0}this.updateParts(),this.network=null,this.isValidLayout=!0;return}let i=new G;i.addAll(e.iterator);let s=new G,n=new G;i=this._O(i,s,n);let o=this.j1,r=this.le,a=this.K1,h=this.hg,l=this.Fh,c=this.Ss,u=this.vy;if((this.direction===12||this.direction===13)&&o===3)this.fD(i,h,a-h/2,10);else if(this.direction===12||this.direction===13){let d=0;switch(o){case 1:d=this.q1(r,c,a,u)*180/Math.PI;break;case 0:{let g=0,p=0,m=s.first();m!==null&&(g=m.Rh(Math.PI/2));let y=n.first();y!==null&&(p=y.Rh(Math.PI/2)),d=this.q1(r,c,a,l+(g+p)/2)*180/Math.PI;break}case 2:d=h/i.length;break}if(this.direction===12){switch(o){case 1:this.Ey(s,h/2,a,11);break;case 0:this.Uy(s,h/2,a,11);break;case 2:this.By(s,h/2,a,11);break}switch(o){case 1:this.Ey(n,h/2,a+d,10);break;case 0:this.Uy(n,h/2,a+d,10);break;case 2:this.By(n,h/2,a+d,10);break}}else{switch(o){case 1:this.Ey(n,h/2,a,11);break;case 0:this.Uy(n,h/2,a,11);break;case 2:this.By(n,h/2,a,11);break}switch(o){case 1:this.Ey(s,h/2,a+d,10);break;case 0:this.Uy(s,h/2,a+d,10);break;case 2:this.By(s,h/2,a+d,10);break}}}else switch(o){case 1:this.Ey(i,h,a,this.direction);break;case 0:this.Uy(i,h,a,this.direction);break;case 2:this.By(i,h,a,this.direction);break;case 3:this.fD(i,h,a,this.direction);break}this.updateParts(),this.network=null,this.isValidLayout=!0}By(t,e,i,s){let n=this.hg,o=this.le,r=this.Ss,a=i*Math.PI/180,h=e*Math.PI/180,l=t.length;for(let c=0;c<l;c++){let u=a+(s===10?c*h/(n>=360?l:l-1):-(c*h)/l),d=t.elt(c),g=o*Math.tan(u)/r,p=Math.sqrt((o*o+r*r*g*g)/(1+g*g));d.centerX=p*Math.cos(u),d.centerY=p*Math.sin(u),d.actualAngle=u*180/Math.PI}}Uy(t,e,i,s){let n=this.le,o=this.Ss,r=this.Fh,a=i*Math.PI/180,h=t.length;for(let l=0;l<h;l++){let c=t.elt(l),u=t.elt(l===h-1?0:l+1),d=n*Math.cos(a),g=o*Math.sin(a);c.centerX=d,c.centerY=g,c.actualAngle=a*180/Math.PI,isNaN(c.diameter)&&c.Rh(0),isNaN(u.diameter)&&u.Rh(0);let p=(c.diameter+u.diameter)/2,m=this.q1(n,o,s===10?a:-a,p+r);a+=s===10?m:-m}}Ey(t,e,i,s){let n=this.le,o=this.Ss,r=this.vy,a=i*Math.PI/180,h=t.length;for(let l=0;l<h;l++){let c=t.elt(l);c.centerX=n*Math.cos(a),c.centerY=o*Math.sin(a),c.actualAngle=a*180/Math.PI;let u=this.q1(n,o,s===10?a:-a,r);a+=s===10?u:-u}}fD(t,e,i,s){let n=this.Iy,o=this.hg;if(this.Ja=0,this.Oy=new En,e<360){for(n=i+(s===10?o:-o);n<0;)n+=360;n%=360,n>180&&(n-=360),n*=Math.PI/180,this.Iy=n,this.uD(t,e,i,s)}else this.dD(t,e,i,s);this.Oy.commit(t)}dD(t,e,i,s){let n=this.le,o=this.Ss,r=this.Fh,a=this.If,h=n*Math.cos(i*Math.PI/180),l=o*Math.sin(i*Math.PI/180),c=t.toArray();if(c.length===3){c[0].centerX=n,c[0].centerY=0,c[1].centerX=c[0].centerX-c[0].width/2-c[1].width/2-r,c[1].y=c[0].y,c[2].centerX=(c[0].centerX+c[1].centerX)/2,c[2].y=c[0].y-c[2].height-r;return}else if(c.length===4){c[0].centerX=n,c[0].centerY=0,c[2].centerX=-c[0].centerX,c[2].centerY=c[0].centerY,c[1].centerX=0,c[1].y=Math.min(c[0].y,c[2].y)-c[1].height-r,c[3].centerX=0,c[3].y=Math.max(c[0].y+c[0].height+r,c[2].y+c[2].height+r);return}let u=P.l();for(let k=0;k<c.length&&(c[k].centerX=h,c[k].centerY=l,!(k>=c.length-1));k++)this.gD(h,l,c,k,s,u)||this.mD(h,l,c,k,s,u),h=u.x,l=u.y;if(P.e(u),this.Ja++,this.Ja>23)return;let d=c[0].centerX,g=c[0].centerY,p=c[c.length-1].centerX,m=c[c.length-1].centerY,y=Math.abs(d-p)-((c[0].width+c[c.length-1].width)/2+r),w=Math.abs(g-m)-((c[0].height+c[c.length-1].height)/2+r),b=0;if(Math.abs(w)<1){let k=Math.abs(d-p),S=(c[0].width+c[c.length-1].width)/2;k<S&&(b=0),y=k-S}else w>0?b=w:Math.abs(y)<1?b=0:b=y;let v=!1;Math.abs(p)>Math.abs(m)?v=p>0!=g>m:v=m>0!=d<p,v=s===10?v:!v,v&&(b=-Math.abs(b),b=Math.min(b,-c[c.length-1].width),b=Math.min(b,-c[c.length-1].height)),this.Oy.iI(b,c),Math.abs(b)>1&&(this.Ja<8?this.le-=b/(2*Math.PI):c.length<5&&b>10?this.le/=2:this.le-=b>0?1.7:-2.3,this.Ss=this.le*a,this.dD(t,e,i,s))}uD(t,e,i,s){let n=this.le,o=this.Ss,r=this.If,a=n*Math.cos(i*Math.PI/180),h=o*Math.sin(i*Math.PI/180),l=P.l(),c=t.toArray();for(let p=0;p<c.length&&(c[p].centerX=a,c[p].centerY=h,!(p>=c.length-1));p++)this.gD(a,h,c,p,s,l)||this.mD(a,h,c,p,s,l),a=l.x,h=l.y;if(P.e(l),this.Ja++,this.Ja>23)return;let u=Math.atan2(h,a),d=s===10?this.Iy-u:u-this.Iy;d=Math.abs(d)<Math.abs(d-2*Math.PI)?d:d-2*Math.PI;let g=d*(n+o)/2;this.Oy.eI(g,c),Math.abs(g)>1&&(this.Ja<8?this.le-=g/(2*Math.PI):this.le-=g>0?1.7:-2.3,this.Ss=this.le*r,this.uD(t,e,i,s))}gD(t,e,i,s,n,o){let r=this.Fh,a=this.le,h=this.Ss,l=0,c=0,u=(i[s].width+i[s+1].width)/2+r,d=!1;if(e>=0!=(n===10)){if(l=t+u,l>a){if(l=t-u,l<-a)return o.x=l,o.y=c,!1;d=!0}}else if(l=t-u,l<-a){if(l=t+u,l>a)return o.x=l,o.y=c,!1;d=!0}return c=Math.sqrt(1-Math.min(1,l*l/(a*a)))*h,e<0!==d&&(c=-c),Math.abs(e-c)>(i[s].height+i[s+1].height)/2?(o.x=l,o.y=c,!1):(o.x=l,o.y=c,!0)}mD(t,e,i,s,n,o){let r=this.Fh,a=this.le,h=this.Ss,l=0,c=0,u=(i[s].height+i[s+1].height)/2+r,d=!1;if(t>=0!=(n===10)){if(c=e-u,c<-h){if(c=e+u,c>h)return o.x=l,o.y=c,!1;d=!0}}else if(c=e+u,c>h){if(c=e-u,c<-h)return o.x=l,o.y=c,!1;d=!0}return l=Math.sqrt(1-Math.min(1,c*c/(h*h)))*a,t<0!==d&&(l=-l),Math.abs(t-l)>(i[s].width+i[s+1].width)/2?(o.x=l,o.y=c,!1):(o.x=l,o.y=c,!0)}commitLayout(){this.commitNodes(),this.isRouting&&this.commitLinks()}commitNodes(){let t=this.group!==null&&this.group.hasPlaceholder(),e=t?this.group.location.copy():null,i=this.actualCenter;t?i=new P(0,0):(i.x=this.arrangementOrigin.x+this.le,i.y=this.arrangementOrigin.y+this.Ss);let s=this.network.vertexes.iterator;for(;s.next();){let n=s.value;n.x+=i.x,n.y+=i.y,n.commit()}if(t){this.group.ensureBounds();let n=this.group.position.copy(),o=this.group.location.copy(),r=e.subtract(o.subtract(n));this.group.move(r),this.HN=r.subtract(n)}}commitLinks(){let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}JN(t,e,i,s){let n=this.cD;if(Math.abs(this.If-1)<.001)return i!==void 0&&s!==void 0?s*t:2*Math.PI*t;let o=t>e?Math.sqrt(t*t-e*e)/t:Math.sqrt(e*e-t*t)/e,r=0,a=0;i!==void 0&&s!==void 0?a=s/(n+1):a=Math.PI/(2*(n+1));let h=0;for(let l=0;l<=n;l++){i!==void 0&&s!==void 0?h=i+l*s/n:h=l*Math.PI/(2*n);let c=Math.sin(h);r+=Math.sqrt(1-o*o*c*c)*a}return i!==void 0&&s!==void 0?(t>e?t:e)*r:4*(t>e?t:e)*r}H1(t,e,i,s){let n=0;return i!==void 0&&s!==void 0?n=this.JN(1,e,i,s):n=this.JN(1,e),t/n}q1(t,e,i,s){if(Math.abs(this.If-1)<.001)return s/t;let n=t>e?Math.sqrt(t*t-e*e)/t:Math.sqrt(e*e-t*t)/e,o=0,r=2*Math.PI/(this.network.vertexes.count*700);t>e&&(i+=Math.PI/2);for(let a=0;;a++){let h=i+a*r,l=Math.sin(h);if(o+=(t>e?t:e)*Math.sqrt(1-n*n*l*l)*r,o>=s)return a*r}}tI(t){switch(this.sorting){case 20:break;case 21:t.reverse();break;case 22:t.sort(this.comparer);break;case 23:t.sort(this.comparer),t.reverse();break;case 24:return this.sI(this.nI(t));default:f.o("Invalid sorting type.")}return t}nI(t){let e=[];for(let s=0;s<t.length;s++)e.push(0);let i=new G;for(let s=0;s<t.length;s++){let n=-1,o=-1;if(s===0)for(let c=0;c<t.length;c++){let u=t.elt(c).edgesCount;u>n&&(n=u,o=c)}else for(let c=0;c<t.length;c++){let u=e[c];u>n&&(n=u,o=c)}i.add(t.elt(o)),e[o]=-1;let r=t.elt(o),a=0,h=r.sourceEdges;for(;h.next();){let c=h.value.fromVertex;a=t.indexOf(c),!(a<0)&&e[a]>=0&&e[a]++}let l=r.destinationEdges;for(;l.next();){let c=l.value.toVertex;a=t.indexOf(c),!(a<0)&&e[a]>=0&&e[a]++}}return i}sI(t){let e=[];for(let u=0;u<t.length;u++){let d=t.elt(u);e[u]=[];let g=0,p=d.destinationEdges;for(;p.next();){let y=p.value.toVertex;g=t.indexOf(y),g!==u&&e[u].indexOf(g)<0&&e[u].push(g)}let m=d.sourceEdges;for(;m.next();){let y=m.value.fromVertex;g=t.indexOf(y),g!==u&&e[u].indexOf(g)<0&&e[u].push(g)}}let i=[];for(let u=0;u<e.length;u++)i[u]=0;let s=[],n=[],o=[],r=[],a=new G,h=0;for(let u=0;u<e.length;u++){let d=e[u].length;if(d===1){r.push(u);continue}if(d===0){a.add(t.elt(u));continue}if(h===0){s.push(u),h++;continue}let g=1/0,p=1/0,m=-1,y=[];for(let w=0;w<s.length;w++)e[s[w]].indexOf(s[w===s.length-1?0:w+1])<0&&y.push(w===s.length-1?0:w+1);if(y.length===0)for(let w=0;w<s.length;w++)y.push(w);for(let w=0;w<y.length;w++){let b=y[w],v=this.oI(e[u],n,o,i,b,s),k=0;for(let S=0;S<e[u].length;S++){let M=e[u][S],F=s.indexOf(M);if(F>=0){let T=Math.abs(b-(F>=b?F+1:F));k+=T<s.length+1-T?T:s.length+1-T}}for(let S=0;S<n.length;S++){let M=i[n[S]],F=i[o[S]];if(M>=b&&M++,F>=b&&F++,M>F){let T=F;F=M,M=T}F-M<(s.length+2)/2==(M<b&&b<=F)&&k++}(v<g||v===g&&k<p)&&(g=v,p=k,m=b)}s.splice(m,0,u);for(let w=0;w<s.length;w++)i[s[w]]=w;for(let w=0;w<e[u].length;w++){let b=e[u][w];s.indexOf(b)>=0&&(n.push(u),o.push(b))}h++}let l=!1,c=s.length;for(;;){l=!0;for(let u=0;u<r.length;u++){let d=r[u],g=e[d][0],p=s.indexOf(g);if(p>=0){let m=0;for(let y=0;y<e[g].length;y++){let w=e[g][y],b=s.indexOf(w);if(b<0||b===p)continue;let v=b>p?b-p:p-b,k=c-v;m+=b<p!=v>k?1:-1}s.splice(m<0?p:p+1,0,d),r.splice(u,1),u--}else l=!1}if(l)break;s.push(r[0]),r.splice(0,1)}for(let u=0;u<s.length;u++){let d=s[u];a.add(t.elt(d))}return a}oI(t,e,i,s,n,o){let r=0;for(let a=0;a<e.length;a++){let h=e[a],l=i[a],c=s[h],u=s[l],d=0,g=0;if(c<u?(d=c,g=u):(d=u,g=c),d<n&&n<=g)for(let p=0;p<t.length;p++){let m=t[p];o.indexOf(m)<0||d<s[m]&&s[m]<g||d===s[m]||g===s[m]||r++}else for(let p=0;p<t.length;p++){let m=t[p];o.indexOf(m)<0||!(d<s[m]&&s[m]<g)||d===s[m]||g===s[m]||r++}}return r}get radius(){return this.ag}set radius(t){this.ag!==t&&(f.s(t,"number",Ze,"radius"),(t>0||isNaN(t))&&(this.ag=t,this.invalidateLayout()))}get aspectRatio(){return this.cg}set aspectRatio(t){this.cg!==t&&(f.s(t,"number",Ze,"aspectRatio"),t>0&&(this.cg=t,this.invalidateLayout()))}get startAngle(){return this.fg}set startAngle(t){this.fg!==t&&(f.s(t,"number",Ze,"startAngle"),this.fg=t,this.invalidateLayout())}get sweepAngle(){return this.Ef}set sweepAngle(t){this.Ef!==t&&(f.s(t,"number",Ze,"sweepAngle"),t>0&&t<=360?this.Ef=t:this.Ef=360,this.invalidateLayout())}get arrangement(){return this.Xi}set arrangement(t){this.Xi!==t&&(t===3||t===0||t===1||t===2)&&(this.Xi=t,this.invalidateLayout())}get direction(){return this.b}set direction(t){this.b!==t&&(t===10||t===11||t===12||t===13)&&(this.b=t,this.invalidateLayout())}get sorting(){return this.pe}set sorting(t){this.pe!==t&&(this.pe=t,this.invalidateLayout())}get comparer(){return this.ye}set comparer(t){this.ye!==t&&(f.k(t,Ze,"comparer"),this.ye=t,this.invalidateLayout())}get spacing(){return this.kn}set spacing(t){this.kn!==t&&(f.s(t,"number",Ze,"spacing"),this.kn=t,this.invalidateLayout())}get nodeDiameterFormula(){return this.ug}set nodeDiameterFormula(t){this.ug!==t&&(t===30||t===31)&&(this.ug=t,this.invalidateLayout())}get actualXRadius(){return this.le}get actualYRadius(){return this.Ss}get actualSpacing(){return this.Fh}get actualCenter(){return this.HN}static ConstantSpacing=0;static ConstantDistance=1;static ConstantAngle=2;static Packed=3;static Clockwise=10;static Counterclockwise=11;static BidirectionalLeft=12;static BidirectionalRight=13;static Forwards=20;static Reverse=21;static Ascending=22;static Descending=23;static Optimized=24;static Pythagorean=30;static Circular=31}class En{Uf;$a;Bf;constructor(){this.Uf=-1/0,this.$a=null,this.Bf=null}iI(t,e){if(t>0&&this.Uf<0||Math.abs(t)<Math.abs(this.Uf)&&!(t<0&&this.Uf>0)){this.Uf=t,this.$a=[],this.Bf=[];for(let i=0;i<e.length;i++)this.$a[i]=e[i].bounds.x,this.Bf[i]=e[i].bounds.y}}eI(t,e){if(Math.abs(t)<Math.abs(this.Uf)){this.Uf=t,this.$a=[],this.Bf=[];for(let i=0;i<e.length;i++)this.$a[i]=e[i].bounds.x,this.Bf[i]=e[i].bounds.y}}commit(t){if(!(this.$a===null||this.Bf===null))for(let e=0;e<this.$a.length;e++){let i=t.elt(e);i.x=this.$a[e],i.y=this.Bf[e]}}}class In extends We{constructor(t){super(t)}createVertex(){return new Ii(this)}createEdge(){return new Bn(this)}}class Ii extends $e{yo;W1;constructor(t){super(t),this.yo=NaN,this.W1=NaN}Rh(t){let e=this.network;if(e===null)return NaN;let i=e.layout;if(i===null)return NaN;if(i.arrangement===3){if(i.nodeDiameterFormula===31)return this.yo=Math.max(this.width,this.height),this.yo;{let s=Math.abs(Math.sin(t)),n=Math.abs(Math.cos(t));return s===0?this.width:n===0?this.height:(this.yo=Math.min(this.height/s,this.width/n),this.yo)}}else return i.nodeDiameterFormula===31?(this.yo=Math.max(this.width,this.height),this.yo):(this.yo=Math.sqrt(this.width*this.width+this.height*this.height),this.yo)}get diameter(){return this.yo}set diameter(t){this.yo!==t&&(f.s(t,"number",Ii,"diameter"),this.yo=t)}get actualAngle(){return this.W1}set actualAngle(t){this.W1!==t&&(f.s(t,"number",Ii,"actualAngle"),this.W1=t)}}class Bn extends mi{constructor(t){super(t)}}class re extends ne{Vy;vh;Ms;dg;Nn;Fe;gg;mg;pg;Vf;yg;wg;zf;Xf;Gf;Yf;xg;bg;Kf;Za;constructor(t){super(),this.Vy=0,this.vh=0,this.Ms=new Q(100,100).u(),this.dg=!1,this.Nn=!0,this.Fe=!1,this.gg=100,this.mg=300,this.pg=1,this.Vf=1e3,this.yg=10,this.wg=Math,this.zf=.05,this.Xf=50,this.Gf=150,this.Yf=0,this.xg=10,this.bg=5,this.Kf=NaN,this.Za=10,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Ms.a(this.Ms),t.dg=this.dg,t.Nn=this.Nn,t.Fe=this.Fe,t.gg=this.gg,t.mg=this.mg,t.pg=this.pg,t.Vf=this.Vf,t.yg=this.yg,t.wg=this.wg,t.zf=this.zf,t.Xf=this.Xf,t.Gf=this.Gf,t.Yf=this.Yf,t.xg=this.xg,t.bg=this.bg,t.Kf=this.Kf,t.Za=this.Za}createNetwork(){return new Vn(this)}doLayout(t){this.network=this.makeNetwork(t);let e=this.network.vertexes.iterator,i=this.maxIterations;if(this.network.vertexes.count>0){for(this.network.deleteSelfEdges(),e=this.network.vertexes.iterator;e.next();){let n=e.value;n.charge=this.electricalCharge(n),n.mass=this.gravitationalMass(n)}let s=this.network.edges.iterator;for(;s.next();){let n=s.value;n.stiffness=this.springStiffness(n),n.length=this.springLength(n)}if(this.$N(),this.vh=0,this.needsPrelayout()){let n=this.network,o=n.splitIntoSubNetworks(!1),r=o.iterator;for(;r.next();){let a=r.value;this.doConnectedSubnetLayout(a)}for(r=o.iterator,this.rI(r,n),r=o.iterator;r.next();){let a=r.value,h=a.vertexes.iterator;for(;h.next();){let c=h.value;n.addVertex(c)}let l=a.edges.iterator;for(;l.next();){let c=l.value;n.addEdge(c)}}}else this.pD(this.network,this.maxIterations);this.updateParts()}this.maxIterations=i,this.isValidLayout=!0}needsPrelayout(){if(this.network===null||this.network.vertexes.count<3)return!1;let t=0,e=0,i=this.network.vertexes.first().bounds,s=this.network.vertexes.iterator;for(;s.next();){let n=s.value,o=n.bounds;if(isNaN(n.x)||isNaN(n.y)||o.intersectsRect(i)&&(t++,t>2))return!0;if(e>10)return!1;e++}return!1}doConnectedSubnetLayout(t){let e=t.vertexes.iterator;for(;e.next();){let a=e.value;a.hierarchicalVertexes.add(a)}let i=t,s=this.Kf;if(isNaN(s)&&(s=t.edges.count/t.vertexes.count),s<t.vertexes.count)for(;i.vertexes.count>Math.max(100,Math.sqrt(s*t.vertexes.count));)i=this.coarsenNetwork(i);let n=0;e=i.vertexes.iterator;let o=this.randomNumberGenerator;for(o===null&&(this.randomNumberGenerator=o=new zn(0));e.next();){e.value.idInCluster=n++;let a=10*(o.random()-.5),h=10*(o.random()-.5);this.isFixed(e.value)||(e.value.x=a,e.value.y=h);let l=e.value.hierarchicalVertexes.iterator;for(;l.next();)this.isFixed(l.value)||(l.value.x=a,l.value.y=h)}let r=this.computePairwiseDistances(i);this.lI(i,r,this.maxPrelayoutIterations,t.vertexes.count),this.pD(t,this.maxIterations)}computePairwiseDistances(t){let e=t.vertexes.count,i=new Array(e);for(let r=0;r<e;r++)i[r]=new Array(e).fill(-1),i[r][r]=0;let s=t.vertexes.iterator,n=new Map,o=[];for(;s.next();){let r=s.value;for(o=[r],n=new Map,n.set(r.idInCluster,0);o.length>0;){let a=o.shift(),h=a.vertexes.iterator;for(;h.next();){let l=h.value;n.has(l.idInCluster)||(n.set(l.idInCluster,n.get(a.idInCluster)+1),o.push(l))}}for(let a=0;a<e;a++){let h=Math.min(i[r.idInCluster][a],i[a][r.idInCluster]),l=n.get(a);(h<0||l<h)&&(i[r.idInCluster][a]=l,i[a][r.idInCluster]=l)}}return i}coarsenNetwork(t){let e=this.createNetwork(),i=new Map,s=0,n=t.vertexes.iterator;for(;n.next();)n.value.idInCluster=s++;for(n=t.vertexes.iterator;n.next();){let r=n.value;if(i.has(r.idInCluster))continue;let a=Number.MAX_SAFE_INTEGER,h=null,l=r.vertexes.iterator;for(;l.next();){let u=l.value;i.has(u.idInCluster)||u.hierarchicalVertexes.length<a&&(a=u.hierarchicalVertexes.length,h=u)}let c=e.createVertex();c.hierarchicalVertexes.addAll(r.hierarchicalVertexes),h!=null&&c.hierarchicalVertexes.addAll(h.hierarchicalVertexes),i.set(r.idInCluster,c),h!=null&&i.set(h.idInCluster,c),e.addVertex(c)}let o=t.edges.iterator;for(;o.next();){let r=o.value,a=i.get(r.fromVertex.idInCluster),h=i.get(r.toVertex.idInCluster);if(a===h)continue;let l=e.createEdge();l.fromVertex=a||null,l.toVertex=h||null,e.addEdge(l)}return e}Cw(t,e){let i=!0,s=t.vertexes.iterator;for(;s.next();){let n=s.value;i?(i=!1,e.set(n.bounds)):e.unionRect(n.bounds)}return e}rI(t,e){let i=this.arrangementSpacing,s=t.count,n=!0,o=0,r=0,a=f.et();for(let u=0;u<s+e.vertexes.count+2;u++)a[u]=null;let h=0;t.reset();let l=z.l(),c;for(;t.next();){let u=t.value;if(this.Cw(u,l),n)n=!1,o=l.x+l.width/2,r=l.y+l.height/2,a[0]=new P(l.x+l.width+i.width,l.y),a[1]=new P(l.x,l.y+l.height+i.height),h=2;else{let d=this.yD(a,h,o,r,l.width,l.height,i),g=a[d],p=new P(g.x+l.width+i.width,g.y),m=new P(g.x,g.y+l.height+i.height);d+1<h&&a.splice(d+1,0,null),a[d]=p,a[d+1]=m,h++;let y=g.x-l.x,w=g.y-l.y;for(c=u.vertexes.iterator;c.next();){let b=c.value;this.isFixed(b)||(b.centerX+=y,b.centerY+=w)}}}for(z.e(l),c=e.vertexes.iterator;c.next();){let u=c.value,d=u.bounds;if(h<2){o=d.x+d.width/2,r=d.y+d.height/2,a[0]=new P(d.x+d.width+i.width,d.y),a[1]=new P(d.x,d.y+d.height+i.height),h=2;continue}let g=this.yD(a,h,o,r,d.width,d.height,i),p=a[g],m=new P(p.x+d.width+i.width,p.y),y=new P(p.x,p.y+d.height+i.height);g+1<h&&a.splice(g+1,0,null),a[g]=m,a[g+1]=y,h++,this.isFixed(u)||(u.centerX=p.x+u.width/2,u.centerY=p.y+u.height/2)}f.J(a)}yD(t,e,i,s,n,o,r){let a=9e19,h=-1;t:for(let l=0;l<e;l++){let c=t[l],u=c.x-i,d=c.y-s,g=u*u+d*d;if(g<a){for(let p=l-1;p>=0;p--)if(t[p].y>c.y&&t[p].x-c.x<n+r.width)continue t;for(let p=l+1;p<e;p++)if(t[p].x>c.x&&t[p].y-c.y<o+r.height)continue t;h=l,a=g}}return h}$N(){if(!this.comments)return;let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value;this.addComments(e)}}addComments(t){let e=t.node;if(e!==null){let i=e.findNodesConnected();for(;i.next();){let s=i.value;if(s.category!=="Comment"||!s.isVisible())continue;let n=this.network.findVertex(s);n===null&&(n=this.network.addNode(s)),n.charge=this.defaultCommentElectricalCharge;let o=null,r=n.destinationEdges;for(;r.next();){let a=r.value;if(a.toVertex===t){o=a;break}}if(o===null){let a=n.sourceEdges;for(;a.next();){let h=a.value;if(h.fromVertex===t){o=h;break}}}o===null&&(o=this.network.linkVertexes(t,n,null)),o.length=this.defaultCommentSpringLength}}}ZN(t,e){let i=t.bounds,s=i.x,n=i.y,o=i.width,r=i.height,a=e.bounds,h=a.x,l=a.y,c=a.width,u=a.height;if(s+o<h)if(n>l+u){let d=s+o-h,g=n-l-u;return L.kw(d*d+g*g)}else if(n+r<l){let d=s+o-h,g=n+r-l;return L.kw(d*d+g*g)}else return h-(s+o);else if(s>h+c)if(n>l+u){let d=s-h-c,g=n-l-u;return L.kw(d*d+g*g)}else if(n+r<l){let d=s-h-c,g=n+r-l;return L.kw(d*d+g*g)}else return s-(h+c);else return n>l+u?n-(l+u):n+r<l?l-(n+r):.1}pD(t,e){let i=this.vh+e;for(;this.vh<i&&(this.vh++,!!this.hI(t)););}hI(t){let e=t.vertexes.toArray();if(e.length<=0)return!1;let i=e[0];i.forceX=0,i.forceY=0;let s=i.centerX,n=s,o=i.centerY,r=o;for(let p=1;p<e.length;p++){let m=e[p];m.forceX=0,m.forceY=0;let y=m.centerX,w=m.centerY;s=Math.min(s,y),n=Math.max(n,y),o=Math.min(o,w),r=Math.max(r,w)}let a=n-s>r-o;a?e.sort((p,m)=>p===null||m===null||p===m?0:p.centerX-m.centerX):e.sort((p,m)=>p===null||m===null||p===m?0:p.centerY-m.centerY);let h=this.Vf,l=0,c=0,u=0;for(let p=0;p<e.length;p++){let m=e[p],y=m.bounds,w=m.focus,b=y.x+w.x,v=y.y+w.y;c=m.charge*this.electricalFieldX(b,v),u=m.charge*this.electricalFieldY(b,v),c+=m.mass*this.gravitationalFieldX(b,v),u+=m.mass*this.gravitationalFieldY(b,v),m.forceX+=c,m.forceY+=u;for(let k=p+1;k<e.length;k++){let S=e[k];if(!this.shouldInteract(m,S)||k===p)continue;let M=S.bounds,F=S.focus,T=M.x+F.x,N=M.y+F.y;if(b-T>h||T-b>h){if(a)break;continue}if(v-N>h||N-v>h){if(!a)break;continue}let C=this.ZN(m,S),R=2*m.charge,O=2*S.charge;if(C>1)l=R*O/(C*C),c=l*(b-T)/C,u=l*(v-N)/C;else{let B=this.randomNumberGenerator;B===null&&(this.randomNumberGenerator=B=new zn(0));let X=B.random(),Y=B.random();if(b>T)c=Math.abs(S.bounds.right-m.bounds.x),c=R*O*(1+c)*X;else if(b<T)c=Math.abs(S.bounds.x-m.bounds.right),c=-(R*O)*(1+c)*X;else{let j=Math.max(S.width,m.width);c=R*O*((1+j)*X-j/2)}if(v>N)u=Math.abs(S.bounds.bottom-m.bounds.y),u=R*O*(1+u)*Y;else if(b<T)u=Math.abs(S.bounds.y-m.bounds.bottom),u=-(R*O)*(1+u)*Y;else{let j=Math.max(S.height,m.height);u=R*O*((1+j)*Y-j/2)}}m.forceX+=c,m.forceY+=u,S.forceX-=c,S.forceY-=u}}let d=t.edges.iterator;for(;d.next();){let p=d.value,m=p.fromVertex,y=p.toVertex,w=m.bounds,b=m.focus,v=w.x+b.x,k=w.y+b.y,S=y.bounds,M=y.focus,F=S.x+M.x,T=S.y+M.y,N=this.ZN(m,y);N>1&&(l=.1*p.stiffness*(N-p.length),c=l*.5*(m.width+y.height)*(v-F)/N,u=l*.5*(m.width+y.height)*(k-T)/N),m.forceX-=c,m.forceY-=u,y.forceX+=c,y.forceY+=u}let g=0;for(let p=0;p<e.length;p++){let m=e[p];this.isFixed(m)?this.moveFixedVertex(m):g=Math.max(g,this.moveVertex(m)||0)}return g>this.epsilonDistance*this.epsilonDistance}lI(t,e,i,s){let n=this.vh+i,o=Math.sqrt(s);this.Vy=this.Za*t.vertexes.count;let r=t.vertexes.toArray(),a=0,h=0,l=0;for(;this.vh<n;){this.vh++,h=a,a=0;for(let c=0;c<r.length;c++){r[c].forceX=0,r[c].forceY=0;for(let d=0;d<r.length;d++){if(c===d)continue;let g=this.ZN(r[c],r[d]),p=e[r[c].idInCluster][r[d].idInCluster],m=(g-this.Za*o*p)/g;r[c].forceX+=m*(r[d].x-r[c].x),r[c].forceY+=m*(r[d].y-r[c].y)}let u=Math.sqrt(r[c].forceX*r[c].forceX+r[c].forceY*r[c].forceY);if(u>0){r[c].forceX=this.Vy*r[c].forceX/u,r[c].forceY=this.Vy*r[c].forceY/u,this.isFixed(r[c])||(r[c].x+=r[c].forceX,r[c].y+=r[c].forceY);let d=r[c].hierarchicalVertexes.iterator;for(;d.next();){let g=d.value;this.isFixed(g)||(g.centerX+=r[c].forceX,g.centerY+=r[c].forceY)}}a+=u*u}if(a>=h){if(l++,l>=5)break}else l=0;this.Vy*=.95}}moveVertex(t){let e=t.forceX,i=t.forceY,s=this.moveLimit;return e<-s?e=-s:e>s&&(e=s),i<-s?i=-s:i>s&&(i=s),t.centerX+=e,t.centerY+=i,e*e+i*i}shouldInteract(t,e){return!0}moveFixedVertex(t){}commitLayout(){this.zy(),this.commitNodes(),this.isRouting&&this.commitLinks()}zy(){if(!this.setsPortSpots)return;let t=this.network.edges.iterator;for(;t.next();){let e=t.value.link;e!==null&&(e.fromSpot=D.Default,e.toSpot=D.Default)}}commitNodes(){let t=0,e=0;if(this.arrangesToOrigin){let n=z.l();this.Cw(this.network,n);let o=this.arrangementOrigin;t=o.x-n.x,e=o.y-n.y,z.e(n)}let i=z.l(),s=this.network.vertexes.iterator;for(;s.next();){let n=s.value;(t!==0||e!==0)&&(i.a(n.bounds),i.x+=t,i.y+=e,n.bounds=i),n.commit()}z.e(i)}commitLinks(){let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}springStiffness(t){let e=t.stiffness;return isNaN(e)?this.zf:e}springLength(t){let e=t.length;return isNaN(e)?this.Xf:e}electricalCharge(t){let e=t.charge;return isNaN(e)?this.Gf:e}electricalFieldX(t,e){return 0}electricalFieldY(t,e){return 0}gravitationalMass(t){let e=t.mass;return isNaN(e)?this.Yf:e}gravitationalFieldX(t,e){return 0}gravitationalFieldY(t,e){return 0}isFixed(t){return t.isFixed}get currentIteration(){return this.vh}get arrangementSpacing(){return this.Ms}set arrangementSpacing(t){this.Ms.equals(t)||(this.Ms.a(t),this.invalidateLayout())}get arrangesToOrigin(){return this.dg}set arrangesToOrigin(t){this.dg!==t&&(f.s(t,"boolean",re,"arrangesToOrigin"),this.dg=t,this.invalidateLayout())}get setsPortSpots(){return this.Nn}set setsPortSpots(t){this.Nn!==t&&(f.s(t,"boolean",re,"setsPortSpots"),this.Nn=t,this.invalidateLayout())}get comments(){return this.Fe}set comments(t){this.Fe!==t&&(f.s(t,"boolean",re,"comments"),this.Fe=t,this.invalidateLayout())}get maxPrelayoutIterations(){return this.gg}set maxPrelayoutIterations(t){this.gg!==t&&(f.s(t,"number",re,"maxPrelayoutIterations"),t>=0&&(this.gg=t,this.invalidateLayout()))}get maxIterations(){return this.mg}set maxIterations(t){this.mg!==t&&(f.s(t,"number",re,"maxIterations"),t>=0&&(this.mg=t,this.invalidateLayout()))}get epsilonDistance(){return this.pg}set epsilonDistance(t){this.pg!==t&&(f.s(t,"number",re,"epsilonDistance"),t>0&&(this.pg=t,this.invalidateLayout()))}get infinityDistance(){return this.Vf}set infinityDistance(t){this.Vf!==t&&(f.s(t,"number",re,"infinityDistance"),t>1&&(this.Vf=t,this.invalidateLayout()))}get moveLimit(){return this.yg}set moveLimit(t){this.yg!==t&&(f.s(t,"number",re,"moveLimit"),this.yg=t,this.invalidateLayout())}get randomNumberGenerator(){return this.wg}set randomNumberGenerator(t){this.wg!==t&&(t!==null&&!f.it(t.random)&&f.o('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+t),this.wg=t)}get defaultSpringStiffness(){return this.zf}set defaultSpringStiffness(t){this.zf!==t&&(f.s(t,"number",re,"defaultSpringStiffness"),this.zf=t,this.invalidateLayout())}get defaultSpringLength(){return this.Xf}set defaultSpringLength(t){this.Xf!==t&&(f.s(t,"number",re,"defaultSpringLength"),this.Xf=t,this.invalidateLayout())}get defaultElectricalCharge(){return this.Gf}set defaultElectricalCharge(t){this.Gf!==t&&(f.s(t,"number",re,"defaultElectricalCharge"),this.Gf=t,this.invalidateLayout())}get defaultGravitationalMass(){return this.Yf}set defaultGravitationalMass(t){this.Yf!==t&&(f.s(t,"number",re,"defaultGravitationalMass"),this.Yf=t,this.invalidateLayout())}get defaultCommentSpringLength(){return this.xg}set defaultCommentSpringLength(t){this.xg!==t&&(f.s(t,"number",re,"defaultCommentSpringLength"),this.xg=t,this.invalidateLayout())}get defaultCommentElectricalCharge(){return this.bg}set defaultCommentElectricalCharge(t){this.bg!==t&&(f.s(t,"number",re,"defaultCommentElectricalCharge"),this.bg=t,this.invalidateLayout())}get prelayoutQuality(){return this.Kf}set prelayoutQuality(t){this.Kf!==t&&(f.s(t,"number",re,"prelayoutQuality"),this.Kf=t,this.invalidateLayout())}get prelayoutSpread(){return this.Za}set prelayoutSpread(t){this.Za!==t&&(f.s(t,"number",re,"prelayoutSpread"),this.Za=t,this.invalidateLayout())}}class Vn extends We{constructor(t){super(t)}createVertex(){return new Qe(this)}createEdge(){return new Bi(this)}}class Qe extends $e{J1;$1;Z1;Q1;_1;hierarchicalVertexes;idInCluster;constructor(t){super(t),this.J1=!1,this.$1=NaN,this.Z1=NaN,this.Q1=0,this._1=0,this.hierarchicalVertexes=new G,this.idInCluster=-1}get isFixed(){return this.J1}set isFixed(t){this.J1!==t&&(f.s(t,"boolean",Qe,"isFixed"),this.J1=t)}get charge(){return this.$1}set charge(t){this.$1!==t&&(f.s(t,"number",Qe,"charge"),this.$1=t)}get mass(){return this.Z1}set mass(t){this.Z1!==t&&(f.s(t,"number",Qe,"mass"),this.Z1=t)}get forceX(){return this.Q1}set forceX(t){this.Q1!==t&&(f.s(t,"number",Qe,"forceX"),this.Q1=t)}get forceY(){return this._1}set forceY(t){this._1!==t&&(f.s(t,"number",Qe,"forceY"),this._1=t)}}class Bi extends mi{tk;ik;constructor(t){super(t),this.tk=NaN,this.ik=NaN}get stiffness(){return this.tk}set stiffness(t){this.tk!==t&&(f.s(t,"number",Bi,"stiffness"),this.tk=t)}get length(){return this.ik}set length(t){this.ik!==t&&(f.s(t,"number",Bi,"length"),this.ik=t)}}class zn{I;R;Q;M;A;seed;constructor(t){t===void 0&&(t=42),this.seed=t,this.A=48271,this.M=2147483647,this.Q=this.M/this.A,this.R=this.M%this.A,this.I=1/this.M,this.random()}random(){let t=this.seed/this.Q,e=this.seed%this.Q,i=this.A*e-this.R*t;return i>0?this.seed=i:this.seed=i+this.M,this.seed*this.I}}var Ks=(x=>(x[x.DepthFirst=0]="DepthFirst",x[x.Greedy=1]="Greedy",x[x.FromLayers=2]="FromLayers",x))(Ks||{}),Xs=(x=>(x[x.OptimalLinkLength=10]="OptimalLinkLength",x[x.LongestPathSink=11]="LongestPathSink",x[x.LongestPathSource=12]="LongestPathSource",x))(Xs||{}),js=(x=>(x[x.DepthFirstOut=20]="DepthFirstOut",x[x.DepthFirstIn=21]="DepthFirstIn",x[x.Naive=22]="Naive",x))(js||{}),Ys=(x=>(x[x.None=30]="None",x[x.Less=31]="Less",x[x.More=32]="More",x))(Ys||{}),Kn=(x=>(x[x.None=0]="None",x[x.Expand=1]="Expand",x[x.Straighten=2]="Straighten",x[x.Median=4]="Median",x[x.MaybeExpand=8]="MaybeExpand",x[x.All=15]="All",x))(Kn||{}),Xn=(x=>(x[x.None=0]="None",x[x.UpperLeft=1]="UpperLeft",x[x.UpperRight=2]="UpperRight",x[x.LowerLeft=4]="LowerLeft",x[x.LowerRight=8]="LowerRight",x[x.All=15]="All",x))(Xn||{});class _e extends ne{Ns;Wi;b;jf;Hf;qf;Qa;Wf;Qo;Jf;Nn;kt;Xy;zt;kg;Cs;ci;Zs;Ls;As;It;Pg;_a;Sg;Qs;$f;_o;Cn;Ln;QN;constructor(t){super(),this.Ns=25,this.Wi=25,this.b=0,this.jf=0,this.Hf=10,this.qf=20,this.Qa=4,this.Wf=31,this.Qo=15,this.Jf=10,this.Nn=!0,this.kt=-1,this.Xy=-1,this.zt=-1,this.kg=0,this.Cs=0,this.ci=null,this.Zs=null,this.Ls=null,this.As=null,this.It=null,this.Pg=0,this._a=null,this.Sg=null,this.Qs=0,this.$f=null,this._o=new P,this.Cn=[],this.Cn.length=100,this.Ln=15,this.QN=0,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Ns=this.Ns,t.Wi=this.Wi,t.b=this.b,t.jf=this.jf,t.Hf=this.Hf,t.qf=this.qf,t.Qa=this.Qa,t.Wf=this.Wf,t.Qo=this.Qo,t.Jf=this.Jf,t.Nn=this.Nn,t.Ln=this.Ln}oi(t){t in Ys?this.aggressiveOption=t:t in Ks?this.cycleRemoveOption=t:t in js?this.initializeOption=t:t in Xs?this.layeringOption=t:super.oi(t)}createNetwork(){return new jn(this)}doLayout(t){this.network===null&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin),this.aI(),this.network.vertexes.count>0&&(this.network.deleteSelfEdges(),this.cycleRemoveOption!==2&&this.removeCycles(),this.cI(),this.cycleRemoveOption===2&&this.removeCycles(),this.fI(),this.uI(),this.dI(),this.reduceCrossings(),this.straightenAndPack(),this.updateParts()),this.network=null,this.isValidLayout=!0}linkMinLength(t){return 1}linkLengthWeight(t){return 1}linkStraightenWeight(t){let e=t.fromVertex.node||t.fromVertex.data,i=t.toVertex.node||t.toVertex.data;return e===null&&i===null?8:e===null||i===null?4:1}nodeMinLayerSpace(t,e){return t.node===null&&t.data===null?0:this.b===90||this.b===270?e?t.focus.y+10:t.bounds.height-t.focus.y+10:e?t.focus.x+10:t.bounds.width-t.focus.x+10}nodeMinColumnSpace(t,e){if(t.node===null&&t.data===null)return 0;let i=e?t.ek:t.sk;if(i!==null)return i;let s=this.b;return s===90||s===270?e?t.ek=t.focus.x/this.Wi+1|0:t.sk=(t.bounds.width-t.focus.x)/this.Wi+1|0:e?t.ek=t.focus.y/this.Wi+1|0:t.sk=(t.bounds.height-t.focus.y)/this.Wi+1|0}Ji(){this._a===null&&(this._a=[]);let t=0,e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;this._a[t]=i.layer,t++,this._a[t]=i.column,t++,this._a[t]=i.index,t++}return this._a}We(t){let e=0,i=this.network.vertexes.iterator;for(;i.next();){let s=i.value;s.layer=t[e],e++,s.column=t[e],e++,s.index=t[e],e++}}wD(t,e){let i=this.Oh(t),s=this.ci[t];(this.Sg===null||this.Sg.length<s*s)&&(this.Sg=[]);let n=this.Sg;for(let o=0;o<s;o++){let r=0,a=i[o],h=a.near,l=0;h!==null&&h!==a&&h.layer===a.layer&&(r+=Math.max(0,Math.abs(h.index-a.index)-1));let c,u=0,d,g=0,p=0,m=0,y,w=0,b,v=0,k=0,S=0,M;if(e>=0){for(c=i[o].fo,u=0;u<c.length;u++)if(d=c[u],d.valid&&d.fromVertex.layer!==t)for(g=d.fromVertex.index,p=d.portToPos,m=d.portFromPos,w=u+1;w<c.length;w++)b=c[w],b.valid&&b.fromVertex.layer!==t&&(v=b.fromVertex.index,k=b.portToPos,S=b.portFromPos,p<k&&(g>v||g===v&&m>S)&&r++,k<p&&(v>g||v===g&&S>m)&&r++)}if(e<=0){for(c=i[o].Wo,u=0;u<c.length;u++)if(d=c[u],d.valid&&d.toVertex.layer!==t)for(g=d.toVertex.index,p=d.portToPos,m=d.portFromPos,w=u+1;w<c.length;w++)b=c[w],b.valid&&b.toVertex.layer!==t&&(v=b.toVertex.index,k=b.portToPos,S=b.portFromPos,m<S&&(g>v||g===v&&p>k)&&r++,S<m&&(v>g||v===g&&k>p)&&r++)}for(n[o*s+o]=r,l=o+1;l<s;l++){let F=0,T=0;if(e>=0){for(y=i[o].fo,M=i[l].fo,u=0;u<y.length;u++)if(d=y[u],d.valid&&d.fromVertex.layer!==t)for(g=d.fromVertex.index,p=d.portToPos,m=d.portFromPos,w=0;w<M.length;w++)b=M[w],b.valid&&b.fromVertex.layer!==t&&(v=b.fromVertex.index,k=b.portToPos,S=b.portFromPos,(g<v||g===v&&m<S)&&T++,(v<g||v===g&&S<m)&&F++)}if(e<=0){for(y=i[o].Wo,M=i[l].Wo,u=0;u<y.length;u++)if(d=y[u],d.valid&&d.toVertex.layer!==t)for(g=d.toVertex.index,p=d.portToPos,m=d.portFromPos,w=0;w<M.length;w++)b=M[w],b.valid&&b.toVertex.layer!==t&&(v=b.toVertex.index,k=b.portToPos,S=b.portFromPos,(g<v||g===v&&p<k)&&T++,(v<g||v===g&&k<p)&&F++)}n[o*s+l]=F,n[l*s+o]=T}}return this.Ih(t,i),n}countCrossings(){let t=0;for(let e=0;e<=this.kt;e++){let i=this.wD(e,1),s=this.ci[e];for(let n=0;n<s;n++)for(let o=n;o<s;o++)t+=i[n*s+o]}return t}gI(t,e,i){let s=this.Oh(t),n=this.ci[t],o=0;for(let r=0;r<n;r++){let a=null;e<=0&&(a=s[r].fo);let h=null;e>=0&&(h=s[r].Wo);let l,c=0,u=0;if(a!==null)for(let d=0;d<a.length;d++)l=a[d],l.valid&&l.fromVertex.layer!==t&&(c=l.fromVertex.column+l.portFromColOffset,u=l.toVertex.column+l.portToColOffset,i?o+=Math.abs(c-u)*this.linkStraightenWeight(l):o+=Math.abs(c-u));if(h!==null)for(let d=0;d<h.length;d++)l=h[d],l.valid&&l.toVertex.layer!==t&&(c=l.fromVertex.column+l.portFromColOffset,u=l.toVertex.column+l.portToColOffset,i?o+=(Math.abs(c-u)+1)*this.linkStraightenWeight(l):o+=Math.abs(c-u))}return this.Ih(t,s),o}nk(t){let e=0;for(let i=0;i<=this.kt;i++)e+=this.gI(i,1,t);return e}Gy(){let t=1/0;this.zt=-1;let e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;t=Math.min(t,i.column-this.nodeMinColumnSpace(i,!0)),this.zt=Math.max(this.zt,i.column+this.nodeMinColumnSpace(i,!1))}for(e.reset();e.next();){let i=e.value;i.column-=t}this.zt-=t}Yy(t,e){let i=this.Oh(t),s=this.ci[t],n=[];for(let o=0;o<s;o++){let r=i[o],a=null;e<=0&&(a=r.fo);let h=null;e>=0&&(h=r.Wo);let l=0,c=0,u=r.near;u!==null&&u.layer===r.layer&&(l+=u.column-1,c++);let d;if(a!==null)for(let g=0;g<a.length;g++){d=a[g];let p=d.fromVertex;d.valid&&!d.rev&&p.layer!==t&&(l+=p.column,c++)}if(h!==null)for(let g=0;g<h.length;g++){d=h[g];let p=d.toVertex;d.valid&&!d.rev&&p.layer!==t&&(l+=p.column,c++)}c===0?n[o]=-1:n[o]=l/c}return this.Ih(t,i),n}xD(t,e){let i=this.Oh(t),s=this.ci[t],n=[];for(let o=0;o<s;o++){let r=i[o],a=null;e<=0&&(a=r.fo);let h=null;e>=0&&(h=r.Wo);let l=0,c=[],u=r.near;u!==null&&u.layer===r.layer&&(c[l]=u.column-1,l++);let d;if(a!==null)for(let g=0;g<a.length;g++){d=a[g];let p=d.fromVertex;d.valid&&!d.rev&&p.layer!==t&&(c[l]=p.column+d.portFromColOffset,l++)}if(h!==null)for(let g=0;g<h.length;g++){d=h[g];let p=d.toVertex;d.valid&&!d.rev&&p.layer!==t&&(c[l]=p.column+d.portToColOffset,l++)}if(l===0)n[o]=-1;else{c.sort((p,m)=>p-m);let g=l>>1;l&1?n[o]=c[g]:n[o]=c[g-1]+c[g]>>1}}return this.Ih(t,i),n}Ky(t,e,i,s,n){if(t.component===i){t.component=e;let o=0,r=0;if(s){let a=t.destinationEdges;for(;a.next();){let h=a.value,l=h.toVertex;o=t.layer-l.layer,r=this.linkMinLength(h),o===r&&this.Ky(l,e,i,s,n)}}if(n){let a=t.sourceEdges;for(;a.next();){let h=a.value,l=h.fromVertex;o=l.layer-t.layer,r=this.linkMinLength(h),o===r&&this.Ky(l,e,i,s,n)}}}}_N(t,e,i,s,n){if(t.component===i){if(t.component=e,s){let o=t.destinationEdges;for(;o.next();){let r=o.value.toVertex;this._N(r,e,i,s,n)}}if(n){let o=t.sourceEdges;for(;o.next();){let r=o.value.fromVertex;this._N(r,e,i,s,n)}}}}removeCycles(){let t=this.network.edges.iterator;for(;t.next();){let e=t.value;e.rev=!1}switch(this.jf){default:case 1:this.mI();break;case 0:this.pI();break;case 2:this.yI();break}}yI(){let t=this.network,e=t.vertexes.iterator,i=1/0;for(;e.next();){let s=e.value;i=Math.min(i,s.layer)}if(i<1/0){if(i<0)for(e.reset();e.next();){let r=e.value;r.layer-=i}let s=[];for(e.reset();e.next();){let r=e.value,a=s[r.layer];a===void 0?s[r.layer]=[r]:a.push(r)}let n=0;for(let r=0;r<s.length;r++){let a=s[r];if(!a||a.length===0)n++;else if(r>0)for(let h=0;h<a.length;h++){let l=a[h];l.layer-=n}}let o=t.edges.iterator;for(;o.next();){let r=o.value,a=r.fromVertex,h=r.toVertex;a.layer<h.layer&&(t.reverseEdge(r),r.rev=!0)}}}mI(){let t=this.network,e=0,i=t.vertexes.count-1,s=[];s.length=i+1;let n=t.vertexes.iterator;for(;n.next();){let r=n.value;r.$i=!0}for(;this.wI(t)!==null;){let r;for(r=this.bD(t);r!==null;)s[i]=r,i--,r.$i=!1,r=this.bD(t);for(r=this.kD(t);r!==null;)s[e]=r,e++,r.$i=!1,r=this.kD(t);r=this.xI(t),r!==null&&(s[e]=r,e++,r.$i=!1)}for(let r=0;r<t.vertexes.count;r++)s[r].index=r;let o=t.edges.iterator;for(;o.next();){let r=o.value,a=r.fromVertex,h=r.toVertex;a.index>h.index&&(t.reverseEdge(r),r.rev=!0)}}wI(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.$i)return i}return null}bD(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.$i){let s=!0,n=i.destinationEdges;for(;n.next();)if(n.value.toVertex.$i){s=!1;break}if(s)return i}}return null}kD(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.$i){let s=!0,n=i.sourceEdges;for(;n.next();)if(n.value.fromVertex.$i){s=!1;break}if(s)return i}}return null}xI(t){let e=null,i=0,s=this.network.vertexes.iterator;for(;s.next();){let n=s.value;if(n.$i){let o=0,r=n.destinationEdges;for(;r.next();)r.value.toVertex.$i&&o++;let a=0,h=n.sourceEdges;for(;h.next();)h.value.fromVertex.$i&&a++;(e===null||i<o-a)&&(e=n,i=o-a)}}return e}pI(){let t=this.network.vertexes.iterator;for(;t.next();){let i=t.value;i.Zf=-1,i.Xn=-1}let e=this.network.edges.iterator;for(;e.next();){let i=e.value;i.forest=!1}for(this.Pg=0,t.reset();t.next();){let i=t.value;i.sourceEdges.count===0&&this.tC(i)}for(t.reset();t.next();){let i=t.value;i.Zf===-1&&this.tC(i)}for(e.reset();e.next();){let i=e.value;if(!i.forest){let s=i.fromVertex,n=s.Zf,o=s.Xn,r=i.toVertex,a=r.Zf,h=r.Xn;a<n&&o<h&&(this.network.reverseEdge(i),i.rev=!0)}}}tC(t){t.Zf=this.Pg,this.Pg++;let e=t.destinationEdges;for(;e.next();){let i=e.value,s=i.toVertex;s.Zf===-1&&(i.forest=!0,this.tC(s))}t.Xn=this.Pg,this.Pg++}cI(){let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value;e.layer=-1}for(this.kt=-1,this.assignLayers(),t.reset();t.next();){let e=t.value;this.kt=Math.max(this.kt,e.layer)}}assignLayers(){switch(this.Hf){case 11:this.PD();break;case 12:this.bI();break;default:case 10:this.kI();break}}PD(){let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value,i=this.SD(e);this.kt=Math.max(i,this.kt)}}SD(t){let e=0;if(t.layer===-1){let i=t.destinationEdges;for(;i.next();){let s=i.value,n=s.toVertex,o=this.linkMinLength(s);e=Math.max(e,this.SD(n)+o)}t.layer=e}else e=t.layer;return e}bI(){let t=0,e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;t=this.MD(i),this.kt=Math.max(t,this.kt)}for(e.reset();e.next();){let i=e.value;i.layer=this.kt-i.layer}}MD(t){let e=0;if(t.layer===-1){let i=t.sourceEdges;for(;i.next();){let s=i.value,n=s.fromVertex,o=this.linkMinLength(s);e=Math.max(e,this.MD(n)+o)}t.layer=e}else e=t.layer;return e}kI(){this.PD();let t=this.network.vertexes.iterator;for(;t.next();){let i=t.value;i.$i=!1}for(t.reset();t.next();){let i=t.value;i.sourceEdges.count===0&&this.ND(i)}let e=1/0;for(t.reset();t.next();){let i=t.value;e=Math.min(e,i.layer)}for(this.kt=-1,t.reset();t.next();){let i=t.value;i.layer-=e,this.kt=Math.max(this.kt,i.layer)}}ND(t){if(!t.$i){t.$i=!0;let e=t.destinationEdges;for(;e.next();){let i=e.value.toVertex;this.ND(i)}this.SI(t),this.MI(t)}}SI(t){let e=this.network.vertexes.iterator;for(;e.next();){let r=e.value;r.component=-1}let i=0,s=1,n=t.fo,o=n.length;for(let r=0;r<o;r++){let a=n[r],h=a.fromVertex,l=a.toVertex,c=this.linkMinLength(a);h.layer-l.layer>c&&this.Ky(h,i,-1,!0,!1)}for(this.Ky(t,s,-1,!0,!0);t.component!==i;){let r=0,a=1/0,h=0,l=null,c=this.network.vertexes.iterator;for(;c.next();){let u=c.value;if(u.component===s){let d=0,g=!1,p=u.fo;o=p.length;for(let y=0;y<o;y++){let w=p[y],b=w.fromVertex;if(d+=this.linkLengthWeight(w),b.component!==s){r+=this.linkLengthWeight(w);let v=b.layer-u.layer,k=this.linkMinLength(w);a=Math.min(a,v-k)}}let m=u.Wo;o=m.length;for(let y=0;y<o;y++){let w=m[y],b=w.toVertex;d-=this.linkLengthWeight(w),b.component!==s?r-=this.linkLengthWeight(w):g=!0}(l===null||d<h)&&!g&&(l=u,h=d)}}if(r>0){for(e.reset();e.next();){let u=e.value;u.component===s&&(u.layer+=a)}t.component=i}else l.component=i}}MI(t){let e=this.network.vertexes.iterator;for(;e.next();){let n=e.value;n.component=-1}let i=0,s=1;for(this.Ky(t,s,-1,!0,!1);t.component!==i;){let n=0,o=1/0,r=0,a=null,h=this.network.vertexes.iterator;for(;h.next();){let l=h.value;if(l.component===s){let c=0,u=!1,d=l.fo,g=d.length;for(let m=0;m<g;m++){let y=d[m],w=y.fromVertex;c+=this.linkLengthWeight(y),w.component!==s?n+=this.linkLengthWeight(y):u=!0}let p=l.Wo;g=p.length;for(let m=0;m<g;m++){let y=p[m],w=y.toVertex;if(c-=this.linkLengthWeight(y),w.component!==s){n-=this.linkLengthWeight(y);let b=l.layer-w.layer,v=this.linkMinLength(y);o=Math.min(o,b-v)}}(a===null||c>r)&&!u&&(a=l,r=c)}}if(n<0){for(e.reset();e.next();){let l=e.value;l.component===s&&(l.layer-=o)}t.component=i}else a.component=i}}fI(){let t=this.network,e=[],i=t.edges.iterator;for(;i.next();){let s=i.value;s.valid=!1,e.push(s)}for(let s=0;s<e.length;s++){let n=e[s],o=n.fromVertex,r=n.toVertex;if(n.valid||(o.node===null&&o.data===null||r.node===null&&r.data===null)&&o.layer===r.layer)continue;let a=0,h=0,l=0,c=0;if(n.link!==null){let S=n.link;if(S===null)continue;let M=o.node,F=r.node;if(M===null||F===null)continue;let T=S.fromNode,N=S.toNode,C=S.fromPort;for(;C!==null&&!C.isVisibleObject();)C=C.panel;let R=S.toPort;for(;R!==null&&!R.isVisibleObject();)R=R.panel;if(n.rev){let nt=T,at=C;T=N,C=R,N=nt,R=at}let O=o.focus,B=r.focus,X=n.rev?r.bounds:o.bounds,Y=P.l();M!==T?X.isReal()&&T.isVisible()?T.actualBounds.isReal()?(T.getRelativePoint(C,D.Center,Y),Y.x+=T.actualBounds.x-X.x,Y.y+=T.actualBounds.y-X.y):(T.getRelativePoint(C,D.Center,Y),Y.isReal()||Y.a(O)):Y.a(O):X.isReal()?(T.getRelativePoint(C,D.Center,Y),Y.isReal()||Y.a(O)):Y.a(O);let j=n.rev?o.bounds:r.bounds,U=P.l();F!==N?j.isReal()&&N.isVisible()?N.actualBounds.isReal()?(N.getRelativePoint(R,D.Center,U),U.x+=N.actualBounds.x-j.x,U.y+=N.actualBounds.y-j.y):(N.getRelativePoint(R,D.Center,U),U.isReal()||U.a(B)):U.a(B):j.isReal()?(N.getRelativePoint(R,D.Center,U),U.isReal()||U.a(B)):U.a(B),this.b===90||this.b===270?(a=Math.round((Y.x-O.x)/this.Wi),l=Y.x,h=Math.round((U.x-B.x)/this.Wi),c=U.x):(a=Math.round((Y.y-O.y)/this.Wi),l=Y.y,h=Math.round((U.y-B.y)/this.Wi),c=U.y),P.e(Y),P.e(U),n.portFromColOffset=a,n.portFromPos=l,n.portToColOffset=h,n.portToPos=c}else n.portFromColOffset=0,n.portFromPos=0,n.portToColOffset=0,n.portToPos=0;let u=o.layer,d=r.layer,g=this.NI(n),p=g===1||g===3,m=g===2||g===3,y,w,b=null,v;m&&(b=this.CI(o,r),v=1,w=t.createVertex(),w.node=null,w.ok=1,w.layer=u,w.near=o,t.addVertex(w),y=t.linkVertexes(o,w,n.link),y.valid=!1,y.rev=n.rev,y.portFromColOffset=a,y.portToColOffset=0,y.portFromPos=l,y.portToPos=0,o=w);let k=1;if(p&&k--,u-d>k&&u>0){for(n.valid=!1,w=t.createVertex(),w.node=null,w.ok=2,w.layer=u-1,b&&v<b.length&&w.layer===b[v].layer&&(w.near=b[v++]),t.addVertex(w),y=t.linkVertexes(o,w,n.link),y.valid=!0,y.rev=n.rev,y.portFromColOffset=m?0:a,y.portToColOffset=0,y.portFromPos=m?0:l,y.portToPos=0,o=w,u--;u-d>k&&u>0;)w=t.createVertex(),w.node=null,w.ok=3,w.layer=u-1,b&&v<b.length&&w.layer===b[v].layer&&(w.near=b[v++]),t.addVertex(w),y=t.linkVertexes(o,w,n.link),y.valid=!0,y.rev=n.rev,y.portFromColOffset=0,y.portToColOffset=0,y.portFromPos=0,y.portToPos=0,o=w,u--;y=t.linkVertexes(w,r,n.link),y.valid=!p,p&&(w.near=r),y.rev=n.rev,y.portFromColOffset=0,y.portToColOffset=h,y.portFromPos=0,y.portToPos=c}else n.valid=!0}}NI(t){let e=0,i=t.link;if(i!==null){let s=i.fromPort,n=i.toPort;if(s!==null&&n!==null){let o=i.fromNode,r=i.toNode;if(o!==null&&r!==null){let a=this.rk(!0),h=this.rk(!1),l=this.setsPortSpots?a:i.computeSpot(!0,s),c=this.setsPortSpots?h:i.computeSpot(!1,n),u=i.isOrthogonal;if(l.isSide()&&l.includesSide(h)&&c.isSide()&&c.includesSide(a))return 0;let d=i.getLinkPoint(o,s,l,!0,u,r,n,P.l()),g=i.getLinkDirection(o,s,d,l,!0,u,r,n);P.e(d),(!l.isNone()&&g===this.CD(t,!0)||this.setsPortSpots&&o!==null&&o.ports.count===1&&t.rev)&&(e+=1);let p=i.getLinkPoint(r,n,c,!1,u,o,s,P.l()),m=i.getLinkDirection(r,n,p,c,!1,u,o,s);P.e(p),(!c.isNone()&&m===this.CD(t,!1)||this.setsPortSpots&&r!==null&&r.ports.count===1&&t.rev)&&(e+=2)}}}return e}CD(t,e){return this.b===90?e&&!t.rev||!e&&t.rev?270:90:this.b===180?e&&!t.rev||!e&&t.rev?0:180:this.b===270?e&&!t.rev||!e&&t.rev?90:270:e&&!t.rev||!e&&t.rev?180:0}CI(t,e){let i=[];return i.push(e),this.LD(t,i)?i.reverse():[]}LD(t,e){let i=e[e.length-1].sourceEdges.iterator;for(;i.next();){let s=i.value;if(s.rev||!s.valid)continue;let n=s.fromVertex;if(e.push(n),n===t||this.LD(t,e))return!0;e.pop()}return!1}uI(){let t=this.ci=[];for(let i=0;i<=this.kt;i++)t[i]=0;let e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;i.index=-1}this.initializeIndices(),this.Xy=-1,this.kg=0,this.Cs=0;for(let i=0;i<=this.kt;i++)t[i]>t[this.Cs]&&(this.Xy=t[i]-1,this.Cs=i),t[i]<t[this.kg]&&(this.kg=i);this.$f=[];for(let i=0;i<t.length;i++)this.$f[i]=[];for(e.reset();e.next();){let i=e.value,s=i.layer,n=this.$f[s];n[i.index]=i}}initializeIndices(){switch(this.qf){default:case 22:this.LI();break;case 20:this.AI();break;case 21:this.TI();break}}LI(){let t=null,e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;if(i.near&&(t===null&&(t=new Map),i.layer===i.near.layer)){let s=t.get(i.near)||[];s.push(i),t.set(i.near,s)}}for(e.reset();e.next();){let i=e.value;if(i.near)continue;let s=i.layer;if(i.index=this.ci[s],this.ci[s]++,!t)continue;let n=t.get(i);Array.isArray(n)&&n.forEach(o=>{o.index=this.ci[s],this.ci[s]++})}}AI(){let t=null,e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;if(i.near&&(t===null&&(t=new Map),i.layer===i.near.layer)){let s=t.get(i.near)||[];s.push(i),t.set(i.near,s)}}for(let i=this.kt;i>=0;i--)for(e.reset();e.next();){let s=e.value;s.layer===i&&s.index===-1&&this.AD(s,t)}}AD(t,e){if(t.near)return;let i=t.layer;if(t.index=this.ci[i],this.ci[i]++,e){let o=e.get(t);Array.isArray(o)&&o.forEach(r=>{r.index=this.ci[i],this.ci[i]++})}let s=t.Wo,n=!0;for(;n;){n=!1;for(let o=0;o<s.length-1;o++){let r=s[o],a=s[o+1];r.portFromColOffset>a.portFromColOffset&&(n=!0,s[o]=a,s[o+1]=r)}}for(let o=0;o<s.length;o++){let r=s[o];if(r.valid){let a=r.toVertex;a.index===-1&&this.AD(a,e)}}}TI(){let t=null,e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;if(i.near&&(t===null&&(t=new Map),i.layer===i.near.layer)){let s=t.get(i.near)||[];s.push(i),t.set(i.near,s)}}for(let i=0;i<=this.kt;i++)for(e.reset();e.next();){let s=e.value;s.layer===i&&s.index===-1&&this.TD(s,t)}}TD(t,e){if(t.near)return;let i=t.layer;if(t.index=this.ci[i],this.ci[i]++,e){let h=e.get(t);Array.isArray(h)&&h.forEach(l=>{l.index=this.ci[i],this.ci[i]++})}let s=t.fo,n=!0,o=0;for(;n;)for(n=!1,o=0;o<s.length-1;o++){let h=s[o],l=s[o+1];h.portToColOffset>l.portToColOffset&&(n=!0,s[o]=l,s[o+1]=h)}let r,a;for(o=0;o<s.length;o++)a=s[o],a.valid&&(r=a.fromVertex,r.index===-1&&this.TD(r,e))}dI(){this.zt=-1;for(let t=0;t<=this.kt;t++){let e=this.Oh(t),i=0,s=this.ci[t];for(let n=0;n<s;n++){let o=e[n];i+=this.nodeMinColumnSpace(o,!0),o.column=i,i+=1,i+=this.nodeMinColumnSpace(o,!1)}this.zt=Math.max(this.zt,i-1),this.Ih(t,e)}}reduceCrossings(){let t=this.countCrossings(),e=this.Ji(),i=0,s=0,n=0;for(i=0;i<this.Qa;i++){for(s=0;s<=this.kt;s++)this.lk(s,1),this.rs(s,1,!1,1);for(n=this.countCrossings(),n<t&&(t=n,e=this.Ji()),s=this.kt;s>=0;s--)this.lk(s,-1),this.rs(s,-1,!1,-1);n=this.countCrossings(),n<t&&(t=n,e=this.Ji())}for(this.We(e),i=0;i<this.Qa;i++){for(s=0;s<=this.kt;s++)this.lk(s,0),this.rs(s,0,!1,0);for(n=this.countCrossings(),n<t&&(t=n,e=this.Ji()),s=this.kt;s>=0;s--)this.lk(s,0),this.rs(s,0,!1,0);n=this.countCrossings(),n<t&&(t=n,e=this.Ji())}this.We(e);let o=!1,r=0,a=0,h=0,l=0;switch(this.Wf){case 30:break;case 32:for(h=t+1;(l=this.countCrossings())<h;)for(h=l,r=this.kt;r>=0;r--)for(a=0;a<=r;a++){for(o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.rs(s,-1,!1,-1)||o;for(n=this.countCrossings(),n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.rs(s,1,!1,1)||o;for(n=this.countCrossings(),n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.rs(s,1,!1,1)||o;for(n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.rs(s,-1,!1,-1)||o;for(n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.rs(s,0,!1,0)||o;for(n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.rs(s,0,!1,0)||o;n>=t?this.We(e):(t=n,e=this.Ji())}break;default:case 31:for(r=this.kt,a=0,h=t+1;(l=this.countCrossings())<h;){for(h=l,o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.rs(s,-1,!1,-1)||o;for(n=this.countCrossings(),n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.rs(s,1,!1,1)||o;for(n=this.countCrossings(),n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.rs(s,1,!1,1)||o;for(n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.rs(s,-1,!1,-1)||o;for(n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.rs(s,0,!1,0)||o;for(n>=t?this.We(e):(t=n,e=this.Ji()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.rs(s,0,!1,0)||o;n>=t?this.We(e):(t=n,e=this.Ji())}break}this.We(e)}lk(t,e){let i=0,s=!1,n=this.Oh(t),o=this.ci[t],r=this.xD(t,e),a=this.Yy(t,e);for(i=0;i<o;i++)a[i]===-1&&(a[i]=n[i].column),r[i]===-1&&(r[i]=n[i].column);let h=!0,l;for(;h;)for(h=!1,i=0;i<o-1;i++)if(r[i+1]<r[i]||r[i+1]===r[i]&&a[i+1]<a[i]){s=!0,h=!0;let u=r[i];r[i]=r[i+1],r[i+1]=u;let d=a[i];a[i]=a[i+1],a[i+1]=d,l=n[i],n[i]=n[i+1],n[i+1]=l}let c=0;for(i=0;i<o;i++)l=n[i],l.index=i,c+=this.nodeMinColumnSpace(l,!0),l.column=c,c+=1,c+=this.nodeMinColumnSpace(l,!1);return this.Ih(t,n),s}rs(t,e,i,s){let n=this.Oh(t),o=this.ci[t],r=this.wD(t,e),a=0,h;if(!i||s>0)for(h=[],a=0;a<o;a++)h[a]=-1;else h=this.Yy(t,-1);let l;if(!i||s<0)for(l=[],a=0;a<o;a++)l[a]=-1;else l=this.Yy(t,1);let c=!1,u=!0;for(;u;)for(u=!1,a=0;a<o-1;a++){let d=r[n[a].index*o+n[a+1].index],g=r[n[a+1].index*o+n[a].index],p=0,m=0,y=n[a].column,w=n[a+1].column,b=this.nodeMinColumnSpace(n[a],!0),v=this.nodeMinColumnSpace(n[a],!1),k=this.nodeMinColumnSpace(n[a+1],!0),S=this.nodeMinColumnSpace(n[a+1],!1),M=y-b+k,F=w-v+S,T=0,N=0,C=0,R=0,O=0,B=0,X=0,Y,j=0,U,nt=0,at=n[a].sourceEdges.iterator;if(i&&s<=0)for(;at.next();){let bt=at.value;Y=bt.fromVertex,bt.valid&&Y.layer!==t&&(C=this.linkStraightenWeight(bt),R=bt.portFromColOffset,O=bt.portToColOffset,B=Y.column,T+=(Math.abs(y+O-(B+R))+1)*C,N+=(Math.abs(F+O-(B+R))+1)*C)}for(at.reset();at.next();){let bt=at.value;if(Y=bt.fromVertex,bt.valid&&Y.layer===t){for(j=0;j<n.length&&n[j]!==Y;)j++;j<a&&(p+=2*(a-j),m+=2*(a+1-j)),j===a+1&&(p+=1),j>a+1&&(p+=4*(j-a),m+=4*(j-(a+1)))}}let tt=n[a].destinationEdges.iterator;if(i&&s>=0)for(;tt.next();){let bt=tt.value;U=bt.toVertex,bt.valid&&U.layer!==t&&(C=this.linkStraightenWeight(bt),R=bt.portFromColOffset,O=bt.portToColOffset,X=U.column,T+=(Math.abs(y+R-(X+O))+1)*C,N+=(Math.abs(F+R-(X+O))+1)*C)}for(tt.reset();tt.next();){let bt=tt.value;if(U=bt.toVertex,bt.valid&&U.layer===t){for(nt=0;nt<n.length&&n[nt]!==U;)nt++;nt===a+1&&(m+=1)}}let st=n[a+1].sourceEdges.iterator;if(i&&s<=0)for(;st.next();){let bt=st.value;Y=bt.fromVertex,bt.valid&&Y.layer!==t&&(C=this.linkStraightenWeight(bt),R=bt.portFromColOffset,O=bt.portToColOffset,B=Y.column,T+=(Math.abs(w+O-(B+R))+1)*C,N+=(Math.abs(M+O-(B+R))+1)*C)}for(st.reset();st.next();){let bt=st.value;if(Y=bt.fromVertex,bt.valid&&Y.layer===t){for(j=0;j<n.length&&n[j]!==Y;)j++;j<a&&(p+=2*(a+1-j),m+=2*(a-j)),j===a&&(m+=1),j>a+1&&(p+=4*(j-(a+1)),m+=4*(j-a))}}let et=n[a+1].destinationEdges.iterator;if(i&&s>=0)for(;et.next();){let bt=et.value;U=bt.toVertex,bt.valid&&U.layer!==t&&(C=this.linkStraightenWeight(bt),R=bt.portFromColOffset,O=bt.portToColOffset,X=U.column,T+=(Math.abs(w+R-(X+O))+1)*C,N+=(Math.abs(M+R-(X+O))+1)*C)}for(et.reset();et.next();){let bt=et.value;if(U=bt.toVertex,bt.valid&&U.layer===t){for(nt=0;nt<n.length&&n[nt]!==U;)nt++;nt===a&&(p+=1)}}let ut=0,gt=0,wt=h[n[a].index],Ct=l[n[a].index],ot=h[n[a+1].index],Mt=l[n[a+1].index];if(wt!==-1&&(ut+=Math.abs(wt-y),gt+=Math.abs(wt-F)),Ct!==-1&&(ut+=Math.abs(Ct-y),gt+=Math.abs(Ct-F)),ot!==-1&&(ut+=Math.abs(ot-w),gt+=Math.abs(ot-M)),Mt!==-1&&(ut+=Math.abs(Mt-w),gt+=Math.abs(Mt-M)),m<p-.5||m===p&&g<d-.5||m===p&&g===d&&N<T-.5||m===p&&g===d&&N===T&&gt<ut-.5){c=!0,u=!0,n[a].column=F,n[a+1].column=M;let bt=n[a];n[a]=n[a+1],n[a+1]=bt}}for(a=0;a<o;a++)n[a].index=a;return this.Ih(t,n),c}straightenAndPack(){if(this.Ln!==0){this.DI();return}let t=0,e=!1,i=(this.Qo&1)!==0,s=(this.Qo&8)!==0;if(this.network.edges.count>1e3&&s&&(i=!1),i){let n=[],o=0;for(o=0;o<=this.kt;o++)n[o]=0;let r=0,a=this.network.vertexes.iterator;for(;a.next();){let l=a.value;t=l.layer,r=l.column;let c=this.nodeMinColumnSpace(l,!1);n[t]=Math.max(n[t],r+c)}let h=8;for(a.reset();a.next();){let l=a.value;t=l.layer,r=l.column,l.column=((this.zt-n[t])*h>>1)+r*h}this.zt*=h}if(this.Qo&2){e=!0;let n=0;for(;e&&n<this.Jf;){for(e=!1,t=this.Cs+1;t<=this.kt;t++)e=this.Mg(t,1)||e;for(t=this.Cs-1;t>=0;t--)e=this.Mg(t,-1)||e;e=this.Mg(this.Cs,0)||e,n++}}if(this.Qo&4){for(t=this.Cs+1;t<=this.kt;t++)this.iC(t,1);for(t=this.Cs-1;t>=0;t--)this.iC(t,-1);this.iC(this.Cs,0)}if(i&&(this.DD(-1),this.DD(1)),this.Qo&2){e=!0;let n=0;for(;e&&n<this.Jf;){for(e=!1,e=this.Mg(this.Cs,0)||e,t=this.Cs+1;t<=this.kt;t++)e=this.Mg(t,0)||e;for(t=this.Cs-1;t>=0;t--)e=this.Mg(t,0)||e;n++}}}Mg(t,e){let i=!1;for(;this.FI(t,e);)i=!0;return i}FI(t,e){let i=0,s=this.Oh(t),n=this.ci[t],o=this.Yy(t,-1);if(e>0)for(i=0;i<n;i++)o[i]=-1;let r=this.Yy(t,1);if(e<0)for(i=0;i<n;i++)r[i]=-1;let a=!1,h=!0;for(;h;)for(h=!1,i=0;i<n;i++){let l=s[i].column,c=this.nodeMinColumnSpace(s[i],!0),u=this.nodeMinColumnSpace(s[i],!1),d=0;i-1<0||l-s[i-1].column-1>c+this.nodeMinColumnSpace(s[i-1],!1)?d=l-1:d=l;let g=0;i+1>=n||s[i+1].column-l-1>u+this.nodeMinColumnSpace(s[i+1],!0)?g=l+1:g=l;let p=0,m=0,y=0,w=0,b=0,v=0;if(e<=0){let N=s[i].sourceEdges.iterator;for(;N.next();){let C=N.value,R=C.fromVertex;if(C.valid&&R.layer!==t){w=this.linkStraightenWeight(C),b=C.portFromColOffset,v=C.portToColOffset;let O=R.column;p+=(Math.abs(l+v-(O+b))+1)*w,m+=(Math.abs(d+v-(O+b))+1)*w,y+=(Math.abs(g+v-(O+b))+1)*w}}}if(e>=0){let N=s[i].destinationEdges.iterator;for(;N.next();){let C=N.value,R=C.toVertex;if(C.valid&&R.layer!==t){w=this.linkStraightenWeight(C),b=C.portFromColOffset,v=C.portToColOffset;let O=R.column;p+=(Math.abs(l+b-(O+v))+1)*w,m+=(Math.abs(d+b-(O+v))+1)*w,y+=(Math.abs(g+b-(O+v))+1)*w}}}let k=0,S=0,M=0,F=o[s[i].index],T=r[s[i].index];F!==-1&&(k+=Math.abs(F-l),S+=Math.abs(F-d),M+=Math.abs(F-g)),T!==-1&&(k+=Math.abs(T-l),S+=Math.abs(T-d),M+=Math.abs(T-g)),m<p||m===p&&S<k?(a=!0,h=!0,s[i].column=d):(y<p||y===p&&M<k)&&(a=!0,h=!0,s[i].column=g)}return this.Ih(t,s),this.Gy(),a}iC(t,e){let i=0,s=this.Oh(t),n=this.ci[t],o=this.xD(t,e),r=[];for(i=0;i<n;i++)r[i]=o[i];let a=!1,h=!0;for(;h;)for(h=!1,i=0;i<n;i++){let l=s[i].column,c=this.nodeMinColumnSpace(s[i],!0),u=this.nodeMinColumnSpace(s[i],!1),d=0,g=0,p=0,m=0,y=0;r[i]===-1?i===0&&i===n-1?d=l:i===0?(g=s[i+1].column,g-l===u+this.nodeMinColumnSpace(s[i+1],!0)?d=l-1:d=l):i===n-1?(p=s[i-1].column,l-p===c+this.nodeMinColumnSpace(s[i-1],!1)?d=l+1:d=l):(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+c+1,g=s[i+1].column,m=g-this.nodeMinColumnSpace(s[i+1],!0)-u-1,d=(y+m)/2|0):i===0&&i===n-1?d=r[i]:i===0?(g=s[i+1].column,m=g-this.nodeMinColumnSpace(s[i+1],!0)-u-1,d=Math.min(r[i],m)):i===n-1?(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+c+1,d=Math.max(r[i],y)):(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+c+1,g=s[i+1].column,m=g-this.nodeMinColumnSpace(s[i+1],!0)-u-1,y<r[i]&&r[i]<m?d=r[i]:y>=r[i]?d=y:m<=r[i]&&(d=m)),d!==l&&(a=!0,h=!0,s[i].column=d)}return this.Ih(t,s),this.Gy(),a}RI(){for(let t=0;t<=this.zt;t++)for(;this.vI(t,1););this.Gy()}vI(t,e){let i=!0,s=this.network.vertexes.iterator;for(;s.next();){let o=s.value,r=this.nodeMinColumnSpace(o,!0),a=this.nodeMinColumnSpace(o,!1);if(o.column-r<=t&&o.column+a>=t){i=!1;break}}let n=!1;if(i){if(e>0)for(s.reset();s.next();){let o=s.value;o.column>t&&(o.column-=1,n=!0)}if(e<0)for(s.reset();s.next();){let o=s.value;o.column<t&&(o.column+=1,n=!0)}}return n}OI(){this.RI();for(let t=0;t<this.zt;t++)for(;this.II(t,1););this.Gy()}II(t,e){let i=t;e>0&&(i=t+1),e<0&&(i=t-1);let s=0,n=[],o=[];for(s=0;s<=this.kt;s++)n[s]=!1,o[s]=!1;let r=this.network.vertexes.iterator;for(;r.next();){let l=r.value,c=l.column-this.nodeMinColumnSpace(l,!0),u=l.column+this.nodeMinColumnSpace(l,!1);c<=t&&u>=t&&(n[l.layer]=!0),c<=i&&u>=i&&(o[l.layer]=!0)}let a=!0,h=!1;for(s=0;s<=this.kt;s++)a=a&&!(n[s]&&o[s]);if(a){if(e>0)for(r.reset();r.next();){let l=r.value;l.column>t&&(l.column-=1,h=!0)}if(e<0)for(r.reset();r.next();){let l=r.value;l.column<t&&(l.column+=1,h=!0)}}return h}DD(t){this.OI();let e=0,i,s=0,n=0,o=0;if(t>0)for(e=0;e<=this.zt;e++)for(i=this.Ji(),s=this.nk(!0),n=s+1;s<n;)n=s,this.FD(e,1),o=this.nk(!0),o>s?this.We(i):o<s&&(s=o,i=this.Ji());if(t<0)for(e=this.zt;e>=0;e--)for(i=this.Ji(),s=this.nk(!0),n=s+1;s<n;)n=s,this.FD(e,-1),o=this.nk(!0),o>s?this.We(i):o<s&&(s=o,i=this.Ji());this.Gy()}FD(t,e){this.Qs=0;let i=this.network.vertexes.iterator;for(;i.next();){let c=i.value;c.component=-1}if(e>0)for(i.reset();i.next();){let c=i.value;c.column-this.nodeMinColumnSpace(c,!0)<=t&&(c.component=this.Qs)}if(e<0)for(i.reset();i.next();){let c=i.value;c.column+this.nodeMinColumnSpace(c,!1)>=t&&(c.component=this.Qs)}for(this.Qs++,i.reset();i.next();){let c=i.value;c.component===-1&&(this._N(c,this.Qs,-1,!0,!0),this.Qs++)}let s=0,n=[];for(s=0;s<this.Qs*this.Qs;s++)n[s]=!1;let o=[];for(s=0;s<(this.kt+1)*(this.zt+1);s++)o[s]=-1;for(i.reset();i.next();){let c=i.value,u=c.layer,d=Math.max(0,c.column-this.nodeMinColumnSpace(c,!0)),g=Math.min(this.zt,c.column+this.nodeMinColumnSpace(c,!1));for(let p=d;p<=g;p++)o[u*(this.zt+1)+p]=c.component}for(let c=0;c<=this.kt;c++){if(e>0)for(let u=0;u<this.zt;u++)o[c*(this.zt+1)+u]!==-1&&o[c*(this.zt+1)+u+1]!==-1&&o[c*(this.zt+1)+u]!==o[c*(this.zt+1)+u+1]&&(n[o[c*(this.zt+1)+u]*this.Qs+o[c*(this.zt+1)+u+1]]=!0);if(e<0)for(let u=this.zt;u>0;u--)o[c*(this.zt+1)+u]!==-1&&o[c*(this.zt+1)+u-1]!==-1&&o[c*(this.zt+1)+u]!==o[c*(this.zt+1)+u-1]&&(n[o[c*(this.zt+1)+u]*this.Qs+o[c*(this.zt+1)+u-1]]=!0)}let r=[];for(s=0;s<this.Qs;s++)r[s]=!0;let a=[];a.push(0);let h=0;for(;a.length!==0;)if(h=a[a.length-1],a.pop(),r[h])for(r[h]=!1,s=0;s<this.Qs;s++)n[h*this.Qs+s]&&a.splice(0,0,s);let l=!1;if(e>0)for(i.reset();i.next();){let c=i.value;r[c.component]&&(c.column-=1,l=!0)}if(e<0)for(i.reset();i.next();){let c=i.value;r[c.component]&&(c.column+=1,l=!0)}return l}DI(){let t=f.et(),e=this.$f.length;for(let d=0;d<=e;d++)t[d]=[];let i=this.network.vertexes.iterator;for(;i.next();){let d=i.value,g=e-d.layer,p=t[g];p[d.index]=d}let s=new I;this.EI(t,s);let n=null,o=null,r=null,a=null,h=(this.Ln&1)!==0,l=(this.Ln&2)!==0,c=(this.Ln&4)!==0,u=(this.Ln&8)!==0;h&&(this.tl(t,s,!0),n=this.hk(t,!0,!1)),t.reverse(),c&&(this.tl(t,s,!1),r=this.hk(t,!1,!1));for(let d of t)d.reverse();u&&(this.tl(t,s,!1),a=this.hk(t,!1,!0)),t.reverse(),l&&(this.tl(t,s,!0),o=this.hk(t,!0,!0)),f.J(t),this.UI(n,o,r,a),this.network.vertexes.each(d=>{let g=d,p=f.et();h&&p.push(n.get(g)),l&&p.push(o.get(g)),c&&p.push(r.get(g)),u&&p.push(a.get(g)),p.sort((v,k)=>v-k);let m=p.length,y=Math.floor((m-1)/2),w=Math.ceil((m-1)/2),b=(p[y]+p[w])/2;f.J(p),g.he=b})}EI(t,e){let i=t.length;for(let s=1;s<i-1;s++){let n=0,o=0,r=t[s],a=t[s+1];for(let h=0;o<a.length;h++){let l=a[h],c=this.BI(l);if(h===a.length-1||c){let u=r.length-1;for(c&&(u=l.getProperSourceVertexes()[0].index);o<=h;){let d=a[o].getProperSourceEdges();for(let g of d){let p=g.fromVertex.index;(p<n||p>u)&&e.add(g)}o++}n=u}}}}BI(t){if(t.node===null){let e=t.getProperSourceVertexes();if(e.length>0)return e[0].node===null}return!1}tl(t,e,i){this.VI(t);for(let s of t){let n=-1;for(let o of s){let r=i?o.getProperSourceVertexes():o.getProperDestinationVertexes(),a=r.length;if(a>0){r.sort((l,c)=>l.Eh-c.Eh);let h=(a-1)/2;for(let l=Math.floor(h),c=Math.ceil(h);l<=c;l++)if(o.An===o){let u=r[l],d;i?d=u.getDestinationEdge(o):d=o.getDestinationEdge(u),!e.has(d)&&n<u.Eh&&(u.An=o,o.tc=u.tc,o.An=u.tc,n=u.Eh)}}}}}VI(t){for(let e=0;e<t.length;e++){let i=t[e];for(let s=0;s<i.length;s++){let n=i[s];n.tc=n,n.An=n,n.RD=e,n.Eh=s}}}hk(t,e,i){let s=this.b===90||this.b===270;for(let o of t)for(let r of o)r.Je=r,r.Qf=1/0,r.he=NaN,r.Tn=0;this.zI(t,e,i);for(let o of t)for(let r of o)r.tc===r&&this.vD(r,t);for(let o=0;o<t.length;o++){if(t[o].length<=0)continue;let r=t[o][0];if(r.Je===r){r.Je.Qf===1/0&&(r.Je.Qf=0);let a=o,h=0,l;do{for(l=t[a][h];l.An!==l.tc;)if(l=l.An,a++,l.Eh>0){let c=this.OD(l,t),u=s?c.width:c.height,d=l.Je.Qf+l.he+l.Tn-(c.he+c.Tn+u+this.columnSpacing);c.Je.Qf=Math.min(c.Je.Qf,d)}h=l.Eh+1}while(a<t.length&&h<t[a].length&&l.Je===t[a][h].Je)}}let n=new pt;for(let o of t)for(let r of o){r.he=r.he+r.Je.Qf+r.Tn;let a=s?r.width:r.height;n.set(r,i?-r.he-a:r.he)}return n}zI(t,e,i){let s=this.b===90||this.b===270;for(let n of t)for(let o of n)if(o.tc===o){let r=0,a=o;for(;a.An!==o;){let h=a.An,l=s?a.width:a.height,c=s?h.width:h.height,u,d,g,p;e?(g=a.getDestinationEdge(h),u=g.portFromPos,d=g.portToPos,g.link!==null&&(a.node&&a.node!==g.link.fromNode&&(u=s?a.focusX:a.focusY),h.node&&h.node!==g.link.toNode&&(d=s?h.focusX:h.focusY)),i?p=a.Tn+(l-u)-(c-d):p=a.Tn+u-d):(g=h.getDestinationEdge(a),u=g.portToPos,d=g.portFromPos,g.link!==null&&(a.node&&a.node!==g.link.toNode&&(u=s?a.focusX:a.focusY),h.node&&h.node!==g.link.fromNode&&(d=s?h.focusX:h.focusY)),i?p=a.Tn+(l-u)-(c-d):p=a.Tn+u-d),h.Tn=p,r=Math.min(r,p),a=a.An}a=o;do a.Tn=a.Tn-r,a=a.An;while(a!==o)}}vD(t,e){if(!isNaN(t.he))return;t.he=0;let i=t;do{if(i.Eh>0){let s=this.OD(i,e),n=s.tc;this.vD(n,e),t.Je===t&&(t.Je=n.Je);let o=this.b===90||this.b===270?s.width:s.height;if(t.Je===n.Je){let r=n.he+s.Tn+o-i.Tn+this.columnSpacing;t.he=Math.max(t.he,r)}}i=i.An}while(i!==t);for(;i.An!==t;)i=i.An,i.he=t.he,i.Je=t.Je}OD(t,e){let i=t.RD,s=t.Eh;return s<1&&f.o("Could not determine previous vertex in layer"),e[i][s-1]}UI(...t){let e=-1,i=f.et(),s=f.et(),n=1/0;for(let o=0;o<4;o++){if(!t[o])continue;let r=this.XI(t[o],i,s,o);r<n&&(e=o,n=r)}for(let o=0;o<4;o++){let r=t[o];if(!r)continue;let a=o===0||o===2?i[e]-i[o]:s[e]-s[o];a!==0&&r.each(h=>{r.set(h.key,h.value+a)})}f.J(i),f.J(s)}XI(t,e,i,s){if(!t||t.count===0)return e[s]=0,i[s]=0,1/0;let n=1/0,o=-1/0;return t.each(r=>{let a=r.key,h=r.value,l=this.b===90||this.b===270?a.width:a.height;h<n&&(n=h),h+l>o&&(o=h+l)}),e[s]=n,i[s]=o,o-n}commitLayout(){this.zy(),this.commitNodes(),this.eC(),this.isRouting&&this.commitLinks()}zy(){if(!this.setsPortSpots)return;let t=this.rk(!0),e=this.rk(!1),i=this.network.edges.iterator;for(;i.next();){let s=i.value.link;s!==null&&(s.fromSpot=t,s.toSpot=e)}}rk(t){return this.b===270?t?D.MiddleTop:D.MiddleBottom:this.b===90?t?D.MiddleBottom:D.MiddleTop:this.b===180?t?D.MiddleLeft:D.MiddleRight:t?D.MiddleRight:D.MiddleLeft}commitNodes(){this.Zs=[],this.Ls=[],this.As=[],this.It=[];for(let g=0;g<=this.kt;g++)this.Zs[g]=0,this.Ls[g]=0,this.As[g]=0,this.It[g]=0;let t=this.network.vertexes.iterator;for(;t.next();){let g=t.value,p=g.layer;this.Zs[p]=Math.max(this.Zs[p],this.nodeMinLayerSpace(g,!0)),this.Ls[p]=Math.max(this.Ls[p],this.nodeMinLayerSpace(g,!1))}let e=0,i=this.Ns;for(let g=0;g<=this.kt;g++){let p=i;this.Zs[g]+this.Ls[g]<=0&&(p=0),g>0&&(e+=p/2),this.b===90||this.b===0?(e+=this.Ls[g],this.As[g]=e,e+=this.Zs[g]):(e+=this.Zs[g],this.As[g]=e,e+=this.Ls[g]),g<this.kt&&(e+=p/2),this.It[g]=e}let s=e,n=this.arrangementOrigin;for(let g=0;g<=this.kt;g++)this.b===270?this.As[g]=n.y+this.As[g]:this.b===90?(this.As[g]=n.y+s-this.As[g],this.It[g]=s-this.It[g]):this.b===180?this.As[g]=n.x+this.As[g]:(this.As[g]=n.x+s-this.As[g],this.It[g]=s-this.It[g]);let o=this.Ln!==0;t.reset();let r=this.b===270||this.b===90,a=1/0,h=1/0,l=1/0,c=-1/0;for(;t.next();){let g=t.value,p=g.layer,m=g.column|0,y=0,w=0;r?(y=n.x+this.Wi*m,w=this.As[p]):(y=this.As[p],w=n.y+this.Wi*m),g.centerX=y,g.centerY=w,o&&isFinite(g.he)&&(r?g.node?g.x=n.x+g.he:g.centerX=n.x+g.he:g.node?g.y=n.y+g.he:g.centerY=n.y+g.he),a=Math.min(g.x,a),h=Math.min(g.y,h),r?(l=a,c=Math.max(c,g.bounds.right)):(l=h,c=Math.max(c,g.bounds.bottom))}this.QN=c-l;let u=n.x-a,d=n.y-h;for(this._o=new P(o&&r?0:u,o&&!r?0:d),t.reset();t.next();){let g=t.value;g.x+=u,g.y+=d,g.commit()}}eC(){let t=0,e=this.Ns;for(let n=0;n<=this.kt;n++)t+=this.Zs[n],t+=this.Ls[n];t+=this.kt*e;let i=[],s=this.Ln!==0?this.QN:this.Wi*this.zt;for(let n=this.maxLayer;n>=0;n--)this.b===270?n===0?i.push(new z(0,0,s,Math.abs(this.It[0]))):i.push(new z(0,this.It[n-1],s,Math.abs(this.It[n-1]-this.It[n]))):this.b===90?n===0?i.push(new z(0,this.It[0],s,Math.abs(this.It[0]-t))):i.push(new z(0,this.It[n],s,Math.abs(this.It[n-1]-this.It[n]))):this.b===180?n===0?i.push(new z(0,0,Math.abs(this.It[0]),s)):i.push(new z(this.It[n-1],0,Math.abs(this.It[n-1]-this.It[n]),s)):n===0?i.push(new z(this.It[0],0,Math.abs(this.It[0]-t),s)):i.push(new z(this.It[n],0,Math.abs(this.It[n-1]-this.It[n]),s));this.commitLayers(i,this._o)}commitLayers(t,e){}commitLinks(){let t=this.network.edges.iterator,e;for(;t.next();)e=t.value.link,e!==null&&(e.startRoute(),e.clearPoints(),e.commitRoute());for(t.reset();t.next();)e=t.value.link,e!==null&&e.updateRoute();for(t.reset();t.next();){let i=t.value;if(e=i.link,e===null||e.pointsCount===0)continue;e.startRoute();let s=e,n=s.fromNode,o=s.toNode,r=s.fromPort,a=s.toPort;if(n!==null){let C=n.findVisibleNode();C!==null&&C!==n&&(n=C,r=C.port)}if(o!==null){let C=o.findVisibleNode();C!==null&&C!==o&&(o=C,a=C.port)}let h=e.computeSpot(!0,r),l=e.computeSpot(!1,a),c=i.fromVertex,u=i.toVertex;if(i.valid){if(e.curve===9&&e.pointsCount===4)if(c.column===u.column&&this.alignOption===0){let C=e.getLinkPoint(n,r,h,!0,!1,o,a),R=e.getLinkPoint(o,a,l,!1,!1,n,r);C.isReal()||C.set(n.actualBounds.center),R.isReal()||R.set(o.actualBounds.center),e.clearPoints(),e.addPointAt(C.x,C.y),e.addPointAt((2*C.x+R.x)/3,(2*C.y+R.y)/3),e.addPointAt((C.x+2*R.x)/3,(C.y+2*R.y)/3),e.addPointAt(R.x,R.y)}else{let C=!1,R=!1;if(r!==null&&h===D.None&&(C=!0),a!==null&&l===D.None&&(R=!0),C||R){let O=null;C&&(O=e.getLinkPointFromPoint(n,r,r.getDocumentPoint(D.Center),e.getPoint(3),!0),O.isReal()||O.set(n.actualBounds.center),e.setPointAt(0,O.x,O.y));let B=null;if(R&&(B=e.getLinkPointFromPoint(o,a,a.getDocumentPoint(D.Center),e.getPoint(0),!1),B.isReal()||B.set(o.actualBounds.center),e.setPointAt(3,B.x,B.y)),O){let X=e.getPoint(2);e.setPointAt(1,(O.x*2+X.x)/3,(O.y*2+X.y)/3)}if(B){let X=e.getPoint(1);e.setPointAt(2,(B.x*2+X.x)/3,(B.y*2+X.y)/3)}}}e.commitRoute();continue}if(c.layer===u.layer){e.commitRoute();continue}let d=!1,g=!1,p=this.Ns,m=0,y=e.firstPickIndex+1;if(e.isOrthogonal)g=!0,m=e.pointsCount,m>4&&e.points.removeRange(2,m-3);else if(e.curve===9)d=!0,m=e.pointsCount,m>4&&e.points.removeRange(2,m-3),m===4&&(y=2);else{m=e.pointsCount;let C=h===D.None,R=l===D.None;m>2&&C&&R?e.points.removeRange(1,m-2):m>3&&C&&!R?e.points.removeRange(1,m-3):m>3&&!C&&R?e.points.removeRange(2,m-2):m>4&&!C&&!R&&e.points.removeRange(2,m-3)}let w,b,v=0,k=0,S=0,M=0,F=0,T=0,N=0;if(i.rev){let C=0;for(;u!==null&&c!==u;){w=null,b=null;let R=u.sourceEdges.iterator;for(;R.next();){let O=R.value;if(O.link===i.link&&(w=O.fromVertex,b=O.toVertex,w.node===null))break}if(w===null)break;if(w!==c)if(v=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=w.centerX,M=w.centerY,g)this.b===180||this.b===0?y===e.firstPickIndex+1?(e.insertPointAt(y++,v,k),e.insertPointAt(y++,v,M)):(b!==null?b.centerY:k)!==M&&(F=this.It[w.layer-1]+this._o.x,e.insertPointAt(y++,F,k),e.insertPointAt(y++,F,M)):y===e.firstPickIndex+1?(e.insertPointAt(y++,v,k),e.insertPointAt(y++,S,k)):(b!==null?b.centerX:v)!==S&&(F=this.It[w.layer-1]+this._o.y,e.insertPointAt(y++,v,F),e.insertPointAt(y++,S,F));else if(y===e.firstPickIndex+1)if(T=Math.max(10,this.Zs[u.layer]),N=Math.max(10,this.Ls[u.layer]),d)this.b===180?S<=u.bounds.x?(C=u.bounds.x,e.insertPointAt(y++,C-T,M),e.insertPointAt(y++,C,M),e.insertPointAt(y++,C+N,M)):(e.insertPointAt(y++,S-T,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S+N,M)):this.b===90?M>=u.bounds.bottom?(C=u.bounds.y+u.bounds.height,e.insertPointAt(y++,S,C+N),e.insertPointAt(y++,S,C),e.insertPointAt(y++,S,C-T)):(e.insertPointAt(y++,S,M+N),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M-T)):this.b===270?M<=u.bounds.y?(C=u.bounds.y,e.insertPointAt(y++,S,C-T),e.insertPointAt(y++,S,C),e.insertPointAt(y++,S,C+N)):(e.insertPointAt(y++,S,M-T),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M+N)):this.b===0&&(S>=u.bounds.right?(C=u.bounds.x+u.bounds.width,e.insertPointAt(y++,C+N,M),e.insertPointAt(y++,C,M),e.insertPointAt(y++,C-T,M)):(e.insertPointAt(y++,S+N,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S-T,M)));else{e.insertPointAt(y++,v,k);let O=0;this.b===180||this.b===0?((this.b===180?S>=u.bounds.right:S<=u.bounds.x)&&(O=(this.b===0?-T:N)/2),e.insertPointAt(y++,v+O,M)):((this.b===270?M>=u.bounds.bottom:M<=u.bounds.y)&&(O=(this.b===90?-T:N)/2),e.insertPointAt(y++,S,k+O)),e.insertPointAt(y++,S,M)}else T=Math.max(10,this.Zs[w.layer]),N=Math.max(10,this.Ls[w.layer]),d?this.b===180?(e.insertPointAt(y++,S-T-p,M),e.insertPointAt(y++,Math.min(S-T+p/2,S),M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,Math.max(S+N-p/2,S),M),e.insertPointAt(y++,S+N+p,M)):this.b===90?(e.insertPointAt(y++,S,M+N+p),e.insertPointAt(y++,S,Math.max(M+N-p/2,M)),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,Math.min(M-T+p/2,M)),e.insertPointAt(y++,S,M-T-p)):this.b===270?(e.insertPointAt(y++,S,M-T-p),e.insertPointAt(y++,S,Math.min(M-T+p/2,M)),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,Math.max(M+N-p/2,M)),e.insertPointAt(y++,S,M+N+p)):(e.insertPointAt(y++,S+N+p,M),e.insertPointAt(y++,Math.max(S+N-p/2,S),M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,Math.min(S-T+p/2,S),M),e.insertPointAt(y++,S-T-p,M)):(this.b===180||this.b===90||this.b,e.insertPointAt(y++,S,M));u=w}if(a===null||h!==D.None||g)if(v=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=e.getPoint(y).x,M=e.getPoint(y).y,g){let R=this.Ls[c.layer],O=0;this.b===180||this.b===0?(O=k,O>=c.bounds.y&&O<=c.bounds.bottom&&(this.b===180?S>=c.bounds.x:S<=c.bounds.right)&&(C=c.centerX+(this.b===180?-R:R),O<c.bounds.y+c.bounds.height/2?O=c.bounds.y-this.Wi/2:O=c.bounds.bottom+this.Wi/2,e.insertPointAt(y++,C,k),e.insertPointAt(y++,C,O)),e.insertPointAt(y++,S,O),e.insertPointAt(y++,S,M)):(O=v,O>=c.bounds.x&&O<=c.bounds.right&&(this.b===270?M>=c.bounds.y:M<=c.bounds.bottom)&&(C=c.centerY+(this.b===270?-R:R),O<c.bounds.x+c.bounds.width/2?O=c.bounds.x-this.Wi/2:O=c.bounds.right+this.Wi/2,e.insertPointAt(y++,v,C),e.insertPointAt(y++,O,C)),e.insertPointAt(y++,O,M),e.insertPointAt(y++,S,M))}else if(d)T=Math.max(10,this.Zs[c.layer]),N=Math.max(10,this.Ls[c.layer]),this.b===180&&S>=c.bounds.x?(C=c.bounds.x+c.bounds.width,e.setPointAt(y-2,C,k),e.setPointAt(y-1,C+N,k)):this.b===90&&M<=c.bounds.bottom?(C=c.bounds.y,e.setPointAt(y-2,v,C),e.setPointAt(y-1,v,C-T)):this.b===270&&M>=c.bounds.y?(C=c.bounds.y+c.bounds.height,e.setPointAt(y-2,v,C),e.setPointAt(y-1,v,C+N)):this.b===0&&S<=c.bounds.right&&(C=c.bounds.x,e.setPointAt(y-2,C,k),e.setPointAt(y-1,C-T,k));else{T=Math.max(10,this.Zs[c.layer]),N=Math.max(10,this.Ls[c.layer]);let R=0;this.b===180||this.b===0?((this.b===180?S<=c.bounds.x:S>=c.bounds.right)&&(R=(this.b===0?N:-T)/2),e.insertPointAt(y++,S+R,k)):((this.b===270?M<=c.bounds.y:M>=c.bounds.bottom)&&(R=(this.b===90?N:-T)/2),e.insertPointAt(y++,v,M+R)),e.insertPointAt(y++,S,M)}}else{for(;c!==null&&c!==u;){w=null,b=null;let C=c.destinationEdges.iterator;for(;C.next();){let R=C.value;if(R.link===i.link&&(w=R.toVertex,b=R.fromVertex,b.node!==null&&(b=null),w.node===null))break}if(w===null)break;w!==u&&(v=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=w.centerX,M=w.centerY,g?this.b===180||this.b===0?(b!==null?b.centerY:k)!==M&&(F=this.It[w.layer]+this._o.x,y===e.firstPickIndex+1&&(this.b===0?F=Math.max(F,v):F=Math.min(F,v)),e.insertPointAt(y++,F,k),e.insertPointAt(y++,F,M)):(b!==null?b.centerX:v)!==S&&(F=this.It[w.layer]+this._o.y,y===e.firstPickIndex+1&&(this.b===90?F=Math.max(F,k):F=Math.min(F,k)),e.insertPointAt(y++,v,F),e.insertPointAt(y++,S,F)):(T=Math.max(10,this.Zs[w.layer]),N=Math.max(10,this.Ls[w.layer]),d?this.b===180?(e.insertPointAt(y++,S+N+p,M),e.insertPointAt(y++,Math.max(S+N-p/2,S),M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,Math.min(S-T+p/2,S),M),e.insertPointAt(y++,S-T-p,M)):this.b===90?(e.insertPointAt(y++,S,M-T-p),e.insertPointAt(y++,S,Math.min(M-T+p/2,M)),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,Math.max(M+N-p/2,M)),e.insertPointAt(y++,S,M+N+p)):this.b===270?(e.insertPointAt(y++,S,M+N+p),e.insertPointAt(y++,S,Math.max(M+N-p/2,M)),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,Math.min(M-T+p/2,M)),e.insertPointAt(y++,S,M-T-p)):(e.insertPointAt(y++,S-T-p,M),e.insertPointAt(y++,Math.min(S-T+p/2,S),M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,S,M),e.insertPointAt(y++,Math.max(S+N-p/2,S),M),e.insertPointAt(y++,S+N+p,M)):this.b===180?(e.insertPointAt(y++,S+N,M),e.insertPointAt(y++,S-T,M)):this.b===90?(e.insertPointAt(y++,S,M-T),e.insertPointAt(y++,S,M+N)):this.b===270?(e.insertPointAt(y++,S,M+N),e.insertPointAt(y++,S,M-T)):(e.insertPointAt(y++,S-T,M),e.insertPointAt(y++,S+N,M)))),c=w}g&&(v=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=e.getPoint(y).x,M=e.getPoint(y).y,this.b===180||this.b===0?k!==M&&(this.b===0?F=Math.min(Math.max((S+v)/2,this.It[u.layer]+this._o.x),S):F=Math.max(Math.min((S+v)/2,this.It[u.layer]+this._o.x),S),e.insertPointAt(y++,F,k),e.insertPointAt(y++,F,M)):v!==S&&(this.b===90?F=Math.min(Math.max((M+k)/2,this.It[u.layer]+this._o.y),M):F=Math.max(Math.min((M+k)/2,this.It[u.layer]+this._o.y),M),e.insertPointAt(y++,v,F),e.insertPointAt(y++,S,F)))}if(s!==null&&d&&e.pointsCount>=4){if(r!==null){let C=h===D.None?e.getLinkPointFromPoint(n,r,r.getDocumentPoint(D.Center),e.getPoint(3),!0):e.getPoint(0);if(h===D.None){let R=e.getPoint(2),O=e.getPoint(3);this.direction===90||this.direction===270?(e.setPointAt(1,(C.x+R.x)/2,R.y),e.setPointAt(2,O.x,(R.y+O.y)/2)):(e.setPointAt(1,R.x,(C.y+R.y)/2),e.setPointAt(2,(R.x+O.x)/2,O.y))}C.isReal()||C.set(n.actualBounds.center),e.setPointAt(0,C.x,C.y)}if(a!==null){let C=l===D.None?e.getLinkPointFromPoint(o,a,a.getDocumentPoint(D.Center),e.getPoint(e.pointsCount-4),!1):e.getPoint(e.pointsCount-1);if(l===D.None){let R=e.getPoint(e.pointsCount-3),O=e.getPoint(e.pointsCount-4);this.direction===90||this.direction===270?(e.setPointAt(e.pointsCount-2,(C.x+R.x)/2,R.y),e.setPointAt(e.pointsCount-2,O.x,(R.y+O.y)/2)):(e.setPointAt(e.pointsCount-2,R.x,(C.y+R.y)/2),e.setPointAt(e.pointsCount-3,(R.x+O.x)/2,O.y))}C.isReal()||C.set(o.actualBounds.center),e.setPointAt(e.pointsCount-1,C.x,C.y)}}e.commitRoute(),i.commit()}}aI(){this.Xy=-1,this.kg=0,this.Cs=0,this._a=null,this.Sg=null,this.$f=null;for(let t=0;t<this.Cn.length;t++)this.Cn[t]=null}Oh(t){let e,i=this.ci[t];if(i>=this.Cn.length){let n=[];for(let o=0;o<this.Cn.length;o++)n[o]=this.Cn[o];this.Cn=n}this.Cn[i]===void 0||this.Cn[i]===null?e=[]:(e=this.Cn[i],this.Cn[i]=null);let s=this.$f[t];for(let n=0;n<s.length;n++){let o=s[n];e[o.index]=o}return e}Ih(t,e){this.Cn[this.ci[t]]=e}get layerSpacing(){return this.Ns}set layerSpacing(t){this.Ns!==t&&(f.s(t,"number",_e,"layerSpacing"),t>=0&&(this.Ns=t,this.invalidateLayout()))}get columnSpacing(){return this.Wi}set columnSpacing(t){this.Wi!==t&&(f.s(t,"number",_e,"columnSpacing"),t>0&&(this.Wi=t,this.invalidateLayout()))}get direction(){return this.b}set direction(t){this.b!==t&&(f.s(t,"number",_e,"direction"),t===0||t===90||t===180||t===270?(this.b=t,this.invalidateLayout()):f.o("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}get cycleRemoveOption(){return this.jf}set cycleRemoveOption(t){this.jf!==t&&(t===1||t===0||t===2)&&(this.jf=t,this.invalidateLayout())}get layeringOption(){return this.Hf}set layeringOption(t){this.Hf!==t&&(t===10||t===11||t===12)&&(this.Hf=t,this.invalidateLayout())}get initializeOption(){return this.qf}set initializeOption(t){this.qf!==t&&(t===20||t===21||t===22)&&(this.qf=t,this.invalidateLayout())}get iterations(){return this.Qa}set iterations(t){this.Qa!==t&&t>=0&&(this.Qa=t,this.invalidateLayout())}get aggressiveOption(){return this.Wf}set aggressiveOption(t){this.Wf!==t&&(t===30||t===31||t===32)&&(this.Wf=t,this.invalidateLayout())}get packOption(){return this.Qo}set packOption(t){this.Qo!==t&&(f.s(t,"number",_e,"packOption"),t>=0&&t<8&&(this.Qo=t,this.invalidateLayout()))}get packIterations(){return this.Jf}set packIterations(t){this.Jf=t}get alignOption(){return this.Ln}set alignOption(t){this.Ln!==t&&(f.s(t,"number",_e,"align"),t>=0&&t<16&&(this.Ln=t,this.invalidateLayout()))}get setsPortSpots(){return this.Nn}set setsPortSpots(t){this.Nn!==t&&(f.s(t,"boolean",_e,"setsPortSpots"),this.Nn=t,this.invalidateLayout())}get maxLayer(){return this.kt}get maxIndex(){return this.Xy}get maxColumn(){return this.zt}get minIndexLayer(){return this.kg}get maxIndexLayer(){return this.Cs}static CycleDepthFirst=0;static CycleGreedy=1;static CycleFromLayers=2;static LayerOptimalLinkLength=10;static LayerLongestPathSink=11;static LayerLongestPathSource=12;static InitDepthFirstOut=20;static InitDepthFirstIn=21;static InitNaive=22;static AggressiveNone=30;static AggressiveLess=31;static AggressiveMore=32;static PackNone=0;static PackExpand=1;static PackStraighten=2;static PackMedian=4;static PackAll=15;static AlignNone=0;static AlignUpperLeft=1;static AlignUpperRight=2;static AlignLowerLeft=4;static AlignLowerRight=8;static AlignAll=15}class jn extends We{constructor(t){super(t)}createVertex(){return new Xe(this)}createEdge(){return new Ee(this)}}class Xe extends $e{Go;Hr;At;ak;ck;$i;Zf;Xn;ok;ek;sk;tc;An;RD;Eh;Je;Qf;he;Tn;jy=null;Hy=null;qy=null;Wy=null;constructor(t){super(t),this.Go=-1,this.Hr=-1,this.At=-1,this.ak=NaN,this.ck=null,this.$i=!1,this.Zf=NaN,this.Xn=NaN,this.ok=0,this.ek=null,this.sk=null}static ID(t,e){return t.index-e.index}getProperSourceEdges(){if(!this.qy){let t=[];for(let e of this.fo){let i=e;i.valid&&t.push(i)}this.qy=t}return this.qy}getProperDestinationEdges(){if(!this.Wy){let t=[];for(let e of this.Wo){let i=e;i.valid&&t.push(i)}this.Wy=t}return this.Wy}getDestinationEdge(t){let e=this.getProperDestinationEdges();for(let i of e)if(i.toVertex===t)return i;f.o("Unable to find destination edge to given vertex")}getProperSourceVertexes(){if(!this.jy){let t=[];for(let e of this.fo){let i=e;!i.valid||i.fromVertex.layer<=i.toVertex.layer||t.push(i.fromVertex)}t.sort(Xe.ID),this.jy=t}return this.jy}getProperDestinationVertexes(){if(!this.Hy){let t=[];for(let e of this.Wo){let i=e;!i.valid||i.fromVertex.layer<=i.toVertex.layer||t.push(i.toVertex)}t.sort(Xe.ID),this.Hy=t}return this.Hy}addSourceEdge(t){super.addSourceEdge(t),this.jy=null,this.qy=null}deleteSourceEdge(t){super.deleteSourceEdge(t),this.jy=null,this.qy=null}addDestinationEdge(t){super.addDestinationEdge(t),this.Hy=null,this.Wy=null}deleteDestinationEdge(t){super.deleteDestinationEdge(t),this.Hy=null,this.Wy=null}get layer(){return this.Go}set layer(t){this.Go!==t&&(f.s(t,"number",Xe,"layer"),this.Go=t)}get column(){return this.Hr}set column(t){this.Hr!==t&&(f.s(t,"number",Xe,"column"),this.Hr=t)}get index(){return this.At}set index(t){this.At!==t&&(f.s(t,"number",Xe,"index"),this.At=t)}get component(){return this.ak}set component(t){this.ak!==t&&(f.s(t,"number",Xe,"component"),this.ak=t)}get near(){return this.ck}set near(t){this.ck!==t&&(this.ck=t)}}class Ee extends mi{$i;fk;uk;dk;gk;mk;pk;constructor(t){super(t),this.$i=!1,this.fk=!1,this.uk=!1,this.dk=NaN,this.gk=NaN,this.mk=0,this.pk=0}get fromVertex(){return this.He}set fromVertex(t){this.He!==t&&(this.He=t)}get toVertex(){return this.qe}set toVertex(t){this.qe!==t&&(this.qe=t)}get valid(){return this.$i}set valid(t){this.$i!==t&&(f.s(t,"boolean",Ee,"valid"),this.$i=t)}get rev(){return this.fk}set rev(t){this.fk!==t&&(f.s(t,"boolean",Ee,"rev"),this.fk=t)}get forest(){return this.uk}set forest(t){this.uk!==t&&(f.s(t,"boolean",Ee,"forest"),this.uk=t)}get portFromPos(){return this.dk}set portFromPos(t){this.dk!==t&&(f.s(t,"number",Ee,"portFromPos"),this.dk=t)}get portToPos(){return this.gk}set portToPos(t){this.gk!==t&&(f.s(t,"number",Ee,"portToPos"),this.gk=t)}get portFromColOffset(){return this.mk}set portFromColOffset(t){this.mk!==t&&(f.s(t,"number",Ee,"portFromColOffset"),this.mk=t)}get portToColOffset(){return this.pk}set portToColOffset(t){this.pk!==t&&(f.s(t,"number",Ee,"portToColOffset"),this.pk=t)}}var Gs=(x=>(x[x.Default=0]="Default",x[x.Destination=1]="Destination",x[x.Source=2]="Source",x))(Gs||{}),Us=(x=>(x[x.Forwards=10]="Forwards",x[x.Reverse=11]="Reverse",x[x.Ascending=12]="Ascending",x[x.Descending=13]="Descending",x))(Us||{}),qs=(x=>(x[x.CenterSubtrees=20]="CenterSubtrees",x[x.CenterChildren=21]="CenterChildren",x[x.Start=22]="Start",x[x.End=23]="End",x[x.Bus=24]="Bus",x[x.BusBranching=25]="BusBranching",x[x.TopLeftBus=26]="TopLeftBus",x[x.BottomRightBus=27]="BottomRightBus",x[x.Custom=28]="Custom",x))(qs||{}),Hs=(x=>(x[x.None=30]="None",x[x.Block=31]="Block",x))(Hs||{}),Ws=(x=>(x[x.Layered=40]="Layered",x[x.LastParents=41]="LastParents",x[x.Alternating=42]="Alternating",x[x.RootOnly=43]="RootOnly",x))(Ws||{}),$s=(x=>(x[x.Vertical=50]="Vertical",x[x.Horizontal=51]="Horizontal",x[x.FixedRoots=52]="FixedRoots",x))($s||{}),Yn=(x=>(x[x.Individual=60]="Individual",x[x.Siblings=61]="Siblings",x[x.Uniform=62]="Uniform",x))(Yn||{});class jt extends ne{Fi;Li;_f;Ng;sC;Fe;Xi;Ms;U;B;yk;ls;constructor(t){super(),this.Fi=new I,this.Li=0,this.ls=1,this._f=40,this.Ng=60,this.sC=[],this.Fe=!0,this.Xi=50,this.Ms=new Q(10,10).u();let e=new Js(this);this.U=new It(e),this.B=new It(e),this.yk=[],t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Li=this.Li,t._f=this._f,t.Ng=this.Ng,t.Fe=this.Fe,t.Xi=this.Xi,t.Ms.a(this.Ms),t.U.copyInheritedPropertiesFrom(this.U),t.B.copyInheritedPropertiesFrom(this.B)}oi(t){t in qs?this.alignment=t:t in $s?this.arrangement=t:t in Hs?this.compaction=t:t in Gs?this.path=t:t in Us?this.sorting=t:t in Ws?this.treeStyle=t:super.oi(t)}createNetwork(){return new Js(this)}makeNetwork(t){let e=this.createNetwork(),i=s=>{if(s instanceof rt)return!s.isLinkLabel&&s.category!=="Comment";if(s instanceof _){let n=s.fromNode;if(n===null||n.isLinkLabel||n.category==="Comment")return!1;let o=s.toNode;return!(o===null||o.isLinkLabel||o.category==="Comment")}return!1};return t instanceof q?(e.addParts(t.nodes,!0,i),e.addParts(t.links,!0,i)):t instanceof ft?e.addParts(t.memberParts,!1,i):e.addParts(t.iterator,!1,i),e}doLayout(t){this.network===null&&(this.network=this.makeNetwork(t)),this.arrangement!==52&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));let e=this.diagram;e===null&&t instanceof q&&(e=t),this.path===0&&e!==null?this.ls=e.isTreePathToChildren?1:2:this.ls=this.path===0?1:this.path,this.network.vertexes.count>0&&(this.HI(),this.qI(),this.WI(),this.JI(),this.$N(),this.$I(),this.arrangeTrees(),this.updateParts()),this.network=null,this.Fi=new I,this.isValidLayout=!0}HI(){this.network.deleteSelfEdges();let t=this.network.vertexes.iterator;for(;t.next();){let n=t.value;n.initialized=!1,n.level=0,n.parent=null,n.children=[]}if(this.Fi.count>0){let n=new I,o=this.Fi.iterator;for(;o.next();){let r=o.value;if(r instanceof rt){let a=this.network.findVertex(r);a!==null&&n.add(a)}else r instanceof It&&n.add(r)}this.Fi=n}this.Fi.count===0&&this.findRoots();let e=this.Fi.copy().iterator;for(;e.next();){let n=e.value;n.initialized||(n.initialized=!0,this.nC(n))}let i=this.network.vertexes,s=null;for(;s=this.ZI(i),s.count>0;){let n=this.ED(s);n!==null&&this.Fi.add(n),n.initialized=!0,this.nC(n),i=s}}ZI(t){let e=new I,i=t.iterator;for(;i.next();){let s=i.value;s.initialized||e.add(s)}return e}findRoots(){let t=this.network.vertexes,e=t.iterator;for(;e.next();){let i=e.value;switch(this.ls){case 1:i.sourceEdges.count===0&&this.Fi.add(i);break;case 2:i.destinationEdges.count===0&&this.Fi.add(i);break;default:f.o("Unhandled path value "+this.ls.toString())}}if(this.Fi.count===0){let i=this.ED(t);i!==null&&this.Fi.add(i)}}ED(t){let e=999999,i=null,s=t.iterator;for(;s.next();){let n=s.value;switch(this.ls){case 1:n.sourceEdges.count<e&&(e=n.sourceEdges.count,i=n);break;case 2:n.destinationEdges.count<e&&(e=n.destinationEdges.count,i=n);break;default:f.o("Unhandled path value "+this.ls.toString())}}return i}nC(t){if(t===null)return;switch(this.ls){case 1:if(t.destinationEdges.count>0){let s=new G,n=t.destinationVertexes;for(;n.next();){let o=n.value;this.UD(t,o)&&s.add(o)}s.count>0&&(t.children=s.toArray())}break;case 2:if(t.sourceEdges.count>0){let s=new G,n=t.sourceVertexes;for(;n.next();){let o=n.value;this.UD(t,o)&&s.add(o)}s.count>0&&(t.children=s.toArray())}break;default:f.o("Unhandled path value"+this.ls.toString())}let e=t.children,i=e.length;for(let s=0;s<i;s++){let n=e[s];n.initialized=!0,n.level=t.level+1,n.parent=t,this.Fi.delete(n)}for(let s=0;s<i;s++){let n=e[s];this.nC(n)}}UD(t,e){return e.initialized?this.QI(e,t)||e.level>t.level?!1:(this._I(e.parent,e),!0):!0}QI(t,e){if(e===null)return!1;let i=e.parent;for(;i!==null&&i!==t;)i=i.parent;return i===t}_I(t,e){if(t===null||e===null)return;let i=t.children,s=0;for(let n=0;n<i.length;n++)i[n]===e&&s++;if(s>0){let n=new Array(i.length-s),o=0;for(let r=0;r<i.length;r++)i[r]!==e&&(n[o++]=i[r]);t.children=n}}qI(){let t=this.Fi.iterator;for(;t.next();){let e=t.value;e instanceof It&&this.BD(e)}}BD(t){if(t===null)return;this.initializeTreeVertexValues(t),t.alignment===25&&this.sortTreeVertexChildren(t);let e=0,i=t.childrenCount,s=0,n=t.children,o=n.length;for(let r=0;r<o;r++){let a=n[r];this.BD(a),e+=a.descendantCount+1,i=Math.max(i,a.maxChildrenCount),s=Math.max(s,a.maxGenerationCount)}t.descendantCount=e,t.maxChildrenCount=i,t.maxGenerationCount=i>0?s+1:0}tE(t){switch(this._f){default:case 40:return t.parent!==null?t.parent:this.U;case 43:return t.parent===null?this.U:t.parent.parent===null?this.B:t.parent;case 42:return t.parent!==null?t.parent.parent!==null?t.parent.parent:this.B:this.U;case 41:{let e=!0;if(t.childrenCount===0)e=!1;else{let i=t.children,s=i.length;for(let n=0;n<s;n++)if(i[n].childrenCount>0){e=!1;break}}return e&&t.parent!==null?this.B:t.parent!==null?t.parent:this.U}}}initializeTreeVertexValues(t){let e=this.tE(t);if(t.copyInheritedPropertiesFrom(e),t.parent!==null&&t.parent.alignment===25){let i=t.angle,s=t.parent.children,n=0;for(;n<s.length&&t!==s[n];)n++;n%2===0?n!==s.length-1&&(i===90?i=180:i===180?i=270:i===270?i=180:i=270):i===90?i=0:i===180?i=90:i===270?i=0:i=90,t.angle=i}t.initialized=!0}WI(){let t=this.Fi.iterator;for(;t.next();){let e=t.value;e instanceof It&&this.VD(e)}}VD(t){if(t===null)return;this.assignTreeVertexValues(t);let e=t.children,i=e.length;for(let s=0;s<i;s++){let n=e[s];this.VD(n)}}assignTreeVertexValues(t){}JI(){let t=this.Fi.iterator;for(;t.next();){let e=t.value;e instanceof It&&this.zD(e)}}zD(t){if(t===null)return;t.alignment!==25&&this.sortTreeVertexChildren(t);let e=t.children,i=e.length;for(let s=0;s<i;s++){let n=e[s];this.zD(n)}}sortTreeVertexChildren(t){switch(t.sorting){default:case 10:break;case 11:t.children.reverse();break;case 12:t.children.sort(t.comparer);break;case 13:t.children.sort(t.comparer),t.children.reverse();break}}$N(){if(!this.comments)return;let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value;this.addComments(e)}}addComments(t){let e=t.angle,i=t.parent,s=0,n=21,o=!1;i!==null&&(s=i.angle,n=i.alignment,o=this.isBusAlignment(n));let r=e===90||e===270,a=s===90||s===270,h=t.childrenCount===0,l=0,c=0,u=0,d=t.commentSpacing;if(t.node!==null){let g=t.node.findNodesConnected();for(;g.next();){let p=g.value;if(p.category!=="Comment"||!p.canLayout())continue;t.comments===null&&(t.comments=[]),t.comments.push(p),p.ensureBounds();let m=p.measuredBounds;r&&!h||!o&&!a&&h||o&&a&&h?(l=Math.max(l,m.width),c+=m.height+Math.abs(u)):(l+=m.width+Math.abs(u),c=Math.max(c,m.height)),u=d}}if(t.comments!==null){r&&!h||!o&&!a&&h||o&&a&&h?(l+=Math.abs(t.commentMargin),c=Math.max(0,c-t.height)):(c+=Math.abs(t.commentMargin),l=Math.max(0,l-t.width));let g=z.V(0,0,t.bounds.width+l,t.bounds.height+c);t.bounds=g,z.e(g)}}isBusAlignment(t){return t===24||t===25||t===26||t===27}Jy(t){return t===24||t===25}oC(t){let e=t.parent;if(e!==null){let i=e.alignment;if(this.isBusAlignment(i))if(this.Jy(i)){let s=e.children,n=0;for(;n<s.length&&t!==s[n];)n++;return n%2===0}else return i===26}return!1}layoutComments(t){if(t.comments!==null){let e=t.node.measuredBounds,i=t.parent,s=t.angle,n=0,o=21,r=!1;i!==null&&(n=i.angle,o=i.alignment,r=this.isBusAlignment(o));let a=s===90||s===270,h=n===90||n===270,l=t.childrenCount===0,c=this.oC(t),u=0,d=t.comments,g=d.length,p=P.l();for(let y=0;y<g;y++){let w=d[y],b=w.measuredBounds;if(a&&!l||!r&&!h&&l||r&&h&&l){if(n>135&&!r||h&&c)if(t.commentMargin>=0){p.i(t.bounds.x-t.commentMargin-b.width,t.bounds.y+u),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleLeft,k.toSpot=D.MiddleRight}}else{p.i(t.bounds.x+t.focus.x*2-t.commentMargin,t.bounds.y+u),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleRight,k.toSpot=D.MiddleLeft}}else if(t.commentMargin>=0){p.i(t.bounds.x+t.focus.x*2+t.commentMargin,t.bounds.y+u),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleRight,k.toSpot=D.MiddleLeft}}else{p.i(t.bounds.x+t.commentMargin-b.width,t.bounds.y+u),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleLeft,k.toSpot=D.MiddleRight}}t.commentSpacing>=0?u+=b.height+t.commentSpacing:u+=t.commentSpacing-b.height}else{if(n>135&&!r||!h&&c)if(t.commentMargin>=0){p.i(t.bounds.x+u,t.bounds.y-t.commentMargin-b.height),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleTop,k.toSpot=D.MiddleBottom}}else{p.i(t.bounds.x+u,t.bounds.y+t.focus.y*2-t.commentMargin),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleBottom,k.toSpot=D.MiddleTop}}else if(t.commentMargin>=0){p.i(t.bounds.x+u,t.bounds.y+t.focus.y*2+t.commentMargin),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleBottom,k.toSpot=D.MiddleTop}}else{p.i(t.bounds.x+u,t.bounds.y+t.commentMargin-b.height),w.move(p);let v=w.findLinksInto();for(;v.next();){let k=v.value;k.fromSpot=D.MiddleTop,k.toSpot=D.MiddleBottom}}t.commentSpacing>=0?u+=b.width+t.commentSpacing:u+=t.commentSpacing-b.width}}P.e(p);let m=u-t.commentSpacing-(a?e.height:e.width);if(this.ls===1){let y=t.destinationEdges;for(;y.next();){let w=y.value.link;w!==null&&!w.isAvoiding&&(w.fromEndSegmentLength=m>0?m:NaN)}}else{let y=t.sourceEdges;for(;y.next();){let w=y.value.link;w!==null&&!w.isAvoiding&&(w.toEndSegmentLength=m>0?m:NaN)}}}}$I(){if(this.layerStyle===62){let e=[],i=this.network.vertexes.iterator;for(;i.next();){let s=i.value,n=s.parent;n===null&&(n=s);let o=n.angle===0||n.angle===180,r=e[s.level];r===void 0&&(r=0),e[s.level]=Math.max(r,o?s.width:s.height)}for(let s=0;s<e.length;s++)e[s]===void 0&&(e[s]=0);for(this.sC=e,i=this.network.vertexes.iterator;i.next();){let s=i.value,n=s.parent;n===null&&(n=s),n.angle===0||n.angle===180?(n.angle===180&&(s.focusX+=e[s.level]-s.width),s.width=e[s.level]):(n.angle===270&&(s.focusY+=e[s.level]-s.height),s.height=e[s.level])}}else if(this.layerStyle===61){let e=this.network.vertexes.iterator;for(;e.next();){let i=e.value,s=i.angle===0||i.angle===180,n=-1;for(let o=0;o<i.children.length;o++){let r=i.children[o];n=Math.max(n,s?r.width:r.height)}if(n>=0)for(let o=0;o<i.children.length;o++){let r=i.children[o];s?(i.angle===180&&(r.focusX+=n-r.width),r.width=n):(i.angle===270&&(r.focusY+=n-r.height),r.height=n)}}}let t=this.Fi.iterator;for(;t.next();){let e=t.value;e instanceof It&&this.layoutTree(e)}}layoutTree(t){if(t===null)return;let e=t.children,i=e.length;for(let s=0;s<i;s++){let n=e[s];this.layoutTree(n)}switch(t.compaction){case 30:this.XD(t);break;default:case 31:t.alignment===25?this.XD(t):this.iE(t);break}}XD(t){if(t.childrenCount===0){let Y=!1,j=0,U=21;t.parent!==null&&(j=t.parent.angle,U=t.parent.alignment,Y=this.isBusAlignment(U));let nt=this.oC(t);t.O.i(0,0),t.ut.i(t.width,t.height),t.parent!==null&&t.comments!==null&&((j===180||j===270)&&!Y||nt)?j===180&&!Y||(j===90||j===270)&&nt?t.lt.i(t.width-t.focus.x*2,0):t.lt.i(0,t.height-t.focus.y*2):t.lt.i(0,0);return}let e=this.orthoAngle(t),i=e===90||e===270,s=0,n=t.children,o=n.length;for(let Y=0;Y<o;Y++){let j=n[Y];s=Math.max(s,i?j.ut.width:j.ut.height)}let r=t.alignment,a=r===22,h=r===23,l=this.isBusAlignment(r),c=Math.max(0,t.breadthLimit),u=this.computeLayerSpacing(t),d=t.nodeSpacing,g=this.computeNodeIndent(t),p=a||h?0:g/2,m=t.rowSpacing,y=0;(a||h)&&(y=Math.max(0,t.rowIndent));let w=t.width,b=t.height,v=0,k=0,S=0,M=0,F=0,T=0,N=0,C=0,R=0,O=0;if(l&&!this.Jy(r)&&e>135&&n.reverse(),this.Jy(r))if(o>1)for(let Y=0;Y<o;Y++){let j=n[Y],U=j.ut;Y%2===0&&Y!==o-1?R=Math.max(R,(i?U.width:U.height)+this.computeBusNodeSpacing(j)-d):Y%2!==0&&(O=Math.max(O,(i?U.width:U.height)+this.computeBusNodeSpacing(j)-d))}else o===1&&(R=i?n[0].ut.width:n[0].ut.height);if(l)switch(r){case 24:case 25:let Y;e<135?Y=this.GD(t,n,R,O,v,k):Y=this.YD(t,n,R,O,v,k),R=Y.x,v=Y.width,k=Y.height;break;case 26:for(let j=0;j<o;j++){let U=n[j],nt=U.ut,at=N===0?0:m;i?(U.O.i(s-nt.width,F+at),v=Math.max(v,nt.width),k=Math.max(k,F+at+nt.height),F+=at+nt.height):(U.O.i(M+at,s-nt.height),v=Math.max(v,M+at+nt.width),k=Math.max(k,nt.height),M+=at+nt.width),N++}break;case 27:for(let j=0;j<o;j++){let U=n[j],nt=U.ut,at=N===0?0:m;i?(U.O.i(d/2+t.focus.x,F+at),v=Math.max(v,nt.width),k=Math.max(k,F+at+nt.height),F+=at+nt.height):(U.O.i(M+at,d/2+t.focus.y),v=Math.max(v,M+at+nt.width),k=Math.max(k,nt.height),M+=at+nt.width),N++}break}else for(let Y=0;Y<o;Y++){let j=n[Y],U=j.ut;if(i){c>0&&N>0&&M+d+U.width>c&&(M<s&&this.ic(t,r,s-M,0,C,Y-1),T++,N=0,C=Y,S=k,M=0,F=e>135?-k-m:k+m);let nt=N===0?p:d;this.wk(j,0,F),j.O.i(M+nt,F),v=Math.max(v,M+nt+U.width),k=Math.max(k,S+(T===0?0:m)+U.height),M+=nt+U.width}else{c>0&&N>0&&F+d+U.height>c&&(F<s&&this.ic(t,r,0,s-F,C,Y-1),T++,N=0,C=Y,S=v,F=0,M=e>135?-v-m:v+m);let nt=N===0?p:d;this.wk(j,M,0),j.O.i(M,F+nt),k=Math.max(k,F+nt+U.height),v=Math.max(v,S+(T===0?0:m)+U.width),F+=nt+U.height}N++}T>0&&(i?(k+=Math.max(0,u),M<v&&this.ic(t,r,v-M,0,C,o-1),y>0&&(h||this.tu(t,y,0,0,o-1),v+=y)):(v+=Math.max(0,u),F<k&&this.ic(t,r,0,k-F,C,o-1),y>0&&(h||this.tu(t,0,y,0,o-1),k+=y)));let B=0,X=0;switch(r){case 20:i?B+=v/2-t.focus.x-g/2:X+=k/2-t.focus.y-g/2;break;default:case 21:if(T>0)i?B+=v/2-t.focus.x-g/2:X+=k/2-t.focus.y-g/2;else{let j=o;if(i){let U=n[0].O.x+n[0].lt.x,nt=n[j-1].O.x+n[j-1].lt.x+n[j-1].focus.x*2;B+=U+(nt-U)/2-t.focus.x-g/2}else{let U=n[0].O.y+n[0].lt.y,nt=n[j-1].O.y+n[j-1].lt.y+n[j-1].focus.y*2;X+=U+(nt-U)/2-t.focus.y-g/2}}break;case 22:i?(B-=g,v+=g):(X-=g,k+=g);break;case 23:i?(B+=v-t.width+g,v+=g):(X+=k-t.height+g,k+=g);break;case 24:case 25:i?o>1?B+=R+d/2-t.focus.x:B+=n[0].focus.x-t.focus.x+n[0].lt.x:o>1?X+=R+d/2-t.focus.y:X+=n[0].focus.y-t.focus.y+n[0].lt.y;break;case 26:i?B+=v+d/2-t.focus.x:X+=k+d/2-t.focus.y;break;case 27:break;case 28:let Y=this.customAlignment(t,B,X,v,k);B=Y[0],X=Y[1],v=Y[2],k=Y[3];break}for(let Y=0;Y<o;Y++){let j=n[Y];i?j.O.i(j.O.x+j.lt.x-B,j.O.y+(e>135?(l?-k:-j.ut.height)+j.lt.y-u:b+u+j.lt.y)):j.O.i(j.O.x+(e>135?(l?-v:-j.ut.width)+j.lt.x-u:w+u+j.lt.x),j.O.y+j.lt.y-X)}i?(v=this.rC(t,v,B),B<0&&(B=0),e>135&&(X+=k+u),k=Math.max(Math.max(k,b),k+b+u)):(e>135&&(B+=v+u),v=Math.max(Math.max(v,w),v+w+u),k=this.lC(t,k,X),X<0&&(X=0)),t.lt.i(B,X),t.ut.i(v,k)}customAlignment(t,e,i,s,n){return[e,i,s,n]}GD(t,e,i,s,n,o){let r=e.length;if(r===0)return new z(i,0,n,o);if(r===1){let m=e[0];return n=m.ut.width,o=m.ut.height,new z(i,0,n,o)}let a=t.nodeSpacing,h=t.rowSpacing,l=this.orthoAngle(t)===90,c=0,u=0,d=0;for(let m=0;m<r;m++){if(m%2!==0||r>1&&m===r-1)continue;let y=e[m],w=y.ut,b=c===0?0:h;if(l){let v=this.computeBusNodeSpacing(y)-a;y.O.i(i-(w.width+v),d+b),n=Math.max(n,w.width+v),o=Math.max(o,d+b+w.height),d+=b+w.height}else{let v=this.computeBusNodeSpacing(y)-a;y.O.i(u+b,i-(w.height+v)),o=Math.max(o,w.height+v),n=Math.max(n,u+b+w.width),u+=b+w.width}c++}c=0;let g=u,p=d;l?(u=i+a,d=0):(u=0,d=i+a);for(let m=0;m<r;m++){if(m%2===0)continue;let y=e[m],w=y.ut,b=c===0?0:h;if(l){let v=this.computeBusNodeSpacing(y)-a;y.O.i(u+v,d+b),n=Math.max(n,u+w.width+v),o=Math.max(o,d+b+w.height),d+=b+w.height}else{let v=this.computeBusNodeSpacing(y)-a;y.O.i(u+b,d+v),n=Math.max(n,u+b+w.width),o=Math.max(o,d+w.height+v),u+=b+w.width}c++}if(r>1&&r%2===1){let m=e[r-1],y=m.ut,w=this.computeBusLastRowSpacing(m,l?Math.max(Math.abs(p),Math.abs(d)):Math.max(Math.abs(g),Math.abs(u)));if(l){m.O.i(i+a/2-m.focus.x-m.lt.x,o+w);let b=i+a/2-m.focus.x-m.lt.x;n=Math.max(n,b+y.width),b<0&&(n-=b),o=Math.max(o,Math.max(p,d)+w+y.height),m.O.x<0&&(i=this.xk(t,m.O.x,!1,i,a))}else{m.O.i(n+w,i+a/2-m.focus.y-m.lt.y),n=Math.max(n,Math.max(g,u)+w+y.width);let b=i+a/2-m.focus.y-m.lt.y;o=Math.max(o,b+y.height),b<0&&(o-=b),m.O.y<0&&(i=this.xk(t,m.O.y,!0,i,a))}}return new z(i,0,n,o)}YD(t,e,i,s,n,o){let r=e.length;if(r===0)return new z(i,0,n,o);if(r===1){let m=e[0];return n=m.ut.width,o=m.ut.height,new z(i,0,n,o)}let a=t.nodeSpacing,h=t.rowSpacing,l=this.orthoAngle(t)===270,c=0,u=0,d=0;for(let m=0;m<r;m++){if(m%2!==0||r>1&&m===r-1)continue;let y=e[m],w=y.ut,b=c===0?0:h;if(l){let v=this.computeBusNodeSpacing(y)-a;d-=b+w.height,y.O.i(i-(w.width+v),d),n=Math.max(n,w.width+v),o=Math.max(o,Math.abs(d))}else{let v=this.computeBusNodeSpacing(y)-a;u-=b+w.width,y.O.i(u,i-(w.height+v)),o=Math.max(o,w.height+v),n=Math.max(n,Math.abs(u))}c++}c=0;let g=u,p=d;l?(u=i+a,d=0):(u=0,d=i+a);for(let m=0;m<r;m++){if(m%2===0)continue;let y=e[m],w=y.ut,b=c===0?0:h;if(l){let v=this.computeBusNodeSpacing(y)-a;d-=b+w.height,y.O.i(u+v,d),n=Math.max(n,u+w.width+v),o=Math.max(o,Math.abs(d))}else{let v=this.computeBusNodeSpacing(y)-a;u-=b+w.width,y.O.i(u,d+v),o=Math.max(o,d+w.height+v),n=Math.max(n,Math.abs(u))}c++}if(r>1&&r%2===1){let m=e[r-1],y=m.ut,w=this.computeBusLastRowSpacing(m,l?Math.max(Math.abs(p),Math.abs(d)):Math.max(Math.abs(g),Math.abs(u)));if(l){m.O.i(i+a/2-m.focus.x-m.lt.x,-o-y.height-w);let b=i+a/2-m.focus.x-m.lt.x;n=Math.max(n,b+y.width),b<0&&(n-=b),o=Math.max(o,Math.abs(Math.min(p,d))+w+y.height),m.O.x<0&&(i=this.xk(t,m.O.x,!1,i,a))}else{m.O.i(-n-y.width-w,i+a/2-m.focus.y-m.lt.y),n=Math.max(n,Math.abs(Math.min(g,u))+w+y.width);let b=i+a/2-m.focus.y-m.lt.y;o=Math.max(o,b+y.height),b<0&&(o-=b),m.O.y<0&&(i=this.xk(t,m.O.y,!0,i,a))}}for(let m=0;m<r;m++){let y=e[m];l?y.O.i(y.O.x,y.O.y+o):y.O.i(y.O.x+n,y.O.y)}return new z(i,0,n,o)}computeBusNodeSpacing(t){return t.parent===null?0:t.parent.nodeSpacing}computeBusLastRowSpacing(t,e){return t.parent===null?0:t.parent.rowSpacing}xk(t,e,i,s,n){let o=t.children,r=o.length;for(let h=0;h<r;h++)i?o[h].O.i(o[h].O.x,o[h].O.y-e):o[h].O.i(o[h].O.x-e,o[h].O.y);let a=o[r-1];return Math.max(s,i?a.lt.y+a.focus.y-n/2:a.lt.x+a.focus.x-n/2)}rC(t,e,i){switch(t.alignment){case 21:case 20:let s=e;return i+t.width>s&&(s=i+t.width),i<0&&(s-=i),s;case 22:return t.width>e?t.width:e;case 23:return t.focus.x*2>e?t.width:e+t.width-t.focus.x*2;case 24:case 25:let n=Math.min(0,i),o=Math.max(e,i+t.width);return Math.max(t.width,o-n);case 26:return t.width-t.focus.x+t.nodeSpacing/2+e;case 27:return Math.max(t.width,t.focus.x+t.nodeSpacing/2+e);default:return e}}lC(t,e,i){switch(t.alignment){case 21:case 20:let s=e;return i+t.height>s&&(s=i+t.height),i<0&&(s-=i),s;case 22:return t.height>e?t.height:e;case 23:return t.focus.y*2>e?t.height:e+t.height-t.focus.y*2;case 24:case 25:let n=Math.min(0,i),o=Math.max(e,i+t.height);return Math.max(t.height,o-n);case 26:return t.height-t.focus.y+t.nodeSpacing/2+e;case 27:return Math.max(t.height,t.focus.y+t.nodeSpacing/2+e);default:return e}}hC(t,e,i){switch(t){case 20:e/=2,i/=2;break;case 21:e/=2,i/=2;break;case 22:e=0,i=0;break;case 23:break;default:f.o("Unhandled alignment value "+t.toString())}return new P(e,i)}ic(t,e,i,s,n,o){let r=this.hC(e,i,s);this.tu(t,r.x,r.y,n,o)}tu(t,e,i,s,n){if(e===0&&i===0)return;let o=t.children;for(let r=s;r<=n;r++){let a=o[r].O;a.x+=e,a.y+=i}}wk(t,e,i){let s=t.parent;switch(this.ls){case 1:{let n=t.sourceEdges;for(;n.next();){let o=n.value;o.fromVertex===s&&o.relativePoint.i(e,i)}break}case 2:{let n=t.destinationEdges;for(;n.next();){let o=n.value;o.toVertex===s&&o.relativePoint.i(e,i)}break}default:f.o("Unhandled path value "+this.ls.toString())}}iE(t){if(t.childrenCount===0){let et=t.parent,ut=!1,gt=0,wt=21;et!==null&&(gt=et.angle,wt=et.alignment,ut=this.isBusAlignment(wt));let Ct=this.oC(t);t.O.i(0,0),t.ut.i(t.width,t.height),t.parent!==null&&t.comments!==null&&((gt===180||gt===270)&&!ut||Ct)?gt===180&&!ut||(gt===90||gt===270)&&Ct?t.lt.i(t.width-t.focus.x*2,0):t.lt.i(0,t.height-t.focus.y*2):t.lt.i(0,0),t.Cg=null,t.Lg=null;return}let e=this.orthoAngle(t),i=e===90||e===270,s=0,n=t.children,o=n.length;for(let et=0;et<o;et++){let ut=n[et];s=Math.max(s,i?ut.ut.width:ut.ut.height)}let r=t.alignment,a=r===22,h=r===23,l=this.isBusAlignment(r),c=Math.max(0,t.breadthLimit),u=this.computeLayerSpacing(t),d=t.nodeSpacing,g=this.computeNodeIndent(t),p=t.rowSpacing,m=0;(a||h)&&(m=Math.max(0,t.rowIndent));let y=t.width,w=t.height,b=0,v=0,k=0,S=null,M=null,F=0,T=0,N=0,C=0,R=0,O=0,B=0,X=0,Y=0;if(l&&!this.Jy(r)&&e>135&&n.reverse(),this.Jy(r))if(o>1)for(let et=0;et<o;et++)et%2===0&&et!==o-1?X=Math.max(X,i?n[et].ut.width:n[et].ut.height):et%2!==0&&(Y=Math.max(Y,i?n[et].ut.width:n[et].ut.height));else o===1&&(X=i?n[0].ut.width:n[0].ut.height);if(l){switch(r){case 24:let et;e<135?et=this.GD(t,n,X,Y,b,v):et=this.YD(t,n,X,Y,b,v),X=et.x,b=et.width,v=et.height;break;case 26:for(let ut=0;ut<o;ut++){let gt=n[ut],wt=gt.ut,Ct=O===0?0:p;i?(gt.O.i(s-wt.width,C+Ct),b=Math.max(b,wt.width),v=Math.max(v,C+Ct+wt.height),C+=Ct+wt.height):(gt.O.i(N+Ct,s-wt.height),b=Math.max(b,N+Ct+wt.width),v=Math.max(v,wt.height),N+=Ct+wt.width),O++}break;case 27:for(let ut=0;ut<o;ut++){let gt=n[ut],wt=gt.ut,Ct=O===0?0:p;i?(gt.O.i(d/2+t.focus.x,C+Ct),b=Math.max(b,wt.width),v=Math.max(v,C+Ct+wt.height),C+=Ct+wt.height):(gt.O.i(N+Ct,d/2+t.focus.y),b=Math.max(b,N+Ct+wt.width),v=Math.max(v,wt.height),N+=Ct+wt.width),O++}break}S=this.ae(2),M=this.ae(2),i?(S[0].i(0,0),S[1].i(0,v),M[0].i(b,0),M[1].i(b,v)):(S[0].i(0,0),S[1].i(b,0),M[0].i(0,v),M[1].i(b,v))}else for(let et=0;et<o;et++){let ut=n[et],gt=ut.ut;if(i){c>0&&O>0&&N+d+gt.width>c&&(N<s&&this.ic(t,r,s-N,0,B,et-1),R++,O=0,B=et,k=v,N=0,C=e>135?-v-p:v+p),this.wk(ut,0,C);let wt=0;if(O===0)S=ut.Cg,M=ut.Lg,F=gt.width,T=gt.height,(S===null||M===null||e!==this.orthoAngle(ut))&&(S=this.ae(2),M=this.ae(2),S[0].i(0,0),S[1].i(0,T),M[0].i(F,0),M[1].i(F,T));else{let Ct=f.et(),ot=this.KD(t,ut,S,M,F,T,Ct);wt=ot.x,S=Ct[0],M=Ct[1],F=ot.width,T=ot.height,f.J(Ct),N<gt.width&&wt<0&&(this.tu(t,-wt,0,B,et-1),this.bk(S,-wt,0),this.bk(M,-wt,0),wt=0)}ut.O.i(wt,C),b=Math.max(b,F),v=Math.max(v,k+(R===0?0:p)+gt.height),N=F}else{c>0&&O>0&&C+d+gt.height>c&&(C<s&&this.ic(t,r,0,s-C,B,et-1),R++,O=0,B=et,k=b,C=0,N=e>135?-b-p:b+p),this.wk(ut,N,0);let wt=0;if(O===0)S=ut.Cg,M=ut.Lg,F=gt.width,T=gt.height,(S===null||M===null||e!==this.orthoAngle(ut))&&(S=this.ae(2),M=this.ae(2),S[0].i(0,0),S[1].i(F,0),M[0].i(0,T),M[1].i(F,T));else{let Ct=f.et(),ot=this.KD(t,ut,S,M,F,T,Ct);wt=ot.x,S=Ct[0],M=Ct[1],F=ot.width,T=ot.height,f.J(Ct),C<gt.height&&wt<0&&(this.tu(t,0,-wt,B,et-1),this.bk(S,0,-wt),this.bk(M,0,-wt),wt=0)}ut.O.i(N,wt),v=Math.max(v,T),b=Math.max(b,k+(R===0?0:p)+gt.width),C=T}O++}R>0&&(i?(v+=Math.max(0,u),N<b&&this.ic(t,r,b-N,0,B,o-1),m>0&&(h||this.tu(t,m,0,0,o-1),b+=m)):(b+=Math.max(0,u),C<v&&this.ic(t,r,0,v-C,B,o-1),m>0&&(h||this.tu(t,0,m,0,o-1),v+=m)));let j=0,U=0;switch(r){case 20:i?j+=b/2-t.focus.x-g/2:U+=v/2-t.focus.y-g/2;break;default:case 21:if(R>0)i?j+=b/2-t.focus.x-g/2:U+=v/2-t.focus.y-g/2;else{let ut=o;if(i){let gt=n[0].O.x+n[0].lt.x,wt=n[ut-1].O.x+n[ut-1].lt.x+n[ut-1].focus.x*2;j+=gt+(wt-gt)/2-t.focus.x-g/2}else{let gt=n[0].O.y+n[0].lt.y,wt=n[ut-1].O.y+n[ut-1].lt.y+n[ut-1].focus.y*2;U+=gt+(wt-gt)/2-t.focus.y-g/2}}break;case 22:i?(j-=g,b+=g):(U-=g,v+=g);break;case 23:i?(j+=b-t.width+g,b+=g):(U+=v-t.height+g,v+=g);break;case 24:i?o>1?j+=X+d/2-t.focus.x:j+=n[0].focus.x-t.focus.x+n[0].lt.x:o>1?U+=X+d/2-t.focus.y:U+=n[0].focus.y-t.focus.y+n[0].lt.y;break;case 26:i?j+=b+d/2-t.focus.x:U+=v+d/2-t.focus.y;break;case 27:break;case 28:let et=this.customAlignment(t,j,U,b,v);j=et[0],U=et[1],b=et[2],v=et[3];break}for(let et=0;et<o;et++){let ut=n[et];i?ut.O.i(ut.O.x+ut.lt.x-j,ut.O.y+(e>135?(l?-v:-ut.ut.height)+ut.lt.y-u:w+u+ut.lt.y)):ut.O.i(ut.O.x+(e>135?(l?-b:-ut.ut.width)+ut.lt.x-u:y+u+ut.lt.x),ut.O.y+ut.lt.y-U)}let nt=0,at=0;if(l)i?(b=this.rC(t,b,j),j<0&&(j=0),e>135&&(U+=v+u),v+=w+u,r===27&&(nt+=d/2+t.focus.x),at+=w+u):(e>135&&(j+=b+u),b+=y+u,v=this.lC(t,v,U),U<0&&(U=0),r===27&&(at+=d/2+t.focus.y),nt+=y+u);else if(i){if(t.comments===null){if(y>b){let et=this.hC(r,y-b,0);nt=et.x,at=et.y,b=y,j=0}}else b=this.rC(t,b,j);j<0&&(nt-=j,j=0),e>135&&(U+=v+u),v=Math.max(Math.max(v,w),v+w+u),at+=w+u}else{if(e>135&&(j+=b+u),b=Math.max(Math.max(b,y),b+y+u),t.comments===null){if(w>v){let et=this.hC(r,0,w-v);nt=et.x,at=et.y,v=w,U=0}}else v=this.lC(t,v,U);U<0&&(at-=U,U=0),nt+=y+u}let tt,st;if(R>0)tt=this.ae(4),st=this.ae(4),i?(tt[2].i(0,w+u),tt[3].i(tt[2].x,v),st[2].i(b,tt[2].y),st[3].i(st[2].x,tt[3].y)):(tt[2].i(y+u,0),tt[3].i(b,tt[2].y),st[2].i(tt[2].x,v),st[3].i(tt[3].x,st[2].y));else{tt=this.ae(S.length+2),st=this.ae(M.length+2);for(let et=0;et<S.length;et++){let ut=S[et];tt[et+2].i(ut.x+nt,ut.y+at)}for(let et=0;et<M.length;et++){let ut=M[et];st[et+2].i(ut.x+nt,ut.y+at)}}i?(tt[0].i(j,0),tt[1].i(tt[0].x,w),tt[2].y<tt[1].y&&(tt[2].x>tt[0].x?tt[2].a(tt[1]):tt[1].a(tt[2])),tt[3].y<tt[2].y&&(tt[3].x>tt[0].x?tt[3].a(tt[2]):tt[2].a(tt[3])),st[0].i(j+y,0),st[1].i(st[0].x,w),st[2].y<st[1].y&&(st[2].x<st[0].x?st[2].a(st[1]):st[1].a(st[2])),st[3].y<st[2].y&&(st[3].x<st[0].x?st[3].a(st[2]):st[2].a(st[3])),tt[2].y-=u/2,st[2].y-=u/2):(tt[0].i(0,U),tt[1].i(y,tt[0].y),tt[2].x<tt[1].x&&(tt[2].y>tt[0].y?tt[2].a(tt[1]):tt[1].a(tt[2])),tt[3].x<tt[2].x&&(tt[3].y>tt[0].y?tt[3].a(tt[2]):tt[2].a(tt[3])),st[0].i(0,U+w),st[1].i(y,st[0].y),st[2].x<st[1].x&&(st[2].y<st[0].y?st[2].a(st[1]):st[1].a(st[2])),st[3].x<st[2].x&&(st[3].y<st[0].y?st[3].a(st[2]):st[2].a(st[3])),tt[2].x-=u/2,st[2].x-=u/2),this._s(S),this._s(M),t.Cg=tt,t.Lg=st,t.lt.i(j,U),t.ut.i(b,v)}bk(t,e,i){for(let s=0;s<t.length;s++){let n=t[s];n.x+=e,n.y+=i}}KD(t,e,i,s,n,o,r){let a=this.orthoAngle(t),h=a===90||a===270,l=t.nodeSpacing,c=i,u=s,d=n,g=o,p=e.Cg,m=e.Lg,y=e.ut,w=h?Math.max(g,y.height):Math.max(d,y.width);if((p===null||a!==this.orthoAngle(e))&&(p=this.ae(2),m=this.ae(2),h?(p[0].i(0,0),p[1].i(0,y.height),m[0].i(y.width,0),m[1].i(m[0].x,p[1].y)):(p[0].i(0,0),p[1].i(y.width,0),m[0].i(0,y.height),m[1].i(p[1].x,m[0].y))),h){let b=d,v=b-this.eE(u,p,b);return v+=l,i=this.sE(c,p,v),s=this.nE(u,m,v),n=Math.max(0,v)+y.width,o=w,this._s(c),this._s(p),this._s(u),this._s(m),r[0]=i,r[1]=s,new z(v,0,n,o)}else{let b=g,v=b-this.oE(u,p,b);return v+=l,i=this.rE(c,p,v),s=this.lE(u,m,v),n=w,o=Math.max(0,v)+y.height,this._s(c),this._s(p),this._s(u),this._s(m),r[0]=i,r[1]=s,new z(v,0,n,o)}}rE(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.ae(t.length+e.length),n=0,o=0,r=0;for(;o<e.length&&e[o].x<t[0].x;){let l=e[o++];s[r++].i(l.x,l.y+i)}for(;n<t.length;){let l=t[n++];s[r++].i(l.x,l.y)}let a=t[t.length-1].x;for(;o<e.length&&e[o].x<=a;)o++;for(;o<e.length&&e[o].x>a;){let l=e[o++];s[r++].i(l.x,l.y+i)}let h=this.ae(r);for(n=0;n<r;n++)h[n].a(s[n]);return this._s(s),h}sE(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.ae(t.length+e.length),n=0,o=0,r=0;for(;o<e.length&&e[o].y<t[0].y;){let l=e[o++];s[r++].i(l.x+i,l.y)}for(;n<t.length;){let l=t[n++];s[r++].i(l.x,l.y)}let a=t[t.length-1].y;for(;o<e.length&&e[o].y<=a;)o++;for(;o<e.length&&e[o].y>a;){let l=e[o++];s[r++].i(l.x+i,l.y)}let h=this.ae(r);for(n=0;n<r;n++)h[n].a(s[n]);return this._s(s),h}lE(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.ae(t.length+e.length),n=0,o=0,r=0;for(;n<t.length&&t[n].x<e[0].x;){let l=t[n++];s[r++].i(l.x,l.y)}for(;o<e.length;){let l=e[o++];s[r++].i(l.x,l.y+i)}let a=e[e.length-1].x;for(;n<t.length&&t[n].x<=a;)n++;for(;n<t.length&&t[n].x>a;){let l=t[n++];s[r++].i(l.x,l.y)}let h=this.ae(r);for(n=0;n<r;n++)h[n].a(s[n]);return this._s(s),h}nE(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.ae(t.length+e.length),n=0,o=0,r=0;for(;n<t.length&&t[n].y<e[0].y;){let l=t[n++];s[r++].i(l.x,l.y)}for(;o<e.length;){let l=e[o++];s[r++].i(l.x+i,l.y)}let a=e[e.length-1].y;for(;n<t.length&&t[n].y<=a;)n++;for(;n<t.length&&t[n].y>a;){let l=t[n++];s[r++].i(l.x,l.y)}let h=this.ae(r);for(n=0;n<r;n++)h[n].a(s[n]);return this._s(s),h}oE(t,e,i){let s=9999999;if(t===null||t.length<2||e===null||e.length<2)return s;let n=0,o=0;for(;n<t.length&&o<e.length;){let r=t[n],a=e[o],h=a.x,l=a.y;l+=i;let c=r;n+1<t.length&&(c=t[n+1]);let u=a,d=u.x,g=u.y;o+1<e.length&&(u=e[o+1],d=u.x,g=u.y,g+=i);let p=s;r.x===h?p=l-r.y:r.x>h&&r.x<d?p=l+(r.x-h)/(d-h)*(g-l)-r.y:h>r.x&&h<c.x&&(p=l-(r.y+(h-r.x)/(c.x-r.x)*(c.y-r.y))),p<s&&(s=p),c.x<=r.x?n++:d<=h?o++:(c.x<=d&&n++,d<=c.x&&o++)}return s}eE(t,e,i){let s=9999999;if(t===null||t.length<2||e===null||e.length<2)return s;let n=0,o=0;for(;n<t.length&&o<e.length;){let r=t[n],a=e[o],h=a.x,l=a.y;h+=i;let c=r;n+1<t.length&&(c=t[n+1]);let u=a,d=u.x,g=u.y;o+1<e.length&&(u=e[o+1],d=u.x,g=u.y,d+=i);let p=s;r.y===l?p=h-r.x:r.y>l&&r.y<g?p=h+(r.y-l)/(g-l)*(d-h)-r.x:l>r.y&&l<c.y&&(p=h-(r.x+(l-r.y)/(c.y-r.y)*(c.x-r.x))),p<s&&(s=p),c.y<=r.y?n++:g<=l?o++:(c.y<=g&&n++,g<=c.y&&o++)}return s}ae(t){let e=this.yk[t];if(e!==void 0){let s=e.pop();if(s!==void 0)return s}let i=[];for(let s=0;s<t;s++)i[s]=new P;return i}_s(t){if(!t)return;let e=t.length,i=this.yk[e];i===void 0&&(i=[],this.yk[e]=i),i.push(t)}arrangeTrees(){if(this.Xi===52){let t=this.Fi.iterator;for(;t.next();){let e=t.value;if(!(e instanceof It))continue;let i=e.node;if(i===null)continue;let s=i.position,n=s.x,o=s.y;isFinite(n)||(n=0),isFinite(o)||(o=0),this.aC(e,n,o)}}else{let t=[],e=this.Fi.iterator;for(;e.next();){let o=e.value;o instanceof It&&t.push(o)}switch(this.sorting){default:case 10:break;case 11:t.reverse();break;case 12:t.sort(this.comparer);break;case 13:t.sort(this.comparer),t.reverse();break}let i=this.arrangementOrigin,s=i.x,n=i.y;for(let o=0;o<t.length;o++){let r=t[o];switch(this.aC(r,s+r.lt.x,n+r.lt.y),this.Xi){case 50:n+=r.ut.height+this.Ms.height;break;default:case 51:s+=r.ut.width+this.Ms.width;break}}}}aC(t,e,i){if(t===null)return;t.x=e,t.y=i;let s=t.children,n=s.length;for(let o=0;o<n;o++){let r=s[o];this.aC(r,e+r.O.x,i+r.O.y)}}commitLayout(){this.zy(),this.commitNodes(),this.eC(),this.isRouting&&this.commitLinks()}commitNodes(){let t=this.network.vertexes.iterator;for(;t.next();)t.value.commit();for(t.reset();t.next();){let e=t.value;this.layoutComments(e)}}eC(){if(this.layerStyle!==62)return;let t=this.sC,e=[],i=null,s=this.network.vertexes.iterator;for(;s.next();){let h=s.value;i===null?i=h.bounds.copy():i.unionRect(h.bounds);let l=e[h.level];l===void 0?l=this.computeLayerSpacing(h):l=Math.max(l,this.computeLayerSpacing(h)),e[h.level]=l}for(let h=0;h<e.length;h++)e[h]===void 0&&(e[h]=0);let n;this.angle===90||this.angle===270?(i.inflate(this.nodeSpacing/2,this.layerSpacing),n=new P(-this.nodeSpacing/2,-this.layerSpacing/2)):(i.inflate(this.layerSpacing,this.nodeSpacing/2),n=new P(-this.layerSpacing/2,-this.nodeSpacing/2));let o=[],r=this.angle===90||this.angle===270?i.width:i.height,a=0;if(this.angle===180||this.angle===270)for(let h=0;h<t.length;h++)a+=t[h]+e[h];for(let h=0;h<t.length;h++){let l=t[h]+e[h];this.angle===270?(a-=l,o.push(new z(0,a,r,l))):this.angle===90?(o.push(new z(0,a,r,l)),a+=l):this.angle===180?(a-=l,o.push(new z(a,0,l,r))):(o.push(new z(a,0,l,r)),a+=l)}this.commitLayers(o,n)}commitLayers(t,e){}commitLinks(){let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}zy(){let t=this.Fi.iterator;for(;t.next();){let e=t.value;e instanceof It&&this.jD(e)}}jD(t){if(t===null)return;this.setPortSpots(t);let e=t.children,i=e.length;for(let s=0;s<i;s++){let n=e[s];this.jD(n)}}setPortSpots(t){let e=t.alignment;if(this.isBusAlignment(e))this.hE(t,e);else{let i=this.orthoAngle(t);if(this.ls===1){let s=t.destinationEdges;for(;s.next();){let n=s.value.link;if(n!==null){if(t.setsPortSpot)if(t.portSpot.isDefault())switch(i){case 0:n.fromSpot=D.MiddleRight;break;case 90:n.fromSpot=D.MiddleBottom;break;case 180:n.fromSpot=D.MiddleLeft;break;default:n.fromSpot=D.MiddleTop;break}else n.fromSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.isDefault())switch(i){case 0:n.toSpot=D.MiddleLeft;break;case 90:n.toSpot=D.MiddleTop;break;case 180:n.toSpot=D.MiddleRight;break;default:n.toSpot=D.MiddleBottom;break}else n.toSpot=t.childPortSpot}}}else{let s=t.sourceEdges;for(;s.next();){let n=s.value.link;if(n!==null){if(t.setsPortSpot)if(t.portSpot.isDefault())switch(i){case 0:n.toSpot=D.MiddleRight;break;case 90:n.toSpot=D.MiddleBottom;break;case 180:n.toSpot=D.MiddleLeft;break;default:n.toSpot=D.MiddleTop;break}else n.toSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.isDefault())switch(i){case 0:n.fromSpot=D.MiddleLeft;break;case 90:n.fromSpot=D.MiddleTop;break;case 180:n.fromSpot=D.MiddleRight;break;default:n.fromSpot=D.MiddleBottom;break}else n.fromSpot=t.childPortSpot}}}}}hE(t,e){let i=this.ls===1,s=this.orthoAngle(t),n;switch(s){case 0:n=D.MiddleRight;break;case 90:n=D.MiddleBottom;break;case 180:n=D.MiddleLeft;break;default:n=D.MiddleTop;break}let o=t.children,r=o.length;switch(e){case 24:case 25:{for(let a=0;a<r;a++){let h=o[a],l=(i?h.sourceEdges:h.destinationEdges).first();if(l===null)continue;let c=l.link;if(c!==null){let u=s===90||s===270?D.MiddleLeft:D.MiddleTop;if(r===1||a===r-1&&r%2===1)switch(s){case 0:u=D.MiddleLeft;break;case 90:u=D.MiddleTop;break;case 180:u=D.MiddleRight;break;default:u=D.MiddleBottom;break}else a%2===0&&(u=s===90||s===270?D.MiddleRight:D.MiddleBottom);i?(t.setsPortSpot&&(c.fromSpot=n),t.setsChildPortSpot&&(c.toSpot=u)):(t.setsPortSpot&&(c.fromSpot=u),t.setsChildPortSpot&&(c.toSpot=n))}}break}case 26:{let a=s===90||s===270?D.MiddleRight:D.MiddleBottom,h=i?t.destinationEdges:t.sourceEdges;for(;h.next();){let l=h.value.link;l!==null&&(i?(t.setsPortSpot&&(l.fromSpot=n),t.setsChildPortSpot&&(l.toSpot=a)):(t.setsPortSpot&&(l.fromSpot=a),t.setsChildPortSpot&&(l.toSpot=n)))}break}case 27:{let a=s===90||s===270?D.MiddleLeft:D.MiddleTop,h=i?t.destinationEdges:t.sourceEdges;for(;h.next();){let l=h.value.link;l!==null&&(i?(t.setsPortSpot&&(l.fromSpot=n),t.setsChildPortSpot&&(l.toSpot=a)):(t.setsPortSpot&&(l.fromSpot=a),t.setsChildPortSpot&&(l.toSpot=n)))}break}}}orthoAngle(t){let e=t.angle;return e<=45?0:e<=135?90:e<=225?180:e<=315?270:0}computeLayerSpacing(t){let e=this.orthoAngle(t),i=e===90||e===270,s=t.layerSpacing;if(t.layerSpacingParentOverlap>0){let n=Math.min(1,t.layerSpacingParentOverlap);s-=i?t.height*n:t.width*n}return s<(i?-t.height:-t.width)&&(s=i?-t.height:-t.width),s}computeNodeIndent(t){let e=this.orthoAngle(t),i=e===90||e===270,s=t.nodeIndent;if(t.nodeIndentPastParent>0){let n=Math.min(1,t.nodeIndentPastParent);s+=i?t.width*n:t.height*n}return s=Math.max(0,s),s}get roots(){return this.Fi}set roots(t){this.Fi!==t&&(this.Fi=t,this.invalidateLayout())}get path(){return this.Li}set path(t){this.Li!==t&&(this.Li=t,this.invalidateLayout())}get treeStyle(){return this._f}set treeStyle(t){this._f!==t&&(t===40||t===42||t===41||t===43)&&(this._f=t,this.invalidateLayout())}get layerStyle(){return this.Ng}set layerStyle(t){this.Ng!==t&&(t===60||t===61||t===62)&&(this.Ng=t,this.invalidateLayout())}get comments(){return this.Fe}set comments(t){this.Fe!==t&&(f.s(t,"boolean",jt,"comments"),this.Fe=t,this.invalidateLayout())}get arrangement(){return this.Xi}set arrangement(t){this.Xi!==t&&(t===50||t===51||t===52)&&(this.Xi=t,this.invalidateLayout())}get arrangementSpacing(){return this.Ms}set arrangementSpacing(t){this.Ms.equals(t)||(this.Ms.a(t),this.invalidateLayout())}get rootDefaults(){return this.U}set rootDefaults(t){this.U!==t&&(this.U=t,this.invalidateLayout())}get alternateDefaults(){return this.B}set alternateDefaults(t){this.B!==t&&(this.B=t,this.invalidateLayout())}get sorting(){return this.U.sorting}set sorting(t){this.U.sorting!==t&&(this.U.sorting=t,this.invalidateLayout())}get comparer(){return this.U.comparer}set comparer(t){this.U.comparer!==t&&(f.k(t,jt,"comparer"),this.U.comparer=t,this.invalidateLayout())}get angle(){return this.U.angle}set angle(t){this.U.angle!==t&&(f.s(t,"number",jt,"angle"),t===0||t===90||t===180||t===270?(this.U.angle=t,this.invalidateLayout()):f.o("TreeLayout.angle must be 0, 90, 180, or 270"))}get alignment(){return this.U.alignment}set alignment(t){this.U.alignment!==t&&(this.U.alignment=t,this.invalidateLayout())}get nodeIndent(){return this.U.nodeIndent}set nodeIndent(t){this.U.nodeIndent!==t&&(f.s(t,"number",jt,"nodeIndent"),t>=0&&(this.U.nodeIndent=t,this.invalidateLayout()))}get nodeIndentPastParent(){return this.U.nodeIndentPastParent}set nodeIndentPastParent(t){this.U.nodeIndentPastParent!==t&&(f.s(t,"number",jt,"nodeIndentPastParent"),t>=0&&t<=1&&(this.U.nodeIndentPastParent=t,this.invalidateLayout()))}get nodeSpacing(){return this.U.nodeSpacing}set nodeSpacing(t){this.U.nodeSpacing!==t&&(f.s(t,"number",jt,"nodeSpacing"),this.U.nodeSpacing=t,this.invalidateLayout())}get layerSpacing(){return this.U.layerSpacing}set layerSpacing(t){this.U.layerSpacing!==t&&(f.s(t,"number",jt,"layerSpacing"),this.U.layerSpacing=t,this.invalidateLayout())}get layerSpacingParentOverlap(){return this.U.layerSpacingParentOverlap}set layerSpacingParentOverlap(t){this.U.layerSpacingParentOverlap!==t&&(f.s(t,"number",jt,"layerSpacingParentOverlap"),t>=0&&t<=1&&(this.U.layerSpacingParentOverlap=t,this.invalidateLayout()))}get compaction(){return this.U.compaction}set compaction(t){this.U.compaction!==t&&(t===30||t===31)&&(this.U.compaction=t,this.invalidateLayout())}get breadthLimit(){return this.U.breadthLimit}set breadthLimit(t){this.U.breadthLimit!==t&&(f.s(t,"number",jt,"breadthLimit"),t>=0&&(this.U.breadthLimit=t,this.invalidateLayout()))}get rowSpacing(){return this.U.rowSpacing}set rowSpacing(t){this.U.rowSpacing!==t&&(f.s(t,"number",jt,"rowSpacing"),this.U.rowSpacing=t,this.invalidateLayout())}get rowIndent(){return this.U.rowIndent}set rowIndent(t){this.U.rowIndent!==t&&(f.s(t,"number",jt,"rowIndent"),t>=0&&(this.U.rowIndent=t,this.invalidateLayout()))}get commentSpacing(){return this.U.commentSpacing}set commentSpacing(t){this.U.commentSpacing!==t&&(f.s(t,"number",jt,"commentSpacing"),this.U.commentSpacing=t,this.invalidateLayout())}get commentMargin(){return this.U.commentMargin}set commentMargin(t){this.U.commentMargin!==t&&(f.s(t,"number",jt,"commentMargin"),this.U.commentMargin=t,this.invalidateLayout())}get setsPortSpot(){return this.U.setsPortSpot}set setsPortSpot(t){this.U.setsPortSpot!==t&&(f.s(t,"boolean",jt,"setsPortSpot"),this.U.setsPortSpot=t,this.invalidateLayout())}get portSpot(){return this.U.portSpot}set portSpot(t){this.U.portSpot.equals(t)||(this.U.portSpot=t,this.invalidateLayout())}get setsChildPortSpot(){return this.U.setsChildPortSpot}set setsChildPortSpot(t){this.U.setsChildPortSpot!==t&&(f.s(t,"boolean",jt,"setsChildPortSpot"),this.U.setsChildPortSpot=t,this.invalidateLayout())}get childPortSpot(){return this.U.childPortSpot}set childPortSpot(t){this.U.childPortSpot.equals(t)||(this.U.childPortSpot=t,this.invalidateLayout())}get alternateSorting(){return this.B.sorting}set alternateSorting(t){this.B.sorting!==t&&(this.B.sorting=t,this.invalidateLayout())}get alternateComparer(){return this.B.comparer}set alternateComparer(t){this.B.comparer!==t&&(f.k(t,jt,"alternateComparer"),this.B.comparer=t,this.invalidateLayout())}get alternateAngle(){return this.B.angle}set alternateAngle(t){this.B.angle!==t&&(f.s(t,"number",jt,"alternateAngle"),(t===0||t===90||t===180||t===270)&&(this.B.angle=t,this.invalidateLayout()))}get alternateAlignment(){return this.B.alignment}set alternateAlignment(t){this.B.alignment!==t&&(this.B.alignment=t,this.invalidateLayout())}get alternateNodeIndent(){return this.B.nodeIndent}set alternateNodeIndent(t){this.B.nodeIndent!==t&&(f.s(t,"number",jt,"alternateNodeIndent"),t>=0&&(this.B.nodeIndent=t,this.invalidateLayout()))}get alternateNodeIndentPastParent(){return this.B.nodeIndentPastParent}set alternateNodeIndentPastParent(t){this.B.nodeIndentPastParent!==t&&(f.s(t,"number",jt,"alternateNodeIndentPastParent"),t>=0&&t<=1&&(this.B.nodeIndentPastParent=t,this.invalidateLayout()))}get alternateNodeSpacing(){return this.B.nodeSpacing}set alternateNodeSpacing(t){this.B.nodeSpacing!==t&&(f.s(t,"number",jt,"alternateNodeSpacing"),this.B.nodeSpacing=t,this.invalidateLayout())}get alternateLayerSpacing(){return this.B.layerSpacing}set alternateLayerSpacing(t){this.B.layerSpacing!==t&&(f.s(t,"number",jt,"alternateLayerSpacing"),this.B.layerSpacing=t,this.invalidateLayout())}get alternateLayerSpacingParentOverlap(){return this.B.layerSpacingParentOverlap}set alternateLayerSpacingParentOverlap(t){this.B.layerSpacingParentOverlap!==t&&(f.s(t,"number",jt,"alternateLayerSpacingParentOverlap"),t>=0&&t<=1&&(this.B.layerSpacingParentOverlap=t,this.invalidateLayout()))}get alternateCompaction(){return this.B.compaction}set alternateCompaction(t){this.B.compaction!==t&&(t===30||t===31)&&(this.B.compaction=t,this.invalidateLayout())}get alternateBreadthLimit(){return this.B.breadthLimit}set alternateBreadthLimit(t){this.B.breadthLimit!==t&&(f.s(t,"number",jt,"alternateBreadthLimit"),t>=0&&(this.B.breadthLimit=t,this.invalidateLayout()))}get alternateRowSpacing(){return this.B.rowSpacing}set alternateRowSpacing(t){this.B.rowSpacing!==t&&(f.s(t,"number",jt,"alternateRowSpacing"),this.B.rowSpacing=t,this.invalidateLayout())}get alternateRowIndent(){return this.B.rowIndent}set alternateRowIndent(t){this.B.rowIndent!==t&&(f.s(t,"number",jt,"alternateRowIndent"),t>=0&&(this.B.rowIndent=t,this.invalidateLayout()))}get alternateCommentSpacing(){return this.B.commentSpacing}set alternateCommentSpacing(t){this.B.commentSpacing!==t&&(f.s(t,"number",jt,"alternateCommentSpacing"),this.B.commentSpacing=t,this.invalidateLayout())}get alternateCommentMargin(){return this.B.commentMargin}set alternateCommentMargin(t){this.B.commentMargin!==t&&(f.s(t,"number",jt,"alternateCommentMargin"),this.B.commentMargin=t,this.invalidateLayout())}get alternateSetsPortSpot(){return this.B.setsPortSpot}set alternateSetsPortSpot(t){this.B.setsPortSpot!==t&&(f.s(t,"boolean",jt,"alternateSetsPortSpot"),this.B.setsPortSpot=t,this.invalidateLayout())}get alternatePortSpot(){return this.B.portSpot}set alternatePortSpot(t){this.B.portSpot.equals(t)||(this.B.portSpot=t,this.invalidateLayout())}get alternateSetsChildPortSpot(){return this.B.setsChildPortSpot}set alternateSetsChildPortSpot(t){this.B.setsChildPortSpot!==t&&(f.s(t,"boolean",jt,"alternateSetsChildPortSpot"),this.B.setsChildPortSpot=t,this.invalidateLayout())}get alternateChildPortSpot(){return this.B.childPortSpot}set alternateChildPortSpot(t){this.B.childPortSpot.equals(t)||(this.B.childPortSpot=t,this.invalidateLayout())}static PathDefault=0;static PathDestination=1;static PathSource=2;static SortingForwards=10;static SortingReverse=11;static SortingAscending=12;static SortingDescending=13;static AlignmentCenterSubtrees=20;static AlignmentCenterChildren=21;static AlignmentStart=22;static AlignmentEnd=23;static AlignmentBus=24;static AlignmentBusBranching=25;static AlignmentTopLeftBus=26;static AlignmentBottomRightBus=27;static CompactionNone=30;static CompactionBlock=31;static StyleLayered=40;static StyleLastParents=41;static StyleAlternating=42;static StyleRootOnly=43;static ArrangementVertical=50;static ArrangementHorizontal=51;static ArrangementFixedRoots=52;static LayerIndividual=60;static LayerSiblings=61;static LayerUniform=62}class Js extends We{constructor(t){super(t)}createVertex(){return new It(this)}createEdge(){return new Gn(this)}}class It extends $e{O;ut;lt;kk;Pk;Sk;Mk;Nk;Ck;Lk;Fe;Cg;Lg;pe;ye;Gt;hi;$y;Zy;Qy;Ns;_y;tw;iw;ew;nw;ow;lw;hw;aw;cw;fw;constructor(t){super(t),this.kk=!1,this.Pk=null,this.Sk=[],this.Mk=0,this.Nk=0,this.Ck=0,this.Lk=0,this.Fe=null,this.O=new P(0,0),this.ut=new Q(0,0),this.lt=new P(0,0),this.Cg=null,this.Lg=null,this.pe=10,this.ye=$e.standardComparer,this.Gt=0,this.hi=21,this.$y=0,this.Zy=0,this.Qy=20,this.Ns=50,this._y=0,this.tw=31,this.iw=0,this.ew=25,this.nw=10,this.ow=10,this.lw=20,this.hw=!0,this.aw=D.Default,this.cw=!0,this.fw=D.Default}copyInheritedPropertiesFrom(t){t!==null&&(this.pe=t.sorting,this.ye=t.comparer,this.Gt=t.angle,this.hi=t.alignment,this.$y=t.nodeIndent,this.Zy=t.nodeIndentPastParent,this.Qy=t.nodeSpacing,this.Ns=t.layerSpacing,this._y=t.layerSpacingParentOverlap,this.tw=t.compaction,this.iw=t.breadthLimit,this.ew=t.rowSpacing,this.nw=t.rowIndent,this.ow=t.commentSpacing,this.lw=t.commentMargin,this.hw=t.setsPortSpot,this.aw=t.portSpot,this.cw=t.setsChildPortSpot,this.fw=t.childPortSpot)}get initialized(){return this.kk}set initialized(t){this.kk!==t&&(f.s(t,"boolean",It,"initialized"),this.kk=t)}get parent(){return this.Pk}set parent(t){this.Pk!==t&&(this.Pk=t)}get children(){return this.Sk}set children(t){if(this.Sk!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",It,"children:value"),t!==null){let e=t.length;for(let i=0;i<e;i++){let s=t[i]}}this.Sk=t}}get level(){return this.Mk}set level(t){this.Mk!==t&&(f.s(t,"number",It,"level"),this.Mk=t)}get descendantCount(){return this.Nk}set descendantCount(t){this.Nk!==t&&(f.s(t,"number",It,"descendantCount"),this.Nk=t)}get maxChildrenCount(){return this.Ck}set maxChildrenCount(t){this.Ck!==t&&(f.s(t,"number",It,"maxChildrenCount"),this.Ck=t)}get maxGenerationCount(){return this.Lk}set maxGenerationCount(t){this.Lk!==t&&(f.s(t,"number",It,"maxGenerationCount"),this.Lk=t)}get comments(){return this.Fe}set comments(t){if(this.Fe!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",It,"comments:value"),t!==null){let e=t.length;for(let i=0;i<e;i++){let s=t[i]}}this.Fe=t}}get sorting(){return this.pe}set sorting(t){this.pe!==t&&(this.pe=t)}get comparer(){return this.ye}set comparer(t){this.ye!==t&&(f.k(t,It,"comparer"),this.ye=t)}get angle(){return this.Gt}set angle(t){this.Gt!==t&&(f.s(t,"number",It,"angle"),this.Gt=t)}get alignment(){return this.hi}set alignment(t){this.hi!==t&&(this.hi=t)}get nodeIndent(){return this.$y}set nodeIndent(t){this.$y!==t&&(f.s(t,"number",It,"nodeIndent"),this.$y=t)}get nodeIndentPastParent(){return this.Zy}set nodeIndentPastParent(t){this.Zy!==t&&(f.s(t,"number",It,"nodeIndentPastParent"),this.Zy=t)}get nodeSpacing(){return this.Qy}set nodeSpacing(t){this.Qy!==t&&(f.s(t,"number",It,"nodeSpacing"),this.Qy=t)}get layerSpacing(){return this.Ns}set layerSpacing(t){this.Ns!==t&&(f.s(t,"number",It,"layerSpacing"),this.Ns=t)}get layerSpacingParentOverlap(){return this._y}set layerSpacingParentOverlap(t){this._y!==t&&(f.s(t,"number",It,"layerSpacingParentOverlap"),this._y=t)}get compaction(){return this.tw}set compaction(t){this.tw!==t&&(this.tw=t)}get breadthLimit(){return this.iw}set breadthLimit(t){this.iw!==t&&(f.s(t,"number",It,"breadthLimit"),this.iw=t)}get rowSpacing(){return this.ew}set rowSpacing(t){this.ew!==t&&(f.s(t,"number",It,"rowSpacing"),this.ew=t)}get rowIndent(){return this.nw}set rowIndent(t){this.nw!==t&&(f.s(t,"number",It,"rowIndent"),this.nw=t)}get commentSpacing(){return this.ow}set commentSpacing(t){this.ow!==t&&(f.s(t,"number",It,"commentSpacing"),this.ow=t)}get commentMargin(){return this.lw}set commentMargin(t){this.lw!==t&&(f.s(t,"number",It,"commentMargin"),this.lw=t)}get setsPortSpot(){return this.hw}set setsPortSpot(t){this.hw!==t&&(f.s(t,"boolean",It,"setsPortSpot"),this.hw=t)}get portSpot(){return this.aw}set portSpot(t){this.aw.equals(t)||(this.aw=t)}get setsChildPortSpot(){return this.cw}set setsChildPortSpot(t){this.cw!==t&&(f.s(t,"boolean",It,"setsChildPortSpot"),this.cw=t)}get childPortSpot(){return this.fw}set childPortSpot(t){this.fw.equals(t)||(this.fw=t)}get childrenCount(){return this.children.length}get relativePosition(){return this.O}set relativePosition(t){this.O.set(t)}get subtreeSize(){return this.ut}set subtreeSize(t){this.ut.set(t)}get subtreeOffset(){return this.lt}set subtreeOffset(t){this.lt.set(t)}}class Gn extends mi{Ak;constructor(t){super(t),this.Ak=new P(0,0)}commit(){let t=this.link;if(t===null||t.isAvoiding)return;let e=this.network.layout,i=null,s=null;switch(e.ls){case 1:i=this.fromVertex,s=this.toVertex;break;case 2:i=this.toVertex,s=this.fromVertex;break;default:f.o("Unhandled path value "+e.ls.toString())}if(i===null||s===null)return;let n=this.Ak;if(n.x===0&&n.y===0){this.aE(i,s);return}let o=i.bounds,r=e.orthoAngle(i),a=e.computeLayerSpacing(i),h=i.rowSpacing;t.updateRoute();let l=t.curve===9,c=t.isOrthogonal,u=0,d,g;if(t.startRoute(),c||l){for(u=2;t.pointsCount>4;)t.removePoint(2);d=t.getPoint(1),g=t.getPoint(2)}else{for(u=1;t.pointsCount>3;)t.removePoint(1);d=t.getPoint(0),g=t.getPoint(t.pointsCount-1)}let p=t.getPoint(t.pointsCount-1),m=0;r===0?(i.alignment===23?(m=o.bottom+n.y,n.y===0&&d.y>p.y+i.rowIndent&&(m=Math.min(m,Math.max(d.y,m-e.computeNodeIndent(i))))):i.alignment===22?(m=o.top+n.y,n.y===0&&d.y<p.y-i.rowIndent&&(m=Math.max(m,Math.min(d.y,m+e.computeNodeIndent(i))))):m=o.y+o.height/2+n.y,l?(t.insertPointAt(u,d.x,m),u++,t.insertPointAt(u,o.right+a,m),u++,t.insertPointAt(u,o.right+a+(n.x-h)/3,m),u++,t.insertPointAt(u,o.right+a+(n.x-h)*2/3,m),u++,t.insertPointAt(u,o.right+a+(n.x-h),m),u++,t.insertPointAt(u,g.x,m),u++):(c&&(t.insertPointAt(u,o.right+a/2,d.y),u++),t.insertPointAt(u,o.right+a/2,m),u++,t.insertPointAt(u,o.right+a+n.x-(c?h/2:h),m),u++,c&&(t.insertPointAt(u,t.getPoint(u-1).x,g.y),u++))):r===90?(i.alignment===23?(m=o.right+n.x,n.x===0&&d.x>p.x+i.rowIndent&&(m=Math.min(m,Math.max(d.x,m-e.computeNodeIndent(i))))):i.alignment===22?(m=o.left+n.x,n.x===0&&d.x<p.x-i.rowIndent&&(m=Math.max(m,Math.min(d.x,m+e.computeNodeIndent(i))))):m=o.x+o.width/2+n.x,l?(t.insertPointAt(u,m,d.y),u++,t.insertPointAt(u,m,o.bottom+a),u++,t.insertPointAt(u,m,o.bottom+a+(n.y-h)/3),u++,t.insertPointAt(u,m,o.bottom+a+(n.y-h)*2/3),u++,t.insertPointAt(u,m,o.bottom+a+(n.y-h)),u++,t.insertPointAt(u,m,g.y),u++):(c&&(t.insertPointAt(u,d.x,o.bottom+a/2),u++),t.insertPointAt(u,m,o.bottom+a/2),u++,t.insertPointAt(u,m,o.bottom+a+n.y-(c?h/2:h)),u++,c&&(t.insertPointAt(u,g.x,t.getPoint(u-1).y),u++))):r===180?(i.alignment===23?(m=o.bottom+n.y,n.y===0&&d.y>p.y+i.rowIndent&&(m=Math.min(m,Math.max(d.y,m-e.computeNodeIndent(i))))):i.alignment===22?(m=o.top+n.y,n.y===0&&d.y<p.y-i.rowIndent&&(m=Math.max(m,Math.min(d.y,m+e.computeNodeIndent(i))))):m=o.y+o.height/2+n.y,l?(t.insertPointAt(u,d.x,m),u++,t.insertPointAt(u,o.left-a,m),u++,t.insertPointAt(u,o.left-a+(n.x+h)/3,m),u++,t.insertPointAt(u,o.left-a+(n.x+h)*2/3,m),u++,t.insertPointAt(u,o.left-a+(n.x+h),m),u++,t.insertPointAt(u,g.x,m),u++):(c&&(t.insertPointAt(u,o.left-a/2,d.y),u++),t.insertPointAt(u,o.left-a/2,m),u++,t.insertPointAt(u,o.left-a+n.x+(c?h/2:h),m),u++,c&&(t.insertPointAt(u,t.getPoint(u-1).x,g.y),u++))):r===270?(i.alignment===23?(m=o.right+n.x,n.x===0&&d.x>p.x+i.rowIndent&&(m=Math.min(m,Math.max(d.x,m-e.computeNodeIndent(i))))):i.alignment===22?(m=o.left+n.x,n.x===0&&d.x<p.x-i.rowIndent&&(m=Math.max(m,Math.min(d.x,m+e.computeNodeIndent(i))))):m=o.x+o.width/2+n.x,l?(t.insertPointAt(u,m,d.y),u++,t.insertPointAt(u,m,o.top-a),u++,t.insertPointAt(u,m,o.top-a+(n.y+h)/3),u++,t.insertPointAt(u,m,o.top-a+(n.y+h)*2/3),u++,t.insertPointAt(u,m,o.top-a+(n.y+h)),u++,t.insertPointAt(u,m,g.y),u++):(c&&(t.insertPointAt(u,d.x,o.top-a/2),u++),t.insertPointAt(u,m,o.top-a/2),u++,t.insertPointAt(u,m,o.top-a+n.y+(c?h/2:h)),u++,c&&(t.insertPointAt(u,g.x,t.getPoint(u-1).y),u++))):f.o("Invalid angle "+r),t.commitRoute()}aE(t,e){let i=this.link;if(i===null)return;let s=this.network.layout,n=s.orthoAngle(t),o=s.orthoAngle(e);if(n===o)return;let r=s.computeLayerSpacing(t),a=t.bounds,h=e.bounds;if(n===0&&h.left-a.right<r+1||n===90&&h.top-a.bottom<r+1||n===180&&a.left-h.right<r+1||n===270&&a.top-h.bottom<r+1)return;i.updateRoute();let l=i.curve===9,c=i.isOrthogonal,u=this.fromVertex,d=s.isBusAlignment(u.alignment);if(i.startRoute(),n===0){let g=a.right+r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).y;i.setPointAt(1,g-20,i.getPoint(1).y),i.insertPointAt(2,g-20,p),i.insertPointAt(3,g,p),i.insertPointAt(4,g+20,p),i.setPointAt(5,i.getPoint(5).x,p)}}else c?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,g,i.getPoint(2).y),i.setPointAt(3,g,i.getPoint(3).y)):i.pointsCount===4?i.insertPointAt(2,g,i.getPoint(2).y):i.pointsCount===3?i.setPointAt(1,g,i.getPoint(2).y):i.pointsCount===2&&i.insertPointAt(1,g,i.getPoint(1).y)}else if(n===90){let g=a.bottom+r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).x;i.setPointAt(1,i.getPoint(1).x,g-20),i.insertPointAt(2,p,g-20),i.insertPointAt(3,p,g),i.insertPointAt(4,p,g+20),i.setPointAt(5,p,i.getPoint(5).y)}}else c?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,i.getPoint(2).x,g),i.setPointAt(3,i.getPoint(3).x,g)):i.pointsCount===4?i.insertPointAt(2,i.getPoint(2).x,g):i.pointsCount===3?i.setPointAt(1,i.getPoint(2).x,g):i.pointsCount===2&&i.insertPointAt(1,i.getPoint(1).x,g)}else if(n===180){let g=a.left-r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).y;i.setPointAt(1,g+20,i.getPoint(1).y),i.insertPointAt(2,g+20,p),i.insertPointAt(3,g,p),i.insertPointAt(4,g-20,p),i.setPointAt(5,i.getPoint(5).x,p)}}else c?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,g,i.getPoint(2).y),i.setPointAt(3,g,i.getPoint(3).y)):i.pointsCount===4?i.insertPointAt(2,g,i.getPoint(2).y):i.pointsCount===3?i.setPointAt(1,g,i.getPoint(2).y):i.pointsCount===2&&i.insertPointAt(1,g,i.getPoint(1).y)}else if(n===270){let g=a.top-r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).x;i.setPointAt(1,i.getPoint(1).x,g+20),i.insertPointAt(2,p,g+20),i.insertPointAt(3,p,g),i.insertPointAt(4,p,g-20),i.setPointAt(5,p,i.getPoint(5).y)}}else c?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,i.getPoint(2).x,g),i.setPointAt(3,i.getPoint(3).x,g)):i.pointsCount===4?i.insertPointAt(2,i.getPoint(2).x,g):i.pointsCount===3?i.setPointAt(1,i.getPoint(2).x,g):i.pointsCount===2&&i.insertPointAt(1,i.getPoint(1).x,g)}i.commitRoute()}get fromVertex(){return this.He}set fromVertex(t){this.He!==t&&(this.He=t)}get toVertex(){return this.qe}set toVertex(t){this.qe!==t&&(this.qe=t)}get relativePoint(){return this.Ak}set relativePoint(t){this.Ak.set(t)}}class Le{constructor(){}static Light={colors:{text:"#0a0a0a",comment:"#ca8a04",link:"#0a0a0a",group:"#a3a3a344",outline:"#a3a3a3",selection:"#0ea5e9",div:"#fff",gridMinor:"#e5e5e5",gridMajor:"#a3a3a3",overviewBox:"#c026d3",tempLink:"#2563eb",tempPort:"#c026d3",adornmentFill:"#0ea5e9",adornmentStroke:"#1e40af",dragSelect:"#c026d3"},fonts:{normal:"10pt sans-serif",bold:"bold 12pt sans-serif"},numbers:{group:1,selection:3},margins:{group:new Lt(5)},arrowheads:{toArrow:"Standard"}};static Dark={colors:{text:"#f5f5f5",comment:"#facc15",link:"#f5f5f5",group:"#a3a3a388",outline:"#a3a3a3",selection:"#38bdf8",div:"#171717",gridMinor:"#262626",gridMajor:"#404040",overviewBox:"#e879f9",tempLink:"#60a5fa",tempPort:"#e879f9",adornmentFill:"#38bdf8",adornmentStroke:"#2563eb",dragSelect:"#e879f9"},fonts:{normal:"10pt sans-serif",bold:"bold 12pt sans-serif"},numbers:{group:1,selection:3},margins:{group:new Lt(5)},arrowheads:{toArrow:"Standard"}}}class ai{ts=new Set;iu=new pt;Tk="light";Dk="light";Fk=!1;Ag="light";HD=t=>{let e=t.matches?"dark":"light";e!==this.Ag&&(this.Ag=e,this.Dk==="system"&&this.uw())};constructor(t){t&&Object.assign(this,t),t?.themeMap||(this.iu.set("light",{colors:{...Le.Light.colors},fonts:{...Le.Light.fonts},numbers:{...Le.Light.numbers},margins:{...Le.Light.margins},arrowheads:{...Le.Light.arrowheads}}),this.iu.set("dark",{colors:{...Le.Dark.colors},fonts:{...Le.Dark.fonts},numbers:{...Le.Dark.numbers},margins:{...Le.Dark.margins},arrowheads:{...Le.Dark.arrowheads}})),A.matchMedia&&(this.Ag=A.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}get themeMap(){return this.iu}set themeMap(t){this.iu!==t&&(this.iu=t,this.uw())}get defaultTheme(){return this.Tk}set defaultTheme(t){this.Tk!==t&&(f.s(t,"string",ai,"defaultTheme"),this.Tk=t,this.uw())}get currentTheme(){return this.Dk}set currentTheme(t){this.Dk!==t&&(f.s(t,"string",ai,"currentTheme"),this.Dk=t,this.uw())}get changesDivBackground(){return this.Fk}set changesDivBackground(t){if(this.Fk!==t&&(this.Fk=t,t))for(let e of this.ts)e.setDivBackground(this.findValue("div","","fill")),e.D("ThemeChanged",this)}get preferredColorScheme(){return this.Ag}addDiagram(t){return this.ts.add(t),this.cC(t),this}removeDiagram(t){return this.ts.delete(t),this.cC(t),this}hR(){this.ts.size===0&&A.matchMedia&&A.matchMedia("(prefers-color-scheme: dark)")?.addEventListener("change",this.HD)}aR(){this.ts.size===0&&A.matchMedia&&A.matchMedia("(prefers-color-scheme: dark)")?.removeEventListener("change",this.HD)}set(t,e){t===""&&(t=this.Tk),t==="system"&&(t=this.Ag);let i=this.iu.get(t);return i?i=this.qD(i,e):i=e,this.iu.set(t,i),this.uw(),this}findValue(t,e,i){return this.getValue(this.findTheme(this.currentTheme),t,e,i)||this.getValue(this.findTheme(this.defaultTheme),t,e,i)}getValue(t,e,i,s){if(!t)return;i==null&&(i="");let n=t,o=a=>{if(n===void 0||a==="")return;if(typeof a=="number"||!(Array.isArray(a)||a.includes(".")))return n[a];let h=Array.isArray(a)?a:a.split(".");for(let l=0;l<h.length;l++){let c=h[l];if(c!==""&&(n=n[c],n===void 0))return}return n},r=()=>{if(!(i!==""&&(n=o(i),n===void 0)))return Array.isArray(n)&&typeof e=="number"?n=n[e%n.length]:n=o(e),n};if(n=r(),n===void 0&&typeof s=="string"&&s.length>0){let a=t.targetPropertyMap?.get(s);if(a?n=t[a]:(a=ai.cE.get(s),n=a?t[a]:t.colors),n=r(),n!==void 0)return n}return n}findTheme(t){return this.themeMap.get(t==="system"?this.Ag:t)}cC(t){let e=t.skipsUndoManager;t.skipsUndoManager=!0,t.updateAllThemeBindings(),this.Fk&&t.setDivBackground(this.findValue("div","","fill")),t.skipsUndoManager=e,t.D("ThemeChanged",this)}uw(){for(let t of this.ts)this.cC(t)}qD(t,e){for(let i in e)if(f.dw(e,i))try{e[i].constructor===Object?t[i]=this.qD(t[i]??{},e[i]):t[i]=e[i]}catch{delete t[i]}return t}static cE=new Map([["background","colors"],["defaultColumnSeparatorStroke","colors"],["defaultRowSeparatorStroke","colors"],["shadowColor","colors"],["fill","colors"],["stroke","colors"],["font","fonts"],["angle","numbers"],["fromEndSegmentLength","numbers"],["fromShortLength","numbers"],["height","numbers"],["opacity","numbers"],["scale","numbers"],["toEndSegmentLength","numbers"],["toShortLength","numbers"],["width","numbers"],["defaultColumnSeparatorStrokeWidth","numbers"],["defaultRowSeparatorStrokeWidth","numbers"],["shadowBlur","numbers"],["corner","numbers"],["curviness","numbers"],["smoothness","numbers"],["parameter1","numbers"],["parameter2","numbers"],["strokeWidth","numbers"],["strokeDashOffset","numbers"],["maxLines","numbers"],["spacingAbove","numbers"],["spacingBelow","numbers"],["position","points"],["shadowOffset","points"],["desiredSize","sizes"],["maxSize","sizes"],["minSize","sizes"],["margin","margins"],["defaultSeparatorPadding","margins"],["padding","margins"],["alignment","spots"],["alignmentFocus","spots"],["fromSpot","spots"],["toSpot","spots"],["defaultAlignment","spots"],["spot1","spots"],["spot2","spots"],["verticalAlignment","spots"],["imageAlignment","spots"],["fromArrow","arrowheads"],["toArrow","arrowheads"]])}class Un{Pt;N;Oi;cl;constructor(){this.N=q.um(),this.Pt="",this.Oi=!0,this.cl=!0}get name(){return this.Pt}set name(t){this.Pt=t}get isEnabled(){return this.Oi}set isEnabled(t){this.Oi=t}get isRealtime(){return this.cl}set isRealtime(t){this.cl=t}get diagram(){return this.N}set diagram(t){this.N!==t&&(this.N=t,t.bl=!0,t.requestUpdate())}invalidateRouter(){this.N!==null&&(this.N.bl=!0,this.N.requestUpdate())}canRoute(t){if(!this.isEnabled)return!1;let e=this.diagram;return!(e&&(!this.isRealtime&&e.gu||e.animationManager.isTicking))}routeLinks(t,e){}toString(){return this.name!==""?this.name+" Router":f.Dn(this.constructor)}}class br extends Un{constructor(t){super(),this.name="AvoidsNodes",t&&Object.assign(this,t)}canRoute(t){return(t instanceof q?t.Vm:t.diagram.Vm)?super.canRoute(t):!1}routeLinks(t,e){let i=e instanceof q?null:e,s=t.iterator,n=this.diagram.getPositions(!0,i,null);for(;s.next();){let o=s.value;if(!o.isAvoiding||o.containingGroup!==i||o.toNode===null||o.fromNode===null||o.pointsCount<4)continue;o.startRoute();let r=o.pointsCount,a=o.getPoint(1),h=o.getPoint(r-2),l=o.fromNode.actualBounds.copy();l.inflate(_.Ua,_.Ua),l.unionPoint(o.getPoint(0));let c=o.toNode.actualBounds.copy();c.inflate(_.Ua,_.Ua),c.unionPoint(o.getPoint(r-1)),this.fE(o,l,c,n)&&this.uE(o,a,o.dN,h,o.gN,l,c,n),o.commitRoute()}}fE(t,e,i,s){let n=t.diagram,o=t.pointsCount;if(n===null||t.fromNode===t.toNode||t.layer.isTemporary||e.containsPoint(t.getPoint(o-1))&&!t.toNode.isMemberOf(t.fromNode)||i.containsPoint(t.getPoint(0))&&!t.fromNode.isMemberOf(t.toNode)||!t.isOrthogonal)return!1;if(t.segmentIndex===17)return!0;let r=t.getPoint(1),a=t.getPoint(o-2),h=t.getPoint(2);if(!s.isUnoccupied(Math.min(r.x,h.x),Math.min(r.y,h.y),Math.abs(r.x-h.x),Math.abs(r.y-h.y)))return!0;for(let c=2;c<o-3;c++){let u=t.getPoint(c),d=t.getPoint(c+1);if(!s.isUnoccupied(Math.min(u.x,d.x),Math.min(u.y,d.y),Math.abs(u.x-d.x),Math.abs(u.y-d.y)))return!0}let l=t.getPoint(o-3);return!s.isUnoccupied(Math.min(l.x,a.x),Math.min(l.y,a.y),Math.abs(l.x-a.x),Math.abs(l.y-a.y))}uE(t,e,i,s,n,o,r,a){let h=t.diagram,l=e,c=s,u=null,d=null;if(h.isVirtualized){let m=a.bounds.copy(),y=t.getPoint(2),w=t.getPoint(t.pointsCount-3);m.inflate(-a.cellWidth,-a.cellHeight);let b=P.l();a.vd(e.x,e.y)||(L.gl(m.x,m.y,m.x+m.width,m.y+m.height,e.x,e.y,y.x,y.y,b)?(u=e=b.copy(),i=b.directionPoint(y)):L.gl(m.x,m.y,m.x+m.width,m.y+m.height,y.x,y.y,w.x,w.y,b)?(u=e=b.copy(),i=b.directionPoint(w)):L.gl(m.x,m.y,m.x+m.width,m.y+m.height,w.x,w.y,s.x,s.y,b)&&(u=e=b.copy(),i=b.directionPoint(s))),a.vd(s.x,s.y)||(L.gl(m.x,m.y,m.x+m.width,m.y+m.height,s.x,s.y,w.x,w.y,b)?(d=s=b.copy(),n=w.directionPoint(b)):L.gl(m.x,m.y,m.x+m.width,m.y+m.height,w.x,w.y,y.x,y.y,b)?(d=s=b.copy(),n=y.directionPoint(b)):L.gl(m.x,m.y,m.x+m.width,m.y+m.height,y.x,y.y,e.x,e.y,b)&&(d=s=b.copy(),n=e.directionPoint(b))),P.e(b)}let g=o.copy().unionRect(r);g.inflate(a.cellWidth*a.Yc,a.cellHeight*a.Yc),a.CT(e,i,s,n,g,!0);let p=a.lo(s.x,s.y);if(!a.by&&p>=Et.Rd&&(a.lA(),g.inflate(a.cellWidth*a.HM,a.cellHeight*a.qM),a.CT(e,i,s,n,g,!1),p=a.lo(s.x,s.y)),!a.by&&p<Et.Rd&&!a.DO(s.x,s.y)){t.points.removeRange(2,t.pointsCount-3),this.fC(t,a,s.x,s.y,n,!0);let m=0,y=90,w=180,b=270,v=t.getPoint(2);if(t.pointsCount<4)i===m||i===w?(v.x=e.x,v.y=s.y):(v.x=s.x,v.y=e.y),t.setPointAt(2,v.x,v.y),t.insertPointAt(3,v.x,v.y);else{let k=t.getPoint(3);if(i===m||i===w)if(L.f(v.x,k.x)){let S=i===m?Math.max(v.x,e.x):Math.min(v.x,e.x);t.setPointAt(2,S,e.y),t.setPointAt(3,S,k.y)}else L.f(v.y,k.y)?(Math.abs(e.y-v.y)<=a.cellHeight/2&&(t.setPointAt(2,v.x,e.y),t.setPointAt(3,k.x,e.y)),t.insertPointAt(2,v.x,e.y)):t.setPointAt(2,e.x,v.y);else if(i===y||i===b)if(L.f(v.y,k.y)){let S=i===y?Math.max(v.y,e.y):Math.min(v.y,e.y);t.setPointAt(2,e.x,S),t.setPointAt(3,k.x,S)}else L.f(v.x,k.x)?(Math.abs(e.x-v.x)<=a.cellWidth/2&&(t.setPointAt(2,e.x,v.y),t.setPointAt(3,e.x,k.y)),t.insertPointAt(2,e.x,v.y)):t.setPointAt(2,v.x,e.y)}if(u!==null){let k=t.getPoint(1),S=t.getPoint(2);k.x!==S.x&&k.y!==S.y?i===m||i===w?t.insertPointAt(2,k.x,S.y):t.insertPointAt(2,S.x,k.y):i===m||i===w?t.insertPointAt(2,l.x,u.y):t.insertPointAt(2,u.x,l.y)}d!==null&&(n===m||n===w?t.insertPointAt(t.pointsCount-2,c.x,d.y):t.insertPointAt(t.pointsCount-2,d.x,c.y))}}fC(t,e,i,s,n,o){let r=e.cellWidth,a=e.cellHeight,h=e.lo(i,s),l=i,c=s,u=l,d=c;for(n===0?u+=r:n===90?d+=a:n===180?u-=r:d-=a,t.yN&&h>Et.Xa&&e.lo(u,d)!==h-1&&(e.lo(l-r,c)===h-1?(n=180,u=l-r,d=c):e.lo(l+r,c)===h-1?(n=0,u=l+r,d=c):e.lo(l,c-a)===h-1?(n=270,u=l,d=c-a):e.lo(l,c+a)===h-1&&(n=90,u=l,d=c+a));h>Et.Xa&&e.lo(u,d)===h-1;)l=u,c=d,n===0?u+=r:n===90?d+=a:n===180?u-=r:d-=a,h-=1;if(o?h>Et.Xa&&(n===180||n===0?l=Math.floor(l/r)*r+r/2:(n===90||n===270)&&(c=Math.floor(c/a)*a+a/2)):(l=Math.floor(l/r)*r+r/2,c=Math.floor(c/a)*a+a/2),h>Et.Xa){let g=n,p=l,m=c;if(n===0?(g=90,m+=a):n===90?(g=180,p-=r):n===180?(g=270,m-=a):n===270&&(g=0,p+=r),e.lo(p,m)===h-1)this.fC(t,e,p,m,g,!1);else{let y=l,w=c;n===0?(g=270,w-=a):n===90?(g=0,y+=r):n===180?(g=90,w+=a):n===270&&(g=180,y-=r),e.lo(y,w)===h-1&&this.fC(t,e,y,w,g,!1)}}t.insertPointAt(t.pointsCount-2,l,c)}}xe.prototype.initializeStandardTools=function(){this.Jt("Action",new bn,this.mouseDownTools),this.Jt("Relinking",new ys,this.mouseDownTools),this.Jt("LinkReshaping",new Ji,this.mouseDownTools),this.Jt("Rotating",new si,this.mouseDownTools),this.Jt("Resizing",new Ti,this.mouseDownTools),this.Jt("Linking",new Li,this.mouseMoveTools),this.Jt("Dragging",new Dt,this.mouseMoveTools),this.Jt("DragSelecting",new Di,this.mouseMoveTools),this.Jt("Panning",new Zi,this.mouseMoveTools),this.Jt("ContextMenu",new qt,this.mouseUpTools),this.Jt("TextEditing",new me,this.mouseUpTools),this.Jt("ClickCreating",new di,this.mouseUpTools),this.Jt("ClickSelecting",new wn,this.mouseUpTools)},q.CM("GraphLinksModel",xr),q.CM("TreeModel",wr);let ns=A.go,Vi={get version(){return q.version},Group:ft,List:G,Set:I,Map:pt,Point:P,Size:Q,Rect:z,Margin:Lt,Spot:D,Geometry:kt,PathFigure:$t,PathSegment:vt,InputEvent:Ye,DiagramEvent:Wi,ChangedEvent:ii,Model:yt,GraphLinksModel:Xt,TreeModel:Je,Binding:oe,ThemeBinding:pi,Transaction:Ai,UndoManager:$i,CommandHandler:be,Tool:ee,DraggingTool:Dt,DraggingInfo:ni,DraggingOptions:Qi,LinkingBaseTool:Ge,LinkingTool:Li,RelinkingTool:ys,LinkReshapingTool:Ji,ResizingTool:Ti,RotatingTool:si,ClickSelectingTool:wn,ActionTool:bn,ClickCreatingTool:di,HTMLInfo:Ne,ContextMenuTool:qt,DragSelectingTool:Di,PanningTool:Zi,TextEditingTool:me,ToolManager:xe,Animation:Ce,AnimationManager:pe,AnimationTrigger:Fi,Layer:Vt,Diagram:q,Palette:er,Overview:_i,Brush:E,GraphObject:dt,Panel:H,RowColumnDefinition:Yt,Shape:ct,TextBlock:xt,Picture:zt,Part:Nt,Adornment:St,Node:rt,Link:_,Placeholder:ve,Layout:ne,LayoutNetwork:We,LayoutVertex:$e,LayoutEdge:mi,GridLayout:ri,PanelLayout:Ft,CircularLayout:Ze,CircularNetwork:In,CircularVertex:Ii,CircularEdge:Bn,ForceDirectedLayout:re,ForceDirectedNetwork:Vn,ForceDirectedVertex:Qe,ForceDirectedEdge:Bi,LayeredDigraphLayout:_e,LayeredDigraphNetwork:jn,LayeredDigraphVertex:Xe,LayeredDigraphEdge:Ee,TreeLayout:jt,TreeNetwork:Js,TreeVertex:It,TreeEdge:Gn,Themes:Le,ThemeManager:ai,Router:Un,AnimationStyle:Pn,AutoScale:xs,CycleMode:Nn,Flip:Ln,TextFormat:Ps,ImageStretch:Ns,LayoutConditions:On,LinkAdjusting:Ls,Curve:Ds,Routing:Ts,Orientation:bs,TextOverflow:Fn,PortSpreading:Rn,ScrollMode:Cn,CollapsePolicy:An,Sizing:vs,TriggerStart:Mn,Stretch:ws,ViewboxStretch:Dn,Wrap:Ss,BrushType:qe,ColorSpace:Tn,GeometryStretch:ms,GeometryType:ei,SegmentType:Ci,BindingMode:ss,ChangeType:ps,CircularArrangement:Is,CircularDirection:Bs,CircularNodeDiameterFormula:zs,CircularSorting:Vs,GridAlignment:Os,GridArrangement:Rs,GridSorting:Es,LayeredDigraphAggressive:Ys,LayeredDigraphAlign:Xn,LayeredDigraphCycleRemove:Ks,LayeredDigraphInit:js,LayeredDigraphLayering:Xs,LayeredDigraphPack:Kn,TreeAlignment:qs,TreeArrangement:$s,TreeCompaction:Hs,TreeLayerStyle:Yn,TreePath:Gs,TreeSorting:Us,TreeStyle:Ws,GestureMode:pn,LinkingDirection:yn,ReshapingBehavior:xn,TextEditingAccept:vn,TextEditingStarting:kn,TextEditingState:Sn,WheelMode:mn};for(let x in Vi){let t=Vi[x];f.it(t)&&t!==Ps&&(t.className=x)}f.Y(ns)&&ns.version&&f.ni("WARNING: a `go` object on the root object is already defined. "+("Debug"in ns?"debug ":"")+"version: "+ns.version+", replaced with version: "+Vi.version),q.prototype.go=Vi,A.go=Vi})();var ka=typeof global<"u"?global.go:self.go,Z=typeof global<"u"?global.go:self.go,Sa=Z.Group,Pa=Z.List,Ma=Z.Set;var Na=Z.Map;var Qn=Z.Point,Ki=Z.Size,Ca=Z.Rect,_s=Z.Margin,Be=Z.Spot,Aa=Z.Geometry,La=Z.PathFigure,Ta=Z.PathSegment,Da=Z.InputEvent,Fa=Z.DiagramEvent,Oa=Z.ChangedEvent,Ra=Z.Model,_n=Z.GraphLinksModel,Ea=Z.TreeModel,Ia=Z.Binding,Ba=Z.ThemeBinding,Va=Z.Transaction,za=Z.UndoManager,Ka=Z.CommandHandler,Xa=Z.Tool,ja=Z.DraggingTool,Ya=Z.DraggingInfo,Ga=Z.DraggingOptions,Ua=Z.LinkingBaseTool,qa=Z.LinkingTool,Ha=Z.RelinkingTool,Wa=Z.LinkReshapingTool,$a=Z.ResizingTool,Ja=Z.RotatingTool,Za=Z.ClickSelectingTool,Qa=Z.ActionTool,_a=Z.ClickCreatingTool,th=Z.HTMLInfo,eh=Z.ContextMenuTool,ih=Z.DragSelectingTool,sh=Z.PanningTool,nh=Z.TextEditingTool,oh=Z.ToolManager,tn=Z.Animation,rh=Z.AnimationManager,ah=Z.AnimationTrigger,hh=Z.Layer,en=Z.Diagram,lh=Z.Palette,ch=Z.Overview,uh=Z.Brush,dh=Z.GraphObject,hi=Z.Panel,fh=Z.RowColumnDefinition,Xi=Z.Shape,os=Z.TextBlock,to=Z.Picture,gh=Z.Part,sn=Z.Adornment,nn=Z.Node,eo=Z.Link,io=Z.Placeholder,mh=Z.Layout,ph=Z.LayoutNetwork,yh=Z.LayoutVertex,xh=Z.LayoutEdge,wh=Z.GridLayout,bh=Z.PanelLayout,vh=Z.CircularLayout,kh=Z.CircularNetwork,Sh=Z.CircularVertex,Ph=Z.CircularEdge,Mh=Z.ForceDirectedLayout,Nh=Z.ForceDirectedNetwork,Ch=Z.ForceDirectedVertex,Ah=Z.ForceDirectedEdge,so=Z.LayeredDigraphLayout,Lh=Z.LayeredDigraphNetwork,Th=Z.LayeredDigraphVertex,Dh=Z.LayeredDigraphEdge,Fh=Z.TreeLayout,Oh=Z.TreeNetwork,Rh=Z.TreeVertex,Eh=Z.TreeEdge,Ih=Z.Themes,Bh=Z.ThemeManager,Vh=Z.Router,zh=Z.version,Kh=Z.AnimationStyle,no=Z.AutoScale,Xh=Z.Curve,jh=Z.CycleMode,Yh=Z.Flip,Gh=Z.ImageStretch,Uh=Z.LayoutConditions,qh=Z.LinkAdjusting,Hh=Z.Orientation,Wh=Z.PortSpreading,oo=Z.Routing,ro=Z.ScrollMode,$h=Z.CollapsePolicy,Jh=Z.Sizing,Zh=Z.TriggerStart,ao=Z.Stretch,Qh=Z.TextFormat,on=Z.TextOverflow,_h=Z.ViewboxStretch,rn=Z.Wrap,tl=Z.BrushType,el=Z.ColorSpace,il=Z.GeometryStretch,sl=Z.GeometryType,nl=Z.SegmentType,ol=Z.BindingMode,rl=Z.ChangeType,al=Z.CircularArrangement,hl=Z.CircularDirection,ll=Z.CircularNodeDiameterFormula,cl=Z.CircularSorting,ul=Z.GridAlignment,dl=Z.GridArrangement,fl=Z.GridSorting,gl=Z.LayeredDigraphAggressive,ml=Z.LayeredDigraphAlign,pl=Z.LayeredDigraphCycleRemove,yl=Z.LayeredDigraphInit,xl=Z.LayeredDigraphLayering,wl=Z.LayeredDigraphPack,bl=Z.TreeAlignment,vl=Z.TreeArrangement,kl=Z.TreeCompaction,Sl=Z.TreeLayerStyle,Pl=Z.TreePath,Ml=Z.TreeSorting,Nl=Z.TreeStyle,Cl=Z.GestureMode,Al=Z.LinkingDirection,Ll=Z.ReshapingBehavior,Tl=Z.TextEditingAccept,Dl=Z.TextEditingStarting,Fl=Z.TextEditingState,ho=Z.WheelMode;var kr=!1;function Sr(A){if(A.sheet)return A.sheet;for(var f=0;f<document.styleSheets.length;f++)if(document.styleSheets[f].ownerNode===A)return document.styleSheets[f]}function Pr(A){var f=document.createElement("style");return f.setAttribute("data-emotion",A.key),A.nonce!==void 0&&f.setAttribute("nonce",A.nonce),f.appendChild(document.createTextNode("")),f.setAttribute("data-s",""),f}var lo=function(){function A(V){var K=this;this._insertTag=function(W){var $;K.tags.length===0?K.insertionPoint?$=K.insertionPoint.nextSibling:K.prepend?$=K.container.firstChild:$=K.before:$=K.tags[K.tags.length-1].nextSibling,K.container.insertBefore(W,$),K.tags.push(W)},this.isSpeedy=V.speedy===void 0?!kr:V.speedy,this.tags=[],this.ctr=0,this.nonce=V.nonce,this.key=V.key,this.container=V.container,this.prepend=V.prepend,this.insertionPoint=V.insertionPoint,this.before=null}var f=A.prototype;return f.hydrate=function(K){K.forEach(this._insertTag)},f.insert=function(K){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Pr(this));var W=this.tags[this.tags.length-1];if(this.isSpeedy){var $=Sr(W);try{$.insertRule(K,$.cssRules.length)}catch{}}else W.appendChild(document.createTextNode(K));this.ctr++},f.flush=function(){this.tags.forEach(function(K){var W;return(W=K.parentNode)==null?void 0:W.removeChild(K)}),this.tags=[],this.ctr=0},A}();var ae="-ms-",ji="-moz-",Kt="-webkit-",rs="comm",yi="rule",xi="decl";var co="@import";var as="@keyframes";var uo="@layer";var fo=Math.abs,li=String.fromCharCode,go=Object.assign;function mo(A,f){return te(A,0)^45?(((f<<2^te(A,0))<<2^te(A,1))<<2^te(A,2))<<2^te(A,3):0}function hs(A){return A.trim()}function an(A,f){return(A=f.exec(A))?A[0]:A}function Bt(A,f,V){return A.replace(f,V)}function Yi(A,f){return A.indexOf(f)}function te(A,f){return A.charCodeAt(f)|0}function ti(A,f,V){return A.slice(f,V)}function de(A){return A.length}function wi(A){return A.length}function bi(A,f){return f.push(A),A}function hn(A,f){return A.map(f).join("")}var ls=1,vi=1,po=0,fe=0,ie=0,Si="";function Gi(A,f,V,K,W,$,it){return{value:A,root:f,parent:V,type:K,props:W,children:$,line:ls,column:vi,length:it,return:""}}function Pi(A,f){return go(Gi("",null,null,"",null,null,0),A,{length:-A.length},f)}function yo(){return ie}function xo(){return ie=fe>0?te(Si,--fe):0,vi--,ie===10&&(vi=1,ls--),ie}function ge(){return ie=fe<po?te(Si,fe++):0,vi++,ie===10&&(vi=1,ls++),ie}function Me(){return te(Si,fe)}function Ui(){return fe}function Mi(A,f){return ti(Si,A,f)}function ki(A){switch(A){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function cs(A){return ls=vi=1,po=de(Si=A),fe=0,[]}function us(A){return Si="",A}function Ni(A){return hs(Mi(fe-1,ln(A===91?A+2:A===40?A+1:A)))}function wo(A){for(;(ie=Me())&&ie<33;)ge();return ki(A)>2||ki(ie)>3?"":" "}function bo(A,f){for(;--f&&ge()&&!(ie<48||ie>102||ie>57&&ie<65||ie>70&&ie<97););return Mi(A,Ui()+(f<6&&Me()==32&&ge()==32))}function ln(A){for(;ge();)switch(ie){case A:return fe;case 34:case 39:A!==34&&A!==39&&ln(ie);break;case 40:A===41&&ln(A);break;case 92:ge();break}return fe}function vo(A,f){for(;ge()&&A+ie!==57;)if(A+ie===84&&Me()===47)break;return"/*"+Mi(f,fe-1)+"*"+li(A===47?A:ge())}function ko(A){for(;!ki(Me());)ge();return Mi(A,fe)}function Mo(A){return us(ds("",null,null,null,[""],A=cs(A),0,[0],A))}function ds(A,f,V,K,W,$,it,ht,G){for(var Tt=0,I=0,Rt=it,he=0,Oe=0,Ut=0,Wt=1,pt=1,P=1,Q=0,z="",Lt=W,D=$,Pt=K,L=z;pt;)switch(Ut=Q,Q=ge()){case 40:if(Ut!=108&&te(L,Rt-1)==58){Yi(L+=Bt(Ni(Q),"&","&\f"),"&\f")!=-1&&(P=-1);break}case 34:case 39:case 91:L+=Ni(Q);break;case 9:case 10:case 13:case 32:L+=wo(Ut);break;case 92:L+=bo(Ui()-1,7);continue;case 47:switch(Me()){case 42:case 47:bi(Mr(vo(ge(),Ui()),f,V),G);break;default:L+="/"}break;case 123*Wt:ht[Tt++]=de(L)*P;case 125*Wt:case 59:case 0:switch(Q){case 0:case 125:pt=0;case 59+I:P==-1&&(L=Bt(L,/\f/g,"")),Oe>0&&de(L)-Rt&&bi(Oe>32?Po(L+";",K,V,Rt-1):Po(Bt(L," ","")+";",K,V,Rt-2),G);break;case 59:L+=";";default:if(bi(Pt=So(L,f,V,Tt,I,W,ht,z,Lt=[],D=[],Rt),$),Q===123)if(I===0)ds(L,f,Pt,Pt,Lt,$,Rt,ht,D);else switch(he===99&&te(L,3)===110?100:he){case 100:case 108:case 109:case 115:ds(A,Pt,Pt,K&&bi(So(A,Pt,Pt,0,0,W,ht,z,W,Lt=[],Rt),D),W,D,Rt,ht,K?Lt:D);break;default:ds(L,Pt,Pt,Pt,[""],D,0,ht,D)}}Tt=I=Oe=0,Wt=P=1,z=L="",Rt=it;break;case 58:Rt=1+de(L),Oe=Ut;default:if(Wt<1){if(Q==123)--Wt;else if(Q==125&&Wt++==0&&xo()==125)continue}switch(L+=li(Q),Q*Wt){case 38:P=I>0?1:(L+="\f",-1);break;case 44:ht[Tt++]=(de(L)-1)*P,P=1;break;case 64:Me()===45&&(L+=Ni(ge())),he=Me(),I=Rt=de(z=L+=ko(Ui())),Q++;break;case 45:Ut===45&&de(L)==2&&(Wt=0)}}return $}function So(A,f,V,K,W,$,it,ht,G,Tt,I){for(var Rt=W-1,he=W===0?$:[""],Oe=wi(he),Ut=0,Wt=0,pt=0;Ut<K;++Ut)for(var P=0,Q=ti(A,Rt+1,Rt=fo(Wt=it[Ut])),z=A;P<Oe;++P)(z=hs(Wt>0?he[P]+" "+Q:Bt(Q,/&\f/g,he[P])))&&(G[pt++]=z);return Gi(A,f,V,W===0?yi:ht,G,Tt,I)}function Mr(A,f,V){return Gi(A,f,V,rs,li(yo()),ti(A,2,-2),0)}function Po(A,f,V,K){return Gi(A,f,V,xi,ti(A,0,K),ti(A,K+1,-1),K)}function ci(A,f){for(var V="",K=wi(A),W=0;W<K;W++)V+=f(A[W],W,A,f)||"";return V}function No(A,f,V,K){switch(A.type){case uo:if(A.children.length)break;case co:case xi:return A.return=A.return||A.value;case rs:return"";case as:return A.return=A.value+"{"+ci(A.children,K)+"}";case yi:A.value=A.props.join(",")}return de(V=ci(A.children,K))?A.return=A.value+"{"+V+"}":""}function Co(A){var f=wi(A);return function(V,K,W,$){for(var it="",ht=0;ht<f;ht++)it+=A[ht](V,K,W,$)||"";return it}}function Ao(A){return function(f){f.root||(f=f.return)&&A(f)}}function Lo(A){var f=Object.create(null);return function(V){return f[V]===void 0&&(f[V]=A(V)),f[V]}}var Nr=function(f,V,K){for(var W=0,$=0;W=$,$=Me(),W===38&&$===12&&(V[K]=1),!ki($);)ge();return Mi(f,fe)},Cr=function(f,V){var K=-1,W=44;do switch(ki(W)){case 0:W===38&&Me()===12&&(V[K]=1),f[K]+=Nr(fe-1,V,K);break;case 2:f[K]+=Ni(W);break;case 4:if(W===44){f[++K]=Me()===58?"&\f":"",V[K]=f[K].length;break}default:f[K]+=li(W)}while(W=ge());return f},Ar=function(f,V){return us(Cr(cs(f),V))},To=new WeakMap,Lr=function(f){if(!(f.type!=="rule"||!f.parent||f.length<1)){for(var V=f.value,K=f.parent,W=f.column===K.column&&f.line===K.line;K.type!=="rule";)if(K=K.parent,!K)return;if(!(f.props.length===1&&V.charCodeAt(0)!==58&&!To.get(K))&&!W){To.set(f,!0);for(var $=[],it=Ar(V,$),ht=K.props,G=0,Tt=0;G<it.length;G++)for(var I=0;I<ht.length;I++,Tt++)f.props[Tt]=$[G]?it[G].replace(/&\f/g,ht[I]):ht[I]+" "+it[G]}}},Tr=function(f){if(f.type==="decl"){var V=f.value;V.charCodeAt(0)===108&&V.charCodeAt(2)===98&&(f.return="",f.value="")}};function Do(A,f){switch(mo(A,f)){case 5103:return Kt+"print-"+A+A;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Kt+A+A;case 5349:case 4246:case 4810:case 6968:case 2756:return Kt+A+ji+A+ae+A+A;case 6828:case 4268:return Kt+A+ae+A+A;case 6165:return Kt+A+ae+"flex-"+A+A;case 5187:return Kt+A+Bt(A,/(\w+).+(:[^]+)/,Kt+"box-$1$2"+ae+"flex-$1$2")+A;case 5443:return Kt+A+ae+"flex-item-"+Bt(A,/flex-|-self/,"")+A;case 4675:return Kt+A+ae+"flex-line-pack"+Bt(A,/align-content|flex-|-self/,"")+A;case 5548:return Kt+A+ae+Bt(A,"shrink","negative")+A;case 5292:return Kt+A+ae+Bt(A,"basis","preferred-size")+A;case 6060:return Kt+"box-"+Bt(A,"-grow","")+Kt+A+ae+Bt(A,"grow","positive")+A;case 4554:return Kt+Bt(A,/([^-])(transform)/g,"$1"+Kt+"$2")+A;case 6187:return Bt(Bt(Bt(A,/(zoom-|grab)/,Kt+"$1"),/(image-set)/,Kt+"$1"),A,"")+A;case 5495:case 3959:return Bt(A,/(image-set\([^]*)/,Kt+"$1$`$1");case 4968:return Bt(Bt(A,/(.+:)(flex-)?(.*)/,Kt+"box-pack:$3"+ae+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Kt+A+A;case 4095:case 3583:case 4068:case 2532:return Bt(A,/(.+)-inline(.+)/,Kt+"$1$2")+A;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(de(A)-1-f>6)switch(te(A,f+1)){case 109:if(te(A,f+4)!==45)break;case 102:return Bt(A,/(.+:)(.+)-([^]+)/,"$1"+Kt+"$2-$3$1"+ji+(te(A,f+3)==108?"$3":"$2-$3"))+A;case 115:return~Yi(A,"stretch")?Do(Bt(A,"stretch","fill-available"),f)+A:A}break;case 4949:if(te(A,f+1)!==115)break;case 6444:switch(te(A,de(A)-3-(~Yi(A,"!important")&&10))){case 107:return Bt(A,":",":"+Kt)+A;case 101:return Bt(A,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Kt+(te(A,14)===45?"inline-":"")+"box$3$1"+Kt+"$2$3$1"+ae+"$2box$3")+A}break;case 5936:switch(te(A,f+11)){case 114:return Kt+A+ae+Bt(A,/[svh]\w+-[tblr]{2}/,"tb")+A;case 108:return Kt+A+ae+Bt(A,/[svh]\w+-[tblr]{2}/,"tb-rl")+A;case 45:return Kt+A+ae+Bt(A,/[svh]\w+-[tblr]{2}/,"lr")+A}return Kt+A+ae+A+A}return A}var Dr=function(f,V,K,W){if(f.length>-1&&!f.return)switch(f.type){case xi:f.return=Do(f.value,f.length);break;case as:return ci([Pi(f,{value:Bt(f.value,"@","@"+Kt)})],W);case yi:if(f.length)return hn(f.props,function($){switch(an($,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ci([Pi(f,{props:[Bt($,/:(read-\w+)/,":"+ji+"$1")]})],W);case"::placeholder":return ci([Pi(f,{props:[Bt($,/:(plac\w+)/,":"+Kt+"input-$1")]}),Pi(f,{props:[Bt($,/:(plac\w+)/,":"+ji+"$1")]}),Pi(f,{props:[Bt($,/:(plac\w+)/,ae+"input-$1")]})],W)}return""})}},Fr=[Dr],Fo=function(f){var V=f.key;if(V==="css"){var K=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(K,function(Wt){var pt=Wt.getAttribute("data-emotion");pt.indexOf(" ")!==-1&&(document.head.appendChild(Wt),Wt.setAttribute("data-s",""))})}var W=f.stylisPlugins||Fr,$={},it,ht=[];it=f.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+V+' "]'),function(Wt){for(var pt=Wt.getAttribute("data-emotion").split(" "),P=1;P<pt.length;P++)$[pt[P]]=!0;ht.push(Wt)});var G,Tt=[Lr,Tr];{var I,Rt=[No,Ao(function(Wt){I.insert(Wt)})],he=Co(Tt.concat(W,Rt)),Oe=function(pt){return ci(Mo(pt),he)};G=function(pt,P,Q,z){I=Q,Oe(pt?pt+"{"+P.styles+"}":P.styles),z&&(Ut.inserted[P.name]=!0)}}var Ut={key:V,sheet:new lo({key:V,container:it,nonce:f.nonce,speedy:f.speedy,prepend:f.prepend,insertionPoint:f.insertionPoint}),nonce:f.nonce,inserted:$,registered:{},insert:G};return Ut.sheet.hydrate(ht),Ut};function Oo(A){for(var f=0,V,K=0,W=A.length;W>=4;++K,W-=4)V=A.charCodeAt(K)&255|(A.charCodeAt(++K)&255)<<8|(A.charCodeAt(++K)&255)<<16|(A.charCodeAt(++K)&255)<<24,V=(V&65535)*1540483477+((V>>>16)*59797<<16),V^=V>>>24,f=(V&65535)*1540483477+((V>>>16)*59797<<16)^(f&65535)*1540483477+((f>>>16)*59797<<16);switch(W){case 3:f^=(A.charCodeAt(K+2)&255)<<16;case 2:f^=(A.charCodeAt(K+1)&255)<<8;case 1:f^=A.charCodeAt(K)&255,f=(f&65535)*1540483477+((f>>>16)*59797<<16)}return f^=f>>>13,f=(f&65535)*1540483477+((f>>>16)*59797<<16),((f^f>>>15)>>>0).toString(36)}var Ro={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var Or=!1,Rr=/[A-Z]|^ms/g,Er=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Vo=function(f){return f.charCodeAt(1)===45},Eo=function(f){return f!=null&&typeof f!="boolean"},cn=Lo(function(A){return Vo(A)?A:A.replace(Rr,"-$&").toLowerCase()}),Io=function(f,V){switch(f){case"animation":case"animationName":if(typeof V=="string")return V.replace(Er,function(K,W,$){return Ve={name:W,styles:$,next:Ve},W})}return Ro[f]!==1&&!Vo(f)&&typeof V=="number"&&V!==0?V+"px":V},Ir="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function qi(A,f,V){if(V==null)return"";var K=V;if(K.__emotion_styles!==void 0)return K;switch(typeof V){case"boolean":return"";case"object":{var W=V;if(W.anim===1)return Ve={name:W.name,styles:W.styles,next:Ve},W.name;var $=V;if($.styles!==void 0){var it=$.next;if(it!==void 0)for(;it!==void 0;)Ve={name:it.name,styles:it.styles,next:Ve},it=it.next;var ht=$.styles+";";return ht}return Br(A,f,V)}case"function":{if(A!==void 0){var G=Ve,Tt=V(A);return Ve=G,qi(A,f,Tt)}break}}var I=V;if(f==null)return I;var Rt=f[I];return Rt!==void 0?Rt:I}function Br(A,f,V){var K="";if(Array.isArray(V))for(var W=0;W<V.length;W++)K+=qi(A,f,V[W])+";";else for(var $ in V){var it=V[$];if(typeof it!="object"){var ht=it;f!=null&&f[ht]!==void 0?K+=$+"{"+f[ht]+"}":Eo(ht)&&(K+=cn($)+":"+Io($,ht)+";")}else{if($==="NO_COMPONENT_SELECTOR"&&Or)throw new Error(Ir);if(Array.isArray(it)&&typeof it[0]=="string"&&(f==null||f[it[0]]===void 0))for(var G=0;G<it.length;G++)Eo(it[G])&&(K+=cn($)+":"+Io($,it[G])+";");else{var Tt=qi(A,f,it);switch($){case"animation":case"animationName":{K+=cn($)+":"+Tt+";";break}default:K+=$+"{"+Tt+"}"}}}}return K}var Bo=/label:\s*([^\s;{]+)\s*(;|$)/g,Ve;function fs(A,f,V){if(A.length===1&&typeof A[0]=="object"&&A[0]!==null&&A[0].styles!==void 0)return A[0];var K=!0,W="";Ve=void 0;var $=A[0];if($==null||$.raw===void 0)K=!1,W+=qi(V,f,$);else{var it=$;W+=it[0]}for(var ht=1;ht<A.length;ht++)if(W+=qi(V,f,A[ht]),K){var G=$;W+=G[ht]}Bo.lastIndex=0;for(var Tt="",I;(I=Bo.exec(W))!==null;)Tt+="-"+I[1];var Rt=Oo(W)+Tt;return{name:Rt,styles:W,next:Ve}}var Vr=!0;function un(A,f,V){var K="";return V.split(" ").forEach(function(W){A[W]!==void 0?f.push(A[W]+";"):W&&(K+=W+" ")}),K}var zr=function(f,V,K){var W=f.key+"-"+V.name;(K===!1||Vr===!1)&&f.registered[W]===void 0&&(f.registered[W]=V.styles)},zo=function(f,V,K){zr(f,V,K);var W=f.key+"-"+V.name;if(f.inserted[V.name]===void 0){var $=V;do f.insert(V===$?"."+W:"",$,f.sheet,!0),$=$.next;while($!==void 0)}};function Ko(A,f){if(A.inserted[f.name]===void 0)return A.insert("",f,A.sheet,!0)}function Xo(A,f,V){var K=[],W=un(A,K,V);return K.length<2?V:W+f(K)}var jo=function(f){var V=Fo(f);V.sheet.speedy=function(ht){this.isSpeedy=ht},V.compat=!0;var K=function(){for(var G=arguments.length,Tt=new Array(G),I=0;I<G;I++)Tt[I]=arguments[I];var Rt=fs(Tt,V.registered,void 0);return zo(V,Rt,!1),V.key+"-"+Rt.name},W=function(){for(var G=arguments.length,Tt=new Array(G),I=0;I<G;I++)Tt[I]=arguments[I];var Rt=fs(Tt,V.registered),he="animation-"+Rt.name;return Ko(V,{name:Rt.name,styles:"@keyframes "+he+"{"+Rt.styles+"}"}),he},$=function(){for(var G=arguments.length,Tt=new Array(G),I=0;I<G;I++)Tt[I]=arguments[I];var Rt=fs(Tt,V.registered);Ko(V,Rt)},it=function(){for(var G=arguments.length,Tt=new Array(G),I=0;I<G;I++)Tt[I]=arguments[I];return Xo(V.registered,K,Kr(Tt))};return{css:K,cx:it,injectGlobal:$,keyframes:W,hydrate:function(G){G.forEach(function(Tt){V.inserted[Tt]=!0})},flush:function(){V.registered={},V.inserted={},V.sheet.flush()},sheet:V.sheet,cache:V,getRegisteredStyles:un.bind(null,V.registered),merge:Xo.bind(null,V.registered,K)}},Kr=function A(f){for(var V="",K=0;K<f.length;K++){var W=f[K];if(W!=null){var $=void 0;switch(typeof W){case"boolean":break;case"object":{if(Array.isArray(W))$=A(W);else{$="";for(var it in W)W[it]&&it&&($&&($+=" "),$+=it)}break}default:$=W}$&&(V&&(V+=" "),V+=$)}}return V};var ze=jo({key:"css"}),mc=ze.flush,pc=ze.hydrate,yc=ze.cx,xc=ze.merge,wc=ze.getRegisteredStyles,Yo=ze.injectGlobal,bc=ze.keyframes,vc=ze.css,kc=ze.sheet,Sc=ze.cache;var Xr=qn`@layer{/** @license
53
+ * Copyright 2025 Esri
54
+ *
55
+ * Licensed under the Apache License, Version 2.0 (the "License");
56
+ * you may not use this file except in compliance with the License.
57
+ * You may obtain a copy of the License at
58
+ *
59
+ * http://www.apache.org/licenses/LICENSE-2.0
60
+ *
61
+ * Unless required by applicable law or agreed to in writing, software
62
+ * distributed under the License is distributed on an "AS IS" BASIS,
63
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64
+ * See the License for the specific language governing permissions and
65
+ * limitations under the License.
66
+ */}`;function jr(A,f){let V=A.toLowerCase(),K=f||[],W=K.includes("Hosted Service");switch(V.trim()){case"360 vr experience":return"360vr";case"3dtiles package":return"3dtileslayerpackage";case"3dtiles service":return K.includes("3DObject")?"3dobjecttileslayer":K.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dobjecttileslayer";case"feature service":case"feature collection":case"kml":case"wfs":if(K.includes("IndoorPositioningDataService"))return"indoorpositioningdataservice";let $=K.includes("Spatiotemporal");return K.includes("Table")?$?"spatiotemporaltable":"table":K.includes("Route Layer")?"routelayer":K.includes("Markup")?"markup":$?"spatiotemporal":K.includes("UtilityNetwork")?"utilitynetwork":W?"featureshosted":"features";case"group":return"group";case"group layer":return K.includes("Map")?"layergroup2d":K.includes("Scene")?"layergroup3d":"layergroup";case"wmts":return"maptiles";case"map service":case"wms":return W||K.includes("Tiled")?"maptiles":"mapimages";case"scene service":return K.includes("Line")?"sceneweblayerline":K.includes("3DObject")?"sceneweblayermultipatch":K.includes("Point")?"sceneweblayerpoint":K.includes("IntegratedMesh")?"sceneweblayermesh":K.includes("PointCloud")?"sceneweblayerpointcloud":K.includes("Polygon")?"sceneweblayerpolygon":K.includes("Building")?"sceneweblayerbuilding":K.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer";case"image service":return K.includes("Elevation 3D Layer")?"elevationlayer":K.includes("Tiled Imagery")?"tiledimagerylayer":"imagery";case"stream service":return"streamlayer";case"video service":return K.includes("Live Stream")?"livestreamvideolayer":"mediaservice";case"vector tile service":return"vectortile";case"datastore catalog service":return"datastorecollection";case"geocoding service":return"geocodeservice";case"geoprocessing service":return K.includes("Web Tool")?"tool":"layers";case"geodata service":return"geodataservice";case"web map":case"cityengine web scene":return"maps";case"web scene":return K.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal";case"application":case"web mapping application":case"mobile application":case"operation view":case"desktop application":return K.includes("configurableApp")?"instantapps":"apps";case"map document":case"map package":case"published map":case"scene document":case"globe document":case"basemap package":case"mobile basemap package":case"mobile map package":case"project package":case"project template":case"pro map":case"layout":return"mapsgray";case"layer":return K.includes("ArcGIS Pro")?"mapsgray":"layersgray";case"explorer map":return K.indexOf("Explorer Document")?"mapsgray":K.includes("Explorer Mapping Application")?"datafilesgray":"mapsgray";case"pro presentation":return"propresentation";case"api key":return"key";case"csv":return"csv";case"shapefile":return"shapefile";case"csv collection":return"csvcollection";case"media layer":return"medialayer";case"microsoft excel":return"excel";case"microsoft powerpoint":return"powerpoint";case"microsoft word":return"word";case"pdf":return"pdf";case"sqlite geodatabase":return"sqlite";case"administrative report":return"report";case"image":return"image";case"cad drawing":return"cad";case"service definition":case"geojson":case"netcdf":return"data";case"explorer add in":case"desktop add in":case"windows viewer add in":case"windows viewer configuration":return"appsgray";case"arcgis pro add in":case"arcgis pro configuration":return"addindesktop";case"rule package":case"file geodatabase":case"kml collection":case"windows mobile package":case"map template":case"desktop application template":case"gml":case"arcpad package":case"code sample":case"document link":case"earth configuration":case"operations dashboard add in":case"rules package":case"workflow manager package":return"datafilesgray";case"form":return K.includes("Survey123")?"survey":"datafilesgray";case"network analysis service":case"geometry service":case"geoprocessing package":case"locator package":case"geoprocessing sample":case"workflow manager service":return"toolsgray";case"layer package":case"explorer layer":return"layersgray";case"scene package":return"scenepackage";case"mobile scene package":return"mobilescenepackage";case"tile package":case"compact tile package":return"tilepackage";case"task file":return"taskfile";case"report template":return"reporttemplate";case"statistical data collection":return"statisticaldatacollection";case"analysis model":return"geoprocessingmodel";case"insights workbook":return"workbook";case"insights model":return"insightsmodel";case"insights page":return"insightspage";case"insights theme":return"insightstheme";case"hub initiative":return"hubinitiative";case"hub page":return"hubpage";case"hub event":return"hubevent";case"hub site application":return"hubsite";case"hub project":return"hubproject";case"relational database connection":return"relationaldatabaseconnection";case"image collection":return"imagecollection";case"style":return K.includes("Dictionary")?"dictionarystyle":"style";case"desktop style":return"desktopstyle";case"dashboard":return"dashboard";case"raster function template":return"rasterprocessingtemplate";case"vector tile package":return"vectortilepackage";case"ortho mapping project":return"orthomappingproject";case"ortho mapping template":return"orthomappingtemplate";case"solution":return"solutions";case"geopackage":return"geopackage";case"deep learning package":return"deeplearningpackage";case"real time analytic":return"realtimeanalytics";case"big data analytic":return"bigdataanalytics";case"feed":return"feed";case"excalibur imagery project":return"excaliburimageryproject";case"notebook":return"notebook";case"reality mapping project":return"realitymappingproject";case"storymap":return K.includes("storymaptemplate")?"storymapstemplate":K.includes("storymapcollection")?"storymapcollection":K.includes("storymapbriefing")?"storymapbriefing":"storymap";case"survey123 add in":return"survey123addin";case"mission":return"mission";case"mission report":return"missionreport";case"quickcapture project":return"quickcaptureproject";case"pro report":return"proreport";case"urban model":return"urbanmodel";case"urban project":return"urbanproject";case"web experience":return"experiencebuilder";case"web experience template":return"webexperiencetemplate";case"experience builder widget":return"experiencebuilderwidget";case"experience builder widget package":return"experiencebuilderwidgetpackage";case"workflow":return"workflow";case"insights script":return"insightsscript";case"kernel gateway connection":return"kernelgatewayconnection";case"hub initiative template":return"hubinitiativetemplate";case"storymap theme":return"storymaptheme";case"knowledge graph":return"knowledgegraph";case"knowledge studio project":return"knowledgestudio";case"knowledge graph layer":return"knowledgegraphlayer";case"native application":return"nativeapp";case"native application installer":return"nativeappinstaller";case"web link chart":return"linkchart";case"knowledge graph web investigation":return"investigation";case"ogcfeatureserver":return"features";case"pro project":return"proproject";case"insights workbook package":return"insightsworkbookpackage";case"apache parquet":return"apacheparquet";case"notebook code snippets":case"notebook code snippet library":return"notebookcodesnippets";case"suitability model":return"suitabilitymodel";case"esri classifier definition":return"classifierdefinition";case"esri classification schema":return"classificationschema";case"insights data engineering workbook":return"dataengineeringworkbook";case"insights data engineering model":return"dataengineeringmodel";case"deep learning studio project":return"deeplearningproject";case"data store":return"datastore";case"data pipeline":return"datapipeline";default:return K.includes("Document")?"datafilesgray":V.includes("service")?"layers":"maps"}}var Yr=15,Gr=15,Ur=10,Hi=new Ki(220,48),qr=1,Hr=8,Go=new Ki(48,48),Wr=new Ki(16,16),Uo=new Ki(153,17),$r="400 0.75rem 'Avenir Next', Avenir, 'Helvetica Neue', sans-serif",Jr="700 0.75rem 'Avenir Next', Avenir, 'Helvetica Neue', sans-serif",Zr="#f4f4f4",Qr="#cacaca",_r="#ffffff",qo="#4a4a4a",Ho="#6a6a6a",ta="#ffffff",gs=1,$o=.3,dn=1,Jo=.2,ea=1;function ia(A){let f=document.createElement("div");f.style.width="100%",f.style.height="100%",A.appendChild(f);let V=new en(f,{click:ca,contentAlignment:Be.Center,dragSelectingTool:null,hoverDelay:50,initialAutoScale:no.Uniform,layout:new so({columnSpacing:Yr,layerSpacing:Gr}),padding:Ur,scrollMode:ro.Infinite,"toolManager.hoverDelay":50,"toolManager.mouseWheelBehavior":ho.Zoom});V.nodeTemplate=new nn("Auto",{click:ua,movable:!1,opacity:gs,toolTip:new sn("Auto",{isShadowed:!0,margin:new _s(12,16,6,16),padding:0,shadowBlur:16,shadowColor:"rgba(0, 0, 0, 0.16)",shadowOffset:new Qn(0,0)}).add(new hi("Vertical",{background:ta,margin:0}).add(new os({margin:14}).bind("text","title")))}).bind("text","title").add(new Xi({desiredSize:Hi,fill:_r,geometryString:la(Hi.width,Hi.height,Hr,Go.width,!0),height:Hi.height,portId:"",stroke:Qr,strokeWidth:qr,width:Hi.width})).add(new hi("Horizontal",{alignment:Be.Left,stretch:ao.Horizontal}).add(new hi("Horizontal",{alignment:Be.Left,desiredSize:Go,margin:1}).add(new hi("Horizontal",{alignment:Be.Center,margin:16}).add(new to({desiredSize:Wr}).bind("source","",$=>ga($.itemType,$.itemTypeKeywords)))),new hi("Horizontal",{alignment:Be.Right,margin:new _s(4,8,0,8)}).add(new hi("Vertical",{}).add(new os({alignment:Be.Left,desiredSize:Uo,font:Jr,overflow:on.Ellipsis,stroke:qo,wrap:rn.None}).bind("text","title"),new os({alignment:Be.Left,desiredSize:Uo,font:$r,overflow:on.Ellipsis,stroke:qo,wrap:rn.None}).bind("text","itemTypeForDisplay"))))),V.commandHandler.zoomFactor=1.05,V.setDivBackground(Zr);let K=V.toolManager.clickSelectingTool;K.standardMouseSelect=function(){};let W=V.toolManager.draggingTool;return W.isEnabled=!1,V.linkTemplate=new eo({corner:5,movable:!1,routing:oo.Orthogonal,selectable:!1}).add(new Xi({opacity:dn,stroke:Ho}),new Xi({fill:Ho,opacity:dn,stroke:null,toArrow:"Standard"})),V}function ui(A,f){A.model=new _n(f.nodes,f.links,{linkFromPortIdProperty:"fromPort",linkToPortIdProperty:"toPort"})}function sa(A,f,V,K=!0){if(K){let G=da(A,V);G.addEventListener("calciteSwitchChange",()=>document.dispatchEvent(new CustomEvent("filteredViewChanged",{detail:G.checked})))}let{resetButton:W,centerButton:$,zoomInButton:it,zoomOutButton:ht}=fa(A,V);W.addEventListener("click",()=>pa(f)),$.addEventListener("click",()=>f.zoomToFit()),it.addEventListener("click",()=>f.commandHandler.increaseZoom()),ht.addEventListener("click",()=>f.commandHandler.decreaseZoom())}function na(A,f,V){ya();let K=ia(A);return ui(K,f),sa(A,K,V),K}function Zo(A){let f=new Set,V=new Set;function K($){$.findLinksInto().each(it=>{V.add(it);let ht=it.fromNode;ht&&!f.has(ht)&&(f.add(ht),K(ht))})}K(A);function W($){$.findLinksOutOf().each(it=>{V.add(it);let ht=it.toNode;ht&&!f.has(ht)&&(f.add(ht),W(ht))})}return W(A),{connectedNodes:f,connectedLinks:V}}function oa(A,f=!1,V){let K=[],W=A.map(it=>{if(it.type!=="Group"){let ht=ha(it);return aa(it,ht,f,V)}else{K.push(it.id);return}}).filter(it=>it!==void 0),$=[];return W.forEach(it=>{(A.find(ht=>ht.id===it.itemId)?.dependencies||[]).forEach(ht=>{let G=W.find(Tt=>Tt?.itemId===ht);G&&$.push({from:G.key,fromSpot:Be.AllSides,to:it.key,toSpot:Be.AllSides})})}),{nodes:W,links:$,groupPseudoNodes:K}}function ra(A,f,V,K=!0){let W=A.diagram;if(!W)return;let $={};if(K){for(let it of W.nodes)$[it.key]=it===A?gs:$o;for(let it of W.links){let ht=`${it.fromNode?.key}-${it.toNode?.key}`;$[ht]=Jo}{let{connectedNodes:it,connectedLinks:ht}=Zo(A);for(let G of it)$[G.key]=gs;for(let G of ht){let Tt=`${G.fromNode?.key}-${G.toNode?.key}`;$[Tt]=ea}}}if(V&&(V.adornedObject=A),K){let it=new tn;it.duration=1;for(let ht of W.nodes)it.add(ht,"opacity",ht.opacity,$[ht.key]);for(let ht of W.links){let G=`${ht.fromNode?.key}-${ht.toNode?.key}`;it.add(ht,"opacity",ht.opacity,$[G])}it.start()}}function Wo(A,f,V,K,W=!0){if(A.length===0)return;let $=f[0].diagram;if(!$)return;let it={};if(W){for(let ht of $.nodes){let G=A.includes(ht.key);it[ht.key]=!V||G?gs:$o}for(let ht of $.links){let G=`${ht.fromNode?.key}-${ht.toNode?.key}`;it[G]=V?Jo:dn}}if(Object.keys(K).forEach(ht=>{K[ht].adornedObject=null}),W){let ht=new tn;ht.duration=1;for(let G of $.nodes)ht.add(G,"opacity",G.opacity,it[G.key]);for(let G of $.links){let Tt=`${G.fromNode?.key}-${G.toNode?.key}`;ht.add(G,"opacity",G.opacity,it[Tt])}ht.start()}}function aa(A,f,V=!1,K){return{key:f,title:A.title,itemId:A.id,itemType:A.type,itemTypeForDisplay:ma(A.type,A.typeKeywords),itemTypeKeywords:A.typeKeywords,group:A.type,url:V?`${K}?id=${A.id}`:void 0}}function ha(A){return A.id}function la(A,f,V,K=0,W=!1){let $="";W&&($+="F");let it=A-2*V,ht=f-2*V;return $+=" M0 0",$+=` h${it}`,$+=` a${V} ${V} 0 0 1 ${V} ${V}`,$+=` v${ht}`,$+=` a${V} ${V} 0 0 1 -8 ${V}`,$+=` h${-it}`,$+=` a${V} ${V} 0 0 1 -8 -8`,$+=` v${-ht}`,$+=` a${V} ${V} 0 0 1 ${V} -8`,K>0&&($+=` M${K-V} 0 v${f}`),$}function ca(){document.dispatchEvent(new CustomEvent("clickInDiagram"))}function ua(A,f){let V=f.part;V instanceof nn&&(V.selectionAdorned=!1,document.dispatchEvent(new CustomEvent("clickOnNode",{detail:V})))}function da(A,f){let V=document.createElement("calcite-switch");V.id="filteredViewButton",V.label=f.filteredView;let K=document.createElement("calcite-label");K.id="filteredViewButtonLabel",K.setAttribute("layout","inline"),K.innerHTML=f.filteredView,K.appendChild(V);let W=document.createElement("div");W.id="filteredViewButtonDiv",W.appendChild(K);let $=document.createElement("calcite-action-pad");$.id="filter-bar-controls",$.layout="horizontal",$.expandDisabled=!0,$.appendChild(W);let it=document.createElement("div");return it.id="filter-bar",A.appendChild(it),it.appendChild($),V}function fa(A,f){let V=document.createElement("calcite-action");V.icon="reset",V.id="showHideGrayedOutButton";let K=document.createElement("calcite-tooltip");K.id="resetButtonTooltip",K.innerHTML=f.reset,K.overlayPositioning="fixed",K.placement="bottom",K.referenceElement=V.id;let W=document.createElement("calcite-action");W.icon="zoom-to-object",W.id="centerButton";let $=document.createElement("calcite-tooltip");$.id="centerButtonTooltip",$.innerHTML=f.centerDiagram,$.overlayPositioning="fixed",$.placement="bottom",$.referenceElement=W.id;let it=document.createElement("calcite-action");it.icon="plus",it.id="zoomInButton";let ht=document.createElement("calcite-tooltip");ht.id="zoomInButtonTooltip",ht.innerHTML=f.zoomIn,ht.overlayPositioning="fixed",ht.placement="bottom",ht.referenceElement=it.id;let G=document.createElement("calcite-action");G.icon="minus",G.id="zoomOutButton";let Tt=document.createElement("calcite-tooltip");Tt.id="zoomOutButtonTooltip",Tt.innerHTML=f.zoomOut,Tt.overlayPositioning="fixed",Tt.placement="bottom",Tt.referenceElement=G.id;let I=document.createElement("calcite-action-pad");I.id="graph-navigation-controls",I.layout="horizontal",I.expandDisabled=!0,I.appendChild(V),I.appendChild(K),I.appendChild(W),I.appendChild($),I.appendChild(it),I.appendChild(ht),I.appendChild(G),I.appendChild(Tt);let Rt=document.createElement("div");return Rt.id="graph-navigation-bar",A.appendChild(Rt),Rt.appendChild(I),{resetButton:V,centerButton:W,zoomInButton:it,zoomOutButton:G}}function ga(A,f){let V=jr(A,f),K=new URL("../assets/item-icons/",import.meta.url).href;return V==="group"?`${K}/${V}16.png`:`${K}/${V}16.svg`}function ma(A,f){let V=A;if(A==="Feature Service"){let K=f.indexOf("View Service")>-1,W=f.indexOf("Table")>-1;V=K&&W?"Table (hosted, view)":W?"Table (hosted)":K?"Feature Layer (hosted, view)":"Feature Layer (hosted)"}return A==="Web Mapping Application"&&(V=f.indexOf("configurableApp")>-1?"Instant App":V),V=A==="Geoprocessing Service"?"Tool":V,V=A==="Feed"?"Feed (hosted)":V,V=A==="Real Time Analytic"?"Real Time Analytic (hosted)":V,V=A==="Big Data Analytic"?"Big Data Analytic (hosted)":V,V=A==="Vector Tile Service"?"Tile Layer":V,V}function pa(A){A.zoomToFit(),document.dispatchEvent(new CustomEvent("reset"))}function ya(){Yo`
67
+ #filter-bar {
68
+ background-color: #f4f4f4;
69
+ position: absolute;
70
+ top: 16px;
71
+ right: 220px;
72
+ z-index: 100;
73
+ }
74
+ #filteredViewButtonDiv {
75
+ padding: 16px 16px 4px 16px;
76
+ }
77
+ #graph-navigation-bar {
78
+ background-color: #f4f4f4;
79
+ position: absolute;
80
+ top: 16px;
81
+ right: 16px;
82
+ z-index: 100;
83
+ }
84
+ #graph-navigation-controls {
85
+ position: absolute;
86
+ top: 0;
87
+ right: 0;
88
+ }
89
+ `}var xa=8,wa=15,ba="#1e90ff",va=4;en.licenseKey="298647e0b16f4fc702d90676423d6bf919a175639c841aa45d0412f3ed083d06329fef2851d38f9787af4efe187c90d1ddc06e219e49563fe531d3da13e1d1aab03774e5140b4589f31136c5ccaa2ca1ae2870e0d2b676a1df678bedebaa";var fn=class{constructor(f,V,K){this.indexPanel=f,this.diagramPanel=V,this.diagramTranslations=K,this.currentSelectedGroupId="",this.currentSelectedItemId="",this.diagramNeedsRedraw=!1,this.usefilteredView=!1,this.handle_clickInDiagram=W=>{W.stopImmediatePropagation(),(this.currentSelectedGroupId||this.currentSelectedItemId)&&(this.currentSelectedGroupId="",this.currentSelectedItemId="",this.diagramNeedsRedraw=this.usefilteredView,this.redraw())},this.handle_clickOnNode=W=>{W.stopImmediatePropagation();let $=W.detail.data.key;this.redraw($,$===this.currentSelectedItemId)},this.handle_filteredViewChanged=W=>{this.usefilteredView=W.detail,this.diagramNeedsRedraw=!!this.currentSelectedGroupId||!!this.currentSelectedItemId,this.redraw(this.currentSelectedItemId||this.currentSelectedGroupId)},this.handle_reset=W=>{W.stopImmediatePropagation(),this.reset()},this.handle_solutionItemSelect=W=>{W.stopImmediatePropagation();let $=W.detail.itemId;this.redraw($,$===this.currentSelectedItemId||$===this.currentSelectedGroupId,!1)},this.indexPanel.innerHTML="",this.diagramPanel.innerHTML=""}create(f){this.collection=f,this.index=document.createElement("solution-item-accordion"),this.index.listSelectionMode="single",this.index.style.overflowY="auto",this.indexPanel.appendChild(this.index),this.index.templateInfos=f,this.allNodesAndLinks=oa(f),this.diagram=na(this.diagramPanel,this.allNodesAndLinks,this.diagramTranslations),this.createNodeHighlighters(),document.addEventListener("clickInDiagram",this.handle_clickInDiagram),document.addEventListener("clickOnNode",this.handle_clickOnNode),document.addEventListener("filteredViewChanged",this.handle_filteredViewChanged),document.addEventListener("reset",this.handle_reset),this.index.addEventListener("solutionItemSelect",this.handle_solutionItemSelect)}dispose(){document.removeEventListener("clickInDiagram",this.handle_clickInDiagram),document.removeEventListener("clickOnNode",this.handle_clickOnNode),document.removeEventListener("filteredViewChanged",this.handle_filteredViewChanged),document.removeEventListener("reset",this.handle_reset),this.index.removeEventListener("solutionItemSelect",this.handle_solutionItemSelect),this.indexPanel.innerHTML="",this.diagramPanel.innerHTML=""}clearSelections(f=!0){this.index.deselectAll(),f&&this.index.collapseAll();let V=this.getNodesFromDiagram(this.diagram),K=V.map(W=>W.data.key);Wo(K,V,!1,this.diagramNodeHighlighterIndex)}createNodeHighlighters(){this.diagramNodeIndex={},this.diagramNodeHighlighterIndex={},this.getNodesFromDiagram(this.diagram).forEach(f=>{this.diagramNodeIndex[f.data.key]=f;let V=new sn("Auto",{background:"transparent",margin:2});V.add(new Xi("RoundedRectangle",{fill:"transparent",parameter1:xa,parameter2:wa,stroke:ba,strokeWidth:va})),V.add(new io({margin:1})),this.diagramNodeHighlighterIndex[f.data.key]=V})}getNodeById(f){return this.diagramNodeIndex[f]}getNodesFromDiagram(f){let V=[],K=f.nodes.iterator;for(;K.next();)V.push(K.value);return V}redraw(f="",V=!1,K=!0){let W=this.allNodesAndLinks.groupPseudoNodes.includes(f);this.diagramNeedsRedraw&&(ui(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),this.diagramNeedsRedraw=!1);let $=!1;if(this.clearSelections(K),!!f){if(W){if(this.currentSelectedItemId="",this.currentSelectedGroupId!==f?this.currentSelectedGroupId=f:V&&(this.currentSelectedGroupId=this.currentSelectedGroupId?"":f,$=this.usefilteredView&&!this.currentSelectedGroupId),this.currentSelectedGroupId){this.usefilteredView&&(ui(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters());let it=this.collection.filter(G=>G.id===f)[0],ht=it.dependencies.map(G=>this.diagramNodeIndex[G]);if(this.usefilteredView){let G=ht.map(Tt=>Tt.data);ui(this.diagram,{nodes:G,links:[]})}else Wo(it.dependencies,ht,!0,this.diagramNodeHighlighterIndex);this.index.selectItem(this.currentSelectedGroupId)}}else{this.currentSelectedGroupId="",this.currentSelectedItemId!==f?this.currentSelectedItemId=f:V&&(this.currentSelectedItemId=this.currentSelectedItemId?"":f,$=this.usefilteredView&&!this.currentSelectedItemId);let it=this.getNodeById(f);if((!it||this.usefilteredView)&&(ui(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),it=this.getNodeById(f),!it))return;if(this.currentSelectedItemId){if(this.usefilteredView){let ht=Zo(it);ht.connectedNodes.add(it);let G=Array.from(ht.connectedNodes).map(I=>I.data),Tt=Array.from(ht.connectedLinks).map(I=>I.data);if(ui(this.diagram,{nodes:G,links:Tt}),this.createNodeHighlighters(),it=this.getNodeById(f),!it)return}it&&setTimeout(()=>ra(it,!0,this.diagramNodeHighlighterIndex[f]),1),this.index.selectItem(this.currentSelectedItemId)}}$&&this.reset()}}reset(){this.diagramNeedsRedraw=!1,this.currentSelectedGroupId="",this.currentSelectedItemId="",ui(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),this.clearSelections()}},gn=class extends $n{constructor(){super(...arguments),this.templateInfoGraph=[],this._diagramPanel=Zs(),this._diagramShell=Zs(),this._translations=Zn({name:"solution-item-diagram",blocking:!0})}static{this.properties={templateInfoGraph:0,_diagramPanel:16,_diagramShell:16,_translations:16}}static{this.styles=Xr}static{this.shadowRootOptions=Wn}updated(){if(this.templateInfoGraph.length>0){let f={centerDiagram:this._translations.graphTranslations.centerDiagram,filteredView:this._translations.graphTranslations.filteredView,reset:this._translations.graphTranslations.reset,zoomIn:this._translations.graphTranslations.zoomIn,zoomOut:this._translations.graphTranslations.zoomOut};this.solutionDisplay=new fn(this._diagramShell.value,this._diagramPanel.value,f),this.solutionDisplay.create(this.templateInfoGraph)}}render(){return Hn`<calcite-shell><calcite-shell-panel id=diagram-shell-panel slot=panel-start ${Qs(this._diagramShell)}></calcite-shell-panel><calcite-panel id=diagram-panel slot=panel-bottom ${Qs(this._diagramPanel)}></calcite-panel></calcite-shell>`}};Jn("solution-item-diagram",gn);export{gn as SolutionItemDiagram};