@esri/solutions-components 1.1.0-next.20250813 → 1.1.0-next.20250814

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 (464) hide show
  1. package/dist/cdn/{ETXGPE47.js → 233SOP2X.js} +2 -2
  2. package/dist/cdn/{HIJ2VUZY.js → 2A5LFLWY.js} +2 -2
  3. package/dist/cdn/{SMAAZRND.js → 2FHWNASZ.js} +2 -2
  4. package/dist/cdn/2MSRG3L3.js +4 -0
  5. package/dist/cdn/{7XRNZ2VO.js → 2PQMOYN2.js} +1 -1
  6. package/dist/cdn/{FH5CEEAL.js → 2R2NLVG4.js} +2 -2
  7. package/dist/cdn/{WIZHWIJI.js → 2SMJNHDA.js} +2 -2
  8. package/dist/cdn/{ZKCETCZM.js → 34PHRONA.js} +2 -2
  9. package/dist/cdn/{C6YIH4HI.js → 36YENHNO.js} +2 -2
  10. package/dist/cdn/{7GI27WHE.js → 37NCXJQ7.js} +2 -2
  11. package/dist/cdn/{2FZPIIHB.js → 3ACOUZ2J.js} +2 -2
  12. package/dist/cdn/{LMNGFYEP.js → 3HY2C477.js} +2 -2
  13. package/dist/cdn/3PKAD5T2.css +1 -0
  14. package/dist/cdn/{5JMJMFDW.js → 3Q7M2PFZ.js} +2 -2
  15. package/dist/cdn/{7QZIMTB6.js → 3VMMC5BJ.js} +2 -2
  16. package/dist/cdn/{HVYCYJJA.js → 3WGSSTHY.js} +2 -2
  17. package/dist/cdn/3WLB6HQG.js +18 -0
  18. package/dist/cdn/{FFAVYRB4.js → 3ZJXTRS3.js} +2 -2
  19. package/dist/cdn/{MGRNE66F.js → 42LO4TCV.js} +2 -2
  20. package/dist/cdn/{MJIIJ7IR.js → 4CBNOR6N.js} +2 -2
  21. package/dist/cdn/{AZCMMHWC.js → 4D2YRN2T.js} +2 -2
  22. package/dist/cdn/{K4BEULDQ.js → 4DGE5KUI.js} +2 -2
  23. package/dist/cdn/{BVARQ3DZ.js → 4DTTBSJJ.js} +2 -2
  24. package/dist/cdn/{AMSTPHGE.js → 4GD36GY6.js} +2 -2
  25. package/dist/cdn/{UG6JNU5B.js → 4GLART42.js} +2 -2
  26. package/dist/cdn/{5ZH5LYCG.js → 4IOF3RZQ.js} +2 -2
  27. package/dist/cdn/{7UB3DEPT.js → 4NIDMX33.js} +2 -2
  28. package/dist/cdn/{Y766BHKT.js → 4Q75WJMW.js} +2 -2
  29. package/dist/cdn/{5QG46LCT.js → 4QMK76M4.js} +2 -2
  30. package/dist/cdn/{4YOLJ22J.js → 4S3PKQJ4.js} +2 -2
  31. package/dist/cdn/{HR6ENVFY.js → 4S3SCEG2.js} +2 -2
  32. package/dist/cdn/4VDUJIVA.js +4 -0
  33. package/dist/cdn/{4777KHCE.js → 5DHG3XZC.js} +2 -2
  34. package/dist/cdn/{QBOSXN7R.js → 5FTEBTMX.js} +2 -2
  35. package/dist/cdn/{L23MKNQC.js → 5GN3UTVY.js} +2 -2
  36. package/dist/cdn/{LAZSJDRK.js → 5M64RMWJ.js} +2 -2
  37. package/dist/cdn/{AJWBRQQN.js → 5Z3UBSQA.js} +2 -2
  38. package/dist/cdn/{F5MY54IS.js → 65KMHURS.js} +1 -1
  39. package/dist/cdn/{7KNQESYU.js → 67UNP3O6.js} +2 -2
  40. package/dist/cdn/{XCWI7Y7D.js → 6B6YSA5T.js} +2 -2
  41. package/dist/cdn/{TWHMQL23.js → 6CE3P6MK.js} +2 -2
  42. package/dist/cdn/{GIPIFBTE.js → 6DEQD5XS.js} +2 -2
  43. package/dist/cdn/{G4RR2COS.js → 6GBJRGMX.js} +2 -2
  44. package/dist/cdn/{BLVRQ6OB.js → 6UNISOCW.js} +1 -1
  45. package/dist/cdn/{QDXWYPJL.js → 6V7OF3L5.js} +2 -2
  46. package/dist/cdn/{LZPSHFJT.js → 6VUW2EIQ.js} +2 -2
  47. package/dist/cdn/{2TO5YBHP.js → 6VYIML44.js} +2 -2
  48. package/dist/cdn/{RSPASQLO.js → 6WWRM5A2.js} +2 -2
  49. package/dist/cdn/{HVYSRDTL.js → 6X64VRXD.js} +1 -1
  50. package/dist/cdn/{4GN6WWZB.js → 6XZKH4OE.js} +1 -1
  51. package/dist/cdn/{M7SV47G6.js → 7APIJZQK.js} +2 -2
  52. package/dist/cdn/{5QZWFNDG.js → 7BFAL4UH.js} +2 -2
  53. package/dist/cdn/{PRVYKTMW.js → 7CUVYKXM.js} +2 -2
  54. package/dist/cdn/{ES57S3YD.js → 7EK6RHGO.js} +2 -2
  55. package/dist/cdn/{Q2G766SX.js → 7HH4LEDN.js} +2 -2
  56. package/dist/cdn/{BTL6T5RK.js → 7KV5JEFS.js} +2 -2
  57. package/dist/cdn/{FG4RZ2ZL.js → 7TIDDZ6R.js} +2 -2
  58. package/dist/cdn/{QKKC6GBL.js → 7TLQLS4B.js} +2 -2
  59. package/dist/cdn/{OPJDGQPQ.js → 7WZ4WODT.js} +1 -1
  60. package/dist/cdn/{B2AO3FYW.js → A5ANEUPM.js} +2 -2
  61. package/dist/cdn/{HXBWYYB2.js → A6COROCR.js} +2 -2
  62. package/dist/cdn/{Q2ZDGWJW.js → AA7WFQB6.js} +1 -1
  63. package/dist/cdn/{XLF4EXMY.js → ABJR44TO.js} +2 -2
  64. package/dist/cdn/{SG7HY4KR.js → ACFG5TV4.js} +2 -2
  65. package/dist/cdn/{76WUG6ZM.js → AFVKAHAM.js} +1 -1
  66. package/dist/cdn/{2I3EU5FX.js → AOCRZJFL.js} +2 -2
  67. package/dist/cdn/{BYBBSBXY.js → ARCKDH5K.js} +2 -2
  68. package/dist/cdn/{4MGPYD2C.js → ATXNKDGP.js} +2 -2
  69. package/dist/cdn/{VU544BRL.js → AZAVNJBN.js} +2 -2
  70. package/dist/cdn/{L35NOW7V.js → B3TFVUQ3.js} +2 -2
  71. package/dist/cdn/{W3MIURTN.js → B45YTTVU.js} +2 -2
  72. package/dist/cdn/{A2JIGX46.js → BI4XBFSU.js} +2 -2
  73. package/dist/cdn/{WOE5WBGS.js → BIGXMS6J.js} +1 -1
  74. package/dist/cdn/{CV5YU67D.js → BKWX324H.js} +2 -2
  75. package/dist/cdn/{DRVD2AAI.js → BO3S7FKQ.js} +1 -1
  76. package/dist/cdn/{ZIR6EOKG.js → BRPY77VA.js} +2 -2
  77. package/dist/cdn/{34IBI2AQ.js → BSSBZ2ER.js} +2 -2
  78. package/dist/cdn/{G57OJUTV.js → BTX6AXUQ.js} +2 -2
  79. package/dist/cdn/{VRDTHKQM.js → BUNVS4W5.js} +2 -2
  80. package/dist/cdn/{NPN7O4FC.js → BY3GJ3CC.js} +2 -2
  81. package/dist/cdn/{EYOCOJSR.js → BYHTYD3Z.js} +2 -2
  82. package/dist/cdn/{7P7IKFXJ.js → C6JV3SFP.js} +2 -2
  83. package/dist/cdn/CFGG33L3.js +4 -0
  84. package/dist/cdn/{UH2QOIEJ.js → CFK3L2YF.js} +3 -3
  85. package/dist/cdn/{RIAEKLSC.js → COA66VSX.js} +2 -2
  86. package/dist/cdn/{U65OM7BT.js → CQ7LEMHR.js} +2 -2
  87. package/dist/cdn/{47MIQ4DL.js → CRMHAJAF.js} +2 -2
  88. package/dist/cdn/{RHIDC6MD.js → CSM3L6AR.js} +2 -2
  89. package/dist/cdn/{OVAKXTWT.js → CT3POA2I.js} +1 -1
  90. package/dist/cdn/{LEM5ESDQ.js → CX6UAOFC.js} +2 -2
  91. package/dist/cdn/{BUR77F2K.js → CZ3BVZWT.js} +1 -1
  92. package/dist/cdn/{67M6LTDD.js → DA7Z7I7X.js} +2 -2
  93. package/dist/cdn/{A2TBPE2G.js → DIBEV5G6.js} +2 -2
  94. package/dist/cdn/{YOY2GNVH.js → DPUKESDE.js} +2 -2
  95. package/dist/cdn/{UC4MDLJF.js → DZCVQ56U.js} +2 -2
  96. package/dist/cdn/E4PI56YM.js +25 -0
  97. package/dist/cdn/{G2IXPHFG.js → E7LQ47NZ.js} +2 -2
  98. package/dist/cdn/{ANMSCQDK.js → EAJXKXMD.js} +2 -2
  99. package/dist/cdn/{7DRSRLQU.js → EEGAL5CF.js} +2 -2
  100. package/dist/cdn/{VW34EHE3.js → EEV7SOFB.js} +2 -2
  101. package/dist/cdn/{IONO5NHM.js → EHQ3VXEX.js} +2 -2
  102. package/dist/cdn/{2BSMPRPL.js → EI3UVHVJ.js} +2 -2
  103. package/dist/cdn/{TPXXUP67.js → EIUU6LFK.js} +2 -2
  104. package/dist/cdn/{6ALKL72V.js → EJPEGRC5.js} +2 -2
  105. package/dist/cdn/{E3J4OV7H.js → EQDRXUK4.js} +2 -2
  106. package/dist/cdn/{3R4UXQEY.js → EUKNWB5D.js} +2 -2
  107. package/dist/cdn/{4TXAIPAV.js → EY72R2LK.js} +2 -2
  108. package/dist/cdn/{MYSOOGRY.js → F2APN33Z.js} +1 -1
  109. package/dist/cdn/{FR3LDSFZ.js → F5XDXMQW.js} +2 -2
  110. package/dist/cdn/{3337RAYT.js → F6J4JHYY.js} +2 -2
  111. package/dist/cdn/{AZXNU3JV.js → FCHZ5RNV.js} +2 -2
  112. package/dist/cdn/{4ZPTS5KZ.js → FCOP3UI6.js} +2 -2
  113. package/dist/cdn/{GZJPCOO2.js → FM7IQX4W.js} +1 -1
  114. package/dist/cdn/{CZ3WANK2.js → FRWXWI2M.js} +2 -2
  115. package/dist/cdn/{6EVHCQPO.js → FVTQPVHE.js} +2 -2
  116. package/dist/cdn/{I2W6HP27.js → GGOYFIFO.js} +2 -2
  117. package/dist/cdn/{DDKMU6YS.js → GGVBPUEY.js} +1 -1
  118. package/dist/cdn/{QIVRCSOY.js → GLTMZBZ3.js} +2 -2
  119. package/dist/cdn/{NF5QA4VW.js → GNLOPXJZ.js} +2 -2
  120. package/dist/cdn/{O6M2B5IS.js → GTKJOQZ5.js} +2 -2
  121. package/dist/cdn/{SFCGDOPG.js → GUHRLDGP.js} +2 -2
  122. package/dist/cdn/{SMY5OKKE.js → GULICWSX.js} +2 -2
  123. package/dist/cdn/{O3YWDE5A.js → GWXCOATK.js} +2 -2
  124. package/dist/cdn/{HQPCR5CJ.js → GZ3JCXM2.js} +2 -2
  125. package/dist/cdn/{MWDFNHWF.js → GZ5FYQCV.js} +2 -2
  126. package/dist/cdn/{AFRKEAQM.js → H32TGV2M.js} +2 -2
  127. package/dist/cdn/{SHG23ECR.js → H36LQ652.js} +2 -2
  128. package/dist/cdn/{YVICINTE.js → H74XC2TA.js} +2 -2
  129. package/dist/cdn/{CYTBK2BQ.js → H752522M.js} +2 -2
  130. package/dist/cdn/{EWG4LDCG.js → HBXZXBY7.js} +2 -2
  131. package/dist/cdn/{GTLNO4OA.js → HEJ3YUKD.js} +1 -1
  132. package/dist/cdn/{Q6HYEE7V.js → HEWFNI5Z.js} +2 -2
  133. package/dist/cdn/{LUCWXIPQ.js → HFSCAQ24.js} +2 -2
  134. package/dist/cdn/{A7BJA2JV.js → HOP7ALIK.js} +2 -2
  135. package/dist/cdn/HZMBWRXQ.js +8 -0
  136. package/dist/cdn/{PV7IPXI2.js → I264P2LK.js} +3 -3
  137. package/dist/cdn/{LXWHWSX3.js → I34YH2F2.js} +1 -1
  138. package/dist/cdn/{ZTMI4TJ2.js → I3MPLFSS.js} +2 -2
  139. package/dist/cdn/{RIUNU5TW.js → I56B5SNN.js} +2 -2
  140. package/dist/cdn/{SGBJLWPE.js → I6MRF2RD.js} +2 -2
  141. package/dist/cdn/IC2ZRIYZ.css +1 -0
  142. package/dist/cdn/{ARSSBQ3Y.js → IIVGSCZM.js} +2 -2
  143. package/dist/cdn/{SVYYLS7W.js → IK7F27QS.js} +2 -2
  144. package/dist/cdn/{QUMBTJ7B.js → ILAB777S.js} +2 -2
  145. package/dist/cdn/{DJA3AADV.js → INFEDXBU.js} +2 -2
  146. package/dist/cdn/{BK567S5G.js → IOFVYSAR.js} +2 -2
  147. package/dist/cdn/{DBETPFAY.js → J7QYWG2V.js} +2 -2
  148. package/dist/cdn/{HKJ2253W.js → JANO2YZL.js} +2 -2
  149. package/dist/cdn/{FI4D65D6.js → JDXO6ZRX.js} +2 -2
  150. package/dist/cdn/{35KLWNMW.js → JER6JZXQ.js} +1 -1
  151. package/dist/cdn/{A4KBWJAK.js → JKQUT6DG.js} +2 -2
  152. package/dist/cdn/{ZP5EZBHS.js → JSJNYFZJ.js} +2 -2
  153. package/dist/cdn/{I6MGRLI4.js → JUYDS4OZ.js} +2 -2
  154. package/dist/cdn/{Y5GTW2DA.js → JVW7WLOW.js} +2 -2
  155. package/dist/cdn/{LJOZBNIY.js → JXB5LIL6.js} +2 -2
  156. package/dist/cdn/{JZEPTF2K.js → JXV5EH5F.js} +2 -2
  157. package/dist/cdn/{QLTUYSOO.js → K25ZDV3N.js} +2 -2
  158. package/dist/cdn/{QFKIG5HD.js → K4VJ4UUU.js} +2 -2
  159. package/dist/cdn/{KOO55D6Y.js → K4WXSKEW.js} +2 -2
  160. package/dist/cdn/{YRKM4RUJ.js → K6Y7PB4W.js} +1 -1
  161. package/dist/cdn/{AD4H2ATA.js → K74VECE5.js} +2 -2
  162. package/dist/cdn/{QERWPSRP.js → KCDXKG6S.js} +2 -2
  163. package/dist/cdn/KERNWLMR.js +4 -0
  164. package/dist/cdn/{WF66BB57.js → KFBZQQQ7.js} +2 -2
  165. package/dist/cdn/{SM5VDDRN.js → KFUZQVRG.js} +2 -2
  166. package/dist/cdn/{6BG7W3CN.js → KIM74FS2.js} +2 -2
  167. package/dist/cdn/{LJWWQW7J.js → KIQZ5WQU.js} +2 -2
  168. package/dist/cdn/{XH733SKB.js → KLSBDOEY.js} +2 -2
  169. package/dist/cdn/{R7EKXMAX.js → KOYHLFAL.js} +2 -2
  170. package/dist/cdn/{77DY6CAU.js → KSTLAKPR.js} +3 -3
  171. package/dist/cdn/{G7TXJGIG.js → KVWD2NCD.js} +1 -1
  172. package/dist/cdn/{WO4VN3HA.js → KXMHMNFG.js} +2 -2
  173. package/dist/cdn/{B25VKT4V.js → L3BR7QKR.js} +2 -2
  174. package/dist/cdn/{IZ2EPCHV.js → L3F7TJ6L.js} +2 -2
  175. package/dist/cdn/{LB5CWVM5.js → L5DUE5CZ.js} +2 -2
  176. package/dist/cdn/{GYNGOAT6.js → LAVEGGCU.js} +2 -2
  177. package/dist/cdn/{PWVFPPH5.js → LFXV5FIA.js} +2 -2
  178. package/dist/cdn/{QTVIQLKJ.js → LMO5IATU.js} +2 -2
  179. package/dist/cdn/{AS7XQPFZ.js → LQBQ6ZZ2.js} +2 -2
  180. package/dist/cdn/{7GQCHIIL.js → LRZ2H4VM.js} +1 -1
  181. package/dist/cdn/{EHPD5LNH.js → LTF34RHT.js} +4 -4
  182. package/dist/cdn/{LKD43DNT.js → LTUHFIIV.js} +2 -2
  183. package/dist/cdn/{FVBN55HK.js → MFUAOGF2.js} +2 -2
  184. package/dist/cdn/{4D4JUG4C.js → MGTNVXN6.js} +1 -1
  185. package/dist/cdn/{HIVBMS4W.js → MJE3V7QY.js} +2 -2
  186. package/dist/cdn/{HA657JM2.js → MMYFF5BN.js} +2 -2
  187. package/dist/cdn/{YF6SFVFK.js → MOMQCSIV.js} +2 -2
  188. package/dist/cdn/{HDIHCB33.js → MTK6HSL2.js} +2 -2
  189. package/dist/cdn/{RDAND746.js → MVUCSBRQ.js} +1 -1
  190. package/dist/cdn/MXVIDHVI.js +6 -0
  191. package/dist/cdn/{3LKWFYL2.js → MYD4NK2J.js} +2 -2
  192. package/dist/cdn/MZQU2J2U.js +18 -0
  193. package/dist/cdn/{7EN7HPX7.js → N4C5NAQY.js} +1 -1
  194. package/dist/cdn/{LLAJ5GH2.js → N7LRP7YX.js} +2 -2
  195. package/dist/cdn/{F4W35326.js → NAU5WDAR.js} +2 -2
  196. package/dist/cdn/{F7AR6B4Q.js → NDJACPW5.js} +2 -2
  197. package/dist/cdn/{FSQIWFIM.js → NE2OEA2D.js} +2 -2
  198. package/dist/cdn/{G2RN44GK.js → NIWJURVV.js} +1 -1
  199. package/dist/cdn/{5325K6YZ.js → NL6JR43M.js} +2 -2
  200. package/dist/cdn/{SLAQ2GU6.js → NLMLINN5.js} +2 -2
  201. package/dist/cdn/{TRSI6C4V.js → NMWGRUCG.js} +2 -2
  202. package/dist/cdn/NO34SVO5.js +4 -0
  203. package/dist/cdn/{CIRQZIIA.js → NVI5TEOI.js} +2 -2
  204. package/dist/cdn/{UYLUOL7G.js → NYQNROUW.js} +2 -2
  205. package/dist/cdn/{RAS6VSVN.js → O4QMU4K5.js} +2 -2
  206. package/dist/cdn/{QF3STRWQ.js → OBILOKBT.js} +1 -1
  207. package/dist/cdn/{D54KWJVY.js → OGASMD3V.js} +2 -2
  208. package/dist/cdn/{GPG6ILNV.js → OKPE75LL.js} +2 -2
  209. package/dist/cdn/{4MD75RVS.js → OQLSBZBK.js} +1 -1
  210. package/dist/cdn/{WMQPXSBF.js → OQVRSS4R.js} +2 -2
  211. package/dist/cdn/{3CS7YODH.js → ORKEWGRR.js} +2 -2
  212. package/dist/cdn/PFUYV3G4.js +81 -0
  213. package/dist/cdn/{D5EP34TV.js → PN2RZQ5Z.js} +1 -1
  214. package/dist/cdn/{YUMDEDM5.js → PPS7C4OY.js} +2 -2
  215. package/dist/cdn/{QKXPSAO2.js → Q32XHGZN.js} +2 -2
  216. package/dist/cdn/{JUZPVELG.js → Q3ISOYAQ.js} +2 -2
  217. package/dist/cdn/Q4BABE57.css +1 -0
  218. package/dist/cdn/QAJ2PAW7.js +4 -0
  219. package/dist/cdn/{SUGOUOC4.js → QBC5SBBE.js} +1 -1
  220. package/dist/cdn/{5OV7AWYU.js → QCHFRVHM.js} +2 -2
  221. package/dist/cdn/{7DGYAZNS.js → QMB4QM6Y.js} +1 -1
  222. package/dist/cdn/{P3J337S3.js → QQ4UOWYP.js} +2 -2
  223. package/dist/cdn/{ZS4TLPQ3.js → QST55MDE.js} +2 -2
  224. package/dist/cdn/{GBQZCOMU.js → QTJB45LA.js} +2 -2
  225. package/dist/cdn/{JHZQDGOM.js → QUUCQ7VD.js} +2 -2
  226. package/dist/cdn/RGMD7TWK.js +8 -0
  227. package/dist/cdn/{HGDIBWTX.js → RGVGURNS.js} +3 -3
  228. package/dist/cdn/{HLDTKQML.js → RHIM2X2N.js} +2 -2
  229. package/dist/cdn/{NY445WIU.js → RI4DNTJV.js} +1 -1
  230. package/dist/cdn/{H55RDRDA.js → RLX2PT2V.js} +2 -2
  231. package/dist/cdn/{U5Z46A5E.js → RNI7TT4M.js} +2 -2
  232. package/dist/cdn/{XWTGQKAR.js → RO5PJ76M.js} +1 -1
  233. package/dist/cdn/{LNTT6I2X.js → ROCIFSUL.js} +2 -2
  234. package/dist/cdn/{J3N2IR3X.js → RWXLPD4H.js} +2 -2
  235. package/dist/cdn/{7KMQUKVD.js → RYES6YM3.js} +2 -2
  236. package/dist/cdn/{RP55AFNY.js → S3MH5MBH.js} +2 -2
  237. package/dist/cdn/{DP6BIYZV.js → SAKENJP3.js} +2 -2
  238. package/dist/cdn/SBTBR7XC.js +4 -0
  239. package/dist/cdn/{NDEKQB6R.js → SCKOUQAW.js} +2 -2
  240. package/dist/cdn/{UQBP62ZD.js → SMIITNGH.js} +2 -2
  241. package/dist/cdn/{RZM7X2DV.js → SRYSQJ5H.js} +2 -2
  242. package/dist/cdn/{KNFAYFJX.js → SRZTL2NZ.js} +2 -2
  243. package/dist/cdn/{KN7A2W4U.js → T2S47FRF.js} +2 -2
  244. package/dist/cdn/T5YWANI2.js +18 -0
  245. package/dist/cdn/{KVMXA3Y6.js → THEX57MF.js} +2 -2
  246. package/dist/cdn/{D4IRZK6U.js → TKL4MG3Q.js} +2 -2
  247. package/dist/cdn/{FIGAKUCR.js → TMK2YYUU.js} +2 -2
  248. package/dist/cdn/{AX43INFU.js → TMNFYHGY.js} +2 -2
  249. package/dist/cdn/{ULVD3IW2.js → TPFTOSLE.js} +2 -2
  250. package/dist/cdn/{6GTMUJA6.js → TTV4NRBC.js} +2 -2
  251. package/dist/cdn/{B3YWATN3.js → TX7MPMSV.js} +2 -2
  252. package/dist/cdn/{46FXW275.js → TZZA2IJ3.js} +3 -3
  253. package/dist/cdn/{SDHBTMKJ.js → U4LWE3ZY.js} +2 -2
  254. package/dist/cdn/{ZGOI3FXD.js → UGA6C7H6.js} +2 -2
  255. package/dist/cdn/{EWLFZX72.js → UR7VT743.js} +2 -2
  256. package/dist/cdn/USF6ABOG.js +4 -0
  257. package/dist/cdn/{VWNN4SWV.js → UTJPTXFZ.js} +2 -2
  258. package/dist/cdn/{QPH2ZSRJ.js → V3BJ3C7G.js} +2 -2
  259. package/dist/cdn/{L2MNL4N6.js → V3FGPANI.js} +2 -2
  260. package/dist/cdn/{BRGIANIA.js → V7ETNYJN.js} +2 -2
  261. package/dist/cdn/{VE76CHCV.js → VHDKMKRB.js} +2 -2
  262. package/dist/cdn/{6L5CFL7R.js → VIUJIRMV.js} +2 -2
  263. package/dist/cdn/{TOZIXJZO.js → VKM2IICG.js} +2 -2
  264. package/dist/cdn/{HPHWYMF3.js → VLIQM5XM.js} +2 -2
  265. package/dist/cdn/{KAV773MF.js → VNC7CXVL.js} +1 -1
  266. package/dist/cdn/{SKSAREHZ.js → VPYZU3PV.js} +2 -2
  267. package/dist/cdn/{2EEVDFAG.js → VQANXEIF.js} +2 -2
  268. package/dist/cdn/{WCPFC4PZ.js → W2C4A6AQ.js} +2 -2
  269. package/dist/cdn/{SLB4NTXY.js → WAICL3LP.js} +2 -2
  270. package/dist/cdn/{Y7UBXMDQ.js → WBJPA4F4.js} +2 -2
  271. package/dist/cdn/{2QFXOBI3.js → WCFYJXHQ.js} +1 -1
  272. package/dist/cdn/{M6HNM3ML.js → WL7PFVSR.js} +2 -2
  273. package/dist/cdn/{KUSFOMTK.js → WSD7UQUA.js} +2 -2
  274. package/dist/cdn/{SIX2JQL2.js → X7AWZSTB.js} +1 -1
  275. package/dist/cdn/X7CK777N.js +4 -0
  276. package/dist/cdn/{FNN6KMV2.js → XBJI7OVV.js} +2 -2
  277. package/dist/cdn/{TN3ITLSW.js → XIPPDG54.js} +2 -2
  278. package/dist/cdn/{3ZLMDYKJ.js → XIU26NMO.js} +2 -2
  279. package/dist/cdn/{3AHKLMK7.js → XIX3CLNV.js} +2 -2
  280. package/dist/cdn/{5MPACKGM.js → XJ4Q4SWE.js} +2 -2
  281. package/dist/cdn/{WIMSMHDF.js → XQ7LKWS6.js} +2 -2
  282. package/dist/cdn/{B6EWOQY5.js → XYIYSCJF.js} +2 -2
  283. package/dist/cdn/{SF4CXPFN.js → Y2JZNUZN.js} +2 -2
  284. package/dist/cdn/{JARC45CV.js → Y5ITNA7H.js} +1 -1
  285. package/dist/cdn/{RQWAIILE.js → YAIWCQES.js} +2 -2
  286. package/dist/cdn/{MQS3QZ22.js → YJ4NJMG7.js} +2 -2
  287. package/dist/cdn/{F63KEMM3.js → YKSLBBBW.js} +1 -1
  288. package/dist/cdn/{F7HH77RT.js → YLTW4Q2G.js} +2 -2
  289. package/dist/cdn/YR23NYJC.js +4 -0
  290. package/dist/cdn/{YYNMOKSW.js → YWNZV6CK.js} +2 -2
  291. package/dist/cdn/{IF2SDHZP.js → Z36FODX2.js} +2 -2
  292. package/dist/cdn/{DZOQFMST.js → Z7EWWUJK.js} +2 -2
  293. package/dist/cdn/{KCM2OFY3.js → ZHCQ73AF.js} +2 -2
  294. package/dist/cdn/{QKSQZGNF.js → ZJMMDGSQ.js} +2 -2
  295. package/dist/cdn/{57YXUARI.js → ZLELJP4A.js} +2 -2
  296. package/dist/cdn/ZQ37VBMP.js +4 -0
  297. package/dist/cdn/{HKNCASTM.js → ZZWNL2AJ.js} +2 -2
  298. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ar.json +1 -1
  299. package/dist/cdn/assets/solution-configure-titles/t9n/messages.bg.json +1 -1
  300. package/dist/cdn/assets/solution-configure-titles/t9n/messages.bs.json +1 -1
  301. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ca.json +1 -1
  302. package/dist/cdn/assets/solution-configure-titles/t9n/messages.cs.json +1 -1
  303. package/dist/cdn/assets/solution-configure-titles/t9n/messages.da.json +1 -1
  304. package/dist/cdn/assets/solution-configure-titles/t9n/messages.de.json +1 -1
  305. package/dist/cdn/assets/solution-configure-titles/t9n/messages.el.json +1 -1
  306. package/dist/cdn/assets/solution-configure-titles/t9n/messages.es.json +1 -1
  307. package/dist/cdn/assets/solution-configure-titles/t9n/messages.et.json +1 -1
  308. package/dist/cdn/assets/solution-configure-titles/t9n/messages.fi.json +1 -1
  309. package/dist/cdn/assets/solution-configure-titles/t9n/messages.fr.json +1 -1
  310. package/dist/cdn/assets/solution-configure-titles/t9n/messages.he.json +1 -1
  311. package/dist/cdn/assets/solution-configure-titles/t9n/messages.hr.json +1 -1
  312. package/dist/cdn/assets/solution-configure-titles/t9n/messages.hu.json +1 -1
  313. package/dist/cdn/assets/solution-configure-titles/t9n/messages.id.json +1 -1
  314. package/dist/cdn/assets/solution-configure-titles/t9n/messages.it.json +1 -1
  315. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ja.json +1 -1
  316. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ko.json +1 -1
  317. package/dist/cdn/assets/solution-configure-titles/t9n/messages.lt.json +1 -1
  318. package/dist/cdn/assets/solution-configure-titles/t9n/messages.lv.json +1 -1
  319. package/dist/cdn/assets/solution-configure-titles/t9n/messages.nl.json +1 -1
  320. package/dist/cdn/assets/solution-configure-titles/t9n/messages.no.json +1 -1
  321. package/dist/cdn/assets/solution-configure-titles/t9n/messages.pl.json +1 -1
  322. package/dist/cdn/assets/solution-configure-titles/t9n/messages.pt-BR.json +1 -1
  323. package/dist/cdn/assets/solution-configure-titles/t9n/messages.pt-PT.json +1 -1
  324. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ro.json +1 -1
  325. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ru.json +1 -1
  326. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sk.json +1 -1
  327. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sl.json +1 -1
  328. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sr.json +1 -1
  329. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sv.json +1 -1
  330. package/dist/cdn/assets/solution-configure-titles/t9n/messages.th.json +1 -1
  331. package/dist/cdn/assets/solution-configure-titles/t9n/messages.tr.json +1 -1
  332. package/dist/cdn/assets/solution-configure-titles/t9n/messages.uk.json +1 -1
  333. package/dist/cdn/assets/solution-configure-titles/t9n/messages.vi.json +1 -1
  334. package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-CN.json +1 -1
  335. package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-HK.json +1 -1
  336. package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-TW.json +1 -1
  337. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.en.json +1 -1
  338. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.json +1 -1
  339. package/dist/cdn/index.js +2 -2
  340. package/dist/cdn/main.css +1 -1
  341. package/dist/cdn/stdin.css +1 -0
  342. package/dist/chunks/Auth.js +1 -1
  343. package/dist/chunks/appConfig.js +1 -1
  344. package/dist/chunks/cardFetchingUtils.js +1 -1
  345. package/dist/chunks/common.js +1 -1
  346. package/dist/chunks/deployAppContexts.js +1 -1
  347. package/dist/chunks/downloadUtils.js +1 -1
  348. package/dist/chunks/helpers.js +1 -1
  349. package/dist/chunks/index.js +1 -1
  350. package/dist/chunks/interfaces.js +1 -1
  351. package/dist/chunks/loadModules.js +1 -1
  352. package/dist/chunks/mapViewUtils.js +1 -1
  353. package/dist/chunks/pciUtils.js +1 -1
  354. package/dist/chunks/popupUtils.js +1 -1
  355. package/dist/chunks/prepareDataForSolutionDisplay.js +1 -1
  356. package/dist/chunks/privilegeUtils.js +1 -1
  357. package/dist/chunks/publicNotificationStore.js +1 -1
  358. package/dist/chunks/queryUtils.js +1 -1
  359. package/dist/chunks/runtime.js +2 -1
  360. package/dist/chunks/solution-store.js +1 -1
  361. package/dist/chunks/templates.js +1 -1
  362. package/dist/chunks/useT9n.js +1 -1
  363. package/dist/components/arcgis-solutions-assistant/customElement.js +1 -1
  364. package/dist/components/basemap-gallery/customElement.js +1 -1
  365. package/dist/components/buffer-tools/customElement.js +1 -1
  366. package/dist/components/card-manager/customElement.js +1 -1
  367. package/dist/components/consent-manager/customElement.js +54 -54
  368. package/dist/components/create-feature/customElement.js +1 -1
  369. package/dist/components/create-related-feature/customElement.js +1 -1
  370. package/dist/components/crowdsource-manager/customElement.js +1 -1
  371. package/dist/components/crowdsource-reporter/customElement.js +1 -1
  372. package/dist/components/deduct-calculator/customElement.js +1 -1
  373. package/dist/components/delete-button/customElement.js +1 -1
  374. package/dist/components/delete-dialog/customElement.js +1 -1
  375. package/dist/components/edit-card/customElement.js +1 -1
  376. package/dist/components/feature-details/customElement.js +1 -1
  377. package/dist/components/feature-list/customElement.js +1 -1
  378. package/dist/components/field-selection/customElement.js +1 -1
  379. package/dist/components/floor-filter/customElement.js +1 -1
  380. package/dist/components/info-card/customElement.js +1 -1
  381. package/dist/components/json-editor/customElement.js +1 -1
  382. package/dist/components/layer-list/customElement.js +1 -1
  383. package/dist/components/layer-table/customElement.js +1 -1
  384. package/dist/components/map-card/customElement.js +1 -1
  385. package/dist/components/map-draw-tools/customElement.js +1 -1
  386. package/dist/components/map-fullscreen/customElement.js +1 -1
  387. package/dist/components/map-layer-picker/customElement.js +1 -1
  388. package/dist/components/map-legend/customElement.js +1 -1
  389. package/dist/components/map-picker/customElement.js +1 -1
  390. package/dist/components/map-search/customElement.js +1 -1
  391. package/dist/components/map-select-tools/customElement.js +1 -1
  392. package/dist/components/map-tools/customElement.js +1 -1
  393. package/dist/components/pci-calculator/customElement.js +1 -1
  394. package/dist/components/pdf-download/customElement.js +1 -1
  395. package/dist/components/public-notification/customElement.js +1 -1
  396. package/dist/components/refine-selection/customElement.js +1 -1
  397. package/dist/components/selection-tool/customElement.js +1 -1
  398. package/dist/components/solution-article-card/customElement.js +1 -1
  399. package/dist/components/solution-configuration/customElement.js +1 -1
  400. package/dist/components/solution-configure-dialog/customElement.js +38 -121
  401. package/dist/components/solution-configure-dialog/index.d.ts +0 -3
  402. package/dist/components/solution-configure-dialog/index.js +0 -3
  403. package/dist/components/solution-configure-titles/customElement.js +10 -10
  404. package/dist/components/solution-contents/customElement.js +1 -1
  405. package/dist/components/solution-delete-dialog/customElement.js +24 -25
  406. package/dist/components/solution-deploy-dialog/customElement.js +1 -1
  407. package/dist/components/solution-deployed-card/customElement.js +8 -8
  408. package/dist/components/solution-deploying-dialog/customElement.js +1 -1
  409. package/dist/components/solution-details-card/customElement.js +2 -2
  410. package/dist/components/solution-details-panel/customElement.js +3 -3
  411. package/dist/components/solution-item/customElement.js +1 -1
  412. package/dist/components/solution-item-accordion/customElement.js +1 -1
  413. package/dist/components/solution-item-details/customElement.js +1 -1
  414. package/dist/components/solution-item-diagram/customElement.d.ts +2 -0
  415. package/dist/components/solution-item-diagram/customElement.js +10 -9
  416. package/dist/components/solution-item-diagram/utils/SolutionDisplay.d.ts +2 -1
  417. package/dist/components/solution-item-icon/customElement.js +1 -1
  418. package/dist/components/solution-item-sharing/customElement.js +1 -1
  419. package/dist/components/solution-organization-variables/customElement.js +1 -1
  420. package/dist/components/solution-resource-item/customElement.js +1 -1
  421. package/dist/components/solution-snapshot-gallery/customElement.js +1 -1
  422. package/dist/components/solution-social-share/customElement.js +1 -1
  423. package/dist/components/solution-spatial-ref/customElement.js +1 -1
  424. package/dist/components/solution-template-data/customElement.js +1 -1
  425. package/dist/components/solution-variables/customElement.js +1 -1
  426. package/dist/components/solutions-all-panel/customElement.js +38 -34
  427. package/dist/components/solutions-all-shell/customElement.js +1 -1
  428. package/dist/components/solutions-article-panel/customElement.js +1 -1
  429. package/dist/components/solutions-articles/customElement.js +1 -1
  430. package/dist/components/solutions-articles-shell/customElement.js +1 -1
  431. package/dist/components/solutions-deployed-panel/customElement.js +1 -1
  432. package/dist/components/solutions-deployed-shell/customElement.js +1 -1
  433. package/dist/components/solutions-filter-panel/customElement.js +1 -1
  434. package/dist/components/spatial-ref/customElement.js +1 -1
  435. package/dist/components/store-manager/customElement.js +1 -1
  436. package/dist/docs/api.json +19 -2
  437. package/dist/docs/docs.json +24 -2
  438. package/dist/docs/web-types.json +6 -1
  439. package/dist/index.js +1 -1
  440. package/dist/loader.js +2 -2
  441. package/dist/types/lumina.d.ts +1 -1
  442. package/dist/types/preact.d.ts +1 -1
  443. package/dist/types/react.d.ts +1 -1
  444. package/dist/types/stencil.d.ts +1 -1
  445. package/package.json +1 -1
  446. package/dist/cdn/5253FCAA.js +0 -4
  447. package/dist/cdn/77RPO7MJ.js +0 -8
  448. package/dist/cdn/7JGAEA3J.js +0 -4
  449. package/dist/cdn/A5KVJBPR.js +0 -8
  450. package/dist/cdn/APNPQ7O7.js +0 -4
  451. package/dist/cdn/B5FGKAM6.js +0 -4
  452. package/dist/cdn/D2ATJM23.js +0 -25
  453. package/dist/cdn/EHWDZP62.js +0 -4
  454. package/dist/cdn/F6Y7AO3M.js +0 -18
  455. package/dist/cdn/FGFRQH3J.js +0 -81
  456. package/dist/cdn/GDBXS7KE.js +0 -4
  457. package/dist/cdn/GO3CZAXV.js +0 -4
  458. package/dist/cdn/IHQKADUC.js +0 -4
  459. package/dist/cdn/KKC3EZXQ.js +0 -4
  460. package/dist/cdn/ODSRLWLP.js +0 -6
  461. package/dist/cdn/RLYQ3LRK.js +0 -18
  462. package/dist/cdn/S3JQNLJM.js +0 -18
  463. package/dist/cdn/YV6HJVHW.js +0 -4
  464. package/dist/cdn/ZI4TWRCO.js +0 -4
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/1.1/esri/copyright.txt for details.
3
- v1.1.0-next.20250813 */
4
- import{a as Zn}from"./MJIIJ7IR.js";import"./ULVD3IW2.js";import"./57YXUARI.js";import{b as $n,c as Jn}from"./EHWDZP62.js";import{h as qn,i as Hn,w as Zs,x as Qs,y as Wn}from"./UH2QOIEJ.js";import"./YRKM4RUJ.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.fC(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.fC(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 G(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 fC(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.G(t)&&t.constructor?f.Dn(t.constructor):typeof t}static Uh(t,e){return e==null||e===""?null:f.G(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return f.G(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 gw(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 mw="32ab5ff3b26f42dc0ed90f21412913b5"}f.vfo="29e646fdb163";class B{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;Gt;At;constructor(t){this.qt=t,this.Ds=null,t.sr=null,this.Gt=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.Gt=t.nt,this.At=-1}next(){let t=this.qt;if(t.nt!==this.Gt){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.Gt=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.Gt=-1,this.Ds=null,this.qt.sr=this}toString(){return"ListIterator@"+this.At+"/"+this.qt.count}}class ht{qt;Gt;At;constructor(t){this.qt=t,t.nr=null,this.Gt=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.Gt=t.nt,this.At=t.r.length}next(){let t=this.qt;if(t.nt!==this.Gt){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.Gt=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.Gt=-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}Pt(){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 uC(){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}Pt(){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 pw=1;static Ki(t){t.__gohashid=I.pw++}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}Pt(){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}Pt(){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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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.dC(t.x-this.px,t.y-this.py)}direction(t,e){return this.dC(t-this.px,e-this.py)}dC(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 gC=new P(-1/0,-1/0).$();static mC=new P(1/0,1/0).$();static pC=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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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 yC=new Q(6,6).$();static nu=new Q(8,8).$();static wC=new Q(10,10).$();static Bk=new Q(1/0,1/0).$();static ww=new Q(NaN,NaN).$();static xC=[];static l(){let t=Q.xC.pop();return t===void 0?new Q:t}static e(t){Q.xC.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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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.xw(e,t,e,t)}addMargin(t){return this.xw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.xw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.xw(t,e,i,s)}xw(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.bC(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.bC(t,e,i,s)}bC(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.kC(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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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 PC=new Lt(2,2,2,2).$();static SC=[];static l(){let t=Lt.SC.pop();return t===void 0?new Lt:t}static e(t){Lt.SC.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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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 MC=[];static l(){let t=D.MC.pop();return t===void 0?new D:t}static e(t){D.MC.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}Yk(){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}NC(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}bw(){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)}kw(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 CC=[];static l(){let t=Pt.CC.pop();return t===void 0?new Pt:t}static e(t){Pt.CC.push(t)}static Gk="54a702f3e53909c447824c6706603faf4c"}let L={QD:"7da71ca0ad381e90",Rn:4*((Math.sqrt(2)-1)/3),LC:null,Pw:x=>{if(x<=0)return 0;let t=L.LC;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);L.LC=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},Sw:(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.Sw(x,t,u,d,w,b,S,M,a,h,l,c)||L.Sw(S,M,v,k,m,y,o,r,a,h,l,c)}else return L.vi(x,t,o,r,c,h,l)},AC:(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 V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,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 V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,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},Mw:(x,t,e)=>L.kC(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),kC:(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),TC:(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},DC:(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.Nw,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 Nw=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.FC(t):t.type===1&&this.type===4?t.FC(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)}FC(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 Yg="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.Yg+"])(["+kt.Yg+"])","gm"),s=new RegExp("(["+kt.Yg+"])([^s])","gm"),n=new RegExp("([^s])(["+kt.Yg+"])","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 V=f.et(),X="",Y=!1;for(let j=0;j<O.length;j++){let U=O[j];U==="."&&!Y?(Y=!0,X+=U):U==="."?(V.push(X),X="."):X+=U}V.push(X),o.splice(R,1);for(let j=0;j<V.length;j++)o.splice(R+j,0,V[j]);R+=V.length-1,f.J(V)}}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()),V=parseFloat(p());a===a.toLowerCase()&&(O=u.x+O,V=u.y+V),R.i(O,V)}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.RC(null),S=!1,M=!1,F=!1,T=!0,N=new RegExp("["+kt.Yg+"]");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 V=y();k.lr(V.x,V.y)}break;case"L":for(;!g();){let V=y();k.lr(V.x,V.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 V=new P;m(V);let X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!g();){let V=b(),X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!g();){let V=w(),X=y();k.Cw(V.x,V.y,X.x,X.y)}d&&(R=!0);break;case"T":for(;!g();){let V=b();c.a(V);let X=y();k.Cw(V.x,V.y,X.x,X.y),c.a(X)}d&&(R=!0);break;case"B":for(;!g();){let V=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(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"A":for(;!g();){let V=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(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"Z":k.rF(),u.a(l);break;case"F":{let V="",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}V=o[r+X];break}V.match(/[Mm]/)?S=!0:k.lF();break}case"U":{let V="",X=1;for(;o[r+X];){if(o[r+X].match(/[Ff]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}V=o[r+X];break}V.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()},
3
+ v1.1.0-next.20250814 */
4
+ import{a as Zn}from"./4CBNOR6N.js";import"./TPFTOSLE.js";import"./ZLELJP4A.js";import{b as $n,c as Jn}from"./4VDUJIVA.js";import{h as qn,i as Hn,w as Zs,x as Qs,y as Wn}from"./CFK3L2YF.js";import"./K6Y7PB4W.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.fC(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.fC(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 G(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 fC(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.G(t)&&t.constructor?f.Dn(t.constructor):typeof t}static Uh(t,e){return e==null||e===""?null:f.G(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return f.G(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 gw(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 mw="32ab5ff3b26f42dc0ed90f21412913b5"}f.vfo="29e646fdb163";class B{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;Gt;At;constructor(t){this.qt=t,this.Ds=null,t.sr=null,this.Gt=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.Gt=t.nt,this.At=-1}next(){let t=this.qt;if(t.nt!==this.Gt){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.Gt=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.Gt=-1,this.Ds=null,this.qt.sr=this}toString(){return"ListIterator@"+this.At+"/"+this.qt.count}}class ht{qt;Gt;At;constructor(t){this.qt=t,t.nr=null,this.Gt=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.Gt=t.nt,this.At=t.r.length}next(){let t=this.qt;if(t.nt!==this.Gt){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.Gt=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.Gt=-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}Pt(){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 uC(){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}Pt(){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 pw=1;static Ki(t){t.__gohashid=I.pw++}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}Pt(){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}Pt(){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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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.dC(t.x-this.px,t.y-this.py)}direction(t,e){return this.dC(t-this.px,e-this.py)}dC(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 gC=new P(-1/0,-1/0).$();static mC=new P(1/0,1/0).$();static pC=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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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 yC=new Q(6,6).$();static nu=new Q(8,8).$();static wC=new Q(10,10).$();static Bk=new Q(1/0,1/0).$();static ww=new Q(NaN,NaN).$();static xC=[];static l(){let t=Q.xC.pop();return t===void 0?new Q:t}static e(t){Q.xC.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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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.xw(e,t,e,t)}addMargin(t){return this.xw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.xw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.xw(t,e,i,s)}xw(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.bC(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.bC(t,e,i,s)}bC(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.kC(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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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 PC=new Lt(2,2,2,2).$();static SC=[];static l(){let t=Lt.SC.pop();return t===void 0?new Lt:t}static e(t){Lt.SC.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}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(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 MC=[];static l(){let t=D.MC.pop();return t===void 0?new D:t}static e(t){D.MC.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}Yk(){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}NC(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}bw(){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)}kw(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 CC=[];static l(){let t=Pt.CC.pop();return t===void 0?new Pt:t}static e(t){Pt.CC.push(t)}static Gk="54a702f3e53909c447824c6706603faf4c"}let L={QD:"7da71ca0ad381e90",Rn:4*((Math.sqrt(2)-1)/3),LC:null,Pw:x=>{if(x<=0)return 0;let t=L.LC;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);L.LC=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},Sw:(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.Sw(x,t,u,d,w,b,S,M,a,h,l,c)||L.Sw(S,M,v,k,m,y,o,r,a,h,l,c)}else return L.vi(x,t,o,r,c,h,l)},AC:(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 V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,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 V=(d.x-a)**2+(d.y-h)**2;V<N&&(N=V,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},Mw:(x,t,e)=>L.kC(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),kC:(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),TC:(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},DC:(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.Nw,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 Nw=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.FC(t):t.type===1&&this.type===4?t.FC(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)}FC(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 Yg="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.Yg+"])(["+kt.Yg+"])","gm"),s=new RegExp("(["+kt.Yg+"])([^s])","gm"),n=new RegExp("([^s])(["+kt.Yg+"])","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 V=f.et(),X="",Y=!1;for(let j=0;j<O.length;j++){let U=O[j];U==="."&&!Y?(Y=!0,X+=U):U==="."?(V.push(X),X="."):X+=U}V.push(X),o.splice(R,1);for(let j=0;j<V.length;j++)o.splice(R+j,0,V[j]);R+=V.length-1,f.J(V)}}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()),V=parseFloat(p());a===a.toLowerCase()&&(O=u.x+O,V=u.y+V),R.i(O,V)}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.RC(null),S=!1,M=!1,F=!1,T=!0,N=new RegExp("["+kt.Yg+"]");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 V=y();k.lr(V.x,V.y)}break;case"L":for(;!g();){let V=y();k.lr(V.x,V.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 V=new P;m(V);let X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!g();){let V=b(),X=w(),Y=y();k.hr(V.x,V.y,X.x,X.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!g();){let V=w(),X=y();k.Cw(V.x,V.y,X.x,X.y)}d&&(R=!0);break;case"T":for(;!g();){let V=b();c.a(V);let X=y();k.Cw(V.x,V.y,X.x,X.y),c.a(X)}d&&(R=!0);break;case"B":for(;!g();){let V=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(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"A":for(;!g();){let V=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(V,X,Y,j,U,nt,at)}d&&(R=!0);break;case"Z":k.rF(),u.a(l);break;case"F":{let V="",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}V=o[r+X];break}V.match(/[Mm]/)?S=!0:k.lF();break}case"U":{let V="",X=1;for(;o[r+X];){if(o[r+X].match(/[Ff]/)!==null){X++;continue}if(o[r+X].match(N)===null){X++;continue}V=o[r+X];break}V.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
5
  string: ${t}`);break}}let C=k.Gg;if(Ke.vC(k),e){let R=C.figures.iterator;for(;R.next();){let O=R.value;O.isFilled=!0}}return C}static OC(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}Lw(){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.Pt(),isNaN(this.rc)||isNaN(this.lc)?t.i(0,0,0,0):t.i(0,0,this.rc,this.lc),this.IC(t,!1),t.unionNoCheck(0,0,0,0),t.u()}computeBoundsWithoutOrigin(){let t=new z;return this.IC(t,!0),t}IC(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.Aw(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.Aw(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,V=(T.point1Y*2+g)/3;u=L.Eg(l,c,C,R,O,V,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 V=this.Aw(n,o,r,a,l,c,T.type===5?T.centerX:T.endX,T.type===5?T.centerY:T.endY);if(isNaN(V))return!0;h+=V;break}let O=null;for(let V=0;V<R;V++){if(O=C[V],V===0){let X=this.Aw(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}Aw(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}EC(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.UC(),this.oc}UC(){if(this.oc===null){let t=this.oc=[],e=this.ru=[];this.fF(t,e)}}get flattenedLengths(){return this.UC(),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.Nw===null&&(kt.Nw=new G().u()),this.Rs=kt.Nw),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.Lw(),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.Sw(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.Sw(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.TC(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.OC(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,V=(-m-v)/r,X=T(C,R,O,V),Y=F(C,R,O,V);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.TC(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.OC(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;Tw;Dw;jg;Hg;qg;Wg;Jg;$g;Zg;Qg;_g;tm;im;ko;em;sm;nm;be;constructor(){this.N=null,this.Tw=new P(0,0).u(),this.Dw=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.Tw.a(this.viewPoint),t.Dw.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.Tw}set viewPoint(t){this.Tw.a(t)}get documentPoint(){return this.Dw}set documentPoint(t){this.Dw.a(t)}getMultiTouchViewPoint(t,e){let i=this.diagram;return i===null||i.BC(this.event,t,e),e}getMultiTouchDocumentPoint(t,e){let i=this.diagram;return i===null||(i.BC(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;St;om;rm;constructor(){this.N=null,this.St="",this.om=null,this.rm=null}copy(){let t=new Wi;return t.N=this.N,t.St=this.St,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.St}set name(t){this.St=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.G(e)&&f.it(e.copyFrozen)?t.ac=e.copyFrozen():t.ac=e,e=this.cc,f.G(e)&&f.it(e.copyFrozen)?t.cc=e.copyFrozen():t.cc=e,e=this.fc,f.G(e)&&f.it(e.copyFrozen)?t.fc=e.copyFrozen():t.fc=e,e=this.uc,f.G(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.VC(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.VC(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{zC;St;$k;constructor(){this.zC=new G().u(),this.St="",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
6
  `+n.toString())}}return e}clear(){let t=this.changes;t.Pt();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.Pt(),e.removeAt(i)}e.u()}thaw(){this.changes.Pt()}optimize(){if(!this.isComplete)return;let t=this.changes;t.Pt();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.zC}get name(){return this.St}set name(t){this.St=t}get isComplete(){return this.$k}set isComplete(t){this.$k=t}}class $i{Fw;Oi;XC;Os;Zk;hm;Vn;Qk;_k;sn;dc;Rw;Is;vw;Ow;am;Iw;constructor(t){this.Fw=new I,this.Oi=!1,this.XC=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.Rw=!0,this.vw=!1,this.Ow=!1,this.am=!1,this.Iw=!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
7
  `+this.history.elt(s).toString(t-1)}return e}clear(){let t=this.history;t.Pt();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.Pt(),this.sn.clear(),this.sn.u(),this.dc.clear(),this.vw=!1,this.Ow=!1,this.am=!1,this.Iw=!1}copyProperties(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.cm=t.cm}addModel(t){this.Fw.add(t)}removeModel(t){this.Fw.delete(t)}startTransaction(t){if(t===void 0&&(t=""),t===null&&(t=""),this.isUndoingRedoing)return!1;this.Rw===!0&&(this.Rw=!1,this.Vn++,this.wl||this.xl("StartingFirstTransaction",t,this.currentTransaction),this.Vn>0&&this.Vn--),this.isEnabled&&(this.sn.Pt(),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.Pt(),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.Pt();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.Ew&&this.clear(),this.Ew=!1,this.Uw=!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.Pt();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()}thaw(){this.history.Pt()}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.Pt(),s.add(i),s.u(),this.cm&&this._k>0&&this.transactionLevel<=0&&!this.Rw){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.Fw.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.XC}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 Ew(){return this.vw}set Ew(t){this.vw=t}get Uw(){return this.Ow}set Uw(t){this.Ow=t}get wl(){return this.Iw}set wl(t){this.Iw=t}get isJustDiscarded(){return this.am}}class ee{N;St;Oi;tP;iP;fm;GC;constructor(){I.Ki(this),this.N=q.um(),this.St="",this.Oi=!0,this.tP=!1,this.iP=null,this.GC=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.GC);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.St}set name(t){f.s(t,"string",ee,"name"),this.St=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{KC;jC;HC;nP;oP;rP;lP;hP;aP;cP;dm;zh;constructor(t){super(),this.name="ToolManager",this.KC=new G,this.jC=new G,this.HC=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.Bw=!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.KC}get mouseMoveTools(){return this.jC}get mouseUpTools(){return this.HC}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;qC;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.qC=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.qC}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.Vw(),t.WC(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.JC(),this.mc.i(NaN,NaN),Dt.Yh!==null&&(Dt.Yh.currentCursor=""),Dt.Yh=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.$C(i,null),t.skipsUndoManager=e,this.cr.length=0}ZC(){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}JC(){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.Vw(),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.QC(!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.$C(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))}$C(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._C(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))}_C(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}tL(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}QC(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.tL(e.getPoint(0),!1),n!==null&&(o=n.part));let r=null,a=null;e.toNode===null&&(r=this.tL(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){}iL(t){let e=this.diagram;this.dragsLink&&this.QC(!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._C(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.iL(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.Yh;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.Yh=i,i!==null&&i!==s){Dt.dt.ZC();let r=i.toolManager.findTool("Dragging");r!==null&&(r.eL(),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.Yh,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.Yh=i;let o=i.toolManager.findTool("Dragging");o!==null&&(Dt.dt.ZC(),o.eL(),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())}eL(){Dt.zw.has(this)||Dt.zw.add(this)}static yF(){if(Dt.zw.count>0){let t=Dt.zw,e=t.length;for(let i=0;i<e;i++){let s=t.elt(i);s.JC(),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.sL(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.sL(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.iL(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}sL(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.Yh=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 zw=new G;static dt=null;static Yh=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;Gh;VP;Kh;zP;XP;YP;GP;KP;jP;nL;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.Gh=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.Gh).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.YP=null,this.GP=null,this.KP=null,this.jP=!0,this.nL=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.Gh=t.port)}get temporaryFromPort(){return this.Gh}set temporaryFromPort(t){if(this.Gh!==null){let e=this.Gh.panel;if(e!==null){let i=e.C.indexOf(this.Gh);e.removeAt(i),e.insertAt(i,t)}}this.Gh=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.YP}set originalFromPort(t){this.YP=t}get originalToNode(){return this.GP}set originalToNode(t){this.GP=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.nL}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.oL(s,t,e,i)}oL(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.oL(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.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)continue;let r=o.fromNode,a=o.toNode,h=r===e?a:r;if(!(h===e||h===null)&&this.rL(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.Xw()||!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{lL=null;hL=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.lL}set fromHandleArchetype(t){this.lL=t,t!==null?this.QP=new St(H.Link).add(t).Et():this.QP=null}get toHandleArchetype(){return this.hL}set toHandleArchetype(t){this.hL=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.Xw()||!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;Yw;sS;ym;constructor(t){super(),this.name="LinkReshaping",this.dr=new ct("Rectangle",{desiredSize:Q.yC,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.Yw=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.Yw}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.Yw=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.Yw=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;Kw;jw;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.yC,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.Kw=new Q(1/0,1/0),this.jw=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.jw=this.computeCellSize(),this.Gw=this.computeMinSize(),this.Kw=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.Kw,s=this.jw,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.Kw,s=this.jw,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;Hw=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.Hw!==null&&(e=this.Hw.copy()),e===null?null:(e.adornedObject=t,e)}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t,t!==null?this.Hw=new St(H.Position,{locationSpot:D.Center}).add(t).Et():this.Hw=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.G(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{qw;aL;ko;xS;constructor(t){super(),this.name="Panning",this.qw=new P,this.aL=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.qw.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.qw,t.isMouseCaptured=!1,this.stopTool()}doMouseMove(){this.cL()}doMouseUp(){this.cL(),this.stopTool()}cL(){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.aL.i(n,o)}}get bubbles(){return this.ko}set bubbles(t){f.s(t,"boolean",Zi,"bubbles"),this.ko=t}get originalPosition(){return this.qw}}class Ne{Ww;Jw;bS;kS;constructor(t){this.Ww=null,this.Jw=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.Ww}set show(t){this.Ww!==t&&(t!==null&&f.k(t,Ne,"show"),this.Ww=t)}get hide(){return this.Jw}set hide(t){this.Jw!==t&&(t!==null&&f.k(t,Ne,"hide"),this.Jw=t)}get valueFunction(){return this.kS}set valueFunction(t){this.kS=t}}class we{ri;$w;kc;constructor(t,e,i){this.ri=t,this.$w=e,this.kc=i}}class qt extends ee{PS;Zw;SS;MS;Qw;_w;bm;constructor(t){super(),this.name="ContextMenu",this.PS=null,this.Zw=null,this.SS=null,this.MS=new P,this.Qw=null,this.bm=!1;let e=this;this._w=()=>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._w=()=>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.Zw!==null&&this.Zw.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.Qw===null&&(this.Qw=this.LF()),qt.km.innerHTML="",qt.Pm.addEventListener("pointerdown",this._w,!1);let e=this,i=f.hs("ul");i.className="goCXul",qt.km.appendChild(i),i.innerHTML="";let s=this.Qw.iterator;for(;s.next();){let n=s.value,o=n.$w,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.$w=o,h.addEventListener("pointerdown",function(l){return this.$w(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._w,!1),this.currentContextMenu=null}get currentContextMenu(){return this.PS}set currentContextMenu(t){this.PS=t,this.Zw=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;Gt;AS;TS;DS;tx;FS;constructor(t){super(),this.name="TextEditing",this.Pe=new xt,this.CS=null,this.LS=2,this.Tl=null,this.Gt=1,this.AS=1,this.TS=!0,this.DS=null,this.tx=new Ne,this.AF(this.tx),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.tx}set defaultTextEditor(t){this.tx=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.Gt=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.Gt===6?this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus():(this.Gt===2||this.Gt===5||this.Gt===3)&&(this.Gt=4,this.fL());break;case 1:case 4:case 3:if(t===4&&this.textBlock!==null&&this.textBlock.isMultiline===!0)return;(this.Gt===2||this.Gt===5||this.Gt===3)&&(this.Gt=4,this.fL());break}}fL(){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.Gt=5,this.doError(s,n);return}this.startTransaction(this.name),this.Gt=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.Gt=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.Gt===2&&(this.Gt=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.Gt}set state(t){this.Gt!==t&&(this.Gt=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;ix;Nm;ex;Mc;pu;Cm;constructor(t){this.N=q.um(),this.Si=!1,this.Sm=!1,this.pi=!1,this.Sc=!1,this.ex=!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.ix=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.nx.equals(e.at)?this.ex=!0:this.ex=!1,e.D("InitialAnimationStarting",this)),i&&!this.wr||t.ce.count===0){this.zn.clear(),this.pi=!1,t.ce.clear(),t.lx(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.Vw(),e.IS(),n.pi=!1,t.start(),t.Si&&(n.xu(),e.invalidateDocumentBounds(),t.uL(0),e.ur(!0),n.bu(),e.D("AnimationStarting",n)))})}ES(){return this.zn.has("Trigger")&&this.zn.count===1}dL(t,e,i,s){this.isTicking||this.ES()||t instanceof _&&(t.fromNode!==null||t.toNode!==null)||this.on.add(t,"position",e,i,s)}hx(t){return this.on.hx(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.ix.addAll(e);let n=i.ix.iterator;for(;n.next();){let o=n.value;o.Si!==!1&&(o.RF()?o.gL(!1):o.Nc=!0)}if(i.ix.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.lx(this.N);return}if(e.ku(!0),e.lx(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.mL(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.mL(t)))}pL(t,e){!this.pi||t.equals(e)||this.ES()||(this.N.Vh||(t=e.copy()),this.on.BS(this.N,"position",t,e))}yL(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))}mL(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 ax=new pt;static defineAnimationEffect(t,e){pe.ax.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.ax,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{cx;Lm;Si;Pu;So;ms;wL;Ac;ce;fx;ei;Xn;Su;Tc;ux;gx;Nc;XS;mx;ds;N;YS;GS;KS;constructor(t){this.N=null,this.ds=null,this.XS=null,this.mx=null,this.YS=!1,this.Si=!1,this.Nc=!1,this.ei=0,this.Xn=0,this.cx=Ce.EaseInOutQuad,this.Lm=Ce.EaseInOutQuad,this.Su=!1,this.Tc=!1,this.ux=1,this.gx=0,this.So=NaN,this.ms=NaN,this.GS=0,this.Pu=null,this.wL=P.xo,this.ce=new pt,this.fx=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.GS=t,this.gL(!0),this.ds.xu(),this.N.ur(),this.ds.bu(),this.N.redraw()}lx(t){if(this.fx.clear(),this.Tc=!1,this.gx=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.cx,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.wL),n&&e.indexOf("position:")===0&&t instanceof Nt?r.yx.location=this.Mu(t.location):n&&(r.yx[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.wx=!0}}hx(t){if(!this.Si)return!1;let e=this.ce.get(t);return e!==null&&e.wx}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}gL(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.GS,s<this.ms?(this.ei=+new Date-s,this.Xn=this.ei+this.ms):s=this.ms),e.xu(),this.uL(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))}uL(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.ax;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.mx!==null&&this.mx.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.ax;for(;r.next();){let l=r.key,c=r.value,u=o?c.gs:c.ei,d=o?c.ei:c.gs,g=c.yx;for(let p in d)if(a.get(p)!==null){let m=p;c.xx&&(m==="position:nodeCollapse"||m==="position:placeholder")&&(m="position"),a.get(m)(l,u[p],g[p]!==void 0?g[p]:c.xx?u[p]:d[p],this.Lm,this.ms,this.ms,this)}c.xx&&g.location!==void 0&&l instanceof Nt&&(l.location=g.location),c.wx&&l instanceof Nt&&l.Ei(!1)}this.gx++;let h=!t&&this.ux>this.gx;if(!h&&(this===i.Mm||this===i.defaultAnimation)&&this.ce.clear(),e.bx.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.lx(null),e.xL(),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.ux}set runCount(t){t>0?this.ux=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.cx}set easing(t){this.cx=t}get isViewportUnconstrained(){return this.YS}set isViewportUnconstrained(t){this.YS=t}get isAnimating(){return this.Si}getTemporaryState(t){let e=this.fx.get(t);return e===null&&(e={},this.fx.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;yx;xx;wx;constructor(t,e,i){this.ei=t,this.gs=e,this.yx={},this.xx=i,this.wx=!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;St;$t;kr;Rl;vl;Ol;Il;El;Ul;Bl;Vl;zl;Xl;Yl;Gl;kc;Kl;kx;Am;Cu;Ct;constructor(t){I.Ki(this),this.N=null,this.Ct=new G,this.St="",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.Yl=!0,this.Gl=!0,this.kc=!0,this.Kl=!0,this.kx=!0,this.Am=!1,this.Cu=[],t&&Object.assign(this,t)}YF(){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+=`
@@ -49,7 +49,7 @@ string: ${t}`);break}}let C=k.Gg;if(Ke.vC(k),e){let R=C.figures.iterator;for(;R.
49
49
  "modifiedLinkData": `;lD=`,
50
50
  "removedLinkKeys": `;oD(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.oD(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.lD:this.rD)+this.Th(h.toArray(),!0)),r.count>0&&(c+=this.$O+this.Th(r.toArray(),!0)),l.count>0&&(c+=(e?this.rD:this.lD)+this.Th(l.toArray(),!0)),c}Fy(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.Fy(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.hD(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.G(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.G(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))}GN(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.GN(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.G(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)}G1(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.G1(i))return;let s=this.Rf;if(s!==null&&(i=s(this,t),i!=null&&!this.G1(i))){this.Z(t,e,i);return}if(typeof i=="string"){let n=2;for(;this.G1(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.G1(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.jT(t,!0))}jT(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.KT(t,!0)}KT(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.hD(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.GN(e),this.findNodeDataForKey(e)===null&&this.Js(e,t),e=this.Ae(t,!1),e=this.GN(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.Y1(t,!0),f.G(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])}}Ry(t,e){super.Ry(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.iD(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.Cy(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)}vy(t){super.vy(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))}hD(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}Xw(){return!0}Hc(){return!0}static EmptyArray=Object.freeze([])}yt.fl(Xt,"GraphLinksModel"),yt.tD=()=>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
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}Dy(t){super.Dy(t),t.nodeParentKeyProperty&&(this.nodeParentKeyProperty=t.nodeParentKeyProperty)}Fy(t){t.nodeParentKeyProperty!==void 0&&t.nodeParentKeyProperty!==this.nodeParentKeyProperty&&f.o("applyIncrementalJson cannot change Model properties"),super.Fy(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))}Ry(t,e){super.Ry(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.Cy(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)}vy(t){super.vy(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}Xw(){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;Oy;Iy;Ja;Ey;aD;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.Oy=0,this.Iy=new En,this.Ja=0,this.Ey=0,this.aD=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.Oy;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.Oy=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.Oy;if((this.direction===12||this.direction===13)&&o===3)this.cD(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.Uy(s,h/2,a,11);break;case 0:this.By(s,h/2,a,11);break;case 2:this.Vy(s,h/2,a,11);break}switch(o){case 1:this.Uy(n,h/2,a+d,10);break;case 0:this.By(n,h/2,a+d,10);break;case 2:this.Vy(n,h/2,a+d,10);break}}else{switch(o){case 1:this.Uy(n,h/2,a,11);break;case 0:this.By(n,h/2,a,11);break;case 2:this.Vy(n,h/2,a,11);break}switch(o){case 1:this.Uy(s,h/2,a+d,10);break;case 0:this.By(s,h/2,a+d,10);break;case 2:this.Vy(s,h/2,a+d,10);break}}}else switch(o){case 1:this.Uy(i,h,a,this.direction);break;case 0:this.By(i,h,a,this.direction);break;case 2:this.Vy(i,h,a,this.direction);break;case 3:this.cD(i,h,a,this.direction);break}this.updateParts(),this.network=null,this.isValidLayout=!0}Vy(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}}By(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}}Uy(t,e,i,s){let n=this.le,o=this.Ss,r=this.Oy,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}}cD(t,e,i,s){let n=this.Ey,o=this.hg;if(this.Ja=0,this.Iy=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.Ey=n,this.fD(t,e,i,s)}else this.uD(t,e,i,s);this.Iy.commit(t)}uD(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.dD(h,l,c,k,s,u)||this.gD(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.Iy.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.uD(t,e,i,s))}fD(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.dD(a,h,c,p,s,l)||this.gD(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.Ey-u:u-this.Ey;d=Math.abs(d)<Math.abs(d-2*Math.PI)?d:d-2*Math.PI;let g=d*(n+o)/2;this.Iy.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.fD(t,e,i,s))}dD(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)}gD(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.aD;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{zy;vh;Ms;dg;Nn;Fe;gg;mg;pg;Vf;yg;wg;zf;Xf;Yf;Gf;xg;bg;Kf;Za;constructor(t){super(),this.zy=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.Yf=150,this.Gf=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.Yf=this.Yf,t.Gf=this.Gf,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.mD(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.mD(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}Lw(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.Lw(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.pD(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.pD(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)}pD(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}}}yD(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.Pw(d*d+g*g)}else if(n+r<l){let d=s+o-h,g=n+r-l;return L.Pw(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.Pw(d*d+g*g)}else if(n+r<l){let d=s-h-c,g=n+r-l;return L.Pw(d*d+g*g)}else return s-(h+c);else return n>l+u?n-(l+u):n+r<l?l-(n+r):.1}mD(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.yD(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 V=this.randomNumberGenerator;V===null&&(this.randomNumberGenerator=V=new zn(0));let X=V.random(),Y=V.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.yD(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.zy=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=Math.sqrt((r[c].centerX-r[d].centerX)**2+(r[c].centerY-r[d].centerY)**2),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.zy*r[c].forceX/u,r[c].forceY=this.zy*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.zy*=.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.Xy(),this.commitNodes(),this.isRouting&&this.commitLinks()}Xy(){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.Lw(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.Yf:e}electricalFieldX(t,e){return 0}electricalFieldY(t,e){return 0}gravitationalMass(t){let e=t.mass;return isNaN(e)?this.Gf: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.Yf}set defaultElectricalCharge(t){this.Yf!==t&&(f.s(t,"number",re,"defaultElectricalCharge"),this.Yf=t,this.invalidateLayout())}get defaultGravitationalMass(){return this.Gf}set defaultGravitationalMass(t){this.Gf!==t&&(f.s(t,"number",re,"defaultGravitationalMass"),this.Gf=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;Yy;zt;kg;Cs;ci;Zs;Ls;As;It;Pg;_a;Sg;Qs;$f;_o;Cn;Ln;ZN;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.Yy=-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.ZN=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}Ky(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}jy(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.jy(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.jy(l,e,i,s,n)}}}}QN(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.QN(r,e,i,s,n)}}if(n){let o=t.sourceEdges;for(;o.next();){let r=o.value.fromVertex;this.QN(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._N(i)}for(t.reset();t.next();){let i=t.value;i.Zf===-1&&this._N(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)}}}_N(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._N(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.jy(h,i,-1,!0,!1)}for(this.jy(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.jy(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,V=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(V)):U.a(V):j.isReal()?(N.getRelativePoint(R,D.Center,U),U.isReal()||U.a(V)):U.a(V),this.b===90||this.b===270?(a=Math.round((Y.x-O.x)/this.Wi),l=Y.x,h=Math.round((U.x-V.x)/this.Wi),c=U.x):(a=Math.round((Y.y-O.y)/this.Wi),l=Y.y,h=Math.round((U.y-V.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.Yy=-1,this.kg=0,this.Cs=0;for(let i=0;i<=this.kt;i++)t[i]>t[this.Cs]&&(this.Yy=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.Ky(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.Ky(t,-1);let l;if(!i||s<0)for(l=[],a=0;a<o;a++)l[a]=-1;else l=this.Ky(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,V=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,V=Y.column,T+=(Math.abs(y+O-(V+R))+1)*C,N+=(Math.abs(F+O-(V+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,V=Y.column,T+=(Math.abs(w+O-(V+R))+1)*C,N+=(Math.abs(M+O-(V+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.tC(t,1);for(t=this.Cs-1;t>=0;t--)this.tC(t,-1);this.tC(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.Ky(t,-1);if(e>0)for(i=0;i<n;i++)o[i]=-1;let r=this.Ky(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}tC(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.QN(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.Xy(),this.commitNodes(),this.iC(),this.isRouting&&this.commitLinks()}Xy(){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.ZN=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()}}iC(){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.ZN: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 V=null;if(R&&(V=e.getLinkPointFromPoint(o,a,a.getDocumentPoint(D.Center),e.getPoint(0),!1),V.isReal()||V.set(o.actualBounds.center),e.setPointAt(3,V.x,V.y)),O){let X=e.getPoint(2);e.setPointAt(1,(O.x*2+X.x)/3,(O.y*2+X.y)/3)}if(V){let X=e.getPoint(1);e.setPointAt(2,(V.x*2+X.x)/3,(V.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.Yy=-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.Yy}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{Yo;Hr;At;ak;ck;$i;Zf;Xn;ok;ek;sk;tc;An;RD;Eh;Je;Qf;he;Tn;Hy=null;qy=null;Wy=null;Jy=null;constructor(t){super(t),this.Yo=-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.Wy){let t=[];for(let e of this.fo){let i=e;i.valid&&t.push(i)}this.Wy=t}return this.Wy}getProperDestinationEdges(){if(!this.Jy){let t=[];for(let e of this.Wo){let i=e;i.valid&&t.push(i)}this.Jy=t}return this.Jy}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.Hy){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.Hy=t}return this.Hy}getProperDestinationVertexes(){if(!this.qy){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.qy=t}return this.qy}addSourceEdge(t){super.addSourceEdge(t),this.Hy=null,this.Wy=null}deleteSourceEdge(t){super.deleteSourceEdge(t),this.Hy=null,this.Wy=null}addDestinationEdge(t){super.addDestinationEdge(t),this.qy=null,this.Jy=null}deleteDestinationEdge(t){super.deleteDestinationEdge(t),this.qy=null,this.Jy=null}get layer(){return this.Yo}set layer(t){this.Yo!==t&&(f.s(t,"number",Xe,"layer"),this.Yo=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;eC;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.eC=[],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.sC(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.sC(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}sC(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.sC(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}$y(t){return t===24||t===25}nC(t){let e=t.parent;if(e!==null){let i=e.alignment;if(this.isBusAlignment(i))if(this.$y(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.nC(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.eC=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.nC(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.$y(r)&&e>135&&n.reverse(),this.$y(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.YD(t,n,R,O,v,k):Y=this.GD(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 V=0,X=0;switch(r){case 20:i?V+=v/2-t.focus.x-g/2:X+=k/2-t.focus.y-g/2;break;default:case 21:if(T>0)i?V+=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;V+=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?(V-=g,v+=g):(X-=g,k+=g);break;case 23:i?(V+=v-t.width+g,v+=g):(X+=k-t.height+g,k+=g);break;case 24:case 25:i?o>1?V+=R+d/2-t.focus.x:V+=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?V+=v+d/2-t.focus.x:X+=k+d/2-t.focus.y;break;case 27:break;case 28:let Y=this.customAlignment(t,V,X,v,k);V=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-V,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.oC(t,v,V),V<0&&(V=0),e>135&&(X+=k+u),k=Math.max(Math.max(k,b),k+b+u)):(e>135&&(V+=v+u),v=Math.max(Math.max(v,w),v+w+u),k=this.rC(t,k,X),X<0&&(X=0)),t.lt.i(V,X),t.ut.i(v,k)}customAlignment(t,e,i,s,n){return[e,i,s,n]}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)===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)}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)===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)}oC(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}}rC(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}}lC(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.lC(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.nC(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,V=0,X=0,Y=0;if(l&&!this.$y(r)&&e>135&&n.reverse(),this.$y(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.YD(t,n,X,Y,b,v):et=this.GD(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,V,et-1),R++,O=0,V=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,V,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,V,et-1),R++,O=0,V=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,V,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,V,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,V,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.oC(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.rC(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.lC(r,y-b,0);nt=et.x,at=et.y,b=y,j=0}}else b=this.oC(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.lC(r,0,w-v);nt=et.x,at=et.y,v=w,U=0}}else v=this.rC(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.hC(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.hC(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}}}}hC(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.hC(r,e+r.O.x,i+r.O.y)}}commitLayout(){this.Xy(),this.commitNodes(),this.iC(),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)}}iC(){if(this.layerStyle!==62)return;let t=this.eC,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()}Xy(){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;Yt;hi;Zy;Qy;_y;Ns;tw;iw;ew;nw;ow;lw;hw;aw;cw;fw;uw;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.Yt=0,this.hi=21,this.Zy=0,this.Qy=0,this._y=20,this.Ns=50,this.tw=0,this.iw=31,this.ew=0,this.nw=25,this.ow=10,this.lw=10,this.hw=20,this.aw=!0,this.cw=D.Default,this.fw=!0,this.uw=D.Default}copyInheritedPropertiesFrom(t){t!==null&&(this.pe=t.sorting,this.ye=t.comparer,this.Yt=t.angle,this.hi=t.alignment,this.Zy=t.nodeIndent,this.Qy=t.nodeIndentPastParent,this._y=t.nodeSpacing,this.Ns=t.layerSpacing,this.tw=t.layerSpacingParentOverlap,this.iw=t.compaction,this.ew=t.breadthLimit,this.nw=t.rowSpacing,this.ow=t.rowIndent,this.lw=t.commentSpacing,this.hw=t.commentMargin,this.aw=t.setsPortSpot,this.cw=t.portSpot,this.fw=t.setsChildPortSpot,this.uw=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.Yt}set angle(t){this.Yt!==t&&(f.s(t,"number",It,"angle"),this.Yt=t)}get alignment(){return this.hi}set alignment(t){this.hi!==t&&(this.hi=t)}get nodeIndent(){return this.Zy}set nodeIndent(t){this.Zy!==t&&(f.s(t,"number",It,"nodeIndent"),this.Zy=t)}get nodeIndentPastParent(){return this.Qy}set nodeIndentPastParent(t){this.Qy!==t&&(f.s(t,"number",It,"nodeIndentPastParent"),this.Qy=t)}get nodeSpacing(){return this._y}set nodeSpacing(t){this._y!==t&&(f.s(t,"number",It,"nodeSpacing"),this._y=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.tw}set layerSpacingParentOverlap(t){this.tw!==t&&(f.s(t,"number",It,"layerSpacingParentOverlap"),this.tw=t)}get compaction(){return this.iw}set compaction(t){this.iw!==t&&(this.iw=t)}get breadthLimit(){return this.ew}set breadthLimit(t){this.ew!==t&&(f.s(t,"number",It,"breadthLimit"),this.ew=t)}get rowSpacing(){return this.nw}set rowSpacing(t){this.nw!==t&&(f.s(t,"number",It,"rowSpacing"),this.nw=t)}get rowIndent(){return this.ow}set rowIndent(t){this.ow!==t&&(f.s(t,"number",It,"rowIndent"),this.ow=t)}get commentSpacing(){return this.lw}set commentSpacing(t){this.lw!==t&&(f.s(t,"number",It,"commentSpacing"),this.lw=t)}get commentMargin(){return this.hw}set commentMargin(t){this.hw!==t&&(f.s(t,"number",It,"commentMargin"),this.hw=t)}get setsPortSpot(){return this.aw}set setsPortSpot(t){this.aw!==t&&(f.s(t,"boolean",It,"setsPortSpot"),this.aw=t)}get portSpot(){return this.cw}set portSpot(t){this.cw.equals(t)||(this.cw=t)}get setsChildPortSpot(){return this.fw}set setsChildPortSpot(t){this.fw!==t&&(f.s(t,"boolean",It,"setsChildPortSpot"),this.fw=t)}get childPortSpot(){return this.uw}set childPortSpot(t){this.uw.equals(t)||(this.uw=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.dw())};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.dw())}get defaultTheme(){return this.Tk}set defaultTheme(t){this.Tk!==t&&(f.s(t,"string",ai,"defaultTheme"),this.Tk=t,this.dw())}get currentTheme(){return this.Dk}set currentTheme(t){this.Dk!==t&&(f.s(t,"string",ai,"currentTheme"),this.Dk=t,this.dw())}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.aC(t),this}removeDiagram(t){return this.ts.delete(t),this.aC(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.dw(),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)}aC(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)}dw(){for(let t of this.ts)this.aC(t)}qD(t,e){for(let i in e)if(f.gw(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{St;N;Oi;cl;constructor(){this.N=q.um(),this.St="",this.Oi=!0,this.cl=!0}get name(){return this.St}set name(t){this.St=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.Gc,a.cellHeight*a.Gc),a.NT(e,i,s,n,g,!0);let p=a.lo(s.x,s.y);if(!a.ky&&p>=Et.Rd&&(a.rA(),g.inflate(a.cellWidth*a.HM,a.cellHeight*a.qM),a.NT(e,i,s,n,g,!1),p=a.lo(s.x,s.y)),!a.ky&&p<Et.Rd&&!a.DO(s.x,s.y)){t.points.removeRange(2,t.pointsCount-3),this.cC(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))}}cC(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.cC(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.cC(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.G(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(B){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=B.speedy===void 0?!kr:B.speedy,this.tags=[],this.ctr=0,this.nonce=B.nonce,this.key=B.key,this.container=B.container,this.prepend=B.prepend,this.insertionPoint=B.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,B){return A.replace(f,B)}function Yi(A,f){return A.indexOf(f)}function te(A,f){return A.charCodeAt(f)|0}function ti(A,f,B){return A.slice(f,B)}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,B,K,W,$,it){return{value:A,root:f,parent:B,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,B,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,B),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,B,Rt-1):Po(Bt(L," ","")+";",K,B,Rt-2),G);break;case 59:L+=";";default:if(bi(Pt=So(L,f,B,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,B,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,B,W===0?yi:ht,G,Tt,I)}function Mr(A,f,B){return Gi(A,f,B,rs,li(yo()),ti(A,2,-2),0)}function Po(A,f,B,K){return Gi(A,f,B,xi,ti(A,0,K),ti(A,K+1,-1),K)}function ci(A,f){for(var B="",K=wi(A),W=0;W<K;W++)B+=f(A[W],W,A,f)||"";return B}function No(A,f,B,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(B=ci(A.children,K))?A.return=A.value+"{"+B+"}":""}function Co(A){var f=wi(A);return function(B,K,W,$){for(var it="",ht=0;ht<f;ht++)it+=A[ht](B,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(B){return f[B]===void 0&&(f[B]=A(B)),f[B]}}var Nr=function(f,B,K){for(var W=0,$=0;W=$,$=Me(),W===38&&$===12&&(B[K]=1),!ki($);)ge();return Mi(f,fe)},Cr=function(f,B){var K=-1,W=44;do switch(ki(W)){case 0:W===38&&Me()===12&&(B[K]=1),f[K]+=Nr(fe-1,B,K);break;case 2:f[K]+=Ni(W);break;case 4:if(W===44){f[++K]=Me()===58?"&\f":"",B[K]=f[K].length;break}default:f[K]+=li(W)}while(W=ge());return f},Ar=function(f,B){return us(Cr(cs(f),B))},To=new WeakMap,Lr=function(f){if(!(f.type!=="rule"||!f.parent||f.length<1)){for(var B=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&&B.charCodeAt(0)!==58&&!To.get(K))&&!W){To.set(f,!0);for(var $=[],it=Ar(B,$),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 B=f.value;B.charCodeAt(0)===108&&B.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,B,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 B=f.key;if(B==="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^="'+B+' "]'),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:B,sheet:new lo({key:B,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,B,K=0,W=A.length;W>=4;++K,W-=4)B=A.charCodeAt(K)&255|(A.charCodeAt(++K)&255)<<8|(A.charCodeAt(++K)&255)<<16|(A.charCodeAt(++K)&255)<<24,B=(B&65535)*1540483477+((B>>>16)*59797<<16),B^=B>>>24,f=(B&65535)*1540483477+((B>>>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,B){switch(f){case"animation":case"animationName":if(typeof B=="string")return B.replace(Er,function(K,W,$){return Ve={name:W,styles:$,next:Ve},W})}return Ro[f]!==1&&!Vo(f)&&typeof B=="number"&&B!==0?B+"px":B},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,B){if(B==null)return"";var K=B;if(K.__emotion_styles!==void 0)return K;switch(typeof B){case"boolean":return"";case"object":{var W=B;if(W.anim===1)return Ve={name:W.name,styles:W.styles,next:Ve},W.name;var $=B;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,B)}case"function":{if(A!==void 0){var G=Ve,Tt=B(A);return Ve=G,qi(A,f,Tt)}break}}var I=B;if(f==null)return I;var Rt=f[I];return Rt!==void 0?Rt:I}function Br(A,f,B){var K="";if(Array.isArray(B))for(var W=0;W<B.length;W++)K+=qi(A,f,B[W])+";";else for(var $ in B){var it=B[$];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,B){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(B,f,$);else{var it=$;W+=it[0]}for(var ht=1;ht<A.length;ht++)if(W+=qi(B,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,B){var K="";return B.split(" ").forEach(function(W){A[W]!==void 0?f.push(A[W]+";"):W&&(K+=W+" ")}),K}var zr=function(f,B,K){var W=f.key+"-"+B.name;(K===!1||Vr===!1)&&f.registered[W]===void 0&&(f.registered[W]=B.styles)},zo=function(f,B,K){zr(f,B,K);var W=f.key+"-"+B.name;if(f.inserted[B.name]===void 0){var $=B;do f.insert(B===$?"."+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,B){var K=[],W=un(A,K,B);return K.length<2?B:W+f(K)}var jo=function(f){var B=Fo(f);B.sheet.speedy=function(ht){this.isSpeedy=ht},B.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,B.registered,void 0);return zo(B,Rt,!1),B.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,B.registered),he="animation-"+Rt.name;return Ko(B,{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,B.registered);Ko(B,Rt)},it=function(){for(var G=arguments.length,Tt=new Array(G),I=0;I<G;I++)Tt[I]=arguments[I];return Xo(B.registered,K,Kr(Tt))};return{css:K,cx:it,injectGlobal:$,keyframes:W,hydrate:function(G){G.forEach(function(Tt){B.inserted[Tt]=!0})},flush:function(){B.registered={},B.inserted={},B.sheet.flush()},sheet:B.sheet,cache:B,getRegisteredStyles:un.bind(null,B.registered),merge:Xo.bind(null,B.registered,K)}},Kr=function A(f){for(var B="",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}$&&(B&&(B+=" "),B+=$)}}return B};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`/** @license
52
+ "nodeParentKeyProperty": `+this.De(this.nodeParentKeyProperty)),t+e}Dy(t){super.Dy(t),t.nodeParentKeyProperty&&(this.nodeParentKeyProperty=t.nodeParentKeyProperty)}Fy(t){t.nodeParentKeyProperty!==void 0&&t.nodeParentKeyProperty!==this.nodeParentKeyProperty&&f.o("applyIncrementalJson cannot change Model properties"),super.Fy(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))}Ry(t,e){super.Ry(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.Cy(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)}vy(t){super.vy(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}Xw(){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;Oy;Iy;Ja;Ey;aD;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.Oy=0,this.Iy=new En,this.Ja=0,this.Ey=0,this.aD=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.Oy;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.Oy=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.Oy;if((this.direction===12||this.direction===13)&&o===3)this.cD(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.Uy(s,h/2,a,11);break;case 0:this.By(s,h/2,a,11);break;case 2:this.Vy(s,h/2,a,11);break}switch(o){case 1:this.Uy(n,h/2,a+d,10);break;case 0:this.By(n,h/2,a+d,10);break;case 2:this.Vy(n,h/2,a+d,10);break}}else{switch(o){case 1:this.Uy(n,h/2,a,11);break;case 0:this.By(n,h/2,a,11);break;case 2:this.Vy(n,h/2,a,11);break}switch(o){case 1:this.Uy(s,h/2,a+d,10);break;case 0:this.By(s,h/2,a+d,10);break;case 2:this.Vy(s,h/2,a+d,10);break}}}else switch(o){case 1:this.Uy(i,h,a,this.direction);break;case 0:this.By(i,h,a,this.direction);break;case 2:this.Vy(i,h,a,this.direction);break;case 3:this.cD(i,h,a,this.direction);break}this.updateParts(),this.network=null,this.isValidLayout=!0}Vy(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}}By(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}}Uy(t,e,i,s){let n=this.le,o=this.Ss,r=this.Oy,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}}cD(t,e,i,s){let n=this.Ey,o=this.hg;if(this.Ja=0,this.Iy=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.Ey=n,this.fD(t,e,i,s)}else this.uD(t,e,i,s);this.Iy.commit(t)}uD(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.dD(h,l,c,k,s,u)||this.gD(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.Iy.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.uD(t,e,i,s))}fD(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.dD(a,h,c,p,s,l)||this.gD(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.Ey-u:u-this.Ey;d=Math.abs(d)<Math.abs(d-2*Math.PI)?d:d-2*Math.PI;let g=d*(n+o)/2;this.Iy.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.fD(t,e,i,s))}dD(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)}gD(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.aD;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{zy;vh;Ms;dg;Nn;Fe;gg;mg;pg;Vf;yg;wg;zf;Xf;Yf;Gf;xg;bg;Kf;Za;constructor(t){super(),this.zy=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.Yf=150,this.Gf=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.Yf=this.Yf,t.Gf=this.Gf,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.mD(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.mD(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}Lw(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.Lw(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.pD(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.pD(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)}pD(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}}}yD(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.Pw(d*d+g*g)}else if(n+r<l){let d=s+o-h,g=n+r-l;return L.Pw(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.Pw(d*d+g*g)}else if(n+r<l){let d=s-h-c,g=n+r-l;return L.Pw(d*d+g*g)}else return s-(h+c);else return n>l+u?n-(l+u):n+r<l?l-(n+r):.1}mD(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.yD(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 V=this.randomNumberGenerator;V===null&&(this.randomNumberGenerator=V=new zn(0));let X=V.random(),Y=V.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.yD(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.zy=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=Math.sqrt((r[c].centerX-r[d].centerX)**2+(r[c].centerY-r[d].centerY)**2),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.zy*r[c].forceX/u,r[c].forceY=this.zy*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.zy*=.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.Xy(),this.commitNodes(),this.isRouting&&this.commitLinks()}Xy(){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.Lw(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.Yf:e}electricalFieldX(t,e){return 0}electricalFieldY(t,e){return 0}gravitationalMass(t){let e=t.mass;return isNaN(e)?this.Gf: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.Yf}set defaultElectricalCharge(t){this.Yf!==t&&(f.s(t,"number",re,"defaultElectricalCharge"),this.Yf=t,this.invalidateLayout())}get defaultGravitationalMass(){return this.Gf}set defaultGravitationalMass(t){this.Gf!==t&&(f.s(t,"number",re,"defaultGravitationalMass"),this.Gf=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;Yy;zt;kg;Cs;ci;Zs;Ls;As;It;Pg;_a;Sg;Qs;$f;_o;Cn;Ln;ZN;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.Yy=-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.ZN=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}Ky(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}jy(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.jy(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.jy(l,e,i,s,n)}}}}QN(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.QN(r,e,i,s,n)}}if(n){let o=t.sourceEdges;for(;o.next();){let r=o.value.fromVertex;this.QN(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._N(i)}for(t.reset();t.next();){let i=t.value;i.Zf===-1&&this._N(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)}}}_N(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._N(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.jy(h,i,-1,!0,!1)}for(this.jy(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.jy(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,V=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(V)):U.a(V):j.isReal()?(N.getRelativePoint(R,D.Center,U),U.isReal()||U.a(V)):U.a(V),this.b===90||this.b===270?(a=Math.round((Y.x-O.x)/this.Wi),l=Y.x,h=Math.round((U.x-V.x)/this.Wi),c=U.x):(a=Math.round((Y.y-O.y)/this.Wi),l=Y.y,h=Math.round((U.y-V.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.Yy=-1,this.kg=0,this.Cs=0;for(let i=0;i<=this.kt;i++)t[i]>t[this.Cs]&&(this.Yy=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.Ky(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.Ky(t,-1);let l;if(!i||s<0)for(l=[],a=0;a<o;a++)l[a]=-1;else l=this.Ky(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,V=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,V=Y.column,T+=(Math.abs(y+O-(V+R))+1)*C,N+=(Math.abs(F+O-(V+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,V=Y.column,T+=(Math.abs(w+O-(V+R))+1)*C,N+=(Math.abs(M+O-(V+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.tC(t,1);for(t=this.Cs-1;t>=0;t--)this.tC(t,-1);this.tC(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.Ky(t,-1);if(e>0)for(i=0;i<n;i++)o[i]=-1;let r=this.Ky(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}tC(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.QN(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.Xy(),this.commitNodes(),this.iC(),this.isRouting&&this.commitLinks()}Xy(){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.ZN=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()}}iC(){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.ZN: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 V=null;if(R&&(V=e.getLinkPointFromPoint(o,a,a.getDocumentPoint(D.Center),e.getPoint(0),!1),V.isReal()||V.set(o.actualBounds.center),e.setPointAt(3,V.x,V.y)),O){let X=e.getPoint(2);e.setPointAt(1,(O.x*2+X.x)/3,(O.y*2+X.y)/3)}if(V){let X=e.getPoint(1);e.setPointAt(2,(V.x*2+X.x)/3,(V.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.Yy=-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.Yy}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{Yo;Hr;At;ak;ck;$i;Zf;Xn;ok;ek;sk;tc;An;RD;Eh;Je;Qf;he;Tn;Hy=null;qy=null;Wy=null;Jy=null;constructor(t){super(t),this.Yo=-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.Wy){let t=[];for(let e of this.fo){let i=e;i.valid&&t.push(i)}this.Wy=t}return this.Wy}getProperDestinationEdges(){if(!this.Jy){let t=[];for(let e of this.Wo){let i=e;i.valid&&t.push(i)}this.Jy=t}return this.Jy}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.Hy){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.Hy=t}return this.Hy}getProperDestinationVertexes(){if(!this.qy){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.qy=t}return this.qy}addSourceEdge(t){super.addSourceEdge(t),this.Hy=null,this.Wy=null}deleteSourceEdge(t){super.deleteSourceEdge(t),this.Hy=null,this.Wy=null}addDestinationEdge(t){super.addDestinationEdge(t),this.qy=null,this.Jy=null}deleteDestinationEdge(t){super.deleteDestinationEdge(t),this.qy=null,this.Jy=null}get layer(){return this.Yo}set layer(t){this.Yo!==t&&(f.s(t,"number",Xe,"layer"),this.Yo=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;eC;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.eC=[],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.sC(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.sC(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}sC(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.sC(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}$y(t){return t===24||t===25}nC(t){let e=t.parent;if(e!==null){let i=e.alignment;if(this.isBusAlignment(i))if(this.$y(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.nC(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.eC=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.nC(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.$y(r)&&e>135&&n.reverse(),this.$y(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.YD(t,n,R,O,v,k):Y=this.GD(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 V=0,X=0;switch(r){case 20:i?V+=v/2-t.focus.x-g/2:X+=k/2-t.focus.y-g/2;break;default:case 21:if(T>0)i?V+=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;V+=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?(V-=g,v+=g):(X-=g,k+=g);break;case 23:i?(V+=v-t.width+g,v+=g):(X+=k-t.height+g,k+=g);break;case 24:case 25:i?o>1?V+=R+d/2-t.focus.x:V+=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?V+=v+d/2-t.focus.x:X+=k+d/2-t.focus.y;break;case 27:break;case 28:let Y=this.customAlignment(t,V,X,v,k);V=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-V,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.oC(t,v,V),V<0&&(V=0),e>135&&(X+=k+u),k=Math.max(Math.max(k,b),k+b+u)):(e>135&&(V+=v+u),v=Math.max(Math.max(v,w),v+w+u),k=this.rC(t,k,X),X<0&&(X=0)),t.lt.i(V,X),t.ut.i(v,k)}customAlignment(t,e,i,s,n){return[e,i,s,n]}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)===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)}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)===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)}oC(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}}rC(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}}lC(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.lC(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.nC(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,V=0,X=0,Y=0;if(l&&!this.$y(r)&&e>135&&n.reverse(),this.$y(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.YD(t,n,X,Y,b,v):et=this.GD(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,V,et-1),R++,O=0,V=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,V,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,V,et-1),R++,O=0,V=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,V,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,V,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,V,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.oC(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.rC(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.lC(r,y-b,0);nt=et.x,at=et.y,b=y,j=0}}else b=this.oC(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.lC(r,0,w-v);nt=et.x,at=et.y,v=w,U=0}}else v=this.rC(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.hC(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.hC(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}}}}hC(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.hC(r,e+r.O.x,i+r.O.y)}}commitLayout(){this.Xy(),this.commitNodes(),this.iC(),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)}}iC(){if(this.layerStyle!==62)return;let t=this.eC,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()}Xy(){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;Yt;hi;Zy;Qy;_y;Ns;tw;iw;ew;nw;ow;lw;hw;aw;cw;fw;uw;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.Yt=0,this.hi=21,this.Zy=0,this.Qy=0,this._y=20,this.Ns=50,this.tw=0,this.iw=31,this.ew=0,this.nw=25,this.ow=10,this.lw=10,this.hw=20,this.aw=!0,this.cw=D.Default,this.fw=!0,this.uw=D.Default}copyInheritedPropertiesFrom(t){t!==null&&(this.pe=t.sorting,this.ye=t.comparer,this.Yt=t.angle,this.hi=t.alignment,this.Zy=t.nodeIndent,this.Qy=t.nodeIndentPastParent,this._y=t.nodeSpacing,this.Ns=t.layerSpacing,this.tw=t.layerSpacingParentOverlap,this.iw=t.compaction,this.ew=t.breadthLimit,this.nw=t.rowSpacing,this.ow=t.rowIndent,this.lw=t.commentSpacing,this.hw=t.commentMargin,this.aw=t.setsPortSpot,this.cw=t.portSpot,this.fw=t.setsChildPortSpot,this.uw=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.Yt}set angle(t){this.Yt!==t&&(f.s(t,"number",It,"angle"),this.Yt=t)}get alignment(){return this.hi}set alignment(t){this.hi!==t&&(this.hi=t)}get nodeIndent(){return this.Zy}set nodeIndent(t){this.Zy!==t&&(f.s(t,"number",It,"nodeIndent"),this.Zy=t)}get nodeIndentPastParent(){return this.Qy}set nodeIndentPastParent(t){this.Qy!==t&&(f.s(t,"number",It,"nodeIndentPastParent"),this.Qy=t)}get nodeSpacing(){return this._y}set nodeSpacing(t){this._y!==t&&(f.s(t,"number",It,"nodeSpacing"),this._y=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.tw}set layerSpacingParentOverlap(t){this.tw!==t&&(f.s(t,"number",It,"layerSpacingParentOverlap"),this.tw=t)}get compaction(){return this.iw}set compaction(t){this.iw!==t&&(this.iw=t)}get breadthLimit(){return this.ew}set breadthLimit(t){this.ew!==t&&(f.s(t,"number",It,"breadthLimit"),this.ew=t)}get rowSpacing(){return this.nw}set rowSpacing(t){this.nw!==t&&(f.s(t,"number",It,"rowSpacing"),this.nw=t)}get rowIndent(){return this.ow}set rowIndent(t){this.ow!==t&&(f.s(t,"number",It,"rowIndent"),this.ow=t)}get commentSpacing(){return this.lw}set commentSpacing(t){this.lw!==t&&(f.s(t,"number",It,"commentSpacing"),this.lw=t)}get commentMargin(){return this.hw}set commentMargin(t){this.hw!==t&&(f.s(t,"number",It,"commentMargin"),this.hw=t)}get setsPortSpot(){return this.aw}set setsPortSpot(t){this.aw!==t&&(f.s(t,"boolean",It,"setsPortSpot"),this.aw=t)}get portSpot(){return this.cw}set portSpot(t){this.cw.equals(t)||(this.cw=t)}get setsChildPortSpot(){return this.fw}set setsChildPortSpot(t){this.fw!==t&&(f.s(t,"boolean",It,"setsChildPortSpot"),this.fw=t)}get childPortSpot(){return this.uw}set childPortSpot(t){this.uw.equals(t)||(this.uw=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.dw())};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.dw())}get defaultTheme(){return this.Tk}set defaultTheme(t){this.Tk!==t&&(f.s(t,"string",ai,"defaultTheme"),this.Tk=t,this.dw())}get currentTheme(){return this.Dk}set currentTheme(t){this.Dk!==t&&(f.s(t,"string",ai,"currentTheme"),this.Dk=t,this.dw())}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.aC(t),this}removeDiagram(t){return this.ts.delete(t),this.aC(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.dw(),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)}aC(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)}dw(){for(let t of this.ts)this.aC(t)}qD(t,e){for(let i in e)if(f.gw(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{St;N;Oi;cl;constructor(){this.N=q.um(),this.St="",this.Oi=!0,this.cl=!0}get name(){return this.St}set name(t){this.St=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.Gc,a.cellHeight*a.Gc),a.NT(e,i,s,n,g,!0);let p=a.lo(s.x,s.y);if(!a.ky&&p>=Et.Rd&&(a.rA(),g.inflate(a.cellWidth*a.HM,a.cellHeight*a.qM),a.NT(e,i,s,n,g,!1),p=a.lo(s.x,s.y)),!a.ky&&p<Et.Rd&&!a.DO(s.x,s.y)){t.points.removeRange(2,t.pointsCount-3),this.cC(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))}}cC(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.cC(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.cC(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.G(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(B){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=B.speedy===void 0?!kr:B.speedy,this.tags=[],this.ctr=0,this.nonce=B.nonce,this.key=B.key,this.container=B.container,this.prepend=B.prepend,this.insertionPoint=B.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,B){return A.replace(f,B)}function Yi(A,f){return A.indexOf(f)}function te(A,f){return A.charCodeAt(f)|0}function ti(A,f,B){return A.slice(f,B)}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,B,K,W,$,it){return{value:A,root:f,parent:B,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,B,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,B),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,B,Rt-1):Po(Bt(L," ","")+";",K,B,Rt-2),G);break;case 59:L+=";";default:if(bi(Pt=So(L,f,B,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,B,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,B,W===0?yi:ht,G,Tt,I)}function Mr(A,f,B){return Gi(A,f,B,rs,li(yo()),ti(A,2,-2),0)}function Po(A,f,B,K){return Gi(A,f,B,xi,ti(A,0,K),ti(A,K+1,-1),K)}function ci(A,f){for(var B="",K=wi(A),W=0;W<K;W++)B+=f(A[W],W,A,f)||"";return B}function No(A,f,B,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(B=ci(A.children,K))?A.return=A.value+"{"+B+"}":""}function Co(A){var f=wi(A);return function(B,K,W,$){for(var it="",ht=0;ht<f;ht++)it+=A[ht](B,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(B){return f[B]===void 0&&(f[B]=A(B)),f[B]}}var Nr=function(f,B,K){for(var W=0,$=0;W=$,$=Me(),W===38&&$===12&&(B[K]=1),!ki($);)ge();return Mi(f,fe)},Cr=function(f,B){var K=-1,W=44;do switch(ki(W)){case 0:W===38&&Me()===12&&(B[K]=1),f[K]+=Nr(fe-1,B,K);break;case 2:f[K]+=Ni(W);break;case 4:if(W===44){f[++K]=Me()===58?"&\f":"",B[K]=f[K].length;break}default:f[K]+=li(W)}while(W=ge());return f},Ar=function(f,B){return us(Cr(cs(f),B))},To=new WeakMap,Lr=function(f){if(!(f.type!=="rule"||!f.parent||f.length<1)){for(var B=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&&B.charCodeAt(0)!==58&&!To.get(K))&&!W){To.set(f,!0);for(var $=[],it=Ar(B,$),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 B=f.value;B.charCodeAt(0)===108&&B.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,B,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 B=f.key;if(B==="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^="'+B+' "]'),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:B,sheet:new lo({key:B,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,B,K=0,W=A.length;W>=4;++K,W-=4)B=A.charCodeAt(K)&255|(A.charCodeAt(++K)&255)<<8|(A.charCodeAt(++K)&255)<<16|(A.charCodeAt(++K)&255)<<24,B=(B&65535)*1540483477+((B>>>16)*59797<<16),B^=B>>>24,f=(B&65535)*1540483477+((B>>>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,B){switch(f){case"animation":case"animationName":if(typeof B=="string")return B.replace(Er,function(K,W,$){return Ve={name:W,styles:$,next:Ve},W})}return Ro[f]!==1&&!Vo(f)&&typeof B=="number"&&B!==0?B+"px":B},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,B){if(B==null)return"";var K=B;if(K.__emotion_styles!==void 0)return K;switch(typeof B){case"boolean":return"";case"object":{var W=B;if(W.anim===1)return Ve={name:W.name,styles:W.styles,next:Ve},W.name;var $=B;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,B)}case"function":{if(A!==void 0){var G=Ve,Tt=B(A);return Ve=G,qi(A,f,Tt)}break}}var I=B;if(f==null)return I;var Rt=f[I];return Rt!==void 0?Rt:I}function Br(A,f,B){var K="";if(Array.isArray(B))for(var W=0;W<B.length;W++)K+=qi(A,f,B[W])+";";else for(var $ in B){var it=B[$];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,B){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(B,f,$);else{var it=$;W+=it[0]}for(var ht=1;ht<A.length;ht++)if(W+=qi(B,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,B){var K="";return B.split(" ").forEach(function(W){A[W]!==void 0?f.push(A[W]+";"):W&&(K+=W+" ")}),K}var zr=function(f,B,K){var W=f.key+"-"+B.name;(K===!1||Vr===!1)&&f.registered[W]===void 0&&(f.registered[W]=B.styles)},zo=function(f,B,K){zr(f,B,K);var W=f.key+"-"+B.name;if(f.inserted[B.name]===void 0){var $=B;do f.insert(B===$?"."+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,B){var K=[],W=un(A,K,B);return K.length<2?B:W+f(K)}var jo=function(f){var B=Fo(f);B.sheet.speedy=function(ht){this.isSpeedy=ht},B.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,B.registered,void 0);return zo(B,Rt,!1),B.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,B.registered),he="animation-"+Rt.name;return Ko(B,{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,B.registered);Ko(B,Rt)},it=function(){for(var G=arguments.length,Tt=new Array(G),I=0;I<G;I++)Tt[I]=arguments[I];return Xo(B.registered,K,Kr(Tt))};return{css:K,cx:it,injectGlobal:$,keyframes:W,hydrate:function(G){G.forEach(function(Tt){B.inserted[Tt]=!0})},flush:function(){B.registered={},B.inserted={},B.sheet.flush()},sheet:B.sheet,cache:B,getRegisteredStyles:un.bind(null,B.registered),merge:Xo.bind(null,B.registered,K)}},Kr=function A(f){for(var B="",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}$&&(B&&(B+=" "),B+=$)}}return B};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`/** @license
53
53
  * Copyright 2025 Esri
54
54
  *
55
55
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -86,4 +86,4 @@ string: ${t}`);break}}let C=k.Gg;if(Ke.vC(k),e){let R=C.figures.iterator;for(;R.
86
86
  top: 0;
87
87
  right: 0;
88
88
  }
89
- `}var xa=8,wa=15,ba="#1e90ff",va=4;en.licenseKey="298647e0b16f4fc702d90676423d6bf919a175639c841aa45d0412f3ed083d06329fef2851d38f9787af4efe187c90d1ddc06e219e49563fe531d3da13e1d1aab03774e5140b4589f31136c5ccaa2ca1ae2870e0d2b676a1df678bedebaa";var fn=class{constructor(f,B,K){this.indexPanel=f,this.diagramPanel=B,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 B=this.getNodesFromDiagram(this.diagram),K=B.map(W=>W.data.key);Wo(K,B,!1,this.diagramNodeHighlighterIndex)}createNodeHighlighters(){this.diagramNodeIndex={},this.diagramNodeHighlighterIndex={},this.getNodesFromDiagram(this.diagram).forEach(f=>{this.diagramNodeIndex[f.data.key]=f;let B=new sn("Auto",{background:"transparent",margin:2});B.add(new Xi("RoundedRectangle",{fill:"transparent",parameter1:xa,parameter2:wa,stroke:ba,strokeWidth:va})),B.add(new io({margin:1})),this.diagramNodeHighlighterIndex[f.data.key]=B})}getNodeById(f){return this.diagramNodeIndex[f]}getNodesFromDiagram(f){let B=[],K=f.nodes.iterator;for(;K.next();)B.push(K.value);return B}redraw(f="",B=!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:B&&(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:B&&(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 Wn{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}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>`}};$n("solution-item-diagram",gn);export{gn as SolutionItemDiagram};
89
+ `}var xa=8,wa=15,ba="#1e90ff",va=4;en.licenseKey="298647e0b16f4fc702d90676423d6bf919a175639c841aa45d0412f3ed083d06329fef2851d38f9787af4efe187c90d1ddc06e219e49563fe531d3da13e1d1aab03774e5140b4589f31136c5ccaa2ca1ae2870e0d2b676a1df678bedebaa";var fn=class{constructor(f,B,K){this.indexPanel=f,this.diagramPanel=B,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,B){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.index.typeKeywords=B,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 B=this.getNodesFromDiagram(this.diagram),K=B.map(W=>W.data.key);Wo(K,B,!1,this.diagramNodeHighlighterIndex)}createNodeHighlighters(){this.diagramNodeIndex={},this.diagramNodeHighlighterIndex={},this.getNodesFromDiagram(this.diagram).forEach(f=>{this.diagramNodeIndex[f.data.key]=f;let B=new sn("Auto",{background:"transparent",margin:2});B.add(new Xi("RoundedRectangle",{fill:"transparent",parameter1:xa,parameter2:wa,stroke:ba,strokeWidth:va})),B.add(new io({margin:1})),this.diagramNodeHighlighterIndex[f.data.key]=B})}getNodeById(f){return this.diagramNodeIndex[f]}getNodesFromDiagram(f){let B=[],K=f.nodes.iterator;for(;K.next();)B.push(K.value);return B}redraw(f="",B=!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:B&&(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:B&&(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 Wn{constructor(){super(...arguments),this.templateInfoGraph=[],this.typeKeywords=[],this._diagramPanel=Zs(),this._diagramShell=Zs(),this._translations=Zn({name:"solution-item-diagram",blocking:!0})}static{this.properties={templateInfoGraph:0,typeKeywords:0,_diagramPanel:16,_diagramShell:16,_translations:16}}static{this.styles=Xr}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,this.typeKeywords)}}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>`}};$n("solution-item-diagram",gn);export{gn as SolutionItemDiagram};