@esri/solutions-components 5.0.3 → 5.0.4-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/2CXZLYXL.js +79 -0
- package/dist/cdn/2RR47QXB.js +36 -0
- package/dist/cdn/2TQ3LQDN.js +71 -0
- package/dist/cdn/{IKK4EKF4.js → 2VWM5HU4.js} +1 -1
- package/dist/cdn/3NM4VY3X.js +2 -0
- package/dist/cdn/{VNMG3E5D.js → 3TZ367SA.js} +1 -1
- package/dist/cdn/3UJYR7QJ.js +49 -0
- package/dist/cdn/3ZMHOVVV.js +2 -0
- package/dist/cdn/54XRTC4C.js +23 -0
- package/dist/cdn/5SMTVGRA.js +174 -0
- package/dist/cdn/5SQMPY2O.js +82 -0
- package/dist/cdn/5UJU2N7K.js +62 -0
- package/dist/cdn/{U2XTDZYY.js → 5XA32F2O.js} +63 -4
- package/dist/cdn/{QKSDEEHH.js → 6FABFHMW.js} +1 -1
- package/dist/cdn/6UB6ABQU.js +330 -0
- package/dist/cdn/6VTRTZCM.js +223 -0
- package/dist/cdn/6W5ZSQ4P.js +2 -0
- package/dist/cdn/763XS3LG.js +42 -0
- package/dist/cdn/7MQM7ESA.js +26 -0
- package/dist/cdn/A4P5V242.js +55 -0
- package/dist/cdn/A5E7TJCH.js +85 -0
- package/dist/cdn/A7S7WB6S.js +45 -0
- package/dist/cdn/APEKOPWA.js +20 -0
- package/dist/cdn/AR2OQQFF.js +156 -0
- package/dist/cdn/BCPJL55B.js +20 -0
- package/dist/cdn/BM6T4KFI.js +526 -0
- package/dist/cdn/{Q364IAYO.js → BNLZOV3T.js} +1 -1
- package/dist/cdn/BYMHRNFA.js +145 -0
- package/dist/cdn/BYMPNT7T.js +33 -0
- package/dist/cdn/CMD2GQDE.js +60 -0
- package/dist/cdn/{3NTCGBPK.js → COH5SYPM.js} +1 -1
- package/dist/cdn/COUYQOYV.js +20 -0
- package/dist/cdn/{OELPVFFA.js → DESJ2W2F.js} +379 -31
- package/dist/cdn/DF3DVYFZ.js +58 -0
- package/dist/cdn/DPG27RMU.js +22 -0
- package/dist/cdn/E44XREMR.js +168 -0
- package/dist/cdn/EOTJ6XDI.js +107 -0
- package/dist/cdn/EVKDZTCS.js +188 -0
- package/dist/cdn/FW7AK7QF.js +25 -0
- package/dist/cdn/GAKD5QPM.js +2 -0
- package/dist/cdn/{MOQP5E5H.js → GIBOCW5C.js} +1 -1
- package/dist/cdn/H2BRVNPE.js +24 -0
- package/dist/cdn/H4ABKN4G.js +83 -0
- package/dist/cdn/{3H5S6KGV.js → HJEU4CSN.js} +42 -42
- package/dist/cdn/IFYSBXWP.js +25 -0
- package/dist/cdn/K2NV6NKR.js +71 -0
- package/dist/cdn/KBANBVGG.js +93 -0
- package/dist/cdn/KZPE7L5X.js +2 -0
- package/dist/cdn/LOPSAZKP.js +162 -0
- package/dist/cdn/LVRNH6J6.js +2 -0
- package/dist/cdn/{ZTRDNR6L.js → M7FZWZ34.js} +1 -1
- package/dist/cdn/M7LRQ6RB.js +112 -0
- package/dist/cdn/MD4ON7OL.js +42 -0
- package/dist/cdn/MKZ6CCBU.js +2 -0
- package/dist/cdn/MPJV2VZV.js +102 -0
- package/dist/cdn/{ZV6LDJIX.js → MPOBC76W.js} +1 -1
- package/dist/cdn/MYJMI5QB.js +251 -0
- package/dist/cdn/{EG4OLFS7.js → N6HNTUZC.js} +1 -1
- package/dist/cdn/NX6QMLTR.js +20 -0
- package/dist/cdn/{MJM54ITG.js → NXLNBR5C.js} +1 -1
- package/dist/cdn/O67WOKX4.js +76 -0
- package/dist/cdn/P5FMRA7U.js +36 -0
- package/dist/cdn/PIDSKZJN.js +82 -0
- package/dist/cdn/PKTLJUC4.js +265 -0
- package/dist/cdn/{HLTPPQD5.js → QFIN37XM.js} +1 -1
- package/dist/cdn/QVLJVDDX.js +54 -0
- package/dist/cdn/RYHGOCR7.js +29 -0
- package/dist/cdn/{Y3CSVJBO.js → S5TRGTQB.js} +1 -1
- package/dist/cdn/{PUFV6POH.js → SAKOMAMP.js} +19 -1
- package/dist/cdn/SC7NAXVA.js +2 -0
- package/dist/cdn/SIAN6MSO.js +2 -0
- package/dist/cdn/SMQQJP7P.js +2 -0
- package/dist/cdn/SPYE3QCZ.js +67 -0
- package/dist/cdn/T36T2T6M.js +102 -0
- package/dist/cdn/TF7SNOC3.js +2 -0
- package/dist/cdn/{A25PBMLE.js → TPH5YYYA.js} +215 -3
- package/dist/cdn/{4TZGWL7D.js → UDNN2SER.js} +1 -1
- package/dist/cdn/UIDVWD7F.js +105 -0
- package/dist/cdn/UJUK6EU3.js +91 -0
- package/dist/cdn/{LLYTIOG4.js → W7VSS557.js} +1 -1
- package/dist/cdn/WQUYSIIK.js +20 -0
- package/dist/cdn/XDRROOF2.js +54 -0
- package/dist/cdn/XFJNDF2N.js +197 -0
- package/dist/cdn/XKG7DQ6B.js +71 -0
- package/dist/cdn/XNJDX5I3.js +20 -0
- package/dist/cdn/YHDRMV7Y.js +93 -0
- package/dist/cdn/ZYJFGFDC.js +2 -0
- package/dist/cdn/assets/arcgis-pdf-creator/labelFormats.json +191 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ar.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bg.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bs.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ca.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.cs.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.da.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.de.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.el.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.es.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.et.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fi.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fr.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.he.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hr.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hu.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.id.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.it.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ja.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ko.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lt.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lv.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.nl.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.no.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pl.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-BR.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-PT.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ro.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ru.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sk.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sl.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sr.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sv.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.th.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.tr.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.uk.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.vi.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-CN.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-HK.json +29 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-TW.json +29 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.ar.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.bg.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.bs.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.ca.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.cs.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.da.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.de.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.el.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.en.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.es.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.et.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.fi.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.fr.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.he.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.hr.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.hu.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.id.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.it.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.ja.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.ko.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.lt.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.lv.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.nb.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.nl.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.no.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.pl.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.pt-BR.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.pt-PT.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.ro.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.ru.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.sk.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.sl.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.sr.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.sv.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.th.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.tr.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.uk.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.vi.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.zh-CN.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.zh-HK.json +6 -1
- package/dist/cdn/assets/buffer-tools/t9n/messages.zh-TW.json +6 -1
- package/dist/cdn/assets/card-manager/t9n/messages.ar.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.bg.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.bs.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.ca.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.cs.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.da.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.de.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.el.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.en.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.es.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.et.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.fi.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.fr.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.he.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.hr.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.hu.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.id.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.it.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.ja.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.ko.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.lt.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.lv.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.nb.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.nl.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.no.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.pl.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.pt-BR.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.pt-PT.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.ro.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.ru.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.sk.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.sl.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.sr.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.sv.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.th.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.tr.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.uk.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.vi.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.zh-CN.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.zh-HK.json +7 -1
- package/dist/cdn/assets/card-manager/t9n/messages.zh-TW.json +7 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.ar.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.bg.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.bs.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.ca.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.cs.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.da.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.de.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.el.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.en.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.es.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.et.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.fi.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.fr.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.he.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.hr.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.hu.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.id.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.it.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.ja.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.ko.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.lt.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.lv.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.nb.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.nl.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.no.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.pl.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.pt-BR.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.pt-PT.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.ro.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.ru.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.sk.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.sl.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.sr.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.sv.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.th.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.tr.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.uk.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.vi.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.zh-CN.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.zh-HK.json +5 -1
- package/dist/cdn/assets/consent-manager/t9n/messages.zh-TW.json +5 -1
- package/dist/cdn/assets/create-feature/t9n/messages.ar.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.bg.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.bs.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.ca.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.cs.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.da.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.de.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.el.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.en.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.es.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.et.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.fi.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.fr.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.he.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.hr.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.hu.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.id.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.it.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.ja.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.ko.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.lt.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.lv.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.nb.json +5 -1
- package/dist/cdn/assets/create-feature/t9n/messages.nl.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.no.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.pl.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.pt-BR.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.pt-PT.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.ro.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.ru.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.sk.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.sl.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.sr.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.sv.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.th.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.tr.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.uk.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.vi.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.zh-CN.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.zh-HK.json +24 -1
- package/dist/cdn/assets/create-feature/t9n/messages.zh-TW.json +24 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.ar.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.bg.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.bs.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.ca.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.cs.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.da.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.de.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.el.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.en.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.es.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.et.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.fi.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.fr.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.he.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.hr.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.hu.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.id.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.it.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.ja.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.ko.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.lt.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.lv.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.nb.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.nl.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.no.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.pl.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.pt-BR.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.pt-PT.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.ro.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.ru.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.sk.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.sl.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.sr.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.sv.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.th.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.tr.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.uk.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.vi.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.zh-CN.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.zh-HK.json +3 -1
- package/dist/cdn/assets/create-related-feature/t9n/messages.zh-TW.json +3 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.ar.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.bg.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.bs.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.ca.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.cs.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.da.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.de.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.el.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.en.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.es.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.et.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.fi.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.fr.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.he.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.hr.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.hu.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.id.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.it.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.ja.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.ko.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.lt.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.lv.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.nb.json +15 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.nl.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.no.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.pl.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.pt-BR.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.pt-PT.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.ro.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.ru.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.sk.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.sl.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.sr.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.sv.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.th.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.tr.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.uk.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.vi.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.zh-CN.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.zh-HK.json +16 -1
- package/dist/cdn/assets/crowdsource-manager/t9n/messages.zh-TW.json +16 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ar.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.bg.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.bs.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ca.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.cs.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.da.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.de.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.el.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.en.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.es.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.et.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.fi.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.fr.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.he.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.hr.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.hu.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.id.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.it.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ja.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ko.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.lt.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.lv.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.nb.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.nl.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.no.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.pl.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.pt-BR.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.pt-PT.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ro.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ru.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sk.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sl.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sr.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sv.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.th.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.tr.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.uk.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.vi.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.zh-CN.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.zh-HK.json +32 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.zh-TW.json +32 -1
- package/dist/cdn/assets/delete-button/t9n/messages.ar.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.bg.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.bs.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.ca.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.cs.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.da.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.de.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.el.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.en.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.es.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.et.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.fi.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.fr.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.he.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.hr.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.hu.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.id.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.it.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.ja.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.ko.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.lt.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.lv.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.nb.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.nl.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.no.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.pl.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.pt-BR.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.pt-PT.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.ro.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.ru.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.sk.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.sl.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.sr.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.sv.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.th.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.tr.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.uk.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.vi.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.zh-CN.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.zh-HK.json +8 -1
- package/dist/cdn/assets/delete-button/t9n/messages.zh-TW.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.ar.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.bg.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.bs.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.ca.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.cs.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.da.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.de.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.el.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.en.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.es.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.et.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.fi.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.fr.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.he.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.hr.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.hu.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.id.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.it.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.ja.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.ko.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.lt.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.lv.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.nb.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.nl.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.no.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.pl.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.pt-BR.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.pt-PT.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.ro.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.ru.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.sk.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.sl.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.sr.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.sv.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.th.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.tr.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.uk.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.vi.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.zh-CN.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.zh-HK.json +8 -1
- package/dist/cdn/assets/delete-dialog/t9n/messages.zh-TW.json +8 -1
- package/dist/cdn/assets/edit-card/t9n/messages.ar.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.bg.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.bs.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.ca.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.cs.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.da.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.de.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.el.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.en.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.es.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.et.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.fi.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.fr.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.he.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.hr.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.hu.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.id.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.it.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.ja.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.ko.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.lt.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.lv.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.nb.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.nl.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.no.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.pl.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.pt-BR.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.pt-PT.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.ro.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.ru.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.sk.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.sl.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.sr.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.sv.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.th.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.tr.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.uk.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.vi.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.zh-CN.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.zh-HK.json +3 -1
- package/dist/cdn/assets/edit-card/t9n/messages.zh-TW.json +3 -1
- package/dist/cdn/assets/feature-list/t9n/messages.ar.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.bg.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.bs.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.ca.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.cs.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.da.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.de.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.el.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.en.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.es.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.et.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.fi.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.fr.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.he.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.hr.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.hu.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.id.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.it.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.ja.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.ko.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.lt.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.lv.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.nb.json +8 -1
- package/dist/cdn/assets/feature-list/t9n/messages.nl.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.no.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.pl.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.pt-BR.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.pt-PT.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.ro.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.ru.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.sk.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.sl.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.sr.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.sv.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.th.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.tr.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.uk.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.vi.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.zh-CN.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.zh-HK.json +9 -1
- package/dist/cdn/assets/feature-list/t9n/messages.zh-TW.json +9 -1
- package/dist/cdn/assets/field-selection/t9n/messages.ar.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.bg.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.bs.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.ca.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.cs.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.da.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.de.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.el.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.en.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.es.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.et.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.fi.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.fr.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.he.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.hr.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.hu.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.id.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.it.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.ja.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.ko.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.lt.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.lv.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.nl.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.no.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.pl.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.pt-BR.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.pt-PT.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.ro.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.ru.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.sk.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.sl.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.sr.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.sv.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.th.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.tr.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.uk.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.vi.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.zh-CN.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.zh-HK.json +18 -1
- package/dist/cdn/assets/field-selection/t9n/messages.zh-TW.json +18 -1
- package/dist/cdn/assets/info-card/t9n/messages.ar.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.bg.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.bs.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.ca.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.cs.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.da.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.de.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.el.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.en.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.es.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.et.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.fi.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.fr.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.he.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.hr.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.hu.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.id.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.it.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.ja.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.ko.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.lt.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.lv.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.nb.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.nl.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.no.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.pl.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.pt-BR.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.pt-PT.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.ro.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.ru.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.sk.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.sl.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.sr.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.sv.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.th.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.tr.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.uk.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.vi.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.zh-CN.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.zh-HK.json +10 -1
- package/dist/cdn/assets/info-card/t9n/messages.zh-TW.json +10 -1
- package/dist/cdn/assets/layer-list/t9n/messages.ar.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.bg.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.bs.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.ca.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.cs.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.da.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.de.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.el.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.en.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.es.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.et.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.fi.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.fr.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.he.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.hr.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.hu.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.id.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.it.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.ja.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.ko.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.lt.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.lv.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.nb.json +4 -1
- package/dist/cdn/assets/layer-list/t9n/messages.nl.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.no.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.pl.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.pt-BR.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.pt-PT.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.ro.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.ru.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.sk.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.sl.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.sr.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.sv.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.th.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.tr.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.uk.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.vi.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.zh-CN.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.zh-HK.json +5 -1
- package/dist/cdn/assets/layer-list/t9n/messages.zh-TW.json +5 -1
- package/dist/cdn/assets/layer-table/t9n/messages.ar.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.bg.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.bs.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.ca.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.cs.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.da.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.de.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.el.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.en.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.es.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.et.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.fi.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.fr.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.he.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.hr.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.hu.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.id.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.it.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.ja.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.ko.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.lt.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.lv.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.nb.json +25 -1
- package/dist/cdn/assets/layer-table/t9n/messages.nl.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.no.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.pl.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.pt-BR.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.pt-PT.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.ro.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.ru.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.sk.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.sl.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.sr.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.sv.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.th.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.tr.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.uk.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.vi.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.zh-CN.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.zh-HK.json +27 -1
- package/dist/cdn/assets/layer-table/t9n/messages.zh-TW.json +27 -1
- package/dist/cdn/assets/map-card/t9n/messages.ar.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.bg.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.bs.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.ca.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.cs.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.da.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.de.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.el.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.en.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.es.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.et.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.fi.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.fr.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.he.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.hr.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.hu.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.id.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.it.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.ja.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.ko.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.lt.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.lv.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.nb.json +10 -1
- package/dist/cdn/assets/map-card/t9n/messages.nl.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.no.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.pl.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.pt-BR.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.pt-PT.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.ro.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.ru.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.sk.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.sl.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.sr.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.sv.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.th.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.tr.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.uk.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.vi.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.zh-CN.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.zh-HK.json +11 -1
- package/dist/cdn/assets/map-card/t9n/messages.zh-TW.json +11 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.ar.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.bg.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.bs.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.ca.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.cs.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.da.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.de.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.el.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.en.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.es.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.et.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.fi.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.fr.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.he.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.hr.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.hu.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.id.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.it.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.ja.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.ko.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.lt.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.lv.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.nb.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.nl.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.no.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.pl.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.pt-BR.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.pt-PT.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.ro.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.ru.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.sk.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.sl.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.sr.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.sv.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.th.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.tr.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.uk.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.vi.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.zh-CN.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.zh-HK.json +5 -1
- package/dist/cdn/assets/map-draw-tools/t9n/messages.zh-TW.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.ar.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.bg.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.bs.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.ca.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.cs.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.da.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.de.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.el.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.en.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.es.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.et.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.fi.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.fr.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.he.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.hr.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.hu.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.id.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.it.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.ja.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.ko.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.lt.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.lv.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.nb.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.nl.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.no.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.pl.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.pt-BR.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.pt-PT.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.ro.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.ru.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.sk.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.sl.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.sr.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.sv.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.th.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.tr.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.uk.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.vi.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.zh-CN.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.zh-HK.json +5 -1
- package/dist/cdn/assets/map-layer-picker/t9n/messages.zh-TW.json +5 -1
- package/dist/cdn/assets/map-picker/t9n/messages.ar.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.bg.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.bs.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.ca.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.cs.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.da.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.de.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.el.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.en.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.es.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.et.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.fi.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.fr.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.he.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.hr.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.hu.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.id.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.it.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.ja.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.ko.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.lt.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.lv.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.nb.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.nl.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.no.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.pl.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.pt-BR.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.pt-PT.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.ro.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.ru.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.sk.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.sl.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.sr.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.sv.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.th.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.tr.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.uk.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.vi.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.zh-CN.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.zh-HK.json +3 -1
- package/dist/cdn/assets/map-picker/t9n/messages.zh-TW.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.ar.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.bg.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.bs.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.ca.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.cs.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.da.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.de.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.el.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.en.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.es.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.et.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.fi.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.fr.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.he.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.hr.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.hu.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.id.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.it.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.ja.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.ko.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.lt.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.lv.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.nl.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.no.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.pl.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.pt-BR.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.pt-PT.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.ro.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.ru.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.sk.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.sl.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.sr.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.sv.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.th.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.tr.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.uk.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.vi.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.zh-CN.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.zh-HK.json +3 -1
- package/dist/cdn/assets/map-search/t9n/messages.zh-TW.json +3 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.ar.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.bg.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.bs.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.ca.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.cs.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.da.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.de.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.el.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.en.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.es.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.et.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.fi.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.fr.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.he.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.hr.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.hu.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.id.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.it.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.ja.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.ko.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.lt.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.lv.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.nb.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.nl.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.no.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.pl.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.pt-BR.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.pt-PT.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.ro.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.ru.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.sk.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.sl.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.sr.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.sv.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.th.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.tr.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.uk.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.vi.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.zh-CN.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.zh-HK.json +16 -1
- package/dist/cdn/assets/map-select-tools/t9n/messages.zh-TW.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.ar.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.bg.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.bs.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.ca.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.cs.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.da.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.de.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.el.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.en.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.es.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.et.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.fi.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.fr.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.he.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.hr.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.hu.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.id.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.it.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.ja.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.ko.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.lt.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.lv.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.nb.json +10 -1
- package/dist/cdn/assets/map-tools/t9n/messages.nl.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.no.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.pl.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.pt-BR.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.pt-PT.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.ro.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.ru.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.sk.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.sl.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.sr.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.sv.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.th.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.tr.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.uk.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.vi.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.zh-CN.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.zh-HK.json +16 -1
- package/dist/cdn/assets/map-tools/t9n/messages.zh-TW.json +16 -1
- package/dist/cdn/assets/pdf-download/data/labelFormats.json +191 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.ar.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.bg.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.bs.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.ca.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.cs.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.da.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.de.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.el.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.en.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.es.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.et.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.fi.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.fr.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.he.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.hr.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.hu.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.id.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.it.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.ja.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.ko.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.lt.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.lv.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.nb.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.nl.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.no.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.pl.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.pt-BR.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.pt-PT.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.ro.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.ru.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.sk.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.sl.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.sr.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.sv.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.th.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.tr.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.uk.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.vi.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.zh-CN.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.zh-HK.json +3 -1
- package/dist/cdn/assets/pdf-download/t9n/messages.zh-TW.json +3 -1
- package/dist/cdn/assets/public-notification/t9n/messages.ar.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.bg.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.bs.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.ca.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.cs.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.da.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.de.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.el.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.en.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.es.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.et.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.fi.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.fr.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.he.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.hr.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.hu.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.id.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.it.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.ja.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.ko.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.lt.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.lv.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.nb.json +44 -1
- package/dist/cdn/assets/public-notification/t9n/messages.nl.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.no.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.pl.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.pt-BR.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.pt-PT.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.ro.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.ru.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.sk.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.sl.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.sr.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.sv.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.th.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.tr.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.uk.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.vi.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.zh-CN.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.zh-HK.json +54 -1
- package/dist/cdn/assets/public-notification/t9n/messages.zh-TW.json +54 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.ar.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.bg.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.bs.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.ca.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.cs.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.da.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.de.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.el.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.en.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.es.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.et.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.fi.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.fr.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.he.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.hr.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.hu.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.id.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.it.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.ja.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.ko.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.lt.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.lv.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.nb.json +9 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.nl.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.no.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.pl.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.pt-BR.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.pt-PT.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.ro.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.ru.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.sk.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.sl.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.sr.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.sv.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.th.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.tr.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.uk.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.vi.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.zh-CN.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.zh-HK.json +13 -1
- package/dist/cdn/assets/refine-selection/t9n/messages.zh-TW.json +13 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.ar.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.bg.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.bs.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.ca.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.cs.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.da.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.de.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.el.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.en.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.es.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.et.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.fi.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.fr.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.he.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.hr.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.hu.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.id.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.it.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.ja.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.ko.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.lt.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.lv.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.nl.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.no.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.pl.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.pt-BR.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.pt-PT.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.ro.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.ru.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.sk.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.sl.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.sr.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.sv.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.th.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.tr.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.uk.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.vi.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-CN.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-HK.json +14 -1
- package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-TW.json +14 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.ar.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.bg.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.bs.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.ca.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.cs.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.da.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.de.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.el.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.en.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.es.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.et.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.fi.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.fr.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.he.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.hr.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.hu.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.id.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.it.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.ja.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.ko.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.lt.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.lv.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.nl.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.no.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.pl.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.pt-BR.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.pt-PT.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.ro.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.ru.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.sk.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.sl.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.sr.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.sv.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.th.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.tr.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.uk.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.vi.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.zh-CN.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.zh-HK.json +12 -1
- package/dist/cdn/assets/solution-delete-dialog/t9n/messages.zh-TW.json +12 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.ar.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.bg.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.bs.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.ca.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.cs.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.da.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.de.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.el.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.en.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.es.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.et.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.fi.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.fr.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.he.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.hr.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.hu.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.id.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.it.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.ja.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.ko.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.lt.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.lv.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.nl.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.no.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.pl.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.pt-BR.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.pt-PT.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.ro.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.ru.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.sk.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.sl.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.sr.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.sv.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.th.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.tr.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.uk.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.vi.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.zh-CN.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.zh-HK.json +21 -1
- package/dist/cdn/assets/solution-deploy-dialog/t9n/messages.zh-TW.json +21 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ar.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.bg.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.bs.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ca.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.cs.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.da.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.de.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.el.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.en.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.es.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.et.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.fi.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.fr.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.he.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.hr.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.hu.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.id.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.it.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ja.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ko.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.lt.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.lv.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.nl.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.no.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.pl.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.pt-BR.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.pt-PT.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ro.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ru.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sk.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sl.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sr.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sv.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.th.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.tr.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.uk.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.vi.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-CN.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-HK.json +14 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-TW.json +14 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ar.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.bg.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.bs.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ca.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.cs.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.da.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.de.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.el.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.en.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.es.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.et.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.fi.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.fr.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.he.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.hr.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.hu.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.id.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.it.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ja.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ko.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.lt.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.lv.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.nl.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.no.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pl.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pt-BR.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pt-PT.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ro.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ru.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sk.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sl.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sr.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sv.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.th.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.tr.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.uk.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.vi.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-CN.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-HK.json +21 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-TW.json +21 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ar.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.bg.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.bs.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ca.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.cs.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.da.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.de.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.el.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.en.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.es.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.et.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.fi.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.fr.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.he.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.hr.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.hu.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.id.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.it.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ja.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ko.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.lt.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.lv.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.nl.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.no.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.pl.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.pt-BR.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.pt-PT.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ro.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ru.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sk.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sl.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sr.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sv.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.th.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.tr.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.uk.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.vi.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.zh-CN.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.zh-HK.json +19 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.zh-TW.json +19 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.ar.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.bg.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.bs.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.ca.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.cs.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.da.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.de.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.el.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.en.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.es.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.et.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.fi.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.fr.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.he.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.hr.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.hu.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.id.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.it.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.ja.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.ko.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.lt.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.lv.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.nl.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.no.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.pl.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.pt-BR.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.pt-PT.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.ro.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.ru.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.sk.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.sl.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.sr.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.sv.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.th.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.tr.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.uk.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.vi.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.zh-CN.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.zh-HK.json +7 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.zh-TW.json +7 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ar.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.bg.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.bs.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ca.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.cs.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.da.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.de.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.el.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.en.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.es.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.et.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.fi.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.fr.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.he.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.hr.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.hu.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.id.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.it.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ja.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ko.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.lt.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.lv.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.nl.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.no.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.pl.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.pt-BR.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.pt-PT.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ro.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ru.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sk.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sl.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sr.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sv.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.th.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.tr.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.uk.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.vi.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-CN.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-HK.json +65 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-TW.json +65 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ar.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.bg.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.bs.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ca.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.cs.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.da.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.de.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.el.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.en.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.es.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.et.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.fi.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.fr.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.he.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.hr.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.hu.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.id.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.it.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ja.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ko.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.lt.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.lv.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.nb.json +3 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.nl.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.no.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.pl.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.pt-BR.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.pt-PT.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ro.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.ru.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sk.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sl.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sr.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.sv.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.th.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.tr.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.uk.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.vi.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-CN.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-HK.json +4 -1
- package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-TW.json +4 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.ar.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.bg.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.bs.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.ca.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.cs.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.da.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.de.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.el.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.en.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.es.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.et.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.fi.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.fr.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.he.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.hr.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.hu.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.id.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.it.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.ja.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.ko.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.lt.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.lv.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.nl.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.no.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.pl.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.pt-BR.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.pt-PT.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.ro.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.ru.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.sk.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.sl.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.sr.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.sv.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.th.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.tr.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.uk.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.vi.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.zh-CN.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.zh-HK.json +9 -1
- package/dist/cdn/assets/solution-item-diagram/t9n/messages.zh-TW.json +9 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.ar.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.bg.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.bs.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.ca.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.cs.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.da.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.de.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.el.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.en.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.es.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.et.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.fi.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.fr.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.he.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.hr.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.hu.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.id.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.it.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.ja.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.ko.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.lt.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.lv.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.nl.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.no.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.pl.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.pt-BR.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.pt-PT.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.ro.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.ru.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.sk.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.sl.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.sr.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.sv.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.th.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.tr.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.uk.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.vi.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.zh-CN.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.zh-HK.json +5 -1
- package/dist/cdn/assets/solution-resource-card/t9n/messages.zh-TW.json +5 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.ar.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.bg.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.bs.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.ca.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.cs.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.da.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.de.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.el.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.en.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.es.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.et.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.fi.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.fr.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.he.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.hr.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.hu.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.id.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.it.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.ja.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.ko.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.lt.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.lv.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.nl.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.no.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.pl.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.pt-BR.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.pt-PT.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.ro.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.ru.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.sk.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.sl.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.sr.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.sv.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.th.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.tr.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.uk.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.vi.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.zh-CN.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.zh-HK.json +4 -1
- package/dist/cdn/assets/solution-snapshot-gallery/t9n/messages.zh-TW.json +4 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.ar.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.bg.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.bs.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.ca.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.cs.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.da.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.de.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.el.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.en.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.es.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.et.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.fi.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.fr.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.he.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.hr.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.hu.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.id.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.it.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.ja.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.ko.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.lt.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.lv.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.nl.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.no.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.pl.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.pt-BR.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.pt-PT.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.ro.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.ru.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.sk.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.sl.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.sr.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.sv.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.th.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.tr.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.uk.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.vi.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.zh-CN.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.zh-HK.json +31 -1
- package/dist/cdn/assets/solution-social-share/t9n/messages.zh-TW.json +31 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.ar.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.bg.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.bs.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.ca.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.cs.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.da.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.de.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.el.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.en.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.es.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.et.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.fi.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.fr.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.he.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.hr.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.hu.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.id.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.it.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.ja.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.ko.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.lt.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.lv.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.nl.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.no.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.pl.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.pt-BR.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.pt-PT.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.ro.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.ru.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.sk.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.sl.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.sr.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.sv.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.th.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.tr.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.uk.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.vi.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.zh-CN.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.zh-HK.json +10 -1
- package/dist/cdn/assets/solutions-all-panel/t9n/messages.zh-TW.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.ar.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.bg.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.bs.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.ca.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.cs.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.da.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.de.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.el.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.en.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.es.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.et.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.fi.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.fr.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.he.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.hr.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.hu.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.id.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.it.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.ja.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.ko.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.lt.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.lv.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.nl.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.no.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.pl.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.pt-BR.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.pt-PT.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.ro.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.ru.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.sk.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.sl.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.sr.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.sv.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.th.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.tr.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.uk.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.vi.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.zh-CN.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.zh-HK.json +10 -1
- package/dist/cdn/assets/solutions-all-shell/t9n/messages.zh-TW.json +10 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ar.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bg.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bs.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ca.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.cs.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.da.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.de.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.el.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.en.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.es.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.et.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fi.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fr.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.he.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hr.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hu.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.id.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.it.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ja.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ko.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lt.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lv.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.nl.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.no.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pl.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-BR.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-PT.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ro.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ru.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sk.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sl.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sr.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sv.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.th.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.tr.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.uk.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.vi.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-CN.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-HK.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-TW.json +17 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.ar.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.bg.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.bs.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.ca.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.cs.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.da.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.de.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.el.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.en.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.es.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.et.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.fi.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.fr.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.he.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.hr.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.hu.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.id.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.it.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.ja.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.ko.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.lt.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.lv.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.nl.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.no.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.pl.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.pt-BR.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.pt-PT.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.ro.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.ru.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.sk.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.sl.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.sr.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.sv.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.th.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.tr.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.uk.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.vi.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.zh-CN.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.zh-HK.json +12 -1
- package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.zh-TW.json +12 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.ar.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.bg.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.bs.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.ca.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.cs.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.da.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.de.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.el.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.en.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.es.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.et.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.fi.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.fr.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.he.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.hr.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.hu.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.id.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.it.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.ja.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.ko.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.lt.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.lv.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.nl.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.no.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.pl.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.pt-BR.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.pt-PT.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.ro.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.ru.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.sk.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.sl.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.sr.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.sv.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.th.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.tr.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.uk.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.vi.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.zh-CN.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.zh-HK.json +8 -1
- package/dist/cdn/assets/solutions-deployed-panel/t9n/messages.zh-TW.json +8 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.ar.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.bg.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.bs.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.ca.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.cs.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.da.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.de.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.el.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.en.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.es.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.et.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.fi.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.fr.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.he.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.hr.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.hu.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.id.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.it.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.ja.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.ko.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.lt.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.lv.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.nl.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.no.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.pl.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.pt-BR.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.pt-PT.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.ro.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.ru.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.sk.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.sl.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.sr.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.sv.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.th.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.tr.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.uk.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.vi.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.zh-CN.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.zh-HK.json +9 -1
- package/dist/cdn/assets/solutions-deployed-shell/t9n/messages.zh-TW.json +9 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ar.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.bg.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.bs.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ca.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.cs.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.da.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.de.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.el.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.en.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.es.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.et.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.fi.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.fr.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.he.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.hr.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.hu.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.id.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.it.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ja.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ko.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.lt.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.lv.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.nl.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.no.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.pl.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.pt-BR.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.pt-PT.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ro.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ru.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sk.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sl.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sr.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sv.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.th.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.tr.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.uk.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.vi.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.zh-CN.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.zh-HK.json +52 -1
- package/dist/cdn/assets/solutions-filter-panel/t9n/messages.zh-TW.json +52 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.ar.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.bg.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.bs.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.ca.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.cs.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.da.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.de.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.el.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.en.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.es.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.et.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.fi.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.fr.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.he.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.hr.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.hu.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.id.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.it.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.ja.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.ko.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.lt.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.lv.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.nl.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.no.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.pl.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.pt-BR.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.pt-PT.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.ro.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.ru.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.sk.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.sl.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.sr.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.sv.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.th.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.tr.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.uk.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.vi.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.zh-CN.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.zh-HK.json +66 -1
- package/dist/cdn/assets/solutions-resources-shell/t9n/messages.zh-TW.json +66 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.ar.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.bg.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.bs.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.ca.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.cs.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.da.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.de.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.el.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.en.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.es.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.et.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.fi.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.fr.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.he.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.hr.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.hu.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.id.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.it.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.ja.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.ko.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.lt.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.lv.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.nl.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.no.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.pl.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.pt-BR.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.pt-PT.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.ro.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.ru.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.sk.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.sl.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.sr.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.sv.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.th.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.tr.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.uk.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.vi.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.zh-CN.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.zh-HK.json +17 -1
- package/dist/cdn/assets/solutions-searchsort-toolbar/t9n/messages.zh-TW.json +17 -1
- package/dist/cdn/index.js +3 -1
- package/dist/cdn/main.css +5 -1
- package/dist/chunks/Auth.js +169 -81
- package/dist/chunks/cardFetchingUtils.js +291 -197
- package/dist/chunks/cardsHelpers.js +101 -69
- package/dist/chunks/downloadUtils.js +820 -513
- package/dist/chunks/getItemIcon.js +108 -26
- package/dist/chunks/getRelatedInfos.js +52 -37
- package/dist/chunks/interfaces.js +830 -367
- package/dist/chunks/mapViewUtils.js +135 -88
- package/dist/chunks/pciUtils.js +372 -184
- package/dist/chunks/popupUtils.js +42 -25
- package/dist/chunks/publicNotificationContext.js +3 -3
- package/dist/chunks/queryUtils.js +105 -55
- package/dist/chunks/runtime.js +12 -11
- package/dist/chunks/solution-deploy-dialog.js +411 -178
- package/dist/chunks/solutions-deploy-app-nav.js +484 -159
- package/dist/chunks/useT9n.js +4 -4
- package/dist/components/arcgis-solutions-assistant/customElement.js +1513 -976
- package/dist/components/buffer-tools/customElement.d.ts +1 -1
- package/dist/components/buffer-tools/customElement.js +134 -43
- package/dist/components/card-manager/customElement.d.ts +2 -2
- package/dist/components/card-manager/customElement.js +141 -42
- package/dist/components/consent-manager/customElement.d.ts +1 -1
- package/dist/components/consent-manager/customElement.js +3910 -2803
- package/dist/components/create-feature/customElement.d.ts +1 -1
- package/dist/components/create-feature/customElement.js +820 -283
- package/dist/components/create-related-feature/customElement.d.ts +3 -3
- package/dist/components/create-related-feature/customElement.js +197 -76
- package/dist/components/crowdsource-manager/customElement.js +622 -145
- package/dist/components/crowdsource-reporter/customElement.d.ts +1 -1
- package/dist/components/crowdsource-reporter/customElement.js +873 -340
- package/dist/components/deduct-calculator/customElement.js +56 -23
- package/dist/components/delete-button/customElement.d.ts +1 -1
- package/dist/components/delete-button/customElement.js +52 -17
- package/dist/components/delete-dialog/customElement.d.ts +1 -1
- package/dist/components/delete-dialog/customElement.js +49 -20
- package/dist/components/edit-card/customElement.d.ts +2 -2
- package/dist/components/edit-card/customElement.js +205 -52
- package/dist/components/feature-details/customElement.d.ts +2 -2
- package/dist/components/feature-details/customElement.js +264 -106
- package/dist/components/feature-list/customElement.d.ts +1 -1
- package/dist/components/feature-list/customElement.js +405 -166
- package/dist/components/field-selection/customElement.d.ts +3 -3
- package/dist/components/field-selection/customElement.js +291 -131
- package/dist/components/info-card/customElement.d.ts +2 -2
- package/dist/components/info-card/customElement.js +309 -82
- package/dist/components/layer-list/customElement.d.ts +1 -1
- package/dist/components/layer-list/customElement.js +155 -71
- package/dist/components/layer-list-widget/customElement.d.ts +2 -2
- package/dist/components/layer-list-widget/customElement.js +51 -20
- package/dist/components/layer-table/customElement.d.ts +1 -1
- package/dist/components/layer-table/customElement.js +1515 -579
- package/dist/components/map-basemap-gallery/customElement.d.ts +2 -2
- package/dist/components/map-basemap-gallery/customElement.js +68 -31
- package/dist/components/map-card/customElement.d.ts +3 -3
- package/dist/components/map-card/customElement.js +418 -130
- package/dist/components/map-draw-tools/customElement.d.ts +5 -5
- package/dist/components/map-draw-tools/customElement.js +240 -90
- package/dist/components/map-floor-filter/customElement.d.ts +2 -2
- package/dist/components/map-floor-filter/customElement.js +92 -34
- package/dist/components/map-fullscreen/customElement.d.ts +2 -2
- package/dist/components/map-fullscreen/customElement.js +54 -22
- package/dist/components/map-layer-picker/customElement.d.ts +1 -1
- package/dist/components/map-layer-picker/customElement.js +329 -113
- package/dist/components/map-legend/customElement.d.ts +2 -2
- package/dist/components/map-legend/customElement.js +53 -22
- package/dist/components/map-picker/customElement.js +233 -64
- package/dist/components/map-search/customElement.d.ts +2 -2
- package/dist/components/map-search/customElement.js +103 -41
- package/dist/components/map-select-tools/customElement.d.ts +9 -9
- package/dist/components/map-select-tools/customElement.js +583 -220
- package/dist/components/map-tools/customElement.d.ts +2 -2
- package/dist/components/map-tools/customElement.js +428 -134
- package/dist/components/pci-calculator/customElement.js +88 -21
- package/dist/components/pdf-download/customElement.js +66 -37
- package/dist/components/public-notification/customElement.d.ts +10 -10
- package/dist/components/public-notification/customElement.js +920 -329
- package/dist/components/refine-selection/customElement.d.ts +8 -8
- package/dist/components/refine-selection/customElement.js +422 -164
- package/dist/components/selection-tool/customElement.d.ts +1 -1
- package/dist/components/selection-tool/customElement.js +82 -36
- package/dist/components/solution-configure-titles/customElement.js +284 -75
- package/dist/components/solution-delete-dialog/customElement.js +208 -75
- package/dist/components/solution-deploy-dialog/customElement.js +2 -2
- package/dist/components/solution-deployed-card/customElement.js +2 -2
- package/dist/components/solution-deployed-card-panel/customElement.js +499 -100
- package/dist/components/solution-deploying-dialog/customElement.js +139 -44
- package/dist/components/solution-details-card/customElement.js +193 -33
- package/dist/components/solution-details-panel/customElement.js +1103 -274
- package/dist/components/solution-item-accordion/customElement.js +228 -71
- package/dist/components/solution-item-diagram/customElement.js +661 -341
- package/dist/components/solution-item-icon/customElement.js +42 -12
- package/dist/components/solution-resource-card/customElement.js +89 -29
- package/dist/components/solution-snapshot-gallery/customElement.js +203 -33
- package/dist/components/solution-social-share/customElement.js +436 -85
- package/dist/components/solution-user-avatar/customElement.js +98 -31
- package/dist/components/solutions-all-panel/customElement.js +412 -131
- package/dist/components/solutions-all-shell/customElement.js +350 -103
- package/dist/components/solutions-deploy-app/customElement.js +514 -159
- package/dist/components/solutions-deploy-app-nav/customElement.js +2 -2
- package/dist/components/solutions-deployed-panel/customElement.js +358 -122
- package/dist/components/solutions-deployed-shell/customElement.js +252 -57
- package/dist/components/solutions-filter-panel/customElement.js +213 -104
- package/dist/components/solutions-resources-section/customElement.js +70 -11
- package/dist/components/solutions-resources-shell/customElement.js +198 -86
- package/dist/components/solutions-searchsort-toolbar/customElement.js +269 -119
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +34 -34
- package/dist/loader.js +4 -4
- package/dist/solutions-components_commit.txt +6 -6
- package/package.json +1 -1
- package/dist/cdn/254AARKL.js +0 -2
- package/dist/cdn/2OL2CMZE.js +0 -2
- package/dist/cdn/3QMNW3AL.js +0 -2
- package/dist/cdn/3X5E5PEB.js +0 -2
- package/dist/cdn/46N6WE5W.js +0 -2
- package/dist/cdn/47EMI5L2.js +0 -2
- package/dist/cdn/4H3LGV2O.js +0 -2
- package/dist/cdn/5H3T3ZTG.js +0 -2
- package/dist/cdn/632Z67I5.js +0 -2
- package/dist/cdn/65I7NFWN.js +0 -2
- package/dist/cdn/6GMSPYN2.js +0 -2
- package/dist/cdn/6LLQFZGG.js +0 -2
- package/dist/cdn/7G7GTCD2.js +0 -2
- package/dist/cdn/7QOFBIFO.js +0 -2
- package/dist/cdn/B5ARN6DC.js +0 -2
- package/dist/cdn/B7LNGJY2.js +0 -2
- package/dist/cdn/BAVJY3AH.js +0 -2
- package/dist/cdn/BVBWBQGA.js +0 -2
- package/dist/cdn/CKD45FGQ.js +0 -2
- package/dist/cdn/DIG42YV7.js +0 -2
- package/dist/cdn/E5GLDSJZ.js +0 -2
- package/dist/cdn/F7CBQCHQ.js +0 -2
- package/dist/cdn/F7KPKXY6.js +0 -2
- package/dist/cdn/FRM6WUOB.js +0 -2
- package/dist/cdn/GHL7S2IO.js +0 -2
- package/dist/cdn/GVHIJ3IB.js +0 -2
- package/dist/cdn/H2ZDTZJM.js +0 -2
- package/dist/cdn/IJBEMLYV.js +0 -2
- package/dist/cdn/JMOT5FWT.js +0 -2
- package/dist/cdn/JO4WX767.js +0 -2
- package/dist/cdn/KB2TRJ24.js +0 -2
- package/dist/cdn/KDIUYXBA.js +0 -2
- package/dist/cdn/LI7AOAAS.js +0 -2
- package/dist/cdn/LT26PSOA.js +0 -2
- package/dist/cdn/LYVD54Z4.js +0 -2
- package/dist/cdn/MKJGHHQA.js +0 -2
- package/dist/cdn/MQ3VVC37.js +0 -2
- package/dist/cdn/O5B2N6WR.js +0 -2
- package/dist/cdn/OWIJJGEY.js +0 -2
- package/dist/cdn/PHNGM56J.js +0 -2
- package/dist/cdn/PTCD4PWF.js +0 -2
- package/dist/cdn/PXZF4QLN.js +0 -2
- package/dist/cdn/Q5CDQ25L.js +0 -2
- package/dist/cdn/QDQVOSEM.js +0 -2
- package/dist/cdn/QFQS5CRA.js +0 -2
- package/dist/cdn/QO5AMX4U.js +0 -2
- package/dist/cdn/QRPBAR4V.js +0 -2
- package/dist/cdn/RNEXKDUX.js +0 -2
- package/dist/cdn/S23N6TCC.js +0 -2
- package/dist/cdn/SHZO2XLE.js +0 -2
- package/dist/cdn/SJEXGZK4.js +0 -2
- package/dist/cdn/SVAPYMHV.js +0 -2
- package/dist/cdn/TH6ZKLKN.js +0 -2
- package/dist/cdn/TZR3I4ZP.js +0 -21
- package/dist/cdn/UDOITPWM.js +0 -2
- package/dist/cdn/URNDQQPI.js +0 -2
- package/dist/cdn/UUYUTETH.js +0 -2
- package/dist/cdn/UW42HUTN.js +0 -2
- package/dist/cdn/VPNO4RA7.js +0 -2
- package/dist/cdn/WEWRDXGB.js +0 -2
- package/dist/cdn/WUNWHJR5.js +0 -2
- package/dist/cdn/WZGZCVBE.js +0 -2
- package/dist/cdn/XWZ2LVEA.js +0 -2
- package/dist/cdn/Y7H6OFT6.js +0 -2
- package/dist/cdn/YCKE3G3V.js +0 -7
- package/dist/cdn/Z6D47FMI.js +0 -2
- package/dist/cdn/ZEFTAU6G.js +0 -2
- package/dist/cdn/ZWFXFJN5.js +0 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{a as un}from"./GVHIJ3IB.js";import"./SHZO2XLE.js";import{a as ln}from"./6LLQFZGG.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import{b as hn}from"./LI7AOAAS.js";import{F as ms,G as ps,H as an,h as on,i as rn}from"./46DQNAMV.js";import"./OR4HXHSY.js";(function(){let K=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};K.requestAnimationFrame===void 0&&(K.setImmediate===void 0?K.requestAnimationFrame=x=>K.setTimeout(x,0):K.requestAnimationFrame=K.setImmediate);class m{static hr=K.navigator!==void 0&&K.navigator.platform!==void 0&&K.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static SP(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&m.wc(s),s=m.un(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static un(t,e){return K.setTimeout(t,e)}static wc(t){K.clearTimeout(t)}static Ni(t){return K.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),m.o(i)}static se(t,e,i,s){}static s(t,e,i,s){}static NU(t,e,i){}static xc(t,e,i){if(t===null||typeof t!="object"){let s=m.LL(e);i!==void 0&&(s+="."+i),m.si(t,"object",s)}}static S(t,e,i){m.s(t,"function",e,i)}static CU(t,e,i){}static si(t,e,i,s){}static J(t,e,i,s){let n=m.LL(i);s!==void 0&&(n+="."+s),m.o(n+" is not in the range "+e+": "+t)}static Xi(t){}static cr(t,e){}static ne(t){K.console&&K.console.log(t)}static $(t){return t!==null&&typeof t=="object"}static it(t){return typeof t=="function"}static MP=[];static st(){let t=m.MP.pop();return t===void 0?[]:t}static Z(t){t.length=0,m.MP.push(t)}static LU=Object.freeze([]);static LL(t){return t===null?"*":typeof t=="string"?t:m.it(t)?t.name:""}static Gn(t){return m.it(t)?t.className?t.className:t.name:m.$(t)&&t.constructor?m.Gn(t.constructor):typeof t}static $a(t,e){return e==null||e===""?null:m.$(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return m.$(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 Yw(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.AU;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static zF(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 XF(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 We(t){return m.zF(m.XF(t))}static color1="@COLOR1";static color2="@COLOR2";static Kw="32ab5ff3b26f42dc0ed90f21422913b5"}m.vfo="29e647fdb5";class rt{NP;constructor(){this.NP=[]}toString(){return this.NP.join("")}add(t){t!==""&&this.NP.push(t)}}class bt{}class Pt{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}Ml(){}toString(){return"EmptyIterator"}static instance=new Pt}class dt{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 dt(t(this.value))}filter(t){return t(this.value)?new dt(this.value):Pt.instance}get count(){return 1}Ml(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class gt{qt;zs;Gt;Tt;constructor(t){this.qt=t,this.zs=null,t.fr=null,this.Gt=t.rt,this.Tt=-1}[Symbol.iterator](){return this.zs===null?this.qt.r.values():this.qt.r.filter(this.zs).values()}key;value;get iterator(){return this}get predicate(){return this.zs}set predicate(t){this.zs=t}reset(){let t=this.qt;t.fr=null,this.Gt=t.rt,this.Tt=-1}next(){let t=this.qt;if(t.rt!==this.Gt){if(this.key<0)return!1;m.Xi(t)}let e=t.r,i=e.length,s=++this.Tt,n=this.zs;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.Tt=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.Ml()}return!1}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.rt,this.Tt=0;let e=t.r,i=e.length,s=this.zs;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.Tt=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.fr=null;let i=e.rt;this.Tt=-1;let s=e.r,n=s.length,o=this.zs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.rt!==i&&m.Xi(e)}}return!1}all(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=e.r,n=s.length,o=this.zs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.rt!==i&&m.Xi(e)}}return!0}each(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=e.r,n=s.length,o=this.zs;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.rt!==i&&m.Xi(e))}return this}map(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.zs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.rt!==i&&m.Xi(e))}let a=new q;return a.r=s,a.Gi(),a.iterator}filter(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.zs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.rt!==i&&m.Xi(e))}let a=new q;return a.r=s,a.Gi(),a.iterator}get count(){let t=this.zs;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}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.zs=null,this.qt.fr=this}toString(){return"ListIterator@"+this.Tt+"/"+this.qt.count}}class kt{qt;Gt;Tt;constructor(t){this.qt=t,t.ur=null,this.Gt=t.rt,this.Tt=t.r.length}[Symbol.iterator](){return this.qt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.qt;t.ur=null,this.Gt=t.rt,this.Tt=t.r.length}next(){let t=this.qt;if(t.rt!==this.Gt){if(this.key<0)return!1;m.Xi(t)}let e=--this.Tt;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.Ml(),!1)}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.rt;let e=t.r,i=e.length-1;if(this.Tt=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.ur=null;let i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.rt!==i&&m.Xi(e)}return!1}all(t){let e=this.qt;e.ur=null;let i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.rt!==i&&m.Xi(e)}return!0}each(t){let e=this.qt;e.ur=null;let i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.rt!==i&&m.Xi(e)}return this}map(t){let e=this.qt;e.ur=null;let i=e.rt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.rt!==i&&m.Xi(e)}let r=new q;return r.r=s,r.Gi(),r.iterator}filter(t){let e=this.qt;e.ur=null;let i=e.rt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.rt!==i&&m.Xi(e)}let r=new q;return r.r=s,r.Gi(),r.iterator}get count(){return this.qt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.qt.ur=this}toString(){return"ListIteratorBackwards("+this.Tt+"/"+this.qt.count+")"}}class q{u;r;rt;fr;ur;constructor(t){V.Je(this),this.u=!1,this.r=[],this.rt=0,this.fr=null,this.ur=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}Gi(){let t=this.rt;t++,t>999999999&&(t=0),this.rt=t}k(){return this.u=!0,this}ce(){return this.u=!1,this}toString(){return"List()#"+V.xs(this)}add(t){return this.u&&m.L(this,t),this.r.push(t),this.Gi(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.u&&m.L(this);let e=this.r;if(t.first){let i=t.iterator;for(;i.next();)e.push(i.value)}else for(let i of t)e.push(i);return this.Gi(),this}clear(){this.u&&m.L(this),this.r.length=0,this.Gi()}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)&&m.J(t,"0 <= i < length",q,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&m.J(t,"0 <= i < length",q,"setElt:i"),this.u&&m.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.u&&m.L(this);let t=this.r;if(t.length>0){let e=t.pop();return e===void 0?null:e}return null}any(t){let e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.rt!==i&&m.Xi(this)}return!1}all(t){let e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.rt!==i&&m.Xi(this)}return!0}each(t){let e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.rt!==i&&m.Xi(this);return this}map(t){let e=new q,i=[],s=this.r,n=this.rt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.rt!==n&&m.Xi(this);return e.r=i,e.Gi(),e}filter(t){let e=new q,i=[],s=this.r,n=this.rt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.rt!==n&&m.Xi(this)}return e.r=i,e.Gi(),e}insertAt(t,e){t<0&&m.J(t,">= 0",q,"insertAt:i"),this.u&&m.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.Gi()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.u&&m.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.Gi(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&m.J(t,"0 <= i < length",q,"removeAt:i"),this.u&&m.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.Gi()}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.u&&m.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.Gi(),this}copy(){let t=new q,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 AL(){return this.r}toSet(){let t=new V,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.u&&m.L(this),this.r.sort(t),this.Gi(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.u&&m.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&m.J(e,"0 <= from < length",q,"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.Gi()),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.Gi(),this}reverse(){return this.u&&m.L(this),this.r.reverse(),this.Gi(),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 Pt.instance;let t=this.fr;return t!==null?(t.reset(),t):new gt(this)}get iteratorBackwards(){if(this.r.length<=0)return Pt.instance;let t=this.ur;return t!==null?(t.reset(),t):new kt(this)}}class Zt{Lo;oe;constructor(t){this.Lo=t,this.oe=t.g.values()}[Symbol.iterator](){return this.Lo.g.values()}key;value;get iterator(){return this}reset(){let t=this.Lo;this.oe=t.g.values()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Lo.g.size===0?null:(this.oe=this.Lo.g.values(),this.oe.next().value)}any(t){return this.Lo.any(t)}all(t){return this.Lo.all(t)}each(t){return this.Lo.each(t),this}map(t){let e=new q;return this.Lo.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new q;return this.Lo.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.Lo.count}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"SetIterator"}}class V{u;g;constructor(t){this.u=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}k(){return this.u=!0,this}ce(){return this.u=!1,this}toString(){return"Set()#"+V.xs(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(this.u&&m.L(this),t.first){let e=t.iterator;for(;e.next();)this.g.add(e.value)}else for(let e of t)this.g.add(e);return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1}else for(let e of t)if(!this.has(e))return!1;return!0}containsAny(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0}else for(let e of t)if(this.has(e))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 V;for(let i of this.g)e.add(t(i));return e}filter(t){let e=new V;for(let i of this.g)t(i)&&e.add(i);return e}delete(t){return this.u&&m.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.u&&m.L(this),t.first){let e=t.iterator;for(;e.next();)this.delete(e.value)}else for(let e of t)this.delete(e);return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.u&&m.L(this);let e=new V;e.addAll(t);let i=[];if(t.first){let s=t.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}}else for(let s of t)e.has(s)||i.push(s);return this.removeAll(i),this}clear(){this.u&&m.L(this),this.g.clear()}copy(){let t=new V;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){let t=new q;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?Pt.instance:new Zt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static Hw=1;static Je(t){t.__gohashid=V.Hw++}static xs(t){return t.__gohashid}}class We{j;oe;constructor(t){this.j=t,this.oe=t.g.keys()}[Symbol.iterator](){return this.j.g.keys()}key;value;get iterator(){return this}reset(){let t=this.j;this.oe=t.g.keys()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.j.g.size===0?null:(this.oe=this.j.g.keys(),this.oe.next().value)}any(t){for(let e of this.j.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.j.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.j.g)t(e[0]);return this}map(t){let e=this.j,i=new q;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.j,i=new q;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.j.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapKeySetIterator"}}class Oi extends V{j;constructor(t){super(),V.Je(this),this.u=!0,this.j=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}k(){return this}ce(){return this}toString(){return"MapKeySet("+this.j.toString()+")"}add(t){m.o("This Set is read-only: "+this.toString())}has(t){return this.j.has(t)}contains(t){return this.has(t)}delete(t){m.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){m.o("This Set is read-only: "+this.toString())}first(){return this.j.g.size===0?null:this.j.g.keys().next().value}any(t){for(let e of this.j.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.j.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.j.g)t(e[0]);return this}map(t){let e=new V;for(let i of this.j.g)e.add(t(i[0]));return e}filter(t){let e=new V;for(let i of this.j.g){let s=i[0];t(s)&&e.add(s)}return e}copy(){return new Oi(this.j)}toSet(){let t=new V,e=this.j.g;for(let i of e)t.add(i[0]);return t}toArray(){let t=this.j.g,e=new Array(t.size),i=0;for(let s of t)e[i]=s[0],i++;return e}toList(){let t=new q,e=this.j.g;for(let i of e)t.add(i[0]);return t}get count(){return this.j.size}get size(){return this.j.size}get iterator(){return this.j.size<=0?Pt.instance:new We(this.j)}}class Tn{j;oe;constructor(t){this.j=t,this.oe=t.g.values()}[Symbol.iterator](){return this.j.g.values()}key;value;get iterator(){return this}reset(){let t=this.j;this.oe=t.g.values()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.j.g.size===0?null:(this.oe=this.j.g.values(),this.oe.next().value)}any(t){for(let e of this.j.g)if(t(e[1]))return!0;return!1}all(t){for(let e of this.j.g)if(!t(e[1]))return!1;return!0}each(t){for(let e of this.j.g)t(e[1]);return this}map(t){let e=this.j,i=new q;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.j,i=new q;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.j.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapValueSetIterator"}}class pe{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class Ln{j;oe;constructor(t){this.j=t,this.oe=t.g.entries()}[Symbol.iterator](){return this.j.g.entries()}key;value;get iterator(){return this}reset(){let t=this.j;this.oe=t.g.entries()}next(){let t=this.oe.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.j.g.size===0)return null;this.oe=this.j.g.entries();let t=this.oe.next().value;return this.key=t[0],this.value=t[1],new pe(t[0],t[1])}any(t){return this.j.any(t)}all(t){return this.j.all(t)}each(t){return this.j.each(t),this}map(t){let e=new q,i=null;return this.j.g.forEach((s,n)=>{i===null?i=new pe(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new q,i=null;return this.j.g.forEach((s,n)=>{i===null?i=new pe(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.j.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapIterator"}}class Mt{u;g;constructor(t){V.Je(this),this.u=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}k(){return this.u=!0,this}ce(){return this.u=!1,this}toString(){return"Map()#"+V.xs(this)}set(t,e){return this.u&&m.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.u&&m.L(this),t instanceof Mt){let e=t.iterator;for(;e.next();)this.g.set(e.key,e.value)}else if(t.first){let e=t.iterator;for(;e.next();){let i=e.value;this.g.set(i.key,i.value)}}else for(let e of t){let i=e;Array.isArray(i)?this.g.set(i[0],i[1]):this.g.set(i.key,i.value)}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return t?new pe(t[0],t[1]):null}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new pe(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 pe(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 pe(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new Mt,i=null;for(let[s,n]of this.g)i===null?i=new pe(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new Mt,i=null;for(let[s,n]of this.g)i===null?i=new pe(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.u&&m.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.u&&m.L(this),this.g.clear()}copy(){let t=new Mt;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 pe(s[0],s[1]),i++;return e}toKeySet(){return new Oi(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?Pt.instance:new Ln(this)}get iteratorKeys(){return this.count<=0?Pt.instance:new We(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?Pt.instance:new Tn(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;u;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):m.o("Invalid arguments to Point constructor: "+t+", "+e),this.u=!1}h(t){return this.px=t.px,this.py=t.py,this}e(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}kt(){return this.u=!0,Object.freeze(this),this}N(){return this.u||Object.isFrozen(this)?this:this.copy().k()}k(){return this.u||(this.u=!0),this}qw(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 m.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 C.c(this.px,t.x)&&C.c(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=C.Ee(t),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.TL(t.x-this.px,t.y-this.py)}direction(t,e){return this.TL(t-this.px,e-this.py)}TL(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 C.ku(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return C.ku(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return C.Pu(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return C.Nl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return C.Nl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return C._g(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return C._g(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}v(t){return t.gt(this),this}Yi(t){return t.Ci(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,u=s-e,c=-l*r-u*a;if(c<=0||c>=h)return r=n-t,a=o-e,Math.min(l*l+u*u,r*r+a*a);{let d=r*u-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 dn=new P(0,0).kt();static DL=new P(-1/0,-1/0).kt();static vL=new P(1/0,1/0).kt();static FL=new P(6,6).kt();static gn=new P(NaN,NaN).kt();static jw=[];static l(){let t=P.jw.pop();return t===void 0?new P:t}static bs(t){let e=P.jw.pop();return e===void 0?t.copy():e.h(t)}static z(t,e){let i=P.jw.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static i(t){P.jw.push(t)}}class st{sw;sh;u;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):m.o("Invalid arguments to Size constructor: "+t+", "+e),this.u=!1}h(t){return this.sw=t.sw,this.sh=t.sh,this}e(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 st;return t.sw=this.sw,t.sh=this.sh,t}kt(){return this.u=!0,Object.freeze(this),this}N(){return this.u||Object.isFrozen(this)?this:this.copy().k()}k(){return this.u||(this.u=!0),this}qw(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 st(s,o)}else return new st}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return m.s(t,"number",st,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof st?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return C.c(this.sw,t.width)&&C.c(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&&m.J(t,">= 0",st,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&m.J(t,">= 0",st,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static bc=new st(0,0).kt();static CP=new st(1,1).kt();static RL=new st(6,6).kt();static Su=new st(8,8).kt();static OL=new st(10,10).kt();static LP=new st(1/0,1/0).kt();static Ww=new st(NaN,NaN).kt();static IL=[];static l(){let t=st.IL.pop();return t===void 0?new st:t}static i(t){st.IL.push(t)}}class I{rx;ry;rw;rh;u;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 st?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):m.o("Incorrect second argument supplied to Rect constructor "+e)}else m.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.u=!1}h(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}e(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}Yn(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 I;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}kt(){return this.u=!0,Object.freeze(this),this}N(){return this.u||Object.isFrozen(this)?this:this.copy().k()}k(){return this.u||(this.u=!0),this}ce(){return this.u&&(Object.isFrozen(this)&&m.o("cannot thaw constant: "+this),this.u=!1),this}qw(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 I(s,o,r,a)}else return new I}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return m.s(t,"number",I,"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 I?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 C.c(this.rx,t.x)&&C.c(this.ry,t.y)&&C.c(this.rw,t.width)&&C.c(this.rh,t.height)}equalsApproxTo(t,e,i,s){return C.c(this.rx,t)&&C.c(this.ry,e)&&C.c(this.rw,i)&&C.c(this.rh,s)}equalsApproxClose(t){return C.X(this.rx,t.x)&&C.X(this.ry,t.y)&&C.X(this.rw,t.width)&&C.X(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.Jw(e,t,e,t)}addMargin(t){return this.Jw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.Jw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.Jw(t,e,i,s)}Jw(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.EL(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.EL(t,e,i,s)}EL(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))}UL(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.re(t.x,t.y,0,0)}unionRect(t){return this.re(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.re(t,e,i,s)}re(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}nearestSideDirection(t,e){return C.$w(this,t,e,!0)}nearestSideDirectionPoint(t){return C.$w(this,t.x,t.y,!0)}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,u=t,c=n;if(h+=u,l+=c,u>l||c>h)return!1;let d=s,f=a,p=e,g=o;return d+=p,f+=g,!(p>f||g>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return C.VL(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&&m.J(t,">= 0",I,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&m.J(t,">= 0",I,"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 st(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 tm=new I(0,0,0,0).kt();static GF=new I(NaN,NaN,NaN,NaN).kt();static Zw=[];static l(){let t=I.Zw.pop();return t===void 0?new I:t}static bs(t){let e=I.Zw.pop();return e===void 0?t.copy():e.h(t)}static z(t,e,i,s){let n=I.Zw.pop();return n===void 0?new I(t,e,i,s):n.e(t,e,i,s)}static i(t){I.Zw.push(t)}}class Dt{mt;mr;mb;ml;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):m.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s)}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 Dt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}qw(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 Dt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Dt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Dt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Dt(s,o):new Dt(s,o,r,a)}else return new Dt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return m.s(t,"number",Dt,"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 Dt?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 C.c(this.mt,t.top)&&C.c(this.mr,t.right)&&C.c(this.mb,t.bottom)&&C.c(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 em=new Dt(0,0,0,0).kt();static BL=new Dt(2,2,2,2).kt()}class T{sx;sy;ox;oy;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)}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 T;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}qw(t){}Ki(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this.kt()}TU(t,e){(isNaN(t)||t>1||t<0)&&m.J(t,"0 <= "+e+" <= 1",T,e)}DU(t,e){(isNaN(t)||t===1/0||t===-1/0)&&m.J(t,"real number, not NaN or Infinity",T,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return T.None;if(t==="TopLeft")return T.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return T.TopCenter;if(t==="TopRight")return T.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return T.LeftCenter;if(t==="Center")return T.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return T.RightCenter;if(t==="BottomLeft")return T.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return T.BottomCenter;if(t==="BottomRight")return T.BottomRight;if(t==="TopSide")return T.TopSide;if(t==="LeftSide")return T.LeftSide;if(t==="RightSide")return T.RightSide;if(t==="BottomSide")return T.BottomSide;if(t==="TopBottomSides")return T.TopBottomSides;if(t==="LeftRightSides")return T.LeftRightSides;if(t==="TopLeftSides")return T.TopLeftSides;if(t==="TopRightSides")return T.TopRightSides;if(t==="BottomLeftSides")return T.BottomLeftSides;if(t==="BottomRightSides")return T.BottomRightSides;if(t==="NotTopSide")return T.NotTopSide;if(t==="NotLeftSide")return T.NotLeftSide;if(t==="NotRightSide")return T.NotRightSide;if(t==="NotBottomSide")return T.NotBottomSide;if(t==="AllSides")return T.AllSides;if(t==="Default")return T.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 T(s,o,r,a)}else return new T}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return m.s(t,"number",T,"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(T.None)?"None":this.equals(T.TopLeft)?"TopLeft":this.equals(T.TopCenter)?"Top":this.equals(T.TopRight)?"TopRight":this.equals(T.LeftCenter)?"Left":this.equals(T.Center)?"Center":this.equals(T.RightCenter)?"Right":this.equals(T.BottomLeft)?"BottomLeft":this.equals(T.BottomCenter)?"Bottom":this.equals(T.BottomRight)?"BottomRight":this.equals(T.TopSide)?"TopSide":this.equals(T.LeftSide)?"LeftSide":this.equals(T.RightSide)?"RightSide":this.equals(T.BottomSide)?"BottomSide":this.equals(T.TopBottomSides)?"TopBottomSides":this.equals(T.LeftRightSides)?"LeftRightSides":this.equals(T.TopLeftSides)?"TopLeftSides":this.equals(T.TopRightSides)?"TopRightSides":this.equals(T.BottomLeftSides)?"BottomLeftSides":this.equals(T.BottomRightSides)?"BottomRightSides":this.equals(T.NotTopSide)?"NotTopSide":this.equals(T.NotLeftSide)?"NotLeftSide":this.equals(T.NotRightSide)?"NotRightSide":this.equals(T.NotBottomSide)?"NotBottomSide":this.equals(T.AllSides)?"AllSides":this.equals(T.Default)?"Default":"None"}equals(t){return t instanceof T?(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 T(.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(T.Left))t=T.LeftSide;else if(t.equals(T.Right))t=T.RightSide;else if(t.equals(T.Top))t=T.TopSide;else if(t.equals(T.Bottom))t=T.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 T(0,0,0,0).Ki(0);static Default=new T(0,0,-1,0).Ki(-1);static TopLeft=new T(0,0,0,0).kt();static TopCenter=new T(.5,0,0,0).kt();static TopRight=new T(1,0,0,0).kt();static LeftCenter=new T(0,.5,0,0).kt();static Center=new T(.5,.5,0,0).kt();static RightCenter=new T(1,.5,0,0).kt();static BottomLeft=new T(0,1,0,0).kt();static BottomCenter=new T(.5,1,0,0).kt();static BottomRight=new T(1,1,0,0).kt();static MiddleTop=T.TopCenter;static MiddleLeft=T.LeftCenter;static MiddleRight=T.RightCenter;static MiddleBottom=T.BottomCenter;static Top=T.TopCenter;static Left=T.LeftCenter;static Right=T.RightCenter;static Bottom=T.BottomCenter;static TopSide=new T(0,0,1,1).Ki(1);static LeftSide=new T(0,0,1,2).Ki(1);static RightSide=new T(0,0,1,4).Ki(1);static BottomSide=new T(0,0,1,8).Ki(1);static TopBottomSides=new T(0,0,1,9).Ki(1);static LeftRightSides=new T(0,0,1,6).Ki(1);static TopLeftSides=new T(0,0,1,3).Ki(1);static TopRightSides=new T(0,0,1,5).Ki(1);static BottomLeftSides=new T(0,0,1,10).Ki(1);static BottomRightSides=new T(0,0,1,12).Ki(1);static NotTopSide=new T(0,0,1,14).Ki(1);static NotLeftSide=new T(0,0,1,13).Ki(1);static NotRightSide=new T(0,0,1,11).Ki(1);static NotBottomSide=new T(0,0,1,7).Ki(1);static AllSides=new T(0,0,1,15).Ki(1);static AP=new T(.156,.156).kt();static TP=new T(.844,.844).kt()}class Nt{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 Nt;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}DP(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ue(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}kc(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}zL(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,u=this.m11*n+this.m21*o,c=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=u,this.m22=c,this}Qw(){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}ks(t,e,i){if(t=C.Ee(t),t===0)return this;this.Xs(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.Xs(-e,-i),this}Xs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}et(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}YF(){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.e(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}Ci(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.e(r*i+a*n,r*s+a*o)}Mu(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.e(h*i+l*n+r,h*s+l*o+a)}im(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,u=this.dy,c=e*o+i*a+l,d=e*r+i*h+u,f=s*o+i*a+l,p=s*r+i*h+u,g=e*o+n*a+l,y=e*r+n*h+u,b=s*o+n*a+l,v=s*r+n*h+u,w=c,k=c,S=d,N=d;return w=Math.min(w,f),k=Math.max(k,f),S=Math.min(S,p),N=Math.max(N,p),w=Math.min(w,g),k=Math.max(k,g),S=Math.min(S,y),N=Math.max(N,y),w=Math.min(w,b),k=Math.max(k,b),S=Math.min(S,v),N=Math.max(N,v),t.e(w,S,k-w,N-S),t}static XL=[];static l(){let t=Nt.XL.pop();return t===void 0?new Nt:t}static i(t){Nt.XL.push(t)}static vP="54a702f3e53909c447824c6706603faf4c"}let C={KF:"7da71ca0ad381e90",Kn:4*((Math.sqrt(2)-1)/3),GL:[],_w:x=>{if(x<=0)return 0;let t=C.GL;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);C.GL=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)},c:(x,t)=>{let e=x-t;return e<.5&&e>-.5},X:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},Ve:(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 u=r+s,c=a-s;if(c<=n&&n<=u){let d=h+s,f=l-s;if(f<=o&&o<=d)if(u-c>d-f)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},tx:(x,t,e,i,s,n,o,r,a,h,l,u)=>{if(!C.Ve(x,t,o,r,u,e,i)||!C.Ve(x,t,o,r,u,s,n)){let c=(x+e)/2,d=(t+i)/2,f=(e+s)/2,p=(i+n)/2,g=(s+o)/2,y=(n+r)/2,b=(c+f)/2,v=(d+p)/2,w=(f+g)/2,k=(p+y)/2,S=(b+w)/2,N=(v+k)/2;return C.tx(x,t,c,d,b,v,S,N,a,h,l,u)||C.tx(S,N,w,k,g,y,o,r,a,h,l,u)}else return C.Ve(x,t,o,r,u,h,l)},YL:(x,t,e,i,s,n,o,r,a)=>{let h=(x+e)/2,l=(t+i)/2,u=(e+s)/2,c=(i+n)/2,d=(s+o)/2,f=(n+r)/2,p=(h+u)/2,g=(l+c)/2,y=(u+d)/2,b=(c+f)/2;return a.e((p+y)/2,(g+b)/2),a},HF:(x,t,e,i,s,n,o,r)=>{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(s+o)/2,d=(n+r)/2,f=(a+l)/2,p=(h+u)/2,g=(l+c)/2,y=(u+d)/2;return P.direction(f,p,g,y)},Nu:(x,t,e,i,s,n,o,r,a,h)=>{if(!C.Ve(x,t,o,r,a,e,i)||!C.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,g=(l+c)/2,y=(u+d)/2,b=(c+f)/2,v=(d+p)/2,w=(g+b)/2,k=(y+v)/2;C.Nu(x,t,l,u,g,y,w,k,a,h),C.Nu(w,k,b,v,f,p,o,r,a,h)}else h.re(x,t,0,0),h.re(o,r,0,0);return h},Hn:(x,t,e,i,s,n,o,r,a,h)=>{if(!C.Ve(x,t,o,r,a,e,i)||!C.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,g=(l+c)/2,y=(u+d)/2,b=(c+f)/2,v=(d+p)/2,w=(g+b)/2,k=(y+v)/2;C.Hn(x,t,l,u,g,y,w,k,a,h),C.Hn(w,k,b,v,f,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},FP:(x,t,e,i,s,n,o,r,a,h)=>{if(C.Ve(x,t,s,n,h,e,i))return C.Ve(x,t,s,n,h,r,a);{let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,f=(l+c)/2,p=(u+d)/2;return C.FP(x,t,l,u,f,p,o,r,a,h)||C.FP(f,p,c,d,s,n,o,r,a,h)}},RP:(x,t,e,i,s,n,o,r)=>{if(C.Ve(x,t,s,n,o,e,i))r.re(x,t,0,0),r.re(s,n,0,0);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;C.RP(x,t,a,h,c,d,o,r),C.RP(c,d,l,u,s,n,o,r)}return r},sm:(x,t,e,i,s,n,o,r)=>{if(C.Ve(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,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;C.sm(x,t,a,h,c,d,o,r),C.sm(c,d,l,u,s,n,o,r)}return r},nm:(x,t,e,i,s,n,o,r,a,h,l,u,c,d)=>{if(!C.Ve(x,t,o,r,c,e,i)||!C.Ve(x,t,o,r,c,s,n)){let f=(x+e)/2,p=(t+i)/2,g=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+g)/2,k=(p+y)/2,S=(g+b)/2,N=(y+v)/2,D=(w+S)/2,L=(k+N)/2,M=1/0,A=!1,F=0,O=0;if(C.nm(x,t,f,p,w,k,D,L,a,h,l,u,c,d)){let E=(d.x-a)**2+(d.y-h)**2;E<M&&(M=E,A=!0,F=d.x,O=d.y)}if(C.nm(D,L,S,N,b,v,o,r,a,h,l,u,c,d)){let E=(d.x-a)**2+(d.y-h)**2;E<M&&(M=E,A=!0,F=d.x,O=d.y)}return A&&(d.x=F,d.y=O),A}else{if(!C.Pu(x,t,o,r,a,h,l,u))return!1;let f=(x-o)*(h-u)-(t-r)*(a-l);if(f===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/f,g=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/f;return d.e(p,g),!0}},om:(x,t,e,i,s,n,o,r,a,h,l,u,c)=>{let d=0;if(!C.Ve(x,t,o,r,c,e,i)||!C.Ve(x,t,o,r,c,s,n)){let f=(x+e)/2,p=(t+i)/2,g=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+g)/2,k=(p+y)/2,S=(g+b)/2,N=(y+v)/2,D=(w+S)/2,L=(k+N)/2;d+=C.om(x,t,f,p,w,k,D,L,a,h,l,u,c),d+=C.om(D,L,S,N,b,v,o,r,a,h,l,u,c)}else{let f=(x-o)*(h-u)-(t-r)*(a-l);if(f===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/f,g=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/f;if(p>=l)return d;let y=0,b=0;if((a>l?a-l:l-a)<(h>u?h-u:u-h)){if(t<r?(y=t,b=r):(y=r,b=t),g<y||g>b)return d}else if(x<o?(y=x,b=o):(y=o,b=x),p<y||p>b)return d;f>0?d++:f<0&&d--}return d},Nl:(x,t,e,i,s,n,o)=>{if(C.X(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.e(x,r),!1):h>a?(o.e(x,a),!1):(o.e(x,h),!0)}else if(C.X(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.e(r,t),!1):h>a?(o.e(a,t),!1):(o.e(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.e(x,t),!1;if(a>1.000005)return o.e(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.e(h,l),!0}}},Ao:(x,t,e,i,s,n,o,r,a)=>{if(C.c(x,e)&&C.c(t,i))return a.e(x,t),!1;if(C.X(s,o)){if(C.X(x,e))return C.Nl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return C.Nl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(C.X(x,e)){let l=h*(x-s)+n,u=0,c=0;return t<i?(u=t,c=i):(u=i,c=t),l<u?(a.e(x,u),!1):l>c?(a.e(x,c),!1):(a.e(x,l),!0)}else{let l=(i-t)/(e-x);if(C.X(h,l))return C.Nl(x,t,e,i,s,n,a),!1;{let u=(l*x-h*s+n-t)/(l-h);if(C.X(l,0)){let c=0,d=0;return x<e?(c=x,d=e):(c=e,d=x),u<c?(a.e(c,t),!1):u>d?(a.e(d,t),!1):(a.e(u,t),!0)}else{let c=l*(u-x)+t;return C.Nl(x,t,e,i,u,c,a)}}}}},Cl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,u=t;if(C.Ao(x,t,x,i,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}if(C.Ao(e,t,e,i,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}if(C.Ao(x,t,e,t,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}if(C.Ao(x,i,e,i,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}return a.e(l,u),h<1e21},ex:(x,t,e)=>C.VL(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),VL:(x,t,e,i,s,n,o,r)=>{let a=x,h=x+e,l=t,u=t+i;if(s===o){let c=0,d=0;return n<r?(c=n,d=r):(c=r,d=n),a<=s&&s<=h&&c<=u&&d>=l}if(n===r){let c=0,d=0;return s<o?(c=s,d=o):(c=o,d=s),l<=n&&n<=u&&c<=h&&d>=a}return!!(I.contains(x,t,e,i,s,n)||I.contains(x,t,e,i,o,r)||C.Pu(a,l,h,l,s,n,o,r)||C.Pu(h,l,h,u,s,n,o,r)||C.Pu(h,u,a,u,s,n,o,r)||C.Pu(a,u,a,l,s,n,o,r))},Pu:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:C.ku(x,t,e,i,s,n)*C.ku(x,t,e,i,o,r)<=0&&C.ku(s,n,o,r,x,t)*C.ku(s,n,o,r,e,i)<=0,ku:(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},$w(x,t,e,i){i===void 0&&(i=!1);let s=0,n=x===null?t:(t-x.x)/(x.width>0?x.width:1),o=x===null?e:(e-x.y)/(x.height>0?x.height:1);return n>o?n>1-o||(i||n<1-o?s=270:s=315):i||n<o?n>1-o?s=90:i||n<1-o?s=180:s=135:n<.5?s=225:n>.5&&(s=45),s},Ee:x=>(x>=360?x-=360:x<0&&(x+=360),x),qF:(x,t)=>x>t?Math.min(x-t,Math.abs(x-360-t)):t>x?Math.min(t-x,Math.abs(x-(t-360))):0,KL:(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=[],u=o/2,c=i,d=Math.min(h,Math.abs(s-i));if(d<a){let f=c+r*Math.min(d,u),p=x+e*Math.cos(c),g=t+e*Math.sin(c),y=x+e*Math.cos(f),b=t+e*Math.sin(f),v=(p+y)/2,w=(g+b)/2;return l.push([p,g,v,w,v,w,y,b]),l}for(;d>a;){let f=c+r*Math.min(d,u);l.push(C.jF(e,c,f,x,t)),d-=Math.abs(f-c),c=f}return l},jF:(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,u=l+a*o+h*r,c=4/3*(Math.sqrt(2*l*u)-u)/(a*r-h*o),d=a-c*h,f=h+c*a,p=d,g=-f,y=n+t,b=Math.cos(y),v=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*b-f*v,s+d*v+f*b,i+p*b-g*v,s+p*v+g*b,i+x*Math.cos(e),s+x*Math.sin(e)]},_g:(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,u=h;h+r-x<r/2&&(u=h+r);let c=l;return l+a-t<a/2&&(c=l+a),o.e(u,c),o},HL:(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},WF:(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,u=0,c=0;return o=r,h=o===0?x:t,u=o===0?e:i,(o===0?s:n)&&(u=-u),o=a,l=o===0?x:t,c=o===0?e:i,(o===0?s:n)&&(c=-c),C.JF(h,l,u,c,0,0)},JF:(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,u=-a+l,c=-a+Math.sqrt(h*h+l*l),d=u,f=9999999999;for(let y=0;y<f&&(d=.5*(u+c),!(d===u||d===c));++y){let b=h/(d+r),v=l/(d+a),w=b*b+v*v-1;if(w>0)u=d;else if(w<0)c=d;else break}s=r*e/(d+r),n=a*i/(d+a);let p=s-e,g=n-i;o=Math.sqrt(p*p+g*g)}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 u=s-e;o=Math.sqrt(u*u+n*n)}else s=x,n=0,o=Math.abs(e-x)}return o},qn:{},rm:new bt,dr:new bt,gr:0,lm:100};C.za=C.KF;var ze=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ze||{}),Ri=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(Ri||{});class wt{n;am;hm;Pc;Cu;Lu;jn;Wn;Jn;W;Li;Ai;ni;oi;Gs;Sc;Mc;constructor(t,e){V.Je(this),this.n=2,t===void 0&&(t=4),this.W=t,this.Li=0,this.Ai=0,this.ni=0,this.oi=0,t===4?this.Gs=new q:this.Gs=wt.ix,this.am=this.Gs.rt,this.hm=new I,this.Pc=null,this.Cu=null,this.Lu=NaN,this.jn=T.TopLeft,this.Wn=T.BottomRight,this.Sc=NaN,this.Mc=NaN,this.Jn=2,e&&Object.assign(this,e)}copy(){let t=new wt;if(t.n=this.n&-2,t.W=this.W,t.Li=this.Li,t.Ai=this.Ai,t.ni=this.ni,t.oi=this.oi,this.W===4){let e=this.Gs.r,i=t.Gs;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Gs=i}else t.Gs=this.Gs;return t.am=this.am,t.hm.h(this.hm),t.Pc=this.Pc,t.Cu=this.Cu,t.Lu=this.Lu,t.jn=this.jn.N(),t.Wn=this.Wn.N(),t.Sc=this.Sc,t.Mc=this.Mc,t.Jn=this.Jn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static ix=new q().k();get u(){return(this.n&1)!==0}set u(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}k(){if(this.u=!0,this.type!==4)return this;let t=this.figures;t.k();for(let e of t)e.k();return this}equalsApprox(t){if(!(t instanceof wt))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.qL(t):t.type===1&&this.type===4?t.qL(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 C.c(this.startX,t.startX)&&C.c(this.startY,t.startY)&&C.c(this.endX,t.endX)&&C.c(this.endY,t.endY)}qL(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&&C.c(this.startX,e.startX)&&C.c(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&C.c(this.endX,i.endX)&&C.c(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return m.s(t,"number",wt,"stringifyFixed:digits"),e=>e.toString(t)}fe(t){t in ze?this.type=t:m.cr(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 I(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 I(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 ze[this.type]}}static fillPath(t){typeof t!="string"&&m.si(t,"string",wt,"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 cm="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&m.si(t,"string",wt,"parse:str");let i=new RegExp("(["+wt.cm+"])(["+wt.cm+"])","gm"),s=new RegExp("(["+wt.cm+"])([^s])","gm"),n=new RegExp("([^s])(["+wt.cm+"])","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 F=0;F<o.length;F++){let O=o[F];if(O.match(/(\.[0-9]*)(\.)/gm)!==null){let E=m.st(),B="",X=!1;for(let z=0;z<O.length;z++){let U=O[z];U==="."&&!X?(X=!0,B+=U):U==="."?(E.push(B),B="."):B+=U}E.push(B),o.splice(F,1);for(let z=0;z<E.length;z++)o.splice(F+z,0,E[z]);F+=E.length-1,m.Z(E)}}let r=-1,a="",h="",l=new P(0,0),u=new P(0,0),c=new P(0,0),d=!0;function f(){return r>=w-1||o[r+1].match(M)!==null?!0:(d=!1,!1)}function p(){return r++,o[r]}function g(F){let O=parseFloat(p()),E=parseFloat(p());a===a.toLowerCase()&&(O=c.x+O,E=c.y+E),F.e(O,E)}function y(){return g(c),c}function b(){return g(u),u}function v(){let F=h.toLowerCase();return F==="c"||F==="s"||F==="q"||F==="t"?new P(2*c.x-u.x,2*c.y-u.y):new P(c.x,c.y)}let w=o.length,k=Ce.jL(null),S=!1,N=!1,D=!1,L=!0,M=new RegExp("["+wt.cm+"]");for(;!(r>=w-1);){if(h=a,a=p(),a==="")continue;d=!0;let F=!1;switch(a.toUpperCase()){case"X":L=!0,S=!1,N=!1;break;case"M":let O=y();for(k.Ne===null||L===!0?(k.Au(O.x,O.y,S,!1,!N,D),L=!1):k.$F(O.x,O.y),l.h(c);!f();){let E=y();k.Ys(E.x,E.y)}break;case"L":for(;!f();){let E=y();k.Ys(E.x,E.y)}d&&(F=!0);break;case"H":for(;!f();)c.e((a===a.toLowerCase()?c.x:0)+parseFloat(p()),c.y),k.Ys(c.x,c.y);break;case"V":for(;!f();)c.e(c.x,(a===a.toLowerCase()?c.y:0)+parseFloat(p())),k.Ys(c.x,c.y);d&&(F=!0);break;case"C":for(;!f();){let E=new P;g(E);let B=b(),X=y();k.pr(E.x,E.y,B.x,B.y,X.x,X.y)}d&&(F=!0);break;case"S":for(;!f();){let E=v(),B=b(),X=y();k.pr(E.x,E.y,B.x,B.y,X.x,X.y)}d&&(F=!0);break;case"Q":for(;!f();){let E=b(),B=y();k.Tu(E.x,E.y,B.x,B.y)}d&&(F=!0);break;case"T":for(;!f();){let E=v();u.h(E);let B=y();k.Tu(E.x,E.y,B.x,B.y),u.h(B)}d&&(F=!0);break;case"B":for(;!f();){let E=parseFloat(p()),B=parseFloat(p()),X=parseFloat(p()),z=parseFloat(p()),U=parseFloat(p()),tt=U,nt=!1;f()||(tt=parseFloat(p()),f()||(nt=parseFloat(p())!==0)),a===a.toLowerCase()&&(X+=c.x,z+=c.y),k.ZF(E,B,X,z,U,tt,nt)}d&&(F=!0);break;case"A":for(;!f();){let E=Math.abs(parseFloat(p())),B=Math.abs(parseFloat(p())),X=parseFloat(p()),z=!1,U=!1,tt=0,nt=0,Z=p();Z.length===1?(z=!!parseFloat(Z),U=!!parseFloat(p()),tt=parseFloat(p()),nt=parseFloat(p())):Z.length===2?(z=!!parseFloat(Z[0]),U=!!parseFloat(Z[1]),tt=parseFloat(p()),nt=parseFloat(p())):(z=!!parseFloat(Z[0]),U=!!parseFloat(Z[1]),tt=parseFloat(Z.slice(2)),nt=parseFloat(p())),a===a.toLowerCase()&&(tt=c.x+tt,nt=c.y+nt),c.e(tt,nt),k.QF(E,B,X,z,U,tt,nt)}d&&(F=!0);break;case"Z":k._F(),c.h(l);break;case"F":{let E="",B=1;for(;o[r+B];){if(o[r+B]==="0"){D=!0,B++;continue}if(o[r+B].match(/[Uu]/)!==null){B++;continue}if(o[r+B].match(M)===null){B++;continue}E=o[r+B];break}E.match(/[Mm]/)?S=!0:k.tR();break}case"U":{let E="",B=1;for(;o[r+B];){if(o[r+B].match(/[Ff]/)!==null){B++;continue}if(o[r+B].match(M)===null){B++;continue}E=o[r+B];break}E.match(/[Mm]/)?N=!0:k.eR(!1);break}default:if(a==="0"||a==="1")break;m.ne("Unknown geometry command: "+a);break}if(F){m.ne(`Bad geometry command: ${a}, next token: ${p()},
|
|
2
|
+
import{a as un}from"./6W5ZSQ4P.js";import"./K2NV6NKR.js";import{a as ln}from"./TF7SNOC3.js";import"./36I27Q5R.js";import"./GDPFKW75.js";import{b as hn}from"./3ZMHOVVV.js";import{F as ms,G as ps,H as an,h as on,i as rn}from"./46DQNAMV.js";import"./OR4HXHSY.js";(function(){let K=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};K.requestAnimationFrame===void 0&&(K.setImmediate===void 0?K.requestAnimationFrame=x=>K.setTimeout(x,0):K.requestAnimationFrame=K.setImmediate);class m{static hr=K.navigator!==void 0&&K.navigator.platform!==void 0&&K.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static SP(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&m.wc(s),s=m.un(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static un(t,e){return K.setTimeout(t,e)}static wc(t){K.clearTimeout(t)}static Ni(t){return K.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),m.o(i)}static se(t,e,i,s){}static s(t,e,i,s){}static NU(t,e,i){}static xc(t,e,i){if(t===null||typeof t!="object"){let s=m.LL(e);i!==void 0&&(s+="."+i),m.si(t,"object",s)}}static S(t,e,i){m.s(t,"function",e,i)}static CU(t,e,i){}static si(t,e,i,s){}static J(t,e,i,s){let n=m.LL(i);s!==void 0&&(n+="."+s),m.o(n+" is not in the range "+e+": "+t)}static Xi(t){}static cr(t,e){}static ne(t){K.console&&K.console.log(t)}static $(t){return t!==null&&typeof t=="object"}static it(t){return typeof t=="function"}static MP=[];static st(){let t=m.MP.pop();return t===void 0?[]:t}static Z(t){t.length=0,m.MP.push(t)}static LU=Object.freeze([]);static LL(t){return t===null?"*":typeof t=="string"?t:m.it(t)?t.name:""}static Gn(t){return m.it(t)?t.className?t.className:t.name:m.$(t)&&t.constructor?m.Gn(t.constructor):typeof t}static $a(t,e){return e==null||e===""?null:m.$(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return m.$(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 Yw(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.AU;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static zF(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 XF(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 We(t){return m.zF(m.XF(t))}static color1="@COLOR1";static color2="@COLOR2";static Kw="32ab5ff3b26f42dc0ed90f21422913b5"}m.vfo="29e647fdb5";class rt{NP;constructor(){this.NP=[]}toString(){return this.NP.join("")}add(t){t!==""&&this.NP.push(t)}}class yt{}class kt{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}Ml(){}toString(){return"EmptyIterator"}static instance=new kt}class dt{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 dt(t(this.value))}filter(t){return t(this.value)?new dt(this.value):kt.instance}get count(){return 1}Ml(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class gt{qt;zs;Gt;Tt;constructor(t){this.qt=t,this.zs=null,t.fr=null,this.Gt=t.rt,this.Tt=-1}[Symbol.iterator](){return this.zs===null?this.qt.r.values():this.qt.r.filter(this.zs).values()}key;value;get iterator(){return this}get predicate(){return this.zs}set predicate(t){this.zs=t}reset(){let t=this.qt;t.fr=null,this.Gt=t.rt,this.Tt=-1}next(){let t=this.qt;if(t.rt!==this.Gt){if(this.key<0)return!1;m.Xi(t)}let e=t.r,i=e.length,s=++this.Tt,n=this.zs;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.Tt=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.Ml()}return!1}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.rt,this.Tt=0;let e=t.r,i=e.length,s=this.zs;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.Tt=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.fr=null;let i=e.rt;this.Tt=-1;let s=e.r,n=s.length,o=this.zs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.rt!==i&&m.Xi(e)}}return!1}all(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=e.r,n=s.length,o=this.zs;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.rt!==i&&m.Xi(e)}}return!0}each(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=e.r,n=s.length,o=this.zs;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.rt!==i&&m.Xi(e))}return this}map(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.zs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.rt!==i&&m.Xi(e))}let a=new q;return a.r=s,a.Gi(),a.iterator}filter(t){let e=this.qt;e.fr=null;let i=e.rt;this.Tt=-1;let s=[],n=e.r,o=n.length,r=this.zs;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.rt!==i&&m.Xi(e))}let a=new q;return a.r=s,a.Gi(),a.iterator}get count(){let t=this.zs;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}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.zs=null,this.qt.fr=this}toString(){return"ListIterator@"+this.Tt+"/"+this.qt.count}}class St{qt;Gt;Tt;constructor(t){this.qt=t,t.ur=null,this.Gt=t.rt,this.Tt=t.r.length}[Symbol.iterator](){return this.qt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.qt;t.ur=null,this.Gt=t.rt,this.Tt=t.r.length}next(){let t=this.qt;if(t.rt!==this.Gt){if(this.key<0)return!1;m.Xi(t)}let e=--this.Tt;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.Ml(),!1)}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.rt;let e=t.r,i=e.length-1;if(this.Tt=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.ur=null;let i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.rt!==i&&m.Xi(e)}return!1}all(t){let e=this.qt;e.ur=null;let i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.rt!==i&&m.Xi(e)}return!0}each(t){let e=this.qt;e.ur=null;let i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.rt!==i&&m.Xi(e)}return this}map(t){let e=this.qt;e.ur=null;let i=e.rt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.rt!==i&&m.Xi(e)}let r=new q;return r.r=s,r.Gi(),r.iterator}filter(t){let e=this.qt;e.ur=null;let i=e.rt,s=[],n=e.r,o=n.length;this.Tt=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.rt!==i&&m.Xi(e)}let r=new q;return r.r=s,r.Gi(),r.iterator}get count(){return this.qt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.qt.ur=this}toString(){return"ListIteratorBackwards("+this.Tt+"/"+this.qt.count+")"}}class q{u;r;rt;fr;ur;constructor(t){V.Je(this),this.u=!1,this.r=[],this.rt=0,this.fr=null,this.ur=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}Gi(){let t=this.rt;t++,t>999999999&&(t=0),this.rt=t}k(){return this.u=!0,this}ce(){return this.u=!1,this}toString(){return"List()#"+V.xs(this)}add(t){return this.u&&m.L(this,t),this.r.push(t),this.Gi(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.u&&m.L(this);let e=this.r;if(t.first){let i=t.iterator;for(;i.next();)e.push(i.value)}else for(let i of t)e.push(i);return this.Gi(),this}clear(){this.u&&m.L(this),this.r.length=0,this.Gi()}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)&&m.J(t,"0 <= i < length",q,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&m.J(t,"0 <= i < length",q,"setElt:i"),this.u&&m.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.u&&m.L(this);let t=this.r;if(t.length>0){let e=t.pop();return e===void 0?null:e}return null}any(t){let e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.rt!==i&&m.Xi(this)}return!1}all(t){let e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.rt!==i&&m.Xi(this)}return!0}each(t){let e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.rt!==i&&m.Xi(this);return this}map(t){let e=new q,i=[],s=this.r,n=this.rt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.rt!==n&&m.Xi(this);return e.r=i,e.Gi(),e}filter(t){let e=new q,i=[],s=this.r,n=this.rt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.rt!==n&&m.Xi(this)}return e.r=i,e.Gi(),e}insertAt(t,e){t<0&&m.J(t,">= 0",q,"insertAt:i"),this.u&&m.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.Gi()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.u&&m.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.Gi(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&m.J(t,"0 <= i < length",q,"removeAt:i"),this.u&&m.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.Gi()}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.u&&m.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.Gi(),this}copy(){let t=new q,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 AL(){return this.r}toSet(){let t=new V,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.u&&m.L(this),this.r.sort(t),this.Gi(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.u&&m.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&m.J(e,"0 <= from < length",q,"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.Gi()),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.Gi(),this}reverse(){return this.u&&m.L(this),this.r.reverse(),this.Gi(),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 kt.instance;let t=this.fr;return t!==null?(t.reset(),t):new gt(this)}get iteratorBackwards(){if(this.r.length<=0)return kt.instance;let t=this.ur;return t!==null?(t.reset(),t):new St(this)}}class Jt{Lo;oe;constructor(t){this.Lo=t,this.oe=t.g.values()}[Symbol.iterator](){return this.Lo.g.values()}key;value;get iterator(){return this}reset(){let t=this.Lo;this.oe=t.g.values()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Lo.g.size===0?null:(this.oe=this.Lo.g.values(),this.oe.next().value)}any(t){return this.Lo.any(t)}all(t){return this.Lo.all(t)}each(t){return this.Lo.each(t),this}map(t){let e=new q;return this.Lo.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new q;return this.Lo.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.Lo.count}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"SetIterator"}}class V{u;g;constructor(t){this.u=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}k(){return this.u=!0,this}ce(){return this.u=!1,this}toString(){return"Set()#"+V.xs(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(this.u&&m.L(this),t.first){let e=t.iterator;for(;e.next();)this.g.add(e.value)}else for(let e of t)this.g.add(e);return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1}else for(let e of t)if(!this.has(e))return!1;return!0}containsAny(t){if(t===null)return!0;if(t.first){let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0}else for(let e of t)if(this.has(e))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 V;for(let i of this.g)e.add(t(i));return e}filter(t){let e=new V;for(let i of this.g)t(i)&&e.add(i);return e}delete(t){return this.u&&m.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.u&&m.L(this),t.first){let e=t.iterator;for(;e.next();)this.delete(e.value)}else for(let e of t)this.delete(e);return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.u&&m.L(this);let e=new V;e.addAll(t);let i=[];if(t.first){let s=t.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}}else for(let s of t)e.has(s)||i.push(s);return this.removeAll(i),this}clear(){this.u&&m.L(this),this.g.clear()}copy(){let t=new V;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){let t=new q;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?kt.instance:new Jt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static Hw=1;static Je(t){t.__gohashid=V.Hw++}static xs(t){return t.__gohashid}}class We{j;oe;constructor(t){this.j=t,this.oe=t.g.keys()}[Symbol.iterator](){return this.j.g.keys()}key;value;get iterator(){return this}reset(){let t=this.j;this.oe=t.g.keys()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.j.g.size===0?null:(this.oe=this.j.g.keys(),this.oe.next().value)}any(t){for(let e of this.j.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.j.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.j.g)t(e[0]);return this}map(t){let e=this.j,i=new q;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.j,i=new q;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.j.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapKeySetIterator"}}class Oi extends V{j;constructor(t){super(),V.Je(this),this.u=!0,this.j=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}k(){return this}ce(){return this}toString(){return"MapKeySet("+this.j.toString()+")"}add(t){m.o("This Set is read-only: "+this.toString())}has(t){return this.j.has(t)}contains(t){return this.has(t)}delete(t){m.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){m.o("This Set is read-only: "+this.toString())}first(){return this.j.g.size===0?null:this.j.g.keys().next().value}any(t){for(let e of this.j.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.j.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.j.g)t(e[0]);return this}map(t){let e=new V;for(let i of this.j.g)e.add(t(i[0]));return e}filter(t){let e=new V;for(let i of this.j.g){let s=i[0];t(s)&&e.add(s)}return e}copy(){return new Oi(this.j)}toSet(){let t=new V,e=this.j.g;for(let i of e)t.add(i[0]);return t}toArray(){let t=this.j.g,e=new Array(t.size),i=0;for(let s of t)e[i]=s[0],i++;return e}toList(){let t=new q,e=this.j.g;for(let i of e)t.add(i[0]);return t}get count(){return this.j.size}get size(){return this.j.size}get iterator(){return this.j.size<=0?kt.instance:new We(this.j)}}class Tn{j;oe;constructor(t){this.j=t,this.oe=t.g.values()}[Symbol.iterator](){return this.j.g.values()}key;value;get iterator(){return this}reset(){let t=this.j;this.oe=t.g.values()}next(){let t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.j.g.size===0?null:(this.oe=this.j.g.values(),this.oe.next().value)}any(t){for(let e of this.j.g)if(t(e[1]))return!0;return!1}all(t){for(let e of this.j.g)if(!t(e[1]))return!1;return!0}each(t){for(let e of this.j.g)t(e[1]);return this}map(t){let e=this.j,i=new q;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.j,i=new q;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.j.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapValueSetIterator"}}class pe{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class Ln{j;oe;constructor(t){this.j=t,this.oe=t.g.entries()}[Symbol.iterator](){return this.j.g.entries()}key;value;get iterator(){return this}reset(){let t=this.j;this.oe=t.g.entries()}next(){let t=this.oe.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.j.g.size===0)return null;this.oe=this.j.g.entries();let t=this.oe.next().value;return this.key=t[0],this.value=t[1],new pe(t[0],t[1])}any(t){return this.j.any(t)}all(t){return this.j.all(t)}each(t){return this.j.each(t),this}map(t){let e=new q,i=null;return this.j.g.forEach((s,n)=>{i===null?i=new pe(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new q,i=null;return this.j.g.forEach((s,n)=>{i===null?i=new pe(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.j.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapIterator"}}class Mt{u;g;constructor(t){V.Je(this),this.u=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}k(){return this.u=!0,this}ce(){return this.u=!1,this}toString(){return"Map()#"+V.xs(this)}set(t,e){return this.u&&m.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.u&&m.L(this),t instanceof Mt){let e=t.iterator;for(;e.next();)this.g.set(e.key,e.value)}else if(t.first){let e=t.iterator;for(;e.next();){let i=e.value;this.g.set(i.key,i.value)}}else for(let e of t){let i=e;Array.isArray(i)?this.g.set(i[0],i[1]):this.g.set(i.key,i.value)}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return t?new pe(t[0],t[1]):null}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new pe(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 pe(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 pe(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new Mt,i=null;for(let[s,n]of this.g)i===null?i=new pe(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new Mt,i=null;for(let[s,n]of this.g)i===null?i=new pe(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.u&&m.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.u&&m.L(this),this.g.clear()}copy(){let t=new Mt;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 pe(s[0],s[1]),i++;return e}toKeySet(){return new Oi(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?kt.instance:new Ln(this)}get iteratorKeys(){return this.count<=0?kt.instance:new We(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?kt.instance:new Tn(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;u;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):m.o("Invalid arguments to Point constructor: "+t+", "+e),this.u=!1}h(t){return this.px=t.px,this.py=t.py,this}e(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}kt(){return this.u=!0,Object.freeze(this),this}N(){return this.u||Object.isFrozen(this)?this:this.copy().k()}k(){return this.u||(this.u=!0),this}qw(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 m.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 C.c(this.px,t.x)&&C.c(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=C.Ee(t),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.TL(t.x-this.px,t.y-this.py)}direction(t,e){return this.TL(t-this.px,e-this.py)}TL(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 C.ku(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return C.ku(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return C.Pu(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return C.Nl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return C.Nl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return C._g(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return C._g(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}v(t){return t.gt(this),this}Yi(t){return t.Ci(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,u=s-e,c=-l*r-u*a;if(c<=0||c>=h)return r=n-t,a=o-e,Math.min(l*l+u*u,r*r+a*a);{let d=r*u-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 dn=new P(0,0).kt();static DL=new P(-1/0,-1/0).kt();static vL=new P(1/0,1/0).kt();static FL=new P(6,6).kt();static gn=new P(NaN,NaN).kt();static jw=[];static l(){let t=P.jw.pop();return t===void 0?new P:t}static bs(t){let e=P.jw.pop();return e===void 0?t.copy():e.h(t)}static z(t,e){let i=P.jw.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static i(t){P.jw.push(t)}}class st{sw;sh;u;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):m.o("Invalid arguments to Size constructor: "+t+", "+e),this.u=!1}h(t){return this.sw=t.sw,this.sh=t.sh,this}e(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 st;return t.sw=this.sw,t.sh=this.sh,t}kt(){return this.u=!0,Object.freeze(this),this}N(){return this.u||Object.isFrozen(this)?this:this.copy().k()}k(){return this.u||(this.u=!0),this}qw(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 st(s,o)}else return new st}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return m.s(t,"number",st,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof st?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return C.c(this.sw,t.width)&&C.c(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&&m.J(t,">= 0",st,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&m.J(t,">= 0",st,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static bc=new st(0,0).kt();static CP=new st(1,1).kt();static RL=new st(6,6).kt();static Su=new st(8,8).kt();static OL=new st(10,10).kt();static LP=new st(1/0,1/0).kt();static Ww=new st(NaN,NaN).kt();static IL=[];static l(){let t=st.IL.pop();return t===void 0?new st:t}static i(t){st.IL.push(t)}}class I{rx;ry;rw;rh;u;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 st?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):m.o("Incorrect second argument supplied to Rect constructor "+e)}else m.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.u=!1}h(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}e(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}Yn(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 I;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}kt(){return this.u=!0,Object.freeze(this),this}N(){return this.u||Object.isFrozen(this)?this:this.copy().k()}k(){return this.u||(this.u=!0),this}ce(){return this.u&&(Object.isFrozen(this)&&m.o("cannot thaw constant: "+this),this.u=!1),this}qw(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 I(s,o,r,a)}else return new I}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return m.s(t,"number",I,"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 I?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 C.c(this.rx,t.x)&&C.c(this.ry,t.y)&&C.c(this.rw,t.width)&&C.c(this.rh,t.height)}equalsApproxTo(t,e,i,s){return C.c(this.rx,t)&&C.c(this.ry,e)&&C.c(this.rw,i)&&C.c(this.rh,s)}equalsApproxClose(t){return C.X(this.rx,t.x)&&C.X(this.ry,t.y)&&C.X(this.rw,t.width)&&C.X(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.Jw(e,t,e,t)}addMargin(t){return this.Jw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.Jw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.Jw(t,e,i,s)}Jw(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.EL(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.EL(t,e,i,s)}EL(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))}UL(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.re(t.x,t.y,0,0)}unionRect(t){return this.re(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.re(t,e,i,s)}re(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}nearestSideDirection(t,e){return C.$w(this,t,e,!0)}nearestSideDirectionPoint(t){return C.$w(this,t.x,t.y,!0)}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,u=t,c=n;if(h+=u,l+=c,u>l||c>h)return!1;let d=s,f=a,p=e,g=o;return d+=p,f+=g,!(p>f||g>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return C.VL(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&&m.J(t,">= 0",I,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&m.J(t,">= 0",I,"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 st(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 tm=new I(0,0,0,0).kt();static GF=new I(NaN,NaN,NaN,NaN).kt();static Zw=[];static l(){let t=I.Zw.pop();return t===void 0?new I:t}static bs(t){let e=I.Zw.pop();return e===void 0?t.copy():e.h(t)}static z(t,e,i,s){let n=I.Zw.pop();return n===void 0?new I(t,e,i,s):n.e(t,e,i,s)}static i(t){I.Zw.push(t)}}class Dt{mt;mr;mb;ml;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):m.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s)}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 Dt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}qw(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 Dt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Dt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Dt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Dt(s,o):new Dt(s,o,r,a)}else return new Dt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return m.s(t,"number",Dt,"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 Dt?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 C.c(this.mt,t.top)&&C.c(this.mr,t.right)&&C.c(this.mb,t.bottom)&&C.c(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 em=new Dt(0,0,0,0).kt();static BL=new Dt(2,2,2,2).kt()}class T{sx;sy;ox;oy;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)}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 T;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}qw(t){}Ki(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this.kt()}TU(t,e){(isNaN(t)||t>1||t<0)&&m.J(t,"0 <= "+e+" <= 1",T,e)}DU(t,e){(isNaN(t)||t===1/0||t===-1/0)&&m.J(t,"real number, not NaN or Infinity",T,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return T.None;if(t==="TopLeft")return T.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return T.TopCenter;if(t==="TopRight")return T.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return T.LeftCenter;if(t==="Center")return T.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return T.RightCenter;if(t==="BottomLeft")return T.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return T.BottomCenter;if(t==="BottomRight")return T.BottomRight;if(t==="TopSide")return T.TopSide;if(t==="LeftSide")return T.LeftSide;if(t==="RightSide")return T.RightSide;if(t==="BottomSide")return T.BottomSide;if(t==="TopBottomSides")return T.TopBottomSides;if(t==="LeftRightSides")return T.LeftRightSides;if(t==="TopLeftSides")return T.TopLeftSides;if(t==="TopRightSides")return T.TopRightSides;if(t==="BottomLeftSides")return T.BottomLeftSides;if(t==="BottomRightSides")return T.BottomRightSides;if(t==="NotTopSide")return T.NotTopSide;if(t==="NotLeftSide")return T.NotLeftSide;if(t==="NotRightSide")return T.NotRightSide;if(t==="NotBottomSide")return T.NotBottomSide;if(t==="AllSides")return T.AllSides;if(t==="Default")return T.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 T(s,o,r,a)}else return new T}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return m.s(t,"number",T,"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(T.None)?"None":this.equals(T.TopLeft)?"TopLeft":this.equals(T.TopCenter)?"Top":this.equals(T.TopRight)?"TopRight":this.equals(T.LeftCenter)?"Left":this.equals(T.Center)?"Center":this.equals(T.RightCenter)?"Right":this.equals(T.BottomLeft)?"BottomLeft":this.equals(T.BottomCenter)?"Bottom":this.equals(T.BottomRight)?"BottomRight":this.equals(T.TopSide)?"TopSide":this.equals(T.LeftSide)?"LeftSide":this.equals(T.RightSide)?"RightSide":this.equals(T.BottomSide)?"BottomSide":this.equals(T.TopBottomSides)?"TopBottomSides":this.equals(T.LeftRightSides)?"LeftRightSides":this.equals(T.TopLeftSides)?"TopLeftSides":this.equals(T.TopRightSides)?"TopRightSides":this.equals(T.BottomLeftSides)?"BottomLeftSides":this.equals(T.BottomRightSides)?"BottomRightSides":this.equals(T.NotTopSide)?"NotTopSide":this.equals(T.NotLeftSide)?"NotLeftSide":this.equals(T.NotRightSide)?"NotRightSide":this.equals(T.NotBottomSide)?"NotBottomSide":this.equals(T.AllSides)?"AllSides":this.equals(T.Default)?"Default":"None"}equals(t){return t instanceof T?(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 T(.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(T.Left))t=T.LeftSide;else if(t.equals(T.Right))t=T.RightSide;else if(t.equals(T.Top))t=T.TopSide;else if(t.equals(T.Bottom))t=T.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 T(0,0,0,0).Ki(0);static Default=new T(0,0,-1,0).Ki(-1);static TopLeft=new T(0,0,0,0).kt();static TopCenter=new T(.5,0,0,0).kt();static TopRight=new T(1,0,0,0).kt();static LeftCenter=new T(0,.5,0,0).kt();static Center=new T(.5,.5,0,0).kt();static RightCenter=new T(1,.5,0,0).kt();static BottomLeft=new T(0,1,0,0).kt();static BottomCenter=new T(.5,1,0,0).kt();static BottomRight=new T(1,1,0,0).kt();static MiddleTop=T.TopCenter;static MiddleLeft=T.LeftCenter;static MiddleRight=T.RightCenter;static MiddleBottom=T.BottomCenter;static Top=T.TopCenter;static Left=T.LeftCenter;static Right=T.RightCenter;static Bottom=T.BottomCenter;static TopSide=new T(0,0,1,1).Ki(1);static LeftSide=new T(0,0,1,2).Ki(1);static RightSide=new T(0,0,1,4).Ki(1);static BottomSide=new T(0,0,1,8).Ki(1);static TopBottomSides=new T(0,0,1,9).Ki(1);static LeftRightSides=new T(0,0,1,6).Ki(1);static TopLeftSides=new T(0,0,1,3).Ki(1);static TopRightSides=new T(0,0,1,5).Ki(1);static BottomLeftSides=new T(0,0,1,10).Ki(1);static BottomRightSides=new T(0,0,1,12).Ki(1);static NotTopSide=new T(0,0,1,14).Ki(1);static NotLeftSide=new T(0,0,1,13).Ki(1);static NotRightSide=new T(0,0,1,11).Ki(1);static NotBottomSide=new T(0,0,1,7).Ki(1);static AllSides=new T(0,0,1,15).Ki(1);static AP=new T(.156,.156).kt();static TP=new T(.844,.844).kt()}class Nt{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 Nt;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}DP(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ue(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}kc(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}zL(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,u=this.m11*n+this.m21*o,c=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=u,this.m22=c,this}Qw(){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}ks(t,e,i){if(t=C.Ee(t),t===0)return this;this.Xs(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.Xs(-e,-i),this}Xs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}et(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}YF(){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.e(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}Ci(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.e(r*i+a*n,r*s+a*o)}Mu(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.e(h*i+l*n+r,h*s+l*o+a)}im(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,u=this.dy,c=e*o+i*a+l,d=e*r+i*h+u,f=s*o+i*a+l,p=s*r+i*h+u,g=e*o+n*a+l,y=e*r+n*h+u,b=s*o+n*a+l,v=s*r+n*h+u,w=c,k=c,S=d,N=d;return w=Math.min(w,f),k=Math.max(k,f),S=Math.min(S,p),N=Math.max(N,p),w=Math.min(w,g),k=Math.max(k,g),S=Math.min(S,y),N=Math.max(N,y),w=Math.min(w,b),k=Math.max(k,b),S=Math.min(S,v),N=Math.max(N,v),t.e(w,S,k-w,N-S),t}static XL=[];static l(){let t=Nt.XL.pop();return t===void 0?new Nt:t}static i(t){Nt.XL.push(t)}static vP="54a702f3e53909c447824c6706603faf4c"}let C={KF:"7da71ca0ad381e90",Kn:4*((Math.sqrt(2)-1)/3),GL:[],_w:x=>{if(x<=0)return 0;let t=C.GL;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);C.GL=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)},c:(x,t)=>{let e=x-t;return e<.5&&e>-.5},X:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},Ve:(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 u=r+s,c=a-s;if(c<=n&&n<=u){let d=h+s,f=l-s;if(f<=o&&o<=d)if(u-c>d-f)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},tx:(x,t,e,i,s,n,o,r,a,h,l,u)=>{if(!C.Ve(x,t,o,r,u,e,i)||!C.Ve(x,t,o,r,u,s,n)){let c=(x+e)/2,d=(t+i)/2,f=(e+s)/2,p=(i+n)/2,g=(s+o)/2,y=(n+r)/2,b=(c+f)/2,v=(d+p)/2,w=(f+g)/2,k=(p+y)/2,S=(b+w)/2,N=(v+k)/2;return C.tx(x,t,c,d,b,v,S,N,a,h,l,u)||C.tx(S,N,w,k,g,y,o,r,a,h,l,u)}else return C.Ve(x,t,o,r,u,h,l)},YL:(x,t,e,i,s,n,o,r,a)=>{let h=(x+e)/2,l=(t+i)/2,u=(e+s)/2,c=(i+n)/2,d=(s+o)/2,f=(n+r)/2,p=(h+u)/2,g=(l+c)/2,y=(u+d)/2,b=(c+f)/2;return a.e((p+y)/2,(g+b)/2),a},HF:(x,t,e,i,s,n,o,r)=>{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(s+o)/2,d=(n+r)/2,f=(a+l)/2,p=(h+u)/2,g=(l+c)/2,y=(u+d)/2;return P.direction(f,p,g,y)},Nu:(x,t,e,i,s,n,o,r,a,h)=>{if(!C.Ve(x,t,o,r,a,e,i)||!C.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,g=(l+c)/2,y=(u+d)/2,b=(c+f)/2,v=(d+p)/2,w=(g+b)/2,k=(y+v)/2;C.Nu(x,t,l,u,g,y,w,k,a,h),C.Nu(w,k,b,v,f,p,o,r,a,h)}else h.re(x,t,0,0),h.re(o,r,0,0);return h},Hn:(x,t,e,i,s,n,o,r,a,h)=>{if(!C.Ve(x,t,o,r,a,e,i)||!C.Ve(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,f=(s+o)/2,p=(n+r)/2,g=(l+c)/2,y=(u+d)/2,b=(c+f)/2,v=(d+p)/2,w=(g+b)/2,k=(y+v)/2;C.Hn(x,t,l,u,g,y,w,k,a,h),C.Hn(w,k,b,v,f,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},FP:(x,t,e,i,s,n,o,r,a,h)=>{if(C.Ve(x,t,s,n,h,e,i))return C.Ve(x,t,s,n,h,r,a);{let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,f=(l+c)/2,p=(u+d)/2;return C.FP(x,t,l,u,f,p,o,r,a,h)||C.FP(f,p,c,d,s,n,o,r,a,h)}},RP:(x,t,e,i,s,n,o,r)=>{if(C.Ve(x,t,s,n,o,e,i))r.re(x,t,0,0),r.re(s,n,0,0);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;C.RP(x,t,a,h,c,d,o,r),C.RP(c,d,l,u,s,n,o,r)}return r},sm:(x,t,e,i,s,n,o,r)=>{if(C.Ve(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,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;C.sm(x,t,a,h,c,d,o,r),C.sm(c,d,l,u,s,n,o,r)}return r},nm:(x,t,e,i,s,n,o,r,a,h,l,u,c,d)=>{if(!C.Ve(x,t,o,r,c,e,i)||!C.Ve(x,t,o,r,c,s,n)){let f=(x+e)/2,p=(t+i)/2,g=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+g)/2,k=(p+y)/2,S=(g+b)/2,N=(y+v)/2,D=(w+S)/2,L=(k+N)/2,M=1/0,A=!1,F=0,O=0;if(C.nm(x,t,f,p,w,k,D,L,a,h,l,u,c,d)){let E=(d.x-a)**2+(d.y-h)**2;E<M&&(M=E,A=!0,F=d.x,O=d.y)}if(C.nm(D,L,S,N,b,v,o,r,a,h,l,u,c,d)){let E=(d.x-a)**2+(d.y-h)**2;E<M&&(M=E,A=!0,F=d.x,O=d.y)}return A&&(d.x=F,d.y=O),A}else{if(!C.Pu(x,t,o,r,a,h,l,u))return!1;let f=(x-o)*(h-u)-(t-r)*(a-l);if(f===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/f,g=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/f;return d.e(p,g),!0}},om:(x,t,e,i,s,n,o,r,a,h,l,u,c)=>{let d=0;if(!C.Ve(x,t,o,r,c,e,i)||!C.Ve(x,t,o,r,c,s,n)){let f=(x+e)/2,p=(t+i)/2,g=(e+s)/2,y=(i+n)/2,b=(s+o)/2,v=(n+r)/2,w=(f+g)/2,k=(p+y)/2,S=(g+b)/2,N=(y+v)/2,D=(w+S)/2,L=(k+N)/2;d+=C.om(x,t,f,p,w,k,D,L,a,h,l,u,c),d+=C.om(D,L,S,N,b,v,o,r,a,h,l,u,c)}else{let f=(x-o)*(h-u)-(t-r)*(a-l);if(f===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/f,g=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/f;if(p>=l)return d;let y=0,b=0;if((a>l?a-l:l-a)<(h>u?h-u:u-h)){if(t<r?(y=t,b=r):(y=r,b=t),g<y||g>b)return d}else if(x<o?(y=x,b=o):(y=o,b=x),p<y||p>b)return d;f>0?d++:f<0&&d--}return d},Nl:(x,t,e,i,s,n,o)=>{if(C.X(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.e(x,r),!1):h>a?(o.e(x,a),!1):(o.e(x,h),!0)}else if(C.X(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.e(r,t),!1):h>a?(o.e(a,t),!1):(o.e(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.e(x,t),!1;if(a>1.000005)return o.e(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.e(h,l),!0}}},Ao:(x,t,e,i,s,n,o,r,a)=>{if(C.c(x,e)&&C.c(t,i))return a.e(x,t),!1;if(C.X(s,o)){if(C.X(x,e))return C.Nl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return C.Nl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(C.X(x,e)){let l=h*(x-s)+n,u=0,c=0;return t<i?(u=t,c=i):(u=i,c=t),l<u?(a.e(x,u),!1):l>c?(a.e(x,c),!1):(a.e(x,l),!0)}else{let l=(i-t)/(e-x);if(C.X(h,l))return C.Nl(x,t,e,i,s,n,a),!1;{let u=(l*x-h*s+n-t)/(l-h);if(C.X(l,0)){let c=0,d=0;return x<e?(c=x,d=e):(c=e,d=x),u<c?(a.e(c,t),!1):u>d?(a.e(d,t),!1):(a.e(u,t),!0)}else{let c=l*(u-x)+t;return C.Nl(x,t,e,i,u,c,a)}}}}},Cl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,u=t;if(C.Ao(x,t,x,i,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}if(C.Ao(e,t,e,i,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}if(C.Ao(x,t,e,t,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}if(C.Ao(x,i,e,i,s,n,o,r,a)){let c=(a.x-s)**2+(a.y-n)**2;c<h&&(h=c,l=a.x,u=a.y)}return a.e(l,u),h<1e21},ex:(x,t,e)=>C.VL(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),VL:(x,t,e,i,s,n,o,r)=>{let a=x,h=x+e,l=t,u=t+i;if(s===o){let c=0,d=0;return n<r?(c=n,d=r):(c=r,d=n),a<=s&&s<=h&&c<=u&&d>=l}if(n===r){let c=0,d=0;return s<o?(c=s,d=o):(c=o,d=s),l<=n&&n<=u&&c<=h&&d>=a}return!!(I.contains(x,t,e,i,s,n)||I.contains(x,t,e,i,o,r)||C.Pu(a,l,h,l,s,n,o,r)||C.Pu(h,l,h,u,s,n,o,r)||C.Pu(h,u,a,u,s,n,o,r)||C.Pu(a,u,a,l,s,n,o,r))},Pu:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:C.ku(x,t,e,i,s,n)*C.ku(x,t,e,i,o,r)<=0&&C.ku(s,n,o,r,x,t)*C.ku(s,n,o,r,e,i)<=0,ku:(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},$w(x,t,e,i){i===void 0&&(i=!1);let s=0,n=x===null?t:(t-x.x)/(x.width>0?x.width:1),o=x===null?e:(e-x.y)/(x.height>0?x.height:1);return n>o?n>1-o||(i||n<1-o?s=270:s=315):i||n<o?n>1-o?s=90:i||n<1-o?s=180:s=135:n<.5?s=225:n>.5&&(s=45),s},Ee:x=>(x>=360?x-=360:x<0&&(x+=360),x),qF:(x,t)=>x>t?Math.min(x-t,Math.abs(x-360-t)):t>x?Math.min(t-x,Math.abs(x-(t-360))):0,KL:(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=[],u=o/2,c=i,d=Math.min(h,Math.abs(s-i));if(d<a){let f=c+r*Math.min(d,u),p=x+e*Math.cos(c),g=t+e*Math.sin(c),y=x+e*Math.cos(f),b=t+e*Math.sin(f),v=(p+y)/2,w=(g+b)/2;return l.push([p,g,v,w,v,w,y,b]),l}for(;d>a;){let f=c+r*Math.min(d,u);l.push(C.jF(e,c,f,x,t)),d-=Math.abs(f-c),c=f}return l},jF:(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,u=l+a*o+h*r,c=4/3*(Math.sqrt(2*l*u)-u)/(a*r-h*o),d=a-c*h,f=h+c*a,p=d,g=-f,y=n+t,b=Math.cos(y),v=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*b-f*v,s+d*v+f*b,i+p*b-g*v,s+p*v+g*b,i+x*Math.cos(e),s+x*Math.sin(e)]},_g:(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,u=h;h+r-x<r/2&&(u=h+r);let c=l;return l+a-t<a/2&&(c=l+a),o.e(u,c),o},HL:(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},WF:(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,u=0,c=0;return o=r,h=o===0?x:t,u=o===0?e:i,(o===0?s:n)&&(u=-u),o=a,l=o===0?x:t,c=o===0?e:i,(o===0?s:n)&&(c=-c),C.JF(h,l,u,c,0,0)},JF:(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,u=-a+l,c=-a+Math.sqrt(h*h+l*l),d=u,f=9999999999;for(let y=0;y<f&&(d=.5*(u+c),!(d===u||d===c));++y){let b=h/(d+r),v=l/(d+a),w=b*b+v*v-1;if(w>0)u=d;else if(w<0)c=d;else break}s=r*e/(d+r),n=a*i/(d+a);let p=s-e,g=n-i;o=Math.sqrt(p*p+g*g)}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 u=s-e;o=Math.sqrt(u*u+n*n)}else s=x,n=0,o=Math.abs(e-x)}return o},qn:{},rm:new yt,dr:new yt,gr:0,lm:100};C.za=C.KF;var ze=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ze||{}),Ri=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(Ri||{});class wt{n;am;hm;Pc;Cu;Lu;jn;Wn;Jn;W;Li;Ai;ni;oi;Gs;Sc;Mc;constructor(t,e){V.Je(this),this.n=2,t===void 0&&(t=4),this.W=t,this.Li=0,this.Ai=0,this.ni=0,this.oi=0,t===4?this.Gs=new q:this.Gs=wt.ix,this.am=this.Gs.rt,this.hm=new I,this.Pc=null,this.Cu=null,this.Lu=NaN,this.jn=T.TopLeft,this.Wn=T.BottomRight,this.Sc=NaN,this.Mc=NaN,this.Jn=2,e&&Object.assign(this,e)}copy(){let t=new wt;if(t.n=this.n&-2,t.W=this.W,t.Li=this.Li,t.Ai=this.Ai,t.ni=this.ni,t.oi=this.oi,this.W===4){let e=this.Gs.r,i=t.Gs;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Gs=i}else t.Gs=this.Gs;return t.am=this.am,t.hm.h(this.hm),t.Pc=this.Pc,t.Cu=this.Cu,t.Lu=this.Lu,t.jn=this.jn.N(),t.Wn=this.Wn.N(),t.Sc=this.Sc,t.Mc=this.Mc,t.Jn=this.Jn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static ix=new q().k();get u(){return(this.n&1)!==0}set u(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}k(){if(this.u=!0,this.type!==4)return this;let t=this.figures;t.k();for(let e of t)e.k();return this}equalsApprox(t){if(!(t instanceof wt))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.qL(t):t.type===1&&this.type===4?t.qL(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 C.c(this.startX,t.startX)&&C.c(this.startY,t.startY)&&C.c(this.endX,t.endX)&&C.c(this.endY,t.endY)}qL(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&&C.c(this.startX,e.startX)&&C.c(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&C.c(this.endX,i.endX)&&C.c(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return m.s(t,"number",wt,"stringifyFixed:digits"),e=>e.toString(t)}fe(t){t in ze?this.type=t:m.cr(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 I(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 I(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 ze[this.type]}}static fillPath(t){typeof t!="string"&&m.si(t,"string",wt,"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 cm="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&m.si(t,"string",wt,"parse:str");let i=new RegExp("(["+wt.cm+"])(["+wt.cm+"])","gm"),s=new RegExp("(["+wt.cm+"])([^s])","gm"),n=new RegExp("([^s])(["+wt.cm+"])","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 F=0;F<o.length;F++){let O=o[F];if(O.match(/(\.[0-9]*)(\.)/gm)!==null){let E=m.st(),B="",X=!1;for(let z=0;z<O.length;z++){let U=O[z];U==="."&&!X?(X=!0,B+=U):U==="."?(E.push(B),B="."):B+=U}E.push(B),o.splice(F,1);for(let z=0;z<E.length;z++)o.splice(F+z,0,E[z]);F+=E.length-1,m.Z(E)}}let r=-1,a="",h="",l=new P(0,0),u=new P(0,0),c=new P(0,0),d=!0;function f(){return r>=w-1||o[r+1].match(M)!==null?!0:(d=!1,!1)}function p(){return r++,o[r]}function g(F){let O=parseFloat(p()),E=parseFloat(p());a===a.toLowerCase()&&(O=c.x+O,E=c.y+E),F.e(O,E)}function y(){return g(c),c}function b(){return g(u),u}function v(){let F=h.toLowerCase();return F==="c"||F==="s"||F==="q"||F==="t"?new P(2*c.x-u.x,2*c.y-u.y):new P(c.x,c.y)}let w=o.length,k=Ce.jL(null),S=!1,N=!1,D=!1,L=!0,M=new RegExp("["+wt.cm+"]");for(;!(r>=w-1);){if(h=a,a=p(),a==="")continue;d=!0;let F=!1;switch(a.toUpperCase()){case"X":L=!0,S=!1,N=!1;break;case"M":let O=y();for(k.Ne===null||L===!0?(k.Au(O.x,O.y,S,!1,!N,D),L=!1):k.$F(O.x,O.y),l.h(c);!f();){let E=y();k.Ys(E.x,E.y)}break;case"L":for(;!f();){let E=y();k.Ys(E.x,E.y)}d&&(F=!0);break;case"H":for(;!f();)c.e((a===a.toLowerCase()?c.x:0)+parseFloat(p()),c.y),k.Ys(c.x,c.y);break;case"V":for(;!f();)c.e(c.x,(a===a.toLowerCase()?c.y:0)+parseFloat(p())),k.Ys(c.x,c.y);d&&(F=!0);break;case"C":for(;!f();){let E=new P;g(E);let B=b(),X=y();k.pr(E.x,E.y,B.x,B.y,X.x,X.y)}d&&(F=!0);break;case"S":for(;!f();){let E=v(),B=b(),X=y();k.pr(E.x,E.y,B.x,B.y,X.x,X.y)}d&&(F=!0);break;case"Q":for(;!f();){let E=b(),B=y();k.Tu(E.x,E.y,B.x,B.y)}d&&(F=!0);break;case"T":for(;!f();){let E=v();u.h(E);let B=y();k.Tu(E.x,E.y,B.x,B.y),u.h(B)}d&&(F=!0);break;case"B":for(;!f();){let E=parseFloat(p()),B=parseFloat(p()),X=parseFloat(p()),z=parseFloat(p()),U=parseFloat(p()),tt=U,nt=!1;f()||(tt=parseFloat(p()),f()||(nt=parseFloat(p())!==0)),a===a.toLowerCase()&&(X+=c.x,z+=c.y),k.ZF(E,B,X,z,U,tt,nt)}d&&(F=!0);break;case"A":for(;!f();){let E=Math.abs(parseFloat(p())),B=Math.abs(parseFloat(p())),X=parseFloat(p()),z=!1,U=!1,tt=0,nt=0,Z=p();Z.length===1?(z=!!parseFloat(Z),U=!!parseFloat(p()),tt=parseFloat(p()),nt=parseFloat(p())):Z.length===2?(z=!!parseFloat(Z[0]),U=!!parseFloat(Z[1]),tt=parseFloat(p()),nt=parseFloat(p())):(z=!!parseFloat(Z[0]),U=!!parseFloat(Z[1]),tt=parseFloat(Z.slice(2)),nt=parseFloat(p())),a===a.toLowerCase()&&(tt=c.x+tt,nt=c.y+nt),c.e(tt,nt),k.QF(E,B,X,z,U,tt,nt)}d&&(F=!0);break;case"Z":k._F(),c.h(l);break;case"F":{let E="",B=1;for(;o[r+B];){if(o[r+B]==="0"){D=!0,B++;continue}if(o[r+B].match(/[Uu]/)!==null){B++;continue}if(o[r+B].match(M)===null){B++;continue}E=o[r+B];break}E.match(/[Mm]/)?S=!0:k.tR();break}case"U":{let E="",B=1;for(;o[r+B];){if(o[r+B].match(/[Ff]/)!==null){B++;continue}if(o[r+B].match(M)===null){B++;continue}E=o[r+B];break}E.match(/[Mm]/)?N=!0:k.eR(!1);break}default:if(a==="0"||a==="1")break;m.ne("Unknown geometry command: "+a);break}if(F){m.ne(`Bad geometry command: ${a}, next token: ${p()},
|
|
3
3
|
string: ${t}`);break}}let A=k.fm;if(Ce.WL(k),e){let F=A.figures.iterator;for(;F.next();){let O=F.value;O.isFilled=!0}}return A}static JL(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.i(s)}OP(){if(this.yt)return!0;if(this.type===4){let t=this.figures;if(this.am!==t.rt)return!0;let e=this.figures.r,i=e.length;for(let s=0;s<i;s++)if(e[s].OP())return!0}return!1}nx(){if(this.yt=!1,this.Pc=null,this.Cu=null,this.Lu=NaN,this.type===4){let e=this.figures;this.am=e.rt;let i=this.figures.r,s=i.length;for(let n=0;n<s;n++)i[n].iR()}let t=this.hm;isNaN(this.Sc)||isNaN(this.Mc)?t.e(0,0,0,0):t.e(0,0,this.Sc,this.Mc),this.$L(t,!1),t.re(0,0,0,0)}computeBoundsWithoutOrigin(){let t=new I;return this.$L(t,!0),t}$L(t,e){switch(this.type){case 1:case 2:case 3:e?t.e(this.Li,this.Ai,0,0):t.re(this.Li,this.Ai,0,0),t.re(this.ni,this.oi,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.e(r.startX,r.startY,0,0):t.re(r.startX,r.startY,0,0);let a=r.segments.r,h=a.length,l=r.startX,u=r.startY;for(let c=0;c<h;c++){let d=a[c];switch(d.type){case 2:case 1:l=d.endX,u=d.endY,t.re(l,u,0,0);break;case 3:C.Nu(l,u,d.point1X,d.point1Y,d.point2X,d.point2Y,d.endX,d.endY,.5,t),l=d.endX,u=d.endY;break;case 4:C.RP(l,u,d.point1X,d.point1Y,d.endX,d.endY,.5,t),l=d.endX,u=d.endY;break;case 5:case 6:let f=d.type===5?d.To(r):d.Za(r,l,u),p=f.length;if(p===0){l=d.type===5?d.centerX:d.endX,u=d.type===5?d.centerY:d.endY,t.re(l,u,0,0);break}let g=null;for(let y=0;y<p;y++)g=f[y],C.Nu(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],.5,t);g!==null&&(l=g[6],u=g[7]);break;default:m.o("Unknown Segment type: "+d.type)}}}break;default:m.o("Unknown Geometry type: "+this.type)}}sR(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.u&&m.L(this);let t=this.computeBoundsWithoutOrigin();return this.offset(-t.x,-t.y),new P(-t.x,-t.y)}offset(t,e){return this.u&&m.L(this),this.v(1,0,0,1,t,e),this}scale(t,e){return this.u&&m.L(this),this.v(t,0,0,e,0,0),this}rotate(t,e,i){this.u&&m.L(this),e===void 0&&(e=0),i===void 0&&(i=0);let s=Nt.l();return s.Ue(),s.ks(t,e,i),this.v(s.m11,s.m12,s.m21,s.m22,s.dx,s.dy),Nt.i(s),this}v(t,e,i,s,n,o){let r=0,a=0;switch(this.type){case 1:case 2:case 3:r=this.Li,a=this.Ai,this.Li=r*t+a*i+n,this.Ai=r*e+a*s+o,r=this.ni,a=this.oi,this.ni=r*t+a*i+n,this.oi=r*e+a*s+o;break;case 4:let h=this.figures.r,l=h.length;for(let u=0;u<l;u++){let c=h[u];r=c.startX,a=c.startY,c.startX=r*t+a*i+n,c.startY=r*e+a*s+o;let d=c.segments.r,f=d.length;for(let p=0;p<f;p++){let g=d[p];switch(g.type){case 2:case 1:r=g.endX,a=g.endY,g.endX=r*t+a*i+n,g.endY=r*e+a*s+o;break;case 3:r=g.point1X,a=g.point1Y,g.point1X=r*t+a*i+n,g.point1Y=r*e+a*s+o,r=g.point2X,a=g.point2Y,g.point2X=r*t+a*i+n,g.point2Y=r*e+a*s+o,r=g.endX,a=g.endY,g.endX=r*t+a*i+n,g.endY=r*e+a*s+o;break;case 4:r=g.point1X,a=g.point1Y,g.point1X=r*t+a*i+n,g.point1Y=r*e+a*s+o,r=g.endX,a=g.endY,g.endX=r*t+a*i+n,g.endY=r*e+a*s+o;break;case 5:if(r=g.centerX,a=g.centerY,g.centerX=r*t+a*i+n,g.centerY=r*e+a*s+o,e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),g.startAngle+=y}t<0&&(g.startAngle=180-g.startAngle,g.sweepAngle=-g.sweepAngle),s<0&&(g.startAngle=-g.startAngle,g.sweepAngle=-g.sweepAngle),g.radiusX*=Math.sqrt(t*t+i*i),g.radiusY!==void 0&&(g.radiusY*=Math.sqrt(e*e+s*s));break;case 6:if(r=g.endX,a=g.endY,g.endX=r*t+a*i+n,g.endY=r*e+a*s+o,g.radiusX===0||g.radiusY===0)break;if(e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),g.xAxisRotation+=y}t<0&&(g.xAxisRotation=180-g.xAxisRotation,g.isClockwiseArc=!g.isClockwiseArc),s<0&&(g.xAxisRotation=-g.xAxisRotation,g.isClockwiseArc=!g.isClockwiseArc),g.radiusX*=Math.sqrt(t*t+i*i),g.radiusY*=Math.sqrt(e*e+s*s);break;default:m.o("Unknown Segment type: "+g.type)}}}break}return this.yt=!0,this}containsPoint(t,e){e===void 0&&(e=0);let i=this.Li,s=this.Ai,n=this.ni,o=this.oi;switch(this.type){case 1:return C.Ve(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,u=I.z(r,a,h,l),c=u.containsPoint(t);return I.i(u),c}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,u=h/2,c=l/2;return u<=0||c<=0?!1:(r=t.x-(r+u),a=t.y-(a+c),r*r/(u*u)+a*a/(c*c)<=1)}case 4:return this.IP(t,e,!0,!1);default:return!1}}IP(t,e,i,s){let n=t.x,o=t.y,r=this.bounds.x-20,a=o,h=0,l=0,u=0,c=0,d=0,f=0,p=this.figures.r,g=p.length;for(let y=0;y<g;y++){let b=p[y],v=!b.isEvenOdd;if(b.isFilled){if(i&&b.EP(n,o,e))return!0}else{if(b.EP(n,o,s?e:e+2))return!0;continue}let w=b.segments;l=b.startX,u=b.startY;let k=l,S=u,N=w.r,D=N[0];for(let L=0;L<=w.length;L++){let M;switch(L!==w.length?(D=N[L],M=D.type,d=D.endX,f=D.endY):(M=2,d=k,f=S),M){case 1:{let A=this.lx(n,o,r,a,l,u,k,S);if(isNaN(A))return!0;h+=A,k=d,S=f;break}case 2:{let A=this.lx(n,o,r,a,l,u,d,f);if(isNaN(A))return!0;h+=A;break}case 3:c=C.om(l,u,D.point1X,D.point1Y,D.point2X,D.point2Y,d,f,r,a,n,o,.5),h+=c;break;case 4:{let A=(l+2*D.point1X)/3,F=(u+2*D.point1Y)/3,O=(D.point1X*2+d)/3,E=(D.point1Y*2+f)/3;c=C.om(l,u,A,F,O,E,d,f,r,a,n,o,.5),h+=c;break}case 5:case 6:{let A=D.type===5?D.To(b):D.Za(b,l,u),F=A.length;if(F===0){let E=this.lx(n,o,r,a,l,u,D.type===5?D.centerX:D.endX,D.type===5?D.centerY:D.endY);if(isNaN(E))return!0;h+=E;break}let O=null;for(let E=0;E<F;E++){if(O=A[E],E===0){let B=this.lx(n,o,r,a,l,u,O[0],O[1]);if(isNaN(B))return!0;h+=B}c=C.om(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],r,a,n,o,.5),h+=c}O!==null&&(d=O[6],f=O[7]);break}default:m.o("Unknown Segment type: "+D.type)}l=d,u=f}if(v){if(h!==0)return!0}else if(h%2!==0)return!0;h=0}return!1}lx(t,e,i,s,n,o,r,a){if(C.Ve(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,u=(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(u<o||u>a)return 0}else if(u<a||u>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}ZL(t,e,i){let s=this.figures.r,n=s.length;for(let o=0;o<n;o++)if(s[o].EP(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.e(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],u=l.length;for(let c=0;c<u;c++){let d=l[c];if(a+d>=r){let f=r-a,p=d===0?0:f/d,g=i[h],y=g[c*2],b=g[c*2+1],v=g[c*2+2],w=g[c*2+3];return e.e(y+(v-y)*p,b+(w-b)*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 u=0;u<l;u++){let c=h[u];if(r+c>=o){let d=e[a],f=d[u*2],p=d[u*2+1],g=d[u*2+2],y=d[u*2+3];return Math.abs(g-f)<1&&Math.abs(y-p)<1?0:Math.abs(g-f)<1?y-p>=0?90:270:Math.abs(y-p)<1?g-f>=0?0:180:Math.atan2(y-p,g-f)*180/Math.PI}r+=c}}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],u=l.length;for(let c=0;c<u;c++){let d=l[c];if(a+d>=r){let f=r-a,p=d===0?0:f/d,g=i[h],y=g[c*2],b=g[c*2+1],v=g[c*2+2],w=g[c*2+3];e[0]=y+(v-y)*p,e[1]=b+(w-b)*p;let k;return Math.abs(v-y)<1&&Math.abs(w-b)<1?k=0:Math.abs(v-y)<1?k=w-b>=0?90:270:Math.abs(w-b)<1?k=v-y>=0?0:180:k=Math.atan2(w-b,v-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,u=P.l();C.Nl(e,i,s,n,o,r,u);let c=u.x,d=u.y;return P.i(u),Math.sqrt(((c-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 u=Math.abs(h-e),c=Math.abs(h-s),d=Math.abs(l-i),f=Math.abs(l-n),p=Math.min(u,c,d,f);if(p===d)return h/a;if(p===c)return(o+l)/a;if(p===f)return(o*2+r-h)/a;if(p===u)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,u=0;for(let d=0;d<h;d++){let f=e[d],p=i[d],g=f.length;for(let y=0;y<g;y+=2){let b=f[y],v=f[y+1];if(y===0){l=b,u=v;continue}C.Nl(l,u,b,v,t.x,t.y,n);let w=(n.x-t.x)**2+(n.y-t.y)**2;w<o&&(o=w,r=a,r+=Math.sqrt((n.x-l)**2+(n.y-u)**2)),a+=p[(y-2)/2],l=b,u=v}}P.i(n);let c=r/s;return c<0?0:c>1?1:c}return 0}get flattenedSegments(){return this.QL(),this.Pc}QL(){if(this.Pc===null){let t=this.Pc=[],e=this.Cu=[];this.nR(t,e)}}get flattenedLengths(){return this.QL(),this.Cu}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}UP(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}nR(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 zt;n.startX=this.endX,n.startY=(this.startY+this.endY)/2;let o=new mt(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.To(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 u=0;u<a;u++){let c=r[u];C.Hn(h,l,c[2],c[3],c[4],c[5],c[6],c[7],.5,i),h=c[6],l=c[7]}}t.push(i),e.push(this.UP(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,u=o.segments.r,c=u.length;for(let d=0;d<c;d++){let f=u[d];switch(f.type){case 1:i.length>=4&&(t.push(i),e.push(this.UP(i))),i=[],i.push(f.endX),i.push(f.endY),r=f.endX,a=f.endY,h=r,l=a;break;case 2:i.push(f.endX),i.push(f.endY),r=f.endX,a=f.endY;break;case 3:C.Hn(r,a,f.point1X,f.point1Y,f.point2X,f.point2Y,f.endX,f.endY,.5,i),r=f.endX,a=f.endY;break;case 4:C.sm(r,a,f.point1X,f.point1Y,f.endX,f.endY,.5,i),r=f.endX,a=f.endY;break;case 5:{let p=f.To(o),g=p.length;if(g===0){i.push(f.centerX),i.push(f.centerY),r=f.centerX,a=f.centerY;break}for(let y=0;y<g;y++){let b=p[y];C.Hn(r,a,b[2],b[3],b[4],b[5],b[6],b[7],.5,i),r=b[6],a=b[7]}break}case 6:{let p=f.Za(o,r,a),g=p.length,y=f.endX,b=f.endY;if(g===0){i.push(y),i.push(b),r=y,a=b;break}for(let v=0;v<g;v++){let w=p[v];C.Hn(r,a,w[2],w[3],w[4],w[5],w[6],w[7],.5,i),r=w[6],a=w[7]}break}default:m.o("Segment not of valid type: "+f.type)}f.isClosed&&(i.push(h),i.push(l))}i.length>=4&&(t.push(i),e.push(this.UP(i)))}}}get type(){return this.W}set type(t){this.W!==t&&(this.u&&m.L(this,t),this.W=t,t===4?this.Gs=new q:(wt.ix===null&&(wt.ix=new q().k()),this.Gs=wt.ix),this.yt=!0)}get startX(){return this.Li}set startX(t){this.Li!==t&&(this.u&&m.L(this,t),this.Li=t,this.yt=!0)}get startY(){return this.Ai}set startY(t){this.Ai!==t&&(this.u&&m.L(this,t),this.Ai=t,this.yt=!0)}get endX(){return this.ni}set endX(t){this.ni!==t&&(this.u&&m.L(this,t),this.ni=t,this.yt=!0)}get endY(){return this.oi}set endY(t){this.oi!==t&&(this.u&&m.L(this,t),this.oi=t,this.yt=!0)}get figures(){return this.Gs}set figures(t){this.Gs!==t&&(this.u&&m.L(this,t),this.Gs=t,this.yt=!0)}add(t){return this.Gs.add(t),this}setSpots(t,e,i,s,n,o,r,a){return this.u&&m.L(this),this.jn=new T(t,e,n,o),this.Wn=new T(i,s,r,a),this}get spot1(){return this.jn}set spot1(t){this.u&&m.L(this,t),this.jn=t.N()}get spot2(){return this.Wn}set spot2(t){this.u&&m.L(this,t),this.Wn=t.N()}get defaultStretch(){return this.Jn}set defaultStretch(t){this.Jn=t}get bounds(){return this.OP()&&this.nx(),this.hm}polygonClosestSegment(t,e){if(e===void 0&&(e=10),this.type!==4)return null;let i=t.x,s=t.y,n=1/0,o=0,r=0,a=0,h=0,l=0,u=0,c=0,d=0;return this.figures.each(f=>{let p=f.startX,g=f.startY;f.segments.each(y=>{let b=y.endX,v=y.endY,w=0;if(y.type===2)w=P.distanceLineSegmentSquared(i,s,p,g,b,v);else{p=y.endX,g=y.endY;return}w<n&&(n=w,o=a,r=h,l=p,u=g,c=b,d=v),p=b,g=v,h++,y.isClosed&&(b=f.startX,v=f.startY,w=P.distanceLineSegmentSquared(i,s,p,g,b,v),w<n&&(n=w,o=a,r=h,l=p,u=g,c=b,d=v),h++)}),a++,h=0}),n<e*e?{figi:o,segi:r,ax:l,ay:u,bx:c,by:d}:null}get polygonArea(){if(this.type===4){let t=this.figures.iterator,e=0,i=0,s=0,n=0,o=0;for(;t.next();){let r=t.value;if(!r.isFilled)continue;e=r.startX,i=r.startY;let a=r.segments.iterator;for(;a.next();){let h=a.value;s=h.endX,n=h.endY,h.type===1||h.type!==5&&(o+=e*n-i*s),e=s,i=n}o+=e*r.startY-i*r.startX}return Math.abs(o)/2}else if(this.type===2){let t=Math.abs(this.startX-this.endX),e=Math.abs(this.startY-this.endY);return t*e}else if(this.type===3){let t=Math.abs(this.startX-this.endX),e=Math.abs(this.startY-this.endY);return Math.PI*t/2*e/2}else return 0}get polygonLength(){if(this.type===4){let t=this.figures.iterator,e=0,i=0,s=0,n=0,o=0;for(;t.next();){let r=t.value;e=r.startX,i=r.startY;let a=r.segments.iterator;for(;a.next();){let l=a.value;s=l.endX,n=l.endY,l.type===1||l.type!==5&&(o+=Math.sqrt((s-e)*(s-e)+(n-i)*(n-i))),e=s,i=n}let h=r.segments.last();h&&h.isClosed&&(s=r.startX,n=r.startY,o+=Math.sqrt((s-e)*(s-e)+(n-i)*(n-i)))}return o}else if(this.type===2){let t=Math.abs(this.startX-this.endX),e=Math.abs(this.startY-this.endY);return t*2+e*2}else if(this.type===3){let t=Math.abs(this.startX-this.endX)/2,e=Math.abs(this.startY-this.endY)/2;if(t+e===0)return 0;let i=(t-e)*(t-e)/((t+e)*(t+e)),s=i,n=1+s/4;return s*=i,n+=s/64,s*=i,n+=s/256,s*=i,n+=s*25/16384,s*=i,n+=s*49/65536,s*=i,n+=s*441/1048576,Math.PI*(t+e)*n}else{let t=this.startX,e=this.startY,i=this.endX,s=this.endY;return Math.sqrt((i-t)*(i-t)+(s-e)*(s-e))}}static computeConvexHull(t){t.sort((s,n)=>s.x===n.x?n.y-s.y:n.x-s.x);let e=[];for(let s=0;s<t.length;s++){for(;e.length>=2&&t[s].compareWithLineSegmentPoint(e[e.length-2],e[e.length-1])>=0;)e.pop();e.push(t[s])}e.pop();let i=[];for(let s=t.length-1;s>=0;s--){for(;i.length>=2&&t[s].compareWithLineSegmentPoint(i[i.length-2],i[i.length-1])>=0;)i.pop();i.push(t[s])}return i.pop(),e.concat(i)}static generatePolygon(t,e,i){e===void 0&&(e=0),i===void 0&&(i=!0);let s=new wt;if(t.length>1)if(e>0)if(i){t.push(t[0]),t.push(t[1]);let n=!0,o=new zt(0,0,i,!1);for(let a=1;a<t.length;a++){let h=(t[a-1].x+t[a].x)/2,l=(t[a-1].y+t[a].y)/2,u=t[a-1].distanceSquaredPoint(t[a]),c=.5*e/Math.sqrt(u);if(c<.5){let d=t[a-1].x+(t[a].x-t[a-1].x)*c,f=t[a-1].y+(t[a].y-t[a-1].y)*c;if(n?(n=!1,o.startX=d,o.startY=f):o.add(new mt(3,d,f,t[a-1].x,t[a-1].y,t[a-1].x,t[a-1].y)),a<t.length-1){let p=t[a].x+(t[a-1].x-t[a].x)*c,g=t[a].y+(t[a-1].y-t[a].y)*c;o.add(new mt(2,p,g))}}else n?(n=!1,o.startX=h,o.startY=l):o.add(new mt(3,h,l,t[a-1].x,t[a-1].y,t[a-1].x,t[a-1].y))}let r=o.segments.last();r&&r.close(),s.add(o)}else{let n=new zt(t[0].x,t[0].y,!1,!1);for(let o=1;o<t.length;o++){let r=(t[o-1].x+t[o].x)/2,a=(t[o-1].y+t[o].y)/2,h=t[o-1].distanceSquaredPoint(t[o]),l=.5*e/Math.sqrt(h);if(l<.5){if(o>1){let d=t[o-1].x+(t[o].x-t[o-1].x)*l,f=t[o-1].y+(t[o].y-t[o-1].y)*l;n.add(new mt(3,d,f,t[o-1].x,t[o-1].y,t[o-1].x,t[o-1].y))}let u=t[o].x+(t[o-1].x-t[o].x)*l,c=t[o].y+(t[o-1].y-t[o].y)*l;n.add(new mt(2,u,c))}else o>1&&n.add(new mt(3,r,a,t[o-1].x,t[o-1].y,t[o-1].x,t[o-1].y));o===t.length-1&&n.add(new mt(2,t[o].x,t[o].y))}s.add(n)}else{let n=new zt(t[0].x,t[0].y,i,!1);for(let o=1;o<t.length;o++)n.add(new mt(2,t[o].x,t[o].y));if(i){let o=n.segments.last();o&&o.close()}s.add(n)}return s}}wt.stringify=wt.stringify,wt.stringifyFixed=wt.stringifyFixed,wt.fillPath=wt.fillPath,wt.parse=wt.parse;class zt{n;Li;Ai;Nc;um;Hi;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.Li=t:this.Li=0,e!==void 0?this.Ai=e:this.Ai=0,this.Nc=new q,this.um=this.Nc.rt,this.Hi=null}copy(){let t=new zt;t.n=this.n&-2,t.Li=this.Li,t.Ai=this.Ai;let e=this.Nc.r,i=e.length,s=t.Nc;for(let n=0;n<i;n++){let o=e[n].copy();s.add(o)}return t.um=this.um,t.Hi=this.Hi,t}equalsApprox(t){if(!(t instanceof zt)||!C.c(this.startX,t.startX)||!C.c(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 u(){return(this.n&1)!==0}set u(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}k(){this.u=!0;let t=this.segments;t.k();let e=t.r,i=t.length;for(let s=0;s<i;s++)e[s].k();return this}OP(){if(this.yt)return!0;let t=this.segments;if(this.um!==t.rt)return!0;for(let e of t)if(e.yt)return!0;return!1}iR(){this.yt=!1,this.Hi=null;let t=this.segments;this.um=t.rt;for(let e of t)e.yt=!1,e.Ks=null}get isFilled(){return(this.n&4)!==0}set isFilled(t){this.u&&m.L(this,t),t?this.n|=4:this.n&=-5}get isShadowed(){return(this.n&8)!==0}set isShadowed(t){this.u&&m.L(this,t),t?this.n|=8:this.n&=-9}get isEvenOdd(){return(this.n&16)!==0}set isEvenOdd(t){this.u&&m.L(this,t),t?this.n|=16:this.n&=-17}get startX(){return this.Li}set startX(t){this.u&&m.L(this,t),this.Li=t,this.Hi=null,this.yt=!0}get startY(){return this.Ai}set startY(t){this.u&&m.L(this,t),this.Ai=t,this.Hi=null,this.yt=!0}get segments(){return this.Nc}set segments(t){this.u&&m.L(this,t),this.Nc=t,this.Hi=null,this.yt=!0}add(t){return this.Nc.add(t),this.Hi=null,this}EP(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 u=0;u<l;u++){let c=h[u];switch(c.type){case 1:r=c.endX,a=c.endY,n=c.endX,o=c.endY;break;case 2:if(C.Ve(n,o,c.endX,c.endY,i,t,e))return!0;n=c.endX,o=c.endY;break;case 3:if(C.tx(n,o,c.point1X,c.point1Y,c.point2X,c.point2Y,c.endX,c.endY,.5,t,e,i))return!0;n=c.endX,o=c.endY;break;case 4:if(C.FP(n,o,c.point1X,c.point1Y,c.endX,c.endY,.5,t,e,i))return!0;n=c.endX,o=c.endY;break;case 5:case 6:let d=c.type===5?c.To(s):c.Za(s,n,o),f=d.length,p=c.type===5?c.centerX:c.endX,g=c.type===5?c.centerY:c.endY;if(f===0){if(C.Ve(n,o,p,g,i,t,e))return!0;n=p,o=g;break}let y=null;for(let b=0;b<f;b++)if(y=d[b],b===0&&C.Ve(n,o,y[0],y[1],i,t,e)||C.tx(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:m.o("Unknown Segment type: "+c.type)}if(c.isClosed&&(n!==r||o!==a)&&C.Ve(n,o,r,a,i,t,e))return!0}return!1}}var ni=(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))(ni||{});class mt{W;n;ni;oi;mn;Ll;Al;yr;Ks;constructor(t,e,i,s,n,o,r,a){if(V.Je(this),t===void 0&&(t=2),this.W=t,this.n=2,e!==void 0?this.ni=e:this.ni=0,i!==void 0?this.oi=i:this.oi=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.mn=h,this.Ll=0,this.Al=Math.max(s,0),this.yr=Math.max(n,0),typeof r=="boolean"?r&&(this.isLargeArc=!0):typeof r=="number"&&r&&(this.isLargeArc=!0),a&&(this.isClockwiseArc=!0)}else this.mn=s,this.Ll=n,t===5&&(o=Math.max(o,0)),this.Al=o,typeof r=="number"?(t===5&&(r=Math.max(r,0)),this.yr=r):this.yr=0;this.Ks=null}copy(){let t=new mt;return t.W=this.W,t.n=this.n&-2,t.ni=this.ni,t.oi=this.oi,t.mn=this.mn,t.Ll=this.Ll,t.Al=this.Al,t.yr=this.yr,t}equalsApprox(t){if(!(t instanceof mt)||this.type!==t.type||this.isClosed!==t.isClosed)return!1;switch(this.type){case 1:case 2:return C.c(this.endX,t.endX)&&C.c(this.endY,t.endY);case 3:return C.c(this.endX,t.endX)&&C.c(this.endY,t.endY)&&C.c(this.point1X,t.point1X)&&C.c(this.point1Y,t.point1Y)&&C.c(this.point2X,t.point2X)&&C.c(this.point2Y,t.point2Y);case 4:return C.c(this.endX,t.endX)&&C.c(this.endY,t.endY)&&C.c(this.point1X,t.point1X)&&C.c(this.point1Y,t.point1Y);case 5:return C.c(this.startAngle,t.startAngle)&&C.c(this.sweepAngle,t.sweepAngle)&&C.c(this.centerX,t.centerX)&&C.c(this.centerY,t.centerY)&&C.c(this.radiusX,t.radiusX)&&C.c(this.radiusY,t.radiusY);case 6:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&C.c(this.xAxisRotation,t.xAxisRotation)&&C.c(this.endX,t.endX)&&C.c(this.endY,t.endY)&&C.c(this.radiusX,t.radiusX)&&C.c(this.radiusY,t.radiusY);default:return!1}}fe(t){t in ni?this.type=t:m.cr(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=ni[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 u(){return(this.n&1)!==0}set u(t){t?this.n|=1:this.n&=-2}get yt(){return(this.n&2)!==0}set yt(t){t?this.n|=2:this.n&=-3}k(){return this.u=!0,this}close(){return this.isClosed=!0,this}To(t){if(this.Ks!==null&&t.yt===!1)return this.Ks;let e=this.radiusX,i=this.radiusY;if(i===void 0&&(i=e),e===0||i===0)return this.Ks=[],this.Ks;let s=this.mn,n=this.Ll,o=C.KL(0,0,e<i?e:i,this.startAngle,this.startAngle+this.sweepAngle,!1);if(e!==i){let a=Nt.l();a.Ue(),e<i?a.et(1,i/e):a.et(e/i,1),wt.JL(o,a),Nt.i(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.Ks=o,this.Ks}Za(t,e,i){if(this.Ks!==null&&t.yt===!1)return this.Ks;if(this.radiusX===0||this.radiusY===0)return this.Ks=[],this.Ks;let s=e,n=i,o=this.Al,r=this.yr;o===0&&(o=1e-4),r===0&&(r=1e-4);let a=this.mn*(Math.PI/180),h=this.isLargeArc,l=this.isClockwiseArc,u=this.ni,c=this.oi,d=Math.cos(a),f=Math.sin(a),p=d*(s-u)/2+f*(n-c)/2,g=-f*(s-u)/2+d*(n-c)/2,y=p*p/(o*o)+g*g/(r*r);y>1&&(o*=Math.sqrt(y),r*=Math.sqrt(y));let b=(h===l?-1:1)*Math.sqrt((o*o*r*r-o*o*g*g-r*r*p*p)/(o*o*g*g+r*r*p*p));isNaN(b)&&(b=0);let v=b*o*g/r,w=b*-r*p/o;isNaN(v)&&(v=0),isNaN(w)&&(w=0);let k=(s+u)/2+d*v-f*w,S=(n+c)/2+f*v+d*w,N=(it,_)=>Math.sqrt(it*it+_*_),D=(it,_,at,ct)=>(it*at+_*ct)/(N(it,_)*N(at,ct)),L=(it,_,at,ct)=>(it*ct<_*at?-1:1)*Math.acos(D(it,_,at,ct)),M=L(1,0,(p-v)/o,(g-w)/r),A=(p-v)/o,F=(g-w)/r,O=(-p-v)/o,E=(-g-w)/r,B=L(A,F,O,E),X=D(A,F,O,E);X<=-1?B=Math.PI:X>=1&&(B=0),!l&&B>0&&(B=B-2*Math.PI),l&&B<0&&(B=B+2*Math.PI);let z=o>r?o:r,U=o>r?1:o/r,tt=o>r?r/o:1,nt=C.KL(0,0,z,M,M+B,!0),Z=Nt.l();return Z.Ue(),Z.Xs(k,S),Z.ks(this.mn,0,0),Z.et(U,tt),wt.JL(nt,Z),Nt.i(Z),this.Ks=nt,this.Ks}get isClosed(){return(this.n&8)!==0}set isClosed(t){this.isClosed!==t&&(t?this.n|=8:this.n&=-9,this.yt=!0)}get type(){return this.W}set type(t){this.u&&m.L(this,t),this.W=t,this.yt=!0}get endX(){return this.ni}set endX(t){this.u&&m.L(this,t),this.ni=t,this.yt=!0}get endY(){return this.oi}set endY(t){this.u&&m.L(this,t),this.oi=t,this.yt=!0}get point1X(){return this.mn}set point1X(t){this.u&&m.L(this,t),this.mn=t,this.yt=!0}get point1Y(){return this.Ll}set point1Y(t){this.u&&m.L(this,t),this.Ll=t,this.yt=!0}get point2X(){return this.Al}set point2X(t){this.u&&m.L(this,t),this.Al=t,this.yt=!0}get point2Y(){return this.yr}set point2Y(t){this.u&&m.L(this,t),this.yr=t,this.yt=!0}get centerX(){return this.mn}set centerX(t){this.u&&m.L(this,t),this.mn=t,this.yt=!0}get centerY(){return this.Ll}set centerY(t){this.u&&m.L(this,t),this.Ll=t,this.yt=!0}get radiusX(){return this.Al}set radiusX(t){t<0&&m.J(t,">= zero",mt,"radiusX"),this.u&&m.L(this,t),this.Al=t,this.yt=!0}get radiusY(){return this.yr}set radiusY(t){t<0&&m.J(t,">= zero",mt,"radiusY"),this.u&&m.L(this,t),this.yr=t,this.yt=!0}get startAngle(){return this.ni}set startAngle(t){this.u&&m.L(this,t),t=t%360,t<0&&(t+=360),this.ni=t,this.yt=!0}get sweepAngle(){return this.oi}set sweepAngle(t){this.u&&m.L(this,t),t>360&&(t=360),t<-360&&(t=-360),this.oi=t,this.yt=!0}get isClockwiseArc(){return(this.n&4)!==0}set isClockwiseArc(t){this.u&&m.L(this,t),t?this.n|=4:this.n&=-5,this.yt=!0}get isLargeArc(){return(this.n&16)!==0}set isLargeArc(t){this.u&&m.L(this,t),t?this.n|=16:this.n&=-17,this.yt=!0}get xAxisRotation(){return this.mn}set xAxisRotation(t){this.u&&m.L(this,t),t=t%360,t<0&&(t+=360),this.mn=t,this.yt=!0}}class Qt{a;hx;cx;dm;gm;mm;pm;ym;wm;xm;bm;km;Pm;Sm;Do;Mm;Nm;Ps;Ti;constructor(){this.a=null,this.hx=new P(0,0).k(),this.cx=new P(0,0).k(),this.dm=0,this.gm=0,this.mm=1,this.pm="",this.ym="",this.wm=!1,this.xm=!1,this.bm=0,this.km=0,this.Pm=!1,this.Sm=!1,this.Do=!1,this.Mm=null,this.Nm=0,this.Ps=null,this.Ti=null}copy(){let t=new Qt;return this.clone(t)}clone(t){return t.a=this.a,t.hx.h(this.viewPoint),t.cx.h(this.documentPoint),t.dm=this.dm,t.gm=this.gm,t.mm=this.mm,t.pm=this.pm,t.ym=this.ym,t.wm=this.wm,t.xm=this.xm,t.bm=this.bm,t.km=this.km,t.Pm=this.Pm,t.Sm=this.Sm,t.Do=this.Do,t.Mm=this.Mm,t.Nm=this.Nm,t.Ps=this.Ps,t.Ti=this.Ti,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.a}set diagram(t){this.a=t}get viewPoint(){return this.hx}set viewPoint(t){this.hx.h(t)}get documentPoint(){return this.cx}set documentPoint(t){this.cx.h(t)}getMultiTouchViewPoint(t,e){let i=this.diagram;return i===null||i._L(this.event,t,e),e}getMultiTouchDocumentPoint(t,e){let i=this.diagram;return i===null||(i._L(this.event,t,e),e.h(i.transformViewToDoc(e))),e}get modifiers(){return this.dm}set modifiers(t){this.dm=t}get button(){return this.gm}set button(t){if(this.gm=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.mm}set buttons(t){this.mm=t}get key(){return this.pm}set key(t){this.pm=t}get code(){return this.ym}set code(t){this.ym=t}get down(){return this.wm}set down(t){this.wm=t}get up(){return this.xm}set up(t){this.xm=t}get clickCount(){return this.bm}set clickCount(t){this.bm=t}get delta(){return this.km}set delta(t){this.km=t}get isMultiTouch(){return this.Pm}set isMultiTouch(t){this.Pm=t}get handled(){return this.Sm}set handled(t){this.Sm=t}get bubbles(){return this.Do}set bubbles(t){this.Do=t}get event(){return this.Mm}set event(t){this.Mm=t}get isTouchEvent(){let t=this.event;return t===null?!1:t.pointerType==="touch"||t.pointerType==="pen"}get timestamp(){return this.Nm}set timestamp(t){this.Nm=t}get targetDiagram(){return this.Ps}set targetDiagram(t){this.Ps=t}get targetObject(){return this.Ti}set targetObject(t){this.Ti=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{a;Pt;Cm;Lm;constructor(){this.a=null,this.Pt="",this.Cm=null,this.Lm=null}copy(){let t=new wi;return t.a=this.a,t.Pt=this.Pt,t.Cm=this.Cm,t.Lm=this.Lm,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.a}set diagram(t){this.a=t}get name(){return this.Pt}set name(t){this.Pt=t}get subject(){return this.Cm}set subject(t){this.Cm=t}get parameter(){return this.Lm}set parameter(t){this.Lm=t}}var Ei=(x=>(x[x.Transaction=1]="Transaction",x[x.Property=2]="Property",x[x.Insert=3]="Insert",x[x.Remove=4]="Remove",x))(Ei||{});class Xe{Du;Am;pn;Ce;a;vu;Cc;Lc;Ac;Tc;constructor(){this.Du=2,this.Am="",this.pn="",this.Ce=null,this.a=null,this.vu=null,this.Cc=null,this.Lc=null,this.Ac=null,this.Tc=null}static Transaction=1;static Property=2;static Insert=3;static Remove=4;clear(){this.Ce=null,this.a=null,this.vu=null,this.Cc=null,this.Lc=null,this.Ac=null,this.Tc=null}copy(){let t=new Xe;t.Du=this.Du,t.Am=this.Am,t.pn=this.pn,t.Ce=this.Ce,t.a=this.a,t.vu=this.vu;let e=this.Cc;return m.$(e)&&m.it(e.copyFrozen)?t.Cc=e.copyFrozen():t.Cc=e,e=this.Lc,m.$(e)&&m.it(e.copyFrozen)?t.Lc=e.copyFrozen():t.Lc=e,e=this.Ac,m.$(e)&&m.it(e.copyFrozen)?t.Ac=e.copyFrozen():t.Ac=e,e=this.Tc,m.$(e)&&m.it(e.copyFrozen)?t.Tc=e.copyFrozen():t.Tc=e,t}fe(t){t in Ei?this.change=t:m.cr(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+=m.toString(this.object)),this.oldValue!==null&&(t+=" old: "+m.toString(this.oldValue)),this.oldParam!==null&&(t+=" "+this.oldParam),this.newValue!==null&&(t+=" new: "+m.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.tA(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.tA(this,!1))}get model(){return this.Ce}set model(t){this.Ce=t}get diagram(){return this.a}set diagram(t){this.a=t}get change(){return this.Du}set change(t){this.Du=t}get modelChange(){return this.Am}set modelChange(t){this.Am=t}get propertyName(){return this.pn}set propertyName(t){this.pn=t}get isTransactionFinished(){return this.Du===1&&(this.pn==="CommittedTransaction"||this.pn==="FinishedUndo"||this.pn==="FinishedRedo")}get object(){return this.vu}set object(t){this.vu=t}get oldValue(){return this.Cc}set oldValue(t){this.Cc=t}get oldParam(){return this.Lc}set oldParam(t){this.Lc=t}get newValue(){return this.Ac}set newValue(t){this.Ac=t}get newParam(){return this.Tc}set newParam(t){this.Tc=t}}class oi{eA;Pt;VP;constructor(){this.eA=new q().k(),this.Pt="",this.VP=!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+=`
|
|
4
4
|
`+n.toString())}}return e}clear(){let t=this.changes;t.ce();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),t.k()}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()}}oR(t){let e=this.changes;for(let i=e.count-1;i>=t;i--){let s=e.elt(i);s!==null&&s.undo(),e.ce(),e.removeAt(i)}e.k()}thaw(){this.changes.ce()}optimize(){if(!this.isComplete)return;let t=this.changes;t.ce();let e=new Map;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 Map,e.set(n.object,o));let r=o.get(n.propertyName);r===void 0?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.k()}get changes(){return this.eA}get name(){return this.Pt}set name(t){this.Pt=t}get isComplete(){return this.VP}set isComplete(t){this.VP=t}}class vi{fx;Be;iA;Hs;BP;Tm;Tl;zP;XP;yn;Dc;ux;qs;gx;mx;Dm;yx;constructor(t){this.fx=new V,this.Be=!1,this.iA=new q().k(),this.Hs=-1,this.BP=999,this.qs=!1,this.Tm=null,this.Tl=0,this.zP=!1,this.XP=23,this.yn=new q().k(),this.Dc=new q,this.ux=!0,this.gx=!1,this.mx=!1,this.Dm=!1,this.yx=!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+=`
|
|
5
5
|
`+this.history.elt(s).toString(t-1)}return e}clear(){let t=this.history;t.ce();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),this.Hs=-1,t.k(),this.qs=!1,this.Tm=null,this.Tl=0,this.yn.ce(),this.yn.clear(),this.yn.k(),this.Dc.clear(),this.gx=!1,this.mx=!1,this.Dm=!1,this.yx=!1}copyProperties(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.vm=t.vm}addModel(t){this.fx.add(t)}removeModel(t){this.fx.delete(t)}startTransaction(t){if(t===void 0&&(t=""),t===null&&(t=""),this.isUndoingRedoing)return!1;this.ux===!0&&(this.ux=!1,this.Tl++,this.Dl||this.vl("StartingFirstTransaction",t,this.currentTransaction),this.Tl>0&&this.Tl--),this.isEnabled&&(this.yn.ce(),this.yn.add(t),this.yn.k(),this.currentTransaction===null?this.Dc.add(0):this.Dc.add(this.currentTransaction.changes.count)),this.Tl++;let e=this.transactionLevel===1;return e&&(this.Dl||this.vl("StartedTransaction",t,this.currentTransaction)),e}commitTransaction(t){return t===void 0&&(t=""),this.sA(!0,t)}rollbackTransaction(){return this.sA(!1,"")}sA(t,e){if(this.isUndoingRedoing)return!1;this.vm&&this.transactionLevel<1&&m.ne("Ending transaction without having started a transaction: "+e);let i=this.transactionLevel===1,s=this.currentTransaction;i&&t&&(this.Dl||this.vl("CommittingTransaction",e,s));let n=0;if(this.transactionLevel>0&&(this.Tl--,this.isEnabled)){let o=this.yn.count;o>0&&(e===""&&(e=this.yn.elt(0)),this.yn.ce(),this.yn.removeAt(o-1),this.yn.k());let r=this.Dc.count;r>0&&(n=this.Dc.elt(r-1),this.Dc.removeAt(r-1))}if(i){if(t){if(this.Dm=!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.ce();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.Hs--}}a!==0&&(r.count===0||r.get(r.count-1)!==o)&&(r.add(o),this.Hs++),r.k(),s=o}this.Dl||this.vl("CommittedTransaction",e,s)}else{this.qs=!0;try{this.isEnabled&&s!==null&&(s.isComplete=!0,s.undo())}finally{this.Dl||this.vl("RolledBackTransaction",e,s),this.qs=!1}s!==null&&s.clear()}return this.Tm=null,this.wx&&this.clear(),this.wx=!1,this.xx=!1,!0}else return this.isEnabled&&!t&&s!==null&&s.oR(n),!1}discardHistoryAfterIndex(){if(this.isUndoingRedoing||!this.canRedo())return;let t=this.history;t.ce();for(let e=t.count-1;e>this.historyIndex;e--){let i=t.elt(e);i!==null&&i.clear(),t.removeAt(e),this.Dm=!0}t.k()}thaw(){this.history.ce()}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;if(t!==null)try{this.qs=!0,this.vl("StartingUndo","Undo",t),this.Hs--,t.undo()}catch(e){m.ne("undo error: "+e.toString())}finally{this.vl("FinishedUndo","Undo",t),this.qs=!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;if(t!==null)try{this.qs=!0,this.vl("StartingRedo","Redo",t),this.Hs++,t.redo()}catch(e){m.ne("redo error: "+e.toString())}finally{this.vl("FinishedRedo","Redo",t),this.qs=!1}}vl(t,e,i){let s=new Xe;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.rR(s)}}handleChanged(t){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(t)){let e=this.currentTransaction;e===null&&(e=new oi,this.Tm=e);let i=t.copy(),s=e.changes;if(s.ce(),s.add(i),s.k(),this.vm&&this.XP>0&&this.transactionLevel<=0&&!this.ux){let n=t.diagram;if(n!==null&&n.Qa===!1)return;m.ne("Change not within a transaction: "+i.toString()),this.XP--}}}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.fx.iterator}get isEnabled(){return this.Be}set isEnabled(t){this.Be=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.qs}get history(){return this.iA}get maxHistoryLength(){return this.BP}set maxHistoryLength(t){this.BP=t}get historyIndex(){return this.Hs}get currentTransaction(){return this.Tm}get transactionLevel(){return this.Tl}get isInTransaction(){return this.Tl>0}get vm(){return this.zP}set vm(t){this.zP=t}get nestedTransactionNames(){return this.yn}get wx(){return this.gx}set wx(t){this.gx=t}get xx(){return this.mx}set xx(t){this.mx=t}get Dl(){return this.yx}set Dl(t){this.yx=t}get isJustDiscarded(){return this.Dm}}class $t{a;Pt;Be;GP;YP;Fm;nA;constructor(){V.Je(this),this.a=Y.Rm(),this.Pt="",this.Be=!0,this.GP=!1,this.YP=null,this.nA=new Qt,this.Fm=-1}get diagram(){return this.a}set diagram(t){t instanceof Y&&(this.a=t)}toString(){return this.name!==""?this.name+" Tool":m.Gn(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.z(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.z(NaN,NaN));if(!i.isReal()||!s.isReal()){P.i(i),P.i(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){t.KP=t.scale;let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o);t.HP=r,e.bubbles=!1}P.i(i),P.i(s)}standardPinchZoomMove(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.z(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.z(NaN,NaN));if(!i.isReal()||!s.isReal()){P.i(i),P.i(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.HP,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.KP*r,l=t.commandHandler;if(h!==t.scale&&l.canResetZoom(h)){let u=t.zoomPoint;t.zoomPoint=a,l.resetZoom(h),t.zoomPoint=u}e.bubbles=!1}P.i(i),P.i(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(m.hr?e.meta:e.control){t.T("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!s.isSelected),t.T("ChangedSelection",t.selection)}else if(e.shift){if(!i.isSelected){t.T("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!0),t.T("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&&!(m.hr?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.oA(n,s,i)}oA(t,e,i){if(e.handled=!1,t!==null&&!t.isEnabledObject())return!1;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.T(n,t)}else{switch(s){case 1:n="BackgroundSingleClicked";break;case 2:n="BackgroundDoubleClicked";break;case 3:n="BackgroundContextClicked";break}s!==0&&i.T(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)}return e.handled}standardMouseOver(){let t=this.diagram,e=t.lastInput;if(t.animationManager.ke===!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.vc){let o=t.vc,r=o;for(t.vc=s,this.rA(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.vc}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="")}rA(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,u="pixel";if((h!==0||l!==0)&&!e.shift){switch(a){case 0:u="pixel";break;case 1:u="line";break;case 2:u="page";break}if(h!==0&&t.allowHorizontalScroll){let c=t.scrollHorizontalLineChange;h=h*(c/16),t.scroll(u,h>0?"right":"left",Math.abs(h))}if(l!==0&&t.allowVerticalScroll){let c=t.scrollVerticalLineChange;l=l*(c/16),t.scroll(u,l>0?"down":"up",Math.abs(l))}}else!e.shift&&t.allowVerticalScroll?(i=i*3*t.scrollVerticalLineChange,t.scroll(u,i>0?"up":"down",Math.abs(i))):e.shift&&t.allowHorizontalScroll&&(i=i*3*t.scrollHorizontalLineChange,t.scroll(u,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.nA);this.Fm=m.un(()=>i.doWaitAfter(s),t)}cancelWaitAfter(){this.Fm!==-1&&m.wc(this.Fm),this.Fm=-1}doWaitAfter(t){}findToolHandleAt(t,e){let i=this.diagram.findObjectAt(t,s=>{for(;s!==null&&!(s.panel instanceof vt);)s=s.panel;return s});return i===null?null:i.part.category===e?i:null}isBeyondDragSize(t,e){let i=this.diagram;t===void 0&&(t=i.firstInput.viewPoint),e===void 0&&(e=i.lastInput.viewPoint);let s=i.toolManager.dragSize,n=s.width,o=s.height;return i.firstInput.isTouchEvent&&(n+=6,o+=6),Math.abs(e.x-t.x)>n||Math.abs(e.y-t.y)>o}get name(){return this.Pt}set name(t){m.s(t,"string",$t,"name"),this.Pt=t}get isEnabled(){return this.Be}set isEnabled(t){m.s(t,"boolean",$t,"isEnabled"),this.Be=t}get isActive(){return this.GP}set isActive(t){m.s(t,"boolean",$t,"isActive"),this.GP=t}get transactionResult(){return this.YP}set transactionResult(t){t!==null&&m.s(t,"string",$t,"transactionResult"),this.YP=t}}var Cs=(x=>(x[x.Scroll=1]="Scroll",x[x.Zoom=2]="Zoom",x[x.None=3]="None",x))(Cs||{}),As=(x=>(x[x.Zoom=1]="Zoom",x[x.Cancel=2]="Cancel",x[x.None=3]="None",x))(As||{});class ne extends $t{lA;aA;hA;qP;jP;WP;JP;$P;ZP;QP;Om;_a;constructor(t){super(),this.name="ToolManager",this.lA=new q,this.aA=new q,this.hA=new q,this.qP=850,this.jP=850,this.WP=new st(2,2).kt(),this.JP=5e3,this.$P=1,this.ZP=1,this.QP=null,this.Om=null,this._a=-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.$P}set mouseWheelBehavior(t){this.$P=t}get gestureBehavior(){return this.ZP}set gestureBehavior(t){this.ZP=t}initializeStandardTools(){return this}updateAdornments(t){let e=this.currentToolTip;if(e instanceof vt&&this.Om===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.cA(t);let i=e.event;i!==null&&(i.type==="pointermove"||!i.cancelable)&&(e.bubbles=!0)}cA(t){this.standardMouseOver(),this.isBeyondDragSize()&&this.standardWaitAfter(this.isActive?this.holdDelay:this.hoverDelay,t.lastInput)}rA(t,e){let i=this.currentToolTip;i!==null&&(e!==null&&i instanceof vt&&(e===i||e.isContainedBy(i))||this.hideToolTip())}doWaitAfter(t){let e=this.diagram;if(!e.lR())return;let i=e.lastInput;if(e.lastInput=t,this.doMouseHover(),this.isActive||this.doToolTip(),t.isTouchEvent&&!e.lastInput.handled){let s=t.copy();s.button=2,e.lastInput=s,e.kx=!0,e.doMouseUp()}e.lastInput=i}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 vt&&(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){e!==null&&m.se(e,J,ne,"showToolTip:obj");let i=this.diagram;if(t!==this.currentToolTip&&this.hideToolTip(),t instanceof vt){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category="ToolTip",t.hasPlaceholder()&&(t.placeholder.scale=i.scale);let s=t.diagram;s!==null&&s!==i&&s.remove(t),i.add(t),e!==null?t.adornedObject=e:t.data=i.model,t.ensureBounds(),this.positionToolTip(t,e)}else t instanceof fe&&t!==this.currentToolTip&&t.show!==null&&t.show(e,i,this);this.currentToolTip=t,this.extendToolTip(this.toolTipDuration)}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}extendToolTip(t){t===void 0&&(t=3e3),this.currentToolTip!==null&&(this._a!==-1&&(m.wc(this._a),this._a=-1),t>0&&t!==1/0&&(this._a=m.un(()=>this.hideToolTip(),t)))}hideToolTip(){this._a!==-1&&(m.wc(this._a),this._a=-1);let t=this.diagram,e=this.currentToolTip;e!==null&&(e instanceof vt?(t.remove(e),this.Om!==null&&this.Om.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof fe&&e.hide!==null&&e.hide(t,this),this.currentToolTip=null)}get currentToolTip(){return this.QP}set currentToolTip(t){this.QP=t,this.Om=t!==null&&t instanceof vt?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){m.s(t,"string",ne,"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){m.s(t,"string",ne,"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){m.s(t,"string",ne,"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.lA}get mouseMoveTools(){return this.aA}get mouseUpTools(){return this.hA}get hoverDelay(){return this.qP}set hoverDelay(t){m.s(t,"number",ne,"hoverDelay"),this.qP=t}get holdDelay(){return this.jP}set holdDelay(t){m.s(t,"number",ne,"holdDelay"),this.jP=t}get dragSize(){return this.WP}set dragSize(t){this.WP=t.N()}get toolTipDuration(){return this.JP}set toolTipDuration(t){m.s(t,"number",ne,"toolTipDuration"),this.JP=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 Tt extends $t{_P;tS;wn;eS;iS;sS;nS;Fc;Im;oS;th;wr;fA;rS;Fu;Ru;lS;aS;hS;cS;static Px=new q;static le=null;static eh=null;constructor(t){super(),this.name="Dragging",this._P=!0,this.cS=!0,this.tS=!0,this.wn=null,this.eS=null,this.iS=null,this.sS=null,this.nS=!1,this.Fu=!1,this.Fc=new P(NaN,NaN),this.Im=new P,this.oS=!0,this.th=100,this.wr=[],this.fA=new V().k(),this.rS=new Pi,this.Ru=null,this.lS="copy",this.aS="",this.hS="no-drop",t&&Object.assign(this,t)}get isCopyEnabled(){return this._P}set isCopyEnabled(t){m.s(t,"boolean",Tt,"isCopyEnabled"),this._P=t}get copiesEffectiveCollection(){return this.tS}set copiesEffectiveCollection(t){m.s(t,"boolean",Tt,"copiesEffectiveCollection"),this.tS=t}get dragOptions(){return this.rS}set dragOptions(t){this.rS=t}get isGridSnapEnabled(){return this.dragOptions.isGridSnapEnabled}set isGridSnapEnabled(t){m.s(t,"boolean",Tt,"isGridSnapEnabled"),this.dragOptions.isGridSnapEnabled=t}get isComplexRoutingRealtime(){return this.oS}set isComplexRoutingRealtime(t){this.oS=t;let e=this.diagram.findRouter("AvoidsLinks");e!==null&&(e.isRealtime=t)}get isGridSnapRealtime(){return this.dragOptions.isGridSnapRealtime}set isGridSnapRealtime(t){m.s(t,"boolean",Tt,"isGridSnapRealtime"),this.dragOptions.isGridSnapRealtime=t}get gridSnapCellSize(){return this.dragOptions.gridSnapCellSize}set gridSnapCellSize(t){this.dragOptions.gridSnapCellSize.equals(t)||(t=t.N(),this.dragOptions.gridSnapCellSize=t)}get gridSnapCellSpot(){return this.dragOptions.gridSnapCellSpot}set gridSnapCellSpot(t){this.dragOptions.gridSnapCellSpot.equals(t)||(t=t.N(),this.dragOptions.gridSnapCellSpot=t)}get gridSnapOrigin(){return this.dragOptions.gridSnapOrigin}set gridSnapOrigin(t){this.dragOptions.gridSnapOrigin.equals(t)||(t=t.N(),this.dragOptions.gridSnapOrigin=t)}get dragsLink(){return this.dragOptions.dragsLink}set dragsLink(t){m.s(t,"boolean",Tt,"dragsLink"),this.dragOptions.dragsLink=t}get dragsTree(){return this.dragOptions.dragsTree}set dragsTree(t){m.s(t,"boolean",Tt,"dragsTree"),this.dragOptions.dragsTree=t}get copyCursor(){return this.lS}set copyCursor(t){this.lS=t}get moveCursor(){return this.aS}set moveCursor(t){this.aS=t}get nodropCursor(){return this.hS}set nodropCursor(t){this.hS=t}get currentPart(){return this.eS}set currentPart(t){t!==null&&m.se(t,pt,Tt,"currentPart"),this.eS=t}get copiedParts(){return this.sS}set copiedParts(t){this.sS=t}get draggedParts(){return this.iS}set draggedParts(t){this.iS=t}get draggingParts(){return this.copiedParts!==null?this.copiedParts.toKeySet():this.draggedParts!==null?this.draggedParts.toKeySet():this.fA}get draggedLink(){return this.diagram.draggedLink}set draggedLink(t){t!==null&&m.se(t,j,Tt,"draggedLink"),this.diagram.draggedLink=t}get isDragOutStarted(){return this.nS}set isDragOutStarted(t){this.nS=t}get startPoint(){return this.Im}set startPoint(t){this.Im.equals(t)||this.Im.h(t)}get delay(){return this.th}set delay(t){m.s(t,"number",Tt,"delay"),this.th=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.th)?!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.T("ChangingSelection",t.selection);let i=t.lastInput;!(m.hr?i.meta:i.control)&&!i.shift&&t.clearSelection(!0),this.currentPart.isSelected=!0,t.T("ChangedSelection",t.selection)}}}doActivate(){let t=this.diagram;this.Ru=null,this.currentPart===null&&this.standardMouseSelect();let e=this.currentPart;if(e===null||!e.canMove()&&!e.canCopy())return;t.cacheGroupExternalLinks(!0),Tt.le=null,this.isActive=!0,this.Fc.set(t.position),this.fS(t.selection),this.wr.length=0,t.animationManager.stopAnimation();let i=this.computeEffectiveCollection(t.selection,this.dragOptions);this.draggedParts=i,this.cS=!!this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,t.Ou=!0,t.getRenderingHint("temporaryPixelRatio")===!0&&t.avgSpf>30&&t.Sx(),t.uA(this.draggedParts),t.Iu=!0,this.startTransaction("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&this.aR()}fS(t){if(!this.dragsLink)return;let e=this.diagram,i=e.model.uS(),s=t.first();i&&t.count===1&&s instanceof j&&this.mayDragLink(s)?(this.draggedLink=s,this.draggedLink.canRelinkFrom()&&this.draggedLink.canRelinkTo()&&this.draggedLink.clearAdornments(),this.wn=e.toolManager.findTool("Relinking"),this.wn===null&&(this.wn=new $e,this.wn.diagram=e),this.wn.originalLink=this.draggedLink):(this.draggedLink=null,this.wn=null)}mayDragLink(t){let e=this.diagram;return e!==null&&e.allowRelink}computeEffectiveCollection(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)}js(t){return t===void 0?new Ke(P.dn):this.isGridSnapEnabled?new Ke(new P(Math.round(t.x*1e3)/1e3,Math.round(t.y*1e3)/1e3)):new Ke(t.copy())}doDeactivate(){this.isActive=!1;let t=this.diagram;this.diagram.layout.isRealtime=this.cS,t.Iu=!1,t.Fl=!0,t.cacheGroupExternalLinks(!1),t.stopAutoScroll(),this.dS(),t.gS(this.draggedParts),this.Ru=null,this.currentPart=null,this.draggedParts=null,this.isDragOutStarted=!1,this.Fu=!1,Tt.hR(),this.dA(),this.Fc.e(NaN,NaN),Tt.eh!==null&&(Tt.eh.currentCursor=""),Tt.eh=null,Tt.le=null,this.Rl(),t.isMouseCaptured=!1,t.currentCursor="",t.Ou=!1,this.stopTransaction(),t.mS(!0)}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}dS(){let t=this.diagram,e=t.skipsUndoManager;t.skipsUndoManager=!0;let i=t.lastInput;this.gA(i,null),t.skipsUndoManager=e,this.wr.length=0}mA(){this.Rl(),this.pS();let t=this.diagram;this.Fc.isReal()&&(t.position=this.Fc),t.stopAutoScroll()}doCancel(){this.Rl(),this.pS();let t=this.diagram;this.Fc.isReal()&&(t.position=this.Fc),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()}cR(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,u=h.y;isNaN(l)||isNaN(u)||(l<i&&(i=l),u<s&&(s=u),l>n&&(n=l),u>o&&(o=u))}return i===1/0?e.e(0,0,0,0):e.e(i,s,n-i,o-s),e}yS(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.pS(),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);e.commandHandler.Rc(n);let o=new Mt,r=this.draggedParts.iterator;for(;r.next();){let h=r.key;if(h.Di()&&h.canCopy()){let l=n.get(h);if(l===null)continue;l.location=h.location,l.ensureBounds(),o.set(l,this.js(l.location))}}let a=n.iterator;for(;a.next();){let h=a.value;h instanceof j&&h.canCopy()&&o.set(h,this.js())}if(this.copiedParts=o,this.fS(o.toKeySet()),this.draggedLink!==null){let h=this.draggedLink,l=h.routeBounds;h.xr(this.startPoint.x-(l.x+l.width/2),this.startPoint.y-(l.y+l.height/2))}this.doUpdateCursor(null)}Rl(){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 j){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}dA(){this.draggedLink!==null&&(this.dragsLink&&this.wn!==null&&(this.wn.stopDraggingMouseMove(),this.wn.originalLink=null),this.draggedLink=null,this.wn=null)}Oc(t,e){if(t===null)return;let i=this.diagram,s=this.startPoint,n=P.l();n.h(i.lastInput.documentPoint),this.moveParts(t,n.subtract(s),e),P.i(n),i.getRenderingHint("temporaryPixelRatio")===!0&&i.Ol===null&&i.avgSpf>30&&(i.Sx(),i.Eu())}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram;s!==null&&s.Mx(t,e,this.dragOptions,i)}pS(){if(this.draggedParts===null)return;let t=this.diagram,e=this.draggedParts.iterator;for(;e.next();){let i=e.key;i.Di()&&(i.location=e.value.point)}for(e=this.draggedParts.iterator;e.next();){let i=e.key;if(i instanceof j&&i.suspendsRouting){let s=e.value.point;this.draggedParts.set(i,this.js()),i.xr(-s.x,-s.y)}}t.maybeUpdate()}fR(t){if(t===null)return!0;let e=t.part;return!!(e===null||e instanceof vt||e.layer?.isTemporary||this.draggedParts&&this.draggedParts.has(e)||this.copiedParts&&this.copiedParts.has(e))}wS(t){let e=this.diagram;this.dragsLink&&(this.draggedLink!==null&&(this.draggedLink.fromNode=null,this.draggedLink.toNode=null),this.pA(!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.gA(s,i),!this.isActive&&Tt.le===null)return;let r=i!==null?i.part:null;if(r===null||e.handlesDragDropForTopLevelParts&&r.isTopLevel&&!(r instanceof ht)){let a=e.mouseDragOver;a!==null&&(a(s),o=!0)}if(!this.isActive&&Tt.le===null||(this.doDragOver(t,i),!this.isActive&&Tt.le===null))return}finally{e.skipsUndoManager=n,o&&e.maybeUpdate()}this.Ru=i,!e.isReadOnly&&(e.allowMove||e.allowCopy)&&(e.allowHorizontalScroll||e.allowVerticalScroll)&&e.doAutoScroll(s.viewPoint)}findDragOverObject(t){return this.diagram.xS(t,null,e=>!this.fR(e))}doUpdateCursor(t){let e=this.diagram;(t===null||this.Ru!==t)&&(!this.diagram.currentTool.isActive||this.mayCopy()?e.currentCursor=this.copyCursor:this.mayMove()?e.currentCursor=this.moveCursor:this.mayDragOut()&&(e.currentCursor=this.nodropCursor))}gA(t,e){let i=!1,s=this.wr.length,n=s>0?this.wr[0]:null;if(e===n)return!1;t.handled=!1;for(let r=0;r<s;r++){let a=this.wr[r],h=a.mouseDragLeave;if(h!==null&&(h(t,a,e),i=!0,t.handled))break}if(this.wr.length=0,!this.isActive&&Tt.le===null||e===null)return i;t.handled=!1;let o=e;for(;o!==null;)this.wr.push(o),o=this.yA(o);s=this.wr.length;for(let r=0;r<s;r++){let a=this.wr[r],h=a.mouseDragEnter;if(h!==null&&(h(t,a,n),i=!0,t.handled))break}return i}vU(t,e){return t===null?!1:!!(t===e||t.isContainedBy(e)||e instanceof ht&&!(t instanceof ht)&&e.handlesDragDropForMembers&&t.part?.isMemberOf(e))}yA(t){let e=t.panel;if(e!==null)return e;if(t instanceof pt&&!(t instanceof ht)){let i=t.containingGroup;if(i!==null&&i.handlesDragDropForMembers)return i}return null}wA(t,e){let i=this.diagram,s=this.wn;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 u=l.value;if(u.part===null)continue;let c=u.getDocumentPoint(T.Center,r),d=t.distanceSquaredPoint(c);d<a&&(h=u,a=d)}return P.i(r),h}pA(t){let e=this.draggedLink;if(e!==null){if(e.pointsCount<2)return;let i=this.diagram;if(i.isReadOnly)return;let s=this.wn;if(s===null)return;let n=null,o=null;e.fromNode===null&&(n=this.wA(e.getPoint(0),!1),n!==null&&(o=n.part));let r=null,a=null;e.toNode===null&&(r=this.wA(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.bS&&i.T("LinkRelinked",e,i.bS),e.toPort!==i.kS&&i.T("LinkRelinked",e,i.kS)):s.doDraggingMouseMove(o,n,a,r):s.doDraggingMouseMove(null,null,null,null)}}doDragOver(t,e){}xA(t){let e=this.diagram;this.dragsLink&&this.pA(!0),this.dS();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.uR(s,a),a=this.yA(a)}}else{let a=e.mouseDrop;a!==null&&a(s)}if(!this.isActive&&Tt.le===null)return;let n=this.copiedParts||this.draggedParts;if(n!==null){let a=n.iterator;for(;a.next();){let h=a.key;h instanceof $&&h.linksConnected.each(l=>l.suspendsRouting=!1)}}if(this.doDropOnto(t,i),!this.isActive&&Tt.le===null)return;let o=I.l(),r=e.selection.iterator;for(;r.next();){let a=r.value;a instanceof $&&this.dR(e,a,o)}I.i(o)}uR(t,e){let i=this.diagram,s=e.part;if(i.handlesDragDropForTopLevelParts&&s!==null&&s.isTopLevel&&!(s instanceof ht)){let n=i.mouseDrop;n!==null&&n(t)}}dR(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.PS(i,a=>a.part,a=>a instanceof j,!0,a=>a instanceof j,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.$t()}}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.yS(!1),this.Oc(this.copiedParts,!1)):this.mayMove()?(this.Rl(),this.Oc(this.draggedParts,!0)):this.mayDragOut()?(this.yS(!1),this.Oc(this.copiedParts,!1)):this.Rl(),this.wS(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.Rl(),this.yS(!0),this.Oc(this.copiedParts,!1),this.copiedParts!==null&&(t.T("ChangingSelection",t.selection),t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0}))):(i=!0,this.Rl(),this.mayMove()&&(this.Oc(this.draggedParts,!0),this.wS(t.lastInput.documentPoint))),this.Fu=!0,this.xA(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.gR(),t.invalidateDocumentBounds(),t.gS(this.draggedParts),this.transactionResult=n?"Copy":"Move",t.T(n?"SelectionCopied":"SelectionMoved",o)}this.stopTool(),s&&t.T("ChangedSelection",t.selection)}simulatedMouseMove(t,e,i){if(Tt.le===null)return!1;let s=Tt.le.diagram;i instanceof Y||(i=null);let n=Tt.eh;if(i!==n){if(n!==null&&n!==s){n.stopAutoScroll(),Tt.le.isDragOutStarted=!1;let r=n.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDragLeave()}if(Tt.eh=i,i!==null&&i!==s){Tt.le.mA();let r=i.toolManager.findTool("Dragging");r!==null&&(r.bA(),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(Tt.le===null)return!1;let s=Tt.eh,n=Tt.le.diagram;if(i===null)return Tt.le.doCancel(),!0;if(i!==s){if(s!==null){let r=s.toolManager.findTool("Dragging");if(s!==null&&s!==n&&r!==null)return s.stopAutoScroll(),Tt.le.isDragOutStarted=!1,r.doSimulatedDragLeave(),!1}Tt.eh=i;let o=i.toolManager.findTool("Dragging");o!==null&&(Tt.le.mA(),o.bA(),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=Tt.le;if(a!==null){let h=a.mayCopy();a.transactionResult=h?"Copy":"Move",a.stopTool()}return!0}return!1}gR(){if(this.draggedParts===null)return;let t=this.draggedParts.iterator;for(;t.next();){let e=t.key;if(e instanceof $){let i=e.containingGroup;i!==null&&i.hasPlaceholder()&&!this.draggedParts.has(i)&&i.placeholder.f()}}}mayCopy(){if(!this.isCopyEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowCopy||!(m.hr?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())}bA(){Tt.Px.has(this)||Tt.Px.add(this)}static hR(){if(Tt.Px.count>0){let t=Tt.Px,e=t.length;for(let i=0;i<e;i++){let s=t.elt(i);s.dA(),s.Rl(),s.dS(),s.diagram.stopAutoScroll()}t.clear()}}mR(t,e,i){return!this.Fu&&this.draggedParts!==null&&!this.draggedParts.has(t)?(i.h(e),!0):!1}get draggingSource(){return Tt.le}mayDragIn(){let t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;let e=Tt.le;return!(e===null||e.diagram.model.dataFormat!==t.model.dataFormat)}doSimulatedDragEnter(){if(!this.mayDragIn())return;let t=this.diagram;t.animationManager.stopAnimation(),t.br(),t.animationManager.stopAnimation();let e=Tt.le;e!==null&&(this.diagram.Ou=!0,t.lastInput.event===null&&(t.lastInput.event=e.diagram.lastInput.event)),this.doUpdateCursor(null)}doSimulatedDragLeave(){let t=Tt.le;t!==null&&t.doSimulatedDragOut(),this.diagram.Ou=!1,this.doCancel()}doSimulatedDragOver(){let t=this.diagram;t.animationManager.Uu=!0;let e=Tt.le;if(e!==null&&e.draggedParts!==null){if(!this.mayDragIn())return;this.kA(e.draggedParts.toKeySet(),!1,t.firstInput),this.Oc(this.copiedParts,!1),this.wS(t.lastInput.documentPoint)}t.animationManager.Uu=!1}doSimulatedDrop(){let t=this.diagram,e=Tt.le;if(e!==null){let i=e.diagram;if(e.Fu=!0,this.Rl(),e.draggedParts===null||!this.mayDragIn())return;t.animationManager.Uu=!0,t.T("ChangingSelection",t.selection),this.startTransaction("Drop"),this.kA(e.draggedParts.toKeySet(),!0,t.lastInput),this.Oc(this.copiedParts,!1);let s=new V;this.copiedParts!==null&&(t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0,s.add(n)})),this.xA(t.lastInput.documentPoint),t.invalidateDocumentBounds(),this.copiedParts!==null&&(this.transactionResult="ExternalCopy"),this.copiedParts=null,t.doFocus(),t.Ou=!1,t.T("ExternalObjectsDropped",s,i),this.stopTransaction(),t.T("ChangedSelection",t.selection)}t.animationManager.Uu=!1}kA(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);s.commandHandler.Rc(n);let o=I.l();this.cR(t,o);let r=o.x+o.width/2,a=o.y+o.height/2;I.i(o);let h=this.Im,l=new Mt,u=P.l(),c=t.iterator;for(;c.next();){let f=c.value;if(f instanceof j&&f.canCopy()){let p=n.get(f);if(p===null)continue;p.points=f.points,p.xr(h.x-r,h.y-a),p.suspendsRouting=!0,l.set(p,this.js())}}let d=t.iterator;for(;d.next();){let f=d.value;if(f.Di()&&f.canCopy()){let p=n.get(f);if(p===null)continue;let g=f.location;u.e(h.x-(r-g.x),h.y-(a-g.y)),p.location=u,p.ensureBounds(),l.set(p,this.js(u))}}if(P.i(u),this.copiedParts=l,this.fS(l.toKeySet()),this.draggedLink!==null){let f=this.draggedLink,p=f.routeBounds;f.xr(this.startPoint.x-(p.x+p.width/2),this.startPoint.y-(p.y+p.height/2))}this.doUpdateCursor(null)}aR(){this.isDragOutStarted=!0,this.Fu=!1,Tt.le=this,Tt.eh=this.diagram,this.doSimulatedDragOut()}doSimulatedDragOut(){let t=this.diagram;!this.mayCopy()&&!this.mayMove()?t.currentCursor=this.nodropCursor:t.currentCursor="",this.Ru=null}computeMove(t,e,i,s){let n=this.diagram;return n!==null?n.computeMove(t,e,this.dragOptions,s):new P}}ne.prototype.doCancel=function(){Tt.le!==null&&Tt.le.doCancel(),$t.prototype.doCancel.call(this)};class ae extends $t{SS;MS;Il;NS;CS;ih;LS;nh;AS;TS;DS;vS;FS;RS;PA;OS;El;IS;constructor(){super(),this.SS=100,this.MS=!1,this.Il="pointer",this.NS=new j({layerName:"Tool"}).add(new et({isPanelMain:!0,stroke:"blue"}).theme("stroke","tempLink"),new et({toArrow:"Standard",fill:"blue",stroke:"blue"}).theme("fill","tempLink").theme("stroke","tempLink")).It(),this.ih=new et("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:st.CP}).theme("stroke","tempPort"),this.CS=new $({selectable:!1,layerName:"Tool"}).add(this.ih).It(),this.nh=new et("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:st.CP}).theme("stroke","tempPort"),this.LS=new $({selectable:!1,layerName:"Tool"}).add(this.nh).It(),this.AS=null,this.TS=null,this.DS=null,this.vS=null,this.FS=null,this.RS=!0,this.PA=new Mt,this.OS=null,this.El=null,this.IS=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.SS}set portGravity(t){m.s(t,"number",ae,"portGravity"),t>=0&&(this.SS=t)}get isUnconnectedLinkValid(){return this.MS}set isUnconnectedLinkValid(t){m.s(t,"boolean",ae,"isUnconnectedLinkValid"),this.MS=t}get linkingCursor(){return this.Il}set linkingCursor(t){this.Il=t}get temporaryLink(){return this.NS}set temporaryLink(t){t.It(),this.NS=t}get temporaryFromNode(){return this.CS}set temporaryFromNode(t){t.It(),this.CS=t,t&&(this.ih=t.port)}get temporaryFromPort(){return this.ih}set temporaryFromPort(t){if(this.ih!==null){let e=this.ih.panel;if(e!==null){let i=e.D.indexOf(this.ih);e.removeAt(i),e.insertAt(i,t)}}this.ih=t}get temporaryToNode(){return this.LS}set temporaryToNode(t){t.It(),this.LS=t,t&&(this.nh=t.port)}get temporaryToPort(){return this.nh}set temporaryToPort(t){if(this.nh!==null){let e=this.nh.panel;if(e!==null){let i=e.D.indexOf(this.nh);e.removeAt(i),e.insertAt(i,t)}}this.nh=t}get originalLink(){return this.AS}set originalLink(t){t!==null&&m.se(t,j,ae,"originalLink"),this.AS=t}get originalFromNode(){return this.TS}set originalFromNode(t){t!==null&&m.se(t,$,ae,"originalFromNode"),this.TS=t}get originalFromPort(){return this.DS}set originalFromPort(t){t!==null&&m.se(t,J,ae,"originalFromPort"),this.DS=t}get originalToNode(){return this.vS}set originalToNode(t){t!==null&&m.se(t,$,ae,"originalToNode"),this.vS=t}get originalToPort(){return this.FS}set originalToPort(t){t!==null&&m.se(t,J,ae,"originalToPort"),this.FS=t}get isForwards(){return this.RS}set isForwards(t){this.RS=t}get validPortsCache(){return this.PA}get targetPort(){return this.OS}set targetPort(t){t!==null&&m.se(t,J,ae,"targetPort"),this.OS=t}copyPortProperties(t,e,i,s,n){if(t===null||e===null||i===null||s===null)return;let o=e.getDocumentScale(),r=st.l();r.width=e.naturalBounds.width*o,r.height=e.naturalBounds.height*o,s.desiredSize=r,st.i(r),n?(s.toSpot=e.toSpot,s.toEndSegmentLength=e.toEndSegmentLength):(s.fromSpot=e.fromSpot,s.fromEndSegmentLength=e.fromEndSegmentLength),i.locationSpot=T.Center;let a=P.l();i.location=e.getDocumentPoint(T.Center,a),P.i(a),s.angle=e.getDocumentAngle(),this.portTargeted!==null&&this.portTargeted(t,e,i,s,n)}setNoTargetPortProperties(t,e,i){e!==null&&(e.desiredSize=st.CP,e.fromSpot=T.None,e.toSpot=T.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 $){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 $))return null;for(;t!==null;){let s=e?t.toLinkable:t.fromLinkable;if(s===!0&&(t.portId!==null||t instanceof $)&&(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 $))continue;let u=h.getDocumentPoint(T.Center,P.l()),c=i.x-u.x,d=i.y-u.y;P.i(u);let f=c*c+d*d;if(f<o){let p=this.validPortsCache.get(h);p!==null?p&&(r=h,o=f):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=f):this.validPortsCache.set(h,!1)}}if(r!==null){let h=r.part;if(h instanceof $&&(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 $))return!1;let s=t.portId;s===null&&(s="");let n=e.part;if(!(n instanceof $))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 V;return s.add(t),this.ES(i,e,s)}ES(t,e,i){if(t===e)return!0;let s=t.fromNode;if(s!==null&&s.labeledLink&&(i.add(s),this.ES(s.labeledLink,e,i)))return!0;let n=t.toNode;return!!(n!==null&&n.labeledLink&&(i.add(n),this.ES(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.Nx()?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.Vu(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.Vu(t,e,i,!0)}else{if(n===2)return!this.pR(t,e,i);if(n===3)return!this.Vu(t,e,i,!1);if(n===4)return!this.yR(t,e,i)}return!0}Vu(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.Vu(r,e,i,s))return!0}return!1}pR(t,e,i){if(t===e)return!0;let s=new Set;return s.add(e),this.SA(s,t,e,i)}SA(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.SA(t,r,i,s))return!0}return!1}yR(t,e,i){if(t===e)return!0;let s=new Set;return s.add(e),this.MA(s,t,e,i)}MA(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.MA(t,h,i,s))return!0}return!1}get linkValidation(){return this.El}set linkValidation(t){t!==null&&m.S(t,ae,"linkValidation"),this.El=t}get portTargeted(){return this.IS}set portTargeted(t){t!==null&&m.S(t,ae,"portTargeted"),this.IS=t}}var Ts=(x=>(x[x.Either=1]="Either",x[x.ForwardsOnly=2]="ForwardsOnly",x[x.BackwardsOnly=3]="BackwardsOnly",x))(Ts||{});class Le extends ae{US;VS;P;BS;constructor(t){super(),this.name="Linking",this.US={},this.VS=null,this.P=1,this.BS=null,t&&Object.assign(this,t)}static Either=1;static ForwardsOnly=2;static BackwardsOnly=3;get archetypeLinkData(){return this.US}set archetypeLinkData(t){t!==null&&m.xc(t,Le,"archetypeLinkData"),t instanceof J&&m.se(t,j,Le,"archetypeLinkData"),this.US=t}get archetypeLabelNodeData(){return this.VS}set archetypeLabelNodeData(t){t!==null&&m.xc(t,Le,"archetypeLabelNodeData"),t instanceof J&&m.se(t,$,Le,"archetypeLabelNodeData"),this.VS=t}get direction(){return this.P}set direction(t){this.P=t}get startObject(){return this.BS}set startObject(t){t!==null&&m.se(t,J,Le,"startObject"),this.BS=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||t.isModelReadOnly||!t.allowLink||!t.model.Cx()||!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 $))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 $&&(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 $&&(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.$t(),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 $&&(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.T("ChangingSelection",t.selection),t.clearSelection(!0),o.isSelected=!0),this.transactionResult=this.name,t.T("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.T("ChangedSelection",t.selection)}}}isNewTreeLink(){let t=this.archetypeLinkData;if(t===null)return!0;if(t instanceof j)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 $e extends ae{NA=null;CA=null;zS=null;XS=null;Ss;GS;constructor(t){super(),this.name="Relinking",this.fromHandleArchetype=new et("Diamond",{desiredSize:st.Su,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:0}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.toHandleArchetype=new et("Diamond",{desiredSize:st.Su,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:-1}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.Ss=null,this.GS=new I,t&&Object.assign(this,t)}updateAdornments(t){if(t===null||!(t instanceof j))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.f())}i===null&&t.removeAdornment(e)}makeAdornment(t,e){let i=e?this.XS:this.zS;return i&&(i=i.copy(),i.adornedObject=t),i}get fromHandleArchetype(){return this.NA}set fromHandleArchetype(t){t!==null&&m.se(t,J,$e,"fromHandleArchetype"),this.NA=t,t!==null?this.zS=new vt(G.Link).add(t).It():this.zS=null}get toHandleArchetype(){return this.CA}set toHandleArchetype(t){t!==null&&m.se(t,J,$e,"toHandleArchetype"),this.CA=t,t!==null?this.XS=new vt(G.Link).add(t).It():this.XS=null}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof vt||m.o("new handle is not in an Adornment: "+t)),this.Ss=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowRelink||!t.model.Cx()||!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 vt)||!(s.adornedPart instanceof j))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.GS.set(e.actualBounds),e.pointsCount>0&&(e.fromNode===null&&(this.temporaryFromPort!==null&&(this.temporaryFromPort.desiredSize=st.bc),this.temporaryFromNode!==null&&(this.temporaryFromNode.location=e.getPoint(0))),e.toNode===null&&(this.temporaryToPort!==null&&(this.temporaryToPort.desiredSize=st.bc),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.$t(),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 $&&(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.$t()),this.transactionResult=this.name,t.T("LinkRelinked",o,this.isForwards?this.originalToPort:this.originalFromPort)):this.originalLink!==null&&this.doNoRelink(this.originalLink,this.isForwards),this.originalLink!==null&&this.originalLink.invalidateOtherJumpOvers(this.GS)}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 Ls=(x=>(x[x.None=0]="None",x[x.Horizontal=1]="Horizontal",x[x.Vertical=2]="Vertical",x[x.All=3]="All",x))(Ls||{});class Je extends $t{kr;YS;KS;Ss;Lx;HS;Em;constructor(t){super(),this.name="LinkReshaping",this.kr=new et("Rectangle",{desiredSize:st.RL,fill:"lightblue",stroke:"dodgerblue"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.YS=new et("Diamond",{desiredSize:st.Su,fill:"lightblue",stroke:"dodgerblue",cursor:"move"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.KS=3,this.Ss=null,this.Lx=null,this.HS=new P,this.Em=new q,t&&Object.assign(this,t)}static None=0;static Horizontal=1;static Vertical=2;static All=3;getReshapingBehavior(t){return t?t.Pr:0}setReshapingBehavior(t,e){t.Pr=e}updateAdornments(t){if(t===null||!(t instanceof j))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.qS!==t.pointsCount||e.jS!==t.resegmentable)&&(e=this.makeAdornment(i),e!==null&&(e.qS=t.pointsCount,e.jS=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 vt,o.type=G.Link;let r=e.firstPickIndex,a=e.lastPickIndex,h=n?1:0;if(e.resegmentable&&(e.computeCurve()!==9||e.isOrthogonal))for(let c=r+h;c<a-h;c++){let d=this.makeResegmentHandle(t,c);d!==null&&(d.segmentIndex=c,d.segmentFraction=.5,d.fromMaxLinks=999,o.add(d))}let l=r+1,u=a-1;for(;l<=u;)if(l<u)this.WS(t,o,r,a,l),this.WS(t,o,r,a,u),l++,u--;else if(l===u){this.WS(t,o,r,a,l);break}o.adornedObject=t}return o}WS(t,e,i,s,n){let o=t.part,r=o.isOrthogonal,a=this.makeHandle(t,n);if(a!==null){if(a.segmentIndex=n,n!==i)if(n===i+1&&r){let h=o.getPoint(i),l=o.getPoint(i+1);C.c(h.x,l.x)&&C.c(h.y,l.y)?(l=o.getPoint(i-1),C.c(h.x,l.x)?(this.setReshapingBehavior(a,2),a.cursor="n-resize"):C.c(h.y,l.y)&&(this.setReshapingBehavior(a,1),a.cursor="w-resize")):C.c(h.x,l.x)?(this.setReshapingBehavior(a,2),a.cursor="n-resize"):C.c(h.y,l.y)&&(this.setReshapingBehavior(a,1),a.cursor="w-resize")}else if(n===s-1&&r){let h=o.getPoint(s-1),l=o.getPoint(s);C.c(h.x,l.x)&&C.c(h.y,l.y)?(h=o.getPoint(s+1),C.c(h.x,l.x)?(this.setReshapingBehavior(a,2),a.cursor="n-resize"):C.c(h.y,l.y)&&(this.setReshapingBehavior(a,1),a.cursor="w-resize")):C.c(h.x,l.x)?(this.setReshapingBehavior(a,2),a.cursor="n-resize"):C.c(h.y,l.y)&&(this.setReshapingBehavior(a,1),a.cursor="w-resize")}else n===s||(this.setReshapingBehavior(a,3),a.cursor="move");e.add(a)}}makeHandle(t,e){let i=this.handleArchetype;return i===null?null:i.copy().JS()}get handleArchetype(){return this.kr}set handleArchetype(t){t!==null&&m.se(t,J,Je,"handleArchetype"),this.kr=t}makeResegmentHandle(t,e){let i=this.midHandleArchetype;return i===null?null:i.copy().JS()}get midHandleArchetype(){return this.YS}set midHandleArchetype(t){t!==null&&m.se(t,J,Je,"midHandleArchetype"),this.YS=t}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof vt||m.o("new handle is not in an Adornment: "+t)),this.Ss=t}get adornedLink(){return this.Lx}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 j){if(this.Lx=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.HS=e.getPoint(this.handle.segmentIndex),this.Em=e.points.copy(),this.isActive=!0}}doDeactivate(){this.stopTransaction(),this.handle=null,this.Lx=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.Em),this.stopTool()}getResegmentingPoint(){return this.handle===null?this.diagram.lastInput.documentPoint:this.handle.getDocumentPoint(T.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&&(i.computeCurve()!==9||i.isOrthogonal)){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(C.Nl(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.i(a)}}t.invalidateDocumentBounds(),this.transactionResult=this.name,t.T("LinkReshaped",this.adornedLink,this.Em)}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.KS}set resegmentingDistance(t){m.s(t,"number",Je,"resegmentingDistance"),this.KS=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);if(!t.equalsApprox(r)){let a=e.getPoint(o-2),h=e.getPoint(o-1),l=e.getPoint(o+1),u=e.getPoint(o+2);C.c(h.x,r.x)&&C.c(r.y,l.y)?(C.c(h.x,a.x)&&!C.c(h.y,a.y)&&!C.c(t.x,r.x)?(e.insertPointAt(o,t.x,h.y),s++,o++):e.setPointAt(o-1,t.x,h.y),C.c(l.y,u.y)&&!C.c(l.x,u.x)&&!C.c(t.y,r.y)?e.insertPointAt(o+1,l.x,t.y):e.setPointAt(o+1,l.x,t.y)):C.c(h.y,r.y)&&C.c(r.x,l.x)?(C.c(h.y,a.y)&&!C.c(h.x,a.x)&&!C.c(t.y,r.y)?(e.insertPointAt(o,h.x,t.y),s++,o++):e.setPointAt(o-1,h.x,t.y),C.c(l.x,u.x)&&!C.c(l.y,u.y)&&!C.c(t.x,r.x)?e.insertPointAt(o+1,t.x,l.y):e.setPointAt(o+1,t.x,l.y)):C.c(h.x,r.x)&&C.c(r.x,l.x)?(C.c(h.x,a.x)&&!C.c(h.y,a.y)&&!C.c(t.x,r.x)?(e.insertPointAt(o,t.x,h.y),s++,o++):e.setPointAt(o-1,t.x,h.y),C.c(l.x,u.x)&&!C.c(l.y,u.y)&&!C.c(t.x,r.x)?e.insertPointAt(o+1,t.x,l.y):e.setPointAt(o+1,t.x,l.y)):C.c(h.y,r.y)&&C.c(r.y,l.y)&&(C.c(h.y,a.y)&&!C.c(h.x,a.x)&&!C.c(t.y,r.y)?(e.insertPointAt(o,h.x,t.y),s++,o++):e.setPointAt(o-1,h.x,t.y),C.c(l.y,u.y)&&!C.c(l.x,u.x)&&!C.c(t.y,r.y)?e.insertPointAt(o+1,l.x,t.y):e.setPointAt(o+1,l.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(T.Center,P.l()),u=e.getLinkPointFromPoint(o,r,l,t,!0,P.l());e.setPointAt(0,u.x,u.y),P.i(l),P.i(u)}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(T.Center,P.l()),u=e.getLinkPointFromPoint(a,h,l,t,!1,P.l());e.setPointAt(e.pointsCount-1,u.x,u.y),P.i(l),P.i(u)}}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.HS}get originalPoints(){return this.Em}}class Ze extends $t{Sr;Mr;vo;Ic;$S;Ms;kr;Ss;Um;ZS;Ec;Ax;Tx;Dx;constructor(t){super(),this.name="Resizing",this.Sr=new st(1,1).k(),this.Mr=new st(9999,9999).k(),this.vo=new st(NaN,NaN).k(),this.Ic=!1,this.$S=!0,this.Ms=null,this.kr=new et("Rectangle",{alignmentFocus:T.Center,desiredSize:st.RL,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.Ss=null,this.Um=new P,this.ZS=new st,this.Ec=new P,this.Ax=new st(0,0),this.Tx=new st(1/0,1/0),this.Dx=new st(1,1),t&&Object.assign(this,t)}updateAdornments(t){if(t!==null){if(t.Nr()){let e=t.rotateObject;if(e===t||e===t.path||e.isPanelMain)return}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.Ul()&&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 vt,e.type=G.Spot,e.locationSpot=T.Center;let s=new le;s.isPanelMain=!0,e.add(s);let n=this.makeHandle(t,T.TopLeft);n!==null&&e.add(n),n=this.makeHandle(t,T.TopRight),n!==null&&e.add(n),n=this.makeHandle(t,T.BottomRight),n!==null&&e.add(n),n=this.makeHandle(t,T.BottomLeft),n!==null&&e.add(n),n=this.makeHandle(t,T.MiddleTop),n!==null&&e.add(n),n=this.makeHandle(t,T.MiddleRight),n!==null&&e.add(n),n=this.makeHandle(t,T.MiddleBottom),n!==null&&e.add(n),n=this.makeHandle(t,T.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().JS();return s.alignment=e,s}updateResizeHandles(t,e){if(t!==null){if(!t.alignment.isDefault()&&(t.cursor==="pointer"||t.cursor.indexOf("resize")>0))this.wR(t,e);else if(t instanceof G){let i=t.elements;for(;i.next();){let s=i.value;this.updateResizeHandles(s,e)}}}}wR(t,e){let i=t.alignment;i.isNoSpot()&&(i=T.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=C.Ee(s),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.kr}set handleArchetype(t){t!==null&&m.se(t,J,Ze,"handleArchetype"),this.kr=t}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof vt||m.o("new handle is not in an Adornment: "+t)),this.Ss=t}get adornedObject(){return this.Ms}set adornedObject(t){t!==null&&t.part instanceof vt&&m.o("new handle must not be in an Adornment: "+t),this.Ms=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.Iu=!0,this.startTransaction(this.name),this.Um.set(this.adornedObject.getDocumentPoint(this.handle.alignment.opposite())),this.Ec.set(this.adornedObject.part.location),this.ZS.set(this.adornedObject.desiredSize),this.Dx=this.computeCellSize(),this.Ax=this.computeMinSize(),this.Tx=this.computeMaxSize(),this.isActive=!0))}doDeactivate(){let t=this.diagram;t.Iu=!1,t.Fl=!0,this.stopTransaction(),this.handle=null,this.Ms=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.Ax,i=this.Tx,s=this.Dx,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.i(o)}doMouseUp(){let t=this.diagram;if(this.isActive&&this.adornedObject!==null&&this.handle!==null){let e=this.Ax,i=this.Tx,s=this.Dx,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.i(n),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.T("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 ht){let o=new q;o.add(s);let r;!this.dragsMembers&&!s.hasPlaceholder()&&(r=new Pi,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 I.tm;e.isNoSpot()&&(e=T.Center);let r=this.adornedObject.naturalBounds,a=r.x,h=r.y,l=r.x+r.width,u=r.y+r.height,c=1;if(!o){let p=r.width,g=r.height;p<=0&&(p=1),g<=0&&(g=1),c=g/p}let d=P.l();C._g(t.x,t.y,a,h,n.width,n.height,d);let f=r.copy();return e.x<=0?e.y<=0?(f.x=Math.max(d.x,l-s.width),f.x=Math.min(f.x,l-i.width),f.width=Math.max(l-f.x,i.width),f.y=Math.max(d.y,u-s.height),f.y=Math.min(f.y,u-i.height),f.height=Math.max(u-f.y,i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(c*f.width,s.height),i.height),f.width=f.height/c):(f.width=Math.max(Math.min(f.height/c,s.width),i.width),f.height=c*f.width),f.x=l-f.width,f.y=u-f.height)):e.y>=1?(f.x=Math.max(d.x,l-s.width),f.x=Math.min(f.x,l-i.width),f.width=Math.max(l-f.x,i.width),f.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(c*f.width,s.height),i.height),f.width=f.height/c):(f.width=Math.max(Math.min(f.height/c,s.width),i.width),f.height=c*f.width),f.x=l-f.width)):(f.x=Math.max(d.x,l-s.width),f.x=Math.min(f.x,l-i.width),f.width=l-f.x,o||(f.height=Math.max(Math.min(c*f.width,s.height),i.height),f.width=f.height/c,f.y=h+.5*(u-h-f.height))):e.x>=1?e.y<=0?(f.width=Math.max(Math.min(d.x-a,s.width),i.width),f.y=Math.max(d.y,u-s.height),f.y=Math.min(f.y,u-i.height),f.height=Math.max(u-f.y,i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(c*f.width,s.height),i.height),f.width=f.height/c):(f.width=Math.max(Math.min(f.height/c,s.width),i.width),f.height=c*f.width),f.y=u-f.height)):e.y>=1?(f.width=Math.max(Math.min(d.x-a,s.width),i.width),f.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(f.height/f.width>=1?(f.height=Math.max(Math.min(c*f.width,s.height),i.height),f.width=f.height/c):(f.width=Math.max(Math.min(f.height/c,s.width),i.width),f.height=c*f.width))):(f.width=Math.max(Math.min(d.x-a,s.width),i.width),o||(f.height=Math.max(Math.min(c*f.width,s.height),i.height),f.width=f.height/c,f.y=h+.5*(u-h-f.height))):e.y<=0?(f.y=Math.max(d.y,u-s.height),f.y=Math.min(f.y,u-i.height),f.height=u-f.y,o||(f.width=Math.max(Math.min(f.height/c,s.width),i.width),f.height=c*f.width,f.x=a+.5*(l-a-f.width))):e.y>=1&&(f.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(f.width=Math.max(Math.min(f.height/c,s.width),i.width),f.height=c*f.width,f.x=a+.5*(l-a-f.width))),P.i(d),f}computeReshape(){let t=0;return this.adornedObject instanceof et&&(t=this.adornedObject.QS()),!(t===6||this.diagram.lastInput.shift)}computeMinSize(){if(this.adornedObject===null)return st.bc;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 st.LP;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 st(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.Sr}set minSize(t){if(!this.Sr.equals(t)){let e=t.width;isNaN(e)&&(e=0);let i=t.height;isNaN(i)&&(i=0),this.Sr.e(e,i)}}get maxSize(){return this.Mr}set maxSize(t){if(!this.Mr.equals(t)){let e=t.width;isNaN(e)&&(e=1/0);let i=t.height;isNaN(i)&&(i=1/0),this.Mr.e(e,i)}}get cellSize(){return this.vo}set cellSize(t){this.vo.equals(t)||this.vo.h(t)}get isGridSnapEnabled(){return this.Ic}set isGridSnapEnabled(t){m.s(t,"boolean",Ze,"isGridSnapEnabled"),this.Ic=t}get dragsMembers(){return this.$S}set dragsMembers(t){m.s(t,"boolean",Ze,"dragsMembers"),this.$S=t}get oppositePoint(){return this.Um}set oppositePoint(t){this.Um.equals(t)||this.Um.h(t)}get originalDesiredSize(){return this.ZS}get originalLocation(){return this.Ec}}class De extends $t{_S;tM;Ms=null;kr=null;vx=null;Ss=null;eM;Vm;Ec;iM;sM;constructor(t){super(),this.name="Rotating",this._S=45,this.tM=2,this.Ec=new P,this.Ms=null,this.handleArchetype=new et("Ellipse",{desiredSize:st.Su,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.Ss=null,this.eM=0,this.Vm=new P(NaN,NaN),this.iM=0,this.sM=50,t&&Object.assign(this,t)}updateAdornments(t){if(t!==null){if(t.Nr()){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.vx!==null&&(e=this.vx.copy()),e===null?null:(e.adornedObject=t,e)}get handleArchetype(){return this.kr}set handleArchetype(t){t!==null&&m.se(t,J,De,"handleArchetype"),this.kr=t,t!==null?this.vx=new vt(G.Position,{locationSpot:T.Center}).add(t).It():this.vx=null}get handle(){return this.Ss}set handle(t){t!==null&&(t.part instanceof vt||m.o("new handle is not in an Adornment: "+t)),this.Ss=t}get adornedObject(){return this.Ms}set adornedObject(t){t!==null&&t.part instanceof vt&&m.o("new handle must not be in an Adornment: "+t),this.Ms=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.eM=this.adornedObject.angle,this.Vm=this.computeRotationPoint(this.adornedObject),this.Ec=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(T.Center)}computeAdornmentLocation(t){let e=this.rotationPoint;e.isReal()||(e=this.computeRotationPoint(t));let i=t.getLocalPoint(e),s=this.handleAngle;s=C.Ee(s),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.Ms=null,this.Vm=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.T("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.Ec.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=C.Ee(e);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)),C.Ee(e)}get snapAngleMultiple(){return this._S}set snapAngleMultiple(t){m.s(t,"number",De,"snapAngleMultiple"),this._S=t}get snapAngleEpsilon(){return this.tM}set snapAngleEpsilon(t){m.s(t,"number",De,"snapAngleEpsilon"),this.tM=t}get originalAngle(){return this.eM}get rotationPoint(){return this.Vm}set rotationPoint(t){this.Vm=t.copy()}get handleAngle(){return this.iM}set handleAngle(t){m.s(t,"number",De,"handleAngle"),this.iM=t}get handleDistance(){return this.sM}set handleDistance(t){m.s(t,"number",De,"handleDistance"),this.sM=t}}class Ds extends $t{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 Fs extends $t{Uc;constructor(t){super(),this.name="Action",this.Uc=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.Uc=i,t.vc=t.findObjectAt(e.documentPoint,null,null),!0):!1}doMouseDown(){if(!this.isActive)this.canStart()&&this.doActivate();else{let t=this.diagram.lastInput,e=this.Uc;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.Uc;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.Uc;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.Uc;e!==null&&(t.targetObject=e,e.actionCancel!==null&&e.actionCancel(t,e),this.stopTool())}doStop(){this.Uc=null}}class Qe extends $t{Vl;nM;Ic;oM;constructor(t){super(),this.name="ClickCreating",this.Vl=null,this.nM=!0,this.Ic=!1,this.oM=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.oM=t.lastInput.viewPoint.copy()),t.lastInput.clickCount!==2||this.isBeyondDragSize(this.oM))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.T("ChangingSelection",e.selection),this.startTransaction(this.name),i instanceof pt)i.Di()&&(i.It(),s=i.copy(),s!==null&&e.add(s));else if(i!==null){let n=e.model.copyNodeData(i);e.model.addNodeData(n),s=e.findPartForData(n)}if(s!==null){let n=P.z(t.x,t.y);this.isGridSnapEnabled&&this.diagram.rM(s,t,n),s.location=n,e.allowSelect&&(e.clearSelection(!0),s.isSelected=!0),P.i(n)}e.invalidateDocumentBounds(),this.transactionResult=this.name,e.T("PartCreated",s)}finally{this.stopTransaction(),e.T("ChangedSelection",e.selection)}return s}get archetypeNodeData(){return this.Vl}set archetypeNodeData(t){t!==null&&m.xc(t,Qe,"archetypeNodeData"),this.Vl=t}get isDoubleClick(){return this.nM}set isDoubleClick(t){m.s(t,"boolean",Qe,"isDoubleClick"),this.nM=t}get isGridSnapEnabled(){return this.Ic}set isGridSnapEnabled(t){m.s(t,"boolean",Qe,"isGridSnapEnabled"),this.Ic=t}}class ri extends $t{th;lM;Bl;constructor(t){super(),this.name="DragSelecting",this.th=175,this.lM=!1,this.Bl=new pt({layerName:"Tool",selectable:!1}).add(new et("Rectangle",{name:"SHAPE",fill:null,stroke:"magenta"}).theme("stroke","dragSelect")).It(),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=st.l().e(e.width,e.height);i!==null&&(i.desiredSize=s),this.box.Vc(e.x,e.y,!1),st.i(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.T("ChangingSelection",t.selection),this.selectInRect(this.computeBoxBounds()),t.T("ChangedSelection",t.selection)}finally{t.currentCursor=""}}this.stopTool()}computeBoxBounds(){let t=this.diagram;return new I(t.firstInput.documentPoint,t.lastInput.documentPoint)}selectInRect(t){let e=this.diagram,i=e.lastInput,s=e.findPartsIn(t,this.isPartialInclusion);if(m.hr?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 q,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.th}set delay(t){m.s(t,"number",ri,"delay"),this.th=t}get isPartialInclusion(){return this.lM}set isPartialInclusion(t){m.s(t,"boolean",ri,"isPartialInclusion"),this.lM=t}get box(){return this.Bl}set box(t){t!==null&&t.It(),this.Bl=t}}class ki extends $t{Fx;LA;Do;aM;constructor(t){super(),this.name="Panning",this.Fx=new P,this.LA=new P,this.Do=!1;let e=this;this.aM=()=>{let i=e.diagram;i!==null&&i.Le(K.document,"scroll",e.aM,!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.Do?(t.lastInput.bubbles=!0,t.Et(K.document,"scroll",this.aM,!1)):(t.currentCursor="move",t.isMouseCaptured=!0,this.Fx.h(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.Fx,t.isMouseCaptured=!1,this.stopTool()}doMouseMove(){this.AA()}doMouseUp(){this.AA(),this.stopTool()}AA(){let t=this.diagram;if(this.isActive&&t){if(this.Do){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.LA.e(n,o)}}get bubbles(){return this.Do}set bubbles(t){m.s(t,"boolean",ki,"bubbles"),this.Do=t}get originalPosition(){return this.Fx}}class fe{Rx;Ox;hM;cM;constructor(t){this.Rx=null,this.Ox=null,this.hM=null,this.cM=null,t&&Object.assign(this,t)}get mainElement(){return this.hM}set mainElement(t){t!==null&&m.se(t,HTMLElement,fe,"mainElement"),this.hM=t}get show(){return this.Rx}set show(t){this.Rx!==t&&(t!==null&&m.S(t,fe,"show"),this.Rx=t)}get hide(){return this.Ox}set hide(t){this.Ox!==t&&(t!==null&&m.S(t,fe,"hide"),this.Ox=t)}get valueFunction(){return this.cM}set valueFunction(t){this.cM=t}}class ce{ue;Ix;Bc;constructor(t,e,i){this.ue=t,this.Ix=e,this.Bc=i}}class It extends $t{fM;Ex;uM;dM;Ux;Vx;Bm;constructor(t){super(),this.name="ContextMenu",this.fM=null,this.Ex=null,this.uM=null,this.dM=new P,this.Ux=null,this.Bm=!1;let e=this;this.Vx=()=>e.stopTool(),t&&Object.assign(this,t)}xR(){let t=new fe;t.show=(r,a,h)=>h.showDefaultContextMenu(),t.hide=(r,a)=>a.hideDefaultContextMenu(),It.Bu=t;let e=this;this.Vx=()=>e.stopTool();let i=m.Ni("div"),s=m.Ni("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=m.Ni("style");K.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.Et(i,"contextmenu",It.oh,!1),o.Et(i,"selectstart",It.oh,!1),o.Et(s,"contextmenu",It.oh,!1)),i.className="goCXforeground",s.className="goCXbackground",K.document.body&&(K.document.body.appendChild(i),K.document.body.appendChild(s)),It.zm=i,It.Xm=s,It.gM=!0}static Bu=null;static gM=!1;static Xm;static zm;static oh(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.dM.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 Y||(t instanceof J?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 vt){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 vt){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 fe||(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;let i=!1;if(e instanceof Y){let s=this.diagram.lastInput;s.targetObject=null,i=this.oA(null,s,this.diagram)}else t&&this.standardMouseSelect(),i=this.standardMouseClick();if(this.Bm=!1,!i){this.isActive=!0;let s=It.Bu;if(e===null&&(e=this.findObjectWithContextMenu()),e!==null){let n=e.contextMenu;n!==null?(this.currentObject=e instanceof J?e:null,this.showContextMenu(n,this.currentObject)):s!==null&&this.showContextMenu(s,this.currentObject)}else s!==null&&this.showContextMenu(s,null);this.currentContextMenu instanceof vt&&!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){e!==null&&m.se(e,J,It,"showContextMenu:obj");let i=this.diagram;if(t!==this.currentContextMenu&&this.hideContextMenu(),t instanceof vt){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 fe&&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 vt?(t.remove(e),this.Ex!==null&&this.Ex.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof fe&&(e.hide!==null?e.hide(t,this):e.mainElement!==null&&(e.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())}bR(){let t=this,e=new q;return e.add(new ce("Copy",i=>i.commandHandler.copySelection(),i=>i.commandHandler.canCopySelection())),e.add(new ce("Cut",i=>i.commandHandler.cutSelection(),i=>i.commandHandler.canCutSelection())),e.add(new ce("Delete",i=>i.commandHandler.deleteSelection(),i=>i.commandHandler.canDeleteSelection())),e.add(new ce("Paste",i=>i.commandHandler.pasteSelection(t.mouseDownPoint),i=>i.commandHandler.canPasteSelection(t.mouseDownPoint))),e.add(new ce("Select All",i=>i.commandHandler.selectAll(),i=>i.commandHandler.canSelectAll())),e.add(new ce("Undo",i=>i.commandHandler.undo(),i=>i.commandHandler.canUndo())),e.add(new ce("Redo",i=>i.commandHandler.redo(),i=>i.commandHandler.canRedo())),e.add(new ce("Scroll To Part",i=>i.commandHandler.scrollToPart(),i=>i.commandHandler.canScrollToPart())),e.add(new ce("Zoom To Fit",i=>i.commandHandler.zoomToFit(),i=>i.commandHandler.canZoomToFit())),e.add(new ce("Reset Zoom",i=>i.commandHandler.resetZoom(),i=>i.commandHandler.canResetZoom())),e.add(new ce("Group Selection",i=>i.commandHandler.groupSelection(),i=>i.commandHandler.canGroupSelection())),e.add(new ce("Ungroup Selection",i=>i.commandHandler.ungroupSelection(),i=>i.commandHandler.canUngroupSelection())),e.add(new ce("Edit Text",i=>i.commandHandler.editTextBlock(),i=>i.commandHandler.canEditTextBlock())),e}showDefaultContextMenu(){let t=this.diagram;this.Ux===null&&(this.Ux=this.bR()),It.zm.innerHTML="",It.Xm.addEventListener("pointerdown",this.Vx,!1);let e=this,i=m.Ni("ul");i.className="goCXul",It.zm.appendChild(i),i.innerHTML="";let s=this.Ux.iterator;for(;s.next();){let n=s.value,o=n.Ix,r=n.Bc;if(!m.it(o)||m.it(r)&&!r(t))continue;let a=m.Ni("li");a.className="goCXli";let h=m.Ni("a");h.className="goCXa",h.href="#",h.Ix=o,h.addEventListener("pointerdown",function(l){return this.Ix(t),e.stopTool(),l.preventDefault(),!1},!1),h.textContent=n.ue,a.appendChild(h),i.appendChild(a)}It.zm.style.display="block",It.Xm.style.display="block"}hideDefaultContextMenu(){if(this.currentContextMenu===null||this.currentContextMenu!==It.Bu)return;It.zm.style.display="none",It.Xm.style.display="none";let t=this.diagram;t!==null&&t.Le(It.Xm,"pointerdown",this.Vx,!1),this.currentContextMenu=null}doMouseWheel(){this.standardMouseWheel()}get currentContextMenu(){return this.fM}set currentContextMenu(t){this.fM=t,this.Ex=t instanceof vt?t.adornedPart:null}get defaultTouchContextMenu(){return It.gM===!1&&It.Bu===null&&Y.isUsingDOM()&&this.xR(),It.Bu}set defaultTouchContextMenu(t){t===null&&(It.gM=!0),It.Bu=t}get currentObject(){return this.uM}set currentObject(t){t!==null&&m.se(t,J,It,"currentObject"),this.uM=t}get mouseDownPoint(){return this.dM}}var Os=(x=>(x[x.LostFocus=1]="LostFocus",x[x.MouseDown=2]="MouseDown",x[x.Tab=3]="Tab",x[x.Enter=4]="Enter",x))(Os||{}),Rs=(x=>(x[x.SingleClick=1]="SingleClick",x[x.SingleClickSelected=2]="SingleClickSelected",x[x.DoubleClick=3]="DoubleClick",x))(Rs||{}),Es=(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))(Es||{});class oe extends $t{vi;mM;pM;zl;Gt;yM;wM;xM;Bx;zx;constructor(t){super(),this.name="TextEditing",this.vi=new lt,this.mM=null,this.pM=2,this.zl=null,this.Gt=1,this.yM=1,this.wM=!0,this.xM=null,this.Bx=new fe,this.zx=null,this.kR(this.Bx),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;kR(t){if(!Y.isUsingDOM())return;let e=m.Ni("textarea");this.zx=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.PR(s)},!1),e.addEventListener("blur",function(s){i.SR(s)},!1),t.valueFunction=()=>e.value,t.mainElement=e,t.show=(s,n,o)=>{if(!(s instanceof lt)||!n||!n.div||!(o instanceof oe))return;if(o.state===5){e.style.border="3px solid red",e.focus();return}let r=s.getDocumentPoint(T.Center),a=n.position,h=n.scale,l=s.getDocumentScale()*h;l<o.minimumEditorScale&&(l=o.minimumEditorScale);let u=s.naturalBounds.width*l+6,c=s.naturalBounds.height*l+2,d=(r.x-a.x)*h,f=(r.y-a.y)*h,p=s.verticalAlignment,g=(s.lineHeight+s.spacingAbove+s.spacingBelow)*s.lineCount*l,y=.5*c-.5*g,b=p.y*c-p.y*g+p.offsetY-y-g/2;e.value=s.text,n.div.style.font=s.font;let v=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=u+"px",e.style.left=(d-u/2|0)-v+"px",e.style.top=(f+b|0)-v+"px",e.style.textAlign=s.textAlign,e.style.margin="0",e.style.padding=v+"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.mM}set textBlock(t){t!==null&&m.se(t,lt,oe,"textBlock"),this.mM=t}get currentTextEditor(){return this.xM}set currentTextEditor(t){this.xM=t}get defaultTextEditor(){return this.Bx}set defaultTextEditor(t){this.Bx=t}get starting(){return this.pM}set starting(t){this.pM=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly||oe.zc&&oe.zc!==this&&(oe.zc.acceptText(2),oe.zc&&oe.zc!==this)||!t.lastInput.left||this.isBeyondDragSize())return!1;let e=t.lastInput.documentPoint,i=t.findObjectAt(e);if(i===null||!(i instanceof lt)||!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(){oe.zc=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 lt)||(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.vi=this.textBlock.copy();let s=new I(this.textBlock.getDocumentPoint(T.TopLeft),this.textBlock.getDocumentPoint(T.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.TA());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.TA());break}}TA(){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.T("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(){oe.zc=null}PR(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.zx;this.Gt===2&&(this.Gt=3),m.it(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}SR(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.zx;m.it(e.focus)&&e.focus(),m.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.zl}set textValidation(t){t!==null&&m.S(t,oe,"textValidation"),this.zl=t}get minimumEditorScale(){return this.yM}set minimumEditorScale(t){t!==null&&m.s(t,"number",oe,"minimumEditorScale"),this.yM=t}get selectsTextOnActivate(){return this.wM}set selectsTextOnActivate(t){t!==null&&m.s(t,"boolean",oe,"selectsTextOnActivate"),this.wM=t}get state(){return this.Gt}set state(t){this.Gt!==t&&(this.Gt=t)}measureTemporaryTextBlock(t){let e=this.vi;return e.text=t,this.textBlock!==null&&e.ht(this.textBlock.Xl,1/0),e}static zc=null}var Is=(x=>(x[x.Default=1]="Default",x[x.AnimateLocations=2]="AnimateLocations",x[x.None=3]="None",x))(Is||{});class he{a;Ae;Be;Cr;$n;Fo;bM;kM;Gm;Xx;ke;Xc;xn;Ym;lh;Gx;Km;Yx;Gc;Uu;Hm;constructor(t){this.a=Y.Rm(),this.Ae=!1,this.Gm=!1,this.Xx=!1,this.ke=!1,this.Xc=!1,this.Yx=!0,this.Gc=1,this.Uu=!1,this.Be=!0,this.Cr=!0,this.Fo=600,this.bM=!1,this.kM=!1,this.$n=new V,this.xn=new ye,this.Ym=new ye,this.xn.Ns=this,this.lh=new V,this.Gx=new V,this.Km=new V,this.Hm=new V,t&&Object.assign(this,t)}Ro(t){this.a=t}FU(){return this.a}canStart(t){return!0}Gl(t){return!this.Be||!this.canStart(t)?!1:(this.$n.add(t),this.defaultAnimation.isAnimating&&this.stopAnimation(),this.a.Te(),this.ke=!0,!0)}getBundleAnimation(){return this.Ym}PM(){if(!this.Be||(this.Ym.yi.count>0&&this.Ym.start(),!this.ke))return;let t=this.xn,e=this.a,i=this.$n.has("Model");if(i&&(this.Xc=!0,this.Gc===1?(t.isViewportUnconstrained=!0,t.yi.clear(),t.add(e,"position",e.position.copy().offset(0,-200),e.position),t.add(e,"opacity",0,1)):this.Gc===3&&t.yi.clear(),this.Gc===2&&e.Kx.equals(e.ct)?this.Yx=!0:this.Yx=!1,e.T("InitialAnimationStarting",this)),i&&!this.Cr||t.yi.count===0){this.$n.clear(),this.ke=!1,t.yi.clear(),t.Hx(e),this.Xc=!1,e.C();return}this.$n.clear(),e.Lr=!1;let s=t.yi.get(e);e.autoScale!==1&&s!==null&&(delete s.ae.scale,delete s.Cs.scale);let n=this;K.requestAnimationFrame(()=>{n.ke===!1||t.Ae||(e.getRenderingHint("temporaryPixelRatio")&&e.Sx(),e.SM(),n.ke=!1,t.start(),t.Ae&&(n.zu(),e.invalidateDocumentBounds(),t.DA(0),e.br(!0),n.Xu(),e.T("AnimationStarting",n)))})}MM(){return this.$n.has("Trigger")&&this.$n.count===1}vA(t,e,i,s){this.isTicking||this.MM()||t instanceof j&&(t.fromNode!==null||t.toNode!==null)||this.xn.add(t,"position",e,i,s)}qx(t){return this.xn.qx(t)}NM(t){return this.xn.NM(t)}MR(t){let e=this.lh,i=this;function s(){if(i.Km.count>0&&(e.addAll(i.Km),i.Km.clear(),i.Ae=!0),i.Ae===!1||e.count===0){i.Xx=!1;return}i.Gx.addAll(e);let n=i.Gx.iterator;for(;n.next();){let o=n.value;o.Ae!==!1&&(o.NR()?o.FA(!1):o.Yc=!0)}if(i.Gx.clear(),i.Ae===!1){K.requestAnimationFrame(s);return}i.zu(),i.a.br(),i.Xu(),K.requestAnimationFrame(s)}this.Ae?this.RA(t):(this.Ae=!0,this.Xx?this.RA(t):(this.Xx=!0,e.add(t),K.requestAnimationFrame(()=>s())))}RA(t){this.Km.add(t)}CR(){let t=this.lh.iterator;for(;t.next();)t.value.Yc=!1}zu(){if(this.Gm)return;let t=this.a;this.bM=t.skipsUndoManager,this.kM=t.wi,t.skipsUndoManager=!0,t.wi=!0,this.Gm=!0}Xu(){let t=this.a;t.skipsUndoManager=this.bM,t.wi=this.kM,this.Gm=!1}stopAnimation(t){let e=this.xn;if(this.ke===!0&&(this.ke=!1,this.Xc=!1,this.$n.clear(),e.LR()&&this.a.requestUpdate()),!this.Ae){e.yi.clear(),e.Hx(this.a);return}if(e.Gu(!0),e.Hx(null),t===!0){let i=this.lh.toArray();for(let s=0;s<i.length;s++)i[s].Gu(!0)}}Gu(t){this.lh.delete(t),this.lh.count===0&&(this.Ae=!1,this.a.requestUpdate()),t===this.defaultAnimation&&this.a.T("AnimationFinished",this)}Kc(t,e){this.ke&&(!this.$n.has("Expand Tree")&&!this.$n.has("Expand SubGraph")||(this.xn.Kc(t,e),this.OA(t)))}Hc(t,e){this.ke&&(!this.$n.has("Collapse Tree")&&!this.$n.has("Collapse SubGraph")||(this.xn.Hc(t,e),this.xn.CM(e,"position",e.position,e.position),this.OA(t)))}IA(t,e){!this.ke||t.equals(e)||this.MM()||(this.a.Qa||(t=e.copy()),this.xn.CM(this.a,"position",t,e))}EA(t,e){this.ke&&(this.MM()||this.xn.add(this.a,"scale",t,e))}LM(t,e){t.Fi&&(t.Ar=e,this.Hm.add(t))}OA(t){let e=t.findLinksConnected();for(;e.next();){let i=e.value;i.Fi&&(i.Ar=i.points.copy(),this.Hm.add(i))}}get isEnabled(){return this.Be}set isEnabled(t){m.s(t,"boolean",he,"isEnabled"),this.Be=t,t&&this.lh.each(e=>{!e.isAnimating&&e.runCount===1/0&&e.start()})}get duration(){return this.Fo}set duration(t){m.s(t,"number",he,"duration"),t<1&&m.J(t,">= 1",he,"duration"),this.Fo=t}get isAnimating(){return this.Ae}get isTicking(){return this.Gm}get isInitial(){return this.Cr}set isInitial(t){m.s(t,"boolean",he,"isInitial"),this.Cr=t}get defaultAnimation(){return this.xn}get activeAnimations(){return this.lh}get initialAnimationStyle(){return this.Gc}set initialAnimationStyle(t){this.Gc=t}static jx=new Mt;static defineAnimationEffect(t,e){he.jx.set(t,e)}static AM(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],u=e[1],c=e[2],d=e[3];a===0||a===100?(o=l,r=u):(c===0||c===100)&&(l=o,u=r),Math.abs(l-o)>180&&(l>o?o+=360:l+=360);let f=n(i,o,l-o,s)%360,p=n(i,r,u-r,s),g=n(i,a,c-a,s),y=n(i,h,d-h,s);return"hsla("+f+", "+p+"%, "+g+"%, "+y+")"}static Default=1;static AnimateLocations=2;static None=3}{let x=he.jx,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.Vc(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.Vc(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.Vc(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,u=h.y+h.height/2-a.height/2;o<r?e.Vc(n(o,i.x,l-i.x,r),n(o,i.y,u-i.y,r),!1):e.position=new P(n(o,i.x,l-i.x,r),n(o,i.y,u-i.y,r))}),x.set("desiredSize",(e,i,s,n,o,r)=>{e.desiredSize=new st(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=he.AM(i,s,o,r,n)}),x.set("stroke",(e,i,s,n,o,r)=>{e.stroke=he.AM(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=he.AM(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 ye{Wx;qm;Ae;Yu;Fo;Ls;UA;qc;yi;Jx;ae;Zn;Ku;jc;$x;Zx;Yc;TM;Qx;Ns;a;DM;vM;FM;constructor(t){this.a=null,this.Ns=null,this.TM=null,this.Qx=null,this.DM=!1,this.Ae=!1,this.Yc=!1,this.ae=0,this.Zn=0,this.Wx=ye.EaseInOutQuad,this.qm=ye.EaseInOutQuad,this.Ku=!1,this.jc=!1,this.$x=1,this.Zx=0,this.Fo=NaN,this.Ls=NaN,this.vM=0,this.Yu=null,this.UA=P.dn,this.yi=new Mt,this.Jx=new Mt,this.qc=new V,this.FM=1,t&&Object.assign(this,t)}suspend(){this.Yc=!0}advanceTo(t,e){e&&(this.Yc=!1),this.Ku&&t>=this.Ls&&(this.jc=!0,t=t-this.Ls),this.vM=t,this.FA(!0),this.Ns.zu(),this.a.br(),this.Ns.Xu(),this.a.redraw()}Hx(t){if(this.Jx.clear(),this.jc=!1,this.Zx=0,this.Ls=NaN,this.qc.count>0&&this.qc.clear(),t!==null){let e=t.links;for(;e.next();)e.value.Ar=null}}LR(){return this.yi.count>0}start(){if(this.yi.count===0)return this;if(this.Ae)return this;let t=this.a,e=this.yi.iterator;for(;e.next();){let s=e.key;t===null&&(s instanceof Y?t=s:s instanceof J&&(t=s.diagram))}if(t!==null)this.a=t,this.Ns=t.animationManager;else return this;let i=this.Ns;return i.isEnabled===!1?this:(this.Ls=isNaN(this.Fo)?i.duration:this.Fo,this.qm=this.Wx,i.Xc&&i.Gc===1&&this===i.defaultAnimation&&(this.qm=ye.EaseOutExpo,this.Ls=isNaN(this.Fo)?i.duration===600?900:i.duration:this.Fo),this.FM=t.scrollMode,this.isViewportUnconstrained&&(t.ah=2),i.zu(),this.qc.each(s=>{s.data=null,t.add(s)}),i.Xu(),this.Ae=!0,this.ae=+new Date,this.Zn=this.ae+this.Ls,i.MR(this),this)}addTemporaryPart(t,e){return t.Di()?(this.qc.add(t),this.a=e,this):this}add(t,e,i,s,n){if(this.a===null&&(t instanceof Y?this.a=t:t instanceof J&&t.diagram!==null&&(this.a=t.diagram)),t instanceof pt){if(!t.isAnimated)return this;e==="position"&&(e="position:part")}return this.CM(t,e,i,s,n),this}CM(t,e,i,s,n){let o=this.yi,r,a,h;if(t instanceof Y&&e==="position"&&(e="position:diagram"),(e==="fill"||e==="stroke"||e==="background")&&(R.Oo(i),R.RM(),i=[R.ze.n0,R.ze.n1,R.ze.n2,R.ze.n3],R.Oo(s),R.RM(),s=[R.ze.n0,R.ze.n1,R.ze.n2,R.ze.n3]),o.has(t))r=o.get(t),a=r.ae,h=r.Cs,a[e]===void 0&&(a[e]=this.Hu(i)),h[e]=this.Hu(s);else{if(e==="position"&&i.equalsApprox(s))return;a={},h={},a[e]=this.Hu(i),h[e]=this.Hu(s),r=new Dn(a,h,n),o.set(t,r)}let l=a[e];l instanceof P&&!l.isReal()&&l.h(this.UA),n&&e.indexOf("position:")===0&&t instanceof pt?r._x.location=this.Hu(t.location):n&&(r._x[e]=this.Hu(i))}Hu(t){return t instanceof P||t instanceof st?t.copy():t}AR(t){let e=this.yi;if(e.has(t)){let i=e.get(t);i.tb=!0}}qx(t){if(!this.Ae)return!1;let e=this.yi.get(t);return e!==null&&e.tb}NM(t){if(!this.Ae)return!1;let e=this.yi.get(t);return e!==null&&!!(e.ae.position||e.ae["position:part"]||e.ae.location)}NR(){if(this.qc.count>0)return!0;let t=this.yi.iterator;for(;t.next();){let e=t.key;if(e instanceof J&&e.diagram!==null||e instanceof Y)return!0}return!1}FA(t){if(this.Yc&&!t)return;let e=this.Ns;if(this.Ae===!1)return;let i=+new Date,s=i>this.Zn?this.Ls:i-this.ae;t&&(s=this.vM,s<this.Ls?(this.ae=+new Date-s,this.Zn=this.ae+this.Ls):s=this.Ls),e.zu(),this.DA(s),this.a.br(!0),e.Xu(),i>this.Zn&&(this.Ku&&!this.jc?(this.ae=+new Date,this.Zn=this.ae+this.Ls,this.jc=!0):this.Gu(!1))}DA(t){let e=this.Ls,i=this.yi.iterator,s=this.jc;for(;i.next();){let n=i.key;if(n instanceof J&&n.diagram===null)continue;let o=i.value,r=s?o.Cs:o.ae,a=s?o.ae:o.Cs,h=he.jx;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.qm,t,e,this)}}stop(){return this.Ae?(this.Gu(!0),this):this}Gu(t){if(this.Qx!==null&&this.Qx.TR(this.TM),!this.Ae)return;let e=this.a,i=this.Ns;i.Xc=!1,this.Ae=!1,this.Yc=!1,i.zu();let s=this.yi,n=this.qc.iterator;for(;n.next();)e.remove(n.value);let o=this.Ku,r=s.iterator,a=he.jx;for(;r.next();){let l=r.key,u=r.value,c=o?u.Cs:u.ae,d=o?u.ae:u.Cs,f=u._x;for(let p in d)if(a.get(p)!==null){let g=p;u.eb&&(g==="position:nodeCollapse"||g==="position:placeholder")&&(g="position"),a.get(g)(l,c[p],f[p]!==void 0?f[p]:u.eb?c[p]:d[p],this.qm,this.Ls,this.Ls,this)}u.eb&&f.location!==void 0&&l instanceof pt&&(l.location=f.location),u.tb&&l instanceof pt&&l.Xe(!1)}this.Zx++;let h=!t&&this.$x>this.Zx;if(!h&&(this===i.Ym||this===i.defaultAnimation)&&this.yi.clear(),e.ib.clear(),e.mS(!1),e.invalidateDocumentBounds(),e.C(),e.br(!0),i.defaultAnimation===this){let l=i.Hm.iterator;for(;l.next();)l.value.DR();i.Hm.clear()}if(e.br(!0),this.isViewportUnconstrained&&(e.scrollMode=this.FM),i.Xu(),h){this.jc=!1,this.start();return}this.Hx(null),e.VA(),i.Gu(this),this.Yu&&this.Yu(this),e.requestUpdate()}Kc(t,e){let i=e.actualBounds,s=null;if(e instanceof ht&&(s=e.placeholder),s!==null&&s.visible){let n=s.getDocumentPoint(T.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 ht&&this.vR(t,e)}vR(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof $&&this.Kc(s,e)}}Hc(t,e){if(!t.isVisible())return;let i=null;if(e instanceof ht&&(i=e.placeholder),i!==null&&i.visible){let s=i.getDocumentPoint(T.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.AR(t),t instanceof ht&&this.FR(t,e)}FR(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof $&&this.Hc(s,e)}}get duration(){return this.Fo}set duration(t){m.s(t,"number",ye,"duration"),t<1&&m.J(t,">= 1",ye,"duration"),this.Fo=t}get reversible(){return this.Ku}set reversible(t){this.Ku=t}get runCount(){return this.$x}set runCount(t){t>0?this.$x=t:m.o("Animation.runCount value must be a positive integer.")}get finished(){return this.Yu}set finished(t){this.Yu!==t&&(t!==null&&m.S(t,ye,"finished"),this.Yu=t)}get easing(){return this.Wx}set easing(t){this.Wx=t}get isViewportUnconstrained(){return this.DM}set isViewportUnconstrained(t){this.DM=t}get isAnimating(){return this.Ae}getTemporaryState(t){let e=this.Jx.get(t);return e===null&&(e={},this.Jx.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 Dn{ae;Cs;_x;eb;tb;constructor(t,e,i){this.ae=t,this.Cs=e,this._x={},this.eb=i,this.tb=!1}}var Bs=(x=>(x[x.Default=1]="Default",x[x.Immediate=2]="Immediate",x[x.Bundled=3]="Bundled",x))(Bs||{});class ai{Ti;pn;qu;Wc;constructor(t,e,i){this.Ti=null,this.pn=t,this.qu=i||1,this.Wc=null,e!==void 0&&(this.Wc=e,i===void 0&&(this.qu=2))}copy(){let t=new ai(this.pn);t.qu=this.qu;let e=this.Wc;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.Wc=i}return t}get propertyName(){return this.pn}set propertyName(t){this.pn=t}get animationSettings(){return this.Wc}set animationSettings(t){this.Wc=t}RR(t){let e=this.Wc;e!==null&&(e.duration&&(t.duration=e.duration),e.finished&&(t.finished=e.finished),e.easing&&(t.easing=e.easing))}get startCondition(){return this.qu}set startCondition(t){this.qu=t}static Default=1;static Immediate=2;static Bundled=3}class Et{a;Pt;Zt;Tr;Yl;Kl;Hl;ql;jl;Wl;Jl;$l;Zl;Ql;_l;ta;Bc;ea;sb;jm;ju;Nt;constructor(t){V.Je(this),this.a=null,this.Nt=new q,this.Pt="",this.Zt=1,this.Tr=!1,this.Yl=!0,this.Kl=!0,this.Hl=!0,this.ql=!0,this.jl=!0,this.Wl=!0,this.Jl=!0,this.$l=!0,this.Zl=!0,this.Ql=!0,this._l=!0,this.ta=!0,this.Bc=!0,this.ea=!0,this.sb=!0,this.jm=!1,this.ju=[],t&&Object.assign(this,t)}OR(){let t=this.Nt;for(let e=0;e<t.length;e++)t.r[e].OM(null);t.clear(),this.ju.length=0}Ro(t){this.a=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.Nt.iterator;for(;a.next();){let l=a.value;l instanceof ht?n++:l instanceof $?s++:l instanceof j?o++:l instanceof vt?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.Nt.iterator;for(;l.next();){let u=l.value;h+=`
|
|
6
6
|
`+u.toString();let c=u.data;c!==null&&V.xs(c)&&(h+=" #"+V.xs(c)),u instanceof $?h+=" "+m.toString(c):u instanceof j&&(h+=" "+m.toString(u.fromNode)+" "+m.toString(u.toNode))}}return e+" "+this.Nt.count+": "+h}findObjectAt(t,e,i){if(e===void 0&&(e=null),i===void 0&&(i=null),this.ea===!1)return null;let s=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(s=!0);let n=P.l(),o=this.Nt.r,r=o.length;for(let a=r;a--;){let h=o[a];if(s===!0&&h.Ul()===!1||!h.isVisible())continue;n.h(t),n.Yi(h.Ws);let l=h.BA(n,e,i);if(l!==null&&(e!==null&&(l=e(l)),l!==null&&(i===null||i(l))))return P.i(n),l}return P.i(n),null}findObjectsAt(t,e,i,s){if(e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof q)&&!(s instanceof V)&&(s=new V),this.ea===!1)return s;let n=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(n=!0);let o=P.l(),r=this.Nt.r,a=r.length;for(let h=a;h--;){let l=r[h];if(n===!0&&l.Ul()===!1||!l.isVisible())continue;o.h(t),o.Yi(l.Ws);let u=l;l.zA(o,e,i,s)&&(e!==null&&(u=e(u)),u!==null&&(i===null||i(u))&&s.add(u))}return P.i(o),s}findObjectsIn(t,e,i,s,n){if(e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof q)&&!(n instanceof V)&&(n=new V),this.ea===!1)return n;let o=!1;this.diagram!==null&&this.diagram.viewportBounds.containsRect(t)&&(o=!0);let r=this.Nt.r,a=r.length;for(let h=a;h--;){let l=r[h];if(o===!0&&l.Ul()===!1||!l.isVisible())continue;let u=l;l.Wm(t,e,i,s,n)&&(e!==null&&(u=e(u)),u!==null&&(i===null||i(u))&&n.add(u))}return n}PS(t,e,i,s,n,o,r){if(this.ea===!1)return n;let a=this.Nt.r,h=a.length;for(let l=h;l--;){let u=a[l];if(r===!0&&u.Ul()===!1||!o(u)||!u.isVisible())continue;let c=u;u.Wm(t,e,i,s,n)&&(e!==null&&(c=e(c)),c!==null&&(i===null||i(c))&&n.add(c))}return n}findObjectsNear(t,e,i,s,n,o){if(i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof q||n instanceof V)&&(o=n),n=!0),!(o instanceof q)&&!(o instanceof V)&&(o=new V),this.ea===!1)return o;let r=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(r=!0);let a=P.l(),h=P.l(),l=this.Nt.r,u=l.length;for(let c=u;c--;){let d=l[c];if(r===!0&&d.Ul()===!1||!d.isVisible())continue;a.h(t),a.Yi(d.Ws),h.e(t.x+e,t.y),h.Yi(d.Ws);let f=d;d.XA(a,h,i,s,n,o)&&(i!==null&&(f=i(f)),f!==null&&(s===null||s(f))&&o.add(f))}return P.i(a),P.i(h),o}IM(){return this.Nt.r}rs(t,e){if(!this.visible)return;let i=this.Nt.r,s=i.length;if(s===0)return;let n=m.st(),o=m.st();for(let r=0;r<s;r++){let a=i[r];if(a.EM=r,a instanceof j){if(a.Fi===!1)continue}else if(a instanceof vt&&a.adornedPart!==null)continue;let h=a.actualBounds;a.isVisible()&&h.UL(e,10)?(a.rs(!0),n.push(a)):(a.rs(!1),a.adornments!==null&&a.adornments.count>0&&o.push(a))}for(let r=0;r<n.length;r++){let a=n[r];a.UM();let h=a.adornments;for(;h.next();){let l=h.value;l.ht(1/0,1/0),l.Ut(),l.rs(!0)}}for(let r=0;r<o.length;r++)o[r].UM();m.Z(n),m.Z(o)}Wu(t){let e=1;return this.Zt!==1&&(e=t.globalAlpha,t.globalAlpha=e*this.Zt),e}GA(t,e){for(let i=0;i<e;i++)t[i].Jc()}Ge(t,e,i){if(!this.visible||this.Zt===0||(i===void 0&&(i=!0),!i&&this.isTemporary))return;let s=this.Nt.r,n=s.length;if(n===0)return;t.Tr&&this.GA(s,n);let o=this.Wu(t),r=this.ju;r.length=0;let a=e.scale,h=I.l();for(let l=0;l<n;l++){let u=s[l];this.Jm(t,u,e,r,a,h,!0)}I.i(h),t.Tr&&this.GA(s,n),t.globalAlpha=o}RU(t,e,i){if(!this.visible||this.Zt===0)return;let s=this.Nt.r,n=s.length;if(n===0)return;let o=this.Wu(t),r=this.ju;r.length=0;let a=e.scale,h=I.l();for(let l=0;l<n;l++){let u=s[l];i.has(u)||this.Jm(t,u,e,r,a,h,!0)}I.i(h),t.globalAlpha=o}IR(t,e,i,s){if(!this.visible||this.Zt===0||!s&&this.isTemporary)return;let n=this.Nt.r,o=n.length;if(o===0)return;let r=this.Wu(t),a=this.ju;a.length=0;let h=e.scale,l=I.l();for(let u=0;u<o;u++){let c=n[u];i.has(c)&&this.Jm(t,c,e,a,h,l,!1)}I.i(l),t.globalAlpha=r}ER(t,e,i,s,n){if(!this.visible||this.opacity===0)return;let o=this.diagram.grid.part;if(!s&&this.isTemporary){if(n&&o.layer===this){let r=this.Wu(t);o.Ge(t,i),t.globalAlpha=r}}else{let r=this.Wu(t),a=i.scale,h=I.l(),l=this.Nt.r,u=l.length;for(let c=0;c<u;c++){let d=l[c];!n&&d===o||this.Jm(t,d,i,null,a,h,!1)}I.i(h),t.globalAlpha=r}}OU(t,e,i){if(!this.visible||this.Zt===0)return;let s=this.Wu(t),n=this.ju;n.length=0;let o=e.scale,r=I.l(),a=this.Nt.r,h=a.length,l=i.length;for(let u=0;u<h;u++){let c=a[u],d=c.hh(c.actualBounds);this.UR(d,i,l,o)&&this.Jm(t,c,e,n,o,r,!0)}I.i(r),t.globalAlpha=s}Jm(t,e,i,s,n,o,r){if(r&&!e.Ul()){t.removePartFromView(e);return}if(s!==null&&e instanceof j&&(e.isOrthogonal&&s.push(e),e.Fi===!1)){t.removePartFromView(e);return}let a=!1,h=e.containingGroup;for(;h!==null;)a?h.he!==null&&o.intersectRect(h.he):h.he!==null&&(a=!0,o.h(h.he)),h=h.containingGroup;let l=e.actualBounds,u=!1;if(a&&e.isVisible()){if(!o.intersectsRect(l)){t.removePartFromView(e);return}u=!o.containsRect(l)}u&&(t.save(),t instanceof re?t.partClipRect=o.copy():(t.beginPath(),t.rect(o.x,o.y,o.width,o.height),t.clip())),l.width*n>i.$m||l.height*n>i.$m?e.Ge(t,i):this.VR(t,e,i),u&&(t.restore(),t.clearContextCache(!0))}VR(t,e,i){if(t instanceof re){e.Ge(t,i);return}let s=e.actualBounds,n=e.naturalBounds;if(s.width===0||s.height===0||isNaN(s.x)||isNaN(s.y)||!e.isVisible())return;let o=e.v;if(e.background===null){e.bn(t,"rgba(0,0,0,0.3)",!0,!1,n,s),t.fillRect(s.x,s.y,s.width,s.height);return}if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),e.bn(t,e.background,!0,!1,n,s),t.fillRect(0,0,n.width/2,n.height/2),!o.DP()){let r=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*r,-o.m12*r,-o.m21*r,o.m11*r,r*(o.m21*o.dy-o.m22*o.dx),r*(o.m12*o.dx-o.m11*o.dy))}}UR(t,e,i,s){let n=2/s,o=4/s;for(let r=0;r<i;r++){let a=e[r];if(!(a.width===0||a.height===0)&&t.intersects(a.x-n,a.y-n,a.width+o,a.height+o))return!0}return!1}t(t,e,i,s,n){let o=this.diagram;o!==null&&o.raiseChangedEvent(2,t,this,e,i,s,n)}ch(t,e,i){let s=this.Nt;if(e.OM(this),t>=s.count)t=s.count;else if(s.elt(t)===e)return-1;s.insertAt(t,e),e.Zm(i);let n=this.diagram;return n!==null&&(i?n.C():n.ch(e)),this.nb(t,e),t}ri(t,e,i){if(!i&&e.layer!==this&&e.layer!==null)return e.layer.ri(t,e,i);let s=this.Nt;if(t<0||t>=s.length){if(t=s.indexOf(e),t<0)return-1}else if(s.elt(t)!==e&&(t=s.indexOf(e),t<0))return-1;e.Qm(i),s.removeAt(t);let n=this.diagram;return n!==null&&(i?n.C():n.ri(e)),e.OM(null),t}nb(t,e){t=this.BR(t,e),e instanceof ht&&this.zR(t,e),e.svg!==null&&e.svg.remove()}BR(t,e){let i=e.zOrder;if(isNaN(i))return t;let s=this.Nt,n=s.count;if(n<=1)return t;if(t<0&&(t=s.indexOf(e)),t<0)return-1;let o=t-1,r=NaN;for(;o>=0&&(r=s.elt(o).zOrder,!!isNaN(r));)o--;let a=t+1,h=NaN;for(;a<n&&(h=s.elt(a).zOrder,!!isNaN(h));)a++;if(!isNaN(r)&&r>i)for(;;){if(o===-1||r<=i)return o++,o===t?t:(s.removeAt(t),s.insertAt(o,e),o);for(r=NaN;--o>=0&&(r=s.elt(o).zOrder,!!isNaN(r)););}else if(!isNaN(h)&&h<i)for(;;){if(a===n||h>=i)return a--,a===t?t:(s.removeAt(t),s.insertAt(a,e),a);for(h=NaN;++a<n&&(h=s.elt(a).zOrder,!!isNaN(h)););}return t}zR(t,e){if(e===null||!isNaN(e.zOrder))return;this.XR(t,e);let i=e.containingGroup;i!==null&&this.nb(-1,i)}XR(t,e){if(e.memberParts.count===0)return;let i=-1,s=this.Nt.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];if(r===e&&(t=o,i>=0)||i<0&&r.containingGroup===e&&(i=o,t>=0))break}if(!(i<0)&&i<t){let o=this.Nt;o.removeAt(t),o.insertAt(i,e)}}get parts(){return this.Nt.iterator}get partsBackwards(){return this.Nt.iteratorBackwards}get diagram(){return this.a}get name(){return this.Pt}set name(t){m.s(t,"string",Et,"name");let e=this.Pt;if(e!==t){let i=this.diagram;if(i!==null){e===""&&m.o("Cannot rename default Layer to: "+t);let n=i.layers;for(;n.next();)n.value.name===t&&m.o("Layer.name is already present in this diagram: "+t)}this.Pt=t,this.t("name",e,t);let s=this.Nt.iterator;for(;s.next();){let n=s.value;n.layerName=this.Pt}}}get opacity(){return this.Zt}set opacity(t){let e=this.Zt;if(e!==t){m.s(t,"number",Et,"opacity"),(t<0||t>1)&&m.J(t,"0 <= value <= 1",Et,"opacity"),this.Zt=t;let i=this.diagram;i!==null&&i.C(),this.t("opacity",e,t)}}get isViewportAligned(){return this.jm}set isViewportAligned(t){let e=this.jm;e!==t&&(this.jm=t,this.diagram&&(this.YA(),this.diagram.C()),this.t("isViewportAligned",e,t),t&&(this.isInDocumentBounds=!1))}YA(){if(!this.jm)return;let t=this.diagram;if(t===null)return;let e=this.Nt.r,i=e.length,s=t.wt,n=t.xt;for(let o=0;o<i;o++){let r=e[o],a=r.naturalBounds.width,h=r.naturalBounds.height,l=r.alignment;(l.isDefault()||!l.isSpot())&&(l=T.BottomRight);let u=r.alignmentFocus;u.isDefault()&&(u=new T(l.x,l.y));let c=l.x*s+l.offsetX-(u.x*a+u.offsetX),d=l.y*n+l.offsetY-(u.y*h+u.offsetY),f=P.z(c,d);t.GR(f),r.Vc(f.x,f.y,!0),P.i(f),r.et=1/t.scale}}get isTemporary(){return this.Tr}set isTemporary(t){let e=this.Tr;e!==t&&(m.s(t,"boolean",Et,"isTemporary"),this.Tr=t,this.t("isTemporary",e,t))}get visible(){return this.Bc}set visible(t){let e=this.Bc;if(e!==t){m.s(t,"boolean",Et,"visible"),this.Bc=t;let i=this.Nt.iterator;for(;i.next();)i.value.Xe(t);let s=this.diagram;s!==null&&s.C(),this.t("visible",e,t)}}get pickable(){return this.ea}set pickable(t){let e=this.ea;e!==t&&(m.s(t,"boolean",Et,"pickable"),this.ea=t,this.t("pickable",e,t))}get isInDocumentBounds(){return this.sb}set isInDocumentBounds(t){let e=this.sb;e!==t&&(this.sb=t,this.diagram!==null&&this.diagram.invalidateDocumentBounds(),this.t("isInDocumentBounds",e,t))}get allowCopy(){return this.Yl}set allowCopy(t){let e=this.Yl;e!==t&&(m.s(t,"boolean",Et,"allowCopy"),this.Yl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.Kl}set allowDelete(t){let e=this.Kl;e!==t&&(m.s(t,"boolean",Et,"allowDelete"),this.Kl=t,this.t("allowDelete",e,t))}get allowTextEdit(){return this.Hl}set allowTextEdit(t){let e=this.Hl;e!==t&&(m.s(t,"boolean",Et,"allowTextEdit"),this.Hl=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.ql}set allowGroup(t){let e=this.ql;e!==t&&(m.s(t,"boolean",Et,"allowGroup"),this.ql=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.jl}set allowUngroup(t){let e=this.jl;e!==t&&(m.s(t,"boolean",Et,"allowUngroup"),this.jl=t,this.t("allowUngroup",e,t))}get allowLink(){return this.Wl}set allowLink(t){let e=this.Wl;e!==t&&(m.s(t,"boolean",Et,"allowLink"),this.Wl=t,this.t("allowLink",e,t))}get allowRelink(){return this.Jl}set allowRelink(t){let e=this.Jl;e!==t&&(m.s(t,"boolean",Et,"allowRelink"),this.Jl=t,this.t("allowRelink",e,t))}get allowMove(){return this.$l}set allowMove(t){let e=this.$l;e!==t&&(m.s(t,"boolean",Et,"allowMove"),this.$l=t,this.t("allowMove",e,t))}get allowReshape(){return this.Zl}set allowReshape(t){let e=this.Zl;e!==t&&(m.s(t,"boolean",Et,"allowReshape"),this.Zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Ql}set allowResize(t){let e=this.Ql;e!==t&&(m.s(t,"boolean",Et,"allowResize"),this.Ql=t,this.t("allowResize",e,t))}get allowRotate(){return this._l}set allowRotate(t){let e=this._l;e!==t&&(m.s(t,"boolean",Et,"allowRotate"),this._l=t,this.t("allowRotate",e,t))}get allowSelect(){return this.ta}set allowSelect(t){let e=this.ta;e!==t&&(m.s(t,"boolean",Et,"allowSelect"),this.ta=t,this.t("allowSelect",e,t))}}var Ii=(x=>(x[x.None=1]="None",x[x.Uniform=2]="Uniform",x[x.UniformToFill=3]="UniformToFill",x))(Ii||{}),Vs=(x=>(x[x.All=1]="All",x[x.NotDirected=2]="NotDirected",x[x.NotDirectedFast=3]="NotDirectedFast",x[x.NotUndirected=4]="NotUndirected",x[x.DestinationTree=5]="DestinationTree",x[x.SourceTree=6]="SourceTree",x))(Vs||{}),zs=(x=>(x[x.Document=1]="Document",x[x.Infinite=2]="Infinite",x))(zs||{}),Xs=(x=>(x[x.TreeParent=1]="TreeParent",x[x.AllParents=2]="AllParents",x[x.AnyParents=3]="AnyParents",x))(Xs||{});class Y{Ns;jt;VM;ob;Dr;Ju;rb;lb;ab;hb;cb;fb;fh;ah;ub;db;gb;ia;$c;vr;_m;pb;yb;$u;Qn;Fr;uh;Io;tp;Zc;ep;Qc;Zu;Rr;_n;BM;zM;wb;xb;XM;bb;GM;YM;KM;kb;ip;Or;Ir;Er;Ur;Vr;Br;Pb;zr;Sb;Xr;Gr;Yr;Kr;Mb;HM;Eo;qM;Nb;Cb;jM;Ce;WM;_c;JM;Hs;Uo;Be;Lb;Yl;Kl;Ab;Tb;Hl;ql;jl;Db;Wl;Jl;$l;Zl;Ql;_l;ta;vb;Fb;$M;Qu;_u;Rb;Ob;Ib;Eb;sp;Ub;Vb;Bb;Qt;KA;zb;HA;td;kn;to;li;eo;qA;sa;ZM;QM;np;Xb;ed;op;Gb;Hr;na;dh;_M;t2;rp;Yb;Kb;ls;sd;lp;nd;Vo;tf;ap;qr;gh;e2;hp;Ht;v;qi;Lr;Ye;As;i2;oa;jr;Fl;Wr;mh;ef;s2;od;ph;rd;Vt;ra;ct;et;ld;wt;xt;lt;sf;kx;Hb;yh;nf;qb;jb;cp;YR;KR;$e;Ol;$m;fp;o2;l2;jA;dp;HR;qR;jR;Wb;WR;JR;$R;wh;WA;la;xh;bh;kh;Ph;Eu;oh;Wt;Mt;of;KP;HP;vc;Zt;static Jb=null;static JA=new Mt;static a2;static h2=null;Iu;$b;Zb;ad;Qb;_b;gp;c2;mp;pp;yp;Kx;f2;u2;rf;wp;xp;constructor(t,e){if(Y.Kw||(Y.vP(),Y.Kw=!0),V.Je(this),Y.$A(this),this.Ht=!0,this.Mt=null,this.wt=0,this.xt=0,this.lt=null,Y.isUsingDOM()){let s=this,n=()=>{s.Le(K.document,"DOMContentLoaded",n,!1),s.setRTL()};K.document.body!==null?this.setRTL():s.Et(K.document,"DOMContentLoaded",n,!1)}this.sf=null,Y.d2("Model",ge);let i=this;return this.WM=s=>i.partManager.doModelDataChanged(s),this._c=s=>i.partManager.doModelChanged(s),this.qb=null,this.jb=null,this.ZA(),this.model=ut.g2(),this.themeManager=new Ge,this.Eo=!0,this.QA(),this.layout=new _t,this.Eo=!1,this.HR=null,this.qR=null,this.jR=null,this.Wb=null,this.WR=null,this.JR=null,this.$R=null,this.wh=null,this.WA=null,this.la=null,this.xh=null,this.bh=null,this.kh=null,this.Ph=null,this.Eu=()=>{},this.oh=null,this.nd=!1,this.of=new Fn(this),t!==void 0&&(typeof t=="string"||K.Element&&t instanceof Element?this.m2(t):e=t),e&&this.setProperties(e),this.Ht=!1,this.requestUpdate(),this}lR(){return this.lt!==null}get renderer(){return this.tf}set renderer(t){if(this instanceof hi)return;t===""&&(t="default");let e=t.toLowerCase(),i=this.tf;if(e===i)return;this.tf=e;let s=null;e==="default"||e==="canvas"?(s=this.Vo.get("svg"),s!==null&&s.bt.remove(),this.lt&&(this.Wt=this.lt._t,this.Wt.clearContextCache(!0))):e==="svg"?(this.Vo.has("svg")?s=this.Vo.get("svg"):(s=new ui(this,K.document),this.addRenderer("svg",s)),this.div!==null&&(s.bt.role="img",this.div.appendChild(s.bt)),this.lt&&(this.Wt=s._t,this.lt._t.setTransform(this.$e,0,0,this.$e,0,0),this.lt._t.clearRect(0,0,this.wt,this.xt))):e==="debug"&&(this.Vo.has("SVG")||(s=new ui(this,K.document),this.addRenderer("SVG",s),s.bt.style.backgroundColor="whitesmoke",this.div!==null&&this.div.after(s.bt))),this.Ht||this.redraw()}ZA(){if(this.rf=new q,this.setupRouters(),this.Ns=new he,this.Ns.Ro(this),this.jt=17,this.VM=!1,this.ld=!1,this.ob="default",this.Vt=new q,this.Vo){let t=this.Vo.get("svg");t!==null&&t.bt.remove(),this.lt&&(this.Wt=this.lt._t,this.Wt.clearContextCache(!0))}this.Vo=new Mt,this.tf="default",this.resetRenderingHints(),this.ZR(),this.Zt=1,this.ct=new P(NaN,NaN).k(),this.Kx=new P(NaN,NaN),this.et=1,this.hp=1,this.rb=new P(NaN,NaN).k(),this.lb=NaN,this.ab=1e-4,this.hb=100,this.v=new Nt,this.cb=new P(NaN,NaN).k(),this.fb=new I(NaN,NaN,NaN,NaN).k(),this.fh=new Dt(0,0,0,0).kt(),this.ah=1,this.ub=!1,this.db=null,this.gb=null,this.ia=1,this.$c=T.Default,this.vr=1,this._m=T.Default,this.pb=T.None,this.yb=T.None,this.qi=!0,this.$u=!1,this.Qn=new Set,this.Fr=new V,this.uh=new V,this.Io=!1,this.ra=new Mt,this.od=!0,this.tp=250,this.Zc=-1,this.ep=new Dt(16,16,16,16).kt(),this.Lr=!1,this.Qc=!1,this.Zu=!0,this.ap=new Qt,this.ap.diagram=this,this.qr=new Qt,this.qr.diagram=this,this.gh=new Qt,this.gh.diagram=this,this.Rr=null,this._n=null,this.kx=!1,this.QR(),this.Wr=new V,this.wb=!0,this.xb=1,this.XM=!1,this.bb=1,this.kb="auto",this.ip="auto",this.Or=null,this.Ir=null,this.Er=null,this.Ur=null,this.Vr=null,this.Br=null,this.Pb=null,this.zr=null,this.Sb=!1,this.Xr=null,this.Gr=null,this.Yr=null,this.Kr=null,this.Mb=!1,this.Hb={},this.yh=[null,null],this.Eo=!1,this.qM=!1,this.Nb=!1,this.Cb=!1,this.jM=!0,this.As=!1,this.ph=!1,this.JM=!0,this.Hs=-2,this.oa=new Mt,this.rd=new q,this.Uo=!1,this.Be=!0,this.Lb=!0,this.Yl=!0,this.Kl=!0,this.Ab=!1,this.Tb=!0,this.Hl=!0,this.ql=!0,this.jl=!0,this.Db=!0,this.Wl=!0,this.Jl=!0,this.$l=!0,this.Zl=!0,this.Ql=!0,this._l=!0,this.ta=!0,this.vb=!0,this.Fb=!0,this.$M=!1,this.nf=!1,this.Qu=!0,this._u=!0,this.Rb=!0,this.Ob=!0,this.Ib=16,this.Eb=16,this.sp=!1,this.Ub=!1,this.Vb=0,this.Bb=0,this.Qt=new Dt(5).kt(),this.KA=new V().k(),this.zb=999999999,this.HA=new V().k(),this.mh=!0,this.td=!0,this.ef=!0,this.kn=!1,this.to=!1,this.jr=!0,this.Fl=!1,this.eo=!1,this.qA=new V,this.s2=new V,this.sa=null,this.ZM=new st(j._A,j.tT),this.QM=999,this.np=!1,this.KP=1,this.HP=0,this.Ye={scale:1,position:new P,bounds:new I,canvasSize:new st,newCanvasSize:new st,isScroll:!1},this.Ye.canvasSize=this.Ye.canvasSize,this.Ye.newCanvasSize=this.Ye.newCanvasSize,this.Ye.isScroll=!1,this.Xb=new I(NaN,NaN,NaN,NaN).k(),this.ed=new st(NaN,NaN).k(),this.op=new I(NaN,NaN,NaN,NaN).k(),this.Gb=!1,this.wp=null,this.xp=null,this._R(),this.ls=null,this.sd=!1,this.vc=null,this.partManager=new ge,this.toolManager=new ne,this.toolManager.initializeStandardTools(),this.defaultTool=this.toolManager,this.currentTool=this.defaultTool,this.Zb=null,this.ad=new Pi,this.Qb=null,this._b=null,this.$b=!1,this.Iu=!1,this.commandHandler=new jt,this.pp=null,this.yp=P.gn,this.f2=!1,this.$e=1,this.Ol=null,this.$m=1,this.gp=0,this.c2=[0,0,0,0,0],this.mp=0,this.fp=1,this.o2=0,this.l2=new P,this.jA=500,this.lp=new P,this.dp=!1}static eT=K.document!==void 0;static isUsingDOM(){return Y.eT}static setDocument(t){K.document=t}static useDOM(t){Y.eT=t?K.document!==void 0:!1}static ji=new WeakMap;clear(){this.animationManager.stopAnimation(),this.model.clear(),Y.iT(),this.sT(!1),this.rd.clear(),this.nT(),this.sa=null,this.invalidateDocumentBounds(),this.ensureBounds(),this.C()}sT(t){this.animationManager.stopAnimation(!0),this.clearSelection(),this.clearHighlighteds();let e=this.skipsUndoManager,i=this.Ce!==null&&this.Ce!==void 0;i&&(this.skipsUndoManager=!0);let s=null;this.ls!==null&&(s=this.ls.part,s!==null&&this.remove(s));let n=[],o=this.Vt.length;if(t){for(let r=0;r<o;r++){let a=this.Vt.r[r].parts;for(;a.next();){let h=a.value;h!==s&&h.data===null&&n.push(h)}}for(let r=0;r<n.length;r++){let a=n[r];this.remove(a)}}for(let r=0;r<o;r++)this.Vt.r[r].OR();return this.partManager.clear(),this.Qn.clear(),this.Fr.clear(),this.uh.clear(),this.ra.clear(),this.Wr.clear(),this.vc=null,this.rd.clear(),this.nT(),m.MP=[],s!==null&&(this.add(s),this.partManager.parts.delete(s)),i&&(this.skipsUndoManager=e),n}static bp=null;static t1="";static iT(){Y.bp=null,Y.t1=""}static IU(){return null}reset(){this.clear(),this.Ht=!0,this.ZA(),this.themeManager=new Ge,this.aa(),this.Eo=!0,this.QA(),this.layout=new _t,this.Eo=!1,this.model=ut.g2(),this.model.undoManager=new vi,this.nd=!1,this.Ht=!1,this.C()}_R(){this.Hr=new Mt,this._M=new $().add(new lt({stroke:"black",font:"10pt sans-serif"}).bind("text","",m.toString).theme("stroke","text").theme("font","normal")),this.Hr.set("",this._M),this.Hr.set("Comment",new $().add(new lt({stroke:"brown",font:"10pt sans-serif"}).bind("text","",m.toString).theme("stroke","comment").theme("font","normal"))),this.Hr.set("LinkLabel",new $({selectable:!1,avoidable:!1}).add(new et("Ellipse",{fill:"black",stroke:null,desiredSize:new st(3,3).kt()}).theme("fill","link"))),this.dh=new Mt,this.i2=new ht(G.Vertical,{selectionObjectName:"GROUPPANEL"}).add(new lt({stroke:"black",font:"bold 12pt sans-serif"}).bind("text","",m.toString).theme("stroke","text").theme("font","bold"),new G(G.Auto,{name:"GROUPPPANEL"}).add(new et({fill:"rgba(128,128,128,0.2)",stroke:"black",strokeWidth:1}).theme("fill","group").theme("stroke","outline").theme("strokeWidth","group"),new le({padding:5}).theme("padding","group"))),this.dh.set("",this.i2),this.na=new Mt,this.t2=new j().add(new et({isPanelMain:!0,stroke:"black"}).theme("stroke","link"),new et({toArrow:"Standard",fill:"black",stroke:null,strokeWidth:0}).theme("toArrow").theme("fill","link")),this.na.set("",this.t2),this.na.set("Comment",new j().add(new et({isPanelMain:!0,stroke:"brown"}).theme("stroke","comment"))),this.rp=new vt(G.Auto).add(new et({fill:null,stroke:"dodgerblue",strokeWidth:3}).theme("stroke","selection").theme("strokeWidth","selection"),new le({margin:1.5}).theme("margin","selection","numbers",null,t=>t?new Dt(t/2):1.5)).freezeBindings(),this.Yb=this.rp,this.Kb=new vt(G.Link).add(new et({isPanelMain:!0,fill:null,stroke:"dodgerblue",strokeWidth:3}).theme("stroke","selection").theme("strokeWidth","selection")).freezeBindings()}setRTL(t){let e=t===void 0?this.div:t;e===null&&(e=K.document.body);let i=m.Ni("div");i.dir="rtl",i.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;",i.textContent="A",e.appendChild(i);let s="reverse";i.scrollLeft>0?s="default":(i.scrollLeft=1,i.scrollLeft===0&&(s="negative")),e.removeChild(i),this.ob=s}setScrollWidth(t){let e=t===void 0?this.div:t;e===null&&(e=K.document.body);let i=0;if(Y.isUsingDOM()){let s=Y.h2,n=Y.a2;s===null&&(Y.h2=m.Ni("p"),s=Y.h2,s.style.width="100%",s.style.height="200px",s.style.boxSizing="content-box",Y.a2=m.Ni("div"),n=Y.a2,n.style.position="absolute",n.style.visibility="hidden",n.style.width="200px",n.style.height="150px",n.style.boxSizing="content-box",n.appendChild(s)),n.style.overflow="hidden",e.appendChild(n);let o=s.offsetWidth;n.style.overflow="scroll";let r=s.offsetWidth;o===r&&(r=n.clientWidth),e.removeChild(n),i=o-r,i===0&&!m.hr&&(i=11)}this.jt=i,this.VM=!0}fe(t){t in Ii?this.autoScale=t:m.cr(this,t)}toString(t){t===void 0&&(t=0);let e="";this.div&&this.div.id&&(e=this.div.id);let i='Diagram "'+e+'"';if(t<=0)return i;let s=this.Vt.iterator;for(;s.next();){let n=s.value;i+=`
|
|
7
|
-
`+n.toString(t-1)}return i}static $A(t){Y.Jb=t}static Rm(){return Y.Jb}static fromDiv(t){let e=t;if(typeof t=="string"&&(e=K.document.getElementById(t)),e instanceof HTMLDivElement){let i=Y.ji.get(e);if(i)return i}return null}get div(){return this.Mt}set div(t){if(t!==null&&m.se(t,HTMLDivElement,Y,"div"),this.Mt!==t){let e=this.Mt;if(e!==null){if(Y.ji.delete(e),e.goDiagram=void 0,e.go=void 0,e.innerHTML="",this.lt!==null){let s=this.lt.bt;this.Le(s,"pointermove",this.xh,!1),this.Le(s,"pointerdown",this.la,!1),this.Le(s,"pointerup",this.bh,!1),this.Le(s,"pointerout",this.kh,!1),this.Le(s,"pointercancel",this.Ph,!1),this.lt.dispose()}this.sf&&(this.sf.disconnect(),this.sf=null);let i=this.toolManager;i!==null&&(i.mouseDownTools.each(s=>s.cancelWaitAfter()),i.mouseMoveTools.each(s=>s.cancelWaitAfter()),i.mouseUpTools.each(s=>s.cancelWaitAfter())),i.cancelWaitAfter(),this.currentTool.doCancel(),this.lt=null,this.Le(K,"resize",this.Wb,!1),this.Le(K,"wheel",this.wh,!0),Y.Rm()===this&&Y.$A(null)}else this.la===null&&(this.eo=!1);if(this.Mt=null,t!==null){let i=Y.ji.get(t);i&&(i.div=null),this.m2(t),this.Eu(),this.themeManager&&this.themeManager.tO()}else this.themeManager&&this.themeManager.eO()}}setupRouters(){this.rf.push(new _n)}m2(t){let e=this;if(!Y.isUsingDOM())return;t==null&&m.o("Diagram setup requires an argument DIV."),e.Mt!==null&&m.o("Diagram has already completed setup."),typeof t=="string"?e.Mt=K.document.getElementById(t):t instanceof HTMLDivElement?e.Mt=t:m.o("No DIV or DIV id supplied: "+t),e.Mt===null&&m.o("Invalid DIV id; could not get element with id: "+t);let i=Y.ji.get(e.Mt);if(i&&i!==this&&m.o("Invalid div id; div already has a Diagram associated with it."),!e.sf&&K.ResizeObserver){let u=K.ResizeObserver,c=m.SP(()=>e.requestUpdate(),250,!1);e.sf=new u(()=>c()),e.sf.observe(e.Mt)}K.getComputedStyle(e.Mt,null).position==="static"&&(e.Mt.style.position="relative");let s=5,n="rgba(2"+s+"5, 255, 255, 0)";s--,e.Mt.style["-webkit-tap-highlight-color"]=n,e.Mt.innerHTML="",Y.ji.set(e.Mt,e),e.Mt.goDiagram=e,e.Mt.go=K.go;let o=new Fe(e);o.style!==void 0&&(o.style.position="absolute",o.style.top="0px",o.style.left="0px",K.getComputedStyle(e.Mt,null).getPropertyValue("direction")==="rtl"&&(e.ld=!0),o.style.zIndex="2",o.style.userSelect="none",o.style.MozUserSelect="none",o.style.touchAction="none",o.style.letterSpacing="normal !important",o.style.wordSpacing="normal !important",o.style.lang="unknown"),o.bt.setAttribute("role","application"),e.lt=o,e.Wt=o._t;let r=e.Wt;e.$e=e.computePixelRatio(),e.viewSize.isReal()||(e.wt=e.Mt.clientWidth||1,e.xt=e.Mt.clientHeight||1),e.oT(e.wt,e.xt);let a=e;e.Mt.insertBefore(o.bt,e.Mt.firstChild);let h=new Fe(null);if(h.width=1,h.height=1,e.YR=h,e.KR=h._t,Y.isUsingDOM()){let u=m.Ni("div"),c=m.Ni("div");u.style.position="absolute",u.style.overflow="auto",u.style.width=e.wt+"px",u.style.height=e.xt+"px",u.style.zIndex="1",c.style.position="absolute",c.style.width="1px",c.style.height="1px",e.Mt.appendChild(u),u.appendChild(c),u.onscroll=Y.iO,u.addEventListener("pointerdown",Y.sO),u.a=e,u.nO=!0,u.oO=!0,e.qb=u,e.jb=c}e.Eu=m.SP(()=>{e.Ol=null,e.C()},300,!1),e.Wb=m.SP(()=>{e.SM()},250,!1),e.oh=u=>(u.preventDefault(),!1),e.wh=u=>{if(!a.isEnabled)return;let c=a.lf(u,!0);c.bubbles=!0;let d=0,f=0;c.delta=0,u.deltaX!==void 0?(u.deltaX!==0&&(d=u.deltaX>0?1:-1),u.deltaY!==0&&(f=u.deltaY>0?1:-1),c.delta=Math.abs(u.deltaX)>Math.abs(u.deltaY)?-d:-f):u.wheelDeltaX!==void 0?(u.wheelDeltaX!==0&&(d=u.wheelDeltaX>0?-1:1),u.wheelDeltaY!==0&&(f=u.wheelDeltaY>0?-1:1),c.delta=Math.abs(u.wheelDeltaX)>Math.abs(u.wheelDeltaY)?-d:-f):u.wheelDelta!==void 0&&u.wheelDelta!==0&&(c.delta=u.wheelDelta>0?1:-1),a.doMouseWheel(),a.Sh(c,u)},e.WA=u=>{if(!a.isEnabled)return;e.nf=!1,a.lf(u,!0);let c=a.currentTool;c.cancelWaitAfter(),c.standardMouseOver()},e.la=u=>{if(!a.isEnabled)return;e.nf=!0;let c=a.Hb;c[u.pointerId]===void 0&&(c[u.pointerId]=u);let d=a.yh,f=!1;if(d[0]!==null&&(d[0].pointerId===u.pointerId||d[0].pointerType!==u.pointerType))d[0]=u;else if(d[1]!==null&&d[1].pointerId===u.pointerId)d[1]=u,f=!0;else if(d[0]===null)d[0]=u;else if(d[1]===null)d[1]=u,f=!0;else{u.preventDefault();return}let p=u.pointerType==="touch"||u.pointerType==="pen";p&&(a.kx=!1,a.dp=!0);let g=a.rO(u,u,f),y=a.l2,b=p?25:10;if(u.timeStamp-a.o2<a.jA&&!(Math.abs(y.x-u.screenX)>b||Math.abs(y.y-u.screenY)>b)?a.fp++:a.fp=1,g.clickCount=a.fp,a.o2=u.timeStamp,a.l2.setTo(u.screenX,u.screenY),a.doMouseDown(),u.button===1){u.preventDefault();return}a.Sh(g,u)},e.xh=u=>{if(!a.isEnabled)return;e.nf=!0;let c=a.yh;if(c[0]!==null&&(c[0].pointerId===u.pointerId||c[0].pointerType!==u.pointerType))c[0]=u;else if(c[1]!==null&&c[1].pointerId===u.pointerId){c[1]=u;return}else if(c[0]===null)c[0]=u;else return;if(c[0].pointerId!==u.pointerId)return;let d=a.lO(u,u,c[1]!==null);a.doMouseMove(),a.Sh(d,u)},e.bh=u=>{if(!a.isEnabled)return;e.nf=!0;let c=u.pointerType==="touch"||u.pointerType==="pen",d=a.Hb;if(c&&a.kx){delete d[u.pointerId],u.preventDefault();return}let f=a.yh;if(f[0]!==null&&(f[0].pointerId===u.pointerId||f[0].pointerType!==u.pointerType))f[0]=null;else if(f[1]!==null&&f[1].pointerId===u.pointerId){f[1]=null;return}else return;let p=a.p2(u,!1,!0,!1,!0,!1),g=K.document.elementFromPoint(u.clientX,u.clientY)||null;g!==null&&g.shadowRoot&&(g=g.shadowRoot.elementFromPoint(u.clientX,u.clientY)||null),g!==null&&g.a instanceof Y&&g.a!==a&&g.a.kp(u,p),g===null&&(g=u.target),a.kp(u,p),p.clickCount=a.fp,p.targetDiagram=a.e1(u,g),p.targetObject=null,a.doMouseUp(),a.Sh(p,u),c&&(a.dp=!1)},e.kh=u=>{if(!a.isEnabled)return;e.nf=!1;let c=a.Hb;c[u.pointerId]&&delete c[u.pointerId];let d=a.yh;if(d[0]!==null&&d[0].pointerId===u.pointerId&&(d[0]=null),d[1]!==null&&d[1].pointerId===u.pointerId&&(d[1]=null),u.pointerType==="touch"||u.pointerType==="pen")return;let f=a.currentTool;f.cancelWaitAfter(),f.standardMouseOver()},e.Ph=u=>{let c=a.yh;c[0]!==null&&c[0].pointerId===u.pointerId?(c[0]=null,a.dp=!1):c[1]!==null&&c[1].pointerId===u.pointerId&&(c[1]=null)};let l=r;if(e.cp=l.F[m.We("7eba17a4ca3b1a8346")][m.We("78a118b7")](l.F,Y.Mh,s,s),r.clearContextCache(!0),e.aO(),this.tf==="svg"){let u=this.Vo.get("svg");this.Mt&&this.Mt.appendChild(u.bt),this.Wt=u._t}}addEventListener(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}Et(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}removeEventListener(t,e,i,s){t.removeEventListener(e,i,{capture:s})}Le(t,e,i,s){t.removeEventListener(e,i,{capture:s})}aO(){let t=this,e=this.lt.bt;e instanceof HTMLCanvasElement||(e=t.div),this.Et(e,"pointerdown",t.la,!1),this.Et(e,"pointermove",t.xh,!1),this.Et(e,"pointerup",t.bh,!1),this.Et(e,"pointerout",t.kh,!1),this.Et(e,"pointercancel",t.Ph,!1),this.Et(e,"pointerenter",t.hO,!1),this.Et(e,"pointerleave",t.cO,!1),this.Et(e,"wheel",t.wh,!1),this.Et(e,"keydown",t.fO,!1),this.Et(e,"keyup",t.uO,!1),this.Et(e,"blur",t.dO,!1),this.Et(e,"focus",t.gO,!1),this.Et(e,"selectstart",i=>(i.preventDefault(),!1),!1),this.Et(e,"contextmenu",i=>(i.preventDefault(),!1),!1),this.Et(K,"resize",t.Wb,!1)}Sx(){this.gp>30&&(this.Ol=1)}mS(t){this.Ol!==null&&(this.Ol=null,t&&this.Eu(),this.gp=0,this.c2=[0,0,0,0,0],this.mp=0)}computePixelRatio(){return this.Ol!==null?this.Ol:K.devicePixelRatio||1}get avgSpf(){return this.gp}doMouseDown(){this.currentTool.doMouseDown()}doMouseMove(){this.currentTool.doMouseMove()}doMouseUp(){this.currentTool.doMouseUp()}doMouseWheel(){this.currentTool.doMouseWheel()}doKeyDown(){let t=this.commandHandler;if(!this.toggleKeyboardControl()){if((t.isFocusEnabled||t.isVirtualPointerEnabled)&&t.doVirtualFocusKeyDown()){let e=this.lastInput;e.bubbles=!1;let i=e.event;i&&(i.stopPropagation&&i.stopPropagation(),i.cancelable!==!1&&i.preventDefault());return}this.currentTool.doKeyDown()}}toggleKeyboardControl(){let t=this.lastInput,e=t.commandKey;if((t.control||t.meta)&&t.alt&&(e==="Enter"||e==="NumpadEnter")){let i=this.commandHandler,s=i.isFocusEnabled||i.isVirtualPointerEnabled;return i.isFocusEnabled=!s,i.isVirtualPointerEnabled=!s,i.focus=i.findFirstFocus(),this.T("FocusOrVirtualPointerEnabledChanged"),!0}return!1}doKeyUp(){let t=this.commandHandler;if((t.isFocusEnabled||t.isVirtualPointerEnabled)&&t.doVirtualFocusKeyUp()){let e=this.lastInput;e.bubbles=!1;let i=e.event;i&&(i.stopPropagation&&i.stopPropagation(),i.cancelable!==!1&&i.preventDefault());return}this.currentTool.doKeyUp()}hd(t,e){if(e)for(let i in e)i!=="sourceDiagram"&&(t[i]=e[i])}emitMouseDown(t,e,i,s){if(typeof t!="number"||typeof e!="number")throw new Error("Robot.mouseDown first two args must be X,Y numbers");i===void 0&&(i=0);let n=this;if(s&&s.sourceDiagram&&(n=s.sourceDiagram),!n.isEnabled)return this;let o=new Qt;return o.diagram=n,o.documentPoint=new P(t,e),o.viewPoint=n.transformDocToView(o.documentPoint),o.timestamp=i,o.down=!0,this.hd(o,s),n.lastInput=o,n.firstInput=o.copy(),n.doMouseDown(),this}emitMouseMove(t,e,i,s){if(typeof t!="number"||typeof e!="number")throw new Error("Robot.mouseMove first two args must be X,Y numbers");i===void 0&&(i=0);let n=this;if(s&&s.sourceDiagram&&(n=s.sourceDiagram),!n.isEnabled)return this;let o=new Qt;return o.diagram=n,o.documentPoint=new P(t,e),o.viewPoint=n.transformDocToView(o.documentPoint),o.timestamp=i,this.hd(o,s),n.lastInput=o,n.doMouseMove(),this}emitMouseUp(t,e,i,s){if(typeof t!="number"||typeof e!="number")throw new Error("Robot.mouseUp first two args must be X,Y numbers");i===void 0&&(i=0);let n=this;if(s&&s.sourceDiagram&&(n=s.sourceDiagram),!n.isEnabled)return this;let o=new Qt;return o.diagram=n,o.documentPoint=new P(t,e),o.viewPoint=n.transformDocToView(o.documentPoint),o.timestamp=i,o.up=!0,n.firstInput.documentPoint.equals(o.documentPoint)&&(o.clickCount=1),this.hd(o,s),n.lastInput=o,n.doMouseUp(),this}emitMouseWheel(t,e,i){if(typeof t!="number")throw new Error("Robot.mouseWheel first arg must be DELTA number");e===void 0&&(e=0);let s=this;if(!s.isEnabled)return this;let n=new Qt;return n.diagram=s,n.documentPoint=s.lastInput.documentPoint,n.viewPoint=s.lastInput.viewPoint,n.delta=t,n.timestamp=e,this.hd(n,i),s.lastInput=n,s.doMouseWheel(),this}emitKeyDown(t,e,i){if(typeof t!="string"&&typeof t!="number")throw new Error("Robot.keyDown first arg must be a string or a number");e===void 0&&(e=0);let s=this;if(!s.isEnabled)return this;let n=new Qt;return n.diagram=s,n.documentPoint=s.lastInput.documentPoint,n.viewPoint=s.lastInput.viewPoint,typeof t=="string"?n.key=t:typeof t=="number"&&(n.key=String.fromCharCode(t)),n.timestamp=e,n.down=!0,this.hd(n,i),s.lastInput=n,s.doKeyDown(),this}emitKeyUp(t,e,i){if(typeof t!="string"&&typeof t!="number")throw new Error("Robot.keyUp first arg must be a string or a number");e===void 0&&(e=0);let s=this;if(!s.isEnabled)return this;let n=new Qt;return n.diagram=s,n.documentPoint=s.lastInput.documentPoint,n.viewPoint=s.lastInput.viewPoint,typeof t=="string"?n.key=t:typeof t=="number"&&(n.key=String.fromCharCode(t)),n.timestamp=e,n.up=!0,this.hd(n,i),s.lastInput=n,s.doKeyUp(),this}doFocus(){this.focus()}focus(){if(this.lt)if(this.scrollsPageOnFocus)this.lt.focus();else{let t=K.scrollX,e=K.scrollY;this.lt.focus(),K.scrollTo(t,e)}}gO(t){let e=Y.ji.get(this);e&&e.T("GainedFocus")}dO(t){let e=Y.ji.get(this);e&&e.T("LostFocus")}SM(){if(this.lt===null)return;let t=this.Mt;if(t===null||t.clientWidth===0||t.clientHeight===0)return;this.VM||this.setScrollWidth();let e=this.to?this.jt:0,i=this.kn?this.jt:0,s=this.$e;if(this.$e=this.computePixelRatio(),this.$e!==s&&(this.$u=!0,this.requestUpdate()),t.clientWidth!==this.wt+e||t.clientHeight!==this.xt+i){this.Nh(),this.qi=!0;let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(this.Qc=!0,n.p()),this.As||this.requestUpdate()}}QA(){let t=0,e=new Et;e.name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="ViewportBackground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="Background",this.Jr(e,t++),e=new Et,e.name="",this.Jr(e,t++),e=new Et,e.name="Foreground",this.Jr(e,t++),e=new Et,e.name="ViewportForeground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,this.Jr(e,t++)}rT(){let t=new G(G.Grid,{name:"GRID"}).add(new et("LineH",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new et("LineV",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new et("LineH",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new et("LineV",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new et("LineH",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor"),new et("LineV",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor")),e=new pt({layerName:"Grid",zOrder:0,isInDocumentBounds:!1,isAnimated:!1,pickable:!1,locationObjectName:"GRID"}).add(t);return this.add(e),this.partManager.parts.delete(e),t.visible=!1,t}static iO(){let t=Y.ji.get(this.parentElement||this);if(t){if(t.Ub){t.Ub=!1;return}if(!t.isEnabled){t.lT();return}t.diagramScroll(this)}}static sO(t){if(!this.a.isEnabled){this.a.updateScroll();return}this.a.Vb=t.target.scrollTop,this.a.Bb=t.target.scrollLeft}diagramScroll(t){if(this.lt===null)return;let e=this.qb,i=this.jb;this.sp=!0;let s=this.documentBounds,n=this.viewportBounds,o=this.fh,r=s.x-o.left,a=s.y-o.top,h=s.width+o.left+o.right,l=s.height+o.top+o.bottom,u=s.right+o.right,c=s.bottom+o.bottom,d=n.x,f=n.y,p=n.width,g=n.height,y=n.right,b=n.bottom,v=this.scale,w,k=t.scrollLeft;if(this.ld)switch(this.ob){case"negative":k=k+t.scrollWidth-t.clientWidth;break;case"reverse":k=t.scrollWidth-k-t.clientWidth;break}let S=k;if(p<h||g<l){w=P.z(this.position.x,this.position.y),this.allowHorizontalScroll&&this.Bb!==S&&(w.x=S/v+r,this.Bb=S),this.allowVerticalScroll&&this.Vb!==t.scrollTop&&(w.y=t.scrollTop/v+a,this.Vb=t.scrollTop),this.position=w,P.i(w),this.sp=!1,this.td=!1;return}if(w=P.l(),t.nO&&this.allowHorizontalScroll&&(r<d&&(this.position=w.e(S+r,this.position.y)),u>y)){let N=e.scrollWidth-this.wt;this.position=w.e(-N+S-this.wt/v+u,this.position.y)}if(t.oO&&this.allowVerticalScroll&&(a<f&&(this.position=w.e(this.position.x,t.scrollTop+a)),c>b)){let N=e.scrollHeight-this.xt;this.position=w.e(this.position.x,-N+t.scrollTop-this.xt/v+c)}P.i(w),this.ha(),this.sp=!1,this.td=!1,s=this.documentBounds,n=this.viewportBounds,u=s.right,y=n.right,c=s.bottom,b=n.bottom,r=s.x,d=n.x,a=s.y,f=n.y,p>=h&&r>=d&&u<=y&&(i.style.width="1px"),g>=l&&a>=f&&c<=b&&(i.style.height="1px")}computeBounds(t){return t===void 0&&(t=new I),this.Te(),this.aT(t)}aT(t){if(this.fixedBounds.isReal())return t.h(this.fixedBounds),t.addMargin(this.Qt),t;let e=!0,i=this.Vt.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if(!o.visible||!o.isInDocumentBounds)continue;let r=o.Nt.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!l.isInDocumentBounds||!l.isVisible())continue;let u=l.actualBounds;u.isReal()&&(e?(e=!1,t.h(u)):t.unionRect(u))}}return e&&t.e(0,0,0,0),t.addMargin(this.Qt),t}computePartsBounds(t,e){e===void 0&&(e=!1);let i;if(Array.isArray(t))for(let s=0;s<t.length;s++){let n=t[s];!e&&n instanceof j||(n.ensureBounds(),i===void 0?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}else{let s=t.iterator;for(;s.next();){let n=s.value;!e&&n instanceof j||(n.ensureBounds(),i===void 0?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}}return i===void 0?new I(NaN,NaN,0,0):i}Js(t){if(!t&&!this.eo||this.Ht||this.lt===null||!this.documentBounds.isReal())return;if(this.Ht=!0,t){let c=this.initialPosition;if(c.isReal()){this.Ht=!1,this.position=c;return}let d=this.initialDocumentSpot,f=this.initialViewportSpot;d.isNoSpot()&&(d=T.TopLeft),f.isNoSpot()&&(f=T.TopLeft);let p=P.l();p.setRectSpot(this.documentBounds,d);let g=this.viewportBounds,y=I.z(0,0,g.width,g.height),b=P.l();b.setRectSpot(y,f),b.e(p.x-b.x,p.y-b.y),this.Ht=!1,this.position=b,I.i(y),P.i(b)}let e=this.ia;t&&this.vr!==1&&(e=this.vr);let i=e!==1?this.cd(e):this.scale,s=this.ct.x,n=this.ct.y,o=this.wt/i,r=this.xt/i,a=this.$c,h=this._m;if(t&&!a.isSpot()&&(h.isSpot()||h.isDefault())){let c=this.initialDocumentSpot.isSpot()&&this.initialViewportSpot.isSpot();a=h.isDefault()&&!c?T.Center:h}this.w2(this.documentBounds,o,r,a,t);let l=this.scale;this.scale=i,this.Ht=!1;let u=this.viewportBounds;u.equalsApproxTo(s,n,o,r)||this.onViewportBoundsChanged(new I(s,n,o,r),u,l,!1)}cd(t){let e=this.hp;if(this.lt===null)return e;if(t===1)return this.scale;this.ensureBounds();let i=this.documentBounds;if(!i.isReal())return e;let s=i.width,n=i.height,o=this.wt+(this.to?this.jt:0),r=this.xt+(this.kn?this.jt:0),a=o/s,h=r/n,l=this.fh,u=l.left+l.right!==0,c=l.top+l.bottom!==0;(u||c)&&(h===a?(h=(r-this.jt)/n,a=(o-this.jt)/s):h>a?h=(r-this.jt)/n:a=(o-this.jt)/s);let d=0;return t===2?d=Math.min(h,a):t===3&&(h>a?d=(r-this.jt)/n:d=(o-this.jt)/s),d>e&&(d=e),d<this.minScale&&(d=this.minScale),d>this.maxScale&&(d=this.maxScale),d}zoomToFit(){let t=this.ah;this.ah=1,this.scale=this.cd(2),this.alignDocument(T.Center,T.Center),t!==1&&(this.Js(!1),this.w2(this.documentBounds,this.wt/this.et,this.xt/this.et,this.$c,!1)),this.ah=t}zoomToRect(t,e){e===void 0&&(e=2);let i=t.width,s=t.height;if(i===0||s===0||isNaN(i)&&isNaN(s))return;let n=1;if(e===2||e===3)if(isNaN(i))n=this.viewportBounds.height*this.scale/s;else if(isNaN(s))n=this.viewportBounds.width*this.scale/i;else{let o=this.wt,r=this.xt;e===3?r/s>o/i?n=(r-(this.kn?this.jt:0))/s:n=(o-(this.to?this.jt:0))/i:n=Math.min(r/s,o/i)}this.scale=n,this.position=new P(t.x,t.y)}get mO(){return this.Ht}set mO(t){this.Ht=t}alignDocument(t,e){this.ensureBounds();let i=this.documentBounds,s=this.viewportBounds;this.position=new P(i.x+(t.x*i.width+t.offsetX)-(e.x*s.width-e.offsetX),i.y+(t.y*i.height+t.offsetY)-(e.y*s.height-e.offsetY))}focusObject(t){if(t instanceof J){this.pp=t;let e=P.l();this.yp=this.transformDocToView(t.getDocumentPoint(T.TopLeft,e)),P.i(e)}else this.pp=null,this.yp=P.gn}w2(t,e,i,s,n){let o=P.z(this.ct.x,this.ct.y),r=o.x,a=o.y;if(this.pp!==null){let h=P.l();h=this.pp.getDocumentPoint(T.TopLeft,h),r=h.x-this.yp.x/this.scale,a=h.y-this.yp.y/this.scale,s=T.None,P.i(h)}if(n||this.scrollMode===1){s.isSpot()&&(e>t.width&&(r=t.x+(s.x*t.width+s.offsetX)-(s.x*e-s.offsetX)),i>t.height&&(a=t.y+(s.y*t.height+s.offsetY)-(s.y*i-s.offsetY)));let h=this.fh,l=e-t.width;if(e<t.width+h.left+h.right){let c=r+e/2;c=Math.min(c,t.right+Math.max(l,h.right)-e/2),c=Math.max(c,t.left-Math.max(l,h.left)+e/2),r=c-e/2}else r>t.left?r=t.left:r<t.right-e&&(r=t.right-e);let u=i-t.height;if(i<t.height+h.top+h.bottom){let c=a+i/2;c=Math.min(c,t.bottom+Math.max(u,h.bottom)-i/2),c=Math.max(c,t.top-Math.max(u,h.top)+i/2),a=c-i/2}else a>t.top?a=t.top:a<t.bottom-i&&(a=t.bottom-i)}if(o.x=isFinite(r)?r:-this.Qt.left,o.y=isFinite(a)?a:-this.Qt.top,this.positionComputation!==null){let h=this.positionComputation(this,o);o.x=h.x,o.y=h.y}this.Ns.IA(this.ct,o),this.ct.e(o.x,o.y),this.Pp(),this.aa(),this.pO(),P.i(o)}findPartAt(t,e){if(e===void 0&&(e=!0),e){let i=this.xS(t,s=>s.part,s=>s.canSelect());if(i instanceof pt)return i}else{let i=this.xS(t,s=>s.part);if(i instanceof pt)return i}return null}findObjectAt(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Te();let s=this.Vt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}xS(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Te();let s=this.Vt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible||n.isTemporary)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}findPartsAt(t,e,i){return e===void 0&&(e=!0),this.yO(t,s=>s.part,e?s=>s instanceof pt&&s.canSelect():null,i)}yO(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof q)&&!(s instanceof V)&&(s=new V),this.Te();let n=this.Vt.iteratorBackwards;for(;n.next();){let o=n.value;!o.visible||o.isTemporary||o.findObjectsAt(t,e,i,s)}return s}findObjectsAt(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof q)&&!(s instanceof V)&&(s=new V),this.Te();let n=this.Vt.iteratorBackwards;for(;n.next();){let o=n.value;o.visible&&o.findObjectsAt(t,e,i,s)}return s}findPartsIn(t,e,i,s){return e===void 0&&(e=!1),i===void 0&&(i=!0),this.wO(t,null,n=>n instanceof pt&&(!i||n.canSelect()),e,s)}findObjectsIn(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof q)&&!(n instanceof V)&&(n=new V),this.Te();let o=this.Vt.iteratorBackwards;for(;o.next();){let r=o.value;r.visible&&r.findObjectsIn(t,e,i,s,n)}return n}PS(t,e,i,s,n,o){let r=new V;this.Te();let a=this.Vt.iteratorBackwards;for(;a.next();){let h=a.value;h.visible&&h.PS(t,e,i,s,r,n,o)}return r}wO(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof q)&&!(n instanceof V)&&(n=new V),this.Te();let o=this.Vt.iteratorBackwards;for(;o.next();){let r=o.value;!r.visible||r.isTemporary||r.findObjectsIn(t,e,i,s,n)}return n}findPartsNear(t,e,i,s,n){return i===void 0&&(i=!0),s===void 0&&(s=!0),this.xO(t,e,null,o=>o instanceof pt&&(!s||o.canSelect()),i,n)}findObjectsNear(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof q||n instanceof V)&&(o=n),n=!0),!(o instanceof q)&&!(o instanceof V)&&(o=new V),this.Te();let r=this.Vt.iteratorBackwards;for(;r.next();){let a=r.value;a.visible&&a.findObjectsNear(t,e,i,s,n,o)}return o}xO(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof q||n instanceof V)&&(o=n),n=!0),!(o instanceof q)&&!(o instanceof V)&&(o=new V),this.Te();let r=this.Vt.iteratorBackwards;for(;r.next();){let a=r.value;!a.visible||a.isTemporary||a.findObjectsNear(t,e,i,s,n,o)}return o}acceptEvent(t){return this.lf(t,t instanceof MouseEvent)}lf(t,e){let i=this.qr;this.qr=this.gh,this.gh=i,i.diagram=this,i.event=t,e?this.kp(t,i):(i.viewPoint=this.qr.viewPoint,i.documentPoint=this.qr.documentPoint);let s=0,n=t;return n.ctrlKey&&(s+=1),n.altKey&&(s+=2),n.shiftKey&&(s+=4),n.metaKey&&(s+=8),i.modifiers=s,i.button=n.button,n.buttons!==void 0&&(i.buttons=n.buttons),m.hr&&n.button===0&&n.ctrlKey&&(i.button=2),i.down=!1,i.up=!1,i.clickCount=1,i.delta=0,i.handled=!1,i.bubbles=!1,i.timestamp=t.timeStamp,i.isMultiTouch=!1,i.targetDiagram=this.e1(t,t.target),i.targetObject=null,i}e1(t,e){if(e===null)return null;let i=Y.ji.get(e);if(i)return i;let s=t.path;if(!s&&m.it(t.composedPath)&&(s=t.composedPath()),s&&s[0]){let n=Y.ji.get(s[0]);if(n)return n}return null}rO(t,e,i){let s=this.p2(t,!0,!1,!1,!0,i);return this.kp(e,s),s.targetDiagram=this.e1(t,t.target),s.targetObject=null,i||s.clone(this.ap),s}lO(t,e,i){let s=this.p2(t,!1,!1,!1,!1,i),n=K.document.elementFromPoint(e.clientX,e.clientY)||null;n!==null&&n.shadowRoot&&(n=n.shadowRoot.elementFromPoint(e.clientX,e.clientY)||null);let o=this,r=t;if(n){let a=this.e1(t,n);a&&(r=e,o=a)}return s.targetDiagram=o,this.kp(r,s),s.targetObject=null,s}p2(t,e,i,s,n,o){let r=this.qr;this.qr=this.gh,this.gh=r,r.diagram=this,r.clickCount=1,r.delta=0;let a=0;return t.ctrlKey&&(a+=1),t.altKey&&(a+=2),t.shiftKey&&(a+=4),t.metaKey&&(a+=8),r.modifiers=a,r.event=t,r.timestamp=t.timeStamp,r.button=i?this.firstInput.button:t.button,r.buttons=t.buttons,m.hr&&t.button===0&&t.ctrlKey&&(r.button=2),r.down=e,r.up=i,r.handled=s,r.bubbles=n,r.isMultiTouch=o,r}Sh(t,e){return t.bubbles?!0:(e.stopPropagation!==void 0&&e.stopPropagation(),e.cancelable!==!1&&e.preventDefault(),e.cancelBubble=!0,!1)}fO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!1);return i.key=t.key,i.code=t.code,i.down=!0,e.doKeyDown(),e.Sh(i,t)}uO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!1);return i.key=t.key,i.code=t.code,i.up=!0,e.doKeyUp(),e.Sh(i,t)}hO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!0);return e.mouseEnter!==null&&e.mouseEnter(i),e.currentTool.standardMouseOver(),e.Sh(i,t)}cO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!0);return e.mouseLeave!==null&&e.mouseLeave(i),e.Sh(i,t)}getMouse(t){let e=this.lt;if(e===null)return new P(0,0);let i=e.getBoundingClientRect(),s=(t.clientX-i.left)*(this.wt/i.width),n=(t.clientY-i.top)*(this.xt/i.height);return new P(s,n).Yi(this.v)}kp(t,e){let i=this.lt,s=0,n=0;if(i!==null){let r=i.getBoundingClientRect();s=(t.clientX-r.left)*(this.wt/r.width),n=(t.clientY-r.top)*(this.xt/r.height)}e.viewPoint.e(s,n);let o=P.z(s,n);this.v.Ci(o),e.documentPoint.h(o),P.i(o)}_L(t,e,i){let s;if(this.yh[0]!==null)s=this.yh[e];else return;let n=this.lt;if(n!==null){let o=n.getBoundingClientRect();i.e((s.clientX-o.left)*(this.wt/o.width),(s.clientY-o.top)*(this.xt/o.height))}}invalidateDocumentBounds(){this.mh||(this.mh=!0,this.requestUpdate(!1))}bO(){this.As||this.Te(),this.ensureBounds()}redraw(){this.Ht||this.As||(this.C(),this.maybeUpdate())}isUpdateRequested(){return this.Lr}delayInitialization(t){t===void 0&&(t=null);let e=this.animationManager,i=e.isEnabled;e.stopAnimation(),e.isEnabled=!1,this.br(),this.eo=!1,this.Kx=new P(NaN,NaN),e.isEnabled=i,this.As=!0;let s=this;t!==null&&m.un(()=>{s.As=!1,e.Gl("Model"),t(s)},1)}requestUpdate(t){if(t===void 0&&(t=!1),this.Lr===!0||this.Ht||t===!1&&this.As)return;this.Lr=!0;let e=this;K.requestAnimationFrame(()=>{e.Lr&&e.maybeUpdate()})}maybeUpdate(){this.Zu&&!this.Lr||(this.Zu&&(this.Zu=!1),this.br())}b2(t,e){!this.td||this.Ht||this.animationManager.defaultAnimation.isAnimating||this.lT()||(t&&this.Te(),e&&this.Js(!1))}br(t){if(this.As||(this.Lr=!1,this.Mt===null&&!this.ed.isReal()))return;this.As=!0;let e=this.animationManager,i=this.rd;if(!e.isAnimating&&i.length!==0){let u=i.r,c=u.length;for(let d=0;d<c;d++){let f=u[d];f.xi(!1),f.f()}i.clear()}let s=this.s2;s.count>0&&(s.each(u=>u.k2()),s.clear());let n=!1,o=!1;e.defaultAnimation.isAnimating&&(o=!0,n=this.skipsUndoManager,this.skipsUndoManager=!0),e.ke||this.SM(),t||this.b2(!1,!0);let r=!this.undoManager.isUndoingRedoing&&(this.Fl||this.rf.count!==0&&this.Fr.size!==0),a=!this.eo||this.jr;this.Te(!0);let h=!1;(a||r)&&(this.eo?this.P2(!this.Qc,r):(this.startTransaction("Initial Layout"),e.isEnabled===!1&&e.stopAnimation(),this.P2(!1,r)),h=a),this.Qc=!1,this.Fl=!1,this.Te(),this.ls!==null&&(this.ls.visible&&!this.sd&&(this.ca(),this.sd=!0),!this.ls.visible&&this.sd&&(this.sd=!1)),this.Nb||this.bO(),t||this.b2(!0,!1);let l=!1;if(h){let u=I.l();u.h(this.viewportBounds),this.eo||(this.eo=!0,l=!0,this.skipsUndoManager||(this.undoManager.wx=!0),this.undoManager.xx=!0,this.kO()),this.PO(),this.Te(!1),t||this.b2(!0,!0),I.i(u)}else if(e.Xc&&e.Yx){if(this.vr!==1)this.scale=this.cd(this.vr);else if(this.ia!==1)this.scale=this.cd(this.ia);else{let u=this.initialScale;isFinite(u)&&u>0&&(this.scale=u)}this.Js(!0)}h&&l&&this.commitTransaction("Initial Layout"),t||this.Ge(this.Wt),o&&(this.skipsUndoManager=n),this.As=!1}get Qa(){return this.eo}kO(){if(this.vr!==1)this.scale=this.cd(this.vr);else if(this.ia!==1)this.scale=this.cd(this.ia);else{let e=this.initialScale;isFinite(e)&&e>0&&(this.scale=e)}this.Js(!0);let t=this.Vt.r;this.rs(t,t.length,this,this.viewportBounds),this.T("InitialLayoutCompleted"),this.Kx.h(this.ct),this.ca()}PO(){this.T("LayoutCompleted")}Sp(t){this.Qn.add(t)}addInvalidRoute(t){this.Io?this.uh.add(t):this.Fr.add(t)}Te(t){if(this.Qn.size!==0&&!(!this.As&&this.animationManager.isTicking)){if(this.As||(this.Fl=!0),t){this.hT(this.Qn);return}for(let e=0;e<23&&this.Qn.size!==0;e++){let i=new Set(this.Qn);this.Qn.clear(),this.k2(i,this.Qn)}this.nodes.each(e=>{e instanceof ht&&e.cT(!1)})}}hT(t,e){for(let i of t)!i.Di()||i instanceof ht||(i.$r()?(i.ht(1/0,1/0),i.Ut()):e&&e.add(i));for(let i of t)if(i instanceof ht){if(!i.isVisible())continue;this.i1(i)}}k2(t,e){this.hT(t,e);for(let i of t){if(!(i instanceof j))continue;let s=i;s.isVisible()&&(s.$r()?(s.ht(1/0,1/0),s.Ut()):e.add(s))}for(let i of t)i instanceof vt&&i.isVisible()&&(i.$r()?(i.ht(1/0,1/0),i.Ut()):e.add(i))}fd(t){let e=t instanceof Y,i=e?t.links:t.memberParts,s=this.Qn;if(e)this.Te(!0);else{for(;i.next();){let n=i.value;s.has(n)&&(!n.Di()||n instanceof ht||n.$r()&&(n.ht(1/0,1/0),n.Ut()))}for(i.reset();i.next();){let n=i.value;if(s.has(n)&&n instanceof ht){if(!n.isVisible())continue;this.i1(n)}}i.reset()}for(;i.next();){let n=i.value;n instanceof j&&s.has(n)&&n.isVisible()&&n.$r()&&(n.ht(1/0,1/0),n.Ut())}}i1(t){let e=m.st(),i=m.st(),s=t.memberParts;for(;s.next();){let o=s.value;o.isVisible()&&(o instanceof ht?(o.Bo()||o.as()||o.fa())&&this.i1(o):o instanceof j?o.fromNode===t||o.toNode===t?i.push(o):e.push(o):(o.ht(1/0,1/0),o.Ut()))}let n=e.length;for(let o=0;o<n;o++){let r=e[o];r.ht(1/0,1/0),r.Ut()}m.Z(e),t.ht(1/0,1/0),t.Ut(),n=i.length;for(let o=0;o<n;o++){let r=i[o];r.ht(1/0,1/0),r.Ut()}m.Z(i)}rs(t,e,i,s){if(!(!this.ef&&!this.animationManager.isAnimating)){for(let n=0;n<e;n++)t[n].rs(i,s);this.Te()}}Ge(t){this.Mt!==null&&(this.lt===null&&m.o("No canvas specified"),this.tf==="svg"?this.SO(t):this.MO(t))}MO(t){let e=this.animationManager;if(e.ke||e.isAnimating&&!e.isTicking)return;let i=new Date;if(this.Mp(),this.Mt&&this.Mt.style.opacity==="0")return;let s=t!==this.Wt,n=this.Vt.r,o=n.length,r=this;if(this.rs(n,o,r,r.viewportBounds),s)t.clearContextCache(!0),this.ha();else if(!this.qi&&!e.isAnimating)return;let a=this.v,h=this.$e;t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,this.wt,this.xt),this.Zt!==1&&(t.globalAlpha=this.Zt),this.S2(t);for(let f=0;f<o;f++)t.setTransform(h,0,0,h,0,0),t.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),t.commitTransform(),n[f].Ge(t,r);let l=!1;this.of?this.of.Mh(this,t)&&(l=this.cp()):l=!0,l&&(Nt.prototype.Ci=Nt.prototype.Mu),s?(this.Wt.clearContextCache(!0),this.ha()):(this.ef=!1,this.qi=!1);let u=+new Date-+i,c=!1,d=this.c2;if(c||this.Ol===null){d[this.mp]=u,this.mp=(this.mp+1)%d.length;let f=0;for(let p=0;p<d.length;p++)f+=d[p];this.gp=f/d.length}if(this.Zt!==1&&(t.globalAlpha=1),c){t.setTransform(1,0,0,1,0,0);for(let f=0;f<d.length;f++)t.fillText(d[f].toString(),20,150+ +(f*20))}}SO(t){if(this.Mt===null)return;let e=this.animationManager;if(e.ke||e.isAnimating&&!e.isTicking)return;this.Mp();let i=this.wt,s=this.xt;t.surface.resize(i,s,i,s);let n=this.Vt.r,o=n.length,r=this;if(this.rs(n,o,r,r.viewportBounds),!this.qi&&!e.isAnimating)return;let a=this.v;t.lastDrawnPart=null,t.setDiagramPosScale(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),this.Zt!==1&&(t.globalAlpha=this.Zt),this.S2(t);let h=this.$e,l=this.lt._t;l.setTransform(h,0,0,h,0,0),l.clearRect(0,0,this.wt,this.xt);for(let c=0;c<o;c++)n[c].Ge(t,r);let u=!1;this.of?this.of.Mh(this,l)&&(u=this.cp()):u=!0,u&&(Nt.prototype.Ci=Nt.prototype.Mu),this.ef=!1,this.qi=!1}s1(t,e,i,s,n,o,r,a,h){o===void 0&&(o=null),r===void 0&&(r=null),a===void 0&&(a=!1),h===void 0&&(h=!1),this.Mp(),t.clearContextCache(!0),this.ha(),this.ph=!0;let l=this.et;this.et=s;let u=this,c=this.Vt.r,d=c.length;try{let f=new I(n.x,n.y,i.width/s,i.height/s),p=f.copy();p.addMargin(e),this.ca(p),this.Te(),this.rs(c,d,u,f),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i.width,i.height),r!==null&&r!==""&&(t.fillStyle=r,t.fillBackground(0,0,i.width,i.height));let g=Nt.l();g.Ue(),g.Xs(e.left,e.top),g.et(s),(n.x!==0||n.y!==0)&&g.Xs(-n.x,-n.y),t.setTransform(g.m11,g.m12,g.m21,g.m22,g.dx,g.dy),t.commitTransform(),t instanceof re&&t.setDiagramPosScale(g.m11,g.m12,g.m21,g.m22,g.dx,g.dy),Nt.i(g),this.S2(t),t.globalAlpha=this.Zt;let y=this.findLayer("Grid");if(o){let b=new V,v=o.iterator;for(v.reset();v.next();){let w=v.value;w instanceof pt&&(!h&&w.layer===y||(w.Jc(),b.add(w)))}for(let w=0;w<d;w++)c[w].IR(t,u,b,a);b.each(w=>w.Jc())}else for(let b=0;b<d;b++){let v=c[b];v===y?h&&v.Ge(t,u,!0):v.Ge(t,u,a)}this.ph=!1,this.of&&this.Wt&&this.of.Mh(this,this.Wt)&&this.cp()}finally{this.et=l,t.clearContextCache(!0),this.ha(),this.rs(c,d,u,u.viewportBounds),this.ca(),this.Wt instanceof re&&(this.Wt.diagramGroup.replaceChildren(),this.redraw())}}getRenderingHint(t){return this.Dr[t]}setRenderingHint(t,e){t==="minDrawingLength"&&(this.$m=e),this.Dr[t]=e,this.redraw()}resetRenderingHints(){this.Dr=new bt,this.Dr.drawShadows=!0,this.Dr.textGreeking=!0,this.Dr.viewportOptimizations=!m.hr,this.Dr.temporaryPixelRatio=!0,this.Dr.pictureRatioOptimization=!0,this.Dr.minDrawingLength=1,this.$m=1}S2(t){let e=this.Dr;if(e===null)return;if(e.imageSmoothingEnabled!==void 0){let s=!!e.imageSmoothingEnabled;t.setImageSmoothingEnabled(s)}let i=e.defaultFont;i!=null&&(t.font=i)}getInputOption(t){return this.Ju[t]}setInputOption(t,e){this.Ju[t]=e}ZR(){this.Ju=new bt,this.Ju.extraTouchArea=10,this.Ju.extraTouchThreshold=10,this.Ju.hasGestureZoom=!0}set(t){return t?(Object.assign(this,t),this):this}attach(t){return this.setProperties(t)}setProperties(t){return Y.Np(this,t),this}static Np(t,e){if(!e)return;let i=t instanceof G,s=t instanceof Y;for(let n in e){n===""&&m.o("Setting properties requires non-empty property names");let o=t,r=n;if(i||s){let h=n.indexOf(".");if(h>0){let l=n.substring(0,h);i?o=t.findObject(l):(o=t[l],o==null&&(o=t.toolManager[l])),m.$(o)?r=n.substring(h+1):m.o("Unable to find object named: "+l+" in "+t.toString()+" when trying to set property: "+n)}}if(r[0]!=="_"&&!m.Yw(o,r))if(s&&r==="ModelChanged"){t.addModelChangedListener(e[r]);continue}else if(s&&r==="Changed"){t.addChangedListener(e[r]);continue}else if(s&&m.Yw(t.toolManager,r))o=t.toolManager;else if(s&&t.fT(r)){t.addDiagramListener(r,e[r]);continue}else if(t instanceof ut&&r==="Changed"){t.addChangedListener(e[r]);continue}else m.o('Trying to set undefined property "'+r+'" on object: '+o.toString());let a=e[n];o[r]=a,r[0]==="_"&&o instanceof J&&o.addCopyProperty(r)}}VA(){if(this.ra.count!==0&&!(this.undoManager.transactionLevel>1)){for(;this.ra.count>0;){let t=this.ra;this.ra=new Mt;let e=t.iterator;for(;e.next();){let i=e.key;i.invalidateOtherJumpOvers(e.value),i.ai()}}this.C()}}C(t){if(t===void 0)this.qi=!0,this.requestUpdate();else{let e=this.viewportBounds;t.isReal()&&e.intersectsRect(t)&&(this.qi=!0,this.requestUpdate())}this.T("InvalidateDraw")}invalidateViewport(t,e){if(this.qi!==!0){if(this.qi=!0,this.tf==="svg"){this.maybeUpdate();return}this.getRenderingHint("temporaryPixelRatio")===!0?(this.Sx(),this.maybeUpdate(),this.mS(!0)):this.maybeUpdate()}}Nh(){this.td=!0}ha(){this.ef=!0}Mp(){this.$u!==!1&&(this.$u=!1,this.oT(this.wt,this.xt))}oT(t,e){this.aa();let i=this.$e,s=t*i,n=e*i;this.lt.resize(s,n,t,e)&&(this.qi=!0,this.Wt.clearContextCache(!0))}lT(){let t=this.lt;if(t===null||this.ed.isReal())return!0;let e=this.wt,i=this.xt,s=this.Mt,n=!1,o=this.to?this.jt:0,r=this.kn?this.jt:0,a=s.clientWidth||e+o,h=s.clientHeight||i+r,l=this.viewportBounds,u=l.x,c=l.y,d=l.width,f=l.height;if((a!==e+o||h!==i+r)&&(this.to=!1,this.kn=!1,o=0,r=0,this.wt=a,this.xt=h,this.$u=!0,n=!0,this.aa()),!this.eo||!this.viewportBounds.isReal())return!0;let p=this.qb,g=this.jb;if(this.td=!1,!n&&!this.to&&!this.kn&&!this.Qu&&!this._u)return!0;let y=this.documentBounds,b=0,v=0,w=0,k=0,S=l.width,N=l.height,D=this.fh;this.contentAlignment.isSpot()?(y.width>S&&(b=D.left,v=D.right),y.height>N&&(w=D.top,k=D.bottom)):(b=D.left,v=D.right,w=D.top,k=D.bottom);let L=y.width+b+v,M=y.height+w+k,A=this.scale,F=A,O=L>a/A,E=M>h/A;if(!n&&!this.to&&!this.kn&&!O&&!E)return!0;let B=y.x-b,X=l.x,z=y.right+v,U=l.right+o,tt=y.y-w,nt=l.y,Z=y.bottom+k,it=l.bottom+r,_="1px",at="1px";if(this.scrollMode===1&&(O||E)){if(O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let Q=1;B+1<X&&(Q=Math.max((X-B)*A+this.wt,Q)),z>U+1&&(Q=Math.max((z-U)*A+this.wt,Q)),S+o+1<L&&(Q=Math.max((L-S)*A+this.wt,Q)),_=Q.toString()+"px"}if(E&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let Q=1;tt+1<nt&&(Q=Math.max((nt-tt)*A+this.xt,Q)),Z>it+1&&(Q=Math.max((Z-it)*A+this.xt,Q)),N+r+1<M&&(Q=Math.max((M-N)*A+this.xt,Q)),at=Q.toString()+"px"}}let ct=_!=="1px",yt=at!=="1px";if(!(ct&&yt)&&(ct||yt)){if(O=!(L<S+o),E=!(M<N+r),yt&&(U-=this.jt),ct&&(it-=this.jt),O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let St=1;B+1<X&&(St=Math.max((X-B)*A+this.wt,St)),z>U+1&&(St=Math.max((z-U)*A+this.wt,St)),S+1<L&&(St=Math.max((L-S)*A+this.wt,St)),_=St.toString()+"px"}ct=_!=="1px";let Q=this.xt;if(ct!==this.kn&&(Q=ct?this.xt-this.jt:this.xt+this.jt),E&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let St=1;tt+1<nt&&(St=Math.max((nt-tt)*A+Q,St)),Z>it+1&&(St=Math.max((Z-it)*A+Q,St)),N+1<M&&(St=Math.max((M-N)*A+Q,St)),at=St.toString()+"px"}yt=at!=="1px"}if(this.sp&&!(ct!==this.kn||yt!==this.to))return(e!==this.wt||i!==this.xt)&&this.maybeUpdate(),!1;if(ct!==this.kn&&(_==="1px"?this.xt=this.xt+this.jt:this.xt=Math.max(this.xt-this.jt,1),n=!0),this.kn=ct,g.style.width=_,yt!==this.to&&(at==="1px"?this.wt=this.wt+this.jt:this.wt=Math.max(this.wt-this.jt,1),n=!0,this.ld)){let Q=P.l();yt?(t.style.left=this.jt+"px",this.position=Q.e(this.ct.x+this.jt/this.scale,this.ct.y)):(t.style.left="0px",this.position=Q.e(this.ct.x-this.jt/this.scale,this.ct.y)),P.i(Q)}n&&this.aa(),this.to=yt,g.style.height=at,this.Ub=!0,n&&(this.$u=!0);let Ct=p.scrollLeft;if(this.hasHorizontalScrollbar&&this.allowHorizontalScroll&&(S+1<L?Ct=(this.position.x-B)*A:B+1<X?Ct=p.scrollWidth-p.clientWidth:z>U+1&&(Ct=this.position.x*A)),this.ld)switch(this.ob){case"negative":Ct=-(p.scrollWidth-Ct-p.clientWidth);break;case"reverse":Ct=p.scrollWidth-Ct-p.clientWidth;break}if(p.scrollLeft=Ct,this.hasVerticalScrollbar&&this.allowVerticalScroll&&(N+1<M?p.scrollTop=(this.position.y-tt)*A:tt+1<nt?p.scrollTop=p.scrollHeight-p.clientHeight:Z>it+1&&(p.scrollTop=this.position.y*A)),a=this.wt,h=this.xt,p.style.width=a+(this.to?this.jt:0)+"px",p.style.height=h+(this.kn?this.jt:0)+"px",e!==a||i!==h||this.animationManager.ke){let Q=I.z(u,c,d,f);return this.onViewportBoundsChanged(Q,this.viewportBounds,F,n),I.i(Q),!1}return!0}add(t){let e=t.diagram;if(e===this)return;e!==null&&m.o("Cannot add part "+t.toString()+" to "+this.toString()+". It is already a part of "+e.toString());let i=this.findLayer(t.layerName);if(i===null&&(i=this.findLayer("")),i===null&&m.o('Cannot add a Part when unable find a Layer named "'+t.layerName+'" and there is no default Layer'),t.layer===i)return;let s=i.ch(99999999,t,t.diagram===this);s>=0&&this.raiseChangedEvent(3,"parts",i,null,t,null,s),i.isTemporary||this.invalidateDocumentBounds(),t.invalidateLayout(1);let n=t.layerChanged;n!==null&&n(t,null,i)}ch(t){this.partManager.ch(t);let e=this;Y.isUsingDOM()&&t.Pn(i=>e.uT(i)),t.data||t.zo(),t.hasPlaceholder()&&t.f(),t.data!==null&&t.Pn(i=>e.partManager.M2(i,null)),(t.as()===!0||t.fa()===!0)&&this.Sp(t),t.dT(!0,this),t instanceof $&&t.canAvoid()&&this.ud(t),t.gT()?(t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.wp!==null&&this.wp(this,t),this.requestUpdate()}ri(t){t.clearAdornments(),this.partManager.ri(t);let e=this;t.data!==null&&t.Pn(i=>e.partManager.N2(i,e)),this.Qn.delete(t),t instanceof j?this.Fr.delete(t):t instanceof $&&t.canAvoid()&&this.ud(t),t.gT()?(t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.xp!==null&&this.xp(this,t),this.requestUpdate()}remove(t){this.C2(t,!0)}C2(t,e){let i=t.layer;if(i===null||i.diagram!==this)return;t.isSelected=!1,t.isHighlighted=!1,t.invalidateLayout(2),e&&t.af();let s=i.ri(-1,t,!1);s>=0&&this.raiseChangedEvent(4,"parts",i,t,null,s,null);let n=t.layerChanged;n!==null&&n(t,i,null)}removeParts(t,e){if(e===void 0&&(e=!1),Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e&&!n.canDelete()||this.remove(n)}}else{let i=new V;i.addAll(t);let s=i.iterator;for(;s.next();){let n=s.value;e&&!n.canDelete()||this.remove(n)}}}copyParts(t,e,i){return i===void 0&&(i=!1),this.partManager.copyParts(t,e,i)}moveParts(t,e,i,s){if(i===void 0&&(i=!1),s===void 0&&(s=this.Cp()),this.toolManager===null)return;let n=new Mt;if(t!==null)if(Array.isArray(t))for(let o=0;o<t.length;o++)this.Zr(n,t[o],i,s);else{let o=t.iterator;for(;o.next();)this.Zr(n,o.value,i,s)}else{let o=this.parts;for(;o.next();){let r=o.value;this.Zr(n,r,i,s)}for(o=this.nodes;o.next();){let r=o.value;this.Zr(n,r,i,s)}for(o=this.links;o.next();){let r=o.value;this.Zr(n,r,i,s)}}this.Mx(n,e,s,i)}Zr(t,e,i,s,n){if(!t.has(e)&&(n===void 0&&(n=!1),!(i&&!n&&!e.canMove()&&!e.canCopy())))if(s===void 0&&(s=this.Cp()),e instanceof $){if(t.set(e,this.js(s,e,e.location)),e instanceof ht&&(e.hasPlaceholder()||s.dragsMembers)){let r=e.memberParts;for(;r.next();){let a=r.value;this.Zr(t,a,i,s,s.groupsAlwaysMove)}}let o=e.linksConnected;for(;o.next();){let r=o.value;if(t.has(r))continue;let a=r.fromNode,h=r.toNode;a!==null&&t.has(a)&&h!==null&&t.has(h)&&this.Zr(t,r,i,s)}if(s.dragsTree){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;this.Zr(t,a,i,s)}}}else if(e instanceof j){t.set(e,this.js(s,e));let o=e.labelNodes;for(;o.next();){let r=o.value;this.Zr(t,r,i,s)}}else e instanceof vt||t.set(e,this.js(s,e,e.location))}Mx(t,e,i,s){if(t===null||t.count===0)return;let n=P.l(),o=P.l();o.h(e),isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0);let r=this.$b;r||this.uA(t);let a=m.st(),h=m.st(),l=t.iterator,u=P.l();for(;l.next();){let g=l.key,y=l.value;if(g.Di()){let b=this.mT(g,t);if(b!==null)a.push(new On(g,y,b));else if(!s||g.canMove()){let v=y.point;n.h(v),this.computeMove(g,n.add(o),i,u),g.location=u,y.shifted===void 0&&(y.shifted=new P),y.shifted.h(u.subtract(v))}}else l.key instanceof j&&h.push(new pe(l.key,l.value))}P.i(u);let c=a.length;for(let g=0;g<c;g++){let y=a[g],b=y.pT.point;n.h(b),y.o1.shifted===void 0&&(y.o1.shifted=new P),y.Ri.location=n.add(y.o1.shifted)}let d=P.l(),f=P.l(),p=h.length;for(let g=0;g<p;g++){let y=h[g],b=y.key;if(b instanceof j){if(b.suspendsRouting){b.Ar=null;let v=b.fromNode,w=b.toNode;if(this.draggedLink!==null&&i.dragsLink){let k=y.value.point;if(b.dragComputation===null){t.set(b,this.js(i,b,o));let S=o.x-k.x,N=o.y-k.y;b.xr(S,N)}else{let S=P.z(0,0),N=b.getPoint(0);N&&N.isReal()&&S.h(N),u=P.l().h(S).add(o);let D=u;i.isGridSnapEnabled&&(i.isGridSnapRealtime||this.lastInput.up)&&(D=P.l(),this.rM(b,u,D,i)),u.h(b.dragComputation(b,u,D)).subtract(S),t.set(b,this.js(i,b,u));let L=u.x-k.x,M=u.y-k.y;b.xr(L,M),P.i(S),P.i(u),D!==u&&P.i(D)}}else{if(v!==null){d.h(v.location);let k=t.get(v);k!==null&&d.subtract(k.point)}if(w!==null){f.h(w.location);let k=t.get(w);k!==null&&f.subtract(k.point)}if(v!==null&&w!==null){let k=y.value.point;if(d.equalsApprox(f)||b.computeAdjusting()!==0){let S=n;S.h(d),S.subtract(k),t.set(b,this.js(i,b,d)),b.xr(S.x,S.y)}else b.suspendsRouting=!1,b.$t()}else{let k=y.value.point,S;v!==null?S=d:w!==null?S=f:S=o,t.set(b,this.js(i,b,S));let N=S.x-k.x,D=S.y-k.y;b.xr(N,D)}}}else if(b.fromNode===null||b.toNode===null){let v=y.value.point;t.set(b,this.js(i,b,o));let w=o.x-v.x,k=o.y-v.y;b.xr(w,k)}}}P.i(n),P.i(o),P.i(d),P.i(f),m.Z(a),m.Z(h),r||(this.Te(),this.gS(t))}computeMove(t,e,i,s){if(s===void 0&&(s=new P),s.h(e),t===null)return s;let n=e,o=i.isGridSnapEnabled;o&&(i.isGridSnapRealtime||this.lastInput.up)&&(n=P.l(),this.rM(t,e,n,i));let r=t.dragComputation!==null?t.dragComputation(t,e,n):n,a=t.minLocation,h=a.x;isNaN(h)&&(h=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let l=a.y;isNaN(l)&&(l=o?Math.round(t.location.y*1e3)/1e3:t.location.y);let u=t.maxLocation,c=u.x;isNaN(c)&&(c=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let d=u.y;return isNaN(d)&&(d=o?Math.round(t.location.y*1e3)/1e3:t.location.y),s.e(Math.max(h,Math.min(r.x,c)),Math.max(l,Math.min(r.y,d))),n!==e&&P.i(n),s}Cp(){let t=this.toolManager.findTool("Dragging");return t instanceof Tt?t.dragOptions:this.ad}rM(t,e,i,s){if(s===void 0&&(s=this.Cp()),i.h(e),t===null)return i;let n=this.grid,o=s.gridSnapCellSize,r=o.width,a=o.height,h=s.gridSnapOrigin,l=h.x,u=h.y,c=s.gridSnapCellSpot;if(n!==null){let f=n.gridCellSize;isNaN(r)&&(r=f.width),isNaN(a)&&(a=f.height);let p=n.gridOrigin;isNaN(l)&&(l=p.x),isNaN(u)&&(u=p.y)}let d=P.z(0,0);return d.setSpot(0,0,r,a,c),C._g(e.x,e.y,l+d.x,u+d.y,r,a,i),P.i(d),i}uA(t){if(t===null)return;this.$b=!0;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof j&&(i.suspendsRouting=!0)}}gS(t){if(t===null)return;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof j&&(i.suspendsRouting=!1,i.yT()&&i.$t())}this.$b=!1}get draggedLink(){return this.Zb}set draggedLink(t){this.Zb!==t&&(this.Zb=t,t!==null&&(this.Qb=t.fromPort,this._b=t.toPort))}get bS(){return this.Qb}set bS(t){this.Qb=t}get kS(){return this._b}set kS(t){this._b=t}mT(t,e){let i=t.containingGroup;if(i!==null){let s=this.mT(i,e);if(s!==null||(s=e.get(i),s!==null))return s}return null}js(t,e,i){if(i===void 0)return new Ke(P.dn);let s=t.isGridSnapEnabled;return!t.groupsSnapMembers&&e.containingGroup!==null&&(s=!1),s?new Ke(new P(Math.round(i.x*1e3)/1e3,Math.round(i.y*1e3)/1e3)):new Ke(i.copy())}L2(t,e){if(t.diagram!==null&&t.diagram!==this&&m.o("Cannot share a Layer with another Diagram: "+t+" of "+t.diagram),e===null?t.diagram!==null&&m.o("Cannot add an existing Layer to this Diagram again: "+t):(e.diagram!==this&&m.o("Existing Layer must be in this Diagram: "+e+" not in "+e.diagram),t===e&&m.o("Cannot move a Layer before or after itself: "+t)),t.diagram===this)return;let i=t.name,s=this.Vt,n=s.count;for(let o=0;o<n;o++)s.elt(o).name===i&&m.o("Cannot add Layer with the name '"+i+"'; a Layer with the same name is already present in this Diagram.")}addLayer(t){this.L2(t,null),t.Ro(this);let e=this.Vt,i=e.count-1;if(!t.isTemporary)for(;i>=0&&e.elt(i).isTemporary;)i--;return e.insertAt(i+1,t),this.Ce!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,i+1),this.C(),this.invalidateDocumentBounds(),this}addLayerBefore(t,e){this.L2(t,e),t.Ro(this);let i=this.Vt,s=i.indexOf(t);s>=0&&(i.delete(t),this.Ce!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o,t);break}return this.Ce!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o),this.C(),s<0&&this.invalidateDocumentBounds(),this}addLayerAfter(t,e){this.L2(t,e),t.Ro(this);let i=this.Vt,s=i.indexOf(t);s>=0&&(i.delete(t),this.Ce!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o+1,t);break}return this.Ce!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o+1),this.C(),s<0&&this.invalidateDocumentBounds(),this}Jr(t,e){t.Ro(this),this.Vt.insertAt(e,t)}wT(t){this.Vt.removeAt(t)}removeLayer(t){if(t.diagram!==this&&m.o("Cannot remove a Layer from another Diagram: "+t+" of "+t.diagram),t.name==="")return;let e=this.Vt,i=e.indexOf(t);if(e.delete(t)){let s=t.Nt.copy().iterator;for(;s.next();){let n=s.value,o=n.layerName;o!==t.name?n.layerName=o:n.layerName=""}this.Ce!==null&&this.raiseChangedEvent(4,"layers",this,t,null,i,null),this.C(),this.invalidateDocumentBounds()}}findLayer(t){let e=this.layers;for(;e.next();){let i=e.value;if(i.name===t)return i}return null}findRouter(t){for(let e of this.rf)if(e.name===t)return e;return null}addModelChangedListener(t){return m.S(t,Y,"addModelChangedListener:listener"),this._n===null&&(this._n=new q),this._n.add(t),this.model&&this.model.addChangedListener(t),this}removeModelChangedListener(t){m.S(t,Y,"removeModelChangedListener:listener"),this._n!==null&&(this._n.delete(t),this._n.count===0&&(this._n=null)),this.model.removeChangedListener(t)}addChangedListener(t){return m.S(t,Y,"addChangedListener:listener"),this.Rr===null&&(this.Rr=new q),this.Rr.add(t),this}removeChangedListener(t){m.S(t,Y,"removeChangedListener:listener"),this.Rr!==null&&(this.Rr.delete(t),this.Rr.count===0&&(this.Rr=null))}A2(t){if(!this.skipsUndoManager&&!this.model.skipsUndoManager&&this.model.undoManager.handleChanged(t),t.change!==1&&(this.isModified=!0),this.Rr!==null){let e=this.Rr,i=e.length;for(let s=0;s<i;s++)e.elt(s)(t)}}raiseChangedEvent(t,e,i,s,n,o,r){o===void 0&&(o=null),r===void 0&&(r=null);let a=new Xe;a.diagram=this,a.change=t,a.propertyName=e,a.object=i,a.oldValue=s,a.oldParam=o,a.newValue=n,a.newParam=r,this.A2(a)}raiseChanged(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}t(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}get partAdded(){return this.wp}set partAdded(t){this.partAdded!==t&&(this.wp=t)}get partRemoved(){return this.xp}set partRemoved(t){this.partRemoved!==t&&(this.xp=t)}get animationManager(){return this.Ns}get undoManager(){return this.Ce.undoManager}get skipsUndoManager(){return this.Eo}set skipsUndoManager(t){m.s(t,"boolean",Y,"skipsUndoManager"),this.Eo=t,this.Ce.skipsUndoManager=t}get delaysLayout(){return this.Cb}set delaysLayout(t){this.Cb=t}tA(t,e){if(t===null||t.diagram!==this)return;let i=this.wi;try{this.wi=!0;let s=t.change;if(s===2){let n=t.object,o=t.propertyName,r=t.getValue(e);if(t.diagram.model.nt(n,o,r),n instanceof J){let a=n.part;a!==null&&(a.invalidateAdornments(),a instanceof j&&(a.fromNode?.Ze(a.fromPort),a.toNode?.Ze(a.toPort)))}this.isModified=!0}else if(s===3){let n=t.object,o=t.newParam,r=t.newValue;if(n instanceof G)if(typeof o=="number"&&r instanceof J){e?n.ri(o):n.insertAt(o,r);let a=n.part;a!==null&&a.invalidateAdornments()}else typeof o=="number"&&r instanceof Kt&&(r.isRow?n.xT(o,e?void 0:r):n.bT(o,e?void 0:r));else if(n instanceof Et){let a=t.oldParam===!0;typeof o=="number"&&r instanceof pt&&(e?(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.ri(a?o:-1,r,a)):n.ch(o,r,a))}else n instanceof Y?typeof o=="number"&&r instanceof Et&&(e?this.wT(o):this.Jr(r,o)):m.o("unknown ChangeType.Insert object: "+t.toString());this.isModified=!0}else if(s===4){let n=t.object,o=t.oldParam,r=t.oldValue;if(n instanceof G)typeof o=="number"&&r instanceof J?e?n.insertAt(o,r):n.ri(o):typeof o=="number"&&r instanceof Kt&&(r.isRow?n.xT(o,e?r:void 0):n.bT(o,e?r:void 0));else if(n instanceof Et){let a=t.newParam===!0;typeof o=="number"&&r instanceof pt&&(e?n.Nt.indexOf(r)<0&&n.ch(o,r,a):(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.ri(a?o:-1,r,a)))}else n instanceof Y?typeof o=="number"&&r instanceof Et&&(e?this.Jr(r,o):this.wT(o)):m.o("unknown ChangeType.Remove object: "+t.toString());this.isModified=!0}else s===1||m.o("unknown ChangedEvent: "+t.toString())}finally{this.wi=i}}startTransaction(t){return this.undoManager.startTransaction(t)}commitTransaction(t){return this.undoManager.commitTransaction(t)}rollbackTransaction(){return this.undoManager.rollbackTransaction()}commit(t,e){let i=e;i===void 0&&(i="");let s=this.skipsUndoManager;i===null&&(this.skipsUndoManager=!0,i=""),this.undoManager.startTransaction(i);let n=!1;try{t(this),n=!0}finally{n?this.undoManager.commitTransaction(i):this.undoManager.rollbackTransaction(),this.skipsUndoManager=s}}updateAllTargetBindings(t){this.partManager.updateAllTargetBindings(t)}updateAllThemeBindings(){if(this.partManager.updateAllThemeBindings(),this.ls!==null){let t=this.ls.part;t!==null&&t.zo()}}setDivBackground(t){this.div&&(this.div.style.backgroundColor=t)}updateAllRelationshipsFromData(){this.partManager.updateAllRelationshipsFromData()}Pp(){let t=this.v,e=this.et,i=this.ct;t.Ue(),e!==1&&t.et(e),(i.x!==0||i.y!==0)&&t.Xs(-i.x,-i.y)}kT(t,e){let i=this.animationManager;if(this.Ht||this.As){this.et=e,this.aa(),this.C(),this.Nh(),i.EA(t,this.et),this.Pp();return}if(this.lt===null){this.et=e,this.Pp();return}this.Ht=!0;let s=this.viewportBounds.copy(),n=this.wt,o=this.xt,r=this.zoomPoint.x,a=this.zoomPoint.y,h=this.contentAlignment;isNaN(r)&&(h.isSide()?h.includesSide(T.LeftSide)?r=0:h.includesSide(T.RightSide)&&(r=n-1):h.isSpot()?r=h.x*(n-1):r=n/2),isNaN(a)&&(h.isSide()?h.includesSide(T.TopSide)?a=0:h.includesSide(T.BottomSide)&&(a=o-1):h.isSpot()?a=h.y*(o-1):a=o/2),this.scaleComputation!==null&&!this.animationManager.defaultAnimation.isAnimating&&(e=this.scaleComputation(this,e)),e<this.minScale&&(e=this.minScale),e>this.maxScale&&(e=this.maxScale);let l=P.z(this.ct.x+r/t-r/e,this.ct.y+a/t-a/e);this.position=l,P.i(l),this.et=e,this.Pp(),this.aa(),this.Ht=!1,this.onViewportBoundsChanged(s,this.viewportBounds,t,!1),this.Js(!1),i.EA(t,this.et),this.C()}pO(){let t=this.Vt.r;for(let e=0;e<t.length;e++)t[e].YA()}onViewportBoundsChanged(t,e,i,s){if(t.equals(e))return;s===void 0&&(s=!1),s||this.Nh(),this.ha();let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(t.width!==e.width||t.height!==e.height)&&n.p();let o=this.currentTool;this.nf===!0&&o instanceof ne&&!this.animationManager.isTicking&&(this.lastInput.documentPoint=this.transformViewToDoc(this.lastInput.viewPoint),o.cA(this)),this.Ht||this.invalidateViewport(t,e),this.ca();let r=this.Vt.r;this.rs(r,r.length,this,this.viewportBounds),this.Ye.scale=i,this.Ye.position.x=t.x,this.Ye.position.y=t.y,this.Ye.bounds.h(t),this.Ye.canvasSize.width=Math.round(t.width*i),this.Ye.canvasSize.height=Math.round(t.height*i),this.Ye.newCanvasSize.width=this.wt,this.Ye.newCanvasSize.height=this.xt,this.Ye.isScroll=s,this.T("ViewportBoundsChanged",this.Ye,t),this.isVirtualized&&this.links.each(a=>{a.isAvoiding&&a.actualBounds.intersectsRect(e)&&a.$t()})}ca(t){let e=this.ls;if(e===null||!e.visible||e.part===null||e.layer===null)return;let i=t!==void 0?t:this.Xb;if(!i.isReal())return;let s=i.width,n=i.height;if(e.scale=1,e.angle=0,e.layer.isViewportAligned)e.width=s*this.scale,e.height=n*this.scale,e.part.alignment=T.TopLeft;else{e.Pe===null&&(e.Pe=new ti);let o=e.Pe.hf;if(!o.isReal())return;e.width=s+o.width*2,e.height=n+o.height*2;let r=P.l();C._g(i.x,i.y,0,0,o.width,o.height,r),r.offset(-o.width,-o.height),e.part.location=r,P.i(r)}}clearSelection(t){t===void 0&&(t=!1);let e=this.selection;if(e.count===0)return;t||this.T("ChangingSelection",e);let i=e.toArray(),s=i.length;for(let n=0;n<s;n++){let o=i[n];o.isSelected=!1}e.ce(),e.clear(),e.k(),t||this.T("ChangedSelection",e)}select(t){t!==null&&t.diagram===this&&(!t.isSelected||this.selection.count>1)&&(this.T("ChangingSelection",this.selection),this.clearSelection(!0),t.isSelected=!0,this.T("ChangedSelection",this.selection))}selectCollection(t){if(this.T("ChangingSelection",this.selection),this.clearSelection(!0),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s instanceof pt||m.o("Diagram.selectCollection given something that is not a Part: "+s),s.isSelected=!0}}else{let e=t.iterator;for(;e.next();){let i=e.value;i instanceof pt||m.o("Diagram.selectCollection given something that is not a Part: "+i),i.isSelected=!0}}this.T("ChangedSelection",this.selection)}clearHighlighteds(){let t=this.highlighteds;if(t.count>0){let e=t.toArray(),i=e.length;for(let s=0;s<i;s++){let n=e[s];n.isHighlighted=!1}t.ce(),t.clear(),t.k()}}highlight(t){t!==null&&t.diagram===this&&(!t.isHighlighted||this.highlighteds.count>1)&&(this.clearHighlighteds(),t.isHighlighted=!0)}highlightCollection(t){let e=new V().addAll(t),i=this.highlighteds.copy().removeAll(e).iterator;for(;i.next();){let n=i.value;n.isHighlighted=!1}let s=e.iterator;for(;s.next();){let n=s.value;n instanceof pt||m.o("Diagram.highlightCollection given something that is not a Part: "+n),n.isHighlighted=!0}}scroll(t,e,i){i===void 0&&(i=1);let s=e==="up"||e==="down",n=0,o=P.l();if(t==="pixel")n=i;else if(t==="line")n=i*(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if(t==="page"){let a=s?this.viewportBounds.height:this.viewportBounds.width;if(a*=this.scale,a!==0){let h=Math.max(a-(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0);n=i*h}}else if(t==="document"){let a=this.documentBounds,h=this.viewportBounds;e==="up"?this.position=o.e(h.x,a.y):e==="left"?this.position=o.e(a.x,h.y):e==="down"?this.position=o.e(h.x,a.bottom-h.height):e==="right"&&(this.position=o.e(a.right-h.width,h.y)),P.i(o);return}else m.o("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+t);n/=this.scale;let r=this.position;e==="up"?this.position=o.e(r.x,r.y-n):e==="down"?this.position=o.e(r.x,r.y+n):e==="left"?this.position=o.e(r.x-n,r.y):e==="right"?this.position=o.e(r.x+n,r.y):m.o("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+e),P.i(o)}scrollToRect(t){let e=this.viewportBounds;if(e.containsRect(t))return;let i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}centerRect(t){let e=this.viewportBounds,i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}transformDocToView(t){return t.copy().v(this.v)}transformViewToDoc(t){return t.copy().Yi(this.v)}GR(t){return t.Yi(this.v)}static None=1;static Uniform=2;static UniformToFill=3;static CycleAll=1;static CycleNotDirected=2;static CycleNotDirectedFast=3;static CycleNotUndirected=4;static CycleDestinationTree=5;static CycleSourceTree=6;static DocumentScroll=1;static InfiniteScroll=2;static TreeParentCollapsed=1;static AllParentsCollapsed=2;static AnyParentsCollapsed=3;get opacity(){return this.Zt}set opacity(t){let e=this.Zt;e!==t&&(m.s(t,"number",Y,"opacity"),(t<0||t>1)&&m.J(t,"0 <= value <= 1",Y,"opacity"),this.Zt=t,this.t("opacity",e,t),this.C())}get validCycle(){return this.bb}set validCycle(t){let e=this.bb;e!==t&&(this.bb=t,this.t("validCycle",e,t))}get layers(){return this.Vt.iterator}get isModelReadOnly(){let t=this.Ce;return t===null?!1:t.isReadOnly}set isModelReadOnly(t){let e=this.Ce;e!==null&&(e.isReadOnly=t)}get isReadOnly(){return this.Uo}set isReadOnly(t){let e=this.Uo;e!==t&&(m.s(t,"boolean",Y,"isReadOnly"),this.Uo=t,this.t("isReadOnly",e,t))}get isEnabled(){return this.Be}set isEnabled(t){let e=this.Be;e!==t&&(m.s(t,"boolean",Y,"isEnabled"),this.Be=t,this.t("isEnabled",e,t))}get allowClipboard(){return this.Lb}set allowClipboard(t){let e=this.Lb;e!==t&&(m.s(t,"boolean",Y,"allowClipboard"),this.Lb=t,this.t("allowClipboard",e,t))}get allowCopy(){return this.Yl}set allowCopy(t){let e=this.Yl;e!==t&&(m.s(t,"boolean",Y,"allowCopy"),this.Yl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.Kl}set allowDelete(t){let e=this.Kl;e!==t&&(m.s(t,"boolean",Y,"allowDelete"),this.Kl=t,this.t("allowDelete",e,t))}get allowDragOut(){return this.Ab}set allowDragOut(t){let e=this.Ab;e!==t&&(m.s(t,"boolean",Y,"allowDragOut"),this.Ab=t,this.t("allowDragOut",e,t))}get allowDrop(){return this.Tb}set allowDrop(t){let e=this.Tb;e!==t&&(m.s(t,"boolean",Y,"allowDrop"),this.Tb=t,this.t("allowDrop",e,t))}get allowTextEdit(){return this.Hl}set allowTextEdit(t){let e=this.Hl;e!==t&&(m.s(t,"boolean",Y,"allowTextEdit"),this.Hl=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.ql}set allowGroup(t){let e=this.ql;e!==t&&(m.s(t,"boolean",Y,"allowGroup"),this.ql=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.jl}set allowUngroup(t){let e=this.jl;e!==t&&(m.s(t,"boolean",Y,"allowUngroup"),this.jl=t,this.t("allowUngroup",e,t))}get allowInsert(){return this.Db}set allowInsert(t){let e=this.Db;e!==t&&(m.s(t,"boolean",Y,"allowInsert"),this.Db=t,this.t("allowInsert",e,t))}get allowLink(){return this.Wl}set allowLink(t){let e=this.Wl;e!==t&&(m.s(t,"boolean",Y,"allowLink"),this.Wl=t,this.t("allowLink",e,t))}get allowRelink(){return this.Jl}set allowRelink(t){let e=this.Jl;e!==t&&(m.s(t,"boolean",Y,"allowRelink"),this.Jl=t,this.t("allowRelink",e,t))}get allowMove(){return this.$l}set allowMove(t){let e=this.$l;e!==t&&(m.s(t,"boolean",Y,"allowMove"),this.$l=t,this.t("allowMove",e,t))}get allowReshape(){return this.Zl}set allowReshape(t){let e=this.Zl;e!==t&&(m.s(t,"boolean",Y,"allowReshape"),this.Zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Ql}set allowResize(t){let e=this.Ql;e!==t&&(m.s(t,"boolean",Y,"allowResize"),this.Ql=t,this.t("allowResize",e,t))}get allowRotate(){return this._l}set allowRotate(t){let e=this._l;e!==t&&(m.s(t,"boolean",Y,"allowRotate"),this._l=t,this.t("allowRotate",e,t))}get allowSelect(){return this.ta}set allowSelect(t){let e=this.ta;e!==t&&(m.s(t,"boolean",Y,"allowSelect"),this.ta=t,this.t("allowSelect",e,t))}get allowUndo(){return this.vb}set allowUndo(t){let e=this.vb;e!==t&&(m.s(t,"boolean",Y,"allowUndo"),this.vb=t,this.t("allowUndo",e,t))}get allowZoom(){return this.Fb}set allowZoom(t){let e=this.Fb;e!==t&&(m.s(t,"boolean",Y,"allowZoom"),this.Fb=t,this.t("allowZoom",e,t))}get hasVerticalScrollbar(){return this._u}set hasVerticalScrollbar(t){let e=this._u;e!==t&&(m.s(t,"boolean",Y,"hasVerticalScrollbar"),this._u=t,this.Nh(),this.C(),this.t("hasVerticalScrollbar",e,t),this.Js(!1))}get hasHorizontalScrollbar(){return this.Qu}set hasHorizontalScrollbar(t){let e=this.Qu;e!==t&&(m.s(t,"boolean",Y,"hasHorizontalScrollbar"),this.Qu=t,this.Nh(),this.C(),this.t("hasHorizontalScrollbar",e,t),this.Js(!1))}get allowHorizontalScroll(){return this.Rb}set allowHorizontalScroll(t){let e=this.Rb;e!==t&&(m.s(t,"boolean",Y,"allowHorizontalScroll"),this.Rb=t,this.t("allowHorizontalScroll",e,t),this.Js(!1))}get allowVerticalScroll(){return this.Ob}set allowVerticalScroll(t){let e=this.Ob;e!==t&&(m.s(t,"boolean",Y,"allowVerticalScroll"),this.Ob=t,this.t("allowVerticalScroll",e,t),this.Js(!1))}get scrollHorizontalLineChange(){return this.Ib}set scrollHorizontalLineChange(t){let e=this.Ib;e!==t&&(m.s(t,"number",Y,"scrollHorizontalLineChange"),t<0&&m.J(t,">= 0",Y,"scrollHorizontalLineChange"),this.Ib=t,this.t("scrollHorizontalLineChange",e,t))}get scrollVerticalLineChange(){return this.Eb}set scrollVerticalLineChange(t){let e=this.Eb;e!==t&&(m.s(t,"number",Y,"scrollVerticalLineChange"),t<0&&m.J(t,">= 0",Y,"scrollVerticalLineChange"),this.Eb=t,this.t("scrollVerticalLineChange",e,t))}get lastInput(){return this.gh}set lastInput(t){this.gh=t}get previousInput(){return this.qr}set previousInput(t){this.qr=t}get firstInput(){return this.ap}set firstInput(t){this.ap=t}get currentCursor(){return this.kb}set currentCursor(t){if(t===""&&(t=this.ip),this.kb!==t){m.s(t,"string",Y,"currentCursor");let e=this.lt,i=this.Mt;if(e===null||i===null)return;this.kb=t;let s=e.style.cursor;e.style.cursor=t,i.style.cursor=t,e.style.cursor===s&&(e.style.cursor="-webkit-"+t,i.style.cursor="-webkit-"+t,e.style.cursor===s&&(e.style.cursor="-moz-"+t,i.style.cursor="-moz-"+t,e.style.cursor===s&&(e.style.cursor=t,i.style.cursor=t)))}}get defaultCursor(){return this.ip}set defaultCursor(t){t===""&&(t="auto");let e=this.ip;e!==t&&(m.s(t,"string",Y,"defaultCursor"),this.ip=t,this.t("defaultCursor",e,t))}get click(){return this.Or}set click(t){let e=this.Or;e!==t&&(t!==null&&m.S(t,Y,"click"),this.Or=t,this.t("click",e,t))}get doubleClick(){return this.Ir}set doubleClick(t){let e=this.Ir;e!==t&&(t!==null&&m.S(t,Y,"doubleClick"),this.Ir=t,this.t("doubleClick",e,t))}get contextClick(){return this.Er}set contextClick(t){let e=this.Er;e!==t&&(t!==null&&m.S(t,Y,"contextClick"),this.Er=t,this.t("contextClick",e,t))}get mouseOver(){return this.Ur}set mouseOver(t){let e=this.Ur;e!==t&&(t!==null&&m.S(t,Y,"mouseOver"),this.Ur=t,this.t("mouseOver",e,t))}get mouseHover(){return this.Vr}set mouseHover(t){let e=this.Vr;e!==t&&(t!==null&&m.S(t,Y,"mouseHover"),this.Vr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.Br}set mouseHold(t){let e=this.Br;e!==t&&(t!==null&&m.S(t,Y,"mouseHold"),this.Br=t,this.t("mouseHold",e,t))}get mouseDragOver(){return this.Pb}set mouseDragOver(t){let e=this.Pb;e!==t&&(t!==null&&m.S(t,Y,"mouseDragOver"),this.Pb=t,this.t("mouseDragOver",e,t))}get mouseDrop(){return this.zr}set mouseDrop(t){let e=this.zr;e!==t&&(this.zr=t,this.t("mouseDrop",e,t))}get handlesDragDropForTopLevelParts(){return this.Sb}set handlesDragDropForTopLevelParts(t){let e=this.Sb;e!==t&&(m.s(t,"boolean",Y,"handlesDragDropForTopLevelParts"),this.Sb=t,this.t("handlesDragDropForTopLevelParts",e,t))}get mouseEnter(){return this.Xr}set mouseEnter(t){let e=this.Xr;e!==t&&(t!==null&&m.S(t,Y,"mouseEnter"),this.Xr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.Gr}set mouseLeave(t){let e=this.Gr;e!==t&&(t!==null&&m.S(t,Y,"mouseLeave"),this.Gr=t,this.t("mouseLeave",e,t))}get toolTip(){return this.Yr}set toolTip(t){let e=this.Yr;e!==t&&(this.Yr=t,this.t("toolTip",e,t))}get contextMenu(){return this.Kr}set contextMenu(t){let e=this.Kr;e!==t&&(this.Kr=t,this.t("contextMenu",e,t))}get commandHandler(){return this.HM}set commandHandler(t){let e=this.HM;e!==t&&(e&&e.doStop(),this.HM=t,t.Ro(this),t.doStart())}get toolManager(){return this.GM}set toolManager(t){this.GM!==t&&(this.GM=t,t.diagram=this)}get defaultTool(){return this.YM}set defaultTool(t){let e=this.YM;e!==t&&(this.YM=t,t.diagram=this,this.currentTool===e&&(this.currentTool=t))}get currentTool(){return this.KM}set currentTool(t){let e=this.KM;e&&(e.isActive&&e.doDeactivate(),e.cancelWaitAfter(),e.doStop()),t===null&&(t=this.defaultTool),t!==null&&(this.KM=t,t.diagram=this,t.doStart())}get selection(){return this.KA}get maxSelectionCount(){return this.zb}set maxSelectionCount(t){let e=this.zb;if(e!==t)if(m.s(t,"number",Y,"maxSelectionCount"),t>=0&&!isNaN(t)){if(this.zb=t,this.t("maxSelectionCount",e,t),!this.undoManager.isUndoingRedoing){let i=this.selection.count-t;if(i>0){this.T("ChangingSelection",this.selection);let s=this.selection.toArray();for(let n=0;n<i;n++)s[n].isSelected=!1;this.T("ChangedSelection",this.selection)}}}else m.J(t,">= 0",Y,"maxSelectionCount")}get nodeSelectionAdornmentTemplate(){return this.rp}set nodeSelectionAdornmentTemplate(t){let e=this.rp;e!==t&&(this.rp=t.It(),this.t("nodeSelectionAdornmentTemplate",e,t))}get groupSelectionAdornmentTemplate(){return this.Yb}set groupSelectionAdornmentTemplate(t){let e=this.Yb;e!==t&&(this.Yb=t.It(),this.t("groupSelectionAdornmentTemplate",e,t))}get linkSelectionAdornmentTemplate(){return this.Kb}set linkSelectionAdornmentTemplate(t){let e=this.Kb;e!==t&&(this.Kb=t.It(),this.t("linkSelectionAdornmentTemplate",e,t))}get highlighteds(){return this.HA}get isModified(){let t=this.undoManager;return t.isEnabled?t.currentTransaction!==null?!0:this.nd&&this.Hs!==t.historyIndex:this.nd}set isModified(t){if(this.nd!==t){m.s(t,"boolean",Y,"isModified"),this.nd=t;let e=this.undoManager;!t&&e.isEnabled&&(this.Hs=e.historyIndex),t||this.PT()}}PT(){let t=this.isModified;this.JM!==t&&(this.JM=t,this.T("Modified"))}get model(){return this.Ce}set model(t){let e=this.Ce;if(e!==t){this.currentTool.doCancel(),e&&e.undoManager!==t.undoManager&&e.undoManager.isInTransaction&&m.o("Do not replace a Diagram.model while a transaction is in progress.");let i=this.sT(!0);this.eo=!1,this.Zu=!0,this.Hs=-2,this.Lr=!1;let s=this.Ht;this.Ht=!0,this.animationManager.Gl("Model"),e&&(this._n!==null&&this._n.each(n=>e.removeChangedListener(n)),e.removeChangedListener(this._c)),this.Ce=t,this.partManager=this.NO(this.Ce.type),this.initializePartManager(this.partManager);for(let n=0;n<i.length;n++)this.add(i[n]);t.addChangedListener(this.WM),this.partManager.T2(),t.removeChangedListener(this.WM),t.addChangedListener(this._c),this._n!==null&&this._n.each(n=>t.addChangedListener(n)),this.Ht=s,this.invalidateDocumentBounds(),this.Ht||this.C(),e&&t.undoManager.copyProperties(e.undoManager)}}get themeManager(){return this.u2}set themeManager(t){let e=this.u2;e!==t&&(e&&e.removeDiagram(this),this.u2=t,t!==null&&t.addDiagram(this))}initializePartManager(t){}static d2(t,e){Y.JA.set(t,e)}static get licenseKey(){return Y.D2.last()}static set licenseKey(t){Y.D2.add(t.replace(/\s/g,""))}static get version(){return Y.CO}static D2=new q;static CO="3.1.6";NO(t){let e=Y.JA.get(t);return e!==null?new e:new ge}get G(){return this.jM}set G(t){this.jM=t}get ib(){return this.qA}LO(t){if(t.model!==this.model)return;let e=t.change,i=t.propertyName;if(e===1&&i[0]==="S"){if(i==="StartingFirstTransaction"){let s=this,n=this.toolManager;n.mouseDownTools.each(o=>o.diagram=s),n.mouseMoveTools.each(o=>o.diagram=s),n.mouseUpTools.each(o=>o.diagram=s),this.routers.each(o=>o.diagram=s),!this.As&&!this.eo&&(this.Qc=!0,this.Zu&&(this.Lr=!0))}else if(i==="StartingUndo"||i==="StartingRedo"){let s=this.animationManager;this.skipsUndoManager||(s.defaultAnimation.isAnimating&&s.stopAnimation(),s.getBundleAnimation().isAnimating&&s.getBundleAnimation().stop()),this.T("ChangingSelection",this.selection)}else if(i==="StartedTransaction"){let s=this.animationManager;s.defaultAnimation.isAnimating&&!this.skipsUndoManager&&s.stopAnimation()}return}if(this.G){this.G=!1;try{if(t.modelChange===""&&e===1){(i==="FinishedUndo"||i==="FinishedRedo")&&(this.T("ChangedSelection",this.selection),this.Te());let s=this.animationManager;i==="RolledBackTransaction"&&s.stopAnimation(),this.VA(),this.Qc=!0,this.maybeUpdate(),(this.undoManager.transactionLevel===0||this.undoManager.transactionLevel===1)&&s.PM(),i==="CommittedTransaction"&&this.undoManager.isJustDiscarded&&(this.Hs=Math.min(this.Hs,this.undoManager.historyIndex-1)),(i==="CommittedTransaction"||i==="RolledBackTransaction")&&this.undoManager.xx&&m.un(()=>{this.isModified=!1},1);let n=t.isTransactionFinished;if(n&&(this.PT(),this.ib.clear(),this.animationManager.CR()),!this.Mb&&n&&this.lastInput.targetDiagram){this.Mb=!0;let o=this;m.un(()=>{o.currentTool.standardMouseOver(),o.Mb=!1},10)}}}finally{this.G=!0}}}get wi(){return this.qM}set wi(t){this.qM=t}get Ou(){return this.Nb}set Ou(t){this.Nb=t}uT(t){let e=t.D.r;for(let i of e)i instanceof Bt&&this.v2(i)}v2(t){let e=t.element;if(e===null||!K.HTMLImageElement||!(e instanceof HTMLImageElement)||(e.hs instanceof V&&e.hs.add(this),t.AO(),!e.Lp))return;let i=e.getAttribute("src")||"",s=this.oa.get(i);if(s===null){Bt.ST(t,e);let n=[];n.push(t),this.oa.set(i,n)}else{for(let n=0;n<s.length;n++)if(s[n]===t)return;s.push(t)}}TO(t){let e=t.D.r,i=e.length;for(let s=0;s<i;s++)this.F2(e[s])}F2(t){if(!(t instanceof Bt))return;let e=t.element;if(e===null||!K.HTMLImageElement||!(e instanceof HTMLImageElement)||!e.Lp)return;let i=e.getAttribute("src")||"",s=this.oa.get(i);if(s!==null){for(let n=0;n<s.length;n++)if(s[n]===t){s.splice(n,1),s.length===0&&(this.oa.delete(i),Bt.DO(e),e.hs instanceof V&&e.hs.delete(this));return}}}nT(){Bt.clearCache(),this.oa.clear()}rebuildParts(){this.partManager.rebuildParts()}Hc(t,e){this.Ns.Hc(t,e)}Kc(t,e){this.Ns.Kc(t,e)}findPartForKey(t){return this.partManager.findPartForKey(t)}findNodeForKey(t){return this.partManager.findNodeForKey(t)}findLinkForKey(t){return this.partManager.findLinkForKey(t)}findPartForData(t){return this.partManager.findPartForData(t)}findNodeForData(t){return this.partManager.findNodeForData(t)}findLinkForData(t){return this.partManager.findLinkForData(t)}findNodesByExample(...t){return this.partManager.findNodesByExample(...t)}findLinksByExample(...t){return this.partManager.findLinksByExample(...t)}get nodeTemplate(){return this.Hr.get("")}set nodeTemplate(t){let e=this.Hr.get("");e!==t&&(this.Hr.set("",t),this.t("nodeTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get nodeTemplateMap(){return this.Hr}set nodeTemplateMap(t){let e=this.Hr;e!==t&&(this.Hr=t,this.t("nodeTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplate(){return this.dh.get("")}set groupTemplate(t){let e=this.dh.get("");e!==t&&(this.dh.set("",t),this.t("groupTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplateMap(){return this.dh}set groupTemplateMap(t){let e=this.dh;e!==t&&(this.dh=t,this.t("groupTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplate(){return this.na.get("")}set linkTemplate(t){let e=this.na.get("");e!==t&&(this.na.set("",t),this.t("linkTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplateMap(){return this.na}set linkTemplateMap(t){let e=this.na;e!==t&&(this.na=t,this.t("linkTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get isMouseCaptured(){return this.$M}set isMouseCaptured(t){let e=this.lt;if(e===null)return;let i=e.bt;i instanceof SVGElement||(t?(this.lastInput.bubbles=!1,this.Le(i,"pointermove",this.xh,!1),this.Le(i,"pointerdown",this.la,!1),this.Le(i,"pointerup",this.bh,!1),this.Le(i,"pointerout",this.kh,!1),this.Le(i,"pointercancel",this.Ph,!1),this.Et(K,"pointermove",this.xh,!0),this.Et(K,"pointerdown",this.la,!0),this.Et(K,"pointerup",this.bh,!0),this.Et(K,"pointerout",this.kh,!0),this.Et(K,"pointercancel",this.Ph,!0),this.Le(i,"wheel",this.wh,!1),this.Et(K,"wheel",this.wh,!0),this.Et(K,"selectstart",this.oh,!1)):(this.Le(K,"pointermove",this.xh,!0),this.Le(K,"pointerdown",this.la,!0),this.Le(K,"pointerup",this.bh,!0),this.Le(K,"pointerout",this.kh,!0),this.Le(K,"pointercancel",this.Ph,!0),this.Et(i,"pointermove",this.xh,!1),this.Et(i,"pointerdown",this.la,!1),this.Et(i,"pointerup",this.bh,!1),this.Et(i,"pointerout",this.kh,!1),this.Et(i,"pointercancel",this.Ph,!1),this.Le(K,"wheel",this.wh,!0),this.Le(K,"selectstart",this.oh,!1),this.Et(i,"wheel",this.wh,!1)),this.$M=t)}get position(){return this.ct}set position(t){if(this.ct.equals(t))return;let e=P.l().h(this.ct),i=this.viewportBounds.copy();if(this.ct.h(t),this.animationManager.IA(e,this.ct),!this.Ht&&!(this.lt===null&&!this.ed.isReal())){this.Ht=!0;let s=this.scale,n=this.wt/s,o=this.xt/s;this.w2(this.op,n,o,this.$c,!1),this.Ht=!1}else this.aa(),this.Pp();if(!this.Ht){let s=this.viewportBounds;this.onViewportBoundsChanged(i,s,this.et,!1)}P.i(e)}get initialPosition(){return this.rb}set initialPosition(t){this.rb.equals(t)||(this.rb=t.N())}get initialScale(){return this.lb}set initialScale(t){this.lb!==t&&(m.s(t,"number",Y,"initialScale"),this.lb=t)}get grid(){return this.ls===null&&(this.ls=this.rT()),this.ls}set grid(t){let e=this.ls;if(e!==t){e===null&&(this.ls=this.rT(),e=this.ls),t.type!==G.Grid&&m.o("Diagram.grid must be a Panel of type Panel.Grid");let i=e.panel;i!==null&&i.remove(e),this.ls=t,t.name="GRID",i!==null&&i.add(t),this.sd=!1,this.C(),this.t("grid",e,t)}}get viewportBounds(){return this.Xb}aa(){let t=this.Xb,e=this.ct,i=this.et;t.e(e.x,e.y,Math.max(this.wt,0)/i,Math.max(this.xt,0)/i),this.ha()}get viewSize(){return this.ed}set viewSize(t){let e=this.viewSize;if(!e.equals(t)){t=t.N(),this.ed=t;let i=0,s=0;t.isReal()?(i=t.width,s=t.height):this.Mt!==null&&(i=this.Mt.clientWidth||1,s=this.Mt.clientHeight||1),this.wt=i,this.xt=s,this.aa(),this.invalidateDocumentBounds(),this.t("viewSize",e,t),this.C()}}get fixedBounds(){return this.fb}set fixedBounds(t){let e=this.fb;e.equals(t)||((t.width===-1/0||t.height===1/0||t.height===-1/0)&&m.o("fixedBounds width/height must not be Infinity"),t=t.N(),this.fb=t,this.invalidateDocumentBounds(),this.t("fixedBounds",e,t))}get scrollMargin(){return this.fh}set scrollMargin(t){typeof t=="number"&&(t=new Dt(t));let e=this.fh;e.equals(t)||(t=t.N(),this.fh=t,this.t("scrollMargin",e,t),this.Eu())}get scrollMode(){return this.ah}set scrollMode(t){let e=this.ah;e!==t&&(this.ah=t,t===1&&this.Js(!1),this.t("scrollMode",e,t),this.Nh(),this.C())}get scrollsPageOnFocus(){return this.ub}set scrollsPageOnFocus(t){let e=this.ub;e!==t&&(m.s(t,"boolean",Y,"scrollsPageOnFocus"),this.ub=t,this.t("scrollsPageOnFocus",e,t))}get positionComputation(){return this.db}set positionComputation(t){let e=this.db;e!==t&&(t!==null&&m.S(t,Y,"positionComputation"),this.db=t,this.Js(!1),this.t("positionComputation",e,t))}get scaleComputation(){return this.gb}set scaleComputation(t){let e=this.gb;e!==t&&(t!==null&&m.S(t,Y,"scaleComputation"),this.gb=t,this.kT(this.scale,this.scale),this.t("scaleComputation",e,t))}get documentBounds(){return this.op}MT(t){this.mh=!1;let e=this.op;e.equals(t)||(e=e.copy(),this.op.h(t),this.Js(!1),this.T("DocumentBoundsChanged",void 0,e),this.Nh(),this.C())}ensureBounds(){if(this.mh){let t=I.l();this.MT(this.computeBounds(t)),I.i(t)}}get isVirtualized(){return this.Gb}set isVirtualized(t){let e=this.Gb;e!==t&&(m.s(t,"boolean",Y,"isVirtualized"),this.Gb=t,this.t("isVirtualized",e,t))}get scale(){return this.et}set scale(t){let e=this.et;e!==t&&this.kT(e,t)}get defaultScale(){return this.hp}set defaultScale(t){this.hp=t}get autoScale(){return this.ia}set autoScale(t){let e=this.ia;e!==t&&(this.ia=t,this.t("autoScale",e,t),t!==1&&this.Js(!1))}get initialAutoScale(){return this.vr}set initialAutoScale(t){let e=this.vr;e!==t&&(this.vr=t,this.t("initialAutoScale",e,t))}get initialViewportSpot(){return this.yb}set initialViewportSpot(t){let e=this.yb;e!==t&&(t.isSpot()||m.o("initialViewportSpot must be a specific Spot: "+t),this.yb=t,this.t("initialViewportSpot",e,t))}get initialDocumentSpot(){return this.pb}set initialDocumentSpot(t){let e=this.pb;e!==t&&(t.isSpot()||m.o("initialViewportSpot must be a specific Spot: "+t),this.pb=t,this.t("initialDocumentSpot",e,t))}get minScale(){return this.ab}set minScale(t){let e=this.ab;e!==t&&(t>0?(this.ab=t,this.t("minScale",e,t),t>this.scale&&(this.scale=t)):m.J(t,"> 0",Y,"minScale"))}get maxScale(){return this.hb}set maxScale(t){let e=this.hb;e!==t&&(t>0?(this.hb=t,this.t("maxScale",e,t),t<this.scale&&(this.scale=t)):m.J(t,"> 0",Y,"maxScale"))}get zoomPoint(){return this.cb}set zoomPoint(t){this.cb.equals(t)||(t=t.N(),this.cb=t)}get contentAlignment(){return this.$c}set contentAlignment(t){let e=this.$c;e.equals(t)||(t=t.N(),this.$c=t,this.t("contentAlignment",e,t),this.Js(!1))}get initialContentAlignment(){return this._m}set initialContentAlignment(t){let e=this._m;e.equals(t)||(t=t.N(),this._m=t,this.t("initialContentAlignment",e,t))}get padding(){return this.Qt}set padding(t){typeof t=="number"&&(t=new Dt(t));let e=this.Qt;e.equals(t)||(t=t.N(),this.Qt=t,this.invalidateDocumentBounds(),this.t("padding",e,t))}get partManager(){return this.e2}set partManager(t){let e=this.e2;e!==t&&(t.diagram!==null&&m.o("Cannot share PartManagers between Diagrams: "+t.toString()),e&&e.Ro(null),this.e2=t,t.Ro(this))}get nodes(){return this.partManager.nodes.iterator}get links(){return this.partManager.links.iterator}get parts(){return this.partManager.parts.iterator}findTopLevelNodesAndLinks(){let t=new V,e=this.nodes;for(;e.next();){let s=e.value;s.isTopLevel&&t.add(s)}let i=this.links;for(;i.next();){let s=i.value;s.isTopLevel&&t.add(s)}return t.iterator}findTopLevelGroups(){return this.Wr.iterator}get routers(){return this.rf}doLinkRouting(t){this.Io=!0;let e=this.rf.r;for(let i=0;i<e.length;i++)e[i].canRoute(t)&&e[i].routeLinks(this.Fr,t);this.Io=!1}get layout(){return this.li}set layout(t){let e=this.li;e!==t&&(this.li=t,t.diagram=this,t.group=null,this.jr=!0,this.t("layout",e,t),this.requestUpdate())}layoutDiagram(t){this.Te(),t&&this.l1(!0),this.As?this.P2(!1,this.Fl||this.rf.count!==0&&this.Qn.size!==0):(this.Qc=!0,this.br())}l1(t){let e=this.Wr.iterator;for(;e.next();)this.NT(e.value,t);this.layout&&(t?this.layout.isValidLayout=!1:this.layout.p())}NT(t,e){if(t===null)return;let i=t.Ch.iterator;for(;i.next();){let s=i.value;this.NT(s,e)}t.layout!==null&&(e?t.layout.isValidLayout=!1:t.layout.p())}P2(t,e){if(this.Cb)return;let i=this.G;this.G=!0;let s="Layout",n=this.undoManager.transactionLevel,o=this.layout,r=this.animationManager;try{n===0&&(this.undoManager.Dl=!0,this.startTransaction(s)),n<=1&&!r.defaultAnimation.isAnimating&&!r.ke&&(t||r.Gl(s)),this.jr=!1;let a=this.Wr.iterator;for(;a.next();)this.fd(a.value),this.CT(a.value,t,n,e);let h=!1;if(o.isValidLayout||(!t||o.isRealtime||o.isRealtime===null||n===0?(o.doLayout(this),this.fd(this),h=!0,o.isValidLayout=!0):this.jr=!0),h||this.fd(this),this.doLinkRouting(this),this.Fr.clear(),this.uh.size!==0){for(let l=0;l<23&&this.uh.size!==0;l++){for(a=this.Wr.iterator;a.next();)this.LT(a.value);let u=this.Fr;this.Fr=this.uh,this.uh=u,this.fd(this),this.doLinkRouting(this)}this.Fr.clear(),this.uh.clear()}}finally{let a=this.undoManager.Dl;n===0&&(this.commitTransaction(s),this.undoManager.Dl=!1),a&&(n===0||n===1)&&r.PM(),this.jr&&(this.jr=!o.isValidLayout),this.G=i}}CT(t,e,i,s){let n=t.Ch.iterator;for(;n.next();)this.CT(n.value,e,i,s);let o=t.layout;o!==null&&!o.isValidLayout?!e||o.isRealtime||i===0?(t.Lh=!t.location.isReal(),o.doLayout(t),t.invalidateLayout(32),this.i1(t),this.fd(t),this.doLinkRouting(t),o.isValidLayout=!0):(this.doLinkRouting(t),this.jr=!0):s&&this.doLinkRouting(t)}LT(t){let e=t.Ch.iterator;for(;e.next();)this.LT(e.value);this.fd(t),this.doLinkRouting(t)}get isTreePathToChildren(){return this.wb}set isTreePathToChildren(t){let e=this.wb;if(e!==t&&(m.s(t,"boolean",Y,"isTreePathToChildren"),this.wb=t,this.t("isTreePathToChildren",e,t),!this.undoManager.isUndoingRedoing)){let i=this.nodes;for(;i.next();)i.value.Ap()}}findTreeRoots(){let t=new q,e=this.nodes;for(;e.next();){let i=e.value;i.isTopLevel&&i.findTreeParentLink()===null&&t.add(i)}return t.iterator}get treeCollapsePolicy(){return this.xb}set treeCollapsePolicy(t){let e=this.xb;e!==t&&(t!==1&&t!==2&&t!==3&&m.o("Unknown Diagram.treeCollapsePolicy: "+t),this.xb=t,this.t("treeCollapsePolicy",e,t))}get isCollapsingExpanding(){return this.XM}set isCollapsingExpanding(t){this.XM=t}QR(){let t=new Mt,e=new Mt;function i(s){let n=s.toLowerCase(),o=new q;t.set(s,o),t.set(n,o),e.set(s,s),e.set(n,s)}i("InitialAnimationStarting"),i("AnimationStarting"),i("AnimationFinished"),i("BackgroundSingleClicked"),i("BackgroundDoubleClicked"),i("BackgroundContextClicked"),i("ClipboardChanged"),i("ClipboardPasted"),i("DocumentBoundsChanged"),i("ExternalObjectsDropped"),i("FocusOrVirtualPointerEnabledChanged"),i("GainedFocus"),i("InitialLayoutCompleted"),i("LayoutCompleted"),i("LinkDrawn"),i("LinkRelinked"),i("LinkReshaped"),i("LostFocus"),i("Modified"),i("ObjectSingleClicked"),i("ObjectDoubleClicked"),i("ObjectContextClicked"),i("PartCreated"),i("PartResized"),i("PartRotated"),i("SelectionMoved"),i("SelectionCopied"),i("SelectionDeleting"),i("SelectionDeleted"),i("SelectionGrouped"),i("SelectionUngrouped"),i("ChangingSelection"),i("ChangedSelection"),i("SubGraphCollapsed"),i("SubGraphExpanded"),i("TextEdited"),i("ThemeChanged"),i("TreeCollapsed"),i("TreeExpanded"),i("ViewportBoundsChanged"),i("InvalidateDraw"),this.BM=t,this.zM=e}fT(t){let e=this.zM.get(t);return e!==null?e:this.zM.get(t.toLowerCase())}R2(t){let e=this.BM.get(t);if(e!==null)return e;let i=t.toLowerCase();if(e=this.BM.get(i),e!==null)return e;m.o("Unknown DiagramEvent name: "+t)}addDiagramListener(t,e){m.s(t,"string",Y,"addDiagramListener:name"),m.S(e,Y,"addDiagramListener:listener");let i=this.R2(t);return i!==null&&i.add(e),this}removeDiagramListener(t,e){m.s(t,"string",Y,"removeDiagramListener:name"),m.S(e,Y,"addDiagramListener:listener");let i=this.R2(t);i!==null&&i.delete(e)}raiseDiagramEvent(t,e,i){this.T(t,e,i)}T(t,e,i){let s=this.R2(t),n=new wi;n.diagram=this;let o=this.fT(t);o!==null&&(n.name=o),e!==void 0&&(n.subject=e),i!==void 0&&(n.parameter=i);let r=s.length;if(r===1)s.elt(0)(n);else if(r!==0){let a=s.toArray();for(let h=0;h<r;h++){let l=a[h];l(n)}}}isUnoccupied(t,e){return this.getPositions(!1,null,e||null).isUnoccupied(t.x,t.y,t.width,t.height)}computeOccupiedArea(t){return this.isVirtualized?this.viewportBounds.copy():this.mh?this.aT(t):t.h(this.documentBounds)}getPositions(t,e,i){let s=this.sa;s===null&&(this.sa=s=new Ot(this.avoidanceCellSize));let n=e;if(s.Xo||s.Ah!==n||s.O2!==i){if(s.I2=Math.max(s.cf+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.width)),s.E2=Math.max(s.cf+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.height)),n!==null&&(n=this.AT(n)),n===null){let o=I.l();this.computeOccupiedArea(o),o.inflate(100,100),s.a1(o);let r=this.nodes;for(;r.next();){let a=r.value,h=a.layer;h===null||!h.visible||h.isTemporary||this.U2(a,i,o)}I.i(o)}else{if(n.memberParts.count>0){let a=this.computePartsBounds(n.memberParts,!1);a.inflate(20,20),s.a1(a)}let o=I.l(),r=n.memberParts;for(;r.next();){let a=r.value;a instanceof $&&this.U2(a,i,o)}I.i(o)}s.Ah=n,s.O2=i,s.Xo=!1}else t&&s.TT();return s}get avoidanceCellSize(){return this.ZM}set avoidanceCellSize(t){this.sa=null,this.ZM=new st(Math.max(1,t.width),Math.max(1,t.height))}get avoidanceLimit(){return this.QM}set avoidanceLimit(t){this.QM=Math.max(1,t)}AT(t){return t.canAvoid()?t:t.containingGroup!==null?this.AT(t.containingGroup):null}U2(t,e,i){if(t===e||!t.isVisible())return;let s=t.canAvoid();if(s){let n=t.getAvoidableRect(i);this.sa.vO(n.x,n.y,n.width,n.height)}if(t instanceof ht&&(!s||t.avoidableMembers)){let n=t.memberParts;for(;n.next();){let o=n.value;o instanceof $&&this.U2(o,e,i)}}}ud(t){this.sa!==null&&!this.sa.Xo&&(t===void 0||t.canAvoid())&&(this.sa.Xo=!0)}get autoScrollInterval(){return this.tp}set autoScrollInterval(t){let e=this.tp;e!==t&&(this.tp=t,this.t("autoScrollInterval",e,t))}get autoScrollRegion(){return this.ep}set autoScrollRegion(t){typeof t=="number"&&(t=new Dt(t));let e=this.ep;e.equals(t)||(t=t.N(),this.ep=t,this.invalidateDocumentBounds(),this.t("autoScrollRegion",e,t))}doAutoScroll(t){this.lp.h(t);let e=P.l();this.computeAutoScrollPosition(this.lp,e).equalsApprox(this.position)?this.stopAutoScroll():this.DT(),P.i(e)}DT(){if(this.Zc!==-1)return;let t=this.tp,e=this;this.Zc=m.un(()=>{if(e.Zc===-1||(e.stopAutoScroll(),e.lastInput.event===null))return;let i=P.l(),s=e.computeAutoScrollPosition(e.lp,i);if(!s.equalsApprox(e.position)){e.position=s,e.lastInput.documentPoint=e.transformViewToDoc(e.lp),e.doMouseMove(),e.mh=!0;let n=I.l();e.computeBounds(n),n.unionRect(e.documentBounds),e.MT(n),I.i(n),e.qi=!0,e.maybeUpdate(),e.DT()}P.i(i)},t)}stopAutoScroll(){this.Zc!==-1&&(m.wc(this.Zc),this.Zc=-1)}computeAutoScrollPosition(t,e){let i=this.position;e===void 0&&(e=new P),e.h(i);let s=this.ep;if(s.top<=0&&s.left<=0&&s.right<=0&&s.bottom<=0)return e;let n=this.viewportBounds,o=this.scale,r=I.z(0,0,n.width*o,n.height*o),a=P.z(0,0);if(t.x>=r.x&&t.x<r.x+s.left&&this.allowHorizontalScroll){let h=Math.max(this.scrollHorizontalLineChange,1);h=h|0,a.x-=h,t.x<r.x+s.left/2&&(a.x-=h),t.x<r.x+s.left/4&&(a.x-=4*h)}else if(t.x<=r.x+r.width&&t.x>r.x+r.width-s.right&&this.allowHorizontalScroll){let h=Math.max(this.scrollHorizontalLineChange,1);h=h|0,a.x+=h,t.x>r.x+r.width-s.right/2&&(a.x+=h),t.x>r.x+r.width-s.right/4&&(a.x+=4*h)}if(t.y>=r.y&&t.y<r.y+s.top&&this.allowVerticalScroll){let h=Math.max(this.scrollVerticalLineChange,1);h=h|0,a.y-=h,t.y<r.y+s.top/2&&(a.y-=h),t.y<r.y+s.top/4&&(a.y-=4*h)}else if(t.y<=r.y+r.height&&t.y>r.y+r.height-s.bottom&&this.allowVerticalScroll){let h=Math.max(this.scrollVerticalLineChange,1);h=h|0,a.y+=h,t.y>r.y+r.height-s.bottom/2&&(a.y+=h),t.y>r.y+r.height-s.bottom/4&&(a.y+=4*h)}return a.equalsApprox(P.dn)||(e.x=i.x+a.x/o,e.y=i.y+a.y/o),I.i(r),P.i(a),e}makeSvg(t){this.Vo.has("SVG")||this.addRenderer("SVG",new ui(this,K.document));let e=new ui(this,K.document,!0);t===void 0&&(t={});let i=this;function s(n,o){let r=i.vT(n,"SVG",e),a=r!==null?r.svg:null,h=n.svgFinished;return a&&h&&h(a),m.it(o)?(o(a),null):a}return this.FT(s,t)}makeSVG(t){return this.makeSvg(t)}addRenderer(t,e){this.Vo.set(t,e)}removeRenderer(t){this.Vo.delete(t)}cacheGroupExternalLinks(t){this.f2=t,t||this.nodes.each(e=>{e instanceof ht&&(e.Tp=null)})}FT(t,e){let i=e.callback,s=!0,n=this.oa.iterator;for(;n.next();)if(!n.value[0].Sn){s=!1;break}if(!m.it(i)||s)return t(e,i,this);let o=this;function r(){let l=+new Date;for(s=!0,n.reset();n.next();)if(!n.value[0].Sn){s=!1;break}if(s||l-h>a){t(e,i,o);return}K.requestAnimationFrame(r)}let a=e.callbackTimeout||300,h=+new Date;return K.requestAnimationFrame(()=>r()),null}makeImage(t){return Y.isUsingDOM()?(t===void 0&&(t={}),t.returnType="Image",this.makeImageData(t)):null}makeImageData(t){return t===void 0&&(t={}),this.FT(this.FO,t)}static img="image";FO(t,e,i){let s=i.vT(t,"canvas",null);if(s===null)return null;let n=s.F.canvas,o=null;if(n!==null){let r=t.returnType;switch(r===void 0?r="string":r=r.toLowerCase(),r){case Y.img+"data":o=s.getImageData(0,0,n.width,n.height);break;case Y.img:let a=(t.document||document).createElement("img");a.src=n.toDataURL(t.type,t.details),o=a;break;case"blob":{let h=n;return m.it(e)||(o="",m.o('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.')),m.it(h.toBlob)?(h.toBlob(e,t.type,t.details),"toBlob"):(e(null),null)}case"string":default:o=n.toDataURL(t.type,t.details)}}return m.it(e)?(e(o),null):o}static RO=!1;vT(t,e,i){this.animationManager.stopAnimation(),this.maybeUpdate(),m.$(t)||m.o("properties argument must be an Object.");let s=!1,n=t.size||null,o=t.scale||null;t.scale!==void 0&&isNaN(t.scale)&&(o="NaN");let r=t.maxSize;t.maxSize===void 0&&(s=!0,e==="SVG"?r=new st(1/0,1/0):r=new st(2e3,2e3));let a=t.position||null,h=t.parts||null;Array.isArray(h)&&(h=new q(h));let l=t.padding===void 0?1:t.padding,u=t.background||null,c=t.omitTemporary;c===void 0&&(c=!0);let d=t.document||K.document,f=t.elementFinished||null,p=t.showTemporary;p===void 0&&(p=!c);let g=t.showGrid;g===void 0&&(g=p),n!==null&&isNaN(n.width)&&isNaN(n.height)&&(n=null),typeof l=="number"?l=new Dt(l):l instanceof Dt||m.o("MakeImage padding must be a Margin or a number."),l.left=Math.max(l.left,0),l.right=Math.max(l.right,0),l.top=Math.max(l.top,0),l.bottom=Math.max(l.bottom,0),this.Wt&&this.Wt.clearContextCache(!0);let y=new Fe(null,d,void 0,!0),b=y._t;if(!(n||o||h||a))return y.width=this.wt+Math.ceil(l.left+l.right),y.height=this.xt+Math.ceil(l.top+l.bottom),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.Qr=d,i.dd=f,this.s1(i._t,l,new st(y.width,y.height),this.et,this.ct,h,u,p,g),i._t):(this.od=!1,this.s1(b,l,new st(y.width,y.height),this.et,this.ct,h,u,p,g),this.od=!0,y._t);let v=this.hp,w=this.documentBounds.copy();if(w.subtractMargin(this.Qt),p){let F=this.Vt.r,O=F.length;for(let E=0;E<O;E++){let B=F[E];if(!B.visible||!B.isTemporary)continue;let X=B.Nt.r,z=X.length;for(let U=0;U<z;U++){let tt=X[U];if(!tt.isInDocumentBounds||!tt.isVisible())continue;let nt=tt.actualBounds;nt.isReal()&&w.unionRect(nt)}}}let k=new P(w.x,w.y);if(h!==null){let F=new I(0,0,0,0),O=!0,E=h.iterator;for(E.reset();E.next();){let B=E.value;if(!(B instanceof pt))continue;let X=B.layer;if(X!==null&&!X.visible||X!==null&&!p&&X.isTemporary||!B.isVisible())continue;let z=B.actualBounds;z.isReal()&&(O?(O=!1,F.h(z)):F.unionRect(z))}w.width=F.width,w.height=F.height,k.x=F.x,k.y=F.y}a!==null&&a.isReal()&&(k=a,o||(o=v));let S=0,N=0;l!==null&&(S=l.left+l.right,N=l.top+l.bottom);let D=0,L=0;n!==null&&(D=n.width,L=n.height,isFinite(D)&&(D=Math.max(0,D-S)),isFinite(L)&&(L=Math.max(0,L-N)));let M=0,A=0;if(n!==null&&o!==null?(o==="NaN"&&(o=v),n.isReal()?(M=D,A=L):isNaN(L)?(M=D,A=w.height*o):(M=w.width*o,A=L)):n!==null?n.isReal()?(o=Math.min(D/w.width,L/w.height),M=D,A=L):isNaN(L)?(o=D/w.width,M=D,A=w.height*o):(o=L/w.height,M=w.width*o,A=L):o!==null?o==="NaN"&&r.isReal()?(o=Math.min((r.width-S)/w.width,(r.height-N)/w.height),o>v?(o=v,M=w.width,A=w.height):(M=r.width,A=r.height)):(M=w.width*o,A=w.height*o):(o=v,M=w.width,A=w.height),l!==null?(M+=S,A+=N):l=new Dt(0),r!==null){let F=r.width,O=r.height;e!=="SVG"&&s&&Y.RO,isNaN(F)&&(F=2e3),isNaN(O)&&(O=2e3),isFinite(F)&&(M=Math.min(M,F)),isFinite(O)&&(A=Math.min(A,O))}return y.width=Math.ceil(M),y.height=Math.ceil(A),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.Qr=d,i.dd=f,this.s1(i._t,l,new st(Math.ceil(M),Math.ceil(A)),o,k,h,u,p,g),i._t):(this.od=!1,this.s1(b,l,new st(Math.ceil(M),Math.ceil(A)),o,k,h,u,p,g),this.od=!0,y._t)}static Mh=null;static V2="5da73c80a36555d5038e4972187c3cae51fd22";static OO="5da73c80a36555d503aa5c72106c30b35bb2006b9cd041b259";static Kw=!1;static vP=()=>{if(Y.V2[5]===void 0&&(Nt.prototype.Ci=Nt.prototype.Mu),!Y.isUsingDOM())return;let t=m.Ni("canvas");t.width=350;let e=t.getContext("2d"),i=m.We("7ca11abfd022028846"),s="7ca11abfd7330390",n=[Y.V2,m.Kw+"4ae6247590da4bb21c324ba3a84e385776",Nt.vP+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",C.za];e.scale(2,2);let o=8;for(let r=1;r<5;r++)e[m.We(s)](m.We(n[r-1]),o,r*15);e[i]=m.We("39f046ebb36e4b");for(let r=1;r<5;r++)e[m.We(s)](m.We(n[r-1]),o,r*15);(n.length!==4||n[0][0]!=="5"||n[3][0]!=="7")&&(Nt.prototype.Ci=Nt.prototype.Mu),Y.Mh=t};static IO=()=>{if(Y.V2[5]===void 0&&(Nt.prototype.Ci=Nt.prototype.Mu),!Y.isUsingDOM())return;let t=m.Ni("canvas"),e=t.getContext("2d"),i=m.We("7ca11abfd022028846"),s="7ca11abfd7330390",n=[Y.OO,C.za],o=5;e.scale(2,2);for(let r=1;r<3;r++)e[m.We(s)](m.We(n[r-1]),o,r*11);e[i]=m.We("39f046ebb36e4b");for(let r=1;r<3;r++)e[m.We(s)](m.We(n[r-1]),o,r*11);(n.length!==2||n[0][0]!=="5")&&(Nt.prototype.Ci=Nt.prototype.Mu),Y.Mh=t}}class Fn{RT;OT;B2;bi;constructor(t){if(this.RT=null,this.OT="63ad05bbe23a1786468a4c741b6d2",this.B2="@onz",this.OT===this._tk){this.B2=!0,this.bi=this.B2;return}this.bi=null}EO(t,e){let i="f",s=K[m.We("76a715b2f73f148a")][m.We("72ba13b5")]||"",n=m.We;if(this.bi=!0,!Y.isUsingDOM())return;let o=Y[n("76a115b6ed251eaf4692")];if(!o){let a=s[n("76ad18b4f73e")];for(let l=s[n("73a612b6fb191d")](n("35e7"))+2;l<a;l++)i+=s[l];let h=i[n("73a612b6fb191d")](n("7da71ca0ad381e90"));this.bi=!(h>=0&&h<i[n("73a612b6fb191d")](n("35")));return}let r=Y.D2.iterator;for(;r.next();){o=r.value;let a=n(o).split(n("39e9")),h=a.length===7?1:0;if(a.length===1&&o.includes(n("5b8b3797c61b32a7"))){if(Y.IO(),!t.lt)return;t.cp=t.lt._t.F[m.We("7eba17a4ca3b1a8346")][m.We("78a118b7")](t.lt._t.F,Y.Mh,4,4)}if(a.length<6)return;let l=n(a[1+h]).split(".");if(a[4+h]!=="7da71ca0")return;let u=n(m[n("6cae19")]).split(".");if(!(l[0]>u[0]||l[0]===u[0]&&l[1]>=u[1]))continue;let c="73a612b6fb191d",d=K[n("74a900bae4370f8b51")][n("6fbb13a1c2311e8a57")].toLowerCase(),f=d[n(c)](n("3aad1ab6e022098b4dc4")),p=n(a[2+h]);if(f>-1){let M=d[n(c)](p.toLowerCase()+"/");if(this.bi=!(M>-1&&M<f),!this.bi)return}let g=s[n("76ad18b4f73e")];for(let M=s[n(c)](n("35e7"))+2;M<g;M++)i+=s[M];let y=i[n(c)](p);if(y<0&&p!==n("7da71ca0ad381e90")&&(y=i[n(c)](n("76a715b2ef3e149757"))),y<0&&(y=i[n(c)](n("76a715b2ef3e149757"))),y<0&&(y=i[n(c)](n("2bfa41fdb3784bca12"))),y<0&&(y=s[n(c)](n("7baa19a6f76c1988428554"))),y<0&&(y=s[n(c)](n("7ea902b2b9221e9c57c45767196566"))),this.bi=!(y>=0&&y<i[n(c)](n("35"))||i[n(c)](n("35"))===-1),!this.bi||s[n(c)](n("7fb002b6ed25128b4da25b2e"))&&(this.bi=!(s[n(c)](p)>-1),!this.bi))return;let b=K[m.We("76a715b2f73f148a")][m.We("69ad17a1e03e")],v=b[n(c)](n("7fb002b6ed25128b4da25b2e"));if(v>-1&&(this.bi=!(b[n(c)](p)>v),!this.bi))return;let w=p;if(w[0]!=="#")continue;let k=m.Ni("div"),S=a[0+h].replace(/[A-Za-z]/g,"");for(;S.length<4;)S+="9";let N=S;S=S.substring(S.length-4);let D=parseInt(u[0]),L=parseInt(u[1]);if(D>3||D===3&&L>=1){let M=parseInt(N)%40+30,A=parseInt(w.substring(1,5),16);if(j.IT===M+A){this.bi=!1;return}}else{let M="",A=["gsh","gsf"],F=["Header","Background","Display","Feedback"];if(M+=A[parseInt(S.substring(0,1),10)%2],M+=F[parseInt(S.substring(0,1),10)%4],k[n("79a417a0f0181a8946")]=M,K.document[n("78a712aa")]){K.document[n("78a712aa")][n("7bb806b6ed32388c4a875b")](k);let O=K.getComputedStyle(k).getPropertyValue(n("78a704b7e62456904c9b12701b6532a8")),E=K.getComputedStyle(k).getPropertyValue(n("75b817b0ea2202"));if(K.document[n("78a712aa")][n("68ad1bbcf533388c4a875b")](k),!O)continue;let B=K[n("77a902b0eb1b1e804a8a")],X="0."+parseInt(N,10)%100;if(E===X||O.indexOf(parseInt(w[1]+w[2],16).toString())!==-1&&O.indexOf(parseInt(w[3]+w[4],16).toString())!==-1){this.bi=!1;return}else if(B&&B(n("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches){M="."+M;for(let z=0;z<K.document.styleSheets.length;z++){let U=K.document.styleSheets[z].rules||K.document.styleSheets[z].cssRules;for(let tt in U)if(M===U[tt].selectorText){this.bi=!1;return}}}}else this.bi=null,e&&(this.bi=!1)}}}Mh(t,e){return e.setTransform(t.$e/2,0,0,t.$e/2,0,0),e.commitTransform(),this.bi===null&&this.EO(t,!0),0<this.bi&&this!==this.RT}}class Ke{z2;X2;constructor(t){this.z2=t===void 0?new P:t,this.X2=new P}get point(){return this.z2}set point(t){this.z2=t}get shifted(){return this.X2}set shifted(t){this.X2=t}}class On{Ri;pT;o1;constructor(t,e,i){this.Ri=t,this.pT=e,this.o1=i}}class Pi{isGridSnapEnabled;isGridSnapRealtime;gridSnapCellSize;gridSnapCellSpot;gridSnapOrigin;dragsLink;dragsTree;groupsSnapMembers;groupsAlwaysMove;dragsMembers;constructor(t){this.Ue(),t&&Object.assign(this,t)}Ue(){this.isGridSnapEnabled=!1,this.isGridSnapRealtime=!0,this.gridSnapCellSize=new st(NaN,NaN).k(),this.gridSnapCellSpot=T.TopLeft,this.gridSnapOrigin=new P(NaN,NaN).k(),this.dragsLink=!1,this.dragsTree=!1,this.groupsSnapMembers=!1,this.groupsAlwaysMove=!0,this.dragsMembers=!0}}class Rn extends Y{constructor(t,e){let i;return t===void 0||typeof t=="string"||K.Element&&t instanceof Element?i=t:m.$(t)&&(e=t),super(i),this.ET(),e&&this.setProperties(e),this}ET(){this.allowDragOut=!0,this.allowMove=!1,this.isReadOnly=!0,this.contentAlignment=T.TopCenter,this.layout=new Ue}setupRouters(){}reset(){super.reset(),this.ET()}}class hi extends Y{h1;c1;f1;u1;Dp;ff;Bl;G2;Y2;d1;K2;constructor(t,e){let i;return t===void 0||typeof t=="string"||K.Element&&t instanceof Element?i=t:m.$(t)&&(e=t),super(i),this.animationManager.isEnabled=!1,this.Ht=!0,this.h1=null,this.Qu=!1,this._u=!1,this.c1=!0,this.f1=!0,this.u1=0,this.Dp=!1,this.ff=null,this.setRenderingHint("drawShadows",!1),this.Bl=new pt({selectable:!0,selectionAdorned:!1,selectionObjectName:"BOXSHAPE",locationObjectName:"BOXSHAPE",resizeObjectName:"BOXSHAPE",cursor:"move"}).add(new et({name:"BOXSHAPE",fill:"transparent",stroke:"magenta",strokeWidth:2}).theme("stroke","overviewBox")).It(),this.allowCopy=!1,this.allowDelete=!1,this.allowDrop=!1,this.allowSelect=!0,this.autoScrollRegion=new Dt(0,0,0,0),this.ct.e(0,0),this.toolManager.Jt("Dragging",new En,this.toolManager.mouseMoveTools),this.click=()=>{let s=this.observed;if(s===null)return;let n=s.viewportBounds,o=this.lastInput.documentPoint;s.position=new P(o.x-n.width/2,o.y-n.height/2)},this.G2=s=>{this.invalidateDocumentBounds(),this.vp()},this.Y2=s=>{this.observed!==null&&(this.invalidateDocumentBounds(),this.C())},this.d1=s=>{this.updateDelay<1?this.C():this.Dp||(this.Dp=!0,m.un(()=>this.redraw(),this.updateDelay))},this.K2=s=>{this.observed!==null&&this.vp()},this.autoScale=2,this.Ht=!1,e&&this.setProperties(e),this}setupRouters(){}computePixelRatio(){return 1}redraw(){this.Dp&&this.updateDelay>=1&&(this.Dp=!1,this.UO()),super.redraw()}Ge(){if(this.Mt===null&&m.o("No div specified"),this.lt===null&&m.o("No canvas specified"),this.lt instanceof ui||(this.box.UM(),!this.qi))return;let t=this.observed;if(t===null||t.animationManager.defaultAnimation.isAnimating||!t.Qa)return;this.Mp();let e=this.lt,i=this.Wt;if(i.clearContextCache(!0),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.width,e.height),this.updateDelay<1)this.UT();else if(this.ff!==null){i.drawImage(this.ff.bt,0,0);let o=this.v;i.scale(this.$e,this.$e),i.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),i.commitTransform()}let s=this.Vt.r,n=s.length;for(let o=0;o<n;o++)s[o].Ge(i,this);this.ef=!1,this.qi=!1}UO(){let t=this.lt,e=this.Wt;if(!(t===null||e===null)){if(this.Mp(),this.ff===null){let i=new Fe(null);i.width=t.width,i.height=t.height,this.ff=i}try{this.lt=this.ff,this.Wt=this.lt._t,this.Wt.clearContextCache(!0),this.Wt.setTransform(1,0,0,1,0,0),this.Wt.clearRect(0,0,this.lt.width,this.lt.height),this.UT()}finally{this.lt=t,this.Wt=e}}}UT(){let t=this.observed;if(t===null)return;let e=this.drawsTemporaryLayers,i=this.drawsGrid&&e,s=t.grid;if(i&&s!==null&&s.visible&&!(isNaN(s.width)||isNaN(s.height))){let u=I.l().h(this.viewportBounds).unionRect(t.viewportBounds);t.ca(u),I.i(u),t.Te()}let n=this.v,o=this.Wt;o.scale(this.$e,this.$e),o.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),o.commitTransform();let r=this.viewportBounds,a=t.Vt.r,h=a.length,l=this.Vt.r;this.rs(l,l.length,this,this.viewportBounds);for(let u=0;u<h;u++)a[u].ER(o,r,this,e,i)}get observed(){return this.h1}set observed(t){let e=this.h1;if(t!==null&&m.se(t,Y,hi,"observed"),t instanceof hi&&m.o("Overview.observed Diagram may not be an Overview itself: "+t),e!==t){if(e!==null&&this.VO(e),this.h1=t,t!==null&&this.BO(t),this.invalidateDocumentBounds(),t===null){this.ff=null;let i=this.lt,s=this.Wt;i&&s&&(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,i.width,i.height))}else this.d1(null),this.vp(),this.C();this.t("observed",e,t)}}get box(){return this.Bl}set box(t){let e=this.Bl;e!==t&&(t.It(),this.Bl=t,this.remove(e),this.add(this.Bl),this.vp(),this.t("box",e,t))}get drawsTemporaryLayers(){return this.c1}set drawsTemporaryLayers(t){this.c1!==t&&(this.c1=t,this.redraw())}get drawsGrid(){return this.f1}set drawsGrid(t){this.f1!==t&&(this.f1=t,this.redraw())}get updateDelay(){return this.u1}set updateDelay(t){t<0&&(t=0),this.u1!==t&&(this.u1=t)}BO(t){t!==null&&(t.addDiagramListener("ViewportBoundsChanged",this.G2),t.addDiagramListener("DocumentBoundsChanged",this.Y2),t.addDiagramListener("InvalidateDraw",this.d1),t.addDiagramListener("AnimationFinished",this.K2),this.add(this.box))}VO(t){t!==null&&(this.remove(this.box),t.removeDiagramListener("ViewportBoundsChanged",this.G2),t.removeDiagramListener("DocumentBoundsChanged",this.Y2),t.removeDiagramListener("InvalidateDraw",this.d1),t.removeDiagramListener("AnimationFinished",this.K2))}vp(){let t=this.box,e=this.observed;if(e===null)return;this.qi=!0;let i=e.viewportBounds,s=t.selectionObject,n=st.l();n.e(i.width,i.height),s.desiredSize=n,st.i(n);let o=2/this.scale;s instanceof et&&(s.strokeWidth=o),t.location=new P(i.x-o/2,i.y-o/2),t.isSelected=!0}computeBounds(){let t=this.observed;if(t===null)return I.tm;let e=t.documentBounds.copy();return e.unionRect(t.viewportBounds),e}invalidateViewport(t,e){this.qi!==!0&&(this.qi=!0,this.requestUpdate())}onViewportBoundsChanged(t,e,i,s){this.Ht||(this.ha(),this.C(),this.Nh(),this.invalidateDocumentBounds(),this.vp(),this.Ye.scale=i,this.Ye.position.x=t.x,this.Ye.position.y=t.y,this.Ye.bounds.h(t),this.Ye.isScroll=s,this.T("ViewportBoundsChanged",this.Ye,t))}}class En extends Tt{ua;constructor(){super(),this.ua=P.gn}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||!t.allowMove||!t.allowSelect)return!1;let e=t.observed;if(e===null)return!1;let i=t.lastInput;if(!i.left||t.currentTool!==this&&(!this.isBeyondDragSize()||i.isTouchEvent&&i.timestamp-t.firstInput.timestamp<this.delay))return!1;if(this.findDraggablePart()===null){let s=e.viewportBounds;this.ua=new P(s.width/2,s.height/2);let n=t.firstInput.documentPoint;e.position=new P(n.x-this.ua.x,n.y-this.ua.y)}return!0}doActivate(){this.ua=P.gn,super.doActivate()}doUpdateCursor(t){let e=this.diagram,i=e.box;i!==null&&i.cursor&&(e.currentCursor=i.cursor)}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram,n=s.observed;if(n===null)return;let o=s.box;if(o===null)return;if(!this.ua.isReal()){let a=s.firstInput.documentPoint,h=o.location;this.ua=new P(a.x-h.x,a.y-h.y)}let r=s.lastInput.documentPoint;n.position=new P(r.x-this.ua.x,r.y-this.ua.y)}}class jt{a;g1="go._clipboard";m1="go._clipboardFormat";H2;q2;j2;W2;J2;$2;Z2;Q2;_2;da;tN;p1;w1;b1;k1;eN;Go;iN;sN;Fp;nN;P1;oN;S1;rN;lN;gd;Rp;Op;aN;_c;hN;cN;fN;uN;dN;md;gN;Oi;Ps;M1;Ip;static pd=["Ctrl","Shft","Alt","Meta"];static VT=jt.mN(230,40,15);static zO=jt.mN(270,40,15);static XO=jt.mN(310,40,15);constructor(t){V.Je(this),this.a=Y.Rm(),this.H2=!0,this.q2=!0,this.j2=!0,this.W2=!1,this.J2=!1,this.$2=!1,this.Z2=!1,this.Q2="memory",this._2=null,this.da=null,this.tN=1.05,this.p1=NaN,this.w1=P.gn,this.b1=NaN,this.k1=I.tm,this.eN=!1,this.Go=null,this.iN=200,this.sN=!1,this.Fp=new vt("Auto",{layerName:"Tool",pickable:!1,selectable:!1}).add(new G("Spot").add(new et({name:"SHAPE",fill:null,stroke:"lime",strokeWidth:4}).bindObject("stroke","adornedPart",e=>e.isSelected?"darkcyan":"lime"),new et({name:"SHAPE2",stretch:2,fill:null,stroke:"magenta",strokeWidth:4,strokeDashArray:[4,4]})),new le({padding:4})),this.nN=null,this.P1="",this.oN="",this.S1=m.hr,this.rN=!1,this.lN=!1,this.gd=new pt({layerName:"Tool",isInDocumentBounds:!1,locationObjectName:"CIRCLE",locationSpot:T.Center,pickable:!1,selectable:!1}).add(new et("Circle",{isGeometryPositioned:!0,width:30,height:30,fill:null,stroke:"darkcyan",strokeWidth:6,visible:!1}).bind("visible","down"),new et({isGeometryPositioned:!0,geometryString:"M15 0L15 30",stroke:"magenta"}),new et({isGeometryPositioned:!0,geometryString:"M0 15L30 15",stroke:"magenta"}),new et("Circle",{name:"CIRCLE",isGeometryPositioned:!0,width:20,height:20,fill:null,stroke:"magenta",position:new P(5,5)}),new et({isGeometryPositioned:!0,geometry:jt.VT,fill:null,stroke:"cyan",strokeWidth:4}).bind("geometry","button",jt.GO),new lt({position:new P(12,0),font:"bold 10pt sans-serif"}).bind("text","clickCount",e=>e>1?e.toString():""),new lt({position:new P(0,16)}).bind("text","modifiers",jt.YO)).freezeBindings(),this.Rp=10,this.Op=1,this.aN=null,this._c=e=>this.KO(e),this.hN=e=>this.HO(e),this.cN=e=>this.qO(e),this.fN=e=>this.jO(e),this.uN=null,this.dN="distance",this.md=null,this.gN=0,this.Oi={},this.Ps=null,this.M1=!1,this.Ip=null,this.pN(),this.gd.data=this.Oi,t&&Object.assign(this,t)}toString(){return"CommandHandler"}get diagram(){return this.a}Ro(t){this.a=t}doStart(){let t=this.a;t&&(t.addModelChangedListener(this._c),t.addDiagramListener("ViewportBoundsChanged",this.hN),t.addDiagramListener("GainedFocus",this.cN),t.addDiagramListener("LostFocus",this.fN))}doStop(){let t=this.a;t&&(t.removeDiagramListener("ViewportBoundsChanged",this.hN),t.removeDiagramListener("GainedFocus",this.cN),t.removeDiagramListener("LostFocus",this.fN),t.removeModelChangedListener(this._c))}doKeyDown(){let t=this.a,e=t.lastInput,i=e.control||e.meta,s=e.shift,n=e.alt,o=e.commandKey;i&&(o==="Insert"||o==="c")?this.canCopySelection()&&this.copySelection():i&&o==="x"||s&&o==="Delete"?this.canCutSelection()&&this.cutSelection():i&&o==="v"||s&&o==="Insert"?this.canPasteSelection()&&this.pasteSelection():i&&o==="y"||i&&s&&o==="z"||n&&s&&o==="Backspace"?this.canRedo()&&this.redo():i&&o==="z"||n&&o==="Backspace"?this.canUndo()&&this.undo():o==="Delete"||o==="Backspace"?this.canDeleteSelection()&&this.deleteSelection():i&&o==="a"?this.canSelectAll()&&this.selectAll():o==="Escape"?this.canStopCommand()&&this.stopCommand():this.BT.indexOf(o)>=0?this.WO(o,i,s):o==="PageUp"?s&&t.allowHorizontalScroll?t.scroll("page","left"):t.allowVerticalScroll&&t.scroll("page","up"):o==="PageDown"?s&&t.allowHorizontalScroll?t.scroll("page","right"):t.allowVerticalScroll&&t.scroll("page","down"):o==="Home"?i&&t.allowVerticalScroll?t.scroll("document","up"):!i&&t.allowHorizontalScroll&&t.scroll("document","left"):o==="End"?i&&t.allowVerticalScroll?t.scroll("document","down"):!i&&t.allowHorizontalScroll&&t.scroll("document","right"):o==="Space"?this.canScrollToPart()&&this.scrollToPart():o==="Minus"||o==="NumpadSubtract"?this.canDecreaseZoom()&&this.decreaseZoom():o==="Equal"||o==="NumpadAdd"?this.canIncreaseZoom()&&this.increaseZoom():i&&o==="Digit0"?this.canResetZoom()&&this.resetZoom():s&&o==="z"?this.canZoomToFit()&&this.zoomToFit():i&&!s&&o==="g"?this.canGroupSelection()&&this.groupSelection():i&&s&&o==="g"?this.canUngroupSelection()&&this.ungroupSelection():o==="F2"?this.canEditTextBlock()&&this.editTextBlock():o==="ContextMenu"||s&&o==="F10"||i&&s&&o==="Backslash"?this.canShowContextMenu()&&this.showContextMenu():e.bubbles=!0}doKeyUp(){let t=this.a.lastInput;t.bubbles=!0}stopCommand(){let t=this.a,e=t.currentTool;if(e instanceof ne){if(e.currentToolTip!==null){e.hideToolTip();return}t.allowSelect&&t.clearSelection()}e!==null&&e.doCancel()}canStopCommand(){return!0}selectAll(){let t=this.a;t.C();try{t.currentCursor="wait",t.T("ChangingSelection",t.selection);let e=t.parts;for(;e.next();){let n=e.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let i=t.nodes;for(;i.next();){let n=i.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let s=t.links;for(;s.next();){let n=s.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}}finally{t.T("ChangedSelection",t.selection),t.currentCursor=""}}canSelectAll(){return this.a.allowSelect}deleteSelection(){let t=this.a;try{t.currentCursor="wait",t.T("ChangingSelection",t.selection),t.startTransaction("Delete"),t.T("SelectionDeleting",t.selection);let e=new V,i=t.selection.iterator;for(;i.next();){let s=i.value;pt.ga(e,s,!0,this.deletesTree?1/0:0,this.deletesConnectedLinks?null:!1,n=>n.canDelete())}t.removeParts(e,!0),t.T("SelectionDeleted",e)}finally{t.commitTransaction("Delete"),t.T("ChangedSelection",t.selection),t.currentCursor=""}}canDeleteSelection(){let t=this.a;return!(t.isReadOnly||t.isModelReadOnly||!t.allowDelete||t.selection.count===0)}copySelection(){let t=this.a;try{let e=new V,i=t.selection.iterator;for(;i.next();){let s=i.value;pt.ga(e,s,!0,this.copiesTree?1/0:0,this.copiesConnectedLinks,n=>n.canCopy())}this.copyToClipboard(e)}finally{}}canCopySelection(){let t=this.a;return!(!t.allowCopy||!t.allowClipboard||t.selection.count===0)}cutSelection(){this.copySelection(),this.deleteSelection()}canCutSelection(){let t=this.a;return!(t.isReadOnly||t.isModelReadOnly||!t.allowCopy||!t.allowDelete||!t.allowClipboard||t.selection.count===0)}copyToClipboard(t){let e=this.a,i=this.storageLocation==="systemClipboard";if(i||this.storageLocation!=="memory")try{if(t===null)if(i&&K.navigator.clipboard)K.navigator.clipboard.writeText("");else{let n=K[this.storageLocation];if(!n)return;n.setItem(this.g1,""),n.setItem(this.m1,"")}else{let n=new Y;n.isTreePathToChildren=e.isTreePathToChildren,n.toolManager.draggingTool.dragsLink=e.toolManager.draggingTool.dragsLink,n.model=e.model.copy();let o=e.copyParts(t,n,!1);if(this.Rc(o),i&&K.navigator.clipboard)K.navigator.clipboard.writeText(n.model.toJson());else{let r=K[this.storageLocation];if(!r)return;r.setItem(this.g1,n.model.toJson()),r.setItem(this.m1,n.model.dataFormat)}}e.T("ClipboardChanged",t);return}catch{return}let s=null;if(t===null)Y.iT();else{let n=null;try{n=e.copyParts(t,null,!0),this.Rc(n)}finally{s=new q,n!==null&&s.addAll(n.iteratorValues),Y.bp=s,Y.t1=e.model.dataFormat}}e.T("ClipboardChanged",s)}Rc(t){let e=this.diagram.model;this.copiesParentKey&&e.Nx()?t.each(i=>{let s=i.key,n=i.value;if(s instanceof $&&n instanceof $&&s.data&&n.data){let o=e.getParentKeyForNodeData(s.data),r=this.diagram.findNodeForKey(o);r!==null&&!t.has(r)&&e.setParentKeyForNodeData(n.data,o)}}):this.copiesGroupKey&&e.Th()&&t.each(i=>{let s=i.key,n=i.value;if(!(s instanceof j)&&!(n instanceof j)&&s.data&&n.data){let o=e.getGroupForData(s.data),r=this.diagram.findNodeForKey(o);r!==null&&!t.has(r)&&e.setGroupForData(n.data,o)}})}pasteFromClipboard(){let t=this.a;if(this.storageLocation!=="memory"){let n=new V;try{let o=K[this.storageLocation];if(!o)return n;let r=o.getItem(this.g1),a=o.getItem(this.m1);if(r===null||r===""||a!==t.model.dataFormat)return n;{let h=new Y;h.model=ut.fromJson(r);let l=new V;l.addAll(h.parts).addAll(h.nodes).addAll(h.links);let u=t.copyParts(l,t,!1);return this.Rc(u),new V().addAll(u.iteratorValues)}}catch{return n}}let e=new V,i=Y.bp;if(i===null||Y.t1!==t.model.dataFormat)return e;let s=null;try{s=t.copyParts(i,t,!1),this.Rc(s)}finally{if(s!==null){let n=s.iterator;for(;n.next();){let o=n.value,r=n.key;o.location.isReal()||(r.location.isReal()?o.location=r.location:!o.position.isReal()&&r.position.isReal()&&(o.position=r.position)),e.add(o)}}}return e}async pasteSelectionAsync(t){let e=this.a;if(K.navigator.clipboard===void 0){m.ne('Cannot paste with storageLocation "clipboard", window.isSecureContext may be false.');return}try{e.currentCursor="wait",e.T("ChangingSelection",e.selection),e.startTransaction("Paste");let i=null,s=await K.navigator.clipboard.readText();try{let o=s;if(!(o===null||o==="")){let r=new Y;r.model=ut.fromJson(o);let a=new V;a.addAll(r.parts).addAll(r.nodes).addAll(r.links);let h=e.copyParts(a,e,!1);this.Rc(h),i=new V().addAll(h.iteratorValues)}}catch{}if(i===null)return;i.count>0&&e.clearSelection(!0);let n=i.iterator;for(;n.next();){let o=n.value;o.isSelected=!0}if(t){let o=e.computePartsBounds(e.selection);if(o.isReal()){let r=this.computeEffectiveCollection(e.selection,e.ad);e.Mx(r,new P(t.x-o.centerX,t.y-o.centerY),e.ad,!1)}}e.T("ClipboardPasted",i)}finally{e.commitTransaction("Paste"),e.T("ChangedSelection",e.selection),e.currentCursor=""}}pasteSelection(t){if(this.storageLocation==="systemClipboard"){this.pasteSelectionAsync(t);return}let e=this.a;try{e.currentCursor="wait",e.T("ChangingSelection",e.selection),e.startTransaction("Paste");let i=this.pasteFromClipboard();i.count>0&&e.clearSelection(!0);let s=i.iterator;for(;s.next();){let n=s.value;n.isSelected=!0}if(t){let n=e.computePartsBounds(e.selection);if(n.isReal()){let o=this.computeEffectiveCollection(e.selection,e.ad);e.Mx(o,new P(t.x-n.centerX,t.y-n.centerY),e.ad,!1)}}e.T("ClipboardPasted",i)}finally{e.commitTransaction("Paste"),e.T("ChangedSelection",e.selection),e.currentCursor=""}}canPasteSelection(t){let e=this.a;if(e.isReadOnly||e.isModelReadOnly||!e.allowInsert||!e.allowClipboard)return!1;if(this.storageLocation==="systemClipboard")return!0;if(this.storageLocation!=="memory")try{let i=K[this.storageLocation];if(!i)return!1;let s=i.getItem(this.g1),n=i.getItem(this.m1);return!(s===null||s===""||n!==e.model.dataFormat)}catch{return!1}return!(Y.bp===null||Y.bp.count===0||Y.t1!==e.model.dataFormat)}undo(){this.a.undoManager.undo()}canUndo(){let t=this.a;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canUndo()}redo(){this.a.undoManager.redo()}canRedo(){let t=this.a;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canRedo()}decreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.a;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canDecreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.a;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}increaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.a;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canIncreaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.a;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}resetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.a;t<e.minScale||t>e.maxScale||(e.scale=t)}canResetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.a;return t<e.minScale||t>e.maxScale?!1:e.allowZoom}zoomToFit(t){let e=this.a,i=e.animationManager;i.stopAnimation(),e.redraw();let s=e.position.copy(),n=e.scale;if(i.Gl("Zoom To Fit"),!t&&this.isZoomToFitRestoreEnabled&&n===this.b1&&!isNaN(this.p1)&&this.w1.isReal()&&e.documentBounds.equals(this.k1))e.scale=this.p1,e.position=this.w1,this.b1=NaN,this.k1=I.tm;else{if(this.p1=n,this.w1=s,t){let o=t.copy();if(o.width>0&&o.height>0){let r=e.viewportBounds,a=r.width*n,h=r.height*n,l=Math.min(a/o.width,h/o.height),u=a/l,c=h/l;o.width<u&&(o.x-=(u-o.width)/2),o.height<c&&(o.y-=(c-o.height)/2)}e.zoomToRect(o,2)}else e.zoomToFit();this.b1=e.scale,this.k1=e.documentBounds.copy()}i.PM()}canZoomToFit(t){return this.a.allowZoom}WO(t,e,i){let s=this.a;t==="ArrowUp"?s.allowVerticalScroll&&(e?s.scroll("pixel","up"):s.scroll("line","up")):t==="ArrowDown"?s.allowVerticalScroll&&(e?s.scroll("pixel","down"):s.scroll("line","down")):t==="ArrowLeft"?s.allowHorizontalScroll&&(e?s.scroll("pixel","left"):s.scroll("line","left")):t==="ArrowRight"&&s.allowHorizontalScroll&&(e?s.scroll("pixel","right"):s.scroll("line","right"))}scrollToPart(t){t===void 0&&(t=null),t!==null&&m.se(t,pt,jt,"part");let e=this.a;if(e.ensureBounds(),t===null){try{this.Go!==null&&(this.Go.next()?t=this.Go.value:this.Go=null)}catch{this.Go=null}t===null&&(e.highlighteds.count>0?this.Go=e.highlighteds.iterator:e.selection.count>0&&(this.Go=e.selection.iterator),this.Go!==null&&this.Go.next()&&(t=this.Go.value))}if(t!==null){let i=e.animationManager;i.Gl("Scroll To Part");let s=this.scrollToPartPause;if(s>0){let n=this.uf(t,[t]);if(n.length===1)e.startTransaction(),e.centerRect(t.actualBounds),e.commitTransaction("Scroll To Part");else{let o=()=>{e.startTransaction();let a=n.pop();for(;n.length>0&&a instanceof $&&a.isTreeExpanded&&(!(a instanceof ht)||a.isSubGraphExpanded);)a=n.pop();n.length>0?(a instanceof pt&&e.scrollToRect(a.actualBounds),a instanceof $&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof ht&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof pt&&e.centerRect(a.actualBounds),e.removeDiagramListener("LayoutCompleted",r)),e.commitTransaction("Scroll To Part")},r=()=>{m.un(o,(i.isEnabled?i.duration:0)+s)};e.addDiagramListener("LayoutCompleted",r),o()}}else{let n=e.position.copy();e.centerRect(t.actualBounds),n.equalsApprox(e.position)&&i.stopAnimation()}}}uf(t,e){if(t.isVisible())return e;if(t instanceof vt){let i=t.adornedPart;i!==null&&this.uf(i,e)}else if(t instanceof j){let i=t.fromNode;i!==null&&this.uf(i,e);let s=t.toNode;s!==null&&this.uf(s,e)}else{if(t instanceof $){let s=t.labeledLink;s!==null&&this.uf(s,e);let n=t.findTreeParentNode();n!==null&&(!n.isTreeExpanded&&!n.wasTreeExpanded&&e.push(n),this.uf(n,e))}let i=t.containingGroup;i!==null&&(!i.isSubGraphExpanded&&!i.wasSubGraphExpanded&&e.push(i),this.uf(i,e))}return e}canScrollToPart(t){if(t===void 0&&(t=null),t!==null&&!(t instanceof pt))return!1;let e=this.a;return e.selection.count===0&&e.highlighteds.count===0?!1:e.allowHorizontalScroll&&e.allowVerticalScroll}collapseTree(t){t===void 0&&(t=null);let e=this.a,i="Collapse Tree";try{e.startTransaction(i),e.animationManager.Gl(i);let s=new q;if(t!==null&&t.isTreeExpanded)t.collapseTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof $&&o.isTreeExpanded&&(o.collapseTree(),s.add(o))}}e.T("TreeCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseTree(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof $)||!t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof $){if(!s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}expandTree(t){t===void 0&&(t=null);let e=this.a,i="Expand Tree";try{e.startTransaction(i),e.animationManager.Gl(i);let s=new q;if(t!==null&&!t.isTreeExpanded)t.expandTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof $&&(o.isTreeExpanded||(o.expandTree(),s.add(o)))}}e.T("TreeExpanded",s)}finally{e.commitTransaction(i)}}canExpandTree(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof $)||t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof $){if(s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}groupSelection(){let t=this.a,e=t.model;if(!e.Th())return;let i=this.archetypeGroupData;if(i===null)return;let s=null;try{t.currentCursor="wait",t.T("ChangingSelection",t.selection),t.startTransaction("Group");let n=new q,o=t.selection.iterator;for(;o.next();){let l=o.value;l.Di()&&l.canGroup()&&n.add(l)}let r=new q,a=n.iterator;for(;a.next();){let l=a.value,u=!1,c=n.iterator;for(;c.next();){let d=c.value;if(l.isMemberOf(d)){u=!0;break}}u||r.add(l)}let h=r.first();if(h!==null){let l=h.containingGroup;if(l!==null)for(;l!==null;){let u=!1,c=r.iterator;for(;c.next();)if(!c.value.isMemberOf(l)){u=!0;break}if(u)l=l.containingGroup;else break}if(i instanceof ht)i.It(),s=i.copy(),s!==null&&t.add(s);else if(e.isGroupForData(i)){let u=e.copyNodeData(i);e.addNodeData(u),s=t.findNodeForData(u)}if(s!==null){l!==null&&this.isValidMember(l,s)&&(s.containingGroup=l);let u=r.iterator;for(;u.next();){let c=u.value;this.isValidMember(s,c)&&(c.containingGroup=s)}t.clearSelection(!0),s.isSelected=!0}}t.T("SelectionGrouped",s)}finally{t.commitTransaction("Group"),t.T("ChangedSelection",t.selection),t.currentCursor=""}}canGroupSelection(){let t=this.a;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowGroup||!t.model.Th()||this.archetypeGroupData===null)return!1;let e=t.selection.iterator;for(;e.next();){let i=e.value;if(i.Di()&&i.canGroup())return!0}return!1}yN(t){let e=m.st();if(Array.isArray(t))t.forEach(n=>{n instanceof j||n instanceof pt&&e.push(n)});else{let n=t.iterator;for(;n.next();){let o=n.value;o instanceof j||o instanceof pt&&e.push(o)}}let i=new V,s=e.length;for(let n=0;n<s;n++){let o=e[n],r=!0;for(let a=0;a<s;a++)if(o.isMemberOf(e[a])){r=!1;break}r&&i.add(o)}return m.Z(e),i}isValidMember(t,e){if(e===null||t===e||e instanceof j)return!1;let i;return t!==null&&(t===e||t.isMemberOf(e)||(i=t.memberValidation,i!==null&&!i(t,e))||t.data===null&&e.data!==null||t.data!==null&&e.data===null)?!1:(i=this.memberValidation,i!==null?i(t,e):!0)}ungroupSelection(t){t===void 0&&(t=null);let e=this.a,i=e.model;if(i.Th())try{e.currentCursor="wait",e.T("ChangingSelection",e.selection),e.startTransaction("Ungroup");let s=new q;if(t!==null)s.add(t);else{let o=e.selection.iterator;for(;o.next();){let r=o.value;r instanceof ht&&r.canUngroup()&&s.add(r)}}let n=new q;if(s.count>0){e.clearSelection(!0);let o=s.iterator;for(;o.next();){let r=o.value;r.expandSubGraph();let a=r.containingGroup,h=a!==null&&a.data!==null?i.getKeyForNodeData(a.data):void 0;n.addAll(r.memberParts);let l=n.iterator;for(;l.next();){let u=l.value;if(u.isSelected=!0,u instanceof j)continue;let c=u.data;c!==null?i.setGroupForData(c,h):u.containingGroup=a}e.remove(r)}}e.T("SelectionUngrouped",s,n)}finally{e.commitTransaction("Ungroup"),e.T("ChangedSelection",e.selection),e.currentCursor=""}}canUngroupSelection(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly||e.isModelReadOnly||!e.allowDelete||!e.allowUngroup||!e.model.Th())return!1;if(t!==null){if(!(t instanceof ht))return!1;if(t.canUngroup())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ht&&s.canUngroup())return!0}}return!1}addTopLevelParts(t,e){let i=this.yN(t),s=!0,n=i.iterator;for(;n.next();){let o=n.value;o.containingGroup!==null&&(!e||this.isValidMember(null,o)?o.containingGroup=null:s=!1)}return s}collapseSubGraph(t){t===void 0&&(t=null);let e=this.a,i="Collapse SubGraph";try{e.startTransaction(i),e.animationManager.Gl(i);let s=new q;if(t!==null&&t.isSubGraphExpanded)t.collapseSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ht&&o.isSubGraphExpanded&&(o.collapseSubGraph(),s.add(o))}}e.T("SubGraphCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseSubGraph(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ht)||!t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ht&&s.isSubGraphExpanded)return!0}}return!1}expandSubGraph(t){t===void 0&&(t=null);let e=this.a,i="Expand SubGraph",s=new q;try{if(e.startTransaction(i),e.animationManager.Gl(i),t!==null&&!t.isSubGraphExpanded)t.expandSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ht&&(o.isSubGraphExpanded||(o.expandSubGraph(),s.add(o)))}}e.T("SubGraphExpanded",s)}finally{for(let n of s)this.zT(e,n);t&&this.zT(e,t),e.commitTransaction(i)}}zT(t,e){for(let i of e.memberParts)i instanceof $&&t.Kc(i,e)}canExpandSubGraph(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ht)||t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ht&&!s.isSubGraphExpanded)return!0}}return!1}editTextBlock(t){t===void 0&&(t=null),t!==null&&m.se(t,lt,jt,"editTextBlock");let e=this.a,i=e.toolManager.findTool("TextEditing");if(i!==null){if(t===null){let s=null,n=e.selection.iterator;for(;n.next();){let o=n.value;if(o.canEdit()){s=o;break}}if(s===null)return;t=s.findInVisualTree(o=>o instanceof lt&&o.editable)}t!==null&&(e.currentTool=null,i.textBlock=t,e.currentTool=i)}}canEditTextBlock(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly||e.isModelReadOnly||!e.allowTextEdit||e.toolManager.findTool("TextEditing")===null)return!1;if(t!==null){if(!(t instanceof lt))return!1;let i=t.part;if(i!==null&&i.canEdit())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s.canEdit()&&(t=s.findInVisualTree(n=>n instanceof lt&&n.editable),t!==null))return!0}}return!1}showContextMenu(t){let e=this.a,i=e.toolManager.findTool("ContextMenu");if(i===null)return;t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e);let s=i.findObjectWithContextMenu(t);if(s!==null){let n=e.lastInput,o;if(s instanceof J?o=s.getDocumentPoint(T.Center):e.viewportBounds.containsPoint(n.documentPoint)?o=P.gn:o=e.viewportBounds.center,o.isReal()){let r=new Qt;r.diagram=e,r.viewPoint=e.transformDocToView(o),r.documentPoint=o,r.button=2,r.up=!0,e.lastInput=r}e.currentTool=i,i.openMenu(!1,s)}}canShowContextMenu(t){let e=this.a,i=e.toolManager.findTool("ContextMenu");return!(i===null||(t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e),i.findObjectWithContextMenu(t)===null))}downloadSvg(t){let e=this.a,i={scale:1,background:e.div?e.div.style.backgroundColor:"white",name:this.JO("svg")};t&&Object.assign(i,t);let s=e.makeSvg(i);if(s!==null){let n=new XMLSerializer().serializeToString(s);this.$O(i.name,"image/svg+xml",n)}}downloadSVG(t){this.downloadSvg(t)}canDownloadSvg(t){return this.a!==null}$O(t,e,i){let s=null,n=null;try{let o=new Blob([i],{type:e});s=K.URL.createObjectURL(o),n=m.Ni("a"),n.style.display="none",n.href=s,n.download=t,K.document.body.appendChild(n),requestAnimationFrame(()=>{try{n!==null&&n.click()}finally{s!==null&&K.URL.revokeObjectURL(s),n!==null&&K.document.body.removeChild(n)}})}catch{s!==null&&K.URL.revokeObjectURL(s),n!==null&&K.document.body.removeChild(n)}}JO(t){let e="."+t,i=this.diagram.model.name;return i?i.endsWith(e)&&(i=i.substring(0,i.length-e.length)):i="diagram",i+=e,i}get copiesClipboardData(){return this.H2}set copiesClipboardData(t){this.H2=!!t}get copiesConnectedLinks(){return this.q2}set copiesConnectedLinks(t){this.q2=!!t}get deletesConnectedLinks(){return this.j2}set deletesConnectedLinks(t){this.j2=!!t}get copiesTree(){return this.W2}set copiesTree(t){this.W2=!!t}get deletesTree(){return this.J2}set deletesTree(t){this.J2=!!t}get copiesParentKey(){return this.$2}set copiesParentKey(t){this.$2=!!t}get copiesGroupKey(){return this.Z2}set copiesGroupKey(t){this.Z2=!!t}get storageLocation(){return this.Q2}set storageLocation(t){t||(t="memory"),t!=="memory"&&t!=="sessionStorage"&&t!=="localStorage"&&t!=="systemClipboard"&&m.o("Invalid new value for CommandHandler.storageLocation: "+t),this.Q2=t}get archetypeGroupData(){return this._2}set archetypeGroupData(t){t!==null&&m.xc(t,jt,"archetypeGroupData");let e=this.a;this._2=t}get memberValidation(){return this.da}set memberValidation(t){t!==null&&m.S(t,jt,"memberValidation"),this.da=t}get defaultScale(){return this.diagram.defaultScale}set defaultScale(t){this.diagram.defaultScale=t}get zoomFactor(){return this.tN}set zoomFactor(t){t>1||m.o("zoomFactor must be larger than 1.0, not: "+t),this.tN=t}get isZoomToFitRestoreEnabled(){return this.eN}set isZoomToFitRestoreEnabled(t){this.eN=!!t}get scrollToPartPause(){return this.iN}set scrollToPartPause(t){this.iN=t}computeEffectiveCollection(t,e){let i=this.a,s=i.toolManager.findTool("Dragging"),n=i.currentTool===s;e===void 0&&(e=i.Cp());let o=new Mt;if(t===null)return o;let r=t.iterator;for(;r.next();){let a=r.value;i.Zr(o,a,n,e)}if(i.draggedLink!==null&&e.dragsLink)return o;for(r=t.iterator;r.next();){let a=r.value;if(a instanceof j){let h=a.fromNode;if(h!==null&&!o.has(h))o.delete(a);else{let l=a.toNode;l!==null&&!o.has(l)&&o.delete(a)}}}return o}static getModifierNames(){return jt.pd}static setModifierNames(t){jt.pd=t}static YO(t){let e="";return t&1&&(e+=jt.pd[0]||""),t&4&&(e+=jt.pd[1]||""),t&2&&(e+=jt.pd[2]||""),t&8&&(e+=jt.pd[3]||""),e}static GO(t){return t===1?jt.zO:t===2?jt.XO:jt.VT}static mN(t,e,i){var s=new P(i,0).rotate(t-e/2),n=new wt().add(new zt(-i,-i)).add(new zt(i,i)).add(new zt(s.x,s.y).add(new mt(5,t-e/2,e,0,0,i,i)));return n.offset(i,i),n}KO(t){t.isTransactionFinished&&this.updateFocusBox()}HO(t){if(t.subject.scale===this.diagram.scale)return;let e=4/this.diagram.scale,i=this.focusBox.findObject("SHAPE");i!==null&&(i.strokeWidth=e);let s=this.focusBox.findObject("SHAPE2");s!==null&&(s.strokeWidth=e,s.strokeDashArray=[e,e]);let n=this.focusBox.placeholder;n!==null&&(n.padding=e)}qO(t){this.focus===null?m.un(()=>{this.focus=this.findFirstFocus()},500):this.onFocusChanged(this.focus,this.focus)}jO(t){this.isVirtualPointerShown=!1}get isFocusEnabled(){return this.sN}set isFocusEnabled(t){t=!!t;let e=this.isFocusEnabled;t!==e&&(t||(this.isVirtualPointerShown=!1,this.uN=this.focus,this.focus=null),this.sN=t,t&&(this.focus=this.uN,this.updateFocusBox()))}get focusBox(){return this.Fp}set focusBox(t){if(!(t instanceof vt))return;let e=this.Fp;if(t!==e&&(this.Fp=t,e.adornedObject!==null)){let i=e.adornedPart;i!==null&&i.removeAdornment("Focus"),t.adornedObject=e.adornedObject,i!==null&&i.addAdornment("Focus",t)}}get focus(){return this.Fp.adornedObject}set focus(t){let e=this.focus;if(t!==e){let i=this.a;if(!i||!this.isFocusEnabled||t!==null&&t.diagram!==i)return;i.currentTool instanceof It||this.cancelVirtualPointer();let s=this.focusBox.adornedPart;s&&s.removeAdornment("Focus"),t===null?(this.md=null,this.virtualPointerLocation=i.viewportBounds.center,this.focusBox.adornedObject=null):(this.virtualPointerLocation=t.getDocumentPoint(T.Center),this.focusBox.adornedObject=t,this.updateFocusBox()),this.onFocusChanged(e,t)}}onFocusChanged(t,e){let i=this.a;if(i&&(this.focusChanged!==null?this.focusChanged(t,e,this):this.ZO(this.describe(t,e)),e!==null&&e.part!==null)){let s=e.getDocumentBounds();i.viewportBounds.containsRect(s)||(e instanceof pt?i.commandHandler.scrollToPart(e):i.scrollToRect(s))}}get focusChanged(){return this.nN}set focusChanged(t){t!==null&&m.S(t,jt,"focusChanged"),this.nN=t}get liveElementId(){return this.P1||this.oN}set liveElementId(t){let e=this.P1;t!==e&&(this.P1=t,this.wN())}wN(){let t=this.diagram;if(!t||!Y.isUsingDOM())return;let e=t.lt?.bt;if(!e)return;let i=this.liveElementId,s=K.document.getElementById(i);this.isUsingAriaLive?(e.removeAttribute("aria-labelledby"),s&&s.setAttribute("aria-live","polite")):(i&&e.setAttribute("aria-labelledby",i),s&&s.removeAttribute("aria-live"))}get isUsingAriaLive(){return this.S1}set isUsingAriaLive(t){let e=this.S1;t!==e&&(this.S1=t,this.wN())}ZO(t){let e=this.diagram;if(!e||!Y.isUsingDOM()||!e.div)return;let i=this.liveElementId;if(!i){let n=m.Ni("span"),o=n.style;for(o.opacity="0",o.position="absolute",o.right="-9999px",o.bottom="-9999px",o.width="0px",o.height="0px",o.overflow="hidden",o.border="0",i=(e.div.id||"diagram")+"_aria";K.document.getElementById(i);)i+=Math.floor(Math.random()*10);n.id=i,this.oN=i,e.div.appendChild(n),this.wN()}let s=K.document.getElementById(i);s&&(s.textContent=t)}describe(t,e){let i="";e instanceof $?e instanceof ht?i="Group":i="Node":e instanceof j?i="Link":e instanceof pt?i="Part":e&&(e.click?i="button":e instanceof lt&&e.editable&&(i="editable"),e.portId!==null&&(i&&(i+=" "),i+="port",e.portId&&(i+=" "+e.portId)));let s=this.xN(e);s&&(i+=" "+s);let n=e;if(t&&n instanceof j&&n.fromNode&&n.toNode){if(t instanceof $&&t.part===n.fromNode||t instanceof j&&t.fromNode===n.fromNode){i+=" to "+this.xN(n.toNode,!0);let o=n.toPort?.portId;o&&(i+=" port "+o)}else if(t instanceof $&&t.part===n.toNode||t instanceof j&&t.toNode===n.toNode){i+=" from "+this.xN(n.fromNode,!0);let o=n.fromPort?.portId;o&&(i+=" port "+o)}}return i}xN(t,e){if(e===void 0&&(e=!1),!t)return"";if(t instanceof lt&&t.text)return t.text;if(t instanceof G){let i="";return t instanceof pt&&t.text&&(i=t.text),e&&i||t.walkVisualTreeFrom(t,(s,n)=>{n.isVisibleObject()&&n instanceof lt&&n.text&&(!e||!i)&&i!==n.text&&(i+=" "+n.text)}),i}return""}updateFocusBox(){let t=this.focus;if(t!==null)if(t.diagram!==null&&(t instanceof pt?t.isVisible():t.isVisibleObject()&&t.part?.isVisible()))this.focusBox.adornedObject=t,t.part?.addAdornment("Focus",this.focusBox);else{let e=null;if(t instanceof pt||(e=t.part),e instanceof pt&&e.isVisible())this.focus=e;else{if(e instanceof $&&!e.isVisible()){let i=e.findTreeParentNode();if(i!==null)e=i;else{let s=e.labeledLink;s!==null&&(e=s)}}for(;e instanceof pt&&!e.isVisible();)e=e.containingGroup;e instanceof pt&&e.isVisible()?this.focus=e:this.focus=null}}}findFirstFocus(){let t=this.a;if(t===null||!t.isEnabled)return null;if(this.focus!==null)return this.focus;if(this.isFocusEnabled)if(t.selection.count>0)this.focus=t.selection.first();else{let e=this.XT(t.isTreePathToChildren).first();if(e!==null)return e}return null}get isVirtualPointerEnabled(){return this.rN}set isVirtualPointerEnabled(t){t=!!t;let e=this.isVirtualPointerEnabled;if(t!==e&&(this.rN=t,t)){let i=this.Ip;i&&(this.Ip=null,i.commandHandler.Ps=null,i.commandHandler.cancelVirtualPointer())}}get isVirtualPointerShown(){return this.lN}set isVirtualPointerShown(t){t=!!t;let e=this.isVirtualPointerShown;if(t!==e){let i=this.a;if(!i||!this.isVirtualPointerEnabled)return;this.lN=t;let s=this.focus;t?this.virtualPointerBox.diagram===null&&(this.virtualPointerLocation.isReal()||(s!==null?this.virtualPointerLocation=s.getDocumentPoint(T.Center):this.virtualPointerLocation=i.viewportBounds.center),i.add(this.virtualPointerBox),this.ma()):this.virtualPointerBox.diagram!==null&&(i.remove(this.virtualPointerBox),this.ma())}}cancelVirtualPointer(){let t=this.a;t&&(this.pN(),this.isVirtualPointerShown=!1,t.currentTool.doCancel(),this.isVirtualPointerDown=!1,this.bN())}bN(){let t=this.Ps;if(t!==null){this.Ps=null;let e=t.commandHandler;e.Ps=null,e.Ip=null,e.isVirtualPointerShown=!1,e.isVirtualPointerDown=!1,e.pN(),this.M1&&(e.isVirtualPointerEnabled=!1),this.M1=!1}}pN(){this.Oi.button=0,this.Oi.modifiers=0,this.Oi.clickCount=1,this.Oi.down=!1,this.ma()}ma(){this.virtualPointerChanged!==null&&this.virtualPointerChanged(this.virtualPointerBox,this),this.updateVirtualPointer()}updateVirtualPointer(){let t=this.virtualPointerBox.diagram;t&&(this.virtualPointerBox.scale=1/t.scale),this.virtualPointerBox.updateTargetBindings()}get virtualPointerBox(){return this.gd}set virtualPointerBox(t){if(!(t instanceof pt))return;let e=this.gd;t!==e&&(e!==null&&(t.location=e.location,e.diagram!==null&&e.diagram.remove(e)),this.gd=t,this.isVirtualPointerShown&&this.diagram&&(this.diagram.add(t),t.data=e.data),this.ma())}get virtualPointerChanged(){return this.aN}set virtualPointerChanged(t){t!==null&&m.S(t,jt,"virtualPointerChanged"),this.aN=t}get virtualPointerLocation(){return this.virtualPointerBox.location}set virtualPointerLocation(t){this.virtualPointerLocation.equals(t)||this.GT(t.x,t.y)}get isVirtualPointerDown(){return this.virtualPointerBox.data?this.virtualPointerBox.data.down:!1}set isVirtualPointerDown(t){t=!!t;let e=this.isVirtualPointerDown;if(t!==e){let i=this.a;if(!i||!this.isVirtualPointerEnabled||(this.virtualPointerBox.data===null&&(this.gd.data=this.Oi),this.virtualPointerBox.data.down=t,this.ma(),!this.isVirtualPointerShown))return;let s=i.lastInput,n=new Qt;n.diagram=i,this.YT(n,t),t?n.down=!0:n.up=!0,n.clickCount=1,n.button=this.Oi.button,n.modifiers=this.Oi.modifiers,t&&(i.firstInput=n.copy()),this.yd(n,!0),t||this.Oi.clickCount===2&&(n.clickCount=2,n.down=!0,n.up=!1,this.yd(n,!0),n.down=!1,n.up=!0,this.yd(n,!0),this.KT(1)),i.lastInput=s}}get virtualPointerShiftMove(){return this.Rp}set virtualPointerShiftMove(t){this.Rp=t}get virtualPointerControlMove(){return this.Op}set virtualPointerControlMove(t){this.Op=t}Ep(t,e){this.GT(this.virtualPointerLocation.x+t,this.virtualPointerLocation.y+e)}GT(t,e){this.virtualPointerBox.moveTo(t,e,!0);let i=this.a;if(!i||!this.isVirtualPointerEnabled||!this.isVirtualPointerShown)return;i.ensureBounds();let s=i.lastInput,n=new Qt;n.diagram=i,this.YT(n,this.isVirtualPointerDown),n.button=this.Oi.button,n.modifiers=this.Oi.modifiers,this.yd(n,!0),i.lastInput=s,this.isVirtualPointerDown&&(i.remove(this.virtualPointerBox),i.add(this.virtualPointerBox)),this.ma()}YT(t,e){let i=this.a;if(i){if(t.targetDiagram=i,t.documentPoint=this.virtualPointerLocation,i.allowDragOut){let s=i.div.getBoundingClientRect(),n=i.transformDocToView(this.virtualPointerLocation),o=s.x+n.x,r=s.y+n.y,a=K.document.elementFromPoint(o,r)||null;a instanceof HTMLCanvasElement&&(a=a.parentElement),a!==null&&a.shadowRoot&&(a=a.shadowRoot.elementFromPoint(o,r)||null,a instanceof HTMLCanvasElement&&(a=a.parentElement));let h=null;if(a instanceof HTMLElement&&(h=Y.ji.get(a))&&h!==i&&h.div){let l=h.div.getBoundingClientRect(),u=new P(n.x-(l.x-s.x),n.y-(l.y-s.y));this.Ps!==null&&this.Ps!==h&&this.bN(),t.targetDiagram=h,t.viewPoint=u,t.documentPoint=h.transformViewToDoc(u),t.viewPoint=h.transformDocToView(t.documentPoint),this.Ps=h;let c=h.commandHandler;this.M1=!c.isVirtualPointerEnabled,c.isVirtualPointerEnabled=!0,c.isVirtualPointerDown=e,c.virtualPointerLocation=t.documentPoint,c.isVirtualPointerShown=!0,c.Ip=i;return}}this.Ps!==null&&this.bN(),t.viewPoint=i.transformDocToView(t.documentPoint)}}yd(t,e){this.doVirtualPointerEvent(t,e)}doVirtualPointerEvent(t,e){let i=this.a;i&&(t.timestamp=Date.now(),i.lastInput=t,e&&(t.up?i.doMouseUp():t.down?i.doMouseDown():i.doMouseMove()),this.onVirtualPointerEvent(t,e))}onVirtualPointerEvent(t,e){let i=this.a;i&&(t.up?this.isVirtualPointerDown&&!i.viewportBounds.containsPoint(this.virtualPointerLocation)&&(this.virtualPointerLocation=this.focus instanceof J?this.focus.getDocumentPoint(T.Center):i.viewportBounds.center):t.down)}doVirtualFocusKeyDown(){let t=this.a;if(!t)return!1;let e=t.lastInput,i=e.commandKey;if(this.isVirtualPointerEnabled&&(i==="ShiftLeft"||i==="ShiftRight"))return this.isVirtualPointerShown=!0,!0;if(this.BT.indexOf(i)>=0)if(e.shift&&this.isVirtualPointerShown){let s=this.N1(i),n=e.control||e.meta?this.Op:this.Rp;s===270?this.Ep(0,-n):s===90?this.Ep(0,n):s===180?this.Ep(-n,0):this.Ep(n,0)}else this.QO();else if(e.shift&&this.isVirtualPointerShown&&(i==="Numpad1"||i==="Numpad2"||i==="Numpad3"||i==="Numpad4"||i==="Numpad6"||i==="Numpad7"||i==="Numpad8"||i==="Numpad9")){let s=e.control||e.meta?this.Op:this.Rp,n=0;i==="Numpad1"||i==="Numpad4"||i==="Numpad7"?n=-s:(i==="Numpad3"||i==="Numpad6"||i==="Numpad9")&&(n=s);let o=0;i==="Numpad7"||i==="Numpad8"||i==="Numpad9"?o=-s:(i==="Numpad1"||i==="Numpad2"||i==="Numpad3")&&(o=s),this.Ep(n,o)}else if(i==="Enter"||i==="NumpadEnter"||i==="Numpad5")e.shift&&this.isVirtualPointerShown?this.isVirtualPointerDown=!this.isVirtualPointerDown:this._O();else if(i==="Escape")this.tI();else if(i==="Space")this.eI();else if(i==="ContextMenu"||e.shift&&i==="F10"||(e.control||e.meta)&&e.shift&&i==="Backslash")this.iI();else if(e.shift&&i==="c")this.C1(1);else if(e.shift&&i==="a")this.C1(2);else if(e.shift&&i==="KeyS")this.C1(4);else if(e.shift&&i==="KeyM")this.C1(8);else if(e.shift&&i==="Digit1")this.L1(0);else if(e.shift&&i==="Digit2")this.L1(1);else if(e.shift&&i==="Digit3")this.L1(2);else if(e.shift&&i==="Numpad0"){let s=this.Oi.button;this.L1(s===2?0:2)}else if(e.shift&&(i==="KeyD"||i==="NumpadDecimal")){let s=this.Oi.clickCount;this.KT(s===2?1:2)}else if(e.shift&&i==="KeyF"){let s=this.nextFocusFormula;this.nextFocusFormula=s==="distance"?"linear":"distance"}else if(e.shift&&i==="y")this.isUsingAriaLive=!this.isUsingAriaLive;else return!1;return!0}doVirtualFocusKeyUp(){let t=this.a;if(!t)return!1;let e=t.lastInput.commandKey;return this.isVirtualPointerEnabled&&(e==="ShiftLeft"||e==="ShiftRight")&&(this.isVirtualPointerShown=!1),!0}N1(t){switch(t){case"ArrowDown":return 90;case"ArrowLeft":return 180;case"ArrowUp":return 270;default:return 0}}BT=["ArrowRight","ArrowDown","ArrowLeft","ArrowUp"];C1(t){let e=this.Oi.modifiers;this.Oi.modifiers=e&t?e&~t:e|t,this.ma()}KT(t){this.Oi.clickCount=t,this.ma()}L1(t){this.Oi.button=t,this.ma()}QO(){let t=this.a;if(!t)return;let e=t.lastInput,i=this.focus;if(i===null){let s=this.XT(t.isTreePathToChildren).first();s!==null&&(this.focus=s)}else if(i instanceof j)this.sI(i);else if(i instanceof $)this.nI(i);else{i instanceof pt&&(this.md=null);let s=this.N1(e.commandKey);s===270?this.focus=this.findNextFocus(270):s===90?this.focus=this.findNextFocus(90):s===180?this.focus=this.findNextFocus(180):this.focus=this.findNextFocus(0)}}sI(t){let e=this.a;if(!e)return;let i=e.lastInput,s=this.N1(i.commandKey),n=null,o=this.md;if(o!==null){let r=this.gN;if(s===r)n=t.getOtherNode(o);else if(s===C.Ee(r+180))n=o;else{let a=r===0||r===180?90:0,h=r===0||r===180?270:180;if(s===a){let l=this.kN(o,r,!0),u=l.indexOf(t);u>=0&&u<l.count-1&&(this.focus=l.elt(u+1))}else if(s===h){let l=this.kN(o,r,!0),u=l.indexOf(t);u>0&&(this.focus=l.elt(u-1))}}}else{let r=t.fromNode,a=t.toNode;if(!r||!a)return;s===270?n=r.location.y<a.location.y?r:a:s==90?n=r.location.y>a.location.y?r:a:s===180?n=r.location.x<a.location.x?r:a:n=r.location.x>a.location.x?r:a}for(;n!==null&&!n.isVisible();)n=n.containingGroup;n!==null&&(this.focus=n)}nI(t){let e=this.a;if(!e)return;let i=e.lastInput,s=this.N1(i.commandKey);if(i.control||i.meta){let n=this.kN(t,s,!0).first();n&&(this.md=t,this.gN=s,this.focus=n)}else this.md=null,this.focus=this.findNextFocus(s)}kN(t,e,i){if(t===null)return new q;let s=t.actualBounds;if(!s.isReal())return new q;let n=new Set;(t instanceof ht?t.findExternalLinksConnected():t.findLinksConnected()).each(r=>{if(!r.isVisible())return;let a=null;if(r.fromNode===t?a=r.toNode:r.toNode===t?a=r.fromNode:t instanceof ht&&(r.fromNode?.isMemberOf(t)?a=r.toNode:r.toNode?.isMemberOf(t)&&(a=r.fromNode)),a===null||a.isMemberOf(t))return;for(;a!==null&&!a.isVisible();)a=a.containingGroup;if(a===null)return;let h=a.location;if(h.isReal()&&!(e===270&&(a!==t?h.y>=s.top:r.midPoint.y>=s.top))){if(e===90&&(a!==t?h.y<=s.bottom:r.midPoint.y<=s.bottom)||e===180&&(a!==t?h.x>=s.left:r.midPoint.x>=s.left)||e===0&&(a!==t?h.x<=s.right:r.midPoint.x<=s.right))return;i&&r.actualBounds.isReal()?n.add(r):n.add(a)}});let o=new q(n);return e===90||e===270?o.sort((r,a)=>r.actualBounds.centerX-a.actualBounds.centerX):o.sort((r,a)=>r.actualBounds.centerY-a.actualBounds.centerY),o}findNextFocus(t){t=C.Ee(t);let e=this.focus,i=e instanceof $?e.location:e.getDocumentPoint(T.Center),s=1/0,n=e,o=(r,a,h,l)=>{if(this.nextFocusFormula==="linear"){let u=1/0;t===0&&h>i.x||t===180&&h<i.x?u=Math.abs(h-i.x):(t===90&&l>i.y||t===270&&l<i.y)&&(u=Math.abs(l-i.y)),u<s&&(s=u,n=r)}else{if(t===0&&(a.right<i.x||(a.centerX-i.x)**2>s)||t===90&&(a.bottom<i.y||(a.centerY-i.y)**2>s)||t===180&&(a.x>i.x||(i.x-a.centerX)**2>s)||t===270&&(a.y>i.y||(i.y-a.centerY)**2>s))return;let u=i.direction(h,l),c=C.qF(t,u);if(t===90||t===270?c<=45:c<45){let d=i.distanceSquared(h,l);d<s&&(s=d,n=r)}}};if(e instanceof pt&&e.diagram!==null){let r=e.containingGroup;r!==null?r.memberParts.each(a=>{a===e||a instanceof j||!a.isVisible()||o(a,a.actualBounds,a.location.x,a.location.y)}):(e.diagram.nodes.each(a=>{a===e||!a.isTopLevel||!a.isVisible()||o(a,a.actualBounds,a.location.x,a.location.y)}),e.diagram.parts.each(a=>{a===e||!a.isTopLevel||!a.isVisible()||o(a,a.actualBounds,a.location.x,a.location.y)}))}else if(e.part!==null){let r=new I;this.PN(e.part).each(a=>{a!==e&&(a.getDocumentBounds(r),o(a,r,r.centerX,r.centerY))})}return n}get nextFocusFormula(){return this.dN}set nextFocusFormula(t){this.dN=t}_O(){let t=this.a;if(!t)return;let e=t.currentTool;if(e instanceof It){let n=e.currentObject;this.A1(this.focus),e.maybeStopTool(this.focus),t.currentTool instanceof It||(this.focus=n);return}let i=this.focus,s=t.lastInput;if(i===null)s.control||s.meta?this.A1(null):this.focus=this.findFirstFocus();else if(i instanceof pt)if(s.control||s.meta)this.A1(i);else{let n=this.PN(i);if(n.count>0)this.focus=n.first();else if(i instanceof j&&i.isLabeledLink){let o=i.labelNodes.first();o!==null&&o.isVisible()&&(this.focus=o)}else if(i instanceof ht&&i.isSubGraphExpanded){let o=i.memberParts.first();o!==null&&o.isVisible()&&(this.focus=o)}}else this.A1(i)}XT(t){let e=new q,i=this.a;if(!i)return e;let s=0;for(;e.count===0&&s<i.nodes.count;){let n=i.nodes;for(;n.next();){let o=n.value;o.isTopLevel&&o.isVisible()&&(t?o.findNodesInto():o.findNodesOutOf()).count===s&&e.add(o)}s++}return e}PN(t){return t instanceof pt?this.Pn(t,new q):new q}Pn(t,e){return!(t instanceof pt)&&t.isVisibleObject()&&t.isEnabledObject()&&(t.contextMenu||t.click||t instanceof lt&&t.editable||t.part instanceof $&&t.portId!==null&&(t.portId!==""||t.part.ports.count>1)||t.toolTip)&&e.add(t),t instanceof G&&t.elements.each(i=>this.Pn(i,e)),e}A1(t){let e=this.a;if(!e)return;let i=e.lastInput,s=t instanceof J?t:e;if(s.click){let n=new Qt;n.diagram=e,n.documentPoint=t instanceof J?t.getDocumentPoint(T.Center):e.viewportBounds.center,n.viewPoint=e.transformDocToView(n.documentPoint),n.button=0,n.clickCount=1,n.targetObject=t,this.yd(n,!1),s instanceof J?s.click(n,s):s.click(n),e.lastInput=i}else s instanceof lt&&s.editable?this.editTextBlock(s):this.HT(t)}tI(){let t=this.a;if(!t)return;let e=t.currentTool;if(e instanceof ne&&e.currentToolTip!==null){e.hideToolTip();return}else if(e instanceof It){let i=e.currentObject;e.doKeyDown(),this.focus=i;return}if(this.focus instanceof pt){let i=this.focus;i instanceof $&&i.labeledLink!==null?this.focus=i.labeledLink:i.containingGroup!==null?this.focus=i.containingGroup:this.focus=null}else if(this.focus instanceof J){let i=this.focus.part;if(i instanceof j&&i.isLabeledLink){let s=i.labelNodes.first();if(s!==null&&s.isVisible()){this.focus=s;return}}else if(i instanceof ht&&i.isSubGraphExpanded){let s=i.memberParts.first();if(s!==null&&s.isVisible()){this.focus=s;return}}this.focus=i}else this.cancelVirtualPointer(),this.stopCommand()}eI(){let t=this.a;if(t)if(t.lastInput.shift&&this.isVirtualPointerShown){let e=t.findPartAt(this.virtualPointerLocation);e!==null&&(e===this.focus?this.qT():this.focus=e)}else this.qT()}qT(){let t=this.a;if(!t)return;let e=t.lastInput,i=this.focus;if(i instanceof pt){let s=i.part;if(e.control||e.meta){for(t.raiseDiagramEvent("ChangingSelection",t.selection);s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!s.isSelected),t.raiseDiagramEvent("ChangedSelection",t.selection)}else if(e.shift){if(s!==null&&!s.isSelected){for(t.raiseDiagramEvent("ChangingSelection",t.selection);s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!0),t.raiseDiagramEvent("ChangedSelection",t.selection)}}else if(s!==null&&!s.isSelected){for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&t.select(s)}}this.HT(i),this.onFocusChanged(i,i)}HT(t){let e=this.a;if(!e)return;e.toolManager.hideToolTip();let i=e.lastInput,s=t instanceof J?t:e;for(;s instanceof J&&!s.toolTip;)s=s.panel;if(s&&s.toolTip){let n=new Qt;n.diagram=e,n.documentPoint=t!==null?t.getDocumentPoint(T.Center):e.viewportBounds.center,n.viewPoint=e.transformDocToView(n.documentPoint),n.targetObject=t,this.yd(n,!1),e.toolManager.showToolTip(s.toolTip,t),e.lastInput=i}}iI(){let t=this.a;if(!t)return;let e=this.focus;if(this.canShowContextMenu(e)){this.showContextMenu(e);let i=t.toolManager.contextMenuTool.currentContextMenu;if(i instanceof vt){let s=this.PN(i);s.count>0&&(this.focus=s.first())}}}}var Bi=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Vertical=4]="Vertical",x[x.Horizontal=5]="Horizontal",x[x.Fill=2]="Fill",x))(Bi||{}),Vi=(x=>(x[x.None=0]="None",x[x.Along=21]="Along",x[x.Plus90=22]="Plus90",x[x.Minus90=23]="Minus90",x[x.Opposite=24]="Opposite",x[x.Upright=25]="Upright",x[x.Plus90Upright=26]="Plus90Upright",x[x.Minus90Upright=27]="Minus90Upright",x[x.Upright45=28]="Upright45",x))(Vi||{}),Ks=(x=>(x[x.None=0]="None",x[x.Vertical=1]="Vertical",x[x.Horizontal=2]="Horizontal",x[x.Both=3]="Both",x))(Ks||{});class J{n;Up;Vp;pa;w;ya;ft;ct;hi;Zt;Bp;$s;Ct;cs;_r;wa;Se;Dh;et;Xt;tl;De;Ke;wd;de;xd;Ot;he;el;T1;xa;df;constructor(){V.Je(this),this.n=30723,this.Zt=1,this.Bp="",this.$s=null,this.Ct=null,this.ct=new P(NaN,NaN).k(),this.cs=st.Ww,this._r=new Nt,this.wa=new Nt,this.Se=null,this.Dh=1,this.et=1,this.Xt=0,this.tl=Dt.em,this.hi=new I(NaN,NaN,NaN,NaN).k(),this.De=new I(NaN,NaN,NaN,NaN).k(),this.Ke=new I(0,0,NaN,NaN).k(),this.wd=null,this.Up=null,this.ft=null,this.de=T.Default,this.xd=T.Default,this.Vp=0,this.pa=0,this.Ot=null,this.w=null,this.ya=null,this.he=null,this.T1=null,this.xa=null,this.el=null,this.df=null}cloneProtected(t){t.n=(this.n|2048|4096)&-32769,t.Zt=this.Zt,t.Bp=this.Bp,t.Ct=this.Ct,t.ct.h(this.ct),t.cs=this.cs.N(),this.Se!==null?t.Se=this.Se.copy():t.Se=null,t.et=this.et,t.Xt=this.Xt,t.tl=this.tl.N(),t.hi.h(this.hi),t.De.h(this.De),t.Ke.h(this.Ke),t.Up=this.Up,this.ft!==null&&(t.ft=this.ft.copy()),t.de=this.de.N(),t.xd=this.xd.N(),t.Vp=this.Vp,t.pa=this.pa,this.Ot!==null&&(t.Ot=this.Ot.copy()),this.w!==null&&(this.w.me?t.w=this.w:t.w=this.w.copy()),this.ya!==null&&(t.ya=this.ya.slice()),this.he!==null&&(t.he=this.he.copy())}addCopyProperty(t){let e=this.ya;if(!Array.isArray(e))e=[],this.ya=e;else for(let i=0;i<e.length;i++)if(e[i]===t)return;e.push(t)}Yo(t){t.wd=null,t.el=null,t.f()}clone(){let t=new this.constructor;if(this.cloneProtected(t),this.ya!==null)for(let e=0;e<this.ya.length;e++){let i=this.ya[e];t[i]=this[i]}return t}copy(){return this.clone()}JS(){let t=this.ve;if(t!==null){this.ve=null;for(let e of t)e.bd()&&(e.isToData?this.themeData(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):e.isToObject?this.themeObject(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter,e.sourceName):e.isToModel?this.themeModel(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):this.theme(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter))}return this}fe(t){t in Vi?this.segmentOrientation=t:t in Bi?this.stretch=t:m.cr(this,t)}toString(){return m.Gn(this.constructor)+"#"+V.xs(this)}static None=0;static Default=1;static Fill=2;static Vertical;static Horizontal;static Uniform=6;static UniformToFill=7;static FlipVertical=1;static FlipHorizontal=2;static FlipBoth=3;ba(){this.w!==null&&(this.w.me=!0)}Yt(){return this.w===null?this.w=new Ye:this.w.me&&(this.w=this.w.copy()),this.w}Wi(){if(this.ft===null){let t=new Ni;t.vh=T.None,t.Fh=T.None,t.Rh=10,t.Oh=10,t.Ih=0,t.Eh=0,this.ft=t}return this.ft}raiseChangedEvent(t,e,i,s,n,o,r){let a=this.part;if(a!==null){a.gf(t,e,i,s,n,o,r),i===this&&t===2&&this.mf()&&this.Uh(a,e);let h=this.diagram;if(this.Ts!==null&&h!==null&&h.Qa&&!h.undoManager.isUndoingRedoing&&!h.animationManager.Uu){let l=this.Ts.get(e);if(l!==null&&h.animationManager.isEnabled&&!h.animationManager.isTicking){this.df===null&&(this.df=new Mt);let u=h.undoManager.transactionLevel===0;if(l.startCondition===2?u=!0:l.startCondition===3&&(u=!1),u){let c=new ye;l.RR(c);let d=this.df.get(l);d!==null&&d.stop(),this.df.set(l,c),c.Qx=this,c.TM=l,c.add(this,e,s,n),c.start()}else h.animationManager.getBundleAnimation().add(this,e,s,n)}}if(this instanceof G&&i===a&&a.SN()&&a.data!==null){let l=this.D.r,u=l.length;for(let c=0;c<u;c++){let d=l[c];d instanceof G&&d.Pn(f=>{f.data!==null&&f.SN()&&f.updateTargetBindings(e)})}}}}TR(t){this.df&&this.df.delete(t)}zo(){if(this.diagram!==null&&this.findBindingPanel()===null&&this.ve!==null){let t=this.diagram.model,e=this.ve.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=null,n=i.sourceName;i.isToObject&&(s=this.jT(n));let o=this,r=i.targetId;r!==-1&&(o=this.zp(r),o===null)||(n==="/"?s=o.part:n==="."?s=o:n===".."&&(s=o.panel),i.updateTarget(o,s,void 0,t))}}}Uh(t,e){let i=this.findBindingPanel();if(i!==null){let s=t.diagram,n=this.ve.iterator;for(;n.next();){let o=n.value,r=null;if(o.isToObject){if(r=o.WT(i,this),r===null)continue;o.updateSource(this,r,e,null)}else if(o.isToModel)s!==null&&!s.wi&&o.updateSource(this,s.model.modelData,e,i);else if(!o.isToTheme){let a=i.data;if(a===null)continue;s!==null&&!s.wi&&o.updateSource(this,a,e,i)}if(r===this){let a=o.targetId,h=i.zp(a);h!==null&&o.updateTarget(h,r,e,s?.model)}}}}zp(t){return this.io===t?this:null}jT(t){let e;return t===""?e=this:t==="/"?e=this:t==="."?e=this:t===".."?e=this:e=this.part.findObject(t),e}get io(){return this.w!==null?this.w.io:-1}set io(t){this.io!==t&&(this.w===null&&(this.w=new Ye),this.w.io=t)}get ve(){return this.w!==null?this.w.ve:null}set ve(t){this.ve!==t&&(this.w===null&&(this.w=new Ye),this.w.ve=t)}get so(){return this.w!==null?this.w.so:null}set so(t){this.so!==t&&(this.w===null&&(this.w=new Ye),this.w.so=t)}raiseChanged(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}t(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}no(t,e,i,s){let n=this.hi;if(n.e(t,e,i,s),this.et!==1||this.Xt!==0){this.Se===null&&(this.Se=new Nt);let o=this.Se;o.Ue(),this.Xp(o,t,e,i,s),o.im(n)}}JT(t,e,i){return this.pickable===!1?!1:(i.kc(this.v),e?this.intersectsRect(t,i):this.containedInRect(t,i))}$T(t,e,i){if(this.pickable===!1)return!1;let s=this.naturalBounds,n=t.distanceSquaredPoint(e);return i?P.distanceLineSegmentSquared(t.x,t.y,0,0,0,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,0,s.height,s.width,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,s.height,s.width,0)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,0,0,0)<=n:t.distanceSquared(0,0)<=n&&t.distanceSquared(0,s.height)<=n&&t.distanceSquared(s.width,0)<=n&&t.distanceSquared(s.width,s.height)<=n}Mn(){return!0}containsPoint(t){let e=P.l();e.h(t),this.v.gt(e);let i=this.actualBounds;if(!i.isReal())return P.i(e),!1;let s=this.diagram;if(s!==null&&s.dp){let o=s.getInputOption("extraTouchThreshold"),r=s.getInputOption("extraTouchArea"),a=r/2,h=this.naturalBounds,l=this.getDocumentScale()*s.scale,u=1/l;if(h.width*l<o&&h.height*l<o){let c=I.contains(i.x-a*u,i.y-a*u,i.width+r*u,i.height+r*u,e.x,e.y);return P.i(e),c}}let n=!1;return(this instanceof vt||this instanceof et?I.contains(i.x-5,i.y-5,i.width+10,i.height+10,e.x,e.y):i.containsPoint(e))&&(this.he&&!this.he.containsPoint(e)?n=!1:this.Ct!==null&&this.Ke.containsPoint(t)?n=!0:n=this.ka(t)),P.i(e),n}ka(t){let e=this.naturalBounds;return I.contains(0,0,e.width,e.height,t.x,t.y)}containsRect(t){if(this.angle===0)return this.actualBounds.containsRect(t);let e=this.naturalBounds,i=I.z(0,0,e.width,e.height),s=this.v,n=!1,o=P.z(t.x,t.y);return i.containsPoint(s.Ci(o))&&(o.e(t.x,t.bottom),i.containsPoint(s.Ci(o))&&(o.e(t.right,t.bottom),i.containsPoint(s.Ci(o))&&(o.e(t.right,t.y),i.containsPoint(s.Ci(o))&&(n=!0)))),P.i(o),I.i(i),n}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=!1,o=P.z(0,0);return t.containsPoint(s.gt(o))&&(o.e(0,i.height),t.containsPoint(s.gt(o))&&(o.e(i.width,i.height),t.containsPoint(s.gt(o))&&(o.e(i.width,0),t.containsPoint(s.gt(o))&&(n=!0)))),P.i(o),n}intersectsRect(t,e){if(e===void 0&&(e=this.v,this.angle===0))return t.intersectsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=P.z(0,0),o=P.z(0,i.height),r=P.z(i.width,i.height),a=P.z(i.width,0),h=!1;if(t.containsPoint(s.gt(n))||t.containsPoint(s.gt(o))||t.containsPoint(s.gt(r))||t.containsPoint(s.gt(a)))h=!0;else{let l=I.z(0,0,i.width,i.height),u=P.z(t.x,t.y);l.containsPoint(s.Ci(u))?h=!0:(u.e(t.x,t.bottom),l.containsPoint(s.Ci(u))?h=!0:(u.e(t.right,t.bottom),l.containsPoint(s.Ci(u))?h=!0:(u.e(t.right,t.y),l.containsPoint(s.Ci(u))&&(h=!0)))),P.i(u),I.i(l),h||(C.ex(t,n,o)||C.ex(t,o,r)||C.ex(t,r,a)||C.ex(t,a,n))&&(h=!0)}return P.i(n),P.i(o),P.i(r),P.i(a),h}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof T){let i=t,s=this.naturalBounds;return e.e(i.x*s.width+i.offsetX,i.y*s.height+i.offsetY),this.Ws.gt(e),e}else return e.set(t),this.Ws.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new I);let e=this.naturalBounds,i=this.Ws,s=P.z(0,0).v(i);return t.e(s.x,s.y,0,0),s.e(e.width,0).v(i),t.re(s.x,s.y,0,0),s.e(e.width,e.height).v(i),t.re(s.x,s.y,0,0),s.e(0,e.height).v(i),t.re(s.x,s.y,0,0),P.i(s),t}getDocumentAngle(){return this.Ws.YF()}getDocumentScale(){if(this.Gp()===!1)return this.Dh;let t=this.et;return this.panel!==null?t*this.panel.getDocumentScale():t}getLocalPoint(t,e){return e===void 0&&(e=new P),e.h(t),this.Ws.Ci(e),e}getNearestIntersectionPoint(t,e,i){return this.pf(t.x,t.y,e.x,e.y,i)}pf(t,e,i,s,n){let o=this.v,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),f=t*a+e*l+c,p=t*h+e*u+d,g=i*a+s*l+c,y=i*h+s*u+d;n.e(0,0);let b=this.naturalBounds,v=C.Cl(0,0,b.width,b.height,f,p,g,y,n);return n.v(o),v}ht(t,e,i,s){if(this.Bo()===!1)return;let n=this.tl,o=n.right+n.left,r=n.top+n.bottom;t=Math.max(t-o,0),e=Math.max(e-r,0),i=i||0,s=s||0,i=Math.max(i-o,0),s=Math.max(s-r,0);let a=this.angle,h=0,l=this.desiredSize,u=this.Yp();a===90||a===270?(t=isFinite(l.height)?l.height+u:t,e=isFinite(l.width)?l.width+u:e):(t=isFinite(l.width)?l.width+u:t,e=isFinite(l.height)?l.height+u:e);let c=i||0,d=s||0,f=this instanceof G;switch(this.Zs(!0)){case 0:c=0,d=0,f&&(t=1/0,e=1/0);break;case 2:isFinite(t)&&t>i&&(c=t),isFinite(e)&&e>s&&(d=e);break;case 5:isFinite(t)&&t>i&&(c=t),d=0,f&&(e=1/0);break;case 4:isFinite(e)&&e>s&&(d=e),c=0,f&&(t=1/0);break}let p=this.maxSize,g=this.minSize;c>p.width&&g.width<p.width&&(c=p.width),d>p.height&&g.height<p.height&&(d=p.height),i=Math.max(c,g.width),s=Math.max(d,g.height),p.width<i&&(i=Math.min(g.width,i)),p.height<s&&(s=Math.min(g.height,s)),t=Math.min(p.width,t),e=Math.min(p.height,e),t=Math.max(i,t),e=Math.max(s,e),(a===90||a===270)&&(h=t,t=e,e=h,h=i,i=s,s=h),this.hi.ce(),this.kd(t,e,i,s),this.hi.k(),this.hi.isReal()||m.o("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.hi.toString()),this.xi(!1)}kd(t,e,i,s){}Qs(){return!1}Ut(t,e,i,s,n){this.yf();let o=I.l();o.h(this.De),this.De.ce(),this.as()===!1?this.De.e(t,e,i,s):this.Pa(t,e,i,s),this.De.k(),n===void 0?this.he=null:this.he=n;let r=!1;if(n!==void 0)r=!0;else{let a=this.panel;if(a!==null&&a.il()&&(a=a.panel),a!==null){let h=a.Ke,l=this.measuredBounds,u=e+l.height,c=t+l.width;if(r=!(0<=t+.05&&c<=h.width+.05&&0<=e+.05&&u<=h.height+.05),this instanceof lt){let d=this.naturalBounds;(this.Kp>d.height||this.pe>d.width)&&(r=!0)}}}r?this.n|=256:this.n&=-257,this.De.isReal()||m.o("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.De.toString()),this.Pd(o,this.De),this.oo(!1),I.i(o)}Pa(t,e,i,s){}commonArrange(t,e,i,s){if(this.De.e(t,e,i,s),this.desiredSize.isReal())return;let n=this.hi,o=this.tl,r=o.right+o.left,a=o.top+o.bottom,h=n.width+r,l=n.height+a;i+=r,s+=a;let u=this.Zs(!0);switch(h===i&&l===s&&(u=0),u){case 0:(h>i||l>s)&&(this.xi(!0),this.ht(h>i?i:h,l>s?s:l,0,0));break;case 2:this.xi(!0),this.ht(i,s,0,0);break;case 5:this.xi(!0),this.ht(i,l,0,0);break;case 4:this.xi(!0),this.ht(h,s,0,0);break}}Pd(t,e){let i=this.part;i!==null&&i.diagram!==null&&((i.selectionObject===this||i.resizeObject===this||i.rotateObject===this)&&i.MN(!0),this.C(),!t.equalsApproxClose(e)&&(i.Sa(),this.Hp(i)))}Hp(t){this.portId!==null&&(t.MN(!0),t instanceof $&&t.invalidateConnectedLinks(void 0,this))}get shadowVisible(){return this.w!==null?this.w.qp:null}set shadowVisible(t){let e=this.shadowVisible;e!==t&&(this.Yt().qp=t,this.Ji(!0),this.C(),this.t("shadowVisible",e,t))}oI(t,e){let i=this.naturalBounds,s=this.wa,n=s.m11,o=s.m21,r=s.dx,a=s.m12,h=s.m22,l=s.dy,u=0,c=0,d=u,f=c;u=d*n+f*o+r,c=d*a+f*h+l;let p=u,g=c,y=0,b=0;d=i.width+e,f=0,u=d*n+f*o+r,c=d*a+f*h+l;let v=Math.min(p,u),w=Math.min(g,c);y=Math.max(p+y,u)-v,b=Math.max(g+b,c)-w,p=v,g=w,d=i.width+e,f=i.height+e,u=d*n+f*o+r,c=d*a+f*h+l,v=Math.min(p,u),w=Math.min(g,c),y=Math.max(p+y,u)-v,b=Math.max(g+b,c)-w,p=v,g=w,d=0,f=i.height+e,u=d*n+f*o+r,c=d*a+f*h+l,v=Math.min(p,u),w=Math.min(g,c),y=Math.max(p+y,u)-v,b=Math.max(g+b,c)-w,p=v,g=w;let k=t.viewportBounds,S=k.x,N=k.y,D=k.width,L=k.height;return p>D+S||S>y+p||g>L+N||N>b+g}Ge(t,e){if(this.rI(t,e)||!this.visible)return;let i=this.opacity;if(i===0)return;let s=1;i!==1&&(s=t.globalAlpha,t.globalAlpha=s*i);let n="";this.filter!==""&&(n=t.filter,t.filter=this.filter);let o=this.v,r=this.panel;this.Gp()===!0&&this.D1();let a=this.part,h=!1,l=0;if(a&&e.getRenderingHint("drawShadows")&&(h=a.isShadowed,h)){let g=a.shadowOffset;l=Math.max(g.y,g.x)*e.scale*e.$e}let u=this instanceof G&&this.il(),c=this.De;if(u&&(this.ZT(h,t,!1,r),this.lI(t,e),this.QT(h,t,!1,r),this._T(h,t,!1)),u||!u&&(c.width===0||c.height===0||isNaN(c.x)||isNaN(c.y))){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let d=this.Qs();if(!e.ph&&d&&this.oI(e,l)){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let f=(this.n&256)!==0;if(t.clipInsteadOfFill&&(f=!1),this instanceof lt&&(t.font=this.font),f){let g=r.Mn()?r.naturalBounds:r.actualBounds,y=Math.max(c.x,g.x),b=Math.max(c.y,g.y),v=Math.min(c.right,g.right)-y,w=Math.min(c.bottom,g.bottom)-b,k=this.he;if(k!==null&&(y=k.x,b=k.y,v=k.width,w=k.height),y>c.width+c.x||c.x>g.width+g.x){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}t.save(),t.beginPath(),t.rect(y,b,v,w),t.clip()}if(d){if(!a.isVisible()){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}if(h){let g=a.shadowOffset;t.shadowsSet(g.x*e.scale*this.scale*e.$e,g.y*e.scale*this.scale*e.$e,a.shadowBlur),t.shadowsOn(),t.shadowColor=a.shadowColor}}let p=this.naturalBounds;if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.ZT(h,t,d,r),this.Ct!==null&&(t.commitTransform(),this.v1(t,p,c)),this.QT(h,t,d,r),this.Ma(t,e),this._T(h,t,d),f&&(t.restore(),t.clearContextCache(this instanceof G)),!o.DP()){let g=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*g,-o.m12*g,-o.m21*g,o.m11*g,g*(o.m21*o.dy-o.m22*o.dx),g*(o.m12*o.dx-o.m11*o.dy))}i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n)}ZT(t,e,i,s){t&&this.shadowVisible===!0?e.shadowsOn():t&&this.shadowVisible===!1&&e.shadowsOff(),t&&this.F1(s)&&this.shadowVisible===null&&e.shadowsOff()}QT(t,e,i,s){t&&(this.Ct!==null||this.F1(s))?(this.R1(!0),this.shadowVisible===null&&e.shadowsOff()):this.R1(!1)}_T(t,e,i){t&&this.NN()===!0&&e.shadowsOn(),i&&t&&e.shadowsOff()}aI(t,e,i){let s=this.part,n=!1;s&&t.getRenderingHint("drawShadows")&&(n=s.isShadowed),e.clipInsteadOfFill&&(n=!1),this.Qs()&&n&&e.shadowsOn(),n&&this.shadowVisible===!0?e.shadowsOn():n&&this.shadowVisible===!1&&e.shadowsOff();let o=this.panel;if(n&&this.F1(o)&&this.shadowVisible===null&&e.shadowsOff(),e.sl){let r=t.computePixelRatio(),a=`drop-shadow(${e.shadowOffsetX/r}px ${e.shadowOffsetY/r}px ${e.shadowBlur/r/2}px ${e.shadowColor})`;this.background!==null&&i.Ct.setAttributeNS(null,"filter",a)}return n&&(this.Ct!==null||this.F1(o))?(this.R1(!0),this.shadowVisible===null&&e.shadowsOff()):this.R1(!1),n}hI(t,e,i,s){if(i.sl){let n=e.computePixelRatio(),o=`drop-shadow(${i.shadowOffsetX/n}px ${i.shadowOffsetY/n}px ${i.shadowBlur/n/2}px ${i.shadowColor})`;this.CN(t,o)}s&&this.NN()===!0&&i.shadowsOn(),this.Qs()&&i.shadowsOff()}F1(t){return t===null?!1:(t.il()&&(t=t.panel),t.NN()||(t.type===G.Auto||t.type===G.Spot)&&t.findMainElement()!==this)}CN(t,e){}v1(t,e,i){let s=this.Yp(),n=e.x,o=e.y,r=e.width+s,a=e.height+s;this.bn(t,this.Ct,!0,!1,e,i),this.Ct instanceof R&&this.Ct.type===3?(t.beginPath(),t.rect(n-s/2,o-s/2,r,a),t.fillContext(this.Ct,!1,null)):t.fillRect(n-s/2,o-s/2,r,a)}tD(t,e){let i=t.cI(this),s=t.xa!==null?t.xa:t.svg;if(s!==null&&i!==-1){for(;i!==0&&!t.elt(i-1).isVisibleObject();)i--;if(i===0)this.fI(t,e,s);else{let n=t.elt(i-1).svg;n!==null?n.after(e):s.appendChild(e)}}}fI(t,e,i){if(t.type===G.Table){let s=i.getElementsByClassName("gojs-ts"),n=s.length!==0?s[0]:null;n!==null&&n.after(e)}else i.Ct?i.Ct.after(e):i.prepend(e)}rI(t,e){if(!(t instanceof re))return!1;if(!this.visible||this.opacity===0)return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let i=this.De;if(this.Qs()&&(!this.isVisible()||i.width===0||i.height===0||isNaN(i.x)||isNaN(i.y)))return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;t.setCurrentTransform(1,0,0,1,0,0);let s=this.panel,n=this.Sd(t);if(this.wf(t,e,n))return this.eD(this.svg),this.svg.parentElement!==null?(this.Qs()&&(t.lastDrawnPart=this.svg),!0):(this.Qs()?(t.lastDrawnPart!==null?t.lastDrawnPart.after(this.svg):t.diagramGroup.prepend(this.svg),t.lastDrawnPart=this.svg):s&&this.tD(s,this.svg),!0);if(this.Ji(!1),this.Qs()&&this.isShadowed){let p=this.shadowOffset;t.shadowsSet(p.x*e.scale*this.scale*e.$e,p.y*e.scale*this.scale*e.$e,this.shadowBlur),t.shadowsOn(),t.shadowColor=this.shadowColor}this instanceof lt&&(t.font=this.font),t.currentElement=null;let o=this.v,r=this instanceof G,a=this instanceof G?this.il():!1,h=this.svg;if(this.Gp()===!0&&this.D1(),t.outerGroup=!1,n)if(t.outerGroup=!0,r&&a)t.newGroup(1,0,0,1,0,0),this.svg=t.lastCreatedElement;else if(r&&this.isClipping){let p=this.findMainElement(),g=0,y=0;p!==null&&(g=p.actualBounds.x,y=p.actualBounds.y),t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx+g,o.dy+y),this.svg=t.lastCreatedElement,p!==null&&t.createOrUpdateClipGroup(this,p.actualBounds),t.currentElement=t.lastCreatedElement}else r?(t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.svg=t.lastCreatedElement):t.newGroup(1,0,0,1,0,0);let l=this.naturalBounds;r||t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.background!==null&&(r?(a&&t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.v1(t,l,i),a&&t.setCurrentTransform(1,0,0,1,0,0)):(t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.v1(t,l,i)),t.currentElement.Ct=t.lastCreatedElement,t.currentElement.prepend(t.lastCreatedElement));let u=this.aI(e,t,t.currentElement);this.Ma(t,e),r&&t.endGroup(),t.outerGroup&&t.endGroup();let c=t.surface.dd,d=r?this.svg:t.currentElement;if(h!==null&&h.parentNode!==null&&d!==h&&(this.panel===null||h.parentNode===this.panel.svg)){let p=this.svg.getAttribute("filter");return p!==null&&d.setAttribute("filter",p),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),h.replaceWith(d),this.svg=d,d!==null&&this.jp(t,s,i,d),!0}if(this.svg=d,c!==null&&d===null&&t.dummyGroup(),d===null)return!0;this.jp(t,s,i,d),this.hI(d,e,t,u);let f=this.Qs()?this.opacity*t.globalAlpha:this.opacity;if(f!==1&&d.setAttributeNS(null,"opacity",f.toString()),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),this.Qs()){if(h!==null&&d!==h&&h.parentNode===t.diagramGroup){let p=h.getAttribute("filter");p!==null&&d.setAttribute("filter",p),h.replaceWith(d)}else t.lastDrawnPart?t.lastDrawnPart.after(d):t.diagramGroup.prepend(d);t.lastDrawnPart=d}else s!==null&&this.tD(s,d);return c!==null&&c(this,d),this.eD(d),!0}eD(t){let e=this,i=t.dataset;e instanceof J&&(e.portId!==null&&(i.portId=e.portId),e instanceof G&&(isNaN(e.itemIndex)||(i.itemIndex=e.itemIndex.toString()),e instanceof pt&&(i.className=m.Gn(e),e.key!==void 0&&(i.key=e.key.toString()),e.containingGroup!==null&&(i.group=e.containingGroup.key.toString()),e instanceof j&&(e.fromNode!==null&&e.fromNode.key!==void 0&&(i.fromKey=e.fromNode.key.toString()),e.fromPortId!==""&&(i.fromPortId=e.fromPortId),e.toNode!==null&&e.toNode.key!==void 0&&(i.toKey=e.toNode.key.toString()),e.toPortId!==""&&(i.toPortId=e.toPortId)))))}jp(t,e,i,s){let n=(this.n&256)!==0;if(t.clipInsteadOfFill&&(n=!1),!n){s.removeAttributeNS(null,"clip-path");return}let o=e.Mn()?e.naturalBounds:e.actualBounds,r=Math.max(i.x,o.x),a=Math.max(i.y,o.y),h=Math.min(i.right,o.right)-r,l=Math.min(i.bottom,o.bottom)-a,u=this.he;u!==null&&(r=u.x,a=u.y,h=u.width,l=u.height);let c=I.z(r,a,Math.max(h,0),Math.max(l,0));if(this instanceof G){let d=Nt.l();d.set(this.v),d.Qw(),d.im(c),Nt.i(d)}s.setAttributeNS(null,"clip-path",`path(' M ${c.x},${c.y} L ${c.width+c.x} ${c.y} L ${c.width+c.x} ${c.height+c.y} L ${c.x} ${c.height+c.y} z') view-box`),I.i(c)}uI(){if(this.svg===null)return;let t=this.svg.innerHTML.match(/url\(#((CLIP|GRAD).+?)\)/g),e=this.svg.ownerDocument;if(t!==null)for(let i of t){let s=e.getElementById(i.split("#")[1].slice(0,-1));s!==null&&s.remove()}this.svg.remove()}lI(t,e){let i=this.De,s=this.Ke,n=this.Ct;n!==null&&t.commitTransform(),n!==null&&(this.bn(t,n,!0,!1,s,i),n instanceof R&&n.type===3?(t.beginPath(),t.rect(i.x,i.y,i.width,i.height),t.fillContext(n,!1,null)):t.fillRect(i.x,i.y,i.width,i.height)),this.Ma(t,e)}Ma(t,e){}xf(){this.Ji(!0)}wf(t,e,i){let s=this.svg;if(this.dI()){if(this.xf(),this.Ji(!1),s===null)return!1;let u=s.getAttribute("clip-path");if(u!==null&&u.includes("url")){let c=t.svg.getElementById(u.split("#")[1].slice(0,-1));c!==null&&c.remove()}return s.getAttribute("filter")&&s.removeAttribute("filter"),!1}if(s===null)return!1;if(!this.visible)return s.remove(),!1;if(s.nodeName!=="g"&&i||s.nodeName==="g"&&!i)return!1;let n=this.v,o="matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")",r=this instanceof G,a=r?this.il():!1;if(!(r&&a))if(this instanceof Bt){let u=this.O1;t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),u!==null&&t.amendImageTransform(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7]),i?s.lastElementChild.setAttributeNS(null,"transform",t.getCurrentTransform()):s.setAttributeNS(null,"transform",t.getCurrentTransform())}else if(i&&!r)if(this instanceof et){let u=s.getElementsByTagName("path");for(let c=0;c<u.length;c++)u[c].setAttributeNS(null,"transform",o)}else if(this instanceof lt){let u=s.getElementsByTagName("text"),c=typeof this.stroke=="string"?this.stroke:null;for(let d=0;d<u.length;d++)u[d].setAttributeNS(null,"transform",o),c&&u[d].setAttributeNS(null,"fill",c)}else(s.lastElementChild||s).setAttributeNS(null,"transform",o);else if(r&&this.isClipping&&this.xa){let u=this.findMainElement(),c=u!==null?u.actualBounds.x:0,d=u!==null?u.actualBounds.y:0;this.xa.setAttributeNS(null,"transform","matrix(1,0,0,1,"+-c+", "+-d+")"),s.setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+(n.dx+c)+", "+(n.dy+d)+")")}else s.setAttributeNS(null,"transform",o);let h=this.Qs()?this.opacity*t.globalAlpha:this.opacity;h===1?s.removeAttribute("opacity"):s.setAttributeNS(null,"opacity",h.toString()),t.setCurrentTransform(1,0,0,1,0,0);let l=this.xa?this.xa:this.T1;if(this.background!==null||l.Ct!==void 0){let u=l.Ct;if(this.background===null)t.removeOldGradient(this,l.Ct,"fill"),l.Ct.remove(),l.Ct=void 0;else{if((a||i&&!(this instanceof G))&&t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),this.v1(t,this.naturalBounds,this.actualBounds),l.Ct){t.removeOldGradient(this,l.Ct,"fill");let c=l.Ct.getAttribute("filter");c!==null&&t.lastCreatedElement.setAttribute("filter",c),l.Ct.replaceWith(t.lastCreatedElement)}else l.prepend(t.lastCreatedElement);l.Ct=t.lastCreatedElement}u&&t.removeOldGradient(this,u,"fill")}return this.jp(t,this.panel,this.actualBounds,s),!0}Sd(t){if(this.background!==null)return!0;let e=(this.n&256)!==0;return t.clipInsteadOfFill&&(e=!1),!!e}static EU(t,e,i,s,n,o,r){let a=.001,h=o.length;t.moveTo(e,i);let l=s-e,u=n-i;l===0&&(l=.001);let c=u/l,d=Math.sqrt(l*l+u*u),f=0,p=!0;a=o[f%h];let g=r!==0;for(;d>=.1;){if(g){for(a=o[f++%h],a-=r;a<0;)a+=o[f++%h],p=!p;g=!1}else a=o[f++%h];a>d&&(a=d);let y=Math.sqrt(a*a/(1+c*c));l<0&&(y=-y),e+=y,i+=c*y,p?t.lineTo(e,i):t.moveTo(e,i),d-=a,p=!p}}bn(t,e,i,s,n,o){let r=1,a=1;if(typeof e=="string"){i?t.fillStyle=e:t.strokeStyle=e;return}else if(e.type===1){i?t.fillStyle=e.color:t.strokeStyle=e.color;return}let h,l=this.Yp();r=n.width,a=n.height,s?(r=o.width,a=o.height):i||(r+=l,a+=l);let u=t instanceof ci;if(u&&e.Nn&&(e.type===4||e.bf===r&&e.I1===a))h=e.Nn;else{let c=0,d=0,f=0,p=0,g=0,y=0,b=0,v=0;if(s?(b=o.x,v=o.y):i||(b-=l/2,v-=l/2),c=e.start.x*r+e.start.offsetX+b,d=e.start.y*a+e.start.offsetY+v,f=e.end.x*r+e.end.offsetX+b,p=e.end.y*a+e.end.offsetY+v,e.type===2)h=t.createLinearGradient(c,d,f,p);else if(e.type===3)y=isNaN(e.endRadius)?Math.max(r,a)/2:e.endRadius,isNaN(e.startRadius)?(g=0,y=Math.max(r,a)/2):g=e.startRadius,h=t.createRadialGradient(c,d,g,f,p,y);else if(e.type===4)try{h=t.createPattern(e.pattern,"repeat")}catch{h=null}else m.si(e.type,"Brush type");if(e.type!==4){let w=e.colorStops;if(w!==null){let k=w.iterator;for(;k.next();)h.addColorStop(k.key,k.value)}}if(u&&(e.Nn=h,h!==null&&(e.bf=r,e.I1=a),h===null&&e.type===4&&e.bf!==-1)){e.bf=-1;let w=this.diagram;w!==null&&e.bf===-1&&m.un(()=>{w.redraw()},600)}}i?t.fillStyle=h:t.strokeStyle=h}isContainedBy(t){return t instanceof G?this.gI(this,t):!1}gI(t,e){if(t===e||e===null)return!1;let i=t.panel;for(;i!==null;){if(i===e)return!0;i=i.panel}return!1}isVisibleObject(){if(!this.visible)return!1;let t=this.panel;return t!==null?t.isVisibleObject():!0}isEnabledObject(){let t=this instanceof G?this:this.panel;for(;t!==null&&t.isEnabled;)t=t.panel;return t===null}get enabledChanged(){return this.w!==null?this.w.Wp:null}set enabledChanged(t){let e=this.enabledChanged;e!==t&&(t!==null&&m.S(t,J,"enabledChanged"),this.Yt().Wp=t,this.t("enabledChanged",e,t))}D1(){if(this.E1()===!0){let t=this._r;if(t.Ue(),!this.De.isReal()||!this.hi.isReal()){this.Md(!1),this.Na(!1);return}if(t.Xs(this.De.x-this.hi.x,this.De.y-this.hi.y),this.scale!==1||this.angle!==0){let e=this.naturalBounds;this.Xp(t,e.x,e.y,e.width,e.height)}this.Md(!1),this.Na(!0)}if(this.Gp()===!0){let t=this.panel;if(t===null)this.wa.set(this._r),this.Dh=this.scale;else if(t.Ws!==null){let e=this.wa;e.Ue(),t.Mn()?e.kc(t.wa):t.panel!==null&&e.kc(t.panel.wa),e.kc(this._r),this.Dh=this.scale*t.Dh}this.Na(!1)}}Xp(t,e,i,s,n){if(this.et!==1&&t.et(this.et),this.Xt===0)return;let o=P.l();o.setSpot(e,i,s,n,T.Center),t.ks(this.Xt,o.x,o.y),P.i(o)}f(t){if(this.Bo())return;t===void 0&&(t=!1),this.xi(!0),this.oo(!0);let e=this.panel;e!==null&&!t&&e.f()}kf(){this.Bo()||(this.xi(!0),this.oo(!0))}Pf(t){if(this.as())return;let e=this.panel;!t&&e!==null&&e.f(),this.oo(!0)}yf(){this.E1()===!1&&(this.Md(!0),this.Na(!0))}LN(){this.Na(!0)}C(){let t=this.part;t!==null&&t.C()}Zs(t){let e=this.stretch,i=this.panel;if(i===null)return this.Ko(e===1?0:e,t);if(i.type===G.Table)return this.Jp(i.getRowDefinition(this.row),i.getColumnDefinition(this.column),t);if(i.type===G.Auto&&i.findMainElement()===this)return this.Ko(2,t);if(e===1){if(i.type===G.Spot&&i.findMainElement()===this)return this.Ko(2,t);let s=i.defaultStretch;return s===1?this.Ko(0,t):this.Ko(s,t)}return this.Ko(e,t)}Jp(t,e,i){let s=this.stretch;if(s!==1)return this.Ko(s,i);let n=null,o=null;switch(t.stretch){case 1:case 5:break;case 4:o=!0;break;case 2:o=!0;break}switch(e.stretch){case 1:case 4:break;case 5:n=!0;break;case 2:n=!0;break}let r=this.panel.defaultStretch;return n===null&&(n=r===5||r===2),o===null&&(o=r===4||r===2),n===!0&&o===!0?this.Ko(2,i):n===!0?this.Ko(5,i):o===!0?this.Ko(4,i):this.Ko(0,i)}Ko(t,e){if(e)return t;if(t===0)return 0;let i=this.desiredSize;if(i.isReal())return 0;let s=!isNaN(i.width),n=!isNaN(i.height),o=this.angle;if(s)if(o!==90&&o!==270){if(t===5)return 0;if(t===2)return 4}else{if(t===4)return 0;if(t===2)return 5}if(n)if(o!==90&&o!==270){if(t===4)return 0;if(t===2)return 5}else{if(t===5)return 0;if(t===2)return 4}return t}get segmentOrientation(){return this.Ot!==null?this.Ot.$p:0}set segmentOrientation(t){let e=this.segmentOrientation;e!==t&&(this.Ot===null&&(this.Ot=new Re),this.Ot.$p=t,this.f(),this.t("segmentOrientation",e,t),t===0&&(this.angle=0))}mI(){this.segmentOrientation=21}get segmentIndex(){return this.Ot!==null?this.Ot.Zp:-1/0}set segmentIndex(t){t=Math.round(t);let e=this.segmentIndex;e!==t&&(this.Ot===null&&(this.Ot=new Re),this.Ot.Zp=t,this.f(),this.t("segmentIndex",e,t))}get segmentFraction(){return this.Ot!==null?this.Ot.Qp:0}set segmentFraction(t){t<0?t=0:t>1&&(t=1);let e=this.segmentFraction;e!==t&&(this.Ot===null&&(this.Ot=new Re),this.Ot.Qp=t,this.f(),this.t("segmentFraction",e,t))}get segmentOffset(){return this.Ot!==null?this.Ot._p:P.dn}set segmentOffset(t){let e=this.segmentOffset;e.equals(t)||(t=t.N(),this.Ot===null&&(this.Ot=new Re),this.Ot._p=t,this.f(),this.t("segmentOffset",e,t))}get stretch(){return this.w!==null?this.w.ro:1}set stretch(t){let e=this.stretch;e!==t&&(this.Yt().ro=t,this.f(),this.t("stretch",e,t))}get name(){return this.w!==null?this.w.Pt:""}set name(t){let e=this.name;e!==t&&(this.Yt().Pt=t,this.part!==null&&this.part.t0(),this.t("name",e,t))}get opacity(){return this.Zt}set opacity(t){t<0?t=0:t>1&&(t=1);let e=this.opacity;if(e!==t){this.Zt=t,this.t("opacity",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.C(s.hh(s.actualBounds))}}get filter(){return this.Bp}set filter(t){let e=this.filter;if(e!==t){this.Bp=t,this.Ji(!0),this.t("filter",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.C(s.hh(s.actualBounds))}}get visible(){return(this.n&1)!==0}set visible(t){let e=(this.n&1)!==0;if(e!==t){this.n=this.n^1,this.xf(),this.t("visible",e,t);let i=this.panel;i!==null?i.f():this.Qs()&&this.Xe(t),this.C(),this.iD()}}get pickable(){return(this.n&2)!==0}set pickable(t){let e=(this.n&2)!==0;e!==t&&(this.n=this.n^2,this.t("pickable",e,t))}get fromLinkableDuplicates(){return(this.n&4)!==0}set fromLinkableDuplicates(t){let e=(this.n&4)!==0;e!==t&&(this.n=this.n^4,this.t("fromLinkableDuplicates",e,t))}get fromLinkableSelfNode(){return(this.n&8)!==0}set fromLinkableSelfNode(t){let e=(this.n&8)!==0;e!==t&&(this.n=this.n^8,this.t("fromLinkableSelfNode",e,t))}get toLinkableDuplicates(){return(this.n&16)!==0}set toLinkableDuplicates(t){let e=(this.n&16)!==0;e!==t&&(this.n=this.n^16,this.t("toLinkableDuplicates",e,t))}get toLinkableSelfNode(){return(this.n&32)!==0}set toLinkableSelfNode(t){let e=(this.n&32)!==0;e!==t&&(this.n=this.n^32,this.t("toLinkableSelfNode",e,t))}get isPanelMain(){return(this.n&64)!==0}set isPanelMain(t){let e=(this.n&64)!==0;e!==t&&(this.n=this.n^64,this.f(),this.t("isPanelMain",e,t))}get isActionable(){return(this.n&128)!==0}set isActionable(t){let e=(this.n&128)!==0;e!==t&&(this.n=this.n^128,this.t("isActionable",e,t))}get background(){return this.Ct}set background(t){let e=this.background;e!==t&&(t!==null&&R.Nd(t,"GraphObject.background"),t instanceof R&&t.k(),this.Ct=t,this.C(),this.t("background",e,t))}NN(){return(this.n&512)!==0}R1(t){t?this.n|=512:this.n&=-513}mf(){return(this.n&1024)!==0}AN(t){t?this.n|=1024:this.n&=-1025}E1(){return(this.n&2048)!==0}Md(t){t?this.n|=2048:this.n&=-2049}Gp(){return(this.n&4096)!==0}Na(t){t?this.n|=4096:this.n&=-4097}Bo(){return(this.n&8192)!==0}xi(t){t?this.n|=8192:this.n&=-8193}as(){return(this.n&16384)!==0}oo(t){t?this.n|=16384:this.n&=-16385}dI(){return(this.n&32768)!==0}Ji(t){t?this.n|=32768:this.n&=-32769}get part(){if(this.Qs())return this;if(this.el!==null)return this.el;let t=this;for(t=t.panel;t;){if(t instanceof pt)return this.el=t,t;t=t.panel}return null}get svg(){return this.T1}set svg(t){this.T1=t}Jc(){this.svg=null}get panel(){return this.$s}Vh(t){this.$s=t,this.svg!==null&&this.svg.remove()}get layer(){let t=this.part;return t!==null?t.layer:null}get diagram(){let t=this.part;return t!==null?t.diagram:null}get position(){return this.ct}set position(t){let e=t.x,i=t.y,s=this.position,n=s.x,o=s.y;n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i))?(t=t.copy(),this.TN(t,n,o)&&this.t("position",new P(n,o),t.copy())):this.DN()}DN(){}TN(t,e,i){return this.ct=t,this.Pf(),!0}Vc(t,e,i){this.ct.x===t&&this.ct.y===e||(this.ct.e(t,e),this.yf())}get actualBounds(){return this.De}get scale(){return this.et}set scale(t){let e=this.scale;e!==t&&(t<=0&&m.o("GraphObject.scale for "+this+" must be greater than zero, not: "+t),this.et=t,this.f(),this.t("scale",e,t))}get angle(){return this.Xt}set angle(t){let e=this.angle;if(e!==t){if(t=t%360,t<0&&(t+=360),e===t)return;this.Xt=t,this.iD(),this.f(),this.t("angle",e,t)}}get desiredSize(){return this.cs}set desiredSize(t){let e=t.width,i=t.height,s=this.desiredSize,n=s.width,o=s.height;if((n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i)))&&(t=t.N(),this.cs=t,this.f(),this instanceof et&&this.ai(),this.t("desiredSize",s,t),this.mf())){let r=this.part;r!==null&&(this.Uh(r,"width"),this.Uh(r,"height"))}}get width(){return this.cs.width}set width(t){let e=this.cs.width;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.cs,s=new st(t,this.cs.height).k();if(this.cs=s,this.f(),this instanceof et&&this.ai(),this.t("desiredSize",i,s),this.mf()){let n=this.part;n!==null&&this.Uh(n,"width")}}}get height(){return this.cs.height}set height(t){let e=this.cs.height;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.cs,s=new st(this.cs.width,t).k();if(this.cs=s,this.f(),this instanceof et&&this.ai(),this.t("desiredSize",i,s),this.mf()){let n=this.part;n!==null&&this.Uh(n,"height")}}}get minSize(){return this.w!==null?this.w.Sr:st.bc}set minSize(t){let e=this.minSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=0),isNaN(t.height)&&(t.height=0),t.k(),this.Yt().Sr=t,this.f(),this.t("minSize",e,t))}get maxSize(){return this.w!==null?this.w.Mr:st.LP}set maxSize(t){let e=this.maxSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=1/0),isNaN(t.height)&&(t.height=1/0),t.k(),this.Yt().Mr=t,this.f(),this.t("maxSize",e,t))}get measuredBounds(){return this.hi}get naturalBounds(){return this.Ke}Yp(){return 0}get margin(){return this.tl}set margin(t){typeof t=="number"&&(t=new Dt(t));let e=this.tl;e.equals(t)||(t=t.N(),this.tl=t,this.f(),this.t("margin",e,t))}get v(){return this.E1()===!0&&this.D1(),this._r}get Ws(){return this.Gp()===!0&&this.D1(),this.wa}trigger(t,e,i){let s=null;return typeof t=="string"?s=new ai(t,e,i):s=t,s.Ti=this,this.Ts===null&&(this.Ts=new Mt),this.Ts.set(s.propertyName,s),this}get Ts(){return this.w!==null?this.w.Ts:null}set Ts(t){this.Ts!==t&&(this.Yt().Ts=t)}get Pr(){return this.w!==null?this.w.Pr:0}set Pr(t){this.Pr!==t&&(this.Yt().Pr=t)}get alignment(){return this.de}set alignment(t){let e=this.alignment;e.equals(t)||(t.isNoSpot()&&!t.isDefault()&&m.o("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+t),t=t.N(),this.de=t,this.Pf(),this.t("alignment",e,t))}get column(){return this.pa}set column(t){t=Math.round(t);let e=this.column;e!==t&&(t<0&&m.J(t,">= 0",J,"column"),this.pa=t,this.f(),this.t("column",e,t),this.svg!==null&&this.svg.remove())}get columnSpan(){return this.w!==null?this.w.e0:1}set columnSpan(t){t=Math.round(t);let e=this.columnSpan;e!==t&&(t<1&&m.J(t,">= 1",J,"columnSpan"),this.Yt().e0=t,this.f(),this.t("columnSpan",e,t))}get row(){return this.Vp}set row(t){t=Math.round(t);let e=this.row;e!==t&&(t<0&&m.J(t,">= 0",J,"row"),this.Vp=t,this.f(),this.t("row",e,t),this.svg!==null&&this.svg.remove())}get rowSpan(){return this.w!==null?this.w.i0:1}set rowSpan(t){t=Math.round(t);let e=this.rowSpan;e!==t&&(t<1&&m.J(t,">= 1",J,"rowSpan"),this.Yt().i0=t,this.f(),this.t("rowSpan",e,t))}get spanAllocation(){return this.w!==null?this.w.s0:null}set spanAllocation(t){let e=this.spanAllocation;e!==t&&(t!==null&&m.S(t,J,"spanAllocation"),this.Yt().s0=t,this.f(),this.t("spanAllocation",e,t))}get alignmentFocus(){return this.xd}set alignmentFocus(t){let e=this.alignmentFocus;e.equals(t)||(t=t.N(),this.xd=t,this.f(),this.t("alignmentFocus",e,t))}get portId(){return this.Up}set portId(t){let e=this.portId;if(e!==t){let i=this.part;i!==null&&!(i instanceof $)&&m.o("Cannot set portID on a Link: "+t);let s=i;e!==null&&s!==null&&s.vN(this),this.Up=t,t!==null&&s!==null&&(s.Cn=!0,s.sD(this)),this.t("portId",e,t)}}Bh(){let t=this.part;if(t instanceof $&&(this.portId!==null||this===t.port)){let e=t.diagram;e!==null&&!e.undoManager.isUndoingRedoing&&t.invalidateConnectedLinks(void 0,this)}}iD(){let t=this.diagram;t===null||t.undoManager.isUndoingRedoing||(this instanceof G?this instanceof $?this.invalidateConnectedLinks():this.walkVisualTreeFrom(this,e=>{e.Bh()}):this.Bh())}get toSpot(){return this.ft!==null?this.ft.Fh:T.None}set toSpot(t){let e=this.toSpot;e.equals(t)||(t=t.N(),this.Wi().Fh=t,this.t("toSpot",e,t),this.Bh())}get toEndSegmentLength(){return this.ft!==null?this.ft.Oh:10}set toEndSegmentLength(t){let e=this.toEndSegmentLength;e!==t&&(t<0&&m.J(t,">= 0",J,"toEndSegmentLength"),this.Wi().Oh=t,this.t("toEndSegmentLength",e,t),this.Bh())}get toShortLength(){return this.ft!==null?this.ft.Eh:0}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Wi().Eh=t,this.t("toShortLength",e,t),this.Bh())}get toLinkable(){return this.ft!==null?this.ft.o0:null}set toLinkable(t){let e=this.toLinkable;e!==t&&(this.Wi().o0=t,this.t("toLinkable",e,t))}get toMaxLinks(){return this.ft!==null?this.ft.r0:1/0}set toMaxLinks(t){let e=this.toMaxLinks;e!==t&&(t<0&&m.J(t,">= 0",J,"toMaxLinks"),this.Wi().r0=t,this.t("toMaxLinks",e,t))}get fromSpot(){return this.ft!==null?this.ft.vh:T.None}set fromSpot(t){let e=this.fromSpot;e.equals(t)||(t=t.N(),this.Wi().vh=t,this.t("fromSpot",e,t),this.Bh())}get fromEndSegmentLength(){return this.ft!==null?this.ft.Rh:10}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;e!==t&&(t<0&&m.J(t,">= 0",J,"fromEndSegmentLength"),this.Wi().Rh=t,this.t("fromEndSegmentLength",e,t),this.Bh())}get fromShortLength(){return this.ft!==null?this.ft.Ih:0}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Wi().Ih=t,this.t("fromShortLength",e,t),this.Bh())}get fromLinkable(){return this.ft!==null?this.ft.l0:null}set fromLinkable(t){let e=this.fromLinkable;e!==t&&(this.Wi().l0=t,this.t("fromLinkable",e,t))}get fromMaxLinks(){return this.ft!==null?this.ft.a0:1/0}set fromMaxLinks(t){let e=this.fromMaxLinks;e!==t&&(t<0&&m.J(t,">= 0",J,"fromMaxLinks"),this.Wi().a0=t,this.t("fromMaxLinks",e,t))}get cursor(){return this.w!==null?this.w.Il:""}set cursor(t){let e=this.cursor;e!==t&&(m.s(t,"string",J,"cursor"),this.Yt().Il=t,this.t("cursor",e,t))}get click(){return this.w!==null?this.w.Or:null}set click(t){let e=this.click;e!==t&&(t!==null&&m.S(t,J,"click"),this.Yt().Or=t,this.t("click",e,t))}get doubleClick(){return this.w!==null?this.w.Ir:null}set doubleClick(t){let e=this.doubleClick;e!==t&&(t!==null&&m.S(t,J,"doubleClick"),this.Yt().Ir=t,this.t("doubleClick",e,t))}get contextClick(){return this.w!==null?this.w.Er:null}set contextClick(t){let e=this.contextClick;e!==t&&(t!==null&&m.S(t,J,"contextClick"),this.Yt().Er=t,this.t("contextClick",e,t))}get mouseEnter(){return this.w!==null?this.w.Xr:null}set mouseEnter(t){let e=this.mouseEnter;e!==t&&(t!==null&&m.S(t,J,"mouseEnter"),this.Yt().Xr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.w!==null?this.w.Gr:null}set mouseLeave(t){let e=this.mouseLeave;e!==t&&(t!==null&&m.S(t,J,"mouseLeave"),this.Yt().Gr=t,this.t("mouseLeave",e,t))}get mouseOver(){return this.w!==null?this.w.Ur:null}set mouseOver(t){let e=this.mouseOver;e!==t&&(t!==null&&m.S(t,J,"mouseOver"),this.Yt().Ur=t,this.t("mouseOver",e,t))}get mouseHover(){return this.w!==null?this.w.Vr:null}set mouseHover(t){let e=this.mouseHover;e!==t&&(t!==null&&m.S(t,J,"mouseHover"),this.Yt().Vr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.w!==null?this.w.Br:null}set mouseHold(t){let e=this.mouseHold;e!==t&&(t!==null&&m.S(t,J,"mouseHold"),this.Yt().Br=t,this.t("mouseHold",e,t))}get mouseDragEnter(){return this.w!==null?this.w.h0:null}set mouseDragEnter(t){let e=this.mouseDragEnter;e!==t&&(t!==null&&m.S(t,J,"mouseDragEnter"),this.Yt().h0=t,this.t("mouseDragEnter",e,t))}get mouseDragLeave(){return this.w!==null?this.w.c0:null}set mouseDragLeave(t){let e=this.mouseDragLeave;e!==t&&(t!==null&&m.S(t,J,"mouseDragLeave"),this.Yt().c0=t,this.t("mouseDragLeave",e,t))}get mouseDrop(){return this.w!==null?this.w.zr:null}set mouseDrop(t){let e=this.mouseDrop;e!==t&&(t!==null&&m.S(t,J,"mouseDrop"),this.Yt().zr=t,this.t("mouseDrop",e,t))}get actionDown(){return this.w!==null?this.w.f0:null}set actionDown(t){let e=this.actionDown;e!==t&&(t!==null&&m.S(t,J,"actionDown"),this.Yt().f0=t,this.t("actionDown",e,t))}get actionMove(){return this.w!==null?this.w.u0:null}set actionMove(t){let e=this.actionMove;e!==t&&(t!==null&&m.S(t,J,"actionMove"),this.Yt().u0=t,this.t("actionMove",e,t))}get actionUp(){return this.w!==null?this.w.d0:null}set actionUp(t){let e=this.actionUp;e!==t&&(t!==null&&m.S(t,J,"actionUp"),this.Yt().d0=t,this.t("actionUp",e,t))}get actionCancel(){return this.w!==null?this.w.g0:null}set actionCancel(t){let e=this.actionCancel;e!==t&&(t!==null&&m.S(t,J,"actionCancel"),this.Yt().g0=t,this.t("actionCancel",e,t))}get toolTip(){return this.w!==null?this.w.Yr:null}set toolTip(t){let e=this.toolTip;e!==t&&(this.Yt().Yr=t,this.t("toolTip",e,t))}get contextMenu(){return this.w!==null?this.w.Kr:null}set contextMenu(t){let e=this.contextMenu;e!==t&&(this.Yt().Kr=t,this.t("contextMenu",e,t))}findBindingPanel(){let t=this instanceof G?this:this.panel;for(;t!==null;){if(t.FN())return t;t=t.panel}return null}bind(t,e,i,s){return this.Sf(t,e,i,s),this}bindTwoWay(t,e,i,s){return this.Sf(t,e,i,s).makeTwoWay(),this}bindModel(t,e,i,s){return this.Sf(t,e,i,s).ofModel(),this}bindObject(t,e,i,s,n){return this.Sf(t,e,i,s).ofObject(n),this}theme(t,e,i,s,n){return this.Ca(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.Ca(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofModel(),this}Sf(t,e,i,s){let n=null;return typeof t=="string"?n=new te(t,e,i,s):n=t,this.m0(n),n}Ca(t,e,i,s,n){let o=null;return typeof t=="string"?o=new ii(t,e,i,s,n):o=t,this.m0(o),o}m0(t){t.Ti=this;let e=this.findBindingPanel();e!==null&&e.nD()&&m.o("Cannot add a Binding to a template that has already been copied: "+t),this.ve===null&&(this.ve=new q),this.ve.add(t)}set(t){return t?(Object.assign(this,t),this):this}attach(t){return J.RN(this,t),this}apply(t,...e){return t.apply(this,[this,...e]),this}setProperties(t){return Y.Np(this,t),this}static make(t,...e){let i=arguments,s=null,n=null;if(m.it(t))n=t;else if(typeof t=="string"){let r=J.U1.get(t);m.it(r)?(i=Array.prototype.slice.call(i),s=r(i),m.$(s)||m.o('GraphObject.make invoked object builder "'+t+'", but it did not return an Object')):n=K.go[t]}s===null&&((n==null||!n.constructor)&&m.o("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+t),s=new n);let o=1;if(s instanceof Y&&i.length>1){let r=s,a=i[1];(typeof a=="string"||a instanceof HTMLDivElement)&&(r.m2(a),o++)}for(let r=o;r<i.length;r++){let a=i[r];a===void 0?m.o("Undefined value at argument "+r+" for object being constructed by GraphObject.make: "+s):s&&J.RN(s,a)}return s}static RN(t,e){if(typeof e=="number")J.pI(t,e);else if(typeof e=="string")J.yI(t,e);else if(e instanceof J)t instanceof G||m.o("A GraphObject can only be added to a Panel, not to: "+t),t.add(e);else if(e instanceof Kt){let i=null;e.isRow&&m.it(t.getRowDefinition)?i=t.getRowDefinition(e.index):!e.isRow&&m.it(t.getColumnDefinition)&&(i=t.getColumnDefinition(e.index)),i instanceof Kt?i.V1(e):m.o("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+t)}else if(e instanceof Lt){let i=t;i.type=e}else if(e instanceof te)t instanceof J||t instanceof Kt?t.bind(e):m.o("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+t);else if(e instanceof ai)t instanceof J?t.trigger(e):m.o("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof zt)t instanceof wt&&t.type===4?t.figures.add(e):m.o("A PathFigure can only be added to a Path Geometry, not to: "+t);else if(e instanceof mt)t instanceof zt?t.segments.add(e):m.o("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof _t)t instanceof Y||t instanceof ht?t.layout=e:m.o("A Layout can only be assigned to a Diagram or a Group, not to: "+t);else if(Array.isArray(e))for(let i=0;i<e.length;i++){let s=e[i];J.RN(t,s)}else m.$(e)?J.wI(t,e):m.o('Unknown initializer "'+e+'" for object being constructed by GraphObject.make: '+t)}static yI(t,e){if(t instanceof lt)t.text=e;else if(t instanceof et)t.figure=e;else if(t instanceof Bt)t.source=e;else if(t instanceof G){let i=Lt.fs.get(e);i!==null&&(t.type=i)}else if(t instanceof R){let i=m.$a(Oe,e);i!==null?t.type=i:m.o("Unknown Brush type as an argument to GraphObject.make: "+e)}else if(t instanceof wt){let i=m.$a(ze,e);i!==null&&(t.type=i)}else if(t instanceof mt){let i=m.$a(ni,e);i!==null&&(t.type=i)}}static pI(t,e){m.it(t.fe)?t.fe(e):m.cr(t,e)}static wI(t,e){if(t instanceof R){let i=new bt;for(let s in e){let n=parseFloat(s);isNaN(n)?i[s]=e[s]:t.addColorStop(n,e[s])}Y.Np(t,i)}else if(t instanceof Kt){if(e.row!==void 0){let s=e.row;(s==null||s===1/0||isNaN(s)||s<0)&&m.o("Must specify non-negative integer row for RowColumnDefinition "+e+", not: "+s),t.isRow=!0,t.index=s}else if(e.column!==void 0){let s=e.column;(s==null||s===1/0||isNaN(s)||s<0)&&m.o("Must specify non-negative integer column for RowColumnDefinition "+e+", not: "+s),t.isRow=!1,t.index=s}let i=new bt;for(let s in e)s==="row"||s==="column"||(i[s]=e[s]);Y.Np(t,i)}else Y.Np(t,e)}static build(t,e,...i){let s=J.U1.get(t);if(m.it(s)){let n=s([t].concat(i));if(n instanceof J)return e&&n.setProperties(e),n}m.o('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')}static defineBuilder(t,e){m.s(t,"string",J,"defineBuilder:name"),m.S(e,J,"defineBuilder:func");let i=t.toLowerCase();J.U1.set(t,e)}static isBuilderDefined(t){return J.U1.has(t)}static takeBuilderArgument(t,e,i){i===void 0&&(i=null);let s=t[1];return(m.it(i)?i(s):typeof s=="string")?(t.splice(1,1),s):(e===void 0&&m.o("no "+(m.it(i)?"satisfactory":"string")+" argument for GraphObject builder "+t[0]),e)}static U1=new Mt}J.Vertical=4,J.Horizontal=5,J.defineBuilder("Button",x=>{let t="#f5f5f5",e="#737373",i="#d4d4d4",s="#737373",n="#a3a3a3",o=2.76142374915397,r=2.761423749153969,a=new G(G.Auto,{isActionable:!0,enabledChanged:(h,l)=>{if(h instanceof G){let u=h.findObject("ButtonBorder");if(u!==null)if(h._buttonFillNormal===void 0&&(h._buttonFillNormal=u.fill),l){let c=null;h.layer!==null&&h.diagram!==null&&h.isVisibleObject()&&(c=h.layer.findObjectAt(h.diagram.lastInput.documentPoint)),c===h||c!==null&&c.isContainedBy(h)?u.fill=h._buttonFillOver:u.fill=h._buttonFillNormal}else u.fill=h._buttonFillDisabled}},cursor:"pointer"}).attach({_buttonFillNormal:void 0,_buttonStrokeNormal:void 0,_buttonFillOver:i,_buttonStrokeOver:s,_buttonFillDisabled:n}).add(new et("RoundedRectangle",{name:"ButtonBorder",spot1:new T(0,0,o,r),spot2:new T(1,1,-o,-r),parameter1:2,fill:t,stroke:e}));return a.mouseEnter=(h,l,u)=>{if(!l.isEnabledObject()||!(l instanceof G))return;let c=l.findObject("ButtonBorder");c instanceof et&&(l._buttonFillNormal===void 0&&(l._buttonFillNormal=c.fill),c.fill=l._buttonFillOver,l._buttonStrokeNormal===void 0&&(l._buttonStrokeNormal=c.stroke),c.stroke=l._buttonStrokeOver)},a.mouseLeave=(h,l,u)=>{if(!l.isEnabledObject()||!(l instanceof G))return;let c=l.findObject("ButtonBorder");c instanceof et&&(l._buttonFillNormal!==void 0&&(c.fill=l._buttonFillNormal),l._buttonStrokeNormal!==void 0&&(c.stroke=l._buttonStrokeNormal))},a}),J.defineBuilder("TreeExpanderButton",x=>{let t=J.build("Button");return t.attach({_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine",visible:!1}),t.add(new et("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:st.Su}).bindObject("figure","isTreeExpanded",(e,i)=>{let s=i.panel;return e?s._treeExpandedFigure:s._treeCollapsedFigure})),t.bindObject("visible","isTreeLeaf",e=>!e),t.click=(e,i)=>{let s=i.part;if(s instanceof vt&&(s=s.adornedPart),!(s instanceof $))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isTreeExpanded){if(!o.canCollapseTree(s))return}else if(!o.canExpandTree(s))return;e.handled=!0,s.isTreeExpanded?o.collapseTree(s):o.expandTree(s)},t}),J.defineBuilder("SubGraphExpanderButton",x=>{let t=J.build("Button");return t.attach({_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"}),t.add(new et("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:st.Su}).bindObject("figure","isSubGraphExpanded",(e,i)=>{let s=i.panel;return e?s._subGraphExpandedFigure:s._subGraphCollapsedFigure})),t.click=(e,i)=>{let s=i.part;if(s instanceof vt&&(s=s.adornedPart),!(s instanceof ht))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isSubGraphExpanded){if(!o.canCollapseSubGraph(s))return}else if(!o.canExpandSubGraph(s))return;e.handled=!0,s.isSubGraphExpanded?o.collapseSubGraph(s):o.expandSubGraph(s)},t}),J.defineBuilder("ToolTip",x=>new vt(G.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2),mouseOver:(t,e)=>{let i=t.diagram.toolManager;i.extendToolTip(i.toolTipDuration)}}).add(new et("RoundedRectangle",{name:"Border",parameter1:1,fill:"#f5f5f5",strokeWidth:0,spot1:new T(0,0,4,6),spot2:new T(1,1,-4,-4)}))),J.defineBuilder("ContextMenu",x=>new vt(G.Vertical,{background:"#f5f5f5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).bindObject("background","",t=>t.adornedPart!==null&&t.hasPlaceholder()?null:"#f5f5f5")),J.defineBuilder("ContextMenuButton",x=>{let t=J.build("Button");t.stretch=5;let e=t.findObject("ButtonBorder");return e instanceof et&&(e.figure="Rectangle",e.strokeWidth=0,e.spot1=new T(0,0,4,6),e.spot2=new T(1,1,-4,-4)),t}),J.defineBuilder("PanelExpanderButton",x=>{let t=J.takeBuilderArgument(x,"COLLAPSIBLE"),e=J.build("Button");e.attach({_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8","ButtonBorder.fill":"rgba(0, 0, 0, 0)",_buttonFillNormal:"rgba(0, 0, 0, 0)","ButtonBorder.stroke":null,_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null}),e.add(new et({name:"ButtonIcon",strokeWidth:2}).bindObject("geometryString","visible",s=>s?e._buttonExpandedFigure:e._buttonCollapsedFigure,void 0,t));let i=e.findObject("ButtonBorder");return i instanceof et&&(i.stroke=null,i.fill="rgba(0, 0, 0, 0)"),e.click=(s,n)=>{if(!(n instanceof G))return;let o=n.diagram;if(o===null||o.isReadOnly)return;let r=n.findBindingPanel();if(r===null&&(r=n.part),r!==null){let a=r.findObject(t);a!==null&&(s.handled=!0,o.startTransaction("Collapse/Expand Panel"),a.visible=!a.visible,o.commitTransaction("Collapse/Expand Panel"))}},e}),J.defineBuilder("CheckBoxButton",x=>{let t=J.takeBuilderArgument(x),e=J.build("Button",{desiredSize:new st(14,14)});e.attach({"ButtonBorder.spot1":new T(0,0,1,1),"ButtonBorder.spot2":new T(1,1,-1,-1)});let i=new et({name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:2,geometryStretch:6,visible:!1});return t!==""&&i.bindTwoWay("visible",t),e.add(i),e.click=(s,n)=>{if(!(n instanceof G))return;let o=s.diagram;if(o===null||o.isReadOnly||t!==""&&o.model.isReadOnly)return;s.handled=!0;let r=n.findObject("ButtonIcon");o.startTransaction("checkbox"),r!==null&&(r.visible=!r.visible),m.it(n._doClick)&&n._doClick(s,n),o.commitTransaction("checkbox")},e}),J.defineBuilder("CheckBox",x=>{let t=J.takeBuilderArgument(x),e=J.build("CheckBoxButton",{name:"Button",isActionable:!1,margin:new Dt(0,1,0,0)},t),i=new G("Horizontal",{isActionable:!0,cursor:e.cursor,margin:new Dt(1),mouseEnter:e.mouseEnter,mouseLeave:e.mouseLeave,click:e.click}).attach({_buttonFillNormal:e._buttonFillNormal,_buttonStrokeNormal:e._buttonStrokeNormal,_buttonFillOver:e._buttonFillOver,_buttonStrokeOver:e._buttonStrokeOver,_buttonFillDisabled:e._buttonFillDisabled,_buttonClick:e.click});return i.add(e),e.mouseEnter=null,e.mouseLeave=null,e.click=null,i}),J.defineBuilder("AutoRepeatButton",x=>{let t=J.takeBuilderArgument(x,50,r=>typeof r=="number"),e=J.takeBuilderArgument(x,500,r=>typeof r=="number");function i(r,a){n(r,a),a.click&&(a.Cd=m.un(()=>s(r,a),e))}function s(r,a){a.Cd&&m.wc(a.Cd),a.click&&(a.Cd=m.un(()=>{a.click&&(a.click(r,a),s(r,a))},t))}function n(r,a){a.Cd&&(m.wc(a.Cd),a.Cd=void 0)}let o=J.build("Button");return o.actionDown=(r,a)=>i(r,a),o.actionUp=(r,a)=>n(r,a),o.actionCancel=(r,a)=>n(r,a),o}),J.defineBuilder("ToggleSwitch",function(x){let t=J.takeBuilderArgument(x);t||m.o("ToggleSwitch must be data-bound to a property name, not: "+t);let e=J.takeBuilderArgument(x,!1,r=>typeof r=="boolean"),i="gray",s="transparent",n="white",o=new G("Auto",{width:e?15:28,height:e?28:15}).attach({_buttonFillOff:i,_buttonBorderOff:s,_buttonIconFillOff:n,_buttonFillOn:"green",_buttonBorderOn:"transparent",_buttonIconFillOn:"white"}).add(new et("Capsule",{name:"ButtonBorder",fill:i,stroke:s,strokeWidth:1}).bind("fill",t,(r,a)=>r?a.panel._buttonFillOn:a.panel._buttonFillOff).bind("stroke",t,(r,a)=>r?a.panel._buttonBorderOn:a.panel._buttonBorderOff)).add(new et("Circle",{name:"ButtonIcon",width:11,height:11,fill:n,stroke:null,alignment:e?T.Bottom:T.Left}).bind("fill",t,(r,a)=>r?a.panel._buttonIconFillOn:a.panel._buttonIconFillOff).bind("alignment",t,r=>r?e?T.Top:T.Right:e?T.Bottom:T.Left));return o.click=function(r,a){if(!a.isEnabledObject())return;let h=r.diagram;if(h===null||h.isReadOnly||t!==""&&h.model.isReadOnly)return;r.handled=!0;let l=a.findBindingPanel();l!==null&&(h.startTransaction("toggle switch"),h.model.set(l.data,t,!l.data[t]),typeof a._doClick=="function"&&a._doClick(r,a),h.commitTransaction("toggle switch"))},o}),J.defineBuilder("Toggle",function(x){let t=J.takeBuilderArgument(x),e=J.build("ToggleSwitch",{name:"Button"},t),i=new G("Horizontal",{cursor:e.cursor,margin:1,mouseEnter:e.mouseEnter,mouseLeave:e.mouseLeave,click:e.click}).attach({_buttonClick:e.click}).add(e);return e.mouseEnter=null,e.mouseLeave=null,e.click=null,i});class Ye{me;Pt;io;ve;so;Ds;Il;Or;Ir;Er;Xr;Gr;Ur;Vr;Br;h0;c0;zr;f0;u0;d0;g0;Yr;Kr;Wp;s0;Ts;Sr;Mr;ro;i0;e0;Pr;qp;p0;y0;constructor(){this.me=!1,this.Pt="",this.io=-1,this.ve=null,this.so=null,this.Ds=null,this.Il="",this.Or=null,this.Ir=null,this.Er=null,this.Xr=null,this.Gr=null,this.Ur=null,this.Vr=null,this.Br=null,this.h0=null,this.c0=null,this.zr=null,this.f0=null,this.u0=null,this.d0=null,this.g0=null,this.Yr=null,this.Kr=null,this.Wp=null,this.s0=null,this.Ts=null,this.Sr=st.bc,this.Mr=st.LP,this.ro=1,this.i0=1,this.e0=1,this.Pr=0,this.qp=null,this.p0=null,this.y0="category"}copy(){let t=new Ye;return t.Pt=this.Pt,t.io=this.io,t.ve=this.ve,t.Ds=this.Ds,t.Il=this.Il,t.Or=this.Or,t.Ir=this.Ir,t.Er=this.Er,t.Xr=this.Xr,t.Gr=this.Gr,t.Ur=this.Ur,t.Vr=this.Vr,t.Br=this.Br,t.h0=this.h0,t.c0=this.c0,t.zr=this.zr,t.f0=this.f0,t.u0=this.u0,t.d0=this.d0,t.g0=this.g0,t.Yr=this.Yr,t.Kr=this.Kr,t.Wp=this.Wp,t.s0=this.s0,t.Ts=this.Ts,t.Sr=this.Sr.N(),t.Mr=this.Mr.N(),t.ro=this.ro,t.i0=this.i0,t.e0=this.e0,t.Pr=this.Pr,t.qp=this.qp,t.p0=this.p0,t.y0=this.y0,t}}class Si{m;constructor(){this.m=[1,0,0,1,0,0]}copy(){let t=new Si;return t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5],t}translate(t,e){this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e}scale(t,e){this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e}rotate(t,e,i){if(t=C.Ee(t),t===0)return;this.translate(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m[0]*s+this.m[2]*n,r=this.m[1]*s+this.m[3]*n,a=this.m[0]*-n+this.m[2]*s,h=this.m[1]*-n+this.m[3]*s;this.m[0]=o,this.m[1]=r,this.m[2]=a,this.m[3]=h,this.translate(-e,-i)}}class li{type;x1;y1;r1;x2;y2;r2;colors;pattern;constructor(t){this.type=t,this.x1=0,this.y1=0,this.r1=0,this.x2=0,this.y2=0,this.r2=0,this.colors=[],this.pattern=null}addColorStop(t,e){this.colors.push({offset:t,color:e})}}class ui{bt;_t;Qr;dd;ON;constructor(t,e,i){let s=e===void 0?K.document:e;this.Qr=s,this.ON="http://www.w3.org/2000/svg";let n="http://www.w3.org/2000/xmlns/";s!==void 0&&(this.bt=this.makeElement("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.style.letterSpacing="normal",this.style.wordSpacing="normal",i||(this.style.position="absolute"),this.bt.setAttributeNS(n,"xmlns",this.ON),this.bt.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink")),this.dd=null,this._t=new re(this,i)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",this.bt.setAttributeNS(null,"width",i+"px"),this.bt.setAttributeNS(null,"height",s+"px"),this.bt.setAttributeNS(null,"viewBox","0 0 "+i+" "+s),this._t.IN.firstElementChild.setAttributeNS(null,"width",i+"px"),this._t.IN.firstElementChild.setAttributeNS(null,"height",s+"px"),!0):!1}makeElement(t,e,i){let s=this.Qr.createElementNS(this.ON,t);if(m.$(e))for(let n in e)s.setAttributeNS(n==="href"?"http://www.w3.org/1999/xlink":"",n,e[n]);return i!==void 0&&(s.textContent=i),s}getBoundingClientRect(){return this.bt.getBoundingClientRect()}focus(){this.bt.focus()}get width(){return parseInt(this.bt.getAttribute("width")||"1")}set width(t){this.bt.setAttribute("width",t+"px")}get height(){return parseInt(this.bt.getAttribute("height")||"1")}set height(t){this.bt.setAttribute("height",t+"px")}dispose(){this.Qr=null}get style(){return this.bt.style}}class re{Mf;Nf;Ln;Fe;$i;fillStyle;font;globalAlpha;lineCap;lineDashOffset;lineJoin;lineWidth;miterLimit;shadowBlur;shadowColor;shadowOffsetX;shadowOffsetY;strokeStyle;textAlign;imageSmoothingEnabled;clipInsteadOfFill;lastCreatedElement;Cf;Lf;surface;svg;IN;oD;B1;Ho;La;zh;currentElement;clipPathGroup;diagramGroup;lastDrawnPart;currentPath;outerGroup;pathAttributes;sl;Tr;filter;letterSpacing;wordSpacing;partClipRect;constructor(t,e){if(this.surface=t,this.svg=t.bt,this.Cf=[],this.Lf=[],this.fillStyle="#000000",this.font="10px sans-serif",this.globalAlpha=1,this.lineCap="butt",this.lineDashOffset=0,this.lineJoin="miter",this.lineWidth=1,this.miterLimit=10,this.shadowBlur=0,this.shadowColor="rgba(0, 0, 0, 0)",this.shadowOffsetX=0,this.shadowOffsetY=0,this.sl=!1,this.strokeStyle="#000000",this.textAlign="start",this.clipInsteadOfFill=!1,this.Mf=0,this.Nf=0,this.Ln=0,this.lastCreatedElement=null,this.currentElement=null,this.Fe=[],this.pathAttributes={},this.B1=!1,this.Ho=null,this.La=0,this.oD={},this.Tr=!!e,this.filter="",this.partClipRect=null,this.$i=new Si,this.letterSpacing="0px",this.wordSpacing="0px",t.Qr===null||t.Qr===void 0)return;this.clipPathGroup=this.newGroup2(),this.diagramGroup=this.newGroup2("gojs-diagram"),this.lastDrawnPart=null,this.currentPath=null;let i=V.Hw++,s=this.makeElement("clipPath",{id:"mainClip"+i}),n={x:0,y:0,width:t.width,height:t.height};s.appendChild(this.makeElement("rect",n)),this.IN=s,this.svg.appendChild(this.clipPathGroup),this.clipPathGroup.appendChild(this.diagramGroup),this.svg.appendChild(s),this.clipPathGroup.setAttributeNS(null,"clip-path","url(#mainClip"+i+")")}setDiagramPosScale(t,e,i,s,n,o){this.diagramGroup===void 0?this.newGroup(t,e,i,s,n,o):this.diagramGroup.setAttribute("transform","matrix("+t+", "+e+", "+i+", "+s+", "+n+", "+o+")")}resetInnerSVG(){this.diagramGroup!==null&&(this.diagramGroup.innerHTML="")}arc(t,e,i,s,n,o,r,a){let h=2*Math.PI,l=1e-6,u=h-l,c=i*Math.cos(s),d=i*Math.sin(s),f=t+c,p=e+d,g=o?0:1,y=o?s-n:n-s;(Math.abs(r-f)>l||Math.abs(a-p)>l)&&this.Fe.push(["L",f,+p]),y<0&&(y=y%h+h),y>u?(this.Fe.push(["A",i,i,0,1,g,t-c,e-d]),this.Fe.push(["A",i,i,0,1,g,f,p])):y>l&&this.Fe.push(["A",i,i,0,+(y>=Math.PI),g,t+i*Math.cos(n),e+i*Math.sin(n)])}beginPath(){this.Fe=[],this.pathAttributes={stroke:"none",fill:"none"}}endPath(t){this.xI(this.Fe,this.$i,t||0)}bezierCurveTo(t,e,i,s,n,o){this.Fe.push(["C",t,e,i,s,n,o])}clearRect(t,e,i,s){}clip(){this.pathAttributes.clipPath=!0}closePath(){this.Fe.push(["z"])}createLinearGradient(t,e,i,s){let n=new li("linear");return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}createPattern(t,e){let i="";t instanceof HTMLCanvasElement&&(i=t.toDataURL()),t instanceof HTMLImageElement&&(i=t.getAttribute("src"));let s=this.oD;if(s[i])return"url(#"+s[i]+")";let n="PATTERN"+V.Hw++,o={width:t.width,height:t.height,id:n,patternUnits:"userSpaceOnUse"},r={x:0,y:0,width:t.width,height:t.height,href:i},a=this.makeElement("pattern",o);return a.appendChild(this.makeElement(Y.img,r)),this.svg.appendChild(a),s[i]=n,"url(#"+n+")"}createRadialGradient(t,e,i,s,n,o){let r=new li("radial");return r.x1=t,r.y1=e,r.r1=i,r.x2=s,r.y2=n,r.r2=o,r}amendImageTransform(t,e,i,s,n,o,r,a){let h=r/i,l=a/s;(n!==0||o!==0)&&this.$i.translate(n,o),(h!==1||l!==1)&&this.$i.scale(h,l),(t!==0||e!==0)&&this.$i.translate(-t,-e)}drawImage(t,e,i,s,n,o,r,a,h){let l="",u=t.width,c=t.height;typeof t.toDataURL=="function"?t.toDataURL():(l=t.getAttribute("src"),u=t.naturalWidth,c=t.naturalHeight),s===void 0&&(o=e,r=i,a=s=u,h=n=c),s=s||0,n=n||0,o=o||0,r=r||0,a=a||0,h=h||0,this.amendImageTransform(e,i,s,n,o,r,a,h);let d={x:0,y:0,width:u||s,height:c||n,href:l};!C.X(s,a)||!C.X(n,h)?d.preserveAspectRatio="none":l.toLowerCase().indexOf(".svg")===-1&&l.toLowerCase().indexOf("data:image/svg")===-1&&(d.preserveAspectRatio="xMidYMid slice"),(e!==0||i!==0||s!==u||n!==c)&&(s+=e,n+=i,d["clip-path"]=`path('M ${e},${i} L ${s} ${i} L ${s} ${n} L ${e} ${n} z')`),this.processCommon(Y.img,d,this.$i),this.Ld(Y.img,d)}fill(t,e){t&&(this.pathAttributes["fill-rule"]="evenodd"),this.setFill(this.pathAttributes)}fillContext(t,e,i){this.clipInsteadOfFill?this.clip():this.fill(e,i)}createOrUpdateClipGroup(t,e){let i=this.newGroup(1,0,0,1,-e.x,-e.y);i.setAttributeNS(null,"class","spotClip"),t.xa=i}fillRect(t,e,i,s){this.addRect("fill",[t,e,i,s],this.$i)}fillBackground(t,e,i,s){let n={x:t,y:e,width:i,height:s};this.processCommon("fill",n,this.$i),this.setFill(n),this.svg.prepend(this.makeElement("rect",n))}fillText(t,e,i){this.addText("fill",[t,e,i],this.$i)}lineTo(t,e){this.Fe.push(["L",t,e])}moveTo(t,e){this.Fe.push(["M",t,e])}quadraticCurveTo(t,e,i,s){this.Fe.push(["Q",t,e,i,s])}rect(t,e,i,s){this.Fe.push(["M",t,e],["L",t+i,e],["L",t+i,e+s],["L",t,e+s],["z"])}restore(){this.$i=this.Cf.pop(),this.Fe=this.Cf.pop();let t=this.Cf.pop();this.fillStyle=t.fillStyle,this.font=t.font,this.globalAlpha=t.globalAlpha,this.lineCap=t.lineCap,this.lineDashOffset=t.lineDashOffset,this.lineJoin=t.lineJoin,this.lineWidth=t.lineWidth,this.miterLimit=t.miterLimit,this.shadowBlur=t.shadowBlur,this.shadowColor=t.shadowColor,this.shadowOffsetX=t.shadowOffsetX,this.shadowOffsetY=t.shadowOffsetY,this.strokeStyle=t.strokeStyle,this.textAlign=t.textAlign,this.partClipRect=t.partClipRect,this.letterSpacing=t.letterSpacing,this.wordSpacing=t.wordSpacing}save(){let t={fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign,partClipRect:this.partClipRect};this.Cf.push(t);let e=[];for(let i=0;i<this.Fe.length;i++)e.push(this.Fe[i]);this.Cf.push(e),this.Cf.push(this.$i.copy())}setTransform(t,e,i,s,n,o){t===1&&e===0&&i===0&&s===1&&n===0&&o===0||this.newGroup(t,e,i,s,n,o)}setCurrentTransform(t,e,i,s,n,o){this.$i.m=[t,e,i,s,n,o]}getCurrentTransform(){let t=this.$i.m;return"matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}scale(t,e){this.$i.scale(t,e)}translate(t,e){this.$i.translate(t,e)}transform(t,e,i,s,n,o){}commitTransform(){}stroke(){this.setStroke(this.pathAttributes)}strokeContext(){this.clipInsteadOfFill||this.stroke()}strokeRect(t,e,i,s){this.addRect("stroke",[t,e,i,s],this.$i)}makeElement(t,e,i){return this.surface.makeElement(t,e,i)}Ld(t,e,i){let s=this.makeElement(t,e,i);return this.currentElement!==null?this.currentElement.appendChild(s):this.currentElement=s,this.lastCreatedElement=s,s}processCommon(t,e,i){if(t==="fill"?this.setFill(e):t==="stroke"&&this.setStroke(e),i!==null){let s=i.m;e.transform="matrix("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+", "+s[4]+", "+s[5]+")"}}setFill(t){if(this.fillStyle instanceof li){t.fill=this.addGradient(this.fillStyle,"fill");return}if(/^rgba\(/.test(this.fillStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.fill="rgb("+e[1]+","+e[2]+","+e[3]+")",t["fill-opacity"]=e[4]}else t.fill=this.fillStyle}setFillOrStrokeInPlace(t,e){let i=e?"fill":"stroke";if(this.fillStyle instanceof li){t.setAttributeNS(null,"fill",this.addGradient(this.fillStyle,i));return}if(/^rgba\(/.test(this.fillStyle)){let s=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.setAttributeNS(null,i,"rgb("+s[1]+","+s[2]+","+s[3]+")"),t.setAttributeNS(null,i+"-opacity",s[4])}else t.setAttributeNS(null,i,this.fillStyle)}setStroke(t){if(this.strokeStyle instanceof li)t.stroke=this.addGradient(this.strokeStyle,"stroke");else if(/^rgba\(/.test(this.strokeStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.strokeStyle);t.stroke="rgb("+e[1]+","+e[2]+","+e[3]+")",t["stroke-opacity"]=e[4]}else t.stroke=this.strokeStyle;t["stroke-width"]=this.lineWidth,t["stroke-linecap"]=this.lineCap,t["stroke-linejoin"]=this.lineJoin,t["stroke-miterlimit"]=this.miterLimit,this.B1&&(t["stroke-dasharray"]=this.Ho.toString(),t["stroke-dashoffset"]=this.La)}addGradient(t,e){let i="",s=this.currentPath!==null?this.currentPath.getAttribute(e):null;if(s!==null&&s.indexOf("GRAD")!==-1){i=s.split("#")[1].slice(0,-1);let a=this.svg.getElementById(i);a!==null&&a.remove()}else i="GRAD"+V.Hw++;let n;if(t.type==="linear"){let a={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,id:i,gradientUnits:"userSpaceOnUse"};n=this.makeElement("linearGradient",a)}else if(t.type==="radial"){let a={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,r1:t.r1,r2:t.r2,id:i};n=this.makeElement("radialGradient",a)}else m.o("invalid gradient");let o=t.colors.sort((a,h)=>a.offset>h.offset?1:-1),r=o.length;for(let a=0;a<r;a++){let h=o[a],l=h.color;n.appendChild(this.makeElement("stop",{offset:h.offset,"stop-color":l}))}return this.svg.appendChild(n),"url(#"+i+")"}addRect(t,e,i){let s={x:e[0],y:e[1],width:e[2],height:e[3]};this.processCommon(t,s,i),this.Ld("rect",s)}addText(t,e,i){let s=this.textAlign;s==="left"?s="start":s==="right"?s="end":s==="center"&&(s="middle");let n={x:e[1],y:e[2],style:"font: "+this.font,"text-anchor":s};n["letter-spacing"]=this.letterSpacing,n["word-spacing"]=this.wordSpacing,this.processCommon(t,n,i),this.Ld("text",n,e[0])}xI(t,e,i){let s=this.bI(t),n=this.pathAttributes;if(n.clipPath){this.Lf.length>1&&this.Lf[this.Lf.length-2].setAttributeNS(null,"clip-path",'path("'+s+'") view-box');return}if(n.d=s,this.processCommon("",n,e),this.currentPath!==null){let o=this.currentPath;if(o.nodeName!=="g")for(let r in n)r!=="transform"&&o.setAttributeNS(null,r,n[r]);else{let r=o.getElementsByTagName("path");for(let a in n)a!=="transform"&&r[i].setAttributeNS(null,a,n[a])}}else this.Ld("path",n)}bI(t){let e=[];for(let i=0;i<t.length;i++){let s=t[i].slice(),n=[s.shift()];if(n[0]==="A")n.push(s.shift()+","+s.shift(),s.shift(),s.shift()+","+s.shift(),s.shift()+","+s.shift());else for(;s.length;)n.push(s.shift()+","+s.shift());e.push(n.join(" "))}return e.join(" ")}newGroup(t,e,i,s,n,o){let r=new Si;r.m=[t,e,i,s,n,o];let a={};this.processCommon("g",a,r);let h=this.Ld("g",a);return this.Lf.push(h),h}newGroup2(t){let e={};t&&(e.class=t);let i=this.Ld("g",e);return this.Lf.push(i),i}endGroup(){return this.Lf.pop()}dummyGroup(){return this.newGroup2(),this.endGroup()}shadowsSet(t,e,i){this.Mf=t,this.Nf=e,this.Ln=i}shadowsOff(){this.sl=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.sl=!0,this.shadowOffsetX=this.Mf,this.shadowOffsetY=this.Nf,this.shadowBlur=this.Ln}enableDash(t,e){this.B1=!0,this.Ho=t,this.La=e}disableDash(){this.B1=!1}clearContextCache(t){}setImageSmoothingEnabled(t){}rotate(t){this.$i.rotate(t*57.2958,0,0)}getImageData(t,e,i,s){return null}measureText(t){return null}removeOldGradient(t,e,i){let s=e.getAttribute(i);if(s===null)return;let n=s.split("#");if(n.length===1)return;let o=this.svg.getElementById(n[1].slice(0,-1));if(o!==null){let r=new RegExp(o.id,"g");this.svg.innerHTML.match(r).length===1&&o.remove()}}removePartFromView(t){t.svg!==null&&t.svg.parentNode===this.diagramGroup&&t.svg.remove()}}class Fe{bt;_t;Qr;dd;constructor(t,e,i,s){let n=e===void 0?K.document:e;this.Qr=n,this.dd=null;let o=n.createElement("canvas");o.tabIndex=0,this.bt=o,this._t=new ci(o,i,s),t&&Y.ji.set(o,t)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",!0):!1}toDataURL(t,e){return this.bt.toDataURL(t,e)}getBoundingClientRect(){return this.bt.getBoundingClientRect()}focus(){this.bt.focus()}get width(){return this.bt.width}set width(t){this.bt.width=t}get height(){return this.bt.height}set height(t){this.bt.height=t}dispose(){Y.ji.delete(this.bt),this.Qr=null}get style(){return this.bt.style}}class ci{F;z1;X1;G1;clipInsteadOfFill;Mf;Nf;Ln;zh;sl;Tr;constructor(t,e,i){t.getContext||m.o("Browser does not support HTML Canvas Element"),this.F=t.getContext("2d",e),this.z1="",this.X1="",this.G1="",this.clipInsteadOfFill=!1,this.Mf=0,this.Nf=0,this.Ln=0,this.sl=!1,this.zh=new Nt,this.Tr=!!i}createOrUpdateClipGroup(t,e){}setImageSmoothingEnabled(t){this.F.imageSmoothingEnabled=t}get fillStyle(){return this.F.fillStyle}set fillStyle(t){this.G1!==t&&(this.F.fillStyle=t,this.G1=t)}get font(){return this.F.font}set font(t){this.z1!==t&&(this.F.font=t,this.z1=t)}get globalAlpha(){return this.F.globalAlpha}set globalAlpha(t){this.F.globalAlpha=t}get lineCap(){return this.F.lineCap}set lineCap(t){this.F.lineCap=t}get lineDashOffset(){return this.F.lineDashOffset}set lineDashOffset(t){this.F.lineDashOffset=t}get lineJoin(){return this.F.lineJoin}set lineJoin(t){this.F.lineJoin=t}get lineWidth(){return this.F.lineWidth}set lineWidth(t){this.F.lineWidth=t}get miterLimit(){return this.F.miterLimit}set miterLimit(t){this.F.miterLimit=t}get shadowBlur(){return this.F.shadowBlur}set shadowBlur(t){this.F.shadowBlur=t}get shadowColor(){return this.F.shadowColor}set shadowColor(t){this.F.shadowColor=t}get shadowOffsetX(){return this.F.shadowOffsetX}set shadowOffsetX(t){this.F.shadowOffsetX=t}get shadowOffsetY(){return this.F.shadowOffsetY}set shadowOffsetY(t){this.F.shadowOffsetY=t}get strokeStyle(){return this.F.strokeStyle}set strokeStyle(t){this.X1!==t&&(this.F.strokeStyle=t,this.X1=t)}get textAlign(){return this.F.textAlign}set textAlign(t){this.F.textAlign=t}get imageSmoothingEnabled(){return this.F.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.F.imageSmoothingEnabled=t}get filter(){return this.F.filter}set filter(t){t===""?this.F.filter="none":this.F.filter=t}get letterSpacing(){return this.F.letterSpacing}set letterSpacing(t){this.F.letterSpacing=t}get wordSpacing(){return this.F.wordSpacing}set wordSpacing(t){this.F.wordSpacing=t}arc(t,e,i,s,n,o,r,a){this.F.arc(t,e,i,s,n,o)}beginPath(){this.F.beginPath()}endPath(){}bezierCurveTo(t,e,i,s,n,o){this.F.bezierCurveTo(t,e,i,s,n,o)}clearRect(t,e,i,s){this.commitTransform(),this.F.clearRect(t,e,i,s)}clip(t){t?this.F.clip(t):this.F.clip()}closePath(){this.F.closePath()}createLinearGradient(t,e,i,s){return this.F.createLinearGradient(t,e,i,s)}createPattern(t,e){return this.F.createPattern(t,e)}createRadialGradient(t,e,i,s,n,o){return this.F.createRadialGradient(t,e,i,s,n,o)}drawImage(t,e,i,s,n,o,r,a,h){s===void 0?this.F.drawImage(t,e,i):this.F.drawImage(t,e,i,s,n,o,r,a,h)}fill(t,e){e?this.F.fill(e,t?"evenodd":"nonzero"):this.F.fill(t?"evenodd":"nonzero")}fillRect(t,e,i,s){this.F.fillRect(t,e,i,s)}fillBackground(t,e,i,s){this.F.fillRect(t,e,i,s)}fillText(t,e,i){this.F.fillText(t,e,i)}getImageData(t,e,i,s){return this.F.getImageData(t,e,i,s)}lineTo(t,e){this.F.lineTo(t,e)}measureText(t){return this.F.measureText(t)}moveTo(t,e){this.F.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.F.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.F.rect(t,e,i,s)}restore(){this.F.restore()}save(){this.commitTransform(),this.F.save()}rotate(t){this.zh.ks(t*57.2958,0,0)}setTransform(t,e,i,s,n,o){this.zh.setTo(t,e,i,s,n,o)}scale(t,e){this.zh.et(t,e)}translate(t,e){this.zh.Xs(t,e)}stroke(t){t?this.F.stroke(t):this.F.stroke()}transform(t,e,i,s,n,o){if(t===1&&e===0&&i===0&&s===1&&n===0&&o===0)return;let r=this.zh,a=r.m11*t+r.m21*e,h=r.m12*t+r.m22*e,l=r.m11*i+r.m21*s,u=r.m12*i+r.m22*s;r.dx=r.m11*n+r.m21*o+r.dx,r.dy=r.m12*n+r.m22*o+r.dy,r.m11=a,r.m12=h,r.m21=l,r.m22=u}commitTransform(){let t=this.zh;this.F.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy)}fillContext(t,e,i){this.radialFill(t,e,i)||this.fillOrClip(e,i)}radialFill(t,e,i){if(!(t instanceof R)||t.type!==3)return!1;let s=t.bf,n=t.I1;return n>s?(this.scale(s/n,1),this.translate((n-s)/2,0)):s>n&&(this.scale(1,n/s),this.translate(0,(s-n)/2)),this.fillOrClip(e,i),n>s?(this.translate(-(n-s)/2,0),this.scale(1/(s/n),1)):s>n&&(this.translate(0,-(s-n)/2),this.scale(1,1/(n/s))),!0}strokeContext(){this.clipInsteadOfFill||this.stroke()}fillOrClip(t,e){this.clipInsteadOfFill?this.clip(e):this.fill(t,e)}shadowsSet(t,e,i){this.Mf=t,this.Nf=e,this.Ln=i}shadowsOff(){this.sl=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.sl=!0,this.shadowOffsetX=this.Mf,this.shadowOffsetY=this.Nf,this.shadowBlur=this.Ln}enableDash(t,e){let i=this.F;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=e)}disableDash(){let t=this.F;t.setLineDash!==void 0&&(t.setLineDash(ci.EmptyArray),t.lineDashOffset=0)}clearContextCache(t){t&&(this.z1=""),this.X1="",this.G1=""}removePartFromView(t){}static EmptyArray=Object.freeze([])}var Oe=(x=>(x[x.Solid=1]="Solid",x[x.Linear=2]="Linear",x[x.Radial=3]="Radial",x[x.Pattern=4]="Pattern",x))(Oe||{}),Ys=(x=>(x[x.Lab=1]="Lab",x[x.HSL=2]="HSL",x[x.Oklch=3]="Oklch",x))(Ys||{});class _e{n0;n1;n2;n3;constructor(){this.n0=0,this.n1=0,this.n2=0,this.n3=0}}class R{u;W;Xh;ae;Cs;w0;x0;qo;b0;Nn;bf;I1;constructor(t,e){if(V.Je(this),this.u=!1,t===void 0)this.W=1,this.Xh="black";else if(typeof t=="string"){let s=m.$a(Oe,t);s!==null?(this.W=s,this.Xh="black"):(this.W=1,this.Xh=t)}else Object.keys(Oe).hasOwnProperty(t)?(this.W=t,this.Xh="black"):typeof t=="object"&&(this.W=1,e=t);let i=this.W;if(i===2?(this.ae=T.TopCenter,this.Cs=T.BottomCenter):i===3?(this.ae=T.Center,this.Cs=T.Center):(this.ae=T.None,this.Cs=T.None),this.w0=0,this.x0=NaN,this.qo=null,this.b0=null,this.Nn=null,this.bf=0,this.I1=0,e){let s={};for(let n in e)isFinite(parseFloat(n))?this.addColorStop(parseFloat(n),e[n]):s[n]=e[n];Object.assign(this,s)}}copy(){let t=new R;return t.W=this.W,t.Xh=this.Xh,t.ae=this.ae.N(),t.Cs=this.Cs.N(),t.w0=this.w0,t.x0=this.x0,this.qo!==null&&(t.qo=this.qo.copy()),t.b0=this.b0,t}k(){return this.u=!0,this.qo!==null&&this.qo.k(),this}fe(t){t in Oe?this.type=t:m.cr(this,t)}toString(){let t="Brush(";if(this.type===1)t+=this.color;else if(this.type===2?t+="Linear ":this.type===3?t+="Radial ":this.type===4?t+="Pattern ":t+="(unknown) ",t+=this.start+" "+this.end,this.colorStops!==null){let e=this.colorStops.iterator;for(;e.next();){let i=e.key,s=e.value;t+=" "+i+":"+s}}return t+=")",t}addColorStop(t,e){return this.u&&m.L(this),(typeof t!="number"||!isFinite(t)||t>1||t<0)&&m.J(t,"0 <= loc <= 1",R,"addColorStop:loc"),m.s(e,"string",R,"addColorStop:color"),this.qo===null&&(this.qo=new Mt),this.qo.set(t,e),this.W===1&&(this.type=2),this.Nn=null,this}get type(){return this.W}set type(t){this.u&&m.L(this,t),this.W=t,this.start.isNoSpot()&&(t===2?this.start=T.TopCenter:t===3&&(this.start=T.Center)),this.end.isNoSpot()&&(t===2?this.end=T.BottomCenter:t===3&&(this.end=T.Center)),this.Nn=null}get color(){return this.Xh}set color(t){this.u&&m.L(this,t),this.Xh=t,this.Nn=null}get start(){return this.ae}set start(t){this.u&&m.L(this,t),this.ae=t.N(),this.Nn=null}get end(){return this.Cs}set end(t){this.u&&m.L(this,t),this.Cs=t.N(),this.Nn=null}get startRadius(){return this.w0}set startRadius(t){this.u&&m.L(this,t),t<0&&m.J(t,">= zero",R,"startRadius"),this.w0=t,this.Nn=null}get endRadius(){return this.x0}set endRadius(t){this.u&&m.L(this,t),t<0&&m.J(t,">= zero",R,"endRadius"),this.x0=t,this.Nn=null}get colorStops(){return this.qo}set colorStops(t){this.u&&m.L(this,t),this.qo=t,this.Nn=null}get pattern(){return this.b0}set pattern(t){this.u&&m.L(this,t),this.b0=t,this.Nn=null}static randomColor(t,e){t===void 0&&(t=128),e===void 0&&(e=Math.max(t,255));let i=Math.abs(e-t),s=Math.floor(t+Math.random()*i).toString(16),n=Math.floor(t+Math.random()*i).toString(16),o=Math.floor(t+Math.random()*i).toString(16);return s.length<2&&(s="0"+s),n.length<2&&(n="0"+n),o.length<2&&(o="0"+o),"#"+s+n+o}static isValidColor(t){return K.CSS?K.CSS.supports("color",t):!0}static lighten(t){return R.lightenBy(t)}lightenBy(t,e){this.u&&m.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)R.Oo(this.color),this.color=R.Ad(i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)R.Oo(n.value),this.addColorStop(n.key,R.Ad(i,s))}return this}static lightenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return R.Oo(t),R.Ad(s,n)}static darken(t){return R.darkenBy(t)}darkenBy(t,e){this.u&&m.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)R.Oo(this.color),this.color=R.Ad(-i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)R.Oo(n.value),this.addColorStop(n.key,R.Ad(-i,s))}return this}static darkenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return R.Oo(t),R.Ad(-s,n)}static mix(t,e,i){R.Oo(t);let s=R.Y.n0,n=R.Y.n1,o=R.Y.n2,r=R.Y.n3;R.Oo(e),i===void 0&&(i=.5);let a=Math.round((R.Y.n0-s)*i+s),h=Math.round((R.Y.n1-n)*i+n),l=Math.round((R.Y.n2-o)*i+o),u=Math.round((R.Y.n3-r)*i+r);return`rgba(${a}, ${h}, ${l}, ${u})`}isDark(){if(this.type===1)return R.isDark(this.color);if((this.type===2||this.type===3)&&this.colorStops!==null){let t=this.colorStops;if(this.type===3){let a=t.first();return a?R.isDark(a.value):!1}if(t.get(.5)!==null)return R.isDark(t.get(.5));if(t.count===2){let a=t.toArray();return R.isDark(R.mix(a[0].value,a[1].value))}let e=t.iterator,i=-1,s=-1,n=1,o=1;for(;e.next();){let a=e.key,h=Math.abs(.5-e.key);n>o&&h<n?(i=a,n=h):o>=n&&h<o&&(s=a,o=h)}if(i>s){let a=i;i=s,s=a,a=n,n=o,o=a}let r=s-i;return R.isDark(R.mix(t.get(i),t.get(s),1-o/r))}return!1}static isDark(t){return t?t instanceof R?t.isDark():(R.Oo(t),(299*R.Y.n0+587*R.Y.n1+114*R.Y.n2)/1e3<128):!1}static Ad(t,e){switch(e){case 1:return R.kI(),R.lo.n0=Math.min(100,Math.max(0,R.lo.n0+100*t)),R.SI(),"rgba("+R.Y.n0+", "+R.Y.n1+", "+R.Y.n2+", "+R.Y.n3+")";case 2:return R.RM(),R.ze.n2=Math.min(100,Math.max(0,R.ze.n2+100*t)),"hsla("+R.ze.n0+", "+R.ze.n1+"%, "+R.ze.n2+"%, "+R.ze.n3+")";case 3:return R.MI(),R.ao.n0=Math.min(100,Math.max(0,R.ao.n0+100*t)),R.NI(),"rgba("+R.Y.n0+", "+R.Y.n1+", "+R.Y.n2+", "+R.Y.n3+")";default:m.o("Unknown color space: "+e)}}static Oo(t){R.k0===!1&&(R.k0=!0,R.us=Y.isUsingDOM()?new Fe(null,void 0,{willReadFrequently:!0})._t:null);let e=R.us;if(e===null)return;e.clearRect(0,0,1,1),e.fillStyle="#000000";let i=e.fillStyle;if(e.fillStyle=t,e.fillStyle!==i){e.fillRect(0,0,1,1);let s=e.getImageData(0,0,1,1).data;R.Y.n0=s[0],R.Y.n1=s[1],R.Y.n2=s[2],R.Y.n3=s[3]/255}else{e.fillStyle="#FFFFFF";let s=e.fillStyle;e.fillStyle=t,e.fillStyle,R.Y.n0=0,R.Y.n1=0,R.Y.n2=0,R.Y.n3=1}}static RM(){let t=R.Y.n0/255,e=R.Y.n1/255,i=R.Y.n2/255,s=Math.max(t,e,i),n=Math.min(t,e,i),o=s-n,r,a,h=(s+n)/2;if(o===0)r=a=0;else{switch(s){case t:r=(e-i)/o%6;break;case e:r=(i-t)/o+2;break;case i:r=(t-e)/o+4;break;default:r=0;break}r*=60,r<0&&(r+=360),a=o/(1-Math.abs(2*h-1))}R.ze.n0=Math.round(r),R.ze.n1=Math.round(a*100),R.ze.n2=Math.round(h*100),R.ze.n3=R.Y.n3}static UU(){let t=R.ze.n0,e=R.ze.n1/100,i=R.ze.n2/100,s,n,o,r=(1-Math.abs(2*i-1))*e,a=t/60,h=r*(1-Math.abs(a%2-1));a>=0&&a<1?(s=r,n=h,o=0):a>=1&&a<2?(s=h,n=r,o=0):a>=2&&a<3?(s=0,n=r,o=h):a>=3&&a<4?(s=0,n=h,o=r):a>=4&&a<5?(s=h,n=0,o=r):(s=r,n=0,o=h);let l=i-.5*r;s+=l,n+=l,o+=l,R.Y.n0=Math.round(s*255),R.Y.n1=Math.round(n*255),R.Y.n2=Math.round(o*255),R.Y.n3=R.ze.n3}static kI(){R.rD(),R.CI()}static SI(){R.LI(),R.lD()}static EN(t){return t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}static UN(t){return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}static rD(){let t=R.EN(R.Y.n0),e=R.EN(R.Y.n1),i=R.EN(R.Y.n2);R.At.n0=.4124564*t+.3575761*e+.1804375*i,R.At.n1=.2126729*t+.7151522*e+.072175*i,R.At.n2=.0193339*t+.119192*e+.9503041*i,R.At.n3=R.Y.n3}static lD(){let t=3.2404542*R.At.n0+-1.5371385*R.At.n1+-.4985314*R.At.n2,e=-.969266*R.At.n0+1.8760108*R.At.n1+.041556*R.At.n2,i=.0556434*R.At.n0+-.2040259*R.At.n1+1.0572252*R.At.n2;R.Y.n0=R.UN(t)*255,R.Y.n1=R.UN(e)*255,R.Y.n2=R.UN(i)*255,R.Y.n3=R.At.n3,R.Y.n0=Math.round(R.Y.n0),R.Y.n0>255?R.Y.n0=255:R.Y.n0<0&&(R.Y.n0=0),R.Y.n1=Math.round(R.Y.n1),R.Y.n1>255?R.Y.n1=255:R.Y.n1<0&&(R.Y.n1=0),R.Y.n2=Math.round(R.Y.n2),R.Y.n2>255?R.Y.n2=255:R.Y.n2<0&&(R.Y.n2=0)}static VN=216/24389;static Y1=24389/27;static Td=[95.047,100,108.883];static BN(t){return t>R.VN?Math.pow(t,1/3):(R.Y1*t+16)/116}static CI(){let t=R.BN(R.At.n0*100/R.Td[0]),e=R.BN(R.At.n1*100/R.Td[1]),i=R.BN(R.At.n2*100/R.Td[2]);R.lo.n0=116*e-16,R.lo.n1=500*(t-e),R.lo.n2=200*(e-i),R.lo.n3=R.At.n3}static aD(t){let e=t*t*t;return e>R.VN?e:(116*t-16)/R.Y1}static LI(){let t=(R.lo.n0+16)/116,e=R.lo.n1/500+t,i=t-R.lo.n2/200;R.At.n0=R.Td[0]/100*R.aD(e),R.At.n1=R.Td[1]/100*(R.lo.n0>R.Y1*R.VN?Math.pow(t,3):R.lo.n0/R.Y1),R.At.n2=R.Td[2]/100*R.aD(i),R.At.n3=R.lo.n3}static AI(){let t=.8190224*R.At.n0+.3619062*R.At.n1+-.1288737*R.At.n2,e=.03298366*R.At.n0+.9292868*R.At.n1+.03614466*R.At.n2,i=.04817719*R.At.n0+.2642395*R.At.n1+.6335478*R.At.n2;t=Math.cbrt(t),e=Math.cbrt(e),i=Math.cbrt(i),R.ge.n0=.2104542*t+.7936177*e+-.004072046*i,R.ge.n1=1.977998*t+-2.428592*e+.4505937*i,R.ge.n2=.02590403*t+.7827717*e+-.8086757*i,R.ge.n3=R.At.n3,R.ge.n0*=100}static TI(){R.ge.n0/=100;let t=.9999999*R.ge.n0+.3963377*R.ge.n1+.2158037*R.ge.n2,e=1.000000009*R.ge.n0+-.1055613*R.ge.n1+-.06385417*R.ge.n2,i=1.00000005*R.ge.n0+-.08948418*R.ge.n1+-1.291485*R.ge.n2;t=t**3,e=e**3,i=i**3,R.At.n0=1.2268798*t+-.5578149*e+.281391*i,R.At.n1=-.04057576*t+1.112286*e+-.07171106*i,R.At.n2=-.07637294*t+-.4214933*e+1.586924*i,R.At.n3=R.ge.n3}static DI(){let t=Math.atan2(R.ge.n2,R.ge.n1)*180/Math.PI;R.ao.n0=R.ge.n0,R.ao.n1=Math.sqrt(R.ge.n1**2+R.ge.n2**2),R.ao.n2=t>=0?t:t+360,R.ao.n3=R.ge.n3}static vI(){R.ge.n0=R.ao.n0,R.ge.n1=R.ao.n1*Math.cos(R.ao.n2*Math.PI/180),R.ge.n2=R.ao.n1*Math.sin(R.ao.n2*Math.PI/180),R.ge.n3=R.ao.n3}static MI(){R.rD(),R.AI(),R.DI()}static NI(){R.vI(),R.TI(),R.lD()}static Nd(t,e){typeof t=="string"||t instanceof R||m.o("Value for "+e+" must be a color string or a Brush, not "+t)}static Solid=1;static Linear=2;static Radial=3;static Pattern=4;static Lab=1;static HSL=2;static us=null;static k0=!1;static Y=new _e;static ze=new _e;static At=new _e;static lo=new _e;static ge=new _e;static ao=new _e}class Lt{Pt="Base";static fs=new Mt;static An(t,e){e.name=t,Lt.fs.set(t,e)}get name(){return this.Pt}set name(t){this.Pt=t}constructor(){}get classType(){return G}measure(t,e,i,s,n,o,r){}measureElement(t,e,i,s,n){t.ht(e,i,s,n)}arrange(t,e,i){}arrangeElement(t,e,i,s,n,o){t.Ut(e,i,s,n,o)}remeasureObject(t){t.kf()}Ge(t,e,i){}}class In extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=t.jo();for(let l=0;l<a;l++){let u=s[l];if(!u.visible&&u!==h)continue;let c=u.margin,d=c.right+c.left,f=c.top+c.bottom;u.ht(e,i,o,r);let p=u.measuredBounds,g=Math.max(p.width+d,0),y=Math.max(p.height+f,0),b=u.position.x,v=u.position.y;if(isFinite(b)||(b=0),isFinite(v)||(v=0),u instanceof et&&u.isGeometryPositioned){let w=u.strokeWidth/2;b-=w,v-=w}n.re(b,v,g,y)}}arrange(t,e,i){let s=e.length,n=t.padding,o=i.x-n.left,r=i.y-n.top;for(let a=0;a<s;a++){let h=e[a],l=h.measuredBounds,u=h.margin,c=h.position.x,d=h.position.y,f=isNaN(c)?-o:c-o,p=isNaN(d)?-r:d-r;if(h instanceof et&&h.isGeometryPositioned){let g=h.strokeWidth/2;f-=g,p-=g}h.visible&&h.Ut(f+u.left,p+u.top,l.width,l.height)}}}Lt.An("Position",new In);class Bn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=m.st(),l=t.jo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let f=d.Zs(!1);if(f!==0&&f!==5){h.push(d);continue}d.ht(1/0,i,0,r);let p=d.margin,g=d.measuredBounds,y=Math.max(g.width+p.right+p.left,0),b=Math.max(g.height+p.top+p.bottom,0);n.Yn(n.width+y,Math.max(n.height,b))}let u=h.length;t.desiredSize.height?i=Math.min(t.desiredSize.height,t.maxSize.height):n.height!==0&&(i=Math.min(n.height,t.maxSize.height));for(let c=0;c<u;c++){let d=h[c];if(!d.visible&&d!==l)continue;let f=d.margin,p=f.right+f.left,g=f.top+f.bottom;d.ht(1/0,i,0,r);let y=d.measuredBounds,b=Math.max(y.width+p,0),v=Math.max(y.height+g,0);n.width+=b,n.height=Math.max(n.height,v)}m.Z(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.top,r=t.isOpposite,a=r?i.width:n.left;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,f=d.top+d.bottom,p=o+n.bottom,g=c.height,y=u.Zs(!1);(isNaN(u.desiredSize.height)&&y===2||y===4)&&(g=Math.max(i.height-f-p,0));let b=g+f+p,v=u.alignment;v.isDefault()&&(v=t.defaultAlignment),v.isSpot()||(v=T.Center),r&&(a-=c.width+d.left+d.right),u.Ut(a+v.offsetX+d.left,l+v.offsetY+d.top+(i.height*v.y-b*v.y),c.width,g),r||(a+=c.width+d.left+d.right)}}}Lt.An("Horizontal",new Bn);class Vn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=m.st(),l=t.jo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let f=d.Zs(!1);if(f!==0&&f!==4){h.push(d);continue}d.ht(e,1/0,o,0);let p=d.margin,g=d.measuredBounds,y=Math.max(g.width+p.right+p.left,0),b=Math.max(g.height+p.top+p.bottom,0);n.Yn(Math.max(n.width,y),n.height+b)}let u=h.length;t.desiredSize.width?e=Math.min(t.desiredSize.width,t.maxSize.width):n.width!==0&&(e=Math.min(n.width,t.maxSize.width));for(let c=0;c<u;c++){let d=h[c];if(!d.visible&&d!==l)continue;let f=d.margin,p=f.right+f.left,g=f.top+f.bottom;d.ht(e,1/0,o,0);let y=d.measuredBounds,b=Math.max(y.width+p,0),v=Math.max(y.height+g,0);n.width=Math.max(n.width,b),n.height+=v}m.Z(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=t.isOpposite,a=r?i.height:n.top;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,f=d.left+d.right,p=o+n.right,g=c.width,y=u.Zs(!1);(isNaN(u.desiredSize.width)&&y===2||y===5)&&(g=Math.max(i.width-f-p,0));let b=g+f+p,v=u.alignment;v.isDefault()&&(v=t.defaultAlignment),v.isSpot()||(v=T.Center),r&&(a-=c.height+d.bottom+d.top),u.Ut(l+v.offsetX+d.left+(i.width*v.x-b*v.x),a+v.offsetY+d.top,g,c.height),r||(a+=c.height+d.bottom+d.top)}}}Lt.An("Vertical",new Vn);class Mi extends Lt{constructor(){super()}static hD=!1;measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,u=0,c=0,d=l.right+l.left,f=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,g=p.width,y=p.height,b=Math.max(g+d,0),v=Math.max(y+f,0),w=t.isClipping;w&&h.Yp()!==0&&!Mi.hD&&(Mi.hD=!0,m.ne("Main Shape for Spot Panel with isClipping = true must have a zero strokeWidth: "+t.toString()));let k=I.z(-l.left,-l.top,b,v),S=I.z(0,0,g,y);this.zN(h,S,!0),g=S.width,y=S.height;let N=!0,D=t.jo(),L;for(let M=0;M<a;M++){let A=s[M],F=e,O=i;if(A===h||!A.visible&&A!==D)continue;l=A.margin;let E=l.left,B=l.top;switch(u=l.right+l.left,c=l.top+l.bottom,L=A.Zs(!1),L){case 2:F=g,O=y,u=0,c=0,E=0,B=0;break;case 5:F=g,u=0,E=0;break;case 4:O=y,c=0,B=0;break}A.ht(F,O,0,0),p=A.measuredBounds,b=Math.max(p.width+u,0),v=Math.max(p.height+c,0);let X=A.alignment;X.isDefault()&&(X=t.defaultAlignment),X.isSpot()||(X=T.Center);let z=A.alignmentFocus;z.isDefault()&&(z=T.Center);let U=null;A instanceof G&&A.ho!==""&&(U=A.findObject(A.ho),U===A&&(U=null));let tt=S.x-E,nt=S.y-B;if(U!==null){A.Ut(0,0,p.width,p.height);let Z=U.actualBounds,it=P.z(Z.x+(z.x*Z.width-z.offsetX),Z.y+(z.y*Z.height-z.offsetY));for(U=U.panel;U!==null&&U!==A;)U.v.gt(it),U=U.panel;tt+=X.x*g+X.offsetX-it.x,nt+=X.y*y+X.offsetY-it.y,P.i(it)}else tt+=X.x*g+X.offsetX-(z.x*p.width+z.offsetX),nt+=X.y*y+X.offsetY-(z.y*p.height+z.offsetY);N?(N=!1,n.e(tt,nt,b,v)):n.re(tt,nt,b,v)}switch(N?n.h(k):w?n.intersect(S.x,S.y,S.width,S.height):n.re(k.x,k.y,k.width,k.height),I.i(k),I.i(S),L=h.stretch,L===1&&(L=h.Zs(!1)),L){case 0:return;case 2:if(!isFinite(e)&&!isFinite(i))return;break;case 5:if(!isFinite(e))return;break;case 4:if(!isFinite(i))return;break}p=h.measuredBounds,g=p.width,y=p.height,b=Math.max(g+d,0),v=Math.max(y+f,0),l=h.margin,S=I.z(-l.left,-l.top,b,v),this.zN(h,S,!0),g=S.width,y=S.height;for(let M=0;M<a;M++){let A=s[M];if(A===h||!A.visible&&A!==D)continue;l=A.margin,u=l.right+l.left,c=l.top+l.bottom,p=A.measuredBounds,b=Math.max(p.width+u,0),v=Math.max(p.height+c,0);let F=A.alignment;F.isDefault()&&(F=t.defaultAlignment),F.isSpot()||(F=T.Center);let O=A.alignmentFocus;O.isDefault()&&(O=T.Center),N?(N=!1,n.e(F.x*g+F.offsetX-(O.x*p.width+O.offsetX)-l.left,F.y*y+F.offsetY-(O.y*p.height+O.offsetY)-l.top,b,v)):n.re(F.x*g+F.offsetX-(O.x*p.width+O.offsetX)-l.left,F.y*y+F.offsetY-(O.y*p.height+O.offsetY)-l.top,b,v)}N?n.h(k):w?n.intersect(S.x,S.y,S.width,S.height):n.re(k.x,k.y,k.width,k.height),I.i(S)}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=o.width,a=o.height,h=t.padding,l=h.left,u=h.top,c=l-i.x,d=u-i.y;n.Ut(c,d,r,a);let f=I.z(0,0,r,a);this.zN(n,f,!1);for(let p=0;p<s;p++){let g=e[p];if(g===n)continue;let y=g.measuredBounds,b=y.width,v=y.height,w=g.alignment;w.isDefault()&&(w=t.defaultAlignment),w.isSpot()||(w=T.Center);let k=g.alignmentFocus;k.isDefault()&&(k=T.Center);let S=null;if(g instanceof G&&g.ho!==""&&(S=g.findObject(g.ho),S===g&&(S=null)),S!==null){let N=S.actualBounds,D=P.z(N.x+(k.x*N.width-k.offsetX),N.y+(k.y*N.height-k.offsetY));for(S=S.panel;S!==null&&S!==g;)S.v.gt(D),S=S.panel;c=w.x*f.width+w.offsetX-D.x,d=w.y*f.height+w.offsetY-D.y,P.i(D)}else c=w.x*f.width+w.offsetX-(k.x*b+k.offsetX),d=w.y*f.height+w.offsetY-(k.y*v+k.offsetY);c+=f.x-i.x,d+=f.y-i.y,g.visible&&g.Ut(l+c,u+d,b,v)}I.i(f)}zN(t,e,i){let s=null;if(t instanceof G&&t.ho!==""&&(s=t.findObject(t.ho),s===t&&(s=null)),s!==null)for(i&&t.Ut(0,0,e.width,e.height),e.h(s.actualBounds),s=s.panel;s!==null&&s!==t;)s.v.im(e),s=s.panel}}Lt.An("Spot",new Mi);class zn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,u=e,c=i,d=l.right+l.left,f=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,g=0,y=null;h instanceof et&&(y=h,g=y.strokeWidth*y.scale);let b=Math.max(p.width+d,0),v=Math.max(p.height+f,0),w=t.XN(h),k=w.x*b+w.offsetX,S=w.y*v+w.offsetY,N=t.GN(h),D=N.x*b+N.offsetX,L=N.y*v+N.offsetY;isFinite(e)&&(u=Math.max(Math.abs(k-D)-g,0)),isFinite(i)&&(c=Math.max(Math.abs(S-L)-g,0));let M=0,A=0;o>0&&(M=Math.max(Math.abs(w.x*o+w.offsetX-(N.x*o+N.offsetX))-g,0)),r>0&&(A=Math.max(Math.abs(w.y*r+w.offsetY-(N.y*r+N.offsetY))-g,0));let F=st.l();F.e(0,0);let O=t.jo();for(let z=0;z<a;z++){let U=s[z];if(U===h||!U.visible&&U!==O)continue;l=U.margin;let tt=l.right+l.left,nt=l.top+l.bottom;U.ht(u,c,M,A),p=U.measuredBounds,b=Math.max(p.width+tt,0),v=Math.max(p.height+nt,0),F.e(Math.max(b,F.width),Math.max(v,F.height))}if(a===1){p=h.measuredBounds,n.width=b,n.height=v,st.i(F);return}w=t.XN(h),N=t.GN(h);let E=0,B=0;N.x!==w.x&&N.y!==w.y&&(E=F.width/Math.abs(N.x-w.x),B=F.height/Math.abs(N.y-w.y)),st.i(F),g=0,y!==null&&(g=y.strokeWidth*y.scale,y.QS()===6&&(E=B=Math.max(E,B))),E+=Math.abs(w.offsetX)+Math.abs(N.offsetX)+g,B+=Math.abs(w.offsetY)+Math.abs(N.offsetY)+g;let X=h.stretch;switch(X===1&&(X=h.Zs(!1)),X){case 0:o=0,r=0;break;case 2:isFinite(e)&&(E=e),isFinite(i)&&(B=i);break;case 5:isFinite(e)&&(E=e),r=0;break;case 4:o=0,isFinite(i)&&(B=i);break}h.kf(),h.ht(E,B,o,r),n.width=h.measuredBounds.width+d,n.height=h.measuredBounds.height+f}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=I.l();r.e(0,0,1,1);let a=n.margin,h=a.left,l=a.top,u=t.padding,c=u.left,d=u.top,f=h,p=l,g=o.width,y=o.height;n.Ut(c+f,d+p,g,y);let b=t.XN(n),v=t.GN(n),w=0+b.x*o.width+b.offsetX,k=0+b.y*o.height+b.offsetY,S=0+v.x*o.width+v.offsetX,N=0+v.y*o.height+v.offsetY;r.x=w,r.y=k,r.re(S,N,0,0),r.x+=h+c,r.y+=l+d;for(let D=0;D<s;D++){let L=e[D];if(L===n)continue;let M=L.measuredBounds;a=L.margin;let A=Math.max(M.width+a.right+a.left,0),F=Math.max(M.height+a.top+a.bottom,0),O=L.alignment;O.isDefault()&&(O=t.defaultAlignment),O.isSpot()||(O=T.Center),f=r.width*O.x+O.offsetX-A*O.x+a.left+r.x,p=r.height*O.y+O.offsetY-F*O.y+a.top+r.y,g=r.width,y=r.height,L.visible&&(I.contains(r.x,r.y,r.width,r.height,f,p,M.width,M.height)?L.Ut(f,p,M.width,M.height):L.Ut(f,p,M.width,M.height,new I(r.x,r.y,r.width,r.height)))}I.i(r)}}Lt.An("Auto",new zn);class Xn extends Lt{constructor(){super(),this.name="Table"}measure(t,e,i,s,n,o,r){let a=s.length,h=m.st(),l=m.st();for(let ot=0;ot<a;ot++){let W=s[ot],ft=W instanceof G?W:null;if(ft!==null&&ft.il()&&W.visible){l.push(ft);let At=ft.D.r,Ht=At.length;for(let Ut=0;Ut<Ht;Ut++){let Gt=At[Ut];ft.type===G.TableRow?Gt.row=W.row:ft.type===G.TableColumn&&(Gt.column=W.column),h.push(Gt)}}else h.push(W)}a=h.length,a===0&&(t.getRowDefinition(0),t.getColumnDefinition(0));let u=[];for(let ot=0;ot<a;ot++){let W=h[ot];W.visible&&(W.xi(!0),W.oo(!0),u[W.row]||(u[W.row]=[]),u[W.row][W.column]||(u[W.row][W.column]=[]),u[W.row][W.column].push(W))}m.Z(h);let c=m.st(),d=m.st(),f=m.st(),p={count:0},g={count:0},y=e,b=i,v=t.Zi,w=t.Qi,k;a=v.length;for(let ot=0;ot<a;ot++)k=v[ot],k!==void 0&&(k.actual=0,k.Re=0);a=w.length;for(let ot=0;ot<a;ot++)k=w[ot],k!==void 0&&(k.actual=0,k.Re=0);let S=u.length,N=0;for(let ot=0;ot<S;ot++)u[ot]&&(N=Math.max(N,u[ot].length));let D=Math.min(t.topIndex,S-1),L=Math.min(t.leftIndex,N-1),M=0,A;S=u.length;let F=t.jo();for(let ot=0;ot<S;ot++){if(!u[ot])continue;N=u[ot].length;let W=t.getRowDefinition(ot);W.actual=0,W.Re=0;for(let ft=0;ft<N;ft++){if(!u[ot][ft])continue;let At=t.getColumnDefinition(ft);c[ft]===void 0&&(At.actual=0,At.Re=0,c[ft]=!0);let Ht=u[ot][ft],Ut=Ht.length;for(let Gt=0;Gt<Ut;Gt++){let qt=Ht[Gt];if(!qt.visible&&qt!==F)continue;let we=qt.rowSpan>1,ue=qt.columnSpan>1;(we||ue)&&!(ot<D)&&!(ft<L)&&d.push(qt);let de=qt.margin,Wt=de.right+de.left,Jt=de.top+de.bottom;A=qt.Jp(W,At,!1);let me=qt.desiredSize,Ft=!isNaN(me.width),Me=!isNaN(me.height);if(A!==0&&!(Ft&&Me)&&!(ot<D)&&!(ft<L)&&(!ue&&p[ft]===void 0&&(A===2||A===5)&&(p[ft]=-1,p.count++),!we&&g[ot]===void 0&&(A===2||A===4)&&(g[ot]=-1,g.count++),!we&&!ue&&f.push(qt)),qt.ht(1/0,1/0,0,0),ot<D||ft<L)continue;let se=qt.measuredBounds,ve=Math.max(se.width+Wt,0),Te=Math.max(se.height+Jt,0);if(qt.rowSpan===1&&(A===0||A===5)){k=t.getRowDefinition(ot);let ke=k.computeEffectiveSpacing(),mi=k.q===0;M=Math.max(Te-k.actual,0),M+(mi?ke:0)>b&&(M=Math.max(b-ke,0)),k.Re=k.Re+M,k.actual=k.q+M,b=Math.max(b-(M+(mi?ke:0)),0)}if(qt.columnSpan===1&&(A===0||A===4)){k=t.getColumnDefinition(ft);let ke=k.computeEffectiveSpacing(),mi=k.q===0;M=Math.max(ve-k.actual,0),M+(mi?ke:0)>y&&(M=Math.max(y-ke,0)),k.Re=k.Re+M,k.actual=k.q+M,y=Math.max(y-(M+(mi?ke:0)),0)}(we||ue)&&qt.kf()}}}m.Z(c);let O=0,E=0;a=t.columnCount;for(let ot=0;ot<a;ot++){let W=w[ot];W!==void 0&&(O+=isNaN(W.ki)?W.Re:W.ki,W.Re!==0&&(O+=W.computeEffectiveSpacing()))}a=t.rowCount;for(let ot=0;ot<a;ot++){let W=v[ot];W!==void 0&&(E+=isNaN(W.ki)?W.Re:W.ki,W.Re!==0&&(E+=W.computeEffectiveSpacing()))}y=Math.max(e-O,0),b=Math.max(i-E,0);let B=b,X=y;a=f.length;for(let ot=0;ot<a;ot++){let W=f[ot],ft=t.getRowDefinition(W.row),At=t.getColumnDefinition(W.column),Ht=W.measuredBounds,Ut=W.margin,Gt=Ut.right+Ut.left,qt=Ut.top+Ut.bottom;At.Re===0&&p[W.column]!==void 0?p[W.column]=Math.max(Ht.width+Gt,p[W.column]):p[W.column]=null,ft.Re===0&&g[W.row]!==void 0?g[W.row]=Math.max(Ht.height+qt,g[W.row]):g[W.row]=null}let z=0,U=0,tt;for(tt in g)tt!=="count"&&(z+=g[tt]);for(tt in p)tt!=="count"&&(U+=p[tt]);let nt=st.l();for(let ot=0;ot<a;ot++){let W=f[ot];if(!W.visible&&W!==F)continue;let ft=t.getRowDefinition(W.row),At=t.getColumnDefinition(W.column),Ht=0;isFinite(At.width)?Ht=At.width:(isFinite(y)&&p[W.column]!==null?U===0?Ht=At.actual+y:Ht=p[W.column]/U*X:p[W.column]!==null?Ht=y:Ht=At.actual||y,Ht=Math.max(0,Ht-At.computeEffectiveSpacing()));let Ut=0;switch(isFinite(ft.height)?Ut=ft.height:(isFinite(b)&&g[W.row]!==null?z===0?Ut=ft.actual+b:Ut=g[W.row]/z*B:g[W.row]!==null?Ut=b:Ut=ft.actual||b,Ut=Math.max(0,Ut-ft.computeEffectiveSpacing())),nt.e(Math.max(At.minimum,Math.min(Ht,At.maximum)),Math.max(ft.minimum,Math.min(Ut,ft.maximum))),A=W.Jp(ft,At,!1),A){case 5:nt.height=Math.max(nt.height,ft.actual+b);break;case 4:nt.width=Math.max(nt.width,At.actual+y);break}let Gt=W.margin,qt=Gt.right+Gt.left,we=Gt.top+Gt.bottom;W.kf();let ue=At.minimum,de=ft.minimum,Wt=W.measuredBounds;Wt.width===0&&p[W.column]!==null&&(ue=Math.max(ue,p[W.column])),Wt.height===0&&g[W.row]!==null&&(de=Math.max(ue,g[W.row])),W.ht(nt.width,nt.height,ue,de);let Jt=W.measuredBounds,me=Math.max(Jt.width+qt,0),Ft=Math.max(Jt.height+we,0);isFinite(y)&&(me=Math.min(me,nt.width)),isFinite(b)&&(Ft=Math.min(Ft,nt.height));let Me=0;Me=ft.actual,ft.actual=Math.max(ft.actual,Ft),ft.Re=Math.max(ft.Re,Ft),M=ft.actual-Me,b=Math.max(b-M,0),g[W.row]===null&&(B=Math.max(B-M,0)),Me=At.actual,At.actual=Math.max(At.actual,me),At.Re=Math.max(At.Re,me),M=At.actual-Me,y=Math.max(y-M,0),p[W.column]===null&&(X=Math.max(X-M,0))}m.Z(f);let Z=st.l(),it=m.st(),_=m.st();if(a=d.length,a!==0)for(let ot=0;ot<S;ot++){if(!u[ot])continue;N=u[ot].length;let W=t.getRowDefinition(ot);it[ot]=W.actual;for(let ft=0;ft<N;ft++){if(!u[ot][ft])continue;let At=t.getColumnDefinition(ft);_[ft]=At.actual}}for(let ot=0;ot<a;ot++){let W=d[ot];if(!W.visible&&W!==F)continue;let ft=t.getRowDefinition(W.row),At=t.getColumnDefinition(W.column);switch(nt.e(Math.max(At.minimum,Math.min(e,At.maximum)),Math.max(ft.minimum,Math.min(i,ft.maximum))),A=W.Jp(ft,At,!1),A){case 2:_[At.index]!==0&&(nt.width=Math.min(nt.width,_[At.index])),it[ft.index]!==0&&(nt.height=Math.min(nt.height,it[ft.index]));break;case 5:_[At.index]!==0&&(nt.width=Math.min(nt.width,_[At.index]));break;case 4:it[ft.index]!==0&&(nt.height=Math.min(nt.height,it[ft.index]));break}isFinite(At.width)&&(nt.width=At.width),isFinite(ft.height)&&(nt.height=ft.height),Z.e(0,0);let Ht=At.minimum,Ut=ft.minimum;for(let Ft=1;Ft<W.rowSpan&&!(W.row+Ft>=t.rowCount);Ft++){if(k=t.getRowDefinition(W.row+Ft),M=0,A===2||A===4){if(k.q===0)continue;M=Math.max(k.minimum,k.q===0?k.maximum:Math.min(k.q,k.maximum))}else M=Math.max(k.minimum,isNaN(k.ki)?k.maximum:Math.min(k.ki,k.maximum));Z.height+=M,Ut+=k.minimum}for(let Ft=1;Ft<W.columnSpan&&!(W.column+Ft>=t.columnCount);Ft++){if(k=t.getColumnDefinition(W.column+Ft),M=0,A===2||A===5){if(k.q===0)continue;M=Math.max(k.minimum,k.q===0?k.maximum:Math.min(k.q,k.maximum))}else M=Math.max(k.minimum,isNaN(k.ki)?k.maximum:Math.min(k.ki,k.maximum));Z.width+=M,Ht+=k.minimum}nt.width+=Z.width,nt.height+=Z.height;let Gt=W.margin,qt=Gt.right+Gt.left,we=Gt.top+Gt.bottom;W.ht(nt.width,nt.height,Ht,Ut);let ue=W.measuredBounds,de=Math.max(ue.width+qt,0),Wt=Math.max(ue.height+we,0),Jt=0;for(let Ft=0;Ft<W.rowSpan&&!(W.row+Ft>=t.rowCount);Ft++)k=t.getRowDefinition(W.row+Ft),Jt+=k.total||0;if(Jt<Wt){let Ft=Wt-Jt,Me=Wt-Jt;if(W.spanAllocation!==null){let se=W.spanAllocation;for(let ve=0;ve<W.rowSpan&&!(Ft<=0||W.row+ve>=t.rowCount);ve++){k=t.getRowDefinition(W.row+ve);let Te=k.q||0,ke=se(W,k,Me);k.actual=Math.min(k.maximum,Te+ke),k.q!==Te&&(Ft-=k.q-Te)}}for(;Ft>0&&k!==void 0;){let se=k.q||0;if(isNaN(k.height)&&k.maximum>se&&(k.actual=Math.min(k.maximum,se+Ft),k.q!==se&&(Ft-=k.q-se)),k.index===0)break;k=t.getRowDefinition(k.index-1)}}let me=0;for(let Ft=0;Ft<W.columnSpan&&!(W.column+Ft>=t.columnCount);Ft++)k=t.getColumnDefinition(W.column+Ft),me+=k.total||0;if(me<de){let Ft=de-me,Me=de-me;if(W.spanAllocation!==null){let se=W.spanAllocation;for(let ve=0;ve<W.columnSpan&&!(Ft<=0||W.column+ve>=t.columnCount);ve++){k=t.getColumnDefinition(W.column+ve);let Te=k.q||0,ke=se(W,k,Me);k.actual=Math.min(k.maximum,Te+ke),k.q!==Te&&(Ft-=k.q-Te)}}for(;Ft>0&&k!==void 0;){let se=k.q||0;if(isNaN(k.width)&&k.maximum>se&&(k.actual=Math.min(k.maximum,se+Ft),k.q!==se&&(Ft-=k.q-se)),k.index===0)break;k=t.getColumnDefinition(k.index-1)}}}m.Z(d),st.i(Z),st.i(nt),it!==void 0&&m.Z(it),_!==void 0&&m.Z(_);let at=0,ct=0,yt=t.desiredSize,Ct=t.maxSize;A=t.Zs(!0),O=0,E=0;let Q=0,St=0;a=t.columnCount;for(let ot=0;ot<a;ot++)if(w[ot]!==void 0){if(k=t.getColumnDefinition(ot),isFinite(k.width)){Q+=k.width,Q+=k.computeEffectiveSpacing();continue}else if(k.K1()===2){Q+=k.q,Q+=k.computeEffectiveSpacing();continue}k.q!==0&&(O+=k.q,O+=k.computeEffectiveSpacing())}isFinite(yt.width)?at=Math.min(yt.width,Ct.width):A!==0&&isFinite(e)?at=e:at=O,at=Math.max(at,isFinite(e)?Math.min(o,e):o),at=Math.max(at-Q,0);let xt=O===0?1:Math.max(at/O,1);for(let ot=0;ot<a;ot++)w[ot]!==void 0&&(k=t.getColumnDefinition(ot),!isFinite(k.width)&&k.K1()!==2&&(k.actual=k.q*xt),k.position=n.width,k.q!==0&&(n.width+=k.q,n.width+=k.computeEffectiveSpacing()));a=t.rowCount;for(let ot=0;ot<a;ot++)if(v[ot]!==void 0){if(k=t.getRowDefinition(ot),isFinite(k.height)){St+=k.height,St+=k.computeEffectiveSpacing();continue}else if(k.K1()===2){St+=k.q,St+=k.computeEffectiveSpacing();continue}k.q!==0&&(E+=k.q,E+=k.computeEffectiveSpacing())}isFinite(yt.height)?ct=Math.min(yt.height,Ct.height):A!==0&&isFinite(i)?ct=i:ct=E,ct=Math.max(ct,isFinite(i)?Math.min(r,i):r),ct=Math.max(ct-St,0);let Yt=E===0?1:Math.max(ct/E,1);for(let ot=0;ot<a;ot++)v[ot]!==void 0&&(k=t.getRowDefinition(ot),!isFinite(k.height)&&k.K1()!==2&&(k.actual=k.q*Yt),k.position=n.height,k.q!==0&&(n.height+=k.q,n.height+=k.computeEffectiveSpacing()));a=l.length;for(let ot=0;ot<a;ot++){let W=l[ot],ft=0,At=0;W.type===G.TableRow?(ft=n.width,k=t.getRowDefinition(W.row),At=k.actual):(k=t.getColumnDefinition(W.column),ft=k.actual,At=n.height),W.measuredBounds.e(0,0,ft,At),W.xi(!1)}m.Z(l),t.Aa=u}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=n.top,a=t.Aa;if(a===null)return;let h=0,l=0,u=a.length,c=0;for(let L=0;L<u;L++)a[L]&&(c=Math.max(c,a[L].length));let d=t.Zi,f=t.Qi,p=0,g=0,y=Math.min(t.topIndex,u-1);if(d.length>0){for(;y!==u&&(d[y]===void 0||d[y].q===0);)y++;y=Math.max(Math.min(y,u-1),0),p=-d[y].position}let b=Math.min(t.leftIndex,c-1);if(f.length>0){for(;b!==c&&(f[b]===void 0||f[b].q===0);)b++;b=Math.max(Math.min(b,c-1),0),g=-f[b].position}let v=0,w=0;for(;v!==u&&d[v]===void 0;)v++;for(;w!==u&&f[w]===void 0;)w++;let k=t.part,S=t.getRowDefinition(v),N=t.getColumnDefinition(w);for(let L=0;L<e.length;L++){let M=e[L];if(!(M instanceof G&&M.visible&&M.il()))continue;M.type===G.TableRow?(S=t.getRowDefinition(M.row),N=t.getColumnDefinition(w)):(S=t.getRowDefinition(v),N=t.getColumnDefinition(M.column)),l=S.position+p+r,S.q!==0&&(l+=S.computeEffectiveSpacingTop(Math.max(v,y))),h=N.position+g+o,N.q!==0&&(h+=N.computeEffectiveSpacingTop(Math.max(w,b)));let A=M.measuredBounds;M.yf(),M.actualBounds.ce();let F=M.actualBounds,O=I.z(F.x,F.y,F.width,F.height);if(F.x=M.type===G.TableRow?o:h,F.y=M.type===G.TableColumn?r:l,F.width=A.width,F.height=A.height,M.actualBounds.k(),M.oo(!1),O.equalsApproxClose(F)){I.i(O);continue}k!==null&&(k.Sa(),M.Hp(k)),I.i(O)}let D=st.l();for(let L=0;L<u;L++){if(!a[L])continue;c=a[L].length;let M=t.getRowDefinition(L);l=M.position+p+r,M.q!==0&&(l+=M.computeEffectiveSpacingTop(Math.max(v,y)));for(let A=0;A<c;A++){if(!a[L][A])continue;let F=t.getColumnDefinition(A);h=F.position+g+o,F.q!==0&&(h+=F.computeEffectiveSpacingTop(Math.max(w,b)));let O=a[L][A],E=O.length;for(let B=0;B<E;B++){let X=O[B],z=X.measuredBounds;D.e(0,0);for(let Wt=1;Wt<X.rowSpan&&!(L+Wt>=t.rowCount);Wt++){let Jt=t.getRowDefinition(L+Wt);Jt.q!==0&&(D.height+=Jt.total)}for(let Wt=1;Wt<X.columnSpan&&!(A+Wt>=t.columnCount);Wt++){let Jt=t.getColumnDefinition(A+Wt);Jt.q!==0&&(D.width+=Jt.total)}let U=F.q+D.width,tt=M.q+D.height,nt=h,Z=l,it=U,_=tt,at=h,ct=l,yt=U,Ct=tt;h+U>i.width&&(yt=Math.max(i.width-h,0)),l+tt>i.height&&(Ct=Math.max(i.height-l,0));let Q=X.alignment,St=0,xt=0,Yt=0,ot=0;if(Q.isDefault()){Q=t.defaultAlignment,Q.isSpot()||(Q=T.Center),St=Q.x,xt=Q.y,Yt=Q.offsetX,ot=Q.offsetY;let Wt=F.alignment,Jt=M.alignment;Wt.isSpot()&&(St=Wt.x,Yt=Wt.offsetX),Jt.isSpot()&&(xt=Jt.y,ot=Jt.offsetY)}else St=Q.x,xt=Q.y,Yt=Q.offsetX,ot=Q.offsetY;(isNaN(St)||isNaN(xt))&&(St=.5,xt=.5,Yt=0,ot=0);let W=z.width,ft=z.height,At=X.margin,Ht=At.left+At.right,Ut=At.top+At.bottom,Gt=X.Jp(M,F,!1);isNaN(X.desiredSize.width)&&(Gt===2||Gt===5)&&(W=Math.max(U-Ht,0)),isNaN(X.desiredSize.height)&&(Gt===2||Gt===4)&&(ft=Math.max(tt-Ut,0));let qt=X.maxSize,we=X.minSize;W=Math.min(qt.width,W),ft=Math.min(qt.height,ft),W=Math.max(we.width,W),ft=Math.max(we.height,ft);let ue=W+Ht,de=ft+Ut;nt+=it*St-ue*St+Yt+At.left,Z+=_*xt-de*xt+ot+At.top,X.visible&&(I.contains(at,ct,yt,Ct,nt,Z,z.width,z.height)?X.Ut(nt,Z,W,ft):X.Ut(nt,Z,W,ft,new I(at,ct,yt,Ct)))}}}st.i(D);for(let L=0;L<s;L++){let M=e[L],A=M instanceof G?M:null;if(A!==null&&A.il()){let F=M.actualBounds;M.naturalBounds.ce(),M.naturalBounds.e(0,0,F.width,F.height),M.naturalBounds.k()}}}}Lt.An("Table",new Xn);class Kn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Lt.An("TableRow",new Kn);class Yn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Lt.An("TableColumn",new Yn);class Un extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){s.length!==1&&m.o("Viewbox Panel must contain exactly one GraphObject.");let a=s[0];a.et=1,a.kf(),a.ht(1/0,1/0,o,r);let h=a.measuredBounds,l=a.margin,u=l.right+l.left,c=l.top+l.bottom;if(isFinite(e)||isFinite(i)){let d=a.scale,f=h.width,p=h.height,g=Math.max(e-u,0),y=Math.max(i-c,0),b=1;t.viewboxStretch===6?(f!==0&&p!==0&&(b=Math.min(g/f,y/p)),b===0&&(b=1e-4),a.et*=b):(f!==0&&p!==0&&(b=Math.max(g/f,y/p)),b===0&&(b=1e-4),a.et*=b),d!==a.scale&&(a.xi(!0),a.ht(1/0,1/0,o,r))}h=a.measuredBounds,n.width=isFinite(e)?e:Math.max(h.width+u,0),n.height=isFinite(i)?i:Math.max(h.height+c,0)}arrange(t,e,i){let s=e[0],n=s.measuredBounds,o=s.margin,r=o.right+o.left,a=o.top+o.bottom,h=Math.max(n.width+r,0),l=Math.max(n.height+a,0),u=s.alignment;u.isDefault()&&(u=t.defaultAlignment),u.isSpot()||(u=T.Center),s.Ut(i.width*u.x-h*u.x+u.offsetX,i.height*u.y-l*u.y+u.offsetY,n.width,n.height)}}Lt.An("Viewbox",new Un);class jn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){t.Pe===null&&(t.Pe=new ti),this.FI(t),this.RI(t)}arrange(t,e,i){}Ge(t,e,i){let s=t.naturalBounds;e.save(),e.beginPath(),e.rect(0,0,s.width,s.height),e.clip(),e.endPath(),this.OI(t,e,i),e.restore(),e.clearContextCache(!1)}OI(t,e,i){let s=t.getDocumentScale()*i.scale;s<=0&&(s=1);let n=t.gridCellSize,o=n.width,r=n.height,a=t.naturalBounds,h=t.actualBounds,l=a.width,u=a.height,c=Math.ceil(l/o),d=Math.ceil(u/r),f=t.gridOrigin,p=f.x,g=f.y,y=t.Pe.P0,b=t.D.r,v=b.length;for(let w=0;w<v;w++){let k=b[w];if(!k.visible)continue;let S=k.interval||1,N=Math.abs(S);if(o*N*s<2)continue;let D=k.segmentIndex;(!isFinite(D)||isNaN(D))&&(D=0),D<0&&(D=N-Math.min(-D,N)),D=Math.round(D%N);let L=k.opacity,M=1;if(L!==1){if(L===0)continue;M=e.globalAlpha,e.globalAlpha=M*L}let A=y[w],F=!1,O=k.strokeDashArray;if(O!==null&&(F=!0,e.enableDash(O,k.strokeDashOffset)),k.stroke!==null&&k.strokeWidth>0&&(k.figure==="LineV"||k.figure==="LineH")){if(e.lineWidth=k.strokeWidth,t.bn(e,k.stroke,!1,!1,a,h),e.beginPath(),k.figure==="LineV"){let E=Math.floor((p-o)/o);for(let B=E;B<=E+c;B++){let X=B*o+p;0<=X&&X<=l&&this.H1(B,S,D,A)&&(e.moveTo(X,0),e.lineTo(X,u))}}else if(k.figure==="LineH"){let E=Math.floor((g-r)/r);for(let B=E;B<=E+d;B++){let X=B*r+g;0<=X&&X<=u&&this.H1(B,S,D,A)&&(e.moveTo(0,X),e.lineTo(l,X))}}e.stroke(),e.endPath()}else if(k.fill!==null){if(t.bn(e,k.fill,!0,!1,a,h),k.figure==="BarV"){let E=k.width;isNaN(E)&&(E=o);let B=Math.floor((p-o)/o);for(let X=B;X<=B+c;X++){let z=X*o+p;0<=z+E&&z<=l&&this.H1(X,S,D,A)&&e.fillRect(z,0,E,u)}}else if(k.figure==="BarH"){let E=k.height;isNaN(E)&&(E=r);let B=Math.floor((g-r)/r);for(let X=B;X<=B+d;X++){let z=X*r+g;0<=z+E&&z<=u&&this.H1(X,S,D,A)&&e.fillRect(0,z,l,E)}}}F&&e.disableDash(),L!==1&&(e.globalAlpha=M)}}H1(t,e,i,s){if(e<0)return t%e===i;if(t%e!==i)return!1;let n=s.length;for(let o=0;o<n;o++){let r=s[o];if(t%r===i)return!1}return!0}RI(t){let e=[],i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(a<0)continue;let h=o.figure,l=this.YN(h);for(let u=0;u<s;u++){if(u===n)continue;let c=i[u];if(!c.visible)continue;let d=c.figure;if(this.YN(d)!==l)continue;let f=c.interval;f>a&&r.push(f)}}t.Pe.P0=e}YN(t){return t==="LineV"||t==="BarV"}FI(t){let e=1,i=1,s=t.D.r,n=s.length;for(let a=0;a<n;a++){let h=s[a],l=Math.abs(h.interval);l<2||(this.YN(h.figure)?i=i*l/C.HL(i,l):e=e*l/C.HL(e,l))}let o=t.gridCellSize,r=t.Pe;r.hf.isReal()?r.hf.e(i*o.width,e*o.height):r.hf=new st(i*o.width,e*o.height)}}Lt.An("Grid",new jn);class Gn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(!(t instanceof vt||t instanceof j))return;let h=null,l=null;if(t instanceof j&&(h=t),t instanceof vt&&(l=t,h=l.adornedPart,t.Af===null&&(t.Af=[])),!(h instanceof j))return;let u=h;if(a===0){t.naturalBounds.Yn(0,0),t.measuredBounds.e(0,0,0,0);return}let c=t instanceof vt?null:h.path,d=h.routeBounds,f=t.Wo;f.e(0,0,d.width,d.height);let p=u.points,g=h.pointsCount;l!==null?l.Dd(!1):h!==null&&h.Dd(!1);let y=d.width,b=d.height,v=t.Af;if(v.length=0,c!==null){this.measureLinkPath(t,y,b,c);let N=c.measuredBounds;f.unionRect(N),v.push(N)}let w=Nt.l(),k=P.l(),S=P.l();for(let N=0;N<a;N++){let D=s[N];if(D===c)continue;let L=D.measuredBounds;if(D.isPanelMain&&D instanceof et){this.measureLinkPath(t,y,b,D),L=D.measuredBounds,f.unionRect(L),v.push(L);continue}if(g<2){D.ht(1/0,1/0,0,0),L=D.measuredBounds,f.unionRect(L),v.push(L);continue}let M=D.segmentIndex,A=D.segmentFraction,F=D.alignmentFocus;F.isNoSpot()&&(F=T.Center);let O=D.segmentOrientation,E=D.segmentOffset,B=0,X=0,z=0,U=0;if(isNaN(M)){let Q=u.ut,St=m.st();Q.getPointAndAngleAlongPath(A,St);let xt=P.z(St[0],St[1]);U=St[2],O!==0&&(z=u.computeAngle(D,O,U),D.Xt=z,D.xi(!0),D.oo(!0)),B=xt.x,X=xt.y,P.i(xt),m.Z(St)}else if(M<-g||M>=g){let Q=P.l();u.KN(Q),U=u.midAngle,O!==0&&(z=u.computeAngle(D,O,U),D.Xt=z,D.xi(!0),D.oo(!0)),B=Q.x-d.x,X=Q.y-d.y,P.i(Q)}else{let Q,St,xt=0;if(M>=0?(Q=p.elt(M),St=M<g-1?p.elt(M+1):Q):(xt=g+M,Q=p.elt(xt),St=xt>0?p.elt(xt-1):Q),Q.equalsApprox(St)){let Yt,ot;M>=0?(Yt=M>0?p.elt(M-1):Q,ot=M<g-2?p.elt(M+2):St):(Yt=xt<g-1?p.elt(xt+1):Q,ot=xt>1?p.elt(xt-2):St);let W=Yt.distanceSquaredPoint(Q),ft=St.distanceSquaredPoint(ot);W>ft+10?U=M>=0?Yt.directionPoint(Q):Q.directionPoint(Yt):ft>W+10?U=M>=0?St.directionPoint(ot):ot.directionPoint(St):U=M>=0?Yt.directionPoint(ot):ot.directionPoint(Yt)}else U=M>=0?Q.directionPoint(St):St.directionPoint(Q);O!==0&&(z=u.computeAngle(D,O,U),D.Xt=z,D.xi(!0),D.oo(!0)),B=Q.x+(St.x-Q.x)*A-d.x,X=Q.y+(St.y-Q.y)*A-d.y}D.ht(1/0,1/0,0,0),L=D.measuredBounds;let tt=D.naturalBounds,nt=0;D instanceof et&&(nt=D.strokeWidth);let Z=tt.width+nt,it=tt.height+nt;w.Ue(),w.Xs(-L.x,-L.y),w.et(D.scale,D.scale),w.ks(O===0?D.angle:U,Z/2,it/2),(O===22||O===26)&&w.ks(90,Z/2,it/2),(O===23||O===27)&&w.ks(-90,Z/2,it/2),O===28&&(U>45&&U<135||U>225&&U<315)&&w.ks(-U,Z/2,it/2);let _=new I(0,0,Z,it);k.setRectSpot(_,F),w.gt(k);let at=-k.x+nt/2*D.scale,ct=-k.y+nt/2*D.scale;S.h(E);let yt=isNaN(E.x),Ct=isNaN(E.y);if(yt||Ct){let Q=Z/2+j.q1,St=it/2+j.q1,xt=U>=45&&U<=135,Yt=U>=225&&U<=315;O===0&&(xt||Yt)?(S.x=Ct?Q:E.y,S.y=yt?St:E.x,xt?M>=0||isNaN(M)&&A<.5||yt&&(S.y=-St):Yt&&((M>=0||isNaN(M)&&A<.5)&&yt&&(S.y=-St),Ct&&(S.x=-Q))):(yt&&(M>=0||isNaN(M)&&A<.5?S.x=Q:S.x=-Q),Ct&&(S.y=-St),S.rotate(U))}else S.rotate(U);B+=S.x,X+=S.y,_.e(B+at,X+ct,L.width,L.height),v.push(_),f.unionRect(_)}if(h!==null){let N=h.labelNodes;for(;N.next();)N.value.ht(1/0,1/0)}t.Wo=f,t.position.e(d.x+f.x,d.y+f.y),n.Yn(f.width||0,f.height||0),Nt.i(w),P.i(k),P.i(S)}arrange(t,e,i){let s=e.length;if(!(t instanceof vt||t instanceof j))return;let n=t,o=null;t instanceof vt&&(o=t,n=o.adornedPart);let r=t,a=t instanceof vt?null:n.path,h=t.Af;if(h.length!==0){let d=0;if(a!==null&&d<h.length){let f=h[d];d++,a.Ut(f.x-r.Wo.x,f.y-r.Wo.y,f.width,f.height)}for(let f=0;f<s;f++){let p=e[f];if(p!==a&&d<h.length){let g=h[d];d++,p.Ut(g.x-r.Wo.x,g.y-r.Wo.y,g.width,g.height)}}}let l=n.points,u=l.count;if(u>=2&&r instanceof j){let d=r.labelNodes;for(;d.next();){let f=d.value;r.II(f,u,l)}}o!==null?o.Dd(!1):n.Dd(!1);let c=t.cD(P.l());t.location.e(t.position.x+c.x,t.position.y+c.y),P.i(c)}measureLinkPath(t,e,i,s){if(s.Bo()===!1)return;let n=s.strokeWidth;if(n===0&&t instanceof vt&&t.type===G.Link&&t.adornedObject instanceof et&&(n=t.adornedObject.strokeWidth),n=n*s.et,t instanceof j&&t.ut!==null){let o=t.geometry.bounds;s.no(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else if(t instanceof vt&&t.adornedPart.ut!==null){let o=t.adornedPart.ut.bounds;s.no(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else s.no(-(n/2),-(n/2),e+n,i+n);s.EI(),s.xi(!1)}}Lt.An("Link",new Gn);class qn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=t.findMainElement();if(!(a instanceof et))return;t._i=[];let h=a.margin,l=h.right+h.left,u=h.top+h.bottom;a.ht(e,i,o,r);let c=a.measuredBounds,d=c.width,f=c.height,p=Math.max(d+l,0),g=Math.max(f+u,0),y=new I(-h.left,-h.top,p,g);t._i.push(y),n.h(y),this.determineGraduatedMarks(t,a);let b=t.vs;if(b===null)return;let v=s.length;for(let w=0;w<v;w++){let k=s[w],S=b[w];!k.visible||k===a||S.length===0||(k instanceof et?this.measureGraduatedTicks(t,k,S,n):k instanceof lt&&this.measureGraduatedLabels(t,k,S,n),k.xi(!1))}}arrange(t,e,i){if(t._i===null)return;let s=t.findMainElement(),n=t.vs;if(n===null)return;let o=t._i,r=0,a=o[r];r++,s!==null&&s.Ut(a.x-i.x,a.y-i.y,a.width,a.height);let h=e.length;for(let l=0;l<h;l++){let u=e[l],c=n[l];!u.visible||u===s||c.length===0||(a=o[r],r++,u.Ut(a.x-i.x,a.y-i.y,a.width,a.height))}t._i=null}measureGraduatedTicks(t,e,i,s){let n=e.alignmentFocus;n.isNoSpot()&&(n=T.TopCenter);let o=e.angle;e.Xt=0,e.ht(1/0,1/0,0,0),e.Xt=o;let r=e.measuredBounds,a=r.width,h=r.height,l=I.z(0,0,a,h),u=P.l();u.setRectSpot(l,n),I.i(l);let c=-u.x,d=-u.y,f=new I,p=i.length;for(let g=0;g<p;g++){let y=i[g],b=y.pt.x,v=y.pt.y,w=y.angle;for(let k=0;k<4;k++){switch(k){case 0:u.e(c,d);break;case 1:u.e(c+a,d);break;case 2:u.e(c,d+h);break;case 3:u.e(c+a,d+h);break}u.rotate(w+e.angle),u.offset(b,v),g===0&&k===0?f.e(u.x,u.y,0,0):f.unionPoint(u),u.offset(-b,-v),u.rotate(-w-e.angle)}}P.i(u),t._i!==null&&t._i.push(f),s.re(f.x,f.y,f.width,f.height)}measureGraduatedLabels(t,e,i,s){t.vi===null&&(t.vi=new lt);let n=t.vi;this.fD(e,n);let o=e.alignmentFocus;o.isNoSpot()&&(o=T.TopCenter);let r=e.segmentOrientation,a=e.segmentOffset,h=new I,l=0,u=0,c=0,d=0,f=0,p=i.length;for(let g=0;g<p;g++){let y=i[g];l=y.pt.x,u=y.pt.y,c=y.angle,d=e.angle,f=e.angle,r!==0&&(r===21||r===25?f=c+e.angle:f=c,d=j.computeAngle(r,f)),n.Xt=d,n.text=y.text||"",n.ht(1/0,1/0,0,0);let b=n.measuredBounds,v=n.naturalBounds,w=v.width,k=v.height,S=Nt.l();S.Ue(),S.Xs(-b.x,-b.y),S.et(n.scale,n.scale),S.ks(f,w/2,k/2),(r===22||r===26)&&S.ks(90,w/2,k/2),(r===23||r===27)&&S.ks(-90,w/2,k/2),r===28&&(c>45&&c<135||c>225&&c<315)&&S.ks(-c,w/2,k/2);let N=I.z(0,0,w,k),D=P.l();D.setRectSpot(N,o),S.gt(D);let L=-D.x,M=-D.y,A=P.l();A.h(a),isNaN(A.x)&&(A.x=w/2+3),isNaN(A.y)&&(A.y=-(k/2+3)),A.rotate(c),l+=A.x+L,u+=A.y+M;let F=new I(l,u,b.width,b.height),O=new I(b.x,b.y,b.width,b.height),E=new I(v.x,v.y,v.width,v.height);y.labelAngle=d,y.lineCount=n.lineCount,y.lines=n.getMetrics(),y.actualBounds=F,y.measuredBounds=O,y.naturalBounds=E,g===0?h.h(F):h.unionRect(F),P.i(A),P.i(D),I.i(N),Nt.i(S)}t._i!==null&&t._i.push(h),s.re(h.x,h.y,h.width,h.height)}determineGraduatedMarks(t,e){let i=e.geometry,s=e.strokeWidth,n=i.flattenedSegments,o=i.flattenedLengths,r=i.flattenedTotalLength,a=n.length,h=0,l=0,u=m.st();for(let v=0;v<a;v++){let w=n[v],k=[];h=0,l=0;let S=w.length;for(let N=0;N<S;N+=2){let D=w[N],L=w[N+1];if(N===0){h=D,l=L;continue}let M=Math.atan2(L-l,D-h)*180/Math.PI;M<0&&(M+=360),k.push(M),h=D,l=L}u.push(k)}let c=this.UI(t),d=t.D.r,f=d.length,p=0,g=0,y=r;t.vs=[];let b;for(let v=0;v<f;v++){let w=d[v];if(b=[],!w.visible||w===e){t.vs.push(b);continue}let k=Math.abs(w.interval),S=t.graduatedTickUnit;if(S*k*r/t.graduatedRange<2&&w.graduatedSkip===null){t.vs.push(b);continue}let N=o[0][0],D=0,L=0;g=r*w.graduatedStart-1e-4,y=r*w.graduatedEnd+1e-4;let M=S*k,A=t.graduatedTickBase;if(A<t.graduatedMin){let B=(t.graduatedMin-A)/M;B=B%1===0?B:Math.floor(B+1),A+=B*M}else if(A>t.graduatedMin+M){let B=Math.floor((A-t.graduatedMin)/M);A-=B*M}let F=c[v],O=A,E=t.graduatedMax*1e-6;for(let B=1;A<=t.graduatedMax+E;B++){if(this.VI(t,A-t.graduatedTickBase,F)&&(A>t.graduatedMax&&(A=t.graduatedMax),(w.graduatedSkip===null||w instanceof lt&&!w.graduatedSkip(A,w)||w instanceof et&&!w.graduatedSkip(A,w))&&(p=(A-t.graduatedMin)*r/t.graduatedRange,p>r&&(p=r),g<=p&&p<=y))){let X=u[D][L],z=o[D][L];for(;D<o.length;){for(;p>N&&L<o[D].length-1;)L++,X=u[D][L],z=o[D][L],N+=z;if(p<=N)break;D++,L=0,X=u[D][L],z=o[D][L],N+=z}let U=n[D],tt=U[L*2],nt=U[L*2+1],Z=U[L*2+2],it=U[L*2+3],_=(p-(N-z))/z,at=new P(tt+(Z-tt)*_+s/2-i.bounds.x,nt+(it-nt)*_+s/2-i.bounds.y);if(at.scale(e.scale,e.scale),X=this.BI(X,_,U,u[D],L),w instanceof lt){let ct="";w.graduatedFunction!==null?(ct=w.graduatedFunction(A,w),ct=ct!=null?ct.toString():""):ct=(+A.toFixed(2)).toString(),ct!==""&&b.push({pt:at,angle:X,text:ct})}else b.push({pt:at,angle:X})}A=O+B*M}t.vs.push(b)}m.Z(u)}BI(t,e,i,s,n){if(e<.5005&&e>.4995)return t;let o=t;if(e<.5?n>0?o=s[n-1]:C.X(i[0],i[i.length-2])&&C.X(i[1],i[i.length-1])&&(o=s[s.length-1]):e>.5&&(n+1<s.length?o=s[n+1]:C.X(i[0],i[i.length-2])&&C.X(i[1],i[i.length-1])&&(o=s[0])),t!==o){let r=Math.abs(t-o);if(r>180&&(t<o?t+=360:o+=360,r=Math.abs(t-o)),e<5e-4||e>.9995)return(t+o)/2%360;if(r<10){let a=1-Math.abs(.5-e);return(t*a+o*(1-a))%360}}return t}UI(t){if(t.ds===null){let e=[],i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(!(a<0))for(let h=0;h<s;h++){if(h===n)continue;let l=i[h];if(!l.visible||o.constructor!==l.constructor)continue;let u=l.interval;u>a&&r.push(u)}}t.ds=e}return t.ds}VI(t,e,i){let s=i.length;for(let n=0;n<s;n++){let o=i[n]*t.graduatedTickUnit,r=e%o,a=t.graduatedTickUnit*1e-6;if(r<a&&r>-a)return!1}return!0}Ge(t,e,i){let s=i.ph;i.ph=!0;let n=t.naturalBounds,o=n.width,r=n.height,a=e instanceof re;e.save(),e.beginPath(),e.rect(-1,-1,o+1,r+1),e.clip(),e.endPath();let h=t.findMainElement();h.Ge(e,i);let l=t.getDocumentScale()*i.scale;l<=0&&(l=1);let u=h.actualBounds,c=t.D.r,d=t.vs,f=c.length;for(let p=0;p<f;p++){let g=c[p],y=d[p],b=y.length;if(!(!g.visible||g===h||y.length===0)){if(g instanceof et){if(t.graduatedTickUnit*g.interval*h.geometry.flattenedTotalLength/t.graduatedRange*l<2&&g.graduatedSkip===null)continue;let v=g.measuredBounds,w=g.strokeWidth*g.scale,k=g.alignmentFocus;k.isNoSpot()&&(k=T.TopCenter);for(let S=0;S<b;S++){let N=y[S].pt,D=y[S].angle;this.zI(g,N,u,D,v,w,k),g.Ge(e,i),a&&(t.svg.appendChild(g.svg),g.svg=null),g._r.Ue()}}else if(g instanceof lt){t.vi===null&&(t.vi=new lt);let v=t.vi;this.fD(g,v),v.HN=!0;for(let w=0;w<b;w++){let k=y[w];if(k.actualBounds&&k.measuredBounds&&k.naturalBounds){v.XI(k);let S=k.actualBounds;v.Ut(S.x,S.y,S.width,S.height),this.GI(v,u,S,k.measuredBounds,k.naturalBounds),v.el=g.part,v.$s=g.panel,v.Ge(e,i),v.$s=null,v.el=null,a&&(t.svg.appendChild(v.svg),v.svg=null)}}}}}i.ph=s,e.restore(),e.clearContextCache(!0)}zI(t,e,i,s,n,o,r){let a=t._r;a.Ue(),a.Xs(e.x+i.x,e.y+i.y),a.ks(s+t.angle,0,0),a.Xs(-n.width*r.x+r.offsetX+o/2,-n.height*r.y+r.offsetY+o/2),a.et(t.scale,t.scale),t.Md(!1),t.wa.set(t._r),t.Dh=t.scale,t.Na(!1)}GI(t,e,i,s,n){let o=t._r;o.Ue(),o.Xs(i.x+e.x,i.y+e.y),o.Xs(-s.x,-s.y),t.Xp(o,n.x,n.y,n.width,n.height),t.Md(!1),t.wa.set(t._r),t.Dh=t.scale,t.Na(!1)}fD(t,e){e.YI(t)}}Lt.An("Graduated",new qn);var Us=(x=>(x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(Us||{});class G extends J{W;D;Qt;vd;Jn;nl;ho;Wo;qN;O;Fd;ot;Pe;te;Rd;Ta;_s;constructor(t,e){if(super(),t===void 0)this.W=G.Position;else if(typeof t=="string"){let i=Lt.fs.get(t);i!==null?this.W=i:m.o("PanelLayout not loaded: "+t)}else t instanceof Lt?this.W=t:(this.W=G.Position,t&&(e=t));this.n|=4194304|(this.W===G.Grid?1048576:0),this.D=new q,this.Qt=Dt.em,this.vd=T.Default,this.Jn=1,this.nl=null,this.ho="",this.Wo=new I(NaN,NaN,NaN,NaN),this.qN=null,this.O=null,this.Fd=6,this.Pe=null,this.ot=null,this.te=null,this.Rd=NaN,this.Ta=null,this._s=null,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.W=this.W,t.Qt=this.Qt.N(),t.vd=this.vd.N(),t.Jn=this.Jn,t.ho=this.ho,t.Wo.h(this.Wo),this.O!==null&&(t.O=this.O.copy(t)),t.Fd=this.Fd,this.ot!==null&&(t.ot=this.ot.copy()),this.Pe!==null&&(t.Pe=this.Pe.copy()),t.te=this.te,t.Rd=this.Rd,t.Ta=this.Ta}Yo(t){super.Yo(t),t.D=this.D;let e=t.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n.$s=t}t.nl=null}copy(){let t=super.copy(),e=this.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].copy();t.KI(n)}return t}toString(){return"Panel("+this.type.name+")#"+V.xs(this)}get type(){return this.W}set type(t){let e=this.W;e!==t&&(this.W=t,this.Tf=this.W===G.Grid,this.f(),this.t("type",e,t))}get elements(){return this.D.iterator}get naturalBounds(){return this.Ke}get padding(){return this.Qt}set padding(t){typeof t=="number"?(t<0&&m.J(t,">= 0",G,"padding"),t=new Dt(t)):(t.left<0&&m.J(t.left,">= 0",G,"padding:value.left"),t.right<0&&m.J(t.right,">= 0",G,"padding:value.right"),t.top<0&&m.J(t.top,">= 0",G,"padding:value.top"),t.bottom<0&&m.J(t.bottom,">= 0",G,"padding:value.bottom"));let e=this.Qt;e.equals(t)||(t=t.N(),this.Qt=t,this.f(),this.t("padding",e,t))}get defaultAlignment(){return this.vd}set defaultAlignment(t){let e=this.vd;e.equals(t)||(t=t.N(),this.vd=t,this.f(),this.t("defaultAlignment",e,t))}get defaultStretch(){return this.Jn}set defaultStretch(t){let e=this.Jn;e!==t&&(this.Jn=t,this.f(),this.t("defaultStretch",e,t))}get defaultSeparatorPadding(){return this.O!==null?this.O.S0:Dt.em}set defaultSeparatorPadding(t){typeof t=="number"&&(t=new Dt(t));let e=this.defaultSeparatorPadding;e.equals(t)||(t=t.N(),this.O===null&&(this.O=new ie),this.O.S0=t,this.f(),this.t("defaultSeparatorPadding",e,t))}get defaultRowSeparatorStroke(){return this.O!==null?this.O.M0:null}set defaultRowSeparatorStroke(t){let e=this.defaultRowSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof R)&&(t instanceof R&&t.k(),this.O===null&&(this.O=new ie),this.O.M0=t,this.C(),this.t("defaultRowSeparatorStroke",e,t))}get defaultRowSeparatorStrokeWidth(){return this.O!==null?this.O.N0:1}set defaultRowSeparatorStrokeWidth(t){let e=this.defaultRowSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.O===null&&(this.O=new ie),this.O.N0=t,this.f(),this.t("defaultRowSeparatorStrokeWidth",e,t))}get defaultRowSeparatorDashArray(){return this.O!==null?this.O.C0:null}set defaultRowSeparatorDashArray(t){let e=this.defaultRowSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",G,"defaultRowSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&m.o("defaultRowSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.O===null&&(this.O=new ie),this.O.C0=t,this.C(),this.t("defaultRowSeparatorDashArray",e,t)}}get defaultColumnSeparatorStroke(){return this.O!==null?this.O.L0:null}set defaultColumnSeparatorStroke(t){let e=this.defaultColumnSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof R)&&(t instanceof R&&t.k(),this.O===null&&(this.O=new ie),this.O.L0=t,this.C(),this.t("defaultColumnSeparatorStroke",e,t))}get defaultColumnSeparatorStrokeWidth(){return this.O!==null?this.O.A0:1}set defaultColumnSeparatorStrokeWidth(t){let e=this.defaultColumnSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.O===null&&(this.O=new ie),this.O.A0=t,this.f(),this.t("defaultColumnSeparatorStrokeWidth",e,t))}get defaultColumnSeparatorDashArray(){return this.O!==null?this.O.T0:null}set defaultColumnSeparatorDashArray(t){let e=this.defaultColumnSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",G,"defaultColumnSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&m.o("defaultColumnSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.O===null&&(this.O=new ie),this.O.T0=t,this.C(),this.t("defaultColumnSeparatorDashArray",e,t)}}get Aa(){return this.O!==null?this.O.Aa:null}set Aa(t){this.O===null&&(this.O=new ie),this.O.Aa=t}get viewboxStretch(){return this.Fd}set viewboxStretch(t){let e=this.Fd;e!==t&&(this.Fd=t,this.f(),this.t("viewboxStretch",e,t))}get gridCellSize(){return this.Pe!==null?this.Pe.Od:st.OL}set gridCellSize(t){this.Pe===null&&(this.Pe=new ti);let e=this.Pe.Od;if(!e.equals(t)){(!t.isReal()||t.width===0||t.height===0)&&m.o("Invalid Panel.gridCellSize: "+t),this.Pe.Od=t.N();let i=this.diagram;i!==null&&this===i.grid&&i.ca(),this.C(),this.t("gridCellSize",e,t)}}get gridOrigin(){return this.Pe!==null?this.Pe.Id:P.dn}set gridOrigin(t){this.Pe===null&&(this.Pe=new ti);let e=this.Pe.Id;if(!e.equals(t)){t.isReal()||m.o("Invalid Panel.gridOrigin: "+t),this.Pe.Id=t.N();let i=this.diagram;i!==null&&this===i.grid&&i.ca(),this.C(),this.t("gridOrigin",e,t)}}get graduatedMin(){return this.ot!==null?this.ot.D0:0}set graduatedMin(t){let e=this.graduatedMin;if(e!==t&&(this.ot===null&&(this.ot=new Pe),this.ot.D0=t,this.f(),this.t("graduatedMin",e,t),this.mf())){let i=this.part;i!==null&&this.Uh(i,"graduatedRange")}}get graduatedMax(){return this.ot!==null?this.ot.v0:100}set graduatedMax(t){let e=this.graduatedMax;if(e!==t&&(this.ot===null&&(this.ot=new Pe),this.ot.v0=t,this.f(),this.t("graduatedMax",e,t),this.mf())){let i=this.part;i!==null&&this.Uh(i,"graduatedRange")}}get graduatedRange(){return this.graduatedMax-this.graduatedMin}get graduatedTickUnit(){return this.ot!==null?this.ot.F0:10}set graduatedTickUnit(t){let e=this.graduatedTickUnit;e!==t&&t>0&&(this.ot===null&&(this.ot=new Pe),this.ot.F0=t,this.f(),this.t("graduatedTickUnit",e,t))}get graduatedTickBase(){return this.ot!==null?this.ot.R0:0}set graduatedTickBase(t){let e=this.graduatedTickBase;e!==t&&(this.ot===null&&(this.ot=new Pe),this.ot.R0=t,this.f(),this.t("graduatedTickBase",e,t))}get vs(){return this.ot!==null?this.ot.vs:null}set vs(t){this.ot!==null?this.ot.vs=t:t!==null&&(this.ot=new Pe,this.ot.vs=t)}get _i(){return this.ot!==null?this.ot._i:null}set _i(t){this.ot!==null?this.ot._i=t:t!==null&&(this.ot=new Pe,this.ot._i=t)}get ds(){return this.ot!==null?this.ot.ds:null}set ds(t){this.ot!==null?this.ot.ds=t:t!==null&&(this.ot=new Pe,this.ot.ds=t)}get vi(){return this.ot!==null?this.ot.vi:null}set vi(t){this.ot!==null?this.ot.vi=t:t!==null&&(this.ot=new Pe,this.ot.vi=t)}Hp(t){super.Hp(t);let e=this.D.r,i=e.length;for(let s=0;s<i;s++)e[s].Hp(t)}Ma(t,e){if(this.W===G.Grid){t.commitTransform(),this.W.Ge(this,t,e);return}if(this.W===G.Graduated){t.commitTransform(),this.W.Ge(this,t,e);return}if(this.W===G.Table)if(t.commitTransform(),t instanceof re){let r=t.currentElement;t.currentElement=t.newGroup2("gojs-ts"),this.jN(t,e),t.endGroup(),t.currentElement=r}else this.jN(t,e);let i=this.isClipping&&this.W===G.Spot;i&&t.save();let s=this.findMainElement(),n=this.D.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];i&&a===s&&(t.clipInsteadOfFill=!0),a.Ge(t,e),i&&a===s&&(t.clipInsteadOfFill=!1)}i&&(t.restore(),t.clearContextCache(!0))}jN(t,e){t.lineCap="butt";let i=this.rowCount>0?this.Zi:null,s=this.columnCount>0?this.Qi:null;i!==null&&this.j1(t,e,!0,i,!0),s!==null&&this.j1(t,e,!1,s,!0),i!==null&&this.uD(t,!0,i),s!==null&&this.uD(t,!1,s),i!==null&&this.j1(t,e,!0,i,!1),s!==null&&this.j1(t,e,!1,s,!1)}uD(t,e,i){let s=i.length,n=this.actualBounds,o=this.naturalBounds,r=!0;for(let a=0;a<s;a++){let h=i[a];if(h===void 0||h.actual===0)continue;if(r){r=!1;continue}if(e){if(h.position>o.height)continue}else if(h.position>o.width)continue;let l=h.separatorStrokeWidth;isNaN(l)&&(l=e?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let u=h.separatorStroke;if(u===null&&(u=e?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),l===0||u===null)continue;this.bn(t,u,!1,!1,o,n);let c=!1,d=h.separatorDashArray;d===null&&(d=e?this.defaultRowSeparatorDashArray:this.defaultColumnSeparatorDashArray),d!==null&&(c=!0,t.enableDash(d,0)),t.beginPath();let f=h.position+l;e?f>o.height&&(l-=f-o.height):f>o.width&&(l-=f-o.width);let p=h.position+l/2;t.lineWidth=l;let g=this.Qt;if(e){p+=g.top;let y=g.left,b=o.width-g.right;t.moveTo(y,p),t.lineTo(b,p)}else{p+=g.left;let y=g.top,b=o.height-g.bottom;t.moveTo(p,y),t.lineTo(p,b)}t.stroke(),t.endPath(),c&&t.disableDash()}}j1(t,e,i,s,n){let o=s.length,r=this.actualBounds,a=this.naturalBounds,h=this.dD(!0),l=this.dD(!1);for(let u=0;u<o;u++){let c=s[u];if(c===void 0||c.background===null||c.coversSeparators===n||c.actual===0)continue;let d=i?r.height:r.width;if(c.position>d)continue;let f=c.computeEffectiveSpacing(),p=c.separatorStrokeWidth;isNaN(p)&&(p=i?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let g=c.separatorStroke;g===null&&(g=i?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),(g===null||c.index===(i?h:l))&&(p=0),f-=p;let y=c.position+p,b=f+c.actual;if(y+b>d&&(b=d-y),b<=0)continue;let v=this.Qt;this.bn(t,c.background,!0,!1,a,r),i?t.fillRect(v.left,y+v.top,r.width-(v.left+v.right),b):t.fillRect(y+v.left,v.top,b,r.height-(v.top+v.bottom))}}dD(t){let e=t?this.rowCount:this.columnCount;for(let i=0;i<e;i++){let s=t?this.Zi[i]:this.Qi[i];if(s!==void 0)return s.index}return 0}xf(){let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].xf();this.Ji(!0)}wf(t,e,i){let s=this.svg;if(s===null)return!1;if(this.type===G.Table){let r=s.getElementsByClassName("gojs-ts"),a=r.length!==0?r[0]:null;a!==null&&(a.innerHTML=""),t.currentElement=a,this.jN(t,e),t.currentElement=null}else{if(this.W===G.Grid||this.W===G.Graduated)return s.innerHTML="",s.remove(),!1;if(this.W===G.Spot&&this.isClipping)return s.innerHTML="",s.remove(),this.xa=null,this.xf(),!1}if(!super.wf(t,e,i))return!1;let n=this.D.r,o=n.length;for(let r=0;r<o;r++)n[r].Ge(t,e);return!0}Sd(t){return!0}jp(t,e,i,s){if(!this.isClipping){if(this.Qs()&&t.partClipRect!==null){let n=t.partClipRect,o=this.D.r,r=0,a=0;for(let h=0;h<o.length;h++){if(!o[h].isVisibleObject())continue;let l=o[h].actualBounds;r=h===0?l.x:Math.min(l.x,r),a=h===0?l.y:Math.min(l.y,a)}s.setAttributeNS(null,"clip-path",`path('M ${n.x-i.x-r},${n.y-i.y-a} l ${n.width} 0 l 0 ${n.height} l -${n.width} 0 z')`);return}super.jp(t,e,i,s)}}pf(t,e,i,s,n){let o=this.Mn(),r=this.v,a=1/(r.m11*r.m22-r.m12*r.m21),h=r.m22*a,l=-r.m12*a,u=-r.m21*a,c=r.m11*a,d=a*(r.m21*r.dy-r.m22*r.dx),f=a*(r.m12*r.dx-r.m11*r.dy);if(this.background!==null){let p=t*h+e*u+d,g=t*l+e*c+f,y=i*h+s*u+d,b=i*l+s*c+f;n.e(0,0);let v=this.naturalBounds,w=C.Cl(0,0,v.width,v.height,p,g,y,b,n);return n.v(r),w}else{o||(h=1,l=0,u=0,c=1,d=0,f=0);let p=t*h+e*u+d,g=t*l+e*c+f,y=i*h+s*u+d,b=i*l+s*c+f;n.e(y,b);let v=(y-p)**2+(b-g)**2,w=!1,k=this.D.r,S=k.length,N=P.l(),D=null,L=1/0,M=null,A=this.isClipping&&this.W===G.Spot;A&&(M=P.l(),D=this.findMainElement(),w=D.pf(p,g,y,b,M),w&&(L=(p-M.x)**2+(g-M.y)**2));for(let F=0;F<S;F++){let O=k[F];if(!O.visible||O===D||!O.pf(p,g,y,b,N))continue;w=!0;let E=(p-N.x)**2+(g-N.y)**2;E<v&&(v=E,n.set(N))}return A&&(L>v&&n.set(M),P.i(M)),P.i(N),o&&n.v(r),w}}Jc(){let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].Jc();super.Jc()}f(t){if(this.Bo())return;super.f(t);let e=null;(this.W===G.Auto||this.W===G.Link)&&(e=this.findMainElement());let i=this.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if((o===e||o.isPanelMain)&&o.f(!0),o.desiredSize.isReal()||!o.visible)continue;let r=o.Zs(!1);!(o instanceof le)&&!(o instanceof G)&&!(o instanceof lt)&&r===0||o.f(!0)}}kf(){if(this.Bo())return;this.xi(!0),this.oo(!0);let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].kf()}yf(){if(this.E1()===!1){this.Md(!0),this.Na(!0);let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].LN()}}LN(){this.Na(!0);let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].LN()}kd(t,e,i,s){let n=this.Wo;n.e(0,0,0,0);let o=this.desiredSize,r=this.minSize;i===void 0&&(i=r.width,s=r.height),i=Math.max(i,r.width),s=Math.max(s,r.height);let a=this.maxSize;isNaN(o.width)||(t=Math.min(o.width,a.width)),isNaN(o.height)||(e=Math.min(o.height,a.height)),t=Math.max(i,t),e=Math.max(s,e);let h=this.Qt;t=Math.max(t-h.left-h.right,0),e=Math.max(e-h.top-h.bottom,0);let l=this.D.r;this.W.measure(this,t,e,l,n,i,s);let u=n.width+h.left+h.right,c=n.height+h.top+h.bottom;isFinite(o.width)&&(u=o.width),isFinite(o.height)&&(c=o.height),u=Math.min(a.width,u),c=Math.min(a.height,c),u=Math.max(r.width,u),c=Math.max(r.height,c),u=Math.max(i,u),c=Math.max(s,c),n.Yn(u,c),this.naturalBounds.Yn(u,c),this.no(0,0,u,c)}findMainElement(){if(this.nl===null){let t=this.D.r,e=t.length;if(e===0)return null;for(let i=0;i<e;i++){let s=t[i];if(s.isPanelMain===!0)return this.nl=s,s}this.nl=t[0]}return this.nl}jo(){return this.part!==null?this.part.locationObject:null}get panelLayoutState(){return this.qN}set panelLayoutState(t){this.qN=t}Pa(t,e,i,s){let n=this.D.r;if(this.actualBounds.e(t,e,i,s),!this.desiredSize.isReal()){let o=this.Zs(!0),r=this.measuredBounds,a=r.width,h=r.height,l=this.tl,u=l.left+l.right,c=l.top+l.bottom;switch(a===i&&h===s&&(o=0),o){case 0:(a>i||h>s)&&(this.f(),this.ht(a>i?i:a,h>s?s:h,0,0));break;case 2:this.f(!0),this.ht(i+u,s+c,0,0);break;case 5:this.f(!0),this.ht(i+u,h+c,0,0);break;case 4:this.f(!0),this.ht(a+u,s+c,0,0);break}}this.W.arrange(this,n,this.Wo)}ka(t){let e=this.naturalBounds,i=this.jo();if(I.contains(0,0,e.width,e.height,t.x,t.y)){let s=this.D.r,n=s.length,o=P.z(0,0);for(let r=n;r--;){let a=s[r];if(!(!a.visible&&a!==i)&&(o.set(t).Yi(a.v),a.containsPoint(o)))return P.i(o),!0}return P.i(o),this.Ct!==null}return!1}zp(t){if(this.io===t)return this;let e=this.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].zp(t);if(n!==null)return n}return null}walkVisualTreeFrom(t,e){if(e(this,t),t instanceof G){let i=t.D.r,s=i.length;for(let n=0;n<s;n++)this.walkVisualTreeFrom(i[n],e)}}Pn(t){this.gD(this,t)}gD(t,e){e(t);let i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o instanceof G&&this.gD(o,e)}}HI(t){this.mD(this,t)}mD(t,e){if(e(t),t instanceof G){let i=t.D.r,s=i.length;for(let n=0;n<s;n++)this.mD(i[n],e)}}findInVisualTree(t){return this.pD(this,t)}pD(t,e){if(e(t))return t;if(t instanceof G){let i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=this.pD(i[n],e);if(o!==null)return o}}return null}findObject(t){if(this.name===t)return this;let e=this.D.r,i=e.length;this.Ta!==null&&(i=this.O0());for(let s=0;s<i;s++){let n=e[s];if(n instanceof G){let o=n.findObject(t);if(o!==null)return o}if(n.name===t)return n}return null}yD(){let t=this.D.r,e=t.length,i=0;for(let s=0;s<e;s++){let n=t[s];n instanceof G?i=Math.max(i,n.yD()):n instanceof et&&(i=Math.max(i,n.qI()))}return i}Mn(){return!(this.type===G.TableRow||this.type===G.TableColumn)}il(){return this.type===G.TableRow||this.type===G.TableColumn}BA(t,e,i){if(this.pickable===!1||(e===void 0&&(e=null),i===void 0&&(i=null),this.as()))return null;let s=this.naturalBounds,n=1/this.getDocumentScale(),o=this.Mn(),r=o?t:P.z(t.x,t.y).Yi(this.v),a=this.diagram,h=10,l=5;if(a!==null&&(h=a.getInputOption("extraTouchArea"),l=h/2),I.contains(-(l*n),-(l*n),s.width+h*n,s.height+h*n,r.x,r.y)){if(!this.Tf){let c=this.D.r,d=c.length,f=P.l(),p=this.isClipping&&this.W===G.Spot,g=p?this.findMainElement():null;if(p&&g&&(g.Mn()?f.set(t).Yi(g.v):f.set(t),!g.containsPoint(f)))return P.i(f),o||P.i(r),null;let y=this.jo();for(let b=d;b--;){let v=c[b];if(!v.visible&&v!==y||(v.Mn()?f.set(t).Yi(v.v):f.set(t),p&&v===g))continue;let w=null;if(v instanceof G?w=v.BA(f,e,i):v.pickable===!0&&v.containsPoint(f)&&(w=v),w!==null&&(e!==null&&(w=e(w)),w!==null&&(i===null||i(w))))return P.i(f),o||P.i(r),w}P.i(f)}if(this.background===null)return o||P.i(r),null;let u=I.contains(0,0,s.width,s.height,r.x,r.y)?this:null;return o||P.i(r),u}return o||P.i(r),null}zA(t,e,i,s){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let n=this.naturalBounds,o=this.Mn(),r=o?t:P.z(t.x,t.y).Yi(this.v),a=this.il(),h=I.contains(0,0,n.width,n.height,r.x,r.y);if(a||h){if(!this.Tf){let l=this.D.r,u=l.length,c=P.l(),d=this.jo();for(let f=u;f--;){let p=l[f];if(!p.visible&&p!==d)continue;p.Mn()?c.set(t).Yi(p.v):c.set(t);let g=p,y=p instanceof G?p:null;if(y!==null?y.zA(c,e,i,s):g.containsPoint(c)){if(g.pickable===!1)continue;e!==null&&(g=e(g)),g!==null&&(i===null||i(g))&&s.add(g)}}P.i(c)}return o||P.i(r),h&&this.background!==null}return o||P.i(r),!1}Wm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r=o;if(r===void 0&&(r=Nt.l(),r.Ue()),r.kc(this.v),this.containedInRect(t,r))return this.WN(e,i,n),o===void 0&&Nt.i(r),!0;if(this.intersectsRect(t,r)){if(!this.Tf){let a=this.jo(),h=this.D.r,l=h.length;for(let u=l;u--;){let c=h[u];if(!c.visible&&c!==a)continue;let d=c.actualBounds,f=this.naturalBounds;if(d.x>f.width||d.y>f.height||d.x+d.width<0||d.y+d.height<0)continue;let p=c,g=c instanceof G?c:null,y=Nt.l();y.set(r),(g!==null?g.Wm(t,e,i,s,n,y):p.JT(t,s,y))&&(e!==null&&(p=e(p)),p!==null&&(i===null||i(p))&&n.add(p)),Nt.i(y)}}return o===void 0&&Nt.i(r),s}return o===void 0&&Nt.i(r),!1}WN(t,e,i){let s=this.D.r,n=s.length;for(let o=n;o--;){let r=s[o];if(!r.visible)continue;let a=r.actualBounds,h=this.naturalBounds;if(a.x>h.width||a.y>h.height||a.x+a.width<0||a.y+a.height<0)continue;r instanceof G&&r.WN(t,e,i);let l=r;t!==null&&(l=t(l)),l!==null&&(e===null||e(l))&&i.add(l)}}XA(t,e,i,s,n,o){if(this.pickable===!1)return!1;i===void 0&&(i=null),s===void 0&&(s=null);let r=this.naturalBounds,a=this.Mn(),h=a?t:P.z(t.x,t.y).Yi(this.v),l=a?e:P.z(e.x,e.y).Yi(this.v),u=h.distanceSquaredPoint(l),c=h.x>0&&h.x<r.width&&h.y>0&&h.y<r.height||P.distanceLineSegmentSquared(h.x,h.y,0,0,0,r.height)<=u||P.distanceLineSegmentSquared(h.x,h.y,0,r.height,r.width,r.height)<=u||P.distanceLineSegmentSquared(h.x,h.y,r.width,r.height,r.width,0)<=u||P.distanceLineSegmentSquared(h.x,h.y,r.width,0,0,0)<=u,d=h.distanceSquared(0,0)<=u&&h.distanceSquared(0,r.height)<=u&&h.distanceSquared(r.width,0)<=u&&h.distanceSquared(r.width,r.height)<=u;if(a||(P.i(h),P.i(l)),c){if(!this.Tf){let f=P.l(),p=P.l(),g=this.jo(),y=this.D.r,b=y.length;for(let v=b;v--;){let w=y[v];if(!w.visible&&w!==g)continue;let k=w.actualBounds,S=this.naturalBounds;if(a&&(k.x>S.width||k.y>S.height||k.x+k.width<0||k.y+k.height<0))continue;if(w.Mn()){let L=w.v;f.set(t).Yi(L),p.set(e).Yi(L)}else f.set(t),p.set(e);let N=w,D=w instanceof G?w:null;(D!==null?D.XA(f,p,i,s,n,o):N.$T(f,p,n))&&(i!==null&&(N=i(N)),N!==null&&(s===null||s(N))&&o.add(N))}P.i(f),P.i(p)}return n?c:d}return!1}XN(t){let e=null;if(t instanceof et){e=t.spot1,e===T.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot1)}return e===null&&(e=T.TopLeft),e}GN(t){let e=null;if(t instanceof et){e=t.spot2,e===T.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot2)}return e===null&&(e=T.BottomRight),e}add(...t){for(let e=0;e<t.length;e++)this.insertAt(this.D.count,t[e]);return this}elt(t){return this.D.elt(t)}insertAt(t,e){e instanceof pt&&m.o("Cannot add a Part to a Panel: "+e+"; use a Panel instead"),(this===e||this.isContainedBy(e))&&(this===e&&m.o("Cannot make a Panel contain itself: "+this.toString()),m.o("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+e.toString()));let i=e.panel;if(i!==null&&i!==this&&m.o("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+e.toString()+", already contained by "+i.toString()+", cannot be shared by this Panel: "+this.toString()),this.W===G.Grid&&!(e instanceof et)&&m.o("Can only add Shapes to a Grid Panel, not: "+e),this.W===G.Graduated&&!(e instanceof et||e instanceof lt)&&m.o("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+e),e.Vh(this),e.el=null,this.itemArray!==null){let r=e.data;m.$(r)&&(this._s===null&&(this._s=new Mt),this._s.set(r,e))}let s=this.D,n=-1;if(i===this){let r=-1,a=this.D.r,h=a.length;for(let l=0;l<h;l++)if(a[l]===e){r=l;break}if(r!==-1){if(r===t||r+1>=s.count&&t>=s.count)return;s.removeAt(r),n=r}else m.o("element "+e.toString()+" has panel "+i.toString()+" but is not contained by it.")}(t<0||t>s.count)&&(t=s.count),s.insertAt(t,e),(t===0||e.isPanelMain)&&(this.nl=null),this.Bo()||this.f(),e.f(!1),e.portId!==null?this.Cn=!0:e instanceof G&&e.Cn===!0&&(this.Cn=!0),this.ds=null,this.isEnabledObject()||this.W1(e,!1);let o=this.part;if(o!==null){o.t0(),o.Df(),this.Cn&&o instanceof $&&(o.Cn=!0),o.Cn&&o instanceof $&&(o.ci=null);let r=this.diagram;if(r!==null&&r.undoManager.isUndoingRedoing)return;n!==-1&&o.raiseChangedEvent(4,"elements",this,e,null,n,null),o.raiseChangedEvent(3,"elements",this,null,e,null,t)}}get Cn(){return(this.n&8388608)!==0}set Cn(t){(this.n&8388608)!==0!==t&&(this.n=this.n^8388608)}SN(){return(this.n&16777216)!==0}JN(t){t?this.n|=16777216:this.n&=-16777217}KI(t){t.Vh(this),t.el=null;let e=this.D,i=e.count;e.insertAt(i,t);let s=this.part;if(s!==null){s.t0(),t.portId!==null&&s instanceof $&&(s.Cn=!0);let n=this.diagram;if(n!==null&&n.undoManager.isUndoingRedoing)return;s.raiseChangedEvent(3,"elements",this,null,t,null,i)}}cI(t){let e=this.D.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}return s}remove(t){let e=this.D.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}s!==-1&&this.ri(s,!0)}removeAt(t){t>=0&&this.ri(t,!0)}ri(t,e){let i=this.D,s=i.elt(t);if(s.el=null,s.Vh(null),this._s!==null){let o=s.data;m.$(o)&&this._s.delete(o)}i.removeAt(t),this.xi(!1),this.f(),this.nl===s&&(this.nl=null),this.ds=null;let n=this.part;if(n!==null){n.t0(),n.Df(),n.invalidateAdornments(),n instanceof $&&(s instanceof G?s.walkVisualTreeFrom(s,(r,a)=>n.vN(a,e)):n.vN(s,e));let o=this.diagram;if(o!==null&&o.undoManager.isUndoingRedoing)return;n.raiseChangedEvent(4,"elements",this,s,null,t,null)}}get Zi(){return this.O===null&&(this.O=new ie),this.O.Zi}get rowCount(){return this.O===null?0:this.Zi.length}getRowDefinition(t){t<0&&m.J(t,">= 0",G,"getRowDefinition:idx"),t=Math.round(t);let e=this.Zi;if(e[t]===void 0){let i=new Kt;i.Vh(this),i.isRow=!0,i.index=t,e[t]=i,this.raiseChangedEvent(3,"rowdefs",this,null,i,null,t)}return e[t]}removeRowDefinition(t){if(t<0&&m.J(t,">= 0",G,"removeRowDefinition:idx"),this.rowCount===0)return;t=Math.round(t);let e=this.Zi,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"rowdefs",this,i,null,t,null),this.f()}}xT(t,e){let i=this.Zi;if(!(t<0)){if(i[t]=e instanceof Kt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.f()}}get Qi(){return this.O===null&&(this.O=new ie),this.O.Qi}get columnCount(){return this.O===null?0:this.Qi.length}getColumnDefinition(t){t<0&&m.J(t,">= 0",G,"getColumnDefinition:idx"),t=Math.round(t);let e=this.Qi;if(e[t]===void 0){let i=new Kt;i.Vh(this),i.isRow=!1,i.index=t,e[t]=i,this.raiseChangedEvent(3,"coldefs",this,null,i,null,t)}return e[t]}removeColumnDefinition(t){if(t<0&&m.J(t,">= 0",G,"removeColumnDefinition:idx"),this.columnCount===0)return;t=Math.round(t);let e=this.Qi,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"coldefs",this,i,null,t,null),this.f()}}bT(t,e){let i=this.Qi;if(!(t<0)){if(i[t]=e instanceof Kt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.f()}}addRowColumnDefinition(t){let e=null;return t.isRow?e=this.getRowDefinition(t.index):t.isRow||(e=this.getColumnDefinition(t.index)),e&&e.V1(t),this}addRowDefinition(t,e){let i=this.getRowDefinition(t);return i&&i.V1(new Kt(e)),this}addColumnDefinition(t,e){let i=this.getColumnDefinition(t);return i&&i.V1(new Kt(e)),this}get rowSizing(){return this.O!==null?this.O.I0:3}set rowSizing(t){let e=this.rowSizing;e!==t&&(this.O===null&&(this.O=new ie),this.O.I0=t,this.f(),this.t("rowSizing",e,t))}get columnSizing(){return this.O!==null?this.O.E0:3}set columnSizing(t){let e=this.columnSizing;e!==t&&(this.O===null&&(this.O=new ie),this.O.E0=t,this.f(),this.t("columnSizing",e,t))}get topIndex(){return this.O!==null?this.O.U0:0}set topIndex(t){let e=this.topIndex;e!==t&&((!isFinite(t)||t<0)&&m.o("Panel.topIndex must be greater than zero and a real number, not: "+t),this.O===null&&(this.O=new ie),this.O.U0=t,this.f(),this.t("topIndex",e,t))}get leftIndex(){return this.O!==null?this.O.V0:0}set leftIndex(t){let e=this.leftIndex;e!==t&&((!isFinite(t)||t<0)&&m.o("Panel.leftIndex must be greater than zero and a real number, not: "+t),this.O===null&&(this.O=new ie),this.O.V0=t,this.f(),this.t("leftIndex",e,t))}findRowForLocalY(t){if(t<0||this.type!==G.Table||this.rowCount===0)return-1;let e=0,i=this.Zi,s=i.length,n=this.topIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}findColumnForLocalX(t){if(t<0||this.type!==G.Table||this.columnCount===0)return-1;let e=0,i=this.Qi,s=i.length,n=this.leftIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}graduatedPointForValue(t,e){if(e===void 0&&(e=new P(NaN,NaN)),this.type!==G.Graduated)return e.e(NaN,NaN),e;t=Math.min(Math.max(t,this.graduatedMin),this.graduatedMax);let i=this.findMainElement();return i.geometry.getPointAlongPath((t-this.graduatedMin)/this.graduatedRange,e),i.v.gt(e)}graduatedValueForPoint(t){if(this.type!==G.Graduated)return NaN;let e=this.findMainElement();return e.v.Ci(t),e.geometry.getFractionForPoint(t)*this.graduatedRange+this.graduatedMin}get data(){return this.te}set data(t){let e=this.te;if(e!==t){let i=this instanceof pt&&!(this instanceof vt);i&&m.s(t,"object",G,"data"),this.It(),this.te=t;let s=this.diagram;if(s!==null)if(i){s.partManager.jI(this,e,t);let n=this.adornments;for(;n.next();){let o=n.value,r=o.adornedObject;if(r!==null){let a=r.findBindingPanel();a!==null&&(o.data=a.data)}}}else{let n=this.panel;n!==null&&n._s!==null&&(e!==null&&n._s.delete(e),t!==null&&n._s.set(t,this))}if(this.t("data",e,t),s!==null&&s.undoManager.isUndoingRedoing)return;t!==null&&this.updateTargetBindings()}}get itemIndex(){return this.Rd}set itemIndex(t){let e=this.Rd;e!==t&&(this.Rd=t,this.t("itemIndex",e,t))}get Ds(){return this.w!==null?this.w.Ds:null}set Ds(t){this.ve!==t&&(this.w===null&&(this.w=new Ye),this.w.Ds=t)}FN(){return this.Ds!==null}nD(){let t=this.Ds;return t!==null&&t.u}freezeBindings(){return this.It()}It(){let t=this.Ds;if(t===null)this.data!==null&&m.o("Template cannot have .data be non-null: "+this),this.Ds=t=new q;else if(t.u)return this;let e=new q;this.JN(!1),this.walkVisualTreeFrom(this,(n,o)=>{o.ba();let r=o.ve;if(r!==null){o.AN(!1);let a=r.iterator;for(;a.next();){let h=a.value;h.mode===2&&o.AN(!0);let l=h.sourceName;if(h.isToObject){l==="/"&&n.JN(!0);let u=h.WT(n,o);u!==null&&(e.add(u),u.so===null&&(u.so=new q),u.so.add(h))}t.add(h)}}if(o instanceof G&&o.type===G.Table){if(o.rowCount>0){let a=o.Zi,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.Fs!==null){let c=u.Fs.iterator;for(;c.next();){let d=c.value;d.Ti=u,d.Ed=2,d.vf=u.index,t.add(d)}}}}if(o.columnCount>0){let a=o.Qi,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.Fs!==null){let c=u.Fs.iterator;for(;c.next();){let d=c.value;d.Ti=u,d.Ed=1,d.vf=u.index,t.add(d)}}}}}});let i=e.iterator;for(;i.next();){let n=i.value;if(n.so!==null){n.AN(!0);let o=n.so.iterator;for(;o.next();){let r=o.value;n.ve===null&&(n.ve=new q),n.ve.add(r)}}n.so=null}let s=t.iterator;for(;s.next();){let n=s.value,o=n.Ti;if(o!==null){n.Ti=null;let r=n.targetProperty,a=r.indexOf(".");if(a>0&&o instanceof G){let h=r.substring(0,a),l=r.substring(a+1),u=o.findObject(h);u!==null?(o=u,n.targetProperty=l):(m.ne('Warning: unable to find GraphObject named "'+h+'" for Binding: '+n.toString()),o=null)}if(o instanceof Kt){let h=V.xs(o.panel);n.targetId=h===void 0?-1:h,o.panel.io=n.targetId}else if(o instanceof J){let h=V.xs(o);n.targetId=h===void 0?-1:h,o.io=n.targetId}else m.o("Unknown type of binding target: "+o);n.check(o)}}return t.k(),this instanceof pt&&this.Di()&&this.ensureBounds(),this}static VU=!1;copyTemplate(t){t===void 0&&(t=!1);let e=this.copy();return e.HI(i=>{i instanceof G&&(i.Ds=null,i.te=null);let s=i.ve;s!==null&&(i.ve=null,s.each(o=>i.bind(o.copy())));let n=i.Ts;n!==null&&(i.Ts=null,n.each(o=>i.trigger(o.value.copy())))}),t&&e.It(),e}updateTargetBindings(t){let e=this.Ds;if(e===null)return;t===void 0&&(t="");let i=this.diagram?.model,s=e.iterator;for(;s.next();){let n=s.value,o=this.$N(n,t);if(o===null)continue;let{data:r,elt:a}=o;n.isToTheme&&this.diagram===null||a!==void 0&&n.updateTarget(a,r,void 0,i)}}WI(t){if(t===""){this.updateTargetBindings(t);return}let e=this.Ds;if(e===null)return;let i=this.diagram?.model,s=e.iterator;for(;s.next();){let n=s.value;if(n.isToData&&n.sourceProperty!=="")continue;let o=this.$N(n,"");if(o===null)continue;let{data:r,elt:a}=o;a!==void 0&&n.updateTarget(a,r,void 0,i)}}zo(){if(this.diagram!==null)if(this.FN()){let t=this.diagram.model,e=this.Ds.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=this.$N(i);if(s===null)continue;let{data:n,elt:o}=s;o!==void 0&&i.updateTarget(o,n,void 0,t)}}else{let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].zo()}}$N(t,e=""){let i=t.sourceProperty;if(e!==""&&i!==""&&i!==e)return null;let s=t.targetProperty;if(t.converter===null&&s==="")return null;let n=this.data,o=t.sourceName;if(t.isToObject){if(n=this.jT(o),n===null)return null}else if(t.isToModel){let l=this.diagram;if(l===null)return null;n=l.model.modelData}let r=this,a=t.targetId;if(a!==-1){if(r=this.zp(a),r===null)return null}else t.Ti!==null&&(r=t.Ti);o==="/"?n=r.part:o==="."?n=r:o===".."&&(n=r.panel);let h=t.Ed;if(h!==0){if(!(r instanceof G))return null;h===1?r=r.getColumnDefinition(t.vf):h===2&&(r=r.getRowDefinition(t.vf))}return{data:n,elt:r}}get itemArray(){return this.Ta}set itemArray(t){let e=this.Ta;if(e!==t||t!==null&&this.JI(t)){let i=this.diagram;if(e!==t&&(i!==null&&e!==null&&i.partManager.N2(this,i),this.Ta=t,i!==null&&t!==null&&i.partManager.M2(this,i)),this.t("itemArray",e,t),i!==null&&i.undoManager.isUndoingRedoing)return;this.wD(e,t)}}findItemPanelForData(t){return t==null||this._s===null?null:(m.xc(t,G,"findItemPanelForData"),this._s.get(t))}JI(t){let e=this.D.r,i=e.length,s=t.length,n=0,o=null;for(;n<i&&(o=e[n],!(o instanceof G)||o.data===null);)n++,o=e[n];if(i-n!==s)return!0;if(o===null)return s>0;let r=0;for(;n<i&&r<s;){if(o=e[n],!(o instanceof G)||o.data!==t[r])return!0;n++,r++}return!1}O0(){if(this.type===G.Spot||this.type===G.Auto)return Math.min(this.D.length,1);if(this.type===G.Link){let t=this.D,e=t.length,i=0;for(;i<e;i++){let s=t.elt(i);if(!(s instanceof et)||!s.isPanelMain)return i}return i}if(this.type===G.Table&&this.D.length>0){let t=this.D.elt(0);if(t.isPanelMain&&t instanceof G&&t.il())return 1}return 0}rebuildItemElements(){let t=this.O0();for(;this.D.length>t;)this.ri(this.D.length-1,!1);this.wD(null,this.itemArray)}wD(t,e){let i=this.O0(),s=e;if(s===null||s.length===0){for(;this.D.length>i;)this.ri(this.D.length-1,!1);return}if(this.D.length<=i){let n=s.length;for(let o=0;o<n;o++)this.J1(s[o],o,!0)}else{let n=i;for(let r=0;r<s.length;r++,n++){let a=s[r],h=n<this.D.length?this.D.elt(n):null;if(h instanceof G){if(h.data!==a){let l=this.ZN(h.data,r),u=this.ZN(a,r),c=u!==l;if(!c){let d=this.QN(h.data,r,l);c=this.QN(a,r,u)!==d}c?(this.ri(n,!1),this.J1(a,r,!1)):h.data=a}}else this.J1(a,r,!1)}for(;n<this.D.length;)this.ri(n,!1);this.nl=null,this._N(i,0),this.Bo()||this.f(),this.ds=null,this.isEnabledObject()||this.W1(this,!1);let o=this.part;o!==null&&(o.t0(),o.Df(),this.Cn&&o instanceof $&&(o.Cn=!0),o.Cn&&o instanceof $&&(o.ci=null))}}J1(t,e,i){if(t==null||e<0)return;let s=this.ZN(t,e),n=this.QN(t,e,s);if(n!==null){n.It();let o=n.copy();if(o.SN()){let a=this.findBindingPanel();a!==null&&a.JN(!0)}m.$(t)&&(this._s===null&&(this._s=new Mt),this._s.set(t,o));let r=e+this.O0();this.insertAt(r,o),i&&(o.te=t,this._N(r,e),o.te=null),o.data=t}}$I(t){if(t<0)return;let e=t+this.O0();this.ri(e,!0),this._N(e,t)}_N(t,e){let i=this.D,s=t,n=e;for(;s<i.length;){let o=i.elt(s);o instanceof G&&o.ZI(s,n),s++,n++}}ZI(t,e){this.type===G.TableRow?this.row=t:this.type===G.TableColumn&&(this.column=t),this.itemIndex=e}get itemTemplate(){let t=this.itemTemplateMap;if(t!==null){let e=t.get("");if(e)return e}return G.xD()}set itemTemplate(t){let e=this.itemTemplate;if(e!==t){(t instanceof pt||t.isPanelMain)&&m.o("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+t),this.itemTemplateMap===null&&(this.itemTemplateMap=new Mt),this.itemTemplateMap.set("",t),this.t("itemTemplate",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemTemplateMap(){return this.w!==null?this.w.p0:null}set itemTemplateMap(t){let e=this.itemTemplateMap;if(e!==t){let i=t.iterator;for(;i.next();){let n=i.value}this.Yt().p0=t,this.t("itemTemplateMap",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemCategoryProperty(){return this.w!==null?this.w.y0:"category"}set itemCategoryProperty(t){let e=this.itemCategoryProperty;e!==t&&(typeof t!="string"&&!m.it(t)&&m.si(t,"string or function",G,"itemCategoryProperty"),this.Yt().y0=t,this.t("itemCategoryProperty",e,t))}ZN(t,e){if(t===null)return"";let i=this.itemCategoryProperty,s="";if(m.it(i))s=i(t);else if(typeof i=="string"&&m.$(t)){if(i==="")return"";let n=this.diagram,o=n!==null?n.model:null;o?s=o.Lt(t,i):s=ut.Lt(t,i)}else return"";if(s===void 0)return"";if(typeof s=="string")return s;m.o("Panel.getCategoryForItemData found a non-string category for "+t+": "+s)}static bD=!1;static tC;static xD(){return G.tC||(G.tC=new G().add(new lt().bind("text","",m.toString).theme("stroke","text"))),G.tC}QN(t,e,i){let s=null,n=this.itemTemplateMap;return n!==null&&(s=n.get(i),s===null&&(s=n.get(""))),s===null&&(G.bD||(G.bD=!0,m.ne('No item template Panel found for category "'+i+'" on '+this),m.ne(" Using default item template.")),s=G.xD()),s}get Tf(){return(this.n&1048576)!==0}set Tf(t){let e=(this.n&1048576)!==0;e!==t&&(m.s(t,"boolean",G,"isAtomic"),this.n=this.n^1048576,this.t("isAtomic",e,t))}get isClipping(){return(this.n&2097152)!==0}set isClipping(t){let e=(this.n&2097152)!==0;e!==t&&(this.xf(),this.n=this.n^2097152,this instanceof ht&&(this.he=null),this.f(),this.t("isClipping",e,t))}get isOpposite(){return(this.n&33554432)!==0}set isOpposite(t){let e=(this.n&33554432)!==0;e!==t&&(this.n=this.n^33554432,this.f(),this.t("isOpposite",e,t))}get isEnabled(){return(this.n&4194304)!==0}set isEnabled(t){let e=(this.n&4194304)!==0;if(e!==t){let i=this.panel===null||this.panel.isEnabledObject();this.n=this.n^4194304,this.t("isEnabled",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;i&&this.W1(this,t)}}W1(t,e){let i=t.enabledChanged;if(i!==null&&i(t,e),t instanceof G){let s=t.D.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];e&&r instanceof G&&!r.isEnabled||this.W1(r,e)}}}get alignmentFocusName(){return this.ho}set alignmentFocusName(t){let e=this.ho;e!==t&&(this.ho=t,this.f(),this.t("alignmentFocusName",e,t))}static definePanelLayout(t,e){Lt.An(t,e)}static isLayoutDefined(t){return Lt.fs.has(t)}static Position=Lt.fs.get("Position");static Horizontal=Lt.fs.get("Horizontal");static Vertical=Lt.fs.get("Vertical");static Spot=Lt.fs.get("Spot");static Auto=Lt.fs.get("Auto");static Table=Lt.fs.get("Table");static Viewbox=Lt.fs.get("Viewbox");static TableRow=Lt.fs.get("TableRow");static TableColumn=Lt.fs.get("TableColumn");static Link=Lt.fs.get("Link");static Grid=Lt.fs.get("Grid");static Graduated=Lt.fs.get("Graduated")}G.definePanelLayout=G.definePanelLayout;class Pe{D0;v0;F0;R0;vs;_i;ds;vi;constructor(){this.D0=0,this.v0=100,this.F0=10,this.R0=0,this.vs=null,this._i=null,this.ds=null,this.vi=null}copy(){let t=new Pe;return t.D0=this.D0,t.v0=this.v0,t.F0=this.F0,t.R0=this.R0,t.vs=this.vs,t._i=this._i,t.ds=this.ds,t.vi=this.vi,t}}class ti{Od;Id;hf;P0;constructor(){this.Od=st.OL,this.Id=P.dn,this.hf=st.Ww,this.P0=[]}copy(){let t=new ti;return t.Od=this.Od.copy(),t.Id=this.Id.copy(),t.hf=this.hf.copy(),t.P0=this.P0,t}}class ie{Zi;Qi;I0;E0;U0;V0;S0;N0;M0;C0;A0;L0;T0;Aa;constructor(){this.Zi=[],this.Qi=[],this.I0=3,this.E0=3,this.U0=0,this.V0=0,this.S0=Dt.em,this.N0=1,this.M0=null,this.C0=null,this.A0=1,this.L0=null,this.T0=null,this.Aa=null}copy(t){let e=new ie,i=this.Zi,s=i.length,n=e.Zi;for(let h=0;h<s;h++){let l=i[h];if(l===void 0)continue;let u=l.copy();u.Vh(t),n[h]=u}let o=this.Qi,r=o.length,a=e.Qi;for(let h=0;h<r;h++){let l=o[h];if(l===void 0)continue;let u=l.copy();u.Vh(t),a[h]=u}return e.I0=this.I0,e.E0=this.E0,e.U0=this.U0,e.V0=this.V0,e.S0=this.S0.N(),e.N0=this.N0,e.M0=this.M0,e.C0=this.C0,e.A0=this.A0,e.L0=this.L0,e.T0=this.T0,e.Aa=this.Aa,e}}var zi=(x=>(x[x.Default=1]="Default",x[x.None=2]="None",x[x.ProportionalExtra=3]="ProportionalExtra",x))(zi||{});class Kt{$s;B0;Tt;Gh;Yh;de;ct;Ud;ro;ol;Vd;Bd;Kh;Ct;zd;Fs;q;Re;ki;constructor(t){V.Je(this),this.$s=null,this.B0=!0,this.Tt=0,this.ki=NaN,this.Gh=0,this.Yh=1/0,this.de=T.Default,this.q=0,this.Re=0,this.ct=0,this.Fs=null,this.Ud=1,this.ro=1,this.ol=null,this.Vd=null,this.Bd=NaN,this.Kh=null,this.Ct=null,this.zd=!1,t&&(Object.assign(this,t),t.column!==void 0?(this.isRow=!1,this.index=t.column):t.row!==void 0&&(this.isRow=!0,this.index=t.row))}copy(){let t=new Kt;return t.B0=this.B0,t.Tt=this.Tt,t.ki=this.ki,t.Gh=this.Gh,t.Yh=this.Yh,t.de=this.de,t.q=this.q,t.Re=this.Re,t.ct=this.ct,t.ro=this.ro,t.Ud=this.Ud,this.ol===null?t.ol=null:t.ol=this.ol.N(),t.Vd=this.Vd,t.Bd=this.Bd,t.Kh=null,this.Kh!==null&&(t.separatorDashArray=this.Kh.slice()),t.Ct=this.Ct,t.zd=this.zd,t.Fs=this.Fs,t}V1(t){t.isRow?t.height!==void 0&&(this.height=t.height):t.width!==void 0&&(this.width=t.width),t.minimum!==void 0&&(this.minimum=t.minimum),t.maximum!==void 0&&(this.maximum=t.maximum),t.alignment!==void 0&&(this.alignment=t.alignment),t.stretch!==void 0&&(this.stretch=t.stretch),t.sizing!==void 0&&(this.sizing=t.sizing),t.separatorPadding!==void 0&&(this.separatorPadding=t.separatorPadding),t.separatorStroke!==void 0&&(this.separatorStroke=t.separatorStroke),t.separatorStrokeWidth!==void 0&&(this.separatorStrokeWidth=t.separatorStrokeWidth),t.separatorDashArray!==void 0&&(this.Kh=t.separatorDashArray),t.background!==void 0&&(this.background=t.background),t.coversSeparators!==void 0&&(this.coversSeparators=t.coversSeparators),t.Fs!==void 0&&(this.Fs=t.Fs)}fe(t){t in zi?this.sizing=t:m.cr(this,t)}toString(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+V.xs(this)}static Default=1;static None=2;static ProportionalExtra=3;Vh(t){this.$s=t}computeEffectiveSpacingTop(t){let e=0,i=this.$s;if(this.index!==t){let n=this.separatorStroke;n===null&&i!==null&&(n=this.isRow?i.defaultRowSeparatorStroke:i.defaultColumnSeparatorStroke),n!==null&&(e=this.separatorStrokeWidth,isNaN(e)&&(i!==null?e=this.isRow?i.defaultRowSeparatorStrokeWidth:i.defaultColumnSeparatorStrokeWidth:e=0))}let s=this.ol;if(s===null)if(i!==null)s=i.defaultSeparatorPadding;else return e;return e+(this.isRow?s.top:s.left)}computeEffectiveSpacing(){let t=0,e=this.$s,i=0,s=this.isRow;if(e!==null&&e.type===G.Table){let o=s?e.Zi.length:e.Qi.length;for(let r=0;r<o;r++){let a=s?e.Zi[r]:e.Qi[r];if(a!==void 0&&a.q!==0){i=a.index;break}}}if(this.index!==i){let o=this.separatorStroke;o===null&&e!==null&&(o=s?e.defaultRowSeparatorStroke:e.defaultColumnSeparatorStroke),o!==null&&(t=this.separatorStrokeWidth,isNaN(t)&&(e!==null?t=s?e.defaultRowSeparatorStrokeWidth:e.defaultColumnSeparatorStrokeWidth:t=0))}let n=this.ol;if(n===null)if(e!==null)n=e.defaultSeparatorPadding;else return t;return t+(this.isRow?n.top+n.bottom:n.left+n.right)}t(t,e,i,s,n){let o=this.$s;if(o!==null&&(o.raiseChangedEvent(2,t,this,e,i,s,n),this.Fs!==null)){let r=o.diagram;if(r!==null&&!r.wi){let a=o.findBindingPanel();if(a!==null){let h=a.data;if(h!==null){let l=this.Fs.iterator;for(;l.next();)l.value.updateSource(this,h,t,a)}}}}}get panel(){return this.$s}get isRow(){return this.B0}set isRow(t){this.B0=t}get index(){return this.Tt}set index(t){this.Tt=t}get height(){return this.ki}set height(t){let e=this.ki;e!==t&&(t<0&&m.J(t,">= 0",Kt,"height"),this.ki=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("height",e,t))}get width(){return this.ki}set width(t){let e=this.ki;e!==t&&(t<0&&m.J(t,">= 0",Kt,"width"),this.ki=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("width",e,t))}get minimum(){return this.Gh}set minimum(t){let e=this.Gh;e!==t&&((t<0||!isFinite(t))&&m.J(t,">= 0",Kt,"minimum"),this.Gh=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("minimum",e,t))}get maximum(){return this.Yh}set maximum(t){let e=this.Yh;e!==t&&(t<0&&m.J(t,">= 0",Kt,"maximum"),this.Yh=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("maximum",e,t))}get alignment(){return this.de}set alignment(t){let e=this.de;e.equals(t)||(this.de=t.N(),this.panel!==null&&this.panel.f(),this.t("alignment",e,t))}get stretch(){return this.ro}set stretch(t){let e=this.ro;e!==t&&(this.ro=t,this.panel!==null&&this.panel.f(),this.t("stretch",e,t))}get separatorPadding(){return this.ol}set separatorPadding(t){typeof t=="number"&&(t=new Dt(t));let e=this.ol;(t===null||e===null||!e.equals(t))&&(t!==null&&(t=t.N()),this.ol=t,this.panel!==null&&this.panel.f(),this.t("separatorPadding",e,t))}get separatorStroke(){return this.Vd}set separatorStroke(t){let e=this.Vd;e!==t&&(t!==null&&R.Nd(t,"RowColumnDefinition.separatorStroke"),t instanceof R&&t.k(),this.Vd=t,this.panel!==null&&this.panel.f(),this.t("separatorStroke",e,t))}get separatorStrokeWidth(){return this.Bd}set separatorStrokeWidth(t){let e=this.Bd;e!==t&&(this.Bd=t,this.panel!==null&&this.panel.f(),this.t("separatorStrokeWidth",e,t))}get separatorDashArray(){return this.Kh}set separatorDashArray(t){let e=this.Kh;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",Kt,"separatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&m.o("separatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Kh=t,this.panel!==null&&this.panel.C(),this.t("separatorDashArray",e,t)}}get background(){return this.Ct}set background(t){let e=this.Ct;e!==t&&(t!==null&&R.Nd(t,"RowColumnDefinition.background"),t instanceof R&&t.k(),this.Ct=t,this.panel!==null&&this.panel.C(),this.t("background",e,t))}get coversSeparators(){return this.zd}set coversSeparators(t){let e=this.zd;e!==t&&(m.s(t,"boolean",Kt,"coversSeparators"),this.zd=t,this.panel!==null&&this.panel.C(),this.t("coversSeparators",e,t))}get sizing(){return this.Ud}set sizing(t){let e=this.Ud;e!==t&&(this.Ud=t,this.panel!==null&&this.panel.f(),this.t("sizing",e,t))}K1(){if(this.sizing===1){let t=this.$s;return t===null?2:this.isRow?t.rowSizing:t.columnSizing}return this.sizing}get actual(){return this.q}set actual(t){isNaN(this.ki)?this.q=Math.max(Math.min(this.Yh,t),this.Gh):this.q=Math.max(Math.min(this.Yh,this.ki),this.Gh)}get measured(){return this.Re}set measured(t){this.Re=t}get total(){return this.q+this.computeEffectiveSpacing()}get position(){return this.ct}set position(t){this.ct=t}bind(t,e,i,s){return this.Sf(t,e,i,s),this}bindTwoWay(t,e,i,s){let n=this.Sf(t,e,i,s);return s===void 0&&n.makeTwoWay(),this}theme(t,e,i,s,n){return this.Ca(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.Ca(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofModel(),this}Sf(t,e,i,s){let n;return typeof t=="string"?n=new te(t,e,i,s):n=t,this.m0(n),n}Ca(t,e,i,s,n){let o;return typeof t=="string"?o=new ii(t,e,i,s,n):o=t,this.m0(o),o}m0(t){t.Ti=this;let e=this.panel;if(e!==null){let i=e.findBindingPanel();i!==null&&i.nD()&&m.o("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+t+" on "+e)}this.Fs===null&&(this.Fs=new q),this.Fs.add(t)}}class et extends J{ut;tn;Xd;Hh;Qe;Jo;Ho;Kt;Gd;Yd;K;constructor(t,e){super(),this.ut=null,this.tn=null,this.Xd="None",this.Hh="black",this.Qe="black",this.Jo=1,this.Ho=null,this.Kt=null,this.Gd=NaN,this.Yd=NaN,this.K=null,typeof t=="string"?this.figure=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.ut=this.ut,t.tn=this.tn,t.Xd=this.Xd,t.Hh=this.Hh,t.Qe=this.Qe,t.Jo=this.Jo,this.Ho!==null&&(t.Ho=this.Ho.slice()),this.Kt!==null&&(this.Kt.me?t.Kt=this.Kt:t.Kt=this.Kt.copy()),t.Gd=this.Gd,t.Yd=this.Yd,this.K!==null&&(t.K=this.K.copy())}qh(){return this.Kt===null?this.Kt=new Xi:this.Kt.me&&(this.Kt=this.Kt.copy()),this.Kt}ba(){super.ba(),this.Kt!==null&&(this.Kt.me=!0)}fe(t){t in Ri?this.geometryStretch=t:super.fe(t)}toString(){return"Shape("+(this.figure!=="None"?this.figure:this.toArrow!=="None"?this.toArrow:this.fromArrow)+")#"+V.xs(this)}QI(t,e){let i=this.pathPattern;if(i===null)return;i.ht(1/0,1/0);let s=i.measuredBounds;i.Ut(0,0,s.width,s.height);let n=this.geometry;if(n===null)return;t.save(),t.beginPath();let o=m.st();if(n.type===1)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.endY),this.Kd(t,e,o,i);else if(n.type===4){let r=n.figures.iterator;for(;r.next();){let a=r.value;o.length=0,o.push(a.startX),o.push(a.startY);let h=a.startX,l=a.startY,u=h,c=l,d=a.segments.r,f=d.length;for(let p=0;p<f;p++){let g=d[p];switch(g.type){case 1:this.Kd(t,e,o,i),o.length=0,o.push(g.endX),o.push(g.endY),h=g.endX,l=g.endY,u=h,c=l;break;case 2:o.push(g.endX),o.push(g.endY),h=g.endX,l=g.endY;break;case 3:C.Hn(h,l,g.point1X,g.point1Y,g.point2X,g.point2Y,g.endX,g.endY,.5,o),h=g.endX,l=g.endY;break;case 4:C.sm(h,l,g.point1X,g.point1Y,g.endX,g.endY,.5,o),h=g.endX,l=g.endY;break;case 5:{let y=g.To(a),b=y.length;if(b===0){o.push(g.centerX),o.push(g.centerY),h=g.centerX,l=g.centerY;break}for(let v=0;v<b;v++){let w=y[v];C.Hn(h,l,w[2],w[3],w[4],w[5],w[6],w[7],.5,o),h=w[6],l=w[7]}break}case 6:{let y=g.Za(a,h,l),b=y.length;if(b===0){o.push(g.endX),o.push(g.endY),h=g.endX,l=g.endY;break}for(let v=0;v<b;v++){let w=y[v];C.Hn(h,l,w[2],w[3],w[4],w[5],w[6],w[7],.5,o),h=w[6],l=w[7]}break}default:m.o("Segment not of valid type: "+g.type)}g.isClosed&&(o.push(u),o.push(c),this.Kd(t,e,o,i))}this.Kd(t,e,o,i)}}else if(n.type===2)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.startY),o.push(n.endX),o.push(n.endY),o.push(n.startX),o.push(n.endY),o.push(n.startX),o.push(n.startY),this.Kd(t,e,o,i);else if(n.type===3){let r=new zt;r.startX=n.endX,r.startY=(n.startY+n.endY)/2;let a=new mt(5);a.startAngle=0,a.sweepAngle=360,a.centerX=(n.startX+n.endX)/2,a.centerY=(n.startY+n.endY)/2,a.radiusX=Math.abs(n.startX-n.endX)/2,a.radiusY=Math.abs(n.startY-n.endY)/2,r.add(a);let h=a.To(r),l=h.length;if(l===0)o.push(a.centerX),o.push(a.centerY);else{let u=r.startX,c=r.startY;for(let d=0;d<l;d++){let f=h[d];C.Hn(u,c,f[2],f[3],f[4],f[5],f[6],f[7],.5,o),u=f[6],c=f[7]}}this.Kd(t,e,o,i)}m.Z(o),t.restore(),t.clearContextCache(!1)}_I(t){let e=t.measuredBounds.width;return t instanceof et&&(e-=t.strokeWidth),e<1&&(e=1),e}Kd(t,e,i,s){let n=i.length;if(n<4)return;let o=s.measuredBounds,r=Math.max(1,o.width),a=o.height,h=i[0],l=i[1],u=0,c=0,d=0,f=0,p=0,g=0,y=0,b=0,v=m.st();for(let A=2;A<n;A+=2)u=i[A],c=i[A+1],d=u-h,f=c-l,d===0&&(d=.001),p=f/d,g=Math.atan2(f,d),y=Math.sqrt(d*d+f*f),v.push([d,g,p,y]),b+=y,h=u,l=c;h=i[0],l=i[1];let w=this._I(s),k=w,S=r/2,N=S!==0,D=0,L=v[D];d=L[0],g=L[1],p=L[2],y=L[3];let M=0;for(;b>=.1;){if(M===0&&(N?(k=w,k-=S,b-=S,N=!1):k=w,k===0&&(k=1)),k>b){k=b,m.Z(v);return}k>y?(M=k-y,k=y):M=0;let A=Math.sqrt(k*k/(1+p*p));if(d<0&&(A=-A),h+=A,l+=p*A,t.translate(h,l),t.rotate(g),t.translate(-(r/2),-(a/2)),M===0&&s.Ma(t,e),t.translate(r/2,a/2),t.rotate(-g),t.translate(-h,-l),b-=k,y-=k,M!==0){if(D++,D===v.length){m.Z(v);return}L=v[D],d=L[0],g=L[1],p=L[2],y=L[3],k=M}}m.Z(v)}Ma(t,e){let i=t instanceof re,s=this.Qe,n=this.Hh;if(s===null&&n===null)return;let o=this.ut;if(o===null)return;t.commitTransform();let r=this.actualBounds,a=this.naturalBounds;n!==null&&this.bn(t,n,!0,!1,a,r);let h=this.part,l=this.Jo;s!==null&&l===0&&h!==null&&(this.isPanelMain||h.findMainElement()===this)&&(l=h.tE()),l===0&&(s=null),s!==null&&l!==0&&(this.bn(t,s,!1,!1,a,r),t.lineWidth=l,t.lineJoin=this.strokeJoin,t.lineCap=this.strokeCap,t.miterLimit=this.strokeMiterLimit);let u=!1;h&&e.getRenderingHint("drawShadows")&&(u=h.isShadowed),t.sl===!1&&(u=!1);let c=!0;s!==null&&(n===null||n==="transparent")&&(c=!1);let d=!1,f=this.strokeDashArray;if(f!==null&&(d=!0,t.enableDash(f,this.strokeDashOffset)),o.type===1)t.beginPath(),t.moveTo(o.startX,o.startY),t.lineTo(o.endX,o.endY),s!==null&&t.strokeContext(),t.endPath();else if(o.type===2){let p=o.startX,g=o.startY,y=o.endX,b=o.endY,v=Math.min(p,y),w=Math.min(g,b),k=Math.abs(y-p),S=Math.abs(b-g);t.beginPath(),t.rect(v,w,k,S),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===3){let p=o.startX,g=o.startY,y=o.endX,b=o.endY,v=Math.abs(y-p)/2,w=Math.abs(b-g)/2,k=Math.min(p,y)+v,S=Math.min(g,b)+w;t.beginPath(),t.moveTo(k,S-w),t.bezierCurveTo(k+C.Kn*v,S-w,k+v,S-C.Kn*w,k+v,S),t.bezierCurveTo(k+v,S+C.Kn*w,k+C.Kn*v,S+w,k,S+w),t.bezierCurveTo(k-C.Kn*v,S+w,k-v,S+C.Kn*w,k-v,S),t.bezierCurveTo(k-v,S-C.Kn*w,k-C.Kn*v,S-w,k,S-w),t.closePath(),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===4){let p=o.figures,g=p.length;for(let y=0;y<g;y++){let b=p.r[y];i?(t.beginPath(),this.kD(t,b)):b.Hi===null&&(b.Hi=new Path2D,this.kD(b.Hi,b));let v=b.isFilled;u?b.isShadowed?(v===!0&&n!=="transparent"&&n!==null&&t.fillContext(n,b.isEvenOdd,b.Hi),s!==null&&(v&&c&&t.shadowsOff(),t.stroke(b.Hi),v&&c&&t.shadowsOn())):(t.shadowsOff(),v&&n!=="transparent"&&n!==null&&t.fillContext(n,b.isEvenOdd,b.Hi),s!==null&&t.stroke(b.Hi),t.shadowsOn()):(v&&n!==null&&t.fillContext(n,b.isEvenOdd,b.Hi),s!==null&&t.stroke(b.Hi)),t.endPath(y)}}d&&t.disableDash(),this.QI(t,e)}kD(t,e){t.moveTo(e.startX,e.startY);let i=e.segments.r,s=i.length,n=null;for(let o=0;o<s;o++){let r=i[o];switch(r.type){case 1:t.moveTo(r.endX,r.endY);break;case 2:t.lineTo(r.endX,r.endY);break;case 3:t.bezierCurveTo(r.point1X,r.point1Y,r.point2X,r.point2Y,r.endX,r.endY);break;case 4:t.quadraticCurveTo(r.point1X,r.point1Y,r.endX,r.endY);break;case 5:if(r.radiusX===r.radiusY){let a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY,l=Math.PI/180;t.arc(r.point1X,r.point1Y,r.radiusX,r.startAngle*l,(r.startAngle+r.sweepAngle)*l,r.sweepAngle<0,a,h)}else{let a=r.To(e),h=a.length;if(h===0){t.lineTo(r.centerX,r.centerY);break}for(let l=0;l<h;l++){let u=a[l];l===0&&t.lineTo(u[0],u[1]),t.bezierCurveTo(u[2],u[3],u[4],u[5],u[6],u[7])}}break;case 6:{let a=0,h=0,l;if(n!==null&&n.type===5){l=n.To(e);let c=l.length;if(c===0){t.lineTo(r.endX,r.endY);break}let d=l[c-1]||null;d!==null&&(a=d[6],h=d[7])}else a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY;l=r.Za(e,a,h);let u=l.length;if(u===0){t.lineTo(r.endX,r.endY);break}for(let c=0;c<u;c++){let d=l[c];t.bezierCurveTo(d[2],d[3],d[4],d[5],d[6],d[7])}break}}r.isClosed&&t.closePath(),n=r}}wf(t,e,i){if(!super.wf(t,e,i)||this.Qe===null&&this.Hh===null||this.ut===null||this.pathPattern!==null)return!1;let s=this.svg.getElementsByTagName("path");return this.geometry.figures.length!==s.length?!1:(t.currentPath=this.svg,this.Ma(t,e),t.currentPath=null,!0)}Sd(t){return this.geometry!==null&&this.geometry.figures.length>1||this.pathPattern!==null?!0:super.Sd(t)}CN(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("path");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof T){let i=t;i.isNoSpot()&&m.o("getDocumentPoint Spot must be a real, specific Spot, not: "+i.toString());let s=this.naturalBounds,n=this.strokeWidth;return e.e(i.x*(s.width+n)-n/2+s.x+i.offsetX,i.y*(s.height+n)-n/2+s.y+i.offsetY),this.Ws.gt(e),e}else return e.set(t),this.Ws.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new I);let e=this.naturalBounds,i=this.Ws,s=I.z(e.x,e.y,e.width,e.height),n=this.strokeWidth;s.inflate(n/2,n/2);let o=P.z(s.x,s.y).v(i);return t.e(o.x,o.y,0,0),o.e(s.right,s.y).v(i),t.re(o.x,o.y,0,0),o.e(s.right,s.bottom).v(i),t.re(o.x,o.y,0,0),o.e(s.x,s.bottom).v(i),t.re(o.x,o.y,0,0),I.i(s),P.i(o),t}ka(t,e){let i=this.geometry;if(i===null||this.fill===null&&this.stroke===null)return!1;let s=i.bounds,n=this.strokeWidth/2;i.type===1&&!e&&(n+=2);let o=I.l();if(o.h(s),o.inflate(n+2,n+2),!o.containsPoint(t))return I.i(o),!1;let r=n+1e-4;if(i.type===1){if(this.stroke===null)return!1;let a=(i.startX-i.endX)*(t.x-i.endX)+(i.startY-i.endY)*(t.y-i.endY),h=(i.endX-i.startX)*(t.x-i.startX)+(i.endY-i.startY)*(t.y-i.startY);return a<0||h<0?!1:(I.i(o),C.Ve(i.startX,i.startY,i.endX,i.endY,n,t.x,t.y))}else if(i.type===2){let a=i.startX,h=i.startY,l=i.endX,u=i.endY;if(o.x=Math.min(a,l),o.y=Math.min(h,u),o.width=Math.abs(l-a),o.height=Math.abs(u-h),this.fill===null){if(o.inflate(-r,-r),o.containsPoint(t))return I.i(o),!1;o.inflate(r,r)}this.stroke!==null&&o.inflate(n,n);let c=o.containsPoint(t);return I.i(o),c}else if(i.type===3){let a=i.startX,h=i.startY,l=i.endX,u=i.endY,c=Math.min(a,l),d=Math.min(h,u),f=Math.abs(l-a),p=Math.abs(u-h),g=f/2,y=p/2;if(c=t.x-(c+g),d=t.y-(d+y),this.fill===null){if(g-=r,y-=r,g<=0||y<=0||c*c/(g*g)+d*d/(y*y)<=1)return I.i(o),!1;g+=r,y+=r}return this.stroke!==null&&(g+=r,y+=r),I.i(o),g<=0||y<=0?!1:c*c/(g*g)+d*d/(y*y)<=1}else{if(i.type===4)return I.i(o),this.fill===null?i.ZL(t.x,t.y,n):i.IP(t,n,this.strokeWidth>1,e);m.o("Unknown Geometry type: "+i.type)}}kd(t,e,i,s){let n=this.desiredSize,o=this.Jo;t=Math.max(t,0),e=Math.max(e,0);let r;if(this.tn!==null)r=this.geometry.bounds;else{let p=this.figure,g=et.eC[p];if(g===void 0){let y=C.qn[p];typeof y=="string"&&(y=C.qn[y]),m.it(y)?(g=y(null,100,100),et.eC[p]=g):m.o("Unsupported Figure: "+p)}r=g.bounds}let a=r.width,h=r.height,l=r.width,u=r.height;switch(this.Zs(!0)){case 0:i=0,s=0;break;case 2:l=Math.max(t-o,0),u=Math.max(e-o,0);break;case 5:l=Math.max(t-o,0),s=0;break;case 4:i=0,u=Math.max(e-o,0);break}isFinite(n.width)&&(l=n.width),isFinite(n.height)&&(u=n.height);let c=this.maxSize,d=this.minSize;i=Math.max(i-o,d.width),s=Math.max(s-o,d.height),l=Math.min(c.width,l),u=Math.min(c.height,u),l=isFinite(l)?Math.max(i,l):Math.max(a,i),u=isFinite(u)?Math.max(s,u):Math.max(h,s);let f=this.QS();switch(f){case 0:break;case 2:a=l,h=u;break;case 6:{let p=Math.min(l/a,u/h);isFinite(p)||(p=1),a=a*p,h=h*p;break}default:m.o(f+" is not a valid geometryStretch.")}if(this.tn!==null){a===0&&(a=.001),h===0&&(h=.001);let p=this.tn.sR(a,h);this.ut=p}else(this.ut===null||!C.X(this.ut.Sc,t-o)||!C.X(this.ut.Mc,e-o))&&(this.ut=et.eE(this,a,h));r=this.ut.bounds,t===1/0||e===1/0?this.no(r.x-o/2,r.y-o/2,t===0&&a===0?0:r.width+o,e===0&&h===0?0:r.height+o):this.no(-(o/2),-(o/2),l+o,u+o),n.isReal()?(l=n.width,u=n.height,l=Math.min(c.width,l),u=Math.min(c.height,u),l=Math.max(d.width,l),u=Math.max(d.height,u),this.Ke.e(0,0,l,u)):this.Ke.h(r)}QS(){let t=this.geometryStretch;return this.tn!==null?t===1?2:t:t===1?et.eC[this.figure].defaultStretch:t}Pa(t,e,i,s){this.commonArrange(t,e,i,s)}getNearestIntersectionPoint(t,e,i){return this.pf(t.x,t.y,e.x,e.y,i)}pf(t,e,i,s,n){let o=this.v,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),f=t*a+e*l+c,p=t*h+e*u+d,g=i*a+s*l+c,y=i*h+s*u+d,b=this.Jo/2,v=this.ut;v===null&&(this.ht(1/0,1/0),v=this.ut);let w=v.bounds,k=!1;if(v.type===1)if(this.strokeWidth<=1.5)k=C.Ao(v.startX,v.startY,v.endX,v.endY,f,p,g,y,n);else{let S=0,N=0;if(v.startX===v.endX)S=b,N=0;else{let F=(v.endY-v.startY)/(v.endX-v.startX);N=b/Math.sqrt(1+F*F),S=N*F}let D=m.st(),L=new P;C.Ao(v.startX+S,v.startY+N,v.endX+S,v.endY+N,f,p,g,y,L)&&D.push(L),L=new P,C.Ao(v.startX-S,v.startY-N,v.endX-S,v.endY-N,f,p,g,y,L)&&D.push(L),L=new P,C.Ao(v.startX+S,v.startY+N,v.startX-S,v.startY-N,f,p,g,y,L)&&D.push(L),L=new P,C.Ao(v.endX+S,v.endY+N,v.endX-S,v.endY-N,f,p,g,y,L)&&D.push(L);let M=D.length;if(M===0)return m.Z(D),!1;k=!0;let A=1/0;for(let F=0;F<M;F++){let O=D[F],E=(O.x-f)**2+(O.y-p)**2;E<A&&(A=E,n.x=O.x,n.y=O.y)}m.Z(D)}else if(v.type===2)k=C.Cl(w.x-b,w.y-b,w.x+w.width+b,w.y+w.height+b,f,p,g,y,n);else if(v.type===3){let S=I.z(w.x,w.y,w.width,w.height).inflate(b,b);k=this.iE(S,f,p,g,y,n),I.i(S)}else if(v.type===4){let S=0,N=0,D=0,L=0,M=P.l(),A=g-f,F=y-p,O=A*A+F*F,E=f,B=p;if(O>0&&w.contains(E,B)&&(M.x=E,M.y=B,this.containsPoint(M)))for(A!==0&&Math.abs(A)<.5?(F*=.5/A,A=.5):F!==0&&Math.abs(F)<.5&&(A*=.5/F,F=.5),E-=A,B-=F;w.contains(E,B);)E-=A,B-=F;let X=.6;n.x=g,n.y=y;for(let nt=0;nt<v.figures.count;nt++){let Z=v.figures.r[nt],it=Z.isFilled?E:f,_=Z.isFilled?B:p,at=Z.segments;S=Z.startX,N=Z.startY;let ct=S,yt=N;for(let Ct=0;Ct<at.count;Ct++){let Q=at.r[Ct],St=Q.type;D=Q.endX,L=Q.endY;let xt=!1;switch(St){case 1:ct=D,yt=L;break;case 2:xt=this.$1(S,N,D,L,it,_,g,y,M);break;case 3:{xt=C.nm(S,N,Q.point1X,Q.point1Y,Q.point2X,Q.point2Y,D,L,it,_,g,y,X,M);break}case 4:{xt=C.nm(S,N,S+2/3*(Q.point1X-S),N+2/3*(Q.point1Y-N),D+2/3*(Q.point1X-D),L+2/3*(Q.point1Y-L),D,L,it,_,g,y,X,M);break}case 5:case 6:{let Yt=Q.type===5?Q.To(Z):Q.Za(Z,S,N),ot=Yt.length;if(ot===0){xt=this.$1(S,N,Q.type===5?Q.centerX:Q.endX,Q.type===5?Q.centerY:Q.endY,it,_,g,y,M);break}let W=null;for(let ft=0;ft<ot;ft++){if(W=Yt[ft],ft===0&&this.$1(S,N,W[0],W[1],it,_,g,y,M)){let At=this.Z1(it,_,M,O,n);At<O&&(O=At,k=!0)}if(C.nm(W[0],W[1],W[2],W[3],W[4],W[5],W[6],W[7],it,_,g,y,X,M)){let At=this.Z1(it,_,M,O,n);At<O&&(O=At,k=!0)}}D=W[6],L=W[7];break}default:m.o("Unknown Segment type: "+St)}if(S=D,N=L,xt){let Yt=this.Z1(it,_,M,O,n);Yt<O&&(O=Yt,k=!0)}if(Q.isClosed&&(D=ct,L=yt,this.$1(S,N,D,L,it,_,g,y,M))){let Yt=this.Z1(it,_,M,O,n);Yt<O&&(O=Yt,k=!0)}}}let z=i-t,U=s-e,tt=Math.sqrt(z*z+U*U);tt!==0&&(z/=tt,U/=tt),n.x-=z*b,n.y-=U*b,P.i(M)}else m.o("Unknown Geometry type: "+v.type);return k?(this.v.gt(n),!0):!1}Z1(t,e,i,s,n){let o=i.x-t,r=i.y-e,a=o*o+r*r;return a<s?(n.x=i.x,n.y=i.y,a):s}$1(t,e,i,s,n,o,r,a,h){if(C.X(t,i)&&C.X(e,s)||C.X(n,r)&&C.X(o,a))return!1;let l=!1,u=(n-r)*(e-s)-(o-a)*(t-i);if(u===0)return!1;if(h.x=((n*a-o*r)*(t-i)-(n-r)*(t*s-e*i))/u,h.y=((n*a-o*r)*(e-s)-(o-a)*(t*s-e*i))/u,(t>i?t-i:i-t)<(e>s?e-s:s-e)){let c=e<s?e:s,d=e<s?s:e;(h.y>c||C.X(h.y,c))&&(h.y<d||C.X(h.y,d))&&(l=!0)}else{let c=t<i?t:i,d=t<i?i:t;(h.x>c||C.X(h.x,c))&&(h.x<d||C.X(h.x,d))&&(l=!0)}return l}sE(t,e,i){return this.pickable===!1?!1:(i.kc(this.v),e?this.nE(t,i):this.containedInRect(t,i))}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.ut;i===null&&(this.ht(1/0,1/0),i=this.ut);let s=i.bounds,n=this.strokeWidth/2,o=!1,r=P.l();return r.e(s.x-n,s.y-n),t.containsPoint(e.gt(r))&&(r.e(s.x-n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.e(s.right+n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.e(s.right+n,s.y-n),t.containsPoint(e.gt(r))&&(o=!0)))),P.i(r),o}intersectsRect(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.v,t.containsRect(this.actualBounds)))return!0;let i=Nt.l();i.set(e),i.Qw();let s=t.left,n=t.right,o=t.top,r=t.bottom,a=P.l();if(a.e(s,o),i.gt(a),this.ka(a,!0)||(a.e(n,o),i.gt(a),this.ka(a,!0))||(a.e(s,r),i.gt(a),this.ka(a,!0))||(a.e(n,r),i.gt(a),this.ka(a,!0)))return P.i(a),!0;let h=P.l(),l=P.l();i.set(e),i.zL(this.v),i.Qw(),h.x=n,h.y=o,h.v(i),a.x=s,a.y=o,a.v(i);let u=!1;return this.jh(a,h,l)?u=!0:(a.x=n,a.y=r,a.v(i),this.jh(a,h,l)?u=!0:(h.x=s,h.y=r,h.v(i),this.jh(a,h,l)?u=!0:(a.x=s,a.y=o,a.v(i),this.jh(a,h,l)&&(u=!0)))),P.i(a),Nt.i(i),P.i(h),P.i(l),u}jh(t,e,i){if(!this.getNearestIntersectionPoint(t,e,i))return!1;let s=t.x,n=t.y,o=e.x,r=e.y,a=i.x,h=i.y;if(s===o){let l=0,u=0;return n<r?(l=n,u=r):(l=r,u=n),h>=l&&h<=u}else{let l=0,u=0;return s<o?(l=s,u=o):(l=o,u=s),a>=l&&a<=u}}nE(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.v,t.containsRect(this.actualBounds)))return!0;let i=t.left,s=t.right,n=t.top,o=t.bottom,r=P.l(),a=P.l(),h=P.l(),l=Nt.l();l.set(e),l.zL(this.v),l.Qw(),a.x=s,a.y=n,a.v(l),r.x=i,r.y=n,r.v(l);let u=!1;return this.jh(r,a,h)?u=!0:(r.x=s,r.y=o,r.v(l),this.jh(r,a,h)?u=!0:(a.x=i,a.y=o,a.v(l),this.jh(r,a,h)?u=!0:(r.x=i,r.y=n,r.v(l),this.jh(r,a,h)&&(u=!0)))),Nt.i(l),P.i(r),P.i(a),P.i(h),u}$T(t,e,i){if(i&&this.fill!==null&&this.ka(t,!0))return!0;let s=t.distanceSquaredPoint(e),n=s;this.strokeWidth>1.5&&(s=this.strokeWidth/2+Math.sqrt(s),s*=s);let o=this.ut;if(o===null&&(this.ht(1/0,1/0),o=this.ut,o===null))return!1;if(!i){let c=o.bounds,d=c.x,f=c.y,p=c.x+c.width,g=c.y+c.height;if(P.distanceSquared(t.x,t.y,d,f)<=s&&P.distanceSquared(t.x,t.y,p,f)<=s&&P.distanceSquared(t.x,t.y,d,g)<=s&&P.distanceSquared(t.x,t.y,p,g)<=s)return!0}function r(c,d){let f=c.length;for(let p=0;p<f;p+=2)if(d.distanceSquared(c[p],c[p+1])>s)return!0;return!1}let a=o.startX,h=o.startY,l=o.endX,u=o.endY;if(o.type===1){let c=P.distanceLineSegmentSquared(t.x,t.y,a,h,l,u),d=(l-a)*(t.x-a)+(u-h)*(t.y-h),f=(a-l)*(t.x-l)+(h-u)*(t.y-u),p=d>=0&&f>=0?s:n;return c<=p}else if(o.type===2){let c=!1;return i&&(c=P.distanceLineSegmentSquared(t.x,t.y,a,h,a,u)<=s||P.distanceLineSegmentSquared(t.x,t.y,a,h,l,h)<=s||P.distanceLineSegmentSquared(t.x,t.y,l,h,l,u)<=s||P.distanceLineSegmentSquared(t.x,t.y,a,u,l,u)<=s),c}else if(o.type===3){let c=(a+l)/2,d=(h+u)/2,f=t.x-c,p=t.y-d,g=Math.abs(l-a)/2,y=Math.abs(u-h)/2;if(g===0||y===0)return P.distanceLineSegmentSquared(t.x,t.y,a,h,l,u)<=s;if(i){let b=C.WF(g,y,f,p);return b*b<=s}else return!(P.distanceSquared(f,p,-g,0)>=s||P.distanceSquared(f,p,0,-y)>=s||P.distanceSquared(f,p,0,y)>=s||P.distanceSquared(f,p,g,0)>=s)}else if(o.type===4){let c=o.bounds,d=c.x,f=c.y,p=c.x+c.width,g=c.y+c.height;if(t.x>p&&t.x<d&&t.y>g&&t.y<f&&P.distanceLineSegmentSquared(t.x,t.y,d,f,d,g)>s&&P.distanceLineSegmentSquared(t.x,t.y,d,f,p,f)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,g,d,g)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,g,p,f)>s)return!1;let y=Math.sqrt(s);if(i){if(this.fill===null?o.ZL(t.x,t.y,y):o.IP(t,y,!0,!1))return!0}else{let b=o.figures;for(let v=0;v<b.count;v++){let w=b.r[v],k=w.startX,S=w.startY;if(t.distanceSquared(k,S)>s)return!1;let N=w.segments.r,D=N.length;for(let L=0;L<D;L++){let M=N[L];switch(M.type){case 1:case 2:if(k=M.endX,S=M.endY,t.distanceSquared(k,S)>s)return!1;break;case 3:{let A=m.st();C.Hn(k,S,M.point1X,M.point1Y,M.point2X,M.point2Y,M.endX,M.endY,.8,A);let F=r(A,t);if(m.Z(A),F||(k=M.endX,S=M.endY,t.distanceSquared(k,S)>s))return!1;break}case 4:{let A=m.st();C.sm(k,S,M.point1X,M.point1Y,M.endX,M.endY,.8,A);let F=r(A,t);if(m.Z(A),F||(k=M.endX,S=M.endY,t.distanceSquared(k,S)>s))return!1;break}case 5:case 6:{let A=M.type===5?M.To(w):M.Za(w,k,S),F=A.length;if(F===0){if(k=M.type===5?M.centerX:M.endX,S=M.type===5?M.centerY:M.endY,t.distanceSquared(k,S)>s)return!1;break}let O=null,E=m.st();for(let B=0;B<F;B++)if(O=A[B],E.length=0,C.Hn(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],.8,E),r(E,t))return m.Z(E),!1;m.Z(E),O!==null&&(k=O[6],S=O[7]);break}default:m.o("Unknown Segment type: "+M.type)}}}return!0}}return!1}iE(t,e,i,s,n,o){if(t.width===0)return C.Ao(t.x,t.y,t.x,t.y+t.height,e,i,s,n,o);if(t.height===0)return C.Ao(t.x,t.y,t.x+t.width,t.y,e,i,s,n,o);{let r=t.width/2,a=t.height/2,h=t.x+r,l=t.y+a,u=9999;if(e!==s&&(u=(i-n)/(e-s)),Math.abs(u)<9999){let c=i-l-u*(e-h);if(r*r*(u*u)+a*a-c*c<0)return o.x=NaN,o.y=NaN,!1;let d=Math.sqrt(r*r*(u*u)+a*a-c*c),f=(-(r*r*u*c)+r*a*d)/(a*a+r*r*(u*u))+h,p=(-(r*r*u*c)-r*a*d)/(a*a+r*r*(u*u))+h,g=u*(f-h)+c+l,y=u*(p-h)+c+l,b=Math.abs((e-f)**2)+Math.abs((i-g)**2),v=Math.abs((e-p)**2)+Math.abs((i-y)**2);b<v?(o.x=f,o.y=g):(o.x=p,o.y=y)}else{let c=a*a,d=r*r,f=e-h,p=c-c/d*(f*f);if(p<0)return o.x=NaN,o.y=NaN,!1;let g=Math.sqrt(p),y=l+g,b=l-g,v=Math.abs(y-i),w=Math.abs(b-i);v<w?(o.x=e,o.y=y):(o.x=e,o.y=b)}return!0}}qI(){return this.Jo/2*this.strokeMiterLimit*this.getDocumentScale()}get geometry(){return this.ut!==null?this.ut:this.tn}set geometry(t){let e=this.ut,i=this.tn;if(e===t)return;t!==null?(this.ut=t.k(),this.tn=this.ut):(this.ut=null,this.tn=null);let s=this.part;if(s!==null&&s.Df(),this.f(),this.t("geometry",e||i,t),this.mf()){let n=this.part;n!==null&&this.Uh(n,"geometryString")}}get geometryString(){return this.geometry===null?"":this.geometry.toString()}set geometryString(t){let e=wt.parse(t),i=e.normalize();this.geometry=e;let s=P.z(-i.x,-i.y);this.position=s,P.i(s)}get isGeometryPositioned(){return(this.n&1048576)!==0}set isGeometryPositioned(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.f(),this.t("isGeometryPositioned",e,t))}ai(){this.ut=null}get fill(){return this.Hh}set fill(t){let e=this.Hh;e!==t&&(t!==null&&R.Nd(t,"Shape.fill"),t instanceof R&&t.k(),this.Hh=t,this.C(),this.t("fill",e,t))}get stroke(){return this.Qe}set stroke(t){let e=this.Qe;e!==t&&(t!==null&&R.Nd(t,"Shape.stroke"),t instanceof R&&t.k(),this.Qe=t,this.C(),this.t("stroke",e,t))}get strokeWidth(){return this.Jo}set strokeWidth(t){let e=this.Jo;if(e!==t)if(t>=0){this.Jo=t,this.f();let i=this.part;i!==null&&i.Df(),this.t("strokeWidth",e,t)}else m.J(t,"value >= 0",et,"strokeWidth:value")}Yp(){return this.Jo}get strokeCap(){return this.Kt!==null?this.Kt.z0:"butt"}set strokeCap(t){let e=this.strokeCap;e!==t&&(typeof t=="string"&&(t==="butt"||t==="round"||t==="square")?(this.qh().z0=t,this.C(),this.t("strokeCap",e,t)):m.J(t,'"butt", "round", or "square"',et,"strokeCap"))}get strokeJoin(){return this.Kt!==null?this.Kt.X0:"miter"}set strokeJoin(t){let e=this.strokeJoin;e!==t&&(typeof t=="string"&&(t==="miter"||t==="bevel"||t==="round")?(this.qh().X0=t,this.C(),this.t("strokeJoin",e,t)):m.J(t,'"miter", "bevel", or "round"',et,"strokeJoin"))}get strokeMiterLimit(){return this.Kt!==null?this.Kt.G0:10}set strokeMiterLimit(t){let e=this.strokeMiterLimit;if(e!==t&&t>=1){this.qh().G0=t,this.C();let i=this.part;i!==null&&i.Df(),this.t("strokeMiterLimit",e,t)}}get strokeDashArray(){return this.Ho}set strokeDashArray(t){let e=this.Ho;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",et,"strokeDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(!(o>=0)||!isFinite(o))&&m.o("strokeDashArray:value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Ho=t,this.C(),this.t("strokeDashArray",e,t)}}get strokeDashOffset(){return this.Kt!==null?this.Kt.La:0}set strokeDashOffset(t){let e=this.strokeDashOffset;e!==t&&t>=0&&(this.qh().La=t,this.C(),this.t("strokeDashOffset",e,t))}get figure(){return this.Xd}set figure(t){let e=this.Xd;if(e!==t){let i=C.qn[t];if(m.it(i)?i=t:(i=C.qn[t.toLowerCase()],(!i||typeof i=="function")&&m.o("Unknown Shape.figure: "+t)),e!==i){let s=this.part;s!==null&&s.Df(),this.Xd=i,this.tn=null,this.ai(),this.f(),this.t("figure",e,i)}}}get toArrow(){return this.Ot!==null?this.Ot.Y0:"None"}set toArrow(t){let e=this.toArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=et.PD(t);i===null?m.o("Unknown Shape.toArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new Re),this.Ot.Y0=i,this.tn=null,this.ai(),this.f(),this.SD(i),this.t("toArrow",e,i))}}get fromArrow(){return this.Ot!==null?this.Ot.K0:"None"}set fromArrow(t){let e=this.fromArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=et.PD(t);i===null?m.o("Unknown Shape.fromArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new Re),this.Ot.K0=i,this.tn=null,this.ai(),this.f(),this.SD(i),this.t("fromArrow",e,i))}}SD(t){let e=this.diagram;e!==null&&e.undoManager.isUndoingRedoing||(this.mI(),this.toArrow!=="None"?(this.segmentIndex=-1,this.alignmentFocus=T.Right):this.fromArrow!=="None"&&(this.segmentIndex=0,this.alignmentFocus=T.Left))}get spot1(){return this.Kt!==null?this.Kt.jn:T.Default}set spot1(t){let e=this.spot1;e.equals(t)||(t=t.N(),this.qh().jn=t,this.f(),this.t("spot1",e,t))}get spot2(){return this.Kt!==null?this.Kt.Wn:T.Default}set spot2(t){let e=this.spot2;e.equals(t)||(t=t.N(),this.qh().Wn=t,this.f(),this.t("spot2",e,t))}get parameter1(){return this.Gd}set parameter1(t){let e=this.Gd;e!==t&&(this.Gd=t,this.ai(),this.f(),this.t("parameter1",e,t))}get parameter2(){return this.Yd}set parameter2(t){let e=this.Yd;e!==t&&(this.Yd=t,this.ai(),this.f(),this.t("parameter2",e,t))}get naturalBounds(){return this.Ke}EI(){let t=this.desiredSize;if(!t.isReal()&&this.ut!==null){let e=this.ut.bounds;this.Ke.h(e)}else this.Ke.e(0,0,t.width,t.height)}get pathPattern(){return this.Kt!==null?this.Kt.H0:null}set pathPattern(t){let e=this.pathPattern;e!==t&&(this.qh().H0=t,this.C(),this.t("pathPattern",e,t))}get geometryStretch(){return this.Kt!==null?this.Kt.q0:1}set geometryStretch(t){let e=this.geometryStretch;e!==t&&(this.qh().q0=t,this.f(),this.t("geometryStretch",e,t))}get interval(){return this.K!==null?this.K.Ff:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new xe),this.K.Ff=t;let i=this.diagram;i!==null&&this.panel===i.grid&&i.ca(),this.C(),this.f();let s=this.panel;s!==null&&(s.ds=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.Rf:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Rf=t,this.f(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.Of:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Of=t,this.f(),this.t("graduatedEnd",e,t))}get graduatedSkip(){return this.K!==null?this.K.If:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&m.S(t,et,"graduatedSkip"),this.K===null&&(this.K=new xe),this.K.If=t,this.f(),this.t("graduatedSkip",e,t))}polygonContainsRect(t){let e=this;if(!e.part||!e.part.actualBounds.containsRect(t))return!1;let i=e.geometry;if(!i)return!1;let s=t.x,n=t.y,o=t.width,r=t.height,a=P.l();if(a.x=s,a.y=n,e.getLocalPoint(a,a),!i.containsPoint(a)||o>0&&r>0&&(a.x=s+o,a.y=n+r,e.getLocalPoint(a,a),!i.containsPoint(a))||o>0&&(a.x=s+o,a.y=n,e.getLocalPoint(a,a),!i.containsPoint(a))||r>0&&(a.x=s,a.y=n+r,e.getLocalPoint(a,a),!i.containsPoint(a))||i.type===1)return!1;if(i.type===4){let h=i.figures.iterator;for(;h.next();){let l=h.value;if(!l.isFilled)continue;a.x=l.startX,a.y=l.startY,e.getDocumentPoint(a,a);let u=a.x,c=a.y,d=u,f=c,p=u,g=c,y=l.segments.iterator;for(;y.next();){let b=y.value;if(a.x=b.endX,a.y=b.endY,e.getDocumentPoint(a,a),p=a.x,g=a.y,b.type===1)u=p,c=g;else if(b.type!==5&&(I.intersectsLineSegment(s,n,o,r,d,f,p,g)||b.isClosed&&I.intersectsLineSegment(s,n,o,r,p,g,u,c)))return!1;d=p,f=g}}}return P.i(a),!0}static eE(t,e,i){let s=null;if(t.toArrow!=="None")s=et.Tn[t.toArrow];else if(t.fromArrow!=="None")s=et.Tn[t.fromArrow];else{let n=C.qn[t.figure];typeof n=="string"&&(n=C.qn[n]),n===void 0&&m.o("Unknown Shape.figure: "+t.figure),s=n(t,e,i),s.Sc=e,s.Mc=i}if(s===null){let n=C.qn.Rectangle;m.it(n)&&(s=n(t,e,i))}return s}static getFigureGenerators(){let t=new Mt;for(let e in C.qn){if(e===e.toLowerCase())continue;let i=C.qn[e];t.set(e,i)}return t.k(),t}static defineFigureGenerator(t,e){m.s(t,"string",et,"defineFigureGenerator:name"),typeof e=="string"||m.S(e,et,"defineFigureGenerator:func");let i=t.toLowerCase(),s=C.qn;s[t]=e,s[i]=t}static isFigureDefined(t){return t in C.qn}static getArrowheadGeometries(){let t=new Mt;for(let e in C.rm)if(et.Tn[e]===void 0){let i=wt.parse(C.rm[e],!1);et.Tn[e]=i;let s=e.toLowerCase();s!==e&&(et.Tn[s]=e)}for(let e in et.Tn){if(e===e.toLowerCase())continue;let i=et.Tn[e];i instanceof wt&&t.set(e,i)}return t.k(),t}static defineArrowheadGeometry(t,e){m.s(t,"string",et,"defineArrowheadGeometry:name");let i=null;typeof e=="string"?(m.s(e,"string",et,"defineArrowheadGeometry:pathstr"),i=wt.parse(e,!1)):i=e;let s=t.toLowerCase();(s==="none"||t===s)&&m.o("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+t);let n=et.Tn;n[t]=i,n[s]=t}static isArrowheadDefined(t){return et.Tn.has(t)}static Tn=new bt;static eC=new bt;static PD(t){let e=et.Tn[t];if(e===void 0){let i=t.toLowerCase();if(i==="none")return"None";if(e=et.Tn[i],e===void 0){let s=null;for(let n in C.rm)if(n.toLowerCase()===i){s=n;break}if(s!==null){let n=wt.parse(C.rm[s],!1);return et.Tn[s]=n,i!==s&&(et.Tn[i]=s),s}}}return typeof e=="string"?e:e instanceof wt?t:null}}class Xi{me;z0;X0;G0;La;H0;q0;jn;Wn;constructor(){this.me=!1,this.z0="butt",this.X0="miter",this.G0=10,this.La=0,this.H0=null,this.q0=1,this.jn=T.Default,this.Wn=T.Default}copy(){let t=new Xi;return t.z0=this.z0,t.X0=this.X0,t.G0=this.G0,t.La=this.La,t.H0=this.H0,t.q0=this.q0,t.jn=this.jn.N(),t.Wn=this.Wn.N(),t}}var Ki=(x=>(x[x.None=0]="None",x[x.Fit=1]="Fit",x[x.DesiredSize=2]="DesiredSize",x[x.BreakAll=3]="BreakAll",x))(Ki||{}),js=(x=>(x[x.Clip=0]="Clip",x[x.Ellipsis=1]="Ellipsis",x))(js||{}),Yi=(x=>(x[x.Trim=0]="Trim",x[x.None=1]="None",x))(Yi||{});class lt extends J{ue;Qe;Dn;Pi;pe;Kp;Hd;K;tt;Xl;co;vn;Ii;ye;Fn;constructor(t,e){return super(),lt.k0===!1&&(lt.k0=!0,lt.us=Y.isUsingDOM()?new Fe(null)._t:null),this.n|=2097152,this.ue="",this.Qe="black",this.Dn="13px sans-serif",this.Pi=0,this.pe=0,this.Kp=0,this.Hd=null,this.K=null,this.tt=null,this.Xl=0,this.co=null,this.vn=0,this.Ii=null,this.ye=null,this.Fn=null,typeof t=="string"?this.text=t:t&&Object.assign(this,t),e&&Object.assign(this,e),this}cloneProtected(t){super.cloneProtected(t),t.ue=this.ue,t.Qe=this.Qe,t.Dn=this.Dn,t.Pi=this.Pi,t.pe=this.pe,t.Kp=this.Kp,t.Hd=this.Hd,this.K!==null&&(t.K=this.K.copy()),this.tt!==null&&(this.tt.me?t.tt=this.tt:t.tt=this.tt.copy()),t.Xl=this.Xl,t.co=this.co,t.vn=this.vn,t.Ii=this.Ii,t.ye=this.ye,t.Fn=this.Fn}Rs(){return this.tt===null?this.tt=new Ui:this.tt.me&&(this.tt=this.tt.copy()),this.tt}ba(){super.ba(),this.tt!==null&&(this.tt.me=!0)}YI(t){this.n=t.n|2048|4096,this.Zt=t.opacity,this.Ct=t.background,this.cs=t.desiredSize.N(),this.minSize=t.minSize.N(),this.maxSize=t.maxSize.N(),t.Se!==null?this.Se=t.Se.copy():this.Se=null,this.et=t.scale,this.Xt=t.angle,this.stretch=t.stretch,this.tl=t.margin.N(),this.de=t.alignment.N(),this.xd=t.alignmentFocus.N(),this.segmentFraction=t.segmentFraction,this.segmentOffset=t.segmentOffset.N(),this.segmentOrientation=t.segmentOrientation,t.he!==null&&(this.he=t.he.copy()),this.shadowVisible=t.shadowVisible,this.ue=t.ue,this.Qe=t.Qe,this.Dn=t.Dn,this.K!==null&&(this.K=t.K.copy()),t.tt!==null&&(t.tt.me?this.tt=t.tt:this.tt=t.tt.copy()),this.Xl=t.Xl}XI(t){if(this.ue=t.text||"",this.Xt=t.labelAngle||0,this.Pi=t.lineCount||0,this.oE(t.lines),t.naturalBounds&&(this.Ke=t.naturalBounds),t.actualBounds){let e=t.actualBounds;this.Ut(e.x,e.y,e.width,e.height)}}fe(t){t in Ki?this.wrap=t:super.fe(t)}toString(){return this.ue.length>22?'TextBlock("'+this.ue.substring(0,20)+'"...)':'TextBlock("'+this.ue+'")'}static getEllipsis(){return lt.j0}static setEllipsis(t){lt.j0=t,lt.Q1=new bt,lt.iC=0}static getBaseline(){return lt._1}static setBaseline(t){lt._1=t}static _1=null;static getUnderline(){return lt.tk}static setUnderline(t){lt.tk=t}static tk=null;static None=0;static WrapFit=1;static WrapDesiredSize=2;static WrapBreakAll=3;static OverflowClip=0;static OverflowEllipsis=1;static FormatTrim=0;static FormatNone=1;f(){super.f(),this.Ji(!0)}get font(){return this.Dn}set font(t){let e=this.Dn;e!==t&&(this.Dn=t,this.co=null,this.f(),this.t("font",e,t))}static isValidFont(t){return K.CSS?K.CSS.supports("font",t):!0}get text(){return this.ue}set text(t){let e=this.ue;t!=null?t=t.toString():t="",e!==t&&(this.ue=t,this.f(),this.t("text",e,t))}get textAlign(){return this.tt!==null?this.tt.W0:"start"}set textAlign(t){let e=this.textAlign;e!==t&&(t==="start"||t==="end"||t==="left"||t==="right"||t==="center")&&(this.Rs().W0=t,this.C(),this.t("textAlign",e,t))}get flip(){return this.tt!==null?this.tt.fo:0}set flip(t){let e=this.flip;e!==t&&(this.Rs().fo=t,this.C(),this.t("flip",e,t))}get verticalAlignment(){return this.tt!==null?this.tt.rl:T.Top}set verticalAlignment(t){let e=this.verticalAlignment;e.equals(t)||(t=t.N(),this.Rs().rl=t,this.Pf(),this.t("verticalAlignment",e,t))}get naturalBounds(){if(!this.Ke.isReal()){let t=st.l();this.sC(this.ue,999999,t);let e=t.width;st.i(t);let i=this.MD(e),s=this.desiredSize;isNaN(s.width)||(e=s.width),isNaN(s.height)||(i=s.height),this.Ke.Yn(e,i)}return this.Ke}get isMultiline(){return(this.n&2097152)!==0}set isMultiline(t){let e=(this.n&2097152)!==0;e!==t&&(this.n=this.n^2097152,this.f(),this.t("isMultiline",e,t))}get isUnderline(){return(this.n&4194304)!==0}set isUnderline(t){let e=(this.n&4194304)!==0;e!==t&&(this.n=this.n^4194304,this.Ji(!0),this.C(),this.t("isUnderline",e,t))}get isStrikethrough(){return(this.n&8388608)!==0}set isStrikethrough(t){let e=(this.n&8388608)!==0;e!==t&&(this.n=this.n^8388608,this.Ji(!0),this.C(),this.t("isStrikethrough",e,t))}get wrap(){return this.tt!==null?this.tt.J0:2}set wrap(t){let e=this.wrap;e!==t&&(this.Rs().J0=t,this.f(),this.t("wrap",e,t))}get overflow(){return this.tt!==null?this.tt.$0:0}set overflow(t){let e=this.overflow;e!==t&&(this.Rs().$0=t,this.f(),this.t("overflow",e,t))}get isOverflowed(){return(this.n&16777216)!==0}nC(t){t?this.n|=16777216:this.n&=-16777217}get stroke(){return this.Qe}set stroke(t){let e=this.Qe;e!==t&&(t!==null&&R.Nd(t,"TextBlock.stroke"),t instanceof R&&t.k(),this.Qe=t,typeof t!="string"&&this.xf(),this.C(),this.t("stroke",e,t))}get lineCount(){return this.Pi}get lineHeight(){return this.Z0()}get editable(){return(this.n&1048576)!==0}set editable(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.t("editable",e,t))}get HN(){return(this.n&33554432)!==0}set HN(t){this.n=this.n^33554432}get textEditor(){return this.tt!==null?this.tt.Q0:null}set textEditor(t){let e=this.textEditor;e!==t&&(this.Rs().Q0=t,this.t("textEditor",e,t))}get errorFunction(){return this.tt!==null?this.tt.gs:null}set errorFunction(t){let e=this.errorFunction;e!==t&&(t!==null&&m.S(t,lt,"errorFunction"),this.Rs().gs=t,this.t("errorFunction",e,t))}get interval(){return this.K!==null?this.K.Ff:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new xe),this.K.Ff=t,this.f();let i=this.panel;i!==null&&(i.ds=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.Rf:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Rf=t,this.f(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.Of:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Of=t,this.f(),this.t("graduatedEnd",e,t))}get graduatedFunction(){return this.K!==null?this.K._0:null}set graduatedFunction(t){let e=this.graduatedFunction;e!==t&&(t!==null&&m.S(t,lt,"graduatedFunction"),this.K===null&&(this.K=new xe),this.K._0=t,this.f(),this.t("graduatedFunction",e,t))}get graduatedSkip(){return this.K!==null?this.K.If:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&m.S(t,lt,"graduatedSkip"),this.K===null&&(this.K=new xe),this.K.If=t,this.f(),this.t("graduatedSkip",e,t))}Ma(t,e){if(this.Qe===null||this.ue.length===0||this.Dn===null)return;let i=this.naturalBounds,s=this.actualBounds,n=i.width,o=i.height,r=this.Z0(),a=t.textAlign=this.textAlign,h=e.ld;a==="start"?a=h?"right":"left":a==="end"&&(a=h?"left":"right");let l=this.isUnderline,u=this.isStrikethrough;this.bn(t,this.Qe,!0,!1,i,s),(l||u)&&this.bn(t,this.Qe,!1,!1,i,s);let c=0,d=0,f=n,p=!1;e.Wt===t&&!(e.Wt instanceof re)&&!this.HN&&e.getRenderingHint("textGreeking")===!0&&r*this.Dh*e.scale<3&&(p=!0);let g=this.spacingAbove,y=this.spacingBelow;switch(this.flip){case 0:break;case 2:t.translate(n,0),t.scale(-1,1);break;case 1:t.translate(0,o),t.scale(1,-1);break;case 3:t.translate(n,o),t.scale(-1,-1);break}t.commitTransform();let b=this.Pi,v=(g+r+y)*b;if(o>v){let w=this.verticalAlignment;d=w.y*o-w.y*v+w.offsetY}if(lt.ek&&(t.letterSpacing=this.letterSpacing,t.wordSpacing=this.wordSpacing),b===1&&this.Fn!==null){let w=this.pe;w>f&&(w=f),d+=g,this.ND(this.Fn,t,c,d,f,r,w,p,a,l,u)}else if(this.Ii!==null&&this.ye!==null)for(let w=0;w<b;w++){let k=this.Ii[w];k>f&&(k=f),d+=g,this.ND(this.ye[w],t,c,d,f,r,k,p,a,l,u),d+=r+y}switch(this.flip){case 0:break;case 2:t.scale(-1,1),t.translate(-n,0);break;case 1:t.scale(1,-1),t.translate(0,-o);break;case 3:t.scale(-1,-1),t.translate(-n,-o);break}}ND(t,e,i,s,n,o,r,a,h,l,u){let c=0;if(a){h==="left"?c=0:h==="right"?c=n-r:h==="center"&&(c=(n-r)/2);let p=e.globalAlpha;e.globalAlpha=p/2,e.fillRect(i+c,s+o/4,r,o/2),e.globalAlpha=p;return}h==="left"?c=0:h==="right"?c=n:h==="center"&&(c=n/2);let d=lt._1!==null?lt._1(this,o):o*.75;e.fillText(t,i+c,s+d);let f=o/20|0;if(f===0&&(f=1),h==="right"?c-=r:h==="center"&&(c-=r/2),l){let p=lt.tk!==null?lt.tk(this,o):o*.8;this.CD(i+c,s+p,i+c+r,s+p,f,e),e instanceof re&&e.lastCreatedElement.classList.add("gojs-td")}if(u){let p=s+o-o/2.2|0;f%2!==0&&(p+=.5),this.CD(i+c,p,i+c+r,p,f,e),e instanceof re&&e.lastCreatedElement.classList.add("gojs-td")}}CD(t,e,i,s,n,o){o.beginPath(),o.lineWidth=n,o.moveTo(t,e),o.lineTo(i,s),o.stroke(),o.endPath()}wf(t,e,i){if(!super.wf(t,e,i))return!1;if(this.bn(t,this.Qe,!0,!1,this.naturalBounds,this.actualBounds),i){if(this.svg.getElementsByTagName("text").length===0)return!0;let s=this.svg.getElementsByClassName("gojs-td");for(let n=0;n<s.length;n++)t.setFillOrStrokeInPlace(s[n],!1)}else this.rE(this.svg,this.ye?this.ye[0]:this.text,t);return!0}rE(t,e,i){t.innerHTML=e,i.setFillOrStrokeInPlace(t,!0)}Sd(t){return this.lineCount>1||this.isUnderline||this.isStrikethrough?!0:super.Sd(t)}CN(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("text");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}lE(){this.vn=0,this.pe=0,this.co=null,this.Ii=null,this.ye=null,this.Fn=null}kd(t,e,i,s){let n=this.Pi;this.Xl=t,this.nC(!1);let o=this.Dn;lt.us!==null&&(lt.LD!==o&&(lt.us.font=o,lt.LD=o),lt.ek&&(lt.us.letterSpacing=this.letterSpacing,lt.us.wordSpacing=this.wordSpacing)),this.lE();let r=0,a=0;isNaN(this.desiredSize.width)?(r=this.aE(),r=Math.min(r,t/this.scale)):r=this.desiredSize.width,this.panel!==null&&(r=Math.min(r,this.panel.maxSize.width)),a=this.MD(r),isNaN(this.desiredSize.height)?a=Math.min(a,e/this.scale):a=this.desiredSize.height,this.hE(t,a),(this.wrap===1||isNaN(this.desiredSize.width))&&(r=isNaN(t)?this.pe:Math.min(t,this.pe)),r=Math.max(i,r),a=Math.max(s,a),this.Ke.Yn(r,a),this.no(0,0,r,a),this.svg!==null&&n!==this.Pi&&this.Ji(!0)}Pa(t,e,i,s){this.commonArrange(t,e,i,s)}Rn(t,e){this.Fn===null?(this.Fn=t,this.pe=e):((this.ye===null||this.Ii===null)&&(this.ye=[],this.Ii=[],this.ye.push(this.Fn),this.Ii.push(this.pe)),this.ye.push(t),this.Ii.push(e),this.ye.length>this.maxLines&&(this.n|=16777216))}sC(t,e,i){let s=this.formatting===0;s&&(t=t.trim());let n=0,o=0,r=0,a=this.Dn,h=this.spacingAbove+this.spacingBelow,l=Math.max(0,this.Z0()+h),u=this.overflow===1?this.AD(a):0;if(this.Pi>=this.maxLines){i!==void 0&&i.e(0,l);return}let c=t;if(this.wrap===0){if(this.vn=1,o=this.getStringWidth(t),u===0||o<=e){this.pe=Math.max(this.pe,o),this.Rn(t,this.pe),i!==void 0&&i.e(o,l);return}let f=this.qd(c);c=c.substring(f.length);let p=this.qd(c);for(o=this.getStringWidth(f+p),r=0;p.length>0&&o<=e;){f+=p,c=c.substring(p.length),p=this.qd(c),r=o;let g=f+p;s&&(g=g.trim()),o=this.getStringWidth(g)}for(s&&(p=p.trim()),f+=p,e=Math.max(1,e-u);this.getStringWidth(f)>e&&f.length>1;)f=f.substring(0,f.length-1);this.nC(!0),f+=lt.j0,r=this.getStringWidth(f),this.pe=r,this.Rn(f,r),i!==void 0&&i.e(r,l);return}let d=0;for(c.length===0&&(d=1,this.Rn(c,0));c.length>0;){let f=this.qd(c);for(c=c.substring(f.length);this.getStringWidth(f)>e;){let y=1;for(o=this.getStringWidth(f.substring(0,y)),r=0;o<=e;)y++,r=o,o=this.getStringWidth(f.substring(0,y));let b=0;y===1?(b=o,n=Math.max(n,o)):(b=r,n=Math.max(n,r)),y--,y<1&&(y=1);let v=f.substring(0,y);if(this.Rn(v,b),d++,f=f.substring(y),this.Pi+d>this.maxLines)break}let p=this.qd(c);for(o=this.getStringWidth(f+p),r=0;p.length>0&&o<=e;){f+=p,c=c.substring(p.length),p=this.qd(c),r=o;let y=f+p;s&&(y=y.trim()),o=this.getStringWidth(y)}if(s&&(f=f.trim()),f==="")continue;f[f.length-1]==="\xAD"&&(f=f.substring(0,f.length-1)+"\u2010");let g=0;if(p.length===0?(g=o,n=Math.max(n,o)):(r=this.getStringWidth(f),g=r,n=Math.max(n,r)),this.Rn(f,g),d++,this.Pi+d>this.maxLines)break}this.vn=Math.min(this.maxLines-this.Pi,d),this.pe=Math.max(this.pe,n),i!==void 0&&i.e(this.pe,l*this.vn)}hE(t,e){if(this.pe===0||this.Ii===null||this.ye===null||this.overflow!==1)return;let i=this.Dn,s=this.overflow===1?this.AD(i):0,n=this.spacingAbove+this.spacingBelow,o=Math.max(0,this.Z0()+n),r=Math.min(this.maxLines-1,Math.max(Math.floor(e/o+.01)-1,0));if(r+1>=this.ye.length)return;this.nC(!0);let a=this.ye[r],h=Math.max(1,t-s);for(;this.getStringWidth(a)>h&&a.length>1;)a=a.substring(0,a.length-1);a+=lt.j0;let l=this.getStringWidth(a);this.ye[r]=a,this.ye=this.ye.slice(0,r+1),this.Ii[r]=l,this.Ii=this.Ii.slice(0,r+1),this.vn=this.ye.length,this.pe=Math.max(this.pe,l),this.Pi=this.vn,this.Pi===1&&(this.Fn=this.ye[0])}qd(t){if(this.wrap===3)return t.substring(0,1);let e=t.length,i=0,s=lt.cE;for(;i<e&&!s.test(t.charAt(i));)i++;for(this.formatting===1&&(e=Math.min(e,i+1));i<e&&s.test(t.charAt(i));)i++;return i>=t.length?t:t.substring(0,i)}getStringWidth(t){return lt.us===null?t.length*8:lt.us.measureText(t).width}Z0(){if(this.co!==null)return this.co;let t=this.Dn,e=0;if(lt.us===null)return e=16,this.co=e,e;if(lt.oC[t]!==void 0&<.TD<5e3)e=lt.oC[t];else{lt.us.letterSpacing="0px";let i=lt.us.measureText("M");lt.us.letterSpacing=this.letterSpacing,e=i.width*1.3,lt.oC[t]=e,lt.TD++}return this.co=e,e}AD(t){if(lt.us===null)return 6;let e=0;return lt.Q1[t]!==void 0&<.iC<5e3?e=lt.Q1[t]:(e=lt.us.measureText(lt.j0).width,lt.Q1[t]=e,lt.iC++),e}ik(t,e){return t.indexOf(`
|
|
7
|
+
`+n.toString(t-1)}return i}static $A(t){Y.Jb=t}static Rm(){return Y.Jb}static fromDiv(t){let e=t;if(typeof t=="string"&&(e=K.document.getElementById(t)),e instanceof HTMLDivElement){let i=Y.ji.get(e);if(i)return i}return null}get div(){return this.Mt}set div(t){if(t!==null&&m.se(t,HTMLDivElement,Y,"div"),this.Mt!==t){let e=this.Mt;if(e!==null){if(Y.ji.delete(e),e.goDiagram=void 0,e.go=void 0,e.innerHTML="",this.lt!==null){let s=this.lt.bt;this.Le(s,"pointermove",this.xh,!1),this.Le(s,"pointerdown",this.la,!1),this.Le(s,"pointerup",this.bh,!1),this.Le(s,"pointerout",this.kh,!1),this.Le(s,"pointercancel",this.Ph,!1),this.lt.dispose()}this.sf&&(this.sf.disconnect(),this.sf=null);let i=this.toolManager;i!==null&&(i.mouseDownTools.each(s=>s.cancelWaitAfter()),i.mouseMoveTools.each(s=>s.cancelWaitAfter()),i.mouseUpTools.each(s=>s.cancelWaitAfter())),i.cancelWaitAfter(),this.currentTool.doCancel(),this.lt=null,this.Le(K,"resize",this.Wb,!1),this.Le(K,"wheel",this.wh,!0),Y.Rm()===this&&Y.$A(null)}else this.la===null&&(this.eo=!1);if(this.Mt=null,t!==null){let i=Y.ji.get(t);i&&(i.div=null),this.m2(t),this.Eu(),this.themeManager&&this.themeManager.tO()}else this.themeManager&&this.themeManager.eO()}}setupRouters(){this.rf.push(new _n)}m2(t){let e=this;if(!Y.isUsingDOM())return;t==null&&m.o("Diagram setup requires an argument DIV."),e.Mt!==null&&m.o("Diagram has already completed setup."),typeof t=="string"?e.Mt=K.document.getElementById(t):t instanceof HTMLDivElement?e.Mt=t:m.o("No DIV or DIV id supplied: "+t),e.Mt===null&&m.o("Invalid DIV id; could not get element with id: "+t);let i=Y.ji.get(e.Mt);if(i&&i!==this&&m.o("Invalid div id; div already has a Diagram associated with it."),!e.sf&&K.ResizeObserver){let u=K.ResizeObserver,c=m.SP(()=>e.requestUpdate(),250,!1);e.sf=new u(()=>c()),e.sf.observe(e.Mt)}K.getComputedStyle(e.Mt,null).position==="static"&&(e.Mt.style.position="relative");let s=5,n="rgba(2"+s+"5, 255, 255, 0)";s--,e.Mt.style["-webkit-tap-highlight-color"]=n,e.Mt.innerHTML="",Y.ji.set(e.Mt,e),e.Mt.goDiagram=e,e.Mt.go=K.go;let o=new Fe(e);o.style!==void 0&&(o.style.position="absolute",o.style.top="0px",o.style.left="0px",K.getComputedStyle(e.Mt,null).getPropertyValue("direction")==="rtl"&&(e.ld=!0),o.style.zIndex="2",o.style.userSelect="none",o.style.MozUserSelect="none",o.style.touchAction="none",o.style.letterSpacing="normal !important",o.style.wordSpacing="normal !important",o.style.lang="unknown"),o.bt.setAttribute("role","application"),e.lt=o,e.Wt=o._t;let r=e.Wt;e.$e=e.computePixelRatio(),e.viewSize.isReal()||(e.wt=e.Mt.clientWidth||1,e.xt=e.Mt.clientHeight||1),e.oT(e.wt,e.xt);let a=e;e.Mt.insertBefore(o.bt,e.Mt.firstChild);let h=new Fe(null);if(h.width=1,h.height=1,e.YR=h,e.KR=h._t,Y.isUsingDOM()){let u=m.Ni("div"),c=m.Ni("div");u.style.position="absolute",u.style.overflow="auto",u.style.width=e.wt+"px",u.style.height=e.xt+"px",u.style.zIndex="1",c.style.position="absolute",c.style.width="1px",c.style.height="1px",e.Mt.appendChild(u),u.appendChild(c),u.onscroll=Y.iO,u.addEventListener("pointerdown",Y.sO),u.a=e,u.nO=!0,u.oO=!0,e.qb=u,e.jb=c}e.Eu=m.SP(()=>{e.Ol=null,e.C()},300,!1),e.Wb=m.SP(()=>{e.SM()},250,!1),e.oh=u=>(u.preventDefault(),!1),e.wh=u=>{if(!a.isEnabled)return;let c=a.lf(u,!0);c.bubbles=!0;let d=0,f=0;c.delta=0,u.deltaX!==void 0?(u.deltaX!==0&&(d=u.deltaX>0?1:-1),u.deltaY!==0&&(f=u.deltaY>0?1:-1),c.delta=Math.abs(u.deltaX)>Math.abs(u.deltaY)?-d:-f):u.wheelDeltaX!==void 0?(u.wheelDeltaX!==0&&(d=u.wheelDeltaX>0?-1:1),u.wheelDeltaY!==0&&(f=u.wheelDeltaY>0?-1:1),c.delta=Math.abs(u.wheelDeltaX)>Math.abs(u.wheelDeltaY)?-d:-f):u.wheelDelta!==void 0&&u.wheelDelta!==0&&(c.delta=u.wheelDelta>0?1:-1),a.doMouseWheel(),a.Sh(c,u)},e.WA=u=>{if(!a.isEnabled)return;e.nf=!1,a.lf(u,!0);let c=a.currentTool;c.cancelWaitAfter(),c.standardMouseOver()},e.la=u=>{if(!a.isEnabled)return;e.nf=!0;let c=a.Hb;c[u.pointerId]===void 0&&(c[u.pointerId]=u);let d=a.yh,f=!1;if(d[0]!==null&&(d[0].pointerId===u.pointerId||d[0].pointerType!==u.pointerType))d[0]=u;else if(d[1]!==null&&d[1].pointerId===u.pointerId)d[1]=u,f=!0;else if(d[0]===null)d[0]=u;else if(d[1]===null)d[1]=u,f=!0;else{u.preventDefault();return}let p=u.pointerType==="touch"||u.pointerType==="pen";p&&(a.kx=!1,a.dp=!0);let g=a.rO(u,u,f),y=a.l2,b=p?25:10;if(u.timeStamp-a.o2<a.jA&&!(Math.abs(y.x-u.screenX)>b||Math.abs(y.y-u.screenY)>b)?a.fp++:a.fp=1,g.clickCount=a.fp,a.o2=u.timeStamp,a.l2.setTo(u.screenX,u.screenY),a.doMouseDown(),u.button===1){u.preventDefault();return}a.Sh(g,u)},e.xh=u=>{if(!a.isEnabled)return;e.nf=!0;let c=a.yh;if(c[0]!==null&&(c[0].pointerId===u.pointerId||c[0].pointerType!==u.pointerType))c[0]=u;else if(c[1]!==null&&c[1].pointerId===u.pointerId){c[1]=u;return}else if(c[0]===null)c[0]=u;else return;if(c[0].pointerId!==u.pointerId)return;let d=a.lO(u,u,c[1]!==null);a.doMouseMove(),a.Sh(d,u)},e.bh=u=>{if(!a.isEnabled)return;e.nf=!0;let c=u.pointerType==="touch"||u.pointerType==="pen",d=a.Hb;if(c&&a.kx){delete d[u.pointerId],u.preventDefault();return}let f=a.yh;if(f[0]!==null&&(f[0].pointerId===u.pointerId||f[0].pointerType!==u.pointerType))f[0]=null;else if(f[1]!==null&&f[1].pointerId===u.pointerId){f[1]=null;return}else return;let p=a.p2(u,!1,!0,!1,!0,!1),g=K.document.elementFromPoint(u.clientX,u.clientY)||null;g!==null&&g.shadowRoot&&(g=g.shadowRoot.elementFromPoint(u.clientX,u.clientY)||null),g!==null&&g.a instanceof Y&&g.a!==a&&g.a.kp(u,p),g===null&&(g=u.target),a.kp(u,p),p.clickCount=a.fp,p.targetDiagram=a.e1(u,g),p.targetObject=null,a.doMouseUp(),a.Sh(p,u),c&&(a.dp=!1)},e.kh=u=>{if(!a.isEnabled)return;e.nf=!1;let c=a.Hb;c[u.pointerId]&&delete c[u.pointerId];let d=a.yh;if(d[0]!==null&&d[0].pointerId===u.pointerId&&(d[0]=null),d[1]!==null&&d[1].pointerId===u.pointerId&&(d[1]=null),u.pointerType==="touch"||u.pointerType==="pen")return;let f=a.currentTool;f.cancelWaitAfter(),f.standardMouseOver()},e.Ph=u=>{let c=a.yh;c[0]!==null&&c[0].pointerId===u.pointerId?(c[0]=null,a.dp=!1):c[1]!==null&&c[1].pointerId===u.pointerId&&(c[1]=null)};let l=r;if(e.cp=l.F[m.We("7eba17a4ca3b1a8346")][m.We("78a118b7")](l.F,Y.Mh,s,s),r.clearContextCache(!0),e.aO(),this.tf==="svg"){let u=this.Vo.get("svg");this.Mt&&this.Mt.appendChild(u.bt),this.Wt=u._t}}addEventListener(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}Et(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}removeEventListener(t,e,i,s){t.removeEventListener(e,i,{capture:s})}Le(t,e,i,s){t.removeEventListener(e,i,{capture:s})}aO(){let t=this,e=this.lt.bt;e instanceof HTMLCanvasElement||(e=t.div),this.Et(e,"pointerdown",t.la,!1),this.Et(e,"pointermove",t.xh,!1),this.Et(e,"pointerup",t.bh,!1),this.Et(e,"pointerout",t.kh,!1),this.Et(e,"pointercancel",t.Ph,!1),this.Et(e,"pointerenter",t.hO,!1),this.Et(e,"pointerleave",t.cO,!1),this.Et(e,"wheel",t.wh,!1),this.Et(e,"keydown",t.fO,!1),this.Et(e,"keyup",t.uO,!1),this.Et(e,"blur",t.dO,!1),this.Et(e,"focus",t.gO,!1),this.Et(e,"selectstart",i=>(i.preventDefault(),!1),!1),this.Et(e,"contextmenu",i=>(i.preventDefault(),!1),!1),this.Et(K,"resize",t.Wb,!1)}Sx(){this.gp>30&&(this.Ol=1)}mS(t){this.Ol!==null&&(this.Ol=null,t&&this.Eu(),this.gp=0,this.c2=[0,0,0,0,0],this.mp=0)}computePixelRatio(){return this.Ol!==null?this.Ol:K.devicePixelRatio||1}get avgSpf(){return this.gp}doMouseDown(){this.currentTool.doMouseDown()}doMouseMove(){this.currentTool.doMouseMove()}doMouseUp(){this.currentTool.doMouseUp()}doMouseWheel(){this.currentTool.doMouseWheel()}doKeyDown(){let t=this.commandHandler;if(!this.toggleKeyboardControl()){if((t.isFocusEnabled||t.isVirtualPointerEnabled)&&t.doVirtualFocusKeyDown()){let e=this.lastInput;e.bubbles=!1;let i=e.event;i&&(i.stopPropagation&&i.stopPropagation(),i.cancelable!==!1&&i.preventDefault());return}this.currentTool.doKeyDown()}}toggleKeyboardControl(){let t=this.lastInput,e=t.commandKey;if((t.control||t.meta)&&t.alt&&(e==="Enter"||e==="NumpadEnter")){let i=this.commandHandler,s=i.isFocusEnabled||i.isVirtualPointerEnabled;return i.isFocusEnabled=!s,i.isVirtualPointerEnabled=!s,i.focus=i.findFirstFocus(),this.T("FocusOrVirtualPointerEnabledChanged"),!0}return!1}doKeyUp(){let t=this.commandHandler;if((t.isFocusEnabled||t.isVirtualPointerEnabled)&&t.doVirtualFocusKeyUp()){let e=this.lastInput;e.bubbles=!1;let i=e.event;i&&(i.stopPropagation&&i.stopPropagation(),i.cancelable!==!1&&i.preventDefault());return}this.currentTool.doKeyUp()}hd(t,e){if(e)for(let i in e)i!=="sourceDiagram"&&(t[i]=e[i])}emitMouseDown(t,e,i,s){if(typeof t!="number"||typeof e!="number")throw new Error("Robot.mouseDown first two args must be X,Y numbers");i===void 0&&(i=0);let n=this;if(s&&s.sourceDiagram&&(n=s.sourceDiagram),!n.isEnabled)return this;let o=new Qt;return o.diagram=n,o.documentPoint=new P(t,e),o.viewPoint=n.transformDocToView(o.documentPoint),o.timestamp=i,o.down=!0,this.hd(o,s),n.lastInput=o,n.firstInput=o.copy(),n.doMouseDown(),this}emitMouseMove(t,e,i,s){if(typeof t!="number"||typeof e!="number")throw new Error("Robot.mouseMove first two args must be X,Y numbers");i===void 0&&(i=0);let n=this;if(s&&s.sourceDiagram&&(n=s.sourceDiagram),!n.isEnabled)return this;let o=new Qt;return o.diagram=n,o.documentPoint=new P(t,e),o.viewPoint=n.transformDocToView(o.documentPoint),o.timestamp=i,this.hd(o,s),n.lastInput=o,n.doMouseMove(),this}emitMouseUp(t,e,i,s){if(typeof t!="number"||typeof e!="number")throw new Error("Robot.mouseUp first two args must be X,Y numbers");i===void 0&&(i=0);let n=this;if(s&&s.sourceDiagram&&(n=s.sourceDiagram),!n.isEnabled)return this;let o=new Qt;return o.diagram=n,o.documentPoint=new P(t,e),o.viewPoint=n.transformDocToView(o.documentPoint),o.timestamp=i,o.up=!0,n.firstInput.documentPoint.equals(o.documentPoint)&&(o.clickCount=1),this.hd(o,s),n.lastInput=o,n.doMouseUp(),this}emitMouseWheel(t,e,i){if(typeof t!="number")throw new Error("Robot.mouseWheel first arg must be DELTA number");e===void 0&&(e=0);let s=this;if(!s.isEnabled)return this;let n=new Qt;return n.diagram=s,n.documentPoint=s.lastInput.documentPoint,n.viewPoint=s.lastInput.viewPoint,n.delta=t,n.timestamp=e,this.hd(n,i),s.lastInput=n,s.doMouseWheel(),this}emitKeyDown(t,e,i){if(typeof t!="string"&&typeof t!="number")throw new Error("Robot.keyDown first arg must be a string or a number");e===void 0&&(e=0);let s=this;if(!s.isEnabled)return this;let n=new Qt;return n.diagram=s,n.documentPoint=s.lastInput.documentPoint,n.viewPoint=s.lastInput.viewPoint,typeof t=="string"?n.key=t:typeof t=="number"&&(n.key=String.fromCharCode(t)),n.timestamp=e,n.down=!0,this.hd(n,i),s.lastInput=n,s.doKeyDown(),this}emitKeyUp(t,e,i){if(typeof t!="string"&&typeof t!="number")throw new Error("Robot.keyUp first arg must be a string or a number");e===void 0&&(e=0);let s=this;if(!s.isEnabled)return this;let n=new Qt;return n.diagram=s,n.documentPoint=s.lastInput.documentPoint,n.viewPoint=s.lastInput.viewPoint,typeof t=="string"?n.key=t:typeof t=="number"&&(n.key=String.fromCharCode(t)),n.timestamp=e,n.up=!0,this.hd(n,i),s.lastInput=n,s.doKeyUp(),this}doFocus(){this.focus()}focus(){if(this.lt)if(this.scrollsPageOnFocus)this.lt.focus();else{let t=K.scrollX,e=K.scrollY;this.lt.focus(),K.scrollTo(t,e)}}gO(t){let e=Y.ji.get(this);e&&e.T("GainedFocus")}dO(t){let e=Y.ji.get(this);e&&e.T("LostFocus")}SM(){if(this.lt===null)return;let t=this.Mt;if(t===null||t.clientWidth===0||t.clientHeight===0)return;this.VM||this.setScrollWidth();let e=this.to?this.jt:0,i=this.kn?this.jt:0,s=this.$e;if(this.$e=this.computePixelRatio(),this.$e!==s&&(this.$u=!0,this.requestUpdate()),t.clientWidth!==this.wt+e||t.clientHeight!==this.xt+i){this.Nh(),this.qi=!0;let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(this.Qc=!0,n.p()),this.As||this.requestUpdate()}}QA(){let t=0,e=new Et;e.name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="ViewportBackground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="Background",this.Jr(e,t++),e=new Et,e.name="",this.Jr(e,t++),e=new Et,e.name="Foreground",this.Jr(e,t++),e=new Et,e.name="ViewportForeground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,this.Jr(e,t++),e=new Et,e.name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,this.Jr(e,t++)}rT(){let t=new G(G.Grid,{name:"GRID"}).add(new et("LineH",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new et("LineV",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new et("LineH",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new et("LineV",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new et("LineH",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor"),new et("LineV",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor")),e=new pt({layerName:"Grid",zOrder:0,isInDocumentBounds:!1,isAnimated:!1,pickable:!1,locationObjectName:"GRID"}).add(t);return this.add(e),this.partManager.parts.delete(e),t.visible=!1,t}static iO(){let t=Y.ji.get(this.parentElement||this);if(t){if(t.Ub){t.Ub=!1;return}if(!t.isEnabled){t.lT();return}t.diagramScroll(this)}}static sO(t){if(!this.a.isEnabled){this.a.updateScroll();return}this.a.Vb=t.target.scrollTop,this.a.Bb=t.target.scrollLeft}diagramScroll(t){if(this.lt===null)return;let e=this.qb,i=this.jb;this.sp=!0;let s=this.documentBounds,n=this.viewportBounds,o=this.fh,r=s.x-o.left,a=s.y-o.top,h=s.width+o.left+o.right,l=s.height+o.top+o.bottom,u=s.right+o.right,c=s.bottom+o.bottom,d=n.x,f=n.y,p=n.width,g=n.height,y=n.right,b=n.bottom,v=this.scale,w,k=t.scrollLeft;if(this.ld)switch(this.ob){case"negative":k=k+t.scrollWidth-t.clientWidth;break;case"reverse":k=t.scrollWidth-k-t.clientWidth;break}let S=k;if(p<h||g<l){w=P.z(this.position.x,this.position.y),this.allowHorizontalScroll&&this.Bb!==S&&(w.x=S/v+r,this.Bb=S),this.allowVerticalScroll&&this.Vb!==t.scrollTop&&(w.y=t.scrollTop/v+a,this.Vb=t.scrollTop),this.position=w,P.i(w),this.sp=!1,this.td=!1;return}if(w=P.l(),t.nO&&this.allowHorizontalScroll&&(r<d&&(this.position=w.e(S+r,this.position.y)),u>y)){let N=e.scrollWidth-this.wt;this.position=w.e(-N+S-this.wt/v+u,this.position.y)}if(t.oO&&this.allowVerticalScroll&&(a<f&&(this.position=w.e(this.position.x,t.scrollTop+a)),c>b)){let N=e.scrollHeight-this.xt;this.position=w.e(this.position.x,-N+t.scrollTop-this.xt/v+c)}P.i(w),this.ha(),this.sp=!1,this.td=!1,s=this.documentBounds,n=this.viewportBounds,u=s.right,y=n.right,c=s.bottom,b=n.bottom,r=s.x,d=n.x,a=s.y,f=n.y,p>=h&&r>=d&&u<=y&&(i.style.width="1px"),g>=l&&a>=f&&c<=b&&(i.style.height="1px")}computeBounds(t){return t===void 0&&(t=new I),this.Te(),this.aT(t)}aT(t){if(this.fixedBounds.isReal())return t.h(this.fixedBounds),t.addMargin(this.Qt),t;let e=!0,i=this.Vt.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if(!o.visible||!o.isInDocumentBounds)continue;let r=o.Nt.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!l.isInDocumentBounds||!l.isVisible())continue;let u=l.actualBounds;u.isReal()&&(e?(e=!1,t.h(u)):t.unionRect(u))}}return e&&t.e(0,0,0,0),t.addMargin(this.Qt),t}computePartsBounds(t,e){e===void 0&&(e=!1);let i;if(Array.isArray(t))for(let s=0;s<t.length;s++){let n=t[s];!e&&n instanceof j||(n.ensureBounds(),i===void 0?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}else{let s=t.iterator;for(;s.next();){let n=s.value;!e&&n instanceof j||(n.ensureBounds(),i===void 0?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}}return i===void 0?new I(NaN,NaN,0,0):i}Js(t){if(!t&&!this.eo||this.Ht||this.lt===null||!this.documentBounds.isReal())return;if(this.Ht=!0,t){let c=this.initialPosition;if(c.isReal()){this.Ht=!1,this.position=c;return}let d=this.initialDocumentSpot,f=this.initialViewportSpot;d.isNoSpot()&&(d=T.TopLeft),f.isNoSpot()&&(f=T.TopLeft);let p=P.l();p.setRectSpot(this.documentBounds,d);let g=this.viewportBounds,y=I.z(0,0,g.width,g.height),b=P.l();b.setRectSpot(y,f),b.e(p.x-b.x,p.y-b.y),this.Ht=!1,this.position=b,I.i(y),P.i(b)}let e=this.ia;t&&this.vr!==1&&(e=this.vr);let i=e!==1?this.cd(e):this.scale,s=this.ct.x,n=this.ct.y,o=this.wt/i,r=this.xt/i,a=this.$c,h=this._m;if(t&&!a.isSpot()&&(h.isSpot()||h.isDefault())){let c=this.initialDocumentSpot.isSpot()&&this.initialViewportSpot.isSpot();a=h.isDefault()&&!c?T.Center:h}this.w2(this.documentBounds,o,r,a,t);let l=this.scale;this.scale=i,this.Ht=!1;let u=this.viewportBounds;u.equalsApproxTo(s,n,o,r)||this.onViewportBoundsChanged(new I(s,n,o,r),u,l,!1)}cd(t){let e=this.hp;if(this.lt===null)return e;if(t===1)return this.scale;this.ensureBounds();let i=this.documentBounds;if(!i.isReal())return e;let s=i.width,n=i.height,o=this.wt+(this.to?this.jt:0),r=this.xt+(this.kn?this.jt:0),a=o/s,h=r/n,l=this.fh,u=l.left+l.right!==0,c=l.top+l.bottom!==0;(u||c)&&(h===a?(h=(r-this.jt)/n,a=(o-this.jt)/s):h>a?h=(r-this.jt)/n:a=(o-this.jt)/s);let d=0;return t===2?d=Math.min(h,a):t===3&&(h>a?d=(r-this.jt)/n:d=(o-this.jt)/s),d>e&&(d=e),d<this.minScale&&(d=this.minScale),d>this.maxScale&&(d=this.maxScale),d}zoomToFit(){let t=this.ah;this.ah=1,this.scale=this.cd(2),this.alignDocument(T.Center,T.Center),t!==1&&(this.Js(!1),this.w2(this.documentBounds,this.wt/this.et,this.xt/this.et,this.$c,!1)),this.ah=t}zoomToRect(t,e){e===void 0&&(e=2);let i=t.width,s=t.height;if(i===0||s===0||isNaN(i)&&isNaN(s))return;let n=1;if(e===2||e===3)if(isNaN(i))n=this.viewportBounds.height*this.scale/s;else if(isNaN(s))n=this.viewportBounds.width*this.scale/i;else{let o=this.wt,r=this.xt;e===3?r/s>o/i?n=(r-(this.kn?this.jt:0))/s:n=(o-(this.to?this.jt:0))/i:n=Math.min(r/s,o/i)}this.scale=n,this.position=new P(t.x,t.y)}get mO(){return this.Ht}set mO(t){this.Ht=t}alignDocument(t,e){this.ensureBounds();let i=this.documentBounds,s=this.viewportBounds;this.position=new P(i.x+(t.x*i.width+t.offsetX)-(e.x*s.width-e.offsetX),i.y+(t.y*i.height+t.offsetY)-(e.y*s.height-e.offsetY))}focusObject(t){if(t instanceof J){this.pp=t;let e=P.l();this.yp=this.transformDocToView(t.getDocumentPoint(T.TopLeft,e)),P.i(e)}else this.pp=null,this.yp=P.gn}w2(t,e,i,s,n){let o=P.z(this.ct.x,this.ct.y),r=o.x,a=o.y;if(this.pp!==null){let h=P.l();h=this.pp.getDocumentPoint(T.TopLeft,h),r=h.x-this.yp.x/this.scale,a=h.y-this.yp.y/this.scale,s=T.None,P.i(h)}if(n||this.scrollMode===1){s.isSpot()&&(e>t.width&&(r=t.x+(s.x*t.width+s.offsetX)-(s.x*e-s.offsetX)),i>t.height&&(a=t.y+(s.y*t.height+s.offsetY)-(s.y*i-s.offsetY)));let h=this.fh,l=e-t.width;if(e<t.width+h.left+h.right){let c=r+e/2;c=Math.min(c,t.right+Math.max(l,h.right)-e/2),c=Math.max(c,t.left-Math.max(l,h.left)+e/2),r=c-e/2}else r>t.left?r=t.left:r<t.right-e&&(r=t.right-e);let u=i-t.height;if(i<t.height+h.top+h.bottom){let c=a+i/2;c=Math.min(c,t.bottom+Math.max(u,h.bottom)-i/2),c=Math.max(c,t.top-Math.max(u,h.top)+i/2),a=c-i/2}else a>t.top?a=t.top:a<t.bottom-i&&(a=t.bottom-i)}if(o.x=isFinite(r)?r:-this.Qt.left,o.y=isFinite(a)?a:-this.Qt.top,this.positionComputation!==null){let h=this.positionComputation(this,o);o.x=h.x,o.y=h.y}this.Ns.IA(this.ct,o),this.ct.e(o.x,o.y),this.Pp(),this.aa(),this.pO(),P.i(o)}findPartAt(t,e){if(e===void 0&&(e=!0),e){let i=this.xS(t,s=>s.part,s=>s.canSelect());if(i instanceof pt)return i}else{let i=this.xS(t,s=>s.part);if(i instanceof pt)return i}return null}findObjectAt(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Te();let s=this.Vt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}xS(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Te();let s=this.Vt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible||n.isTemporary)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}findPartsAt(t,e,i){return e===void 0&&(e=!0),this.yO(t,s=>s.part,e?s=>s instanceof pt&&s.canSelect():null,i)}yO(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof q)&&!(s instanceof V)&&(s=new V),this.Te();let n=this.Vt.iteratorBackwards;for(;n.next();){let o=n.value;!o.visible||o.isTemporary||o.findObjectsAt(t,e,i,s)}return s}findObjectsAt(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof q)&&!(s instanceof V)&&(s=new V),this.Te();let n=this.Vt.iteratorBackwards;for(;n.next();){let o=n.value;o.visible&&o.findObjectsAt(t,e,i,s)}return s}findPartsIn(t,e,i,s){return e===void 0&&(e=!1),i===void 0&&(i=!0),this.wO(t,null,n=>n instanceof pt&&(!i||n.canSelect()),e,s)}findObjectsIn(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof q)&&!(n instanceof V)&&(n=new V),this.Te();let o=this.Vt.iteratorBackwards;for(;o.next();){let r=o.value;r.visible&&r.findObjectsIn(t,e,i,s,n)}return n}PS(t,e,i,s,n,o){let r=new V;this.Te();let a=this.Vt.iteratorBackwards;for(;a.next();){let h=a.value;h.visible&&h.PS(t,e,i,s,r,n,o)}return r}wO(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof q)&&!(n instanceof V)&&(n=new V),this.Te();let o=this.Vt.iteratorBackwards;for(;o.next();){let r=o.value;!r.visible||r.isTemporary||r.findObjectsIn(t,e,i,s,n)}return n}findPartsNear(t,e,i,s,n){return i===void 0&&(i=!0),s===void 0&&(s=!0),this.xO(t,e,null,o=>o instanceof pt&&(!s||o.canSelect()),i,n)}findObjectsNear(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof q||n instanceof V)&&(o=n),n=!0),!(o instanceof q)&&!(o instanceof V)&&(o=new V),this.Te();let r=this.Vt.iteratorBackwards;for(;r.next();){let a=r.value;a.visible&&a.findObjectsNear(t,e,i,s,n,o)}return o}xO(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof q||n instanceof V)&&(o=n),n=!0),!(o instanceof q)&&!(o instanceof V)&&(o=new V),this.Te();let r=this.Vt.iteratorBackwards;for(;r.next();){let a=r.value;!a.visible||a.isTemporary||a.findObjectsNear(t,e,i,s,n,o)}return o}acceptEvent(t){return this.lf(t,t instanceof MouseEvent)}lf(t,e){let i=this.qr;this.qr=this.gh,this.gh=i,i.diagram=this,i.event=t,e?this.kp(t,i):(i.viewPoint=this.qr.viewPoint,i.documentPoint=this.qr.documentPoint);let s=0,n=t;return n.ctrlKey&&(s+=1),n.altKey&&(s+=2),n.shiftKey&&(s+=4),n.metaKey&&(s+=8),i.modifiers=s,i.button=n.button,n.buttons!==void 0&&(i.buttons=n.buttons),m.hr&&n.button===0&&n.ctrlKey&&(i.button=2),i.down=!1,i.up=!1,i.clickCount=1,i.delta=0,i.handled=!1,i.bubbles=!1,i.timestamp=t.timeStamp,i.isMultiTouch=!1,i.targetDiagram=this.e1(t,t.target),i.targetObject=null,i}e1(t,e){if(e===null)return null;let i=Y.ji.get(e);if(i)return i;let s=t.path;if(!s&&m.it(t.composedPath)&&(s=t.composedPath()),s&&s[0]){let n=Y.ji.get(s[0]);if(n)return n}return null}rO(t,e,i){let s=this.p2(t,!0,!1,!1,!0,i);return this.kp(e,s),s.targetDiagram=this.e1(t,t.target),s.targetObject=null,i||s.clone(this.ap),s}lO(t,e,i){let s=this.p2(t,!1,!1,!1,!1,i),n=K.document.elementFromPoint(e.clientX,e.clientY)||null;n!==null&&n.shadowRoot&&(n=n.shadowRoot.elementFromPoint(e.clientX,e.clientY)||null);let o=this,r=t;if(n){let a=this.e1(t,n);a&&(r=e,o=a)}return s.targetDiagram=o,this.kp(r,s),s.targetObject=null,s}p2(t,e,i,s,n,o){let r=this.qr;this.qr=this.gh,this.gh=r,r.diagram=this,r.clickCount=1,r.delta=0;let a=0;return t.ctrlKey&&(a+=1),t.altKey&&(a+=2),t.shiftKey&&(a+=4),t.metaKey&&(a+=8),r.modifiers=a,r.event=t,r.timestamp=t.timeStamp,r.button=i?this.firstInput.button:t.button,r.buttons=t.buttons,m.hr&&t.button===0&&t.ctrlKey&&(r.button=2),r.down=e,r.up=i,r.handled=s,r.bubbles=n,r.isMultiTouch=o,r}Sh(t,e){return t.bubbles?!0:(e.stopPropagation!==void 0&&e.stopPropagation(),e.cancelable!==!1&&e.preventDefault(),e.cancelBubble=!0,!1)}fO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!1);return i.key=t.key,i.code=t.code,i.down=!0,e.doKeyDown(),e.Sh(i,t)}uO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!1);return i.key=t.key,i.code=t.code,i.up=!0,e.doKeyUp(),e.Sh(i,t)}hO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!0);return e.mouseEnter!==null&&e.mouseEnter(i),e.currentTool.standardMouseOver(),e.Sh(i,t)}cO(t){let e=Y.ji.get(this);if(!e||!e.isEnabled)return!1;let i=e.lf(t,!0);return e.mouseLeave!==null&&e.mouseLeave(i),e.Sh(i,t)}getMouse(t){let e=this.lt;if(e===null)return new P(0,0);let i=e.getBoundingClientRect(),s=(t.clientX-i.left)*(this.wt/i.width),n=(t.clientY-i.top)*(this.xt/i.height);return new P(s,n).Yi(this.v)}kp(t,e){let i=this.lt,s=0,n=0;if(i!==null){let r=i.getBoundingClientRect();s=(t.clientX-r.left)*(this.wt/r.width),n=(t.clientY-r.top)*(this.xt/r.height)}e.viewPoint.e(s,n);let o=P.z(s,n);this.v.Ci(o),e.documentPoint.h(o),P.i(o)}_L(t,e,i){let s;if(this.yh[0]!==null)s=this.yh[e];else return;let n=this.lt;if(n!==null){let o=n.getBoundingClientRect();i.e((s.clientX-o.left)*(this.wt/o.width),(s.clientY-o.top)*(this.xt/o.height))}}invalidateDocumentBounds(){this.mh||(this.mh=!0,this.requestUpdate(!1))}bO(){this.As||this.Te(),this.ensureBounds()}redraw(){this.Ht||this.As||(this.C(),this.maybeUpdate())}isUpdateRequested(){return this.Lr}delayInitialization(t){t===void 0&&(t=null);let e=this.animationManager,i=e.isEnabled;e.stopAnimation(),e.isEnabled=!1,this.br(),this.eo=!1,this.Kx=new P(NaN,NaN),e.isEnabled=i,this.As=!0;let s=this;t!==null&&m.un(()=>{s.As=!1,e.Gl("Model"),t(s)},1)}requestUpdate(t){if(t===void 0&&(t=!1),this.Lr===!0||this.Ht||t===!1&&this.As)return;this.Lr=!0;let e=this;K.requestAnimationFrame(()=>{e.Lr&&e.maybeUpdate()})}maybeUpdate(){this.Zu&&!this.Lr||(this.Zu&&(this.Zu=!1),this.br())}b2(t,e){!this.td||this.Ht||this.animationManager.defaultAnimation.isAnimating||this.lT()||(t&&this.Te(),e&&this.Js(!1))}br(t){if(this.As||(this.Lr=!1,this.Mt===null&&!this.ed.isReal()))return;this.As=!0;let e=this.animationManager,i=this.rd;if(!e.isAnimating&&i.length!==0){let u=i.r,c=u.length;for(let d=0;d<c;d++){let f=u[d];f.xi(!1),f.f()}i.clear()}let s=this.s2;s.count>0&&(s.each(u=>u.k2()),s.clear());let n=!1,o=!1;e.defaultAnimation.isAnimating&&(o=!0,n=this.skipsUndoManager,this.skipsUndoManager=!0),e.ke||this.SM(),t||this.b2(!1,!0);let r=!this.undoManager.isUndoingRedoing&&(this.Fl||this.rf.count!==0&&this.Fr.size!==0),a=!this.eo||this.jr;this.Te(!0);let h=!1;(a||r)&&(this.eo?this.P2(!this.Qc,r):(this.startTransaction("Initial Layout"),e.isEnabled===!1&&e.stopAnimation(),this.P2(!1,r)),h=a),this.Qc=!1,this.Fl=!1,this.Te(),this.ls!==null&&(this.ls.visible&&!this.sd&&(this.ca(),this.sd=!0),!this.ls.visible&&this.sd&&(this.sd=!1)),this.Nb||this.bO(),t||this.b2(!0,!1);let l=!1;if(h){let u=I.l();u.h(this.viewportBounds),this.eo||(this.eo=!0,l=!0,this.skipsUndoManager||(this.undoManager.wx=!0),this.undoManager.xx=!0,this.kO()),this.PO(),this.Te(!1),t||this.b2(!0,!0),I.i(u)}else if(e.Xc&&e.Yx){if(this.vr!==1)this.scale=this.cd(this.vr);else if(this.ia!==1)this.scale=this.cd(this.ia);else{let u=this.initialScale;isFinite(u)&&u>0&&(this.scale=u)}this.Js(!0)}h&&l&&this.commitTransaction("Initial Layout"),t||this.Ge(this.Wt),o&&(this.skipsUndoManager=n),this.As=!1}get Qa(){return this.eo}kO(){if(this.vr!==1)this.scale=this.cd(this.vr);else if(this.ia!==1)this.scale=this.cd(this.ia);else{let e=this.initialScale;isFinite(e)&&e>0&&(this.scale=e)}this.Js(!0);let t=this.Vt.r;this.rs(t,t.length,this,this.viewportBounds),this.T("InitialLayoutCompleted"),this.Kx.h(this.ct),this.ca()}PO(){this.T("LayoutCompleted")}Sp(t){this.Qn.add(t)}addInvalidRoute(t){this.Io?this.uh.add(t):this.Fr.add(t)}Te(t){if(this.Qn.size!==0&&!(!this.As&&this.animationManager.isTicking)){if(this.As||(this.Fl=!0),t){this.hT(this.Qn);return}for(let e=0;e<23&&this.Qn.size!==0;e++){let i=new Set(this.Qn);this.Qn.clear(),this.k2(i,this.Qn)}this.nodes.each(e=>{e instanceof ht&&e.cT(!1)})}}hT(t,e){for(let i of t)!i.Di()||i instanceof ht||(i.$r()?(i.ht(1/0,1/0),i.Ut()):e&&e.add(i));for(let i of t)if(i instanceof ht){if(!i.isVisible())continue;this.i1(i)}}k2(t,e){this.hT(t,e);for(let i of t){if(!(i instanceof j))continue;let s=i;s.isVisible()&&(s.$r()?(s.ht(1/0,1/0),s.Ut()):e.add(s))}for(let i of t)i instanceof vt&&i.isVisible()&&(i.$r()?(i.ht(1/0,1/0),i.Ut()):e.add(i))}fd(t){let e=t instanceof Y,i=e?t.links:t.memberParts,s=this.Qn;if(e)this.Te(!0);else{for(;i.next();){let n=i.value;s.has(n)&&(!n.Di()||n instanceof ht||n.$r()&&(n.ht(1/0,1/0),n.Ut()))}for(i.reset();i.next();){let n=i.value;if(s.has(n)&&n instanceof ht){if(!n.isVisible())continue;this.i1(n)}}i.reset()}for(;i.next();){let n=i.value;n instanceof j&&s.has(n)&&n.isVisible()&&n.$r()&&(n.ht(1/0,1/0),n.Ut())}}i1(t){let e=m.st(),i=m.st(),s=t.memberParts;for(;s.next();){let o=s.value;o.isVisible()&&(o instanceof ht?(o.Bo()||o.as()||o.fa())&&this.i1(o):o instanceof j?o.fromNode===t||o.toNode===t?i.push(o):e.push(o):(o.ht(1/0,1/0),o.Ut()))}let n=e.length;for(let o=0;o<n;o++){let r=e[o];r.ht(1/0,1/0),r.Ut()}m.Z(e),t.ht(1/0,1/0),t.Ut(),n=i.length;for(let o=0;o<n;o++){let r=i[o];r.ht(1/0,1/0),r.Ut()}m.Z(i)}rs(t,e,i,s){if(!(!this.ef&&!this.animationManager.isAnimating)){for(let n=0;n<e;n++)t[n].rs(i,s);this.Te()}}Ge(t){this.Mt!==null&&(this.lt===null&&m.o("No canvas specified"),this.tf==="svg"?this.SO(t):this.MO(t))}MO(t){let e=this.animationManager;if(e.ke||e.isAnimating&&!e.isTicking)return;let i=new Date;if(this.Mp(),this.Mt&&this.Mt.style.opacity==="0")return;let s=t!==this.Wt,n=this.Vt.r,o=n.length,r=this;if(this.rs(n,o,r,r.viewportBounds),s)t.clearContextCache(!0),this.ha();else if(!this.qi&&!e.isAnimating)return;let a=this.v,h=this.$e;t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,this.wt,this.xt),this.Zt!==1&&(t.globalAlpha=this.Zt),this.S2(t);for(let f=0;f<o;f++)t.setTransform(h,0,0,h,0,0),t.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),t.commitTransform(),n[f].Ge(t,r);let l=!1;this.of?this.of.Mh(this,t)&&(l=this.cp()):l=!0,l&&(Nt.prototype.Ci=Nt.prototype.Mu),s?(this.Wt.clearContextCache(!0),this.ha()):(this.ef=!1,this.qi=!1);let u=+new Date-+i,c=!1,d=this.c2;if(c||this.Ol===null){d[this.mp]=u,this.mp=(this.mp+1)%d.length;let f=0;for(let p=0;p<d.length;p++)f+=d[p];this.gp=f/d.length}if(this.Zt!==1&&(t.globalAlpha=1),c){t.setTransform(1,0,0,1,0,0);for(let f=0;f<d.length;f++)t.fillText(d[f].toString(),20,150+ +(f*20))}}SO(t){if(this.Mt===null)return;let e=this.animationManager;if(e.ke||e.isAnimating&&!e.isTicking)return;this.Mp();let i=this.wt,s=this.xt;t.surface.resize(i,s,i,s);let n=this.Vt.r,o=n.length,r=this;if(this.rs(n,o,r,r.viewportBounds),!this.qi&&!e.isAnimating)return;let a=this.v;t.lastDrawnPart=null,t.setDiagramPosScale(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),this.Zt!==1&&(t.globalAlpha=this.Zt),this.S2(t);let h=this.$e,l=this.lt._t;l.setTransform(h,0,0,h,0,0),l.clearRect(0,0,this.wt,this.xt);for(let c=0;c<o;c++)n[c].Ge(t,r);let u=!1;this.of?this.of.Mh(this,l)&&(u=this.cp()):u=!0,u&&(Nt.prototype.Ci=Nt.prototype.Mu),this.ef=!1,this.qi=!1}s1(t,e,i,s,n,o,r,a,h){o===void 0&&(o=null),r===void 0&&(r=null),a===void 0&&(a=!1),h===void 0&&(h=!1),this.Mp(),t.clearContextCache(!0),this.ha(),this.ph=!0;let l=this.et;this.et=s;let u=this,c=this.Vt.r,d=c.length;try{let f=new I(n.x,n.y,i.width/s,i.height/s),p=f.copy();p.addMargin(e),this.ca(p),this.Te(),this.rs(c,d,u,f),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i.width,i.height),r!==null&&r!==""&&(t.fillStyle=r,t.fillBackground(0,0,i.width,i.height));let g=Nt.l();g.Ue(),g.Xs(e.left,e.top),g.et(s),(n.x!==0||n.y!==0)&&g.Xs(-n.x,-n.y),t.setTransform(g.m11,g.m12,g.m21,g.m22,g.dx,g.dy),t.commitTransform(),t instanceof re&&t.setDiagramPosScale(g.m11,g.m12,g.m21,g.m22,g.dx,g.dy),Nt.i(g),this.S2(t),t.globalAlpha=this.Zt;let y=this.findLayer("Grid");if(o){let b=new V,v=o.iterator;for(v.reset();v.next();){let w=v.value;w instanceof pt&&(!h&&w.layer===y||(w.Jc(),b.add(w)))}for(let w=0;w<d;w++)c[w].IR(t,u,b,a);b.each(w=>w.Jc())}else for(let b=0;b<d;b++){let v=c[b];v===y?h&&v.Ge(t,u,!0):v.Ge(t,u,a)}this.ph=!1,this.of&&this.Wt&&this.of.Mh(this,this.Wt)&&this.cp()}finally{this.et=l,t.clearContextCache(!0),this.ha(),this.rs(c,d,u,u.viewportBounds),this.ca(),this.Wt instanceof re&&(this.Wt.diagramGroup.replaceChildren(),this.redraw())}}getRenderingHint(t){return this.Dr[t]}setRenderingHint(t,e){t==="minDrawingLength"&&(this.$m=e),this.Dr[t]=e,this.redraw()}resetRenderingHints(){this.Dr=new yt,this.Dr.drawShadows=!0,this.Dr.textGreeking=!0,this.Dr.viewportOptimizations=!m.hr,this.Dr.temporaryPixelRatio=!0,this.Dr.pictureRatioOptimization=!0,this.Dr.minDrawingLength=1,this.$m=1}S2(t){let e=this.Dr;if(e===null)return;if(e.imageSmoothingEnabled!==void 0){let s=!!e.imageSmoothingEnabled;t.setImageSmoothingEnabled(s)}let i=e.defaultFont;i!=null&&(t.font=i)}getInputOption(t){return this.Ju[t]}setInputOption(t,e){this.Ju[t]=e}ZR(){this.Ju=new yt,this.Ju.extraTouchArea=10,this.Ju.extraTouchThreshold=10,this.Ju.hasGestureZoom=!0}set(t){return t?(Object.assign(this,t),this):this}attach(t){return this.setProperties(t)}setProperties(t){return Y.Np(this,t),this}static Np(t,e){if(!e)return;let i=t instanceof G,s=t instanceof Y;for(let n in e){n===""&&m.o("Setting properties requires non-empty property names");let o=t,r=n;if(i||s){let h=n.indexOf(".");if(h>0){let l=n.substring(0,h);i?o=t.findObject(l):(o=t[l],o==null&&(o=t.toolManager[l])),m.$(o)?r=n.substring(h+1):m.o("Unable to find object named: "+l+" in "+t.toString()+" when trying to set property: "+n)}}if(r[0]!=="_"&&!m.Yw(o,r))if(s&&r==="ModelChanged"){t.addModelChangedListener(e[r]);continue}else if(s&&r==="Changed"){t.addChangedListener(e[r]);continue}else if(s&&m.Yw(t.toolManager,r))o=t.toolManager;else if(s&&t.fT(r)){t.addDiagramListener(r,e[r]);continue}else if(t instanceof ut&&r==="Changed"){t.addChangedListener(e[r]);continue}else m.o('Trying to set undefined property "'+r+'" on object: '+o.toString());let a=e[n];o[r]=a,r[0]==="_"&&o instanceof J&&o.addCopyProperty(r)}}VA(){if(this.ra.count!==0&&!(this.undoManager.transactionLevel>1)){for(;this.ra.count>0;){let t=this.ra;this.ra=new Mt;let e=t.iterator;for(;e.next();){let i=e.key;i.invalidateOtherJumpOvers(e.value),i.ai()}}this.C()}}C(t){if(t===void 0)this.qi=!0,this.requestUpdate();else{let e=this.viewportBounds;t.isReal()&&e.intersectsRect(t)&&(this.qi=!0,this.requestUpdate())}this.T("InvalidateDraw")}invalidateViewport(t,e){if(this.qi!==!0){if(this.qi=!0,this.tf==="svg"){this.maybeUpdate();return}this.getRenderingHint("temporaryPixelRatio")===!0?(this.Sx(),this.maybeUpdate(),this.mS(!0)):this.maybeUpdate()}}Nh(){this.td=!0}ha(){this.ef=!0}Mp(){this.$u!==!1&&(this.$u=!1,this.oT(this.wt,this.xt))}oT(t,e){this.aa();let i=this.$e,s=t*i,n=e*i;this.lt.resize(s,n,t,e)&&(this.qi=!0,this.Wt.clearContextCache(!0))}lT(){let t=this.lt;if(t===null||this.ed.isReal())return!0;let e=this.wt,i=this.xt,s=this.Mt,n=!1,o=this.to?this.jt:0,r=this.kn?this.jt:0,a=s.clientWidth||e+o,h=s.clientHeight||i+r,l=this.viewportBounds,u=l.x,c=l.y,d=l.width,f=l.height;if((a!==e+o||h!==i+r)&&(this.to=!1,this.kn=!1,o=0,r=0,this.wt=a,this.xt=h,this.$u=!0,n=!0,this.aa()),!this.eo||!this.viewportBounds.isReal())return!0;let p=this.qb,g=this.jb;if(this.td=!1,!n&&!this.to&&!this.kn&&!this.Qu&&!this._u)return!0;let y=this.documentBounds,b=0,v=0,w=0,k=0,S=l.width,N=l.height,D=this.fh;this.contentAlignment.isSpot()?(y.width>S&&(b=D.left,v=D.right),y.height>N&&(w=D.top,k=D.bottom)):(b=D.left,v=D.right,w=D.top,k=D.bottom);let L=y.width+b+v,M=y.height+w+k,A=this.scale,F=A,O=L>a/A,E=M>h/A;if(!n&&!this.to&&!this.kn&&!O&&!E)return!0;let B=y.x-b,X=l.x,z=y.right+v,U=l.right+o,tt=y.y-w,nt=l.y,Z=y.bottom+k,it=l.bottom+r,_="1px",at="1px";if(this.scrollMode===1&&(O||E)){if(O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let Q=1;B+1<X&&(Q=Math.max((X-B)*A+this.wt,Q)),z>U+1&&(Q=Math.max((z-U)*A+this.wt,Q)),S+o+1<L&&(Q=Math.max((L-S)*A+this.wt,Q)),_=Q.toString()+"px"}if(E&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let Q=1;tt+1<nt&&(Q=Math.max((nt-tt)*A+this.xt,Q)),Z>it+1&&(Q=Math.max((Z-it)*A+this.xt,Q)),N+r+1<M&&(Q=Math.max((M-N)*A+this.xt,Q)),at=Q.toString()+"px"}}let ct=_!=="1px",xt=at!=="1px";if(!(ct&&xt)&&(ct||xt)){if(O=!(L<S+o),E=!(M<N+r),xt&&(U-=this.jt),ct&&(it-=this.jt),O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let Pt=1;B+1<X&&(Pt=Math.max((X-B)*A+this.wt,Pt)),z>U+1&&(Pt=Math.max((z-U)*A+this.wt,Pt)),S+1<L&&(Pt=Math.max((L-S)*A+this.wt,Pt)),_=Pt.toString()+"px"}ct=_!=="1px";let Q=this.xt;if(ct!==this.kn&&(Q=ct?this.xt-this.jt:this.xt+this.jt),E&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let Pt=1;tt+1<nt&&(Pt=Math.max((nt-tt)*A+Q,Pt)),Z>it+1&&(Pt=Math.max((Z-it)*A+Q,Pt)),N+1<M&&(Pt=Math.max((M-N)*A+Q,Pt)),at=Pt.toString()+"px"}xt=at!=="1px"}if(this.sp&&!(ct!==this.kn||xt!==this.to))return(e!==this.wt||i!==this.xt)&&this.maybeUpdate(),!1;if(ct!==this.kn&&(_==="1px"?this.xt=this.xt+this.jt:this.xt=Math.max(this.xt-this.jt,1),n=!0),this.kn=ct,g.style.width=_,xt!==this.to&&(at==="1px"?this.wt=this.wt+this.jt:this.wt=Math.max(this.wt-this.jt,1),n=!0,this.ld)){let Q=P.l();xt?(t.style.left=this.jt+"px",this.position=Q.e(this.ct.x+this.jt/this.scale,this.ct.y)):(t.style.left="0px",this.position=Q.e(this.ct.x-this.jt/this.scale,this.ct.y)),P.i(Q)}n&&this.aa(),this.to=xt,g.style.height=at,this.Ub=!0,n&&(this.$u=!0);let Ct=p.scrollLeft;if(this.hasHorizontalScrollbar&&this.allowHorizontalScroll&&(S+1<L?Ct=(this.position.x-B)*A:B+1<X?Ct=p.scrollWidth-p.clientWidth:z>U+1&&(Ct=this.position.x*A)),this.ld)switch(this.ob){case"negative":Ct=-(p.scrollWidth-Ct-p.clientWidth);break;case"reverse":Ct=p.scrollWidth-Ct-p.clientWidth;break}if(p.scrollLeft=Ct,this.hasVerticalScrollbar&&this.allowVerticalScroll&&(N+1<M?p.scrollTop=(this.position.y-tt)*A:tt+1<nt?p.scrollTop=p.scrollHeight-p.clientHeight:Z>it+1&&(p.scrollTop=this.position.y*A)),a=this.wt,h=this.xt,p.style.width=a+(this.to?this.jt:0)+"px",p.style.height=h+(this.kn?this.jt:0)+"px",e!==a||i!==h||this.animationManager.ke){let Q=I.z(u,c,d,f);return this.onViewportBoundsChanged(Q,this.viewportBounds,F,n),I.i(Q),!1}return!0}add(t){let e=t.diagram;if(e===this)return;e!==null&&m.o("Cannot add part "+t.toString()+" to "+this.toString()+". It is already a part of "+e.toString());let i=this.findLayer(t.layerName);if(i===null&&(i=this.findLayer("")),i===null&&m.o('Cannot add a Part when unable find a Layer named "'+t.layerName+'" and there is no default Layer'),t.layer===i)return;let s=i.ch(99999999,t,t.diagram===this);s>=0&&this.raiseChangedEvent(3,"parts",i,null,t,null,s),i.isTemporary||this.invalidateDocumentBounds(),t.invalidateLayout(1);let n=t.layerChanged;n!==null&&n(t,null,i)}ch(t){this.partManager.ch(t);let e=this;Y.isUsingDOM()&&t.Pn(i=>e.uT(i)),t.data||t.zo(),t.hasPlaceholder()&&t.f(),t.data!==null&&t.Pn(i=>e.partManager.M2(i,null)),(t.as()===!0||t.fa()===!0)&&this.Sp(t),t.dT(!0,this),t instanceof $&&t.canAvoid()&&this.ud(t),t.gT()?(t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.wp!==null&&this.wp(this,t),this.requestUpdate()}ri(t){t.clearAdornments(),this.partManager.ri(t);let e=this;t.data!==null&&t.Pn(i=>e.partManager.N2(i,e)),this.Qn.delete(t),t instanceof j?this.Fr.delete(t):t instanceof $&&t.canAvoid()&&this.ud(t),t.gT()?(t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.C(t.hh(t.actualBounds)),this.xp!==null&&this.xp(this,t),this.requestUpdate()}remove(t){this.C2(t,!0)}C2(t,e){let i=t.layer;if(i===null||i.diagram!==this)return;t.isSelected=!1,t.isHighlighted=!1,t.invalidateLayout(2),e&&t.af();let s=i.ri(-1,t,!1);s>=0&&this.raiseChangedEvent(4,"parts",i,t,null,s,null);let n=t.layerChanged;n!==null&&n(t,i,null)}removeParts(t,e){if(e===void 0&&(e=!1),Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e&&!n.canDelete()||this.remove(n)}}else{let i=new V;i.addAll(t);let s=i.iterator;for(;s.next();){let n=s.value;e&&!n.canDelete()||this.remove(n)}}}copyParts(t,e,i){return i===void 0&&(i=!1),this.partManager.copyParts(t,e,i)}moveParts(t,e,i,s){if(i===void 0&&(i=!1),s===void 0&&(s=this.Cp()),this.toolManager===null)return;let n=new Mt;if(t!==null)if(Array.isArray(t))for(let o=0;o<t.length;o++)this.Zr(n,t[o],i,s);else{let o=t.iterator;for(;o.next();)this.Zr(n,o.value,i,s)}else{let o=this.parts;for(;o.next();){let r=o.value;this.Zr(n,r,i,s)}for(o=this.nodes;o.next();){let r=o.value;this.Zr(n,r,i,s)}for(o=this.links;o.next();){let r=o.value;this.Zr(n,r,i,s)}}this.Mx(n,e,s,i)}Zr(t,e,i,s,n){if(!t.has(e)&&(n===void 0&&(n=!1),!(i&&!n&&!e.canMove()&&!e.canCopy())))if(s===void 0&&(s=this.Cp()),e instanceof $){if(t.set(e,this.js(s,e,e.location)),e instanceof ht&&(e.hasPlaceholder()||s.dragsMembers)){let r=e.memberParts;for(;r.next();){let a=r.value;this.Zr(t,a,i,s,s.groupsAlwaysMove)}}let o=e.linksConnected;for(;o.next();){let r=o.value;if(t.has(r))continue;let a=r.fromNode,h=r.toNode;a!==null&&t.has(a)&&h!==null&&t.has(h)&&this.Zr(t,r,i,s)}if(s.dragsTree){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;this.Zr(t,a,i,s)}}}else if(e instanceof j){t.set(e,this.js(s,e));let o=e.labelNodes;for(;o.next();){let r=o.value;this.Zr(t,r,i,s)}}else e instanceof vt||t.set(e,this.js(s,e,e.location))}Mx(t,e,i,s){if(t===null||t.count===0)return;let n=P.l(),o=P.l();o.h(e),isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0);let r=this.$b;r||this.uA(t);let a=m.st(),h=m.st(),l=t.iterator,u=P.l();for(;l.next();){let g=l.key,y=l.value;if(g.Di()){let b=this.mT(g,t);if(b!==null)a.push(new On(g,y,b));else if(!s||g.canMove()){let v=y.point;n.h(v),this.computeMove(g,n.add(o),i,u),g.location=u,y.shifted===void 0&&(y.shifted=new P),y.shifted.h(u.subtract(v))}}else l.key instanceof j&&h.push(new pe(l.key,l.value))}P.i(u);let c=a.length;for(let g=0;g<c;g++){let y=a[g],b=y.pT.point;n.h(b),y.o1.shifted===void 0&&(y.o1.shifted=new P),y.Ri.location=n.add(y.o1.shifted)}let d=P.l(),f=P.l(),p=h.length;for(let g=0;g<p;g++){let y=h[g],b=y.key;if(b instanceof j){if(b.suspendsRouting){b.Ar=null;let v=b.fromNode,w=b.toNode;if(this.draggedLink!==null&&i.dragsLink){let k=y.value.point;if(b.dragComputation===null){t.set(b,this.js(i,b,o));let S=o.x-k.x,N=o.y-k.y;b.xr(S,N)}else{let S=P.z(0,0),N=b.getPoint(0);N&&N.isReal()&&S.h(N),u=P.l().h(S).add(o);let D=u;i.isGridSnapEnabled&&(i.isGridSnapRealtime||this.lastInput.up)&&(D=P.l(),this.rM(b,u,D,i)),u.h(b.dragComputation(b,u,D)).subtract(S),t.set(b,this.js(i,b,u));let L=u.x-k.x,M=u.y-k.y;b.xr(L,M),P.i(S),P.i(u),D!==u&&P.i(D)}}else{if(v!==null){d.h(v.location);let k=t.get(v);k!==null&&d.subtract(k.point)}if(w!==null){f.h(w.location);let k=t.get(w);k!==null&&f.subtract(k.point)}if(v!==null&&w!==null){let k=y.value.point;if(d.equalsApprox(f)||b.computeAdjusting()!==0){let S=n;S.h(d),S.subtract(k),t.set(b,this.js(i,b,d)),b.xr(S.x,S.y)}else b.suspendsRouting=!1,b.$t()}else{let k=y.value.point,S;v!==null?S=d:w!==null?S=f:S=o,t.set(b,this.js(i,b,S));let N=S.x-k.x,D=S.y-k.y;b.xr(N,D)}}}else if(b.fromNode===null||b.toNode===null){let v=y.value.point;t.set(b,this.js(i,b,o));let w=o.x-v.x,k=o.y-v.y;b.xr(w,k)}}}P.i(n),P.i(o),P.i(d),P.i(f),m.Z(a),m.Z(h),r||(this.Te(),this.gS(t))}computeMove(t,e,i,s){if(s===void 0&&(s=new P),s.h(e),t===null)return s;let n=e,o=i.isGridSnapEnabled;o&&(i.isGridSnapRealtime||this.lastInput.up)&&(n=P.l(),this.rM(t,e,n,i));let r=t.dragComputation!==null?t.dragComputation(t,e,n):n,a=t.minLocation,h=a.x;isNaN(h)&&(h=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let l=a.y;isNaN(l)&&(l=o?Math.round(t.location.y*1e3)/1e3:t.location.y);let u=t.maxLocation,c=u.x;isNaN(c)&&(c=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let d=u.y;return isNaN(d)&&(d=o?Math.round(t.location.y*1e3)/1e3:t.location.y),s.e(Math.max(h,Math.min(r.x,c)),Math.max(l,Math.min(r.y,d))),n!==e&&P.i(n),s}Cp(){let t=this.toolManager.findTool("Dragging");return t instanceof Tt?t.dragOptions:this.ad}rM(t,e,i,s){if(s===void 0&&(s=this.Cp()),i.h(e),t===null)return i;let n=this.grid,o=s.gridSnapCellSize,r=o.width,a=o.height,h=s.gridSnapOrigin,l=h.x,u=h.y,c=s.gridSnapCellSpot;if(n!==null){let f=n.gridCellSize;isNaN(r)&&(r=f.width),isNaN(a)&&(a=f.height);let p=n.gridOrigin;isNaN(l)&&(l=p.x),isNaN(u)&&(u=p.y)}let d=P.z(0,0);return d.setSpot(0,0,r,a,c),C._g(e.x,e.y,l+d.x,u+d.y,r,a,i),P.i(d),i}uA(t){if(t===null)return;this.$b=!0;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof j&&(i.suspendsRouting=!0)}}gS(t){if(t===null)return;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof j&&(i.suspendsRouting=!1,i.yT()&&i.$t())}this.$b=!1}get draggedLink(){return this.Zb}set draggedLink(t){this.Zb!==t&&(this.Zb=t,t!==null&&(this.Qb=t.fromPort,this._b=t.toPort))}get bS(){return this.Qb}set bS(t){this.Qb=t}get kS(){return this._b}set kS(t){this._b=t}mT(t,e){let i=t.containingGroup;if(i!==null){let s=this.mT(i,e);if(s!==null||(s=e.get(i),s!==null))return s}return null}js(t,e,i){if(i===void 0)return new Ke(P.dn);let s=t.isGridSnapEnabled;return!t.groupsSnapMembers&&e.containingGroup!==null&&(s=!1),s?new Ke(new P(Math.round(i.x*1e3)/1e3,Math.round(i.y*1e3)/1e3)):new Ke(i.copy())}L2(t,e){if(t.diagram!==null&&t.diagram!==this&&m.o("Cannot share a Layer with another Diagram: "+t+" of "+t.diagram),e===null?t.diagram!==null&&m.o("Cannot add an existing Layer to this Diagram again: "+t):(e.diagram!==this&&m.o("Existing Layer must be in this Diagram: "+e+" not in "+e.diagram),t===e&&m.o("Cannot move a Layer before or after itself: "+t)),t.diagram===this)return;let i=t.name,s=this.Vt,n=s.count;for(let o=0;o<n;o++)s.elt(o).name===i&&m.o("Cannot add Layer with the name '"+i+"'; a Layer with the same name is already present in this Diagram.")}addLayer(t){this.L2(t,null),t.Ro(this);let e=this.Vt,i=e.count-1;if(!t.isTemporary)for(;i>=0&&e.elt(i).isTemporary;)i--;return e.insertAt(i+1,t),this.Ce!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,i+1),this.C(),this.invalidateDocumentBounds(),this}addLayerBefore(t,e){this.L2(t,e),t.Ro(this);let i=this.Vt,s=i.indexOf(t);s>=0&&(i.delete(t),this.Ce!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o,t);break}return this.Ce!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o),this.C(),s<0&&this.invalidateDocumentBounds(),this}addLayerAfter(t,e){this.L2(t,e),t.Ro(this);let i=this.Vt,s=i.indexOf(t);s>=0&&(i.delete(t),this.Ce!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o+1,t);break}return this.Ce!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o+1),this.C(),s<0&&this.invalidateDocumentBounds(),this}Jr(t,e){t.Ro(this),this.Vt.insertAt(e,t)}wT(t){this.Vt.removeAt(t)}removeLayer(t){if(t.diagram!==this&&m.o("Cannot remove a Layer from another Diagram: "+t+" of "+t.diagram),t.name==="")return;let e=this.Vt,i=e.indexOf(t);if(e.delete(t)){let s=t.Nt.copy().iterator;for(;s.next();){let n=s.value,o=n.layerName;o!==t.name?n.layerName=o:n.layerName=""}this.Ce!==null&&this.raiseChangedEvent(4,"layers",this,t,null,i,null),this.C(),this.invalidateDocumentBounds()}}findLayer(t){let e=this.layers;for(;e.next();){let i=e.value;if(i.name===t)return i}return null}findRouter(t){for(let e of this.rf)if(e.name===t)return e;return null}addModelChangedListener(t){return m.S(t,Y,"addModelChangedListener:listener"),this._n===null&&(this._n=new q),this._n.add(t),this.model&&this.model.addChangedListener(t),this}removeModelChangedListener(t){m.S(t,Y,"removeModelChangedListener:listener"),this._n!==null&&(this._n.delete(t),this._n.count===0&&(this._n=null)),this.model.removeChangedListener(t)}addChangedListener(t){return m.S(t,Y,"addChangedListener:listener"),this.Rr===null&&(this.Rr=new q),this.Rr.add(t),this}removeChangedListener(t){m.S(t,Y,"removeChangedListener:listener"),this.Rr!==null&&(this.Rr.delete(t),this.Rr.count===0&&(this.Rr=null))}A2(t){if(!this.skipsUndoManager&&!this.model.skipsUndoManager&&this.model.undoManager.handleChanged(t),t.change!==1&&(this.isModified=!0),this.Rr!==null){let e=this.Rr,i=e.length;for(let s=0;s<i;s++)e.elt(s)(t)}}raiseChangedEvent(t,e,i,s,n,o,r){o===void 0&&(o=null),r===void 0&&(r=null);let a=new Xe;a.diagram=this,a.change=t,a.propertyName=e,a.object=i,a.oldValue=s,a.oldParam=o,a.newValue=n,a.newParam=r,this.A2(a)}raiseChanged(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}t(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}get partAdded(){return this.wp}set partAdded(t){this.partAdded!==t&&(this.wp=t)}get partRemoved(){return this.xp}set partRemoved(t){this.partRemoved!==t&&(this.xp=t)}get animationManager(){return this.Ns}get undoManager(){return this.Ce.undoManager}get skipsUndoManager(){return this.Eo}set skipsUndoManager(t){m.s(t,"boolean",Y,"skipsUndoManager"),this.Eo=t,this.Ce.skipsUndoManager=t}get delaysLayout(){return this.Cb}set delaysLayout(t){this.Cb=t}tA(t,e){if(t===null||t.diagram!==this)return;let i=this.wi;try{this.wi=!0;let s=t.change;if(s===2){let n=t.object,o=t.propertyName,r=t.getValue(e);if(t.diagram.model.nt(n,o,r),n instanceof J){let a=n.part;a!==null&&(a.invalidateAdornments(),a instanceof j&&(a.fromNode?.Ze(a.fromPort),a.toNode?.Ze(a.toPort)))}this.isModified=!0}else if(s===3){let n=t.object,o=t.newParam,r=t.newValue;if(n instanceof G)if(typeof o=="number"&&r instanceof J){e?n.ri(o):n.insertAt(o,r);let a=n.part;a!==null&&a.invalidateAdornments()}else typeof o=="number"&&r instanceof Kt&&(r.isRow?n.xT(o,e?void 0:r):n.bT(o,e?void 0:r));else if(n instanceof Et){let a=t.oldParam===!0;typeof o=="number"&&r instanceof pt&&(e?(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.ri(a?o:-1,r,a)):n.ch(o,r,a))}else n instanceof Y?typeof o=="number"&&r instanceof Et&&(e?this.wT(o):this.Jr(r,o)):m.o("unknown ChangeType.Insert object: "+t.toString());this.isModified=!0}else if(s===4){let n=t.object,o=t.oldParam,r=t.oldValue;if(n instanceof G)typeof o=="number"&&r instanceof J?e?n.insertAt(o,r):n.ri(o):typeof o=="number"&&r instanceof Kt&&(r.isRow?n.xT(o,e?r:void 0):n.bT(o,e?r:void 0));else if(n instanceof Et){let a=t.newParam===!0;typeof o=="number"&&r instanceof pt&&(e?n.Nt.indexOf(r)<0&&n.ch(o,r,a):(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.ri(a?o:-1,r,a)))}else n instanceof Y?typeof o=="number"&&r instanceof Et&&(e?this.Jr(r,o):this.wT(o)):m.o("unknown ChangeType.Remove object: "+t.toString());this.isModified=!0}else s===1||m.o("unknown ChangedEvent: "+t.toString())}finally{this.wi=i}}startTransaction(t){return this.undoManager.startTransaction(t)}commitTransaction(t){return this.undoManager.commitTransaction(t)}rollbackTransaction(){return this.undoManager.rollbackTransaction()}commit(t,e){let i=e;i===void 0&&(i="");let s=this.skipsUndoManager;i===null&&(this.skipsUndoManager=!0,i=""),this.undoManager.startTransaction(i);let n=!1;try{t(this),n=!0}finally{n?this.undoManager.commitTransaction(i):this.undoManager.rollbackTransaction(),this.skipsUndoManager=s}}updateAllTargetBindings(t){this.partManager.updateAllTargetBindings(t)}updateAllThemeBindings(){if(this.partManager.updateAllThemeBindings(),this.ls!==null){let t=this.ls.part;t!==null&&t.zo()}}setDivBackground(t){this.div&&(this.div.style.backgroundColor=t)}updateAllRelationshipsFromData(){this.partManager.updateAllRelationshipsFromData()}Pp(){let t=this.v,e=this.et,i=this.ct;t.Ue(),e!==1&&t.et(e),(i.x!==0||i.y!==0)&&t.Xs(-i.x,-i.y)}kT(t,e){let i=this.animationManager;if(this.Ht||this.As){this.et=e,this.aa(),this.C(),this.Nh(),i.EA(t,this.et),this.Pp();return}if(this.lt===null){this.et=e,this.Pp();return}this.Ht=!0;let s=this.viewportBounds.copy(),n=this.wt,o=this.xt,r=this.zoomPoint.x,a=this.zoomPoint.y,h=this.contentAlignment;isNaN(r)&&(h.isSide()?h.includesSide(T.LeftSide)?r=0:h.includesSide(T.RightSide)&&(r=n-1):h.isSpot()?r=h.x*(n-1):r=n/2),isNaN(a)&&(h.isSide()?h.includesSide(T.TopSide)?a=0:h.includesSide(T.BottomSide)&&(a=o-1):h.isSpot()?a=h.y*(o-1):a=o/2),this.scaleComputation!==null&&!this.animationManager.defaultAnimation.isAnimating&&(e=this.scaleComputation(this,e)),e<this.minScale&&(e=this.minScale),e>this.maxScale&&(e=this.maxScale);let l=P.z(this.ct.x+r/t-r/e,this.ct.y+a/t-a/e);this.position=l,P.i(l),this.et=e,this.Pp(),this.aa(),this.Ht=!1,this.onViewportBoundsChanged(s,this.viewportBounds,t,!1),this.Js(!1),i.EA(t,this.et),this.C()}pO(){let t=this.Vt.r;for(let e=0;e<t.length;e++)t[e].YA()}onViewportBoundsChanged(t,e,i,s){if(t.equals(e))return;s===void 0&&(s=!1),s||this.Nh(),this.ha();let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(t.width!==e.width||t.height!==e.height)&&n.p();let o=this.currentTool;this.nf===!0&&o instanceof ne&&!this.animationManager.isTicking&&(this.lastInput.documentPoint=this.transformViewToDoc(this.lastInput.viewPoint),o.cA(this)),this.Ht||this.invalidateViewport(t,e),this.ca();let r=this.Vt.r;this.rs(r,r.length,this,this.viewportBounds),this.Ye.scale=i,this.Ye.position.x=t.x,this.Ye.position.y=t.y,this.Ye.bounds.h(t),this.Ye.canvasSize.width=Math.round(t.width*i),this.Ye.canvasSize.height=Math.round(t.height*i),this.Ye.newCanvasSize.width=this.wt,this.Ye.newCanvasSize.height=this.xt,this.Ye.isScroll=s,this.T("ViewportBoundsChanged",this.Ye,t),this.isVirtualized&&this.links.each(a=>{a.isAvoiding&&a.actualBounds.intersectsRect(e)&&a.$t()})}ca(t){let e=this.ls;if(e===null||!e.visible||e.part===null||e.layer===null)return;let i=t!==void 0?t:this.Xb;if(!i.isReal())return;let s=i.width,n=i.height;if(e.scale=1,e.angle=0,e.layer.isViewportAligned)e.width=s*this.scale,e.height=n*this.scale,e.part.alignment=T.TopLeft;else{e.Pe===null&&(e.Pe=new ti);let o=e.Pe.hf;if(!o.isReal())return;e.width=s+o.width*2,e.height=n+o.height*2;let r=P.l();C._g(i.x,i.y,0,0,o.width,o.height,r),r.offset(-o.width,-o.height),e.part.location=r,P.i(r)}}clearSelection(t){t===void 0&&(t=!1);let e=this.selection;if(e.count===0)return;t||this.T("ChangingSelection",e);let i=e.toArray(),s=i.length;for(let n=0;n<s;n++){let o=i[n];o.isSelected=!1}e.ce(),e.clear(),e.k(),t||this.T("ChangedSelection",e)}select(t){t!==null&&t.diagram===this&&(!t.isSelected||this.selection.count>1)&&(this.T("ChangingSelection",this.selection),this.clearSelection(!0),t.isSelected=!0,this.T("ChangedSelection",this.selection))}selectCollection(t){if(this.T("ChangingSelection",this.selection),this.clearSelection(!0),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s instanceof pt||m.o("Diagram.selectCollection given something that is not a Part: "+s),s.isSelected=!0}}else{let e=t.iterator;for(;e.next();){let i=e.value;i instanceof pt||m.o("Diagram.selectCollection given something that is not a Part: "+i),i.isSelected=!0}}this.T("ChangedSelection",this.selection)}clearHighlighteds(){let t=this.highlighteds;if(t.count>0){let e=t.toArray(),i=e.length;for(let s=0;s<i;s++){let n=e[s];n.isHighlighted=!1}t.ce(),t.clear(),t.k()}}highlight(t){t!==null&&t.diagram===this&&(!t.isHighlighted||this.highlighteds.count>1)&&(this.clearHighlighteds(),t.isHighlighted=!0)}highlightCollection(t){let e=new V().addAll(t),i=this.highlighteds.copy().removeAll(e).iterator;for(;i.next();){let n=i.value;n.isHighlighted=!1}let s=e.iterator;for(;s.next();){let n=s.value;n instanceof pt||m.o("Diagram.highlightCollection given something that is not a Part: "+n),n.isHighlighted=!0}}scroll(t,e,i){i===void 0&&(i=1);let s=e==="up"||e==="down",n=0,o=P.l();if(t==="pixel")n=i;else if(t==="line")n=i*(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if(t==="page"){let a=s?this.viewportBounds.height:this.viewportBounds.width;if(a*=this.scale,a!==0){let h=Math.max(a-(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0);n=i*h}}else if(t==="document"){let a=this.documentBounds,h=this.viewportBounds;e==="up"?this.position=o.e(h.x,a.y):e==="left"?this.position=o.e(a.x,h.y):e==="down"?this.position=o.e(h.x,a.bottom-h.height):e==="right"&&(this.position=o.e(a.right-h.width,h.y)),P.i(o);return}else m.o("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+t);n/=this.scale;let r=this.position;e==="up"?this.position=o.e(r.x,r.y-n):e==="down"?this.position=o.e(r.x,r.y+n):e==="left"?this.position=o.e(r.x-n,r.y):e==="right"?this.position=o.e(r.x+n,r.y):m.o("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+e),P.i(o)}scrollToRect(t){let e=this.viewportBounds;if(e.containsRect(t))return;let i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}centerRect(t){let e=this.viewportBounds,i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}transformDocToView(t){return t.copy().v(this.v)}transformViewToDoc(t){return t.copy().Yi(this.v)}GR(t){return t.Yi(this.v)}static None=1;static Uniform=2;static UniformToFill=3;static CycleAll=1;static CycleNotDirected=2;static CycleNotDirectedFast=3;static CycleNotUndirected=4;static CycleDestinationTree=5;static CycleSourceTree=6;static DocumentScroll=1;static InfiniteScroll=2;static TreeParentCollapsed=1;static AllParentsCollapsed=2;static AnyParentsCollapsed=3;get opacity(){return this.Zt}set opacity(t){let e=this.Zt;e!==t&&(m.s(t,"number",Y,"opacity"),(t<0||t>1)&&m.J(t,"0 <= value <= 1",Y,"opacity"),this.Zt=t,this.t("opacity",e,t),this.C())}get validCycle(){return this.bb}set validCycle(t){let e=this.bb;e!==t&&(this.bb=t,this.t("validCycle",e,t))}get layers(){return this.Vt.iterator}get isModelReadOnly(){let t=this.Ce;return t===null?!1:t.isReadOnly}set isModelReadOnly(t){let e=this.Ce;e!==null&&(e.isReadOnly=t)}get isReadOnly(){return this.Uo}set isReadOnly(t){let e=this.Uo;e!==t&&(m.s(t,"boolean",Y,"isReadOnly"),this.Uo=t,this.t("isReadOnly",e,t))}get isEnabled(){return this.Be}set isEnabled(t){let e=this.Be;e!==t&&(m.s(t,"boolean",Y,"isEnabled"),this.Be=t,this.t("isEnabled",e,t))}get allowClipboard(){return this.Lb}set allowClipboard(t){let e=this.Lb;e!==t&&(m.s(t,"boolean",Y,"allowClipboard"),this.Lb=t,this.t("allowClipboard",e,t))}get allowCopy(){return this.Yl}set allowCopy(t){let e=this.Yl;e!==t&&(m.s(t,"boolean",Y,"allowCopy"),this.Yl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.Kl}set allowDelete(t){let e=this.Kl;e!==t&&(m.s(t,"boolean",Y,"allowDelete"),this.Kl=t,this.t("allowDelete",e,t))}get allowDragOut(){return this.Ab}set allowDragOut(t){let e=this.Ab;e!==t&&(m.s(t,"boolean",Y,"allowDragOut"),this.Ab=t,this.t("allowDragOut",e,t))}get allowDrop(){return this.Tb}set allowDrop(t){let e=this.Tb;e!==t&&(m.s(t,"boolean",Y,"allowDrop"),this.Tb=t,this.t("allowDrop",e,t))}get allowTextEdit(){return this.Hl}set allowTextEdit(t){let e=this.Hl;e!==t&&(m.s(t,"boolean",Y,"allowTextEdit"),this.Hl=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.ql}set allowGroup(t){let e=this.ql;e!==t&&(m.s(t,"boolean",Y,"allowGroup"),this.ql=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.jl}set allowUngroup(t){let e=this.jl;e!==t&&(m.s(t,"boolean",Y,"allowUngroup"),this.jl=t,this.t("allowUngroup",e,t))}get allowInsert(){return this.Db}set allowInsert(t){let e=this.Db;e!==t&&(m.s(t,"boolean",Y,"allowInsert"),this.Db=t,this.t("allowInsert",e,t))}get allowLink(){return this.Wl}set allowLink(t){let e=this.Wl;e!==t&&(m.s(t,"boolean",Y,"allowLink"),this.Wl=t,this.t("allowLink",e,t))}get allowRelink(){return this.Jl}set allowRelink(t){let e=this.Jl;e!==t&&(m.s(t,"boolean",Y,"allowRelink"),this.Jl=t,this.t("allowRelink",e,t))}get allowMove(){return this.$l}set allowMove(t){let e=this.$l;e!==t&&(m.s(t,"boolean",Y,"allowMove"),this.$l=t,this.t("allowMove",e,t))}get allowReshape(){return this.Zl}set allowReshape(t){let e=this.Zl;e!==t&&(m.s(t,"boolean",Y,"allowReshape"),this.Zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Ql}set allowResize(t){let e=this.Ql;e!==t&&(m.s(t,"boolean",Y,"allowResize"),this.Ql=t,this.t("allowResize",e,t))}get allowRotate(){return this._l}set allowRotate(t){let e=this._l;e!==t&&(m.s(t,"boolean",Y,"allowRotate"),this._l=t,this.t("allowRotate",e,t))}get allowSelect(){return this.ta}set allowSelect(t){let e=this.ta;e!==t&&(m.s(t,"boolean",Y,"allowSelect"),this.ta=t,this.t("allowSelect",e,t))}get allowUndo(){return this.vb}set allowUndo(t){let e=this.vb;e!==t&&(m.s(t,"boolean",Y,"allowUndo"),this.vb=t,this.t("allowUndo",e,t))}get allowZoom(){return this.Fb}set allowZoom(t){let e=this.Fb;e!==t&&(m.s(t,"boolean",Y,"allowZoom"),this.Fb=t,this.t("allowZoom",e,t))}get hasVerticalScrollbar(){return this._u}set hasVerticalScrollbar(t){let e=this._u;e!==t&&(m.s(t,"boolean",Y,"hasVerticalScrollbar"),this._u=t,this.Nh(),this.C(),this.t("hasVerticalScrollbar",e,t),this.Js(!1))}get hasHorizontalScrollbar(){return this.Qu}set hasHorizontalScrollbar(t){let e=this.Qu;e!==t&&(m.s(t,"boolean",Y,"hasHorizontalScrollbar"),this.Qu=t,this.Nh(),this.C(),this.t("hasHorizontalScrollbar",e,t),this.Js(!1))}get allowHorizontalScroll(){return this.Rb}set allowHorizontalScroll(t){let e=this.Rb;e!==t&&(m.s(t,"boolean",Y,"allowHorizontalScroll"),this.Rb=t,this.t("allowHorizontalScroll",e,t),this.Js(!1))}get allowVerticalScroll(){return this.Ob}set allowVerticalScroll(t){let e=this.Ob;e!==t&&(m.s(t,"boolean",Y,"allowVerticalScroll"),this.Ob=t,this.t("allowVerticalScroll",e,t),this.Js(!1))}get scrollHorizontalLineChange(){return this.Ib}set scrollHorizontalLineChange(t){let e=this.Ib;e!==t&&(m.s(t,"number",Y,"scrollHorizontalLineChange"),t<0&&m.J(t,">= 0",Y,"scrollHorizontalLineChange"),this.Ib=t,this.t("scrollHorizontalLineChange",e,t))}get scrollVerticalLineChange(){return this.Eb}set scrollVerticalLineChange(t){let e=this.Eb;e!==t&&(m.s(t,"number",Y,"scrollVerticalLineChange"),t<0&&m.J(t,">= 0",Y,"scrollVerticalLineChange"),this.Eb=t,this.t("scrollVerticalLineChange",e,t))}get lastInput(){return this.gh}set lastInput(t){this.gh=t}get previousInput(){return this.qr}set previousInput(t){this.qr=t}get firstInput(){return this.ap}set firstInput(t){this.ap=t}get currentCursor(){return this.kb}set currentCursor(t){if(t===""&&(t=this.ip),this.kb!==t){m.s(t,"string",Y,"currentCursor");let e=this.lt,i=this.Mt;if(e===null||i===null)return;this.kb=t;let s=e.style.cursor;e.style.cursor=t,i.style.cursor=t,e.style.cursor===s&&(e.style.cursor="-webkit-"+t,i.style.cursor="-webkit-"+t,e.style.cursor===s&&(e.style.cursor="-moz-"+t,i.style.cursor="-moz-"+t,e.style.cursor===s&&(e.style.cursor=t,i.style.cursor=t)))}}get defaultCursor(){return this.ip}set defaultCursor(t){t===""&&(t="auto");let e=this.ip;e!==t&&(m.s(t,"string",Y,"defaultCursor"),this.ip=t,this.t("defaultCursor",e,t))}get click(){return this.Or}set click(t){let e=this.Or;e!==t&&(t!==null&&m.S(t,Y,"click"),this.Or=t,this.t("click",e,t))}get doubleClick(){return this.Ir}set doubleClick(t){let e=this.Ir;e!==t&&(t!==null&&m.S(t,Y,"doubleClick"),this.Ir=t,this.t("doubleClick",e,t))}get contextClick(){return this.Er}set contextClick(t){let e=this.Er;e!==t&&(t!==null&&m.S(t,Y,"contextClick"),this.Er=t,this.t("contextClick",e,t))}get mouseOver(){return this.Ur}set mouseOver(t){let e=this.Ur;e!==t&&(t!==null&&m.S(t,Y,"mouseOver"),this.Ur=t,this.t("mouseOver",e,t))}get mouseHover(){return this.Vr}set mouseHover(t){let e=this.Vr;e!==t&&(t!==null&&m.S(t,Y,"mouseHover"),this.Vr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.Br}set mouseHold(t){let e=this.Br;e!==t&&(t!==null&&m.S(t,Y,"mouseHold"),this.Br=t,this.t("mouseHold",e,t))}get mouseDragOver(){return this.Pb}set mouseDragOver(t){let e=this.Pb;e!==t&&(t!==null&&m.S(t,Y,"mouseDragOver"),this.Pb=t,this.t("mouseDragOver",e,t))}get mouseDrop(){return this.zr}set mouseDrop(t){let e=this.zr;e!==t&&(this.zr=t,this.t("mouseDrop",e,t))}get handlesDragDropForTopLevelParts(){return this.Sb}set handlesDragDropForTopLevelParts(t){let e=this.Sb;e!==t&&(m.s(t,"boolean",Y,"handlesDragDropForTopLevelParts"),this.Sb=t,this.t("handlesDragDropForTopLevelParts",e,t))}get mouseEnter(){return this.Xr}set mouseEnter(t){let e=this.Xr;e!==t&&(t!==null&&m.S(t,Y,"mouseEnter"),this.Xr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.Gr}set mouseLeave(t){let e=this.Gr;e!==t&&(t!==null&&m.S(t,Y,"mouseLeave"),this.Gr=t,this.t("mouseLeave",e,t))}get toolTip(){return this.Yr}set toolTip(t){let e=this.Yr;e!==t&&(this.Yr=t,this.t("toolTip",e,t))}get contextMenu(){return this.Kr}set contextMenu(t){let e=this.Kr;e!==t&&(this.Kr=t,this.t("contextMenu",e,t))}get commandHandler(){return this.HM}set commandHandler(t){let e=this.HM;e!==t&&(e&&e.doStop(),this.HM=t,t.Ro(this),t.doStart())}get toolManager(){return this.GM}set toolManager(t){this.GM!==t&&(this.GM=t,t.diagram=this)}get defaultTool(){return this.YM}set defaultTool(t){let e=this.YM;e!==t&&(this.YM=t,t.diagram=this,this.currentTool===e&&(this.currentTool=t))}get currentTool(){return this.KM}set currentTool(t){let e=this.KM;e&&(e.isActive&&e.doDeactivate(),e.cancelWaitAfter(),e.doStop()),t===null&&(t=this.defaultTool),t!==null&&(this.KM=t,t.diagram=this,t.doStart())}get selection(){return this.KA}get maxSelectionCount(){return this.zb}set maxSelectionCount(t){let e=this.zb;if(e!==t)if(m.s(t,"number",Y,"maxSelectionCount"),t>=0&&!isNaN(t)){if(this.zb=t,this.t("maxSelectionCount",e,t),!this.undoManager.isUndoingRedoing){let i=this.selection.count-t;if(i>0){this.T("ChangingSelection",this.selection);let s=this.selection.toArray();for(let n=0;n<i;n++)s[n].isSelected=!1;this.T("ChangedSelection",this.selection)}}}else m.J(t,">= 0",Y,"maxSelectionCount")}get nodeSelectionAdornmentTemplate(){return this.rp}set nodeSelectionAdornmentTemplate(t){let e=this.rp;e!==t&&(this.rp=t.It(),this.t("nodeSelectionAdornmentTemplate",e,t))}get groupSelectionAdornmentTemplate(){return this.Yb}set groupSelectionAdornmentTemplate(t){let e=this.Yb;e!==t&&(this.Yb=t.It(),this.t("groupSelectionAdornmentTemplate",e,t))}get linkSelectionAdornmentTemplate(){return this.Kb}set linkSelectionAdornmentTemplate(t){let e=this.Kb;e!==t&&(this.Kb=t.It(),this.t("linkSelectionAdornmentTemplate",e,t))}get highlighteds(){return this.HA}get isModified(){let t=this.undoManager;return t.isEnabled?t.currentTransaction!==null?!0:this.nd&&this.Hs!==t.historyIndex:this.nd}set isModified(t){if(this.nd!==t){m.s(t,"boolean",Y,"isModified"),this.nd=t;let e=this.undoManager;!t&&e.isEnabled&&(this.Hs=e.historyIndex),t||this.PT()}}PT(){let t=this.isModified;this.JM!==t&&(this.JM=t,this.T("Modified"))}get model(){return this.Ce}set model(t){let e=this.Ce;if(e!==t){this.currentTool.doCancel(),e&&e.undoManager!==t.undoManager&&e.undoManager.isInTransaction&&m.o("Do not replace a Diagram.model while a transaction is in progress.");let i=this.sT(!0);this.eo=!1,this.Zu=!0,this.Hs=-2,this.Lr=!1;let s=this.Ht;this.Ht=!0,this.animationManager.Gl("Model"),e&&(this._n!==null&&this._n.each(n=>e.removeChangedListener(n)),e.removeChangedListener(this._c)),this.Ce=t,this.partManager=this.NO(this.Ce.type),this.initializePartManager(this.partManager);for(let n=0;n<i.length;n++)this.add(i[n]);t.addChangedListener(this.WM),this.partManager.T2(),t.removeChangedListener(this.WM),t.addChangedListener(this._c),this._n!==null&&this._n.each(n=>t.addChangedListener(n)),this.Ht=s,this.invalidateDocumentBounds(),this.Ht||this.C(),e&&t.undoManager.copyProperties(e.undoManager)}}get themeManager(){return this.u2}set themeManager(t){let e=this.u2;e!==t&&(e&&e.removeDiagram(this),this.u2=t,t!==null&&t.addDiagram(this))}initializePartManager(t){}static d2(t,e){Y.JA.set(t,e)}static get licenseKey(){return Y.D2.last()}static set licenseKey(t){Y.D2.add(t.replace(/\s/g,""))}static get version(){return Y.CO}static D2=new q;static CO="3.1.6";NO(t){let e=Y.JA.get(t);return e!==null?new e:new ge}get G(){return this.jM}set G(t){this.jM=t}get ib(){return this.qA}LO(t){if(t.model!==this.model)return;let e=t.change,i=t.propertyName;if(e===1&&i[0]==="S"){if(i==="StartingFirstTransaction"){let s=this,n=this.toolManager;n.mouseDownTools.each(o=>o.diagram=s),n.mouseMoveTools.each(o=>o.diagram=s),n.mouseUpTools.each(o=>o.diagram=s),this.routers.each(o=>o.diagram=s),!this.As&&!this.eo&&(this.Qc=!0,this.Zu&&(this.Lr=!0))}else if(i==="StartingUndo"||i==="StartingRedo"){let s=this.animationManager;this.skipsUndoManager||(s.defaultAnimation.isAnimating&&s.stopAnimation(),s.getBundleAnimation().isAnimating&&s.getBundleAnimation().stop()),this.T("ChangingSelection",this.selection)}else if(i==="StartedTransaction"){let s=this.animationManager;s.defaultAnimation.isAnimating&&!this.skipsUndoManager&&s.stopAnimation()}return}if(this.G){this.G=!1;try{if(t.modelChange===""&&e===1){(i==="FinishedUndo"||i==="FinishedRedo")&&(this.T("ChangedSelection",this.selection),this.Te());let s=this.animationManager;i==="RolledBackTransaction"&&s.stopAnimation(),this.VA(),this.Qc=!0,this.maybeUpdate(),(this.undoManager.transactionLevel===0||this.undoManager.transactionLevel===1)&&s.PM(),i==="CommittedTransaction"&&this.undoManager.isJustDiscarded&&(this.Hs=Math.min(this.Hs,this.undoManager.historyIndex-1)),(i==="CommittedTransaction"||i==="RolledBackTransaction")&&this.undoManager.xx&&m.un(()=>{this.isModified=!1},1);let n=t.isTransactionFinished;if(n&&(this.PT(),this.ib.clear(),this.animationManager.CR()),!this.Mb&&n&&this.lastInput.targetDiagram){this.Mb=!0;let o=this;m.un(()=>{o.currentTool.standardMouseOver(),o.Mb=!1},10)}}}finally{this.G=!0}}}get wi(){return this.qM}set wi(t){this.qM=t}get Ou(){return this.Nb}set Ou(t){this.Nb=t}uT(t){let e=t.D.r;for(let i of e)i instanceof Bt&&this.v2(i)}v2(t){let e=t.element;if(e===null||!K.HTMLImageElement||!(e instanceof HTMLImageElement)||(e.hs instanceof V&&e.hs.add(this),t.AO(),!e.Lp))return;let i=e.getAttribute("src")||"",s=this.oa.get(i);if(s===null){Bt.ST(t,e);let n=[];n.push(t),this.oa.set(i,n)}else{for(let n=0;n<s.length;n++)if(s[n]===t)return;s.push(t)}}TO(t){let e=t.D.r,i=e.length;for(let s=0;s<i;s++)this.F2(e[s])}F2(t){if(!(t instanceof Bt))return;let e=t.element;if(e===null||!K.HTMLImageElement||!(e instanceof HTMLImageElement)||!e.Lp)return;let i=e.getAttribute("src")||"",s=this.oa.get(i);if(s!==null){for(let n=0;n<s.length;n++)if(s[n]===t){s.splice(n,1),s.length===0&&(this.oa.delete(i),Bt.DO(e),e.hs instanceof V&&e.hs.delete(this));return}}}nT(){Bt.clearCache(),this.oa.clear()}rebuildParts(){this.partManager.rebuildParts()}Hc(t,e){this.Ns.Hc(t,e)}Kc(t,e){this.Ns.Kc(t,e)}findPartForKey(t){return this.partManager.findPartForKey(t)}findNodeForKey(t){return this.partManager.findNodeForKey(t)}findLinkForKey(t){return this.partManager.findLinkForKey(t)}findPartForData(t){return this.partManager.findPartForData(t)}findNodeForData(t){return this.partManager.findNodeForData(t)}findLinkForData(t){return this.partManager.findLinkForData(t)}findNodesByExample(...t){return this.partManager.findNodesByExample(...t)}findLinksByExample(...t){return this.partManager.findLinksByExample(...t)}get nodeTemplate(){return this.Hr.get("")}set nodeTemplate(t){let e=this.Hr.get("");e!==t&&(this.Hr.set("",t),this.t("nodeTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get nodeTemplateMap(){return this.Hr}set nodeTemplateMap(t){let e=this.Hr;e!==t&&(this.Hr=t,this.t("nodeTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplate(){return this.dh.get("")}set groupTemplate(t){let e=this.dh.get("");e!==t&&(this.dh.set("",t),this.t("groupTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplateMap(){return this.dh}set groupTemplateMap(t){let e=this.dh;e!==t&&(this.dh=t,this.t("groupTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplate(){return this.na.get("")}set linkTemplate(t){let e=this.na.get("");e!==t&&(this.na.set("",t),this.t("linkTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplateMap(){return this.na}set linkTemplateMap(t){let e=this.na;e!==t&&(this.na=t,this.t("linkTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get isMouseCaptured(){return this.$M}set isMouseCaptured(t){let e=this.lt;if(e===null)return;let i=e.bt;i instanceof SVGElement||(t?(this.lastInput.bubbles=!1,this.Le(i,"pointermove",this.xh,!1),this.Le(i,"pointerdown",this.la,!1),this.Le(i,"pointerup",this.bh,!1),this.Le(i,"pointerout",this.kh,!1),this.Le(i,"pointercancel",this.Ph,!1),this.Et(K,"pointermove",this.xh,!0),this.Et(K,"pointerdown",this.la,!0),this.Et(K,"pointerup",this.bh,!0),this.Et(K,"pointerout",this.kh,!0),this.Et(K,"pointercancel",this.Ph,!0),this.Le(i,"wheel",this.wh,!1),this.Et(K,"wheel",this.wh,!0),this.Et(K,"selectstart",this.oh,!1)):(this.Le(K,"pointermove",this.xh,!0),this.Le(K,"pointerdown",this.la,!0),this.Le(K,"pointerup",this.bh,!0),this.Le(K,"pointerout",this.kh,!0),this.Le(K,"pointercancel",this.Ph,!0),this.Et(i,"pointermove",this.xh,!1),this.Et(i,"pointerdown",this.la,!1),this.Et(i,"pointerup",this.bh,!1),this.Et(i,"pointerout",this.kh,!1),this.Et(i,"pointercancel",this.Ph,!1),this.Le(K,"wheel",this.wh,!0),this.Le(K,"selectstart",this.oh,!1),this.Et(i,"wheel",this.wh,!1)),this.$M=t)}get position(){return this.ct}set position(t){if(this.ct.equals(t))return;let e=P.l().h(this.ct),i=this.viewportBounds.copy();if(this.ct.h(t),this.animationManager.IA(e,this.ct),!this.Ht&&!(this.lt===null&&!this.ed.isReal())){this.Ht=!0;let s=this.scale,n=this.wt/s,o=this.xt/s;this.w2(this.op,n,o,this.$c,!1),this.Ht=!1}else this.aa(),this.Pp();if(!this.Ht){let s=this.viewportBounds;this.onViewportBoundsChanged(i,s,this.et,!1)}P.i(e)}get initialPosition(){return this.rb}set initialPosition(t){this.rb.equals(t)||(this.rb=t.N())}get initialScale(){return this.lb}set initialScale(t){this.lb!==t&&(m.s(t,"number",Y,"initialScale"),this.lb=t)}get grid(){return this.ls===null&&(this.ls=this.rT()),this.ls}set grid(t){let e=this.ls;if(e!==t){e===null&&(this.ls=this.rT(),e=this.ls),t.type!==G.Grid&&m.o("Diagram.grid must be a Panel of type Panel.Grid");let i=e.panel;i!==null&&i.remove(e),this.ls=t,t.name="GRID",i!==null&&i.add(t),this.sd=!1,this.C(),this.t("grid",e,t)}}get viewportBounds(){return this.Xb}aa(){let t=this.Xb,e=this.ct,i=this.et;t.e(e.x,e.y,Math.max(this.wt,0)/i,Math.max(this.xt,0)/i),this.ha()}get viewSize(){return this.ed}set viewSize(t){let e=this.viewSize;if(!e.equals(t)){t=t.N(),this.ed=t;let i=0,s=0;t.isReal()?(i=t.width,s=t.height):this.Mt!==null&&(i=this.Mt.clientWidth||1,s=this.Mt.clientHeight||1),this.wt=i,this.xt=s,this.aa(),this.invalidateDocumentBounds(),this.t("viewSize",e,t),this.C()}}get fixedBounds(){return this.fb}set fixedBounds(t){let e=this.fb;e.equals(t)||((t.width===-1/0||t.height===1/0||t.height===-1/0)&&m.o("fixedBounds width/height must not be Infinity"),t=t.N(),this.fb=t,this.invalidateDocumentBounds(),this.t("fixedBounds",e,t))}get scrollMargin(){return this.fh}set scrollMargin(t){typeof t=="number"&&(t=new Dt(t));let e=this.fh;e.equals(t)||(t=t.N(),this.fh=t,this.t("scrollMargin",e,t),this.Eu())}get scrollMode(){return this.ah}set scrollMode(t){let e=this.ah;e!==t&&(this.ah=t,t===1&&this.Js(!1),this.t("scrollMode",e,t),this.Nh(),this.C())}get scrollsPageOnFocus(){return this.ub}set scrollsPageOnFocus(t){let e=this.ub;e!==t&&(m.s(t,"boolean",Y,"scrollsPageOnFocus"),this.ub=t,this.t("scrollsPageOnFocus",e,t))}get positionComputation(){return this.db}set positionComputation(t){let e=this.db;e!==t&&(t!==null&&m.S(t,Y,"positionComputation"),this.db=t,this.Js(!1),this.t("positionComputation",e,t))}get scaleComputation(){return this.gb}set scaleComputation(t){let e=this.gb;e!==t&&(t!==null&&m.S(t,Y,"scaleComputation"),this.gb=t,this.kT(this.scale,this.scale),this.t("scaleComputation",e,t))}get documentBounds(){return this.op}MT(t){this.mh=!1;let e=this.op;e.equals(t)||(e=e.copy(),this.op.h(t),this.Js(!1),this.T("DocumentBoundsChanged",void 0,e),this.Nh(),this.C())}ensureBounds(){if(this.mh){let t=I.l();this.MT(this.computeBounds(t)),I.i(t)}}get isVirtualized(){return this.Gb}set isVirtualized(t){let e=this.Gb;e!==t&&(m.s(t,"boolean",Y,"isVirtualized"),this.Gb=t,this.t("isVirtualized",e,t))}get scale(){return this.et}set scale(t){let e=this.et;e!==t&&this.kT(e,t)}get defaultScale(){return this.hp}set defaultScale(t){this.hp=t}get autoScale(){return this.ia}set autoScale(t){let e=this.ia;e!==t&&(this.ia=t,this.t("autoScale",e,t),t!==1&&this.Js(!1))}get initialAutoScale(){return this.vr}set initialAutoScale(t){let e=this.vr;e!==t&&(this.vr=t,this.t("initialAutoScale",e,t))}get initialViewportSpot(){return this.yb}set initialViewportSpot(t){let e=this.yb;e!==t&&(t.isSpot()||m.o("initialViewportSpot must be a specific Spot: "+t),this.yb=t,this.t("initialViewportSpot",e,t))}get initialDocumentSpot(){return this.pb}set initialDocumentSpot(t){let e=this.pb;e!==t&&(t.isSpot()||m.o("initialViewportSpot must be a specific Spot: "+t),this.pb=t,this.t("initialDocumentSpot",e,t))}get minScale(){return this.ab}set minScale(t){let e=this.ab;e!==t&&(t>0?(this.ab=t,this.t("minScale",e,t),t>this.scale&&(this.scale=t)):m.J(t,"> 0",Y,"minScale"))}get maxScale(){return this.hb}set maxScale(t){let e=this.hb;e!==t&&(t>0?(this.hb=t,this.t("maxScale",e,t),t<this.scale&&(this.scale=t)):m.J(t,"> 0",Y,"maxScale"))}get zoomPoint(){return this.cb}set zoomPoint(t){this.cb.equals(t)||(t=t.N(),this.cb=t)}get contentAlignment(){return this.$c}set contentAlignment(t){let e=this.$c;e.equals(t)||(t=t.N(),this.$c=t,this.t("contentAlignment",e,t),this.Js(!1))}get initialContentAlignment(){return this._m}set initialContentAlignment(t){let e=this._m;e.equals(t)||(t=t.N(),this._m=t,this.t("initialContentAlignment",e,t))}get padding(){return this.Qt}set padding(t){typeof t=="number"&&(t=new Dt(t));let e=this.Qt;e.equals(t)||(t=t.N(),this.Qt=t,this.invalidateDocumentBounds(),this.t("padding",e,t))}get partManager(){return this.e2}set partManager(t){let e=this.e2;e!==t&&(t.diagram!==null&&m.o("Cannot share PartManagers between Diagrams: "+t.toString()),e&&e.Ro(null),this.e2=t,t.Ro(this))}get nodes(){return this.partManager.nodes.iterator}get links(){return this.partManager.links.iterator}get parts(){return this.partManager.parts.iterator}findTopLevelNodesAndLinks(){let t=new V,e=this.nodes;for(;e.next();){let s=e.value;s.isTopLevel&&t.add(s)}let i=this.links;for(;i.next();){let s=i.value;s.isTopLevel&&t.add(s)}return t.iterator}findTopLevelGroups(){return this.Wr.iterator}get routers(){return this.rf}doLinkRouting(t){this.Io=!0;let e=this.rf.r;for(let i=0;i<e.length;i++)e[i].canRoute(t)&&e[i].routeLinks(this.Fr,t);this.Io=!1}get layout(){return this.li}set layout(t){let e=this.li;e!==t&&(this.li=t,t.diagram=this,t.group=null,this.jr=!0,this.t("layout",e,t),this.requestUpdate())}layoutDiagram(t){this.Te(),t&&this.l1(!0),this.As?this.P2(!1,this.Fl||this.rf.count!==0&&this.Qn.size!==0):(this.Qc=!0,this.br())}l1(t){let e=this.Wr.iterator;for(;e.next();)this.NT(e.value,t);this.layout&&(t?this.layout.isValidLayout=!1:this.layout.p())}NT(t,e){if(t===null)return;let i=t.Ch.iterator;for(;i.next();){let s=i.value;this.NT(s,e)}t.layout!==null&&(e?t.layout.isValidLayout=!1:t.layout.p())}P2(t,e){if(this.Cb)return;let i=this.G;this.G=!0;let s="Layout",n=this.undoManager.transactionLevel,o=this.layout,r=this.animationManager;try{n===0&&(this.undoManager.Dl=!0,this.startTransaction(s)),n<=1&&!r.defaultAnimation.isAnimating&&!r.ke&&(t||r.Gl(s)),this.jr=!1;let a=this.Wr.iterator;for(;a.next();)this.fd(a.value),this.CT(a.value,t,n,e);let h=!1;if(o.isValidLayout||(!t||o.isRealtime||o.isRealtime===null||n===0?(o.doLayout(this),this.fd(this),h=!0,o.isValidLayout=!0):this.jr=!0),h||this.fd(this),this.doLinkRouting(this),this.Fr.clear(),this.uh.size!==0){for(let l=0;l<23&&this.uh.size!==0;l++){for(a=this.Wr.iterator;a.next();)this.LT(a.value);let u=this.Fr;this.Fr=this.uh,this.uh=u,this.fd(this),this.doLinkRouting(this)}this.Fr.clear(),this.uh.clear()}}finally{let a=this.undoManager.Dl;n===0&&(this.commitTransaction(s),this.undoManager.Dl=!1),a&&(n===0||n===1)&&r.PM(),this.jr&&(this.jr=!o.isValidLayout),this.G=i}}CT(t,e,i,s){let n=t.Ch.iterator;for(;n.next();)this.CT(n.value,e,i,s);let o=t.layout;o!==null&&!o.isValidLayout?!e||o.isRealtime||i===0?(t.Lh=!t.location.isReal(),o.doLayout(t),t.invalidateLayout(32),this.i1(t),this.fd(t),this.doLinkRouting(t),o.isValidLayout=!0):(this.doLinkRouting(t),this.jr=!0):s&&this.doLinkRouting(t)}LT(t){let e=t.Ch.iterator;for(;e.next();)this.LT(e.value);this.fd(t),this.doLinkRouting(t)}get isTreePathToChildren(){return this.wb}set isTreePathToChildren(t){let e=this.wb;if(e!==t&&(m.s(t,"boolean",Y,"isTreePathToChildren"),this.wb=t,this.t("isTreePathToChildren",e,t),!this.undoManager.isUndoingRedoing)){let i=this.nodes;for(;i.next();)i.value.Ap()}}findTreeRoots(){let t=new q,e=this.nodes;for(;e.next();){let i=e.value;i.isTopLevel&&i.findTreeParentLink()===null&&t.add(i)}return t.iterator}get treeCollapsePolicy(){return this.xb}set treeCollapsePolicy(t){let e=this.xb;e!==t&&(t!==1&&t!==2&&t!==3&&m.o("Unknown Diagram.treeCollapsePolicy: "+t),this.xb=t,this.t("treeCollapsePolicy",e,t))}get isCollapsingExpanding(){return this.XM}set isCollapsingExpanding(t){this.XM=t}QR(){let t=new Mt,e=new Mt;function i(s){let n=s.toLowerCase(),o=new q;t.set(s,o),t.set(n,o),e.set(s,s),e.set(n,s)}i("InitialAnimationStarting"),i("AnimationStarting"),i("AnimationFinished"),i("BackgroundSingleClicked"),i("BackgroundDoubleClicked"),i("BackgroundContextClicked"),i("ClipboardChanged"),i("ClipboardPasted"),i("DocumentBoundsChanged"),i("ExternalObjectsDropped"),i("FocusOrVirtualPointerEnabledChanged"),i("GainedFocus"),i("InitialLayoutCompleted"),i("LayoutCompleted"),i("LinkDrawn"),i("LinkRelinked"),i("LinkReshaped"),i("LostFocus"),i("Modified"),i("ObjectSingleClicked"),i("ObjectDoubleClicked"),i("ObjectContextClicked"),i("PartCreated"),i("PartResized"),i("PartRotated"),i("SelectionMoved"),i("SelectionCopied"),i("SelectionDeleting"),i("SelectionDeleted"),i("SelectionGrouped"),i("SelectionUngrouped"),i("ChangingSelection"),i("ChangedSelection"),i("SubGraphCollapsed"),i("SubGraphExpanded"),i("TextEdited"),i("ThemeChanged"),i("TreeCollapsed"),i("TreeExpanded"),i("ViewportBoundsChanged"),i("InvalidateDraw"),this.BM=t,this.zM=e}fT(t){let e=this.zM.get(t);return e!==null?e:this.zM.get(t.toLowerCase())}R2(t){let e=this.BM.get(t);if(e!==null)return e;let i=t.toLowerCase();if(e=this.BM.get(i),e!==null)return e;m.o("Unknown DiagramEvent name: "+t)}addDiagramListener(t,e){m.s(t,"string",Y,"addDiagramListener:name"),m.S(e,Y,"addDiagramListener:listener");let i=this.R2(t);return i!==null&&i.add(e),this}removeDiagramListener(t,e){m.s(t,"string",Y,"removeDiagramListener:name"),m.S(e,Y,"addDiagramListener:listener");let i=this.R2(t);i!==null&&i.delete(e)}raiseDiagramEvent(t,e,i){this.T(t,e,i)}T(t,e,i){let s=this.R2(t),n=new wi;n.diagram=this;let o=this.fT(t);o!==null&&(n.name=o),e!==void 0&&(n.subject=e),i!==void 0&&(n.parameter=i);let r=s.length;if(r===1)s.elt(0)(n);else if(r!==0){let a=s.toArray();for(let h=0;h<r;h++){let l=a[h];l(n)}}}isUnoccupied(t,e){return this.getPositions(!1,null,e||null).isUnoccupied(t.x,t.y,t.width,t.height)}computeOccupiedArea(t){return this.isVirtualized?this.viewportBounds.copy():this.mh?this.aT(t):t.h(this.documentBounds)}getPositions(t,e,i){let s=this.sa;s===null&&(this.sa=s=new Ot(this.avoidanceCellSize));let n=e;if(s.Xo||s.Ah!==n||s.O2!==i){if(s.I2=Math.max(s.cf+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.width)),s.E2=Math.max(s.cf+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.height)),n!==null&&(n=this.AT(n)),n===null){let o=I.l();this.computeOccupiedArea(o),o.inflate(100,100),s.a1(o);let r=this.nodes;for(;r.next();){let a=r.value,h=a.layer;h===null||!h.visible||h.isTemporary||this.U2(a,i,o)}I.i(o)}else{if(n.memberParts.count>0){let a=this.computePartsBounds(n.memberParts,!1);a.inflate(20,20),s.a1(a)}let o=I.l(),r=n.memberParts;for(;r.next();){let a=r.value;a instanceof $&&this.U2(a,i,o)}I.i(o)}s.Ah=n,s.O2=i,s.Xo=!1}else t&&s.TT();return s}get avoidanceCellSize(){return this.ZM}set avoidanceCellSize(t){this.sa=null,this.ZM=new st(Math.max(1,t.width),Math.max(1,t.height))}get avoidanceLimit(){return this.QM}set avoidanceLimit(t){this.QM=Math.max(1,t)}AT(t){return t.canAvoid()?t:t.containingGroup!==null?this.AT(t.containingGroup):null}U2(t,e,i){if(t===e||!t.isVisible())return;let s=t.canAvoid();if(s){let n=t.getAvoidableRect(i);this.sa.vO(n.x,n.y,n.width,n.height)}if(t instanceof ht&&(!s||t.avoidableMembers)){let n=t.memberParts;for(;n.next();){let o=n.value;o instanceof $&&this.U2(o,e,i)}}}ud(t){this.sa!==null&&!this.sa.Xo&&(t===void 0||t.canAvoid())&&(this.sa.Xo=!0)}get autoScrollInterval(){return this.tp}set autoScrollInterval(t){let e=this.tp;e!==t&&(this.tp=t,this.t("autoScrollInterval",e,t))}get autoScrollRegion(){return this.ep}set autoScrollRegion(t){typeof t=="number"&&(t=new Dt(t));let e=this.ep;e.equals(t)||(t=t.N(),this.ep=t,this.invalidateDocumentBounds(),this.t("autoScrollRegion",e,t))}doAutoScroll(t){this.lp.h(t);let e=P.l();this.computeAutoScrollPosition(this.lp,e).equalsApprox(this.position)?this.stopAutoScroll():this.DT(),P.i(e)}DT(){if(this.Zc!==-1)return;let t=this.tp,e=this;this.Zc=m.un(()=>{if(e.Zc===-1||(e.stopAutoScroll(),e.lastInput.event===null))return;let i=P.l(),s=e.computeAutoScrollPosition(e.lp,i);if(!s.equalsApprox(e.position)){e.position=s,e.lastInput.documentPoint=e.transformViewToDoc(e.lp),e.doMouseMove(),e.mh=!0;let n=I.l();e.computeBounds(n),n.unionRect(e.documentBounds),e.MT(n),I.i(n),e.qi=!0,e.maybeUpdate(),e.DT()}P.i(i)},t)}stopAutoScroll(){this.Zc!==-1&&(m.wc(this.Zc),this.Zc=-1)}computeAutoScrollPosition(t,e){let i=this.position;e===void 0&&(e=new P),e.h(i);let s=this.ep;if(s.top<=0&&s.left<=0&&s.right<=0&&s.bottom<=0)return e;let n=this.viewportBounds,o=this.scale,r=I.z(0,0,n.width*o,n.height*o),a=P.z(0,0);if(t.x>=r.x&&t.x<r.x+s.left&&this.allowHorizontalScroll){let h=Math.max(this.scrollHorizontalLineChange,1);h=h|0,a.x-=h,t.x<r.x+s.left/2&&(a.x-=h),t.x<r.x+s.left/4&&(a.x-=4*h)}else if(t.x<=r.x+r.width&&t.x>r.x+r.width-s.right&&this.allowHorizontalScroll){let h=Math.max(this.scrollHorizontalLineChange,1);h=h|0,a.x+=h,t.x>r.x+r.width-s.right/2&&(a.x+=h),t.x>r.x+r.width-s.right/4&&(a.x+=4*h)}if(t.y>=r.y&&t.y<r.y+s.top&&this.allowVerticalScroll){let h=Math.max(this.scrollVerticalLineChange,1);h=h|0,a.y-=h,t.y<r.y+s.top/2&&(a.y-=h),t.y<r.y+s.top/4&&(a.y-=4*h)}else if(t.y<=r.y+r.height&&t.y>r.y+r.height-s.bottom&&this.allowVerticalScroll){let h=Math.max(this.scrollVerticalLineChange,1);h=h|0,a.y+=h,t.y>r.y+r.height-s.bottom/2&&(a.y+=h),t.y>r.y+r.height-s.bottom/4&&(a.y+=4*h)}return a.equalsApprox(P.dn)||(e.x=i.x+a.x/o,e.y=i.y+a.y/o),I.i(r),P.i(a),e}makeSvg(t){this.Vo.has("SVG")||this.addRenderer("SVG",new ui(this,K.document));let e=new ui(this,K.document,!0);t===void 0&&(t={});let i=this;function s(n,o){let r=i.vT(n,"SVG",e),a=r!==null?r.svg:null,h=n.svgFinished;return a&&h&&h(a),m.it(o)?(o(a),null):a}return this.FT(s,t)}makeSVG(t){return this.makeSvg(t)}addRenderer(t,e){this.Vo.set(t,e)}removeRenderer(t){this.Vo.delete(t)}cacheGroupExternalLinks(t){this.f2=t,t||this.nodes.each(e=>{e instanceof ht&&(e.Tp=null)})}FT(t,e){let i=e.callback,s=!0,n=this.oa.iterator;for(;n.next();)if(!n.value[0].Sn){s=!1;break}if(!m.it(i)||s)return t(e,i,this);let o=this;function r(){let l=+new Date;for(s=!0,n.reset();n.next();)if(!n.value[0].Sn){s=!1;break}if(s||l-h>a){t(e,i,o);return}K.requestAnimationFrame(r)}let a=e.callbackTimeout||300,h=+new Date;return K.requestAnimationFrame(()=>r()),null}makeImage(t){return Y.isUsingDOM()?(t===void 0&&(t={}),t.returnType="Image",this.makeImageData(t)):null}makeImageData(t){return t===void 0&&(t={}),this.FT(this.FO,t)}static img="image";FO(t,e,i){let s=i.vT(t,"canvas",null);if(s===null)return null;let n=s.F.canvas,o=null;if(n!==null){let r=t.returnType;switch(r===void 0?r="string":r=r.toLowerCase(),r){case Y.img+"data":o=s.getImageData(0,0,n.width,n.height);break;case Y.img:let a=(t.document||document).createElement("img");a.src=n.toDataURL(t.type,t.details),o=a;break;case"blob":{let h=n;return m.it(e)||(o="",m.o('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.')),m.it(h.toBlob)?(h.toBlob(e,t.type,t.details),"toBlob"):(e(null),null)}case"string":default:o=n.toDataURL(t.type,t.details)}}return m.it(e)?(e(o),null):o}static RO=!1;vT(t,e,i){this.animationManager.stopAnimation(),this.maybeUpdate(),m.$(t)||m.o("properties argument must be an Object.");let s=!1,n=t.size||null,o=t.scale||null;t.scale!==void 0&&isNaN(t.scale)&&(o="NaN");let r=t.maxSize;t.maxSize===void 0&&(s=!0,e==="SVG"?r=new st(1/0,1/0):r=new st(2e3,2e3));let a=t.position||null,h=t.parts||null;Array.isArray(h)&&(h=new q(h));let l=t.padding===void 0?1:t.padding,u=t.background||null,c=t.omitTemporary;c===void 0&&(c=!0);let d=t.document||K.document,f=t.elementFinished||null,p=t.showTemporary;p===void 0&&(p=!c);let g=t.showGrid;g===void 0&&(g=p),n!==null&&isNaN(n.width)&&isNaN(n.height)&&(n=null),typeof l=="number"?l=new Dt(l):l instanceof Dt||m.o("MakeImage padding must be a Margin or a number."),l.left=Math.max(l.left,0),l.right=Math.max(l.right,0),l.top=Math.max(l.top,0),l.bottom=Math.max(l.bottom,0),this.Wt&&this.Wt.clearContextCache(!0);let y=new Fe(null,d,void 0,!0),b=y._t;if(!(n||o||h||a))return y.width=this.wt+Math.ceil(l.left+l.right),y.height=this.xt+Math.ceil(l.top+l.bottom),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.Qr=d,i.dd=f,this.s1(i._t,l,new st(y.width,y.height),this.et,this.ct,h,u,p,g),i._t):(this.od=!1,this.s1(b,l,new st(y.width,y.height),this.et,this.ct,h,u,p,g),this.od=!0,y._t);let v=this.hp,w=this.documentBounds.copy();if(w.subtractMargin(this.Qt),p){let F=this.Vt.r,O=F.length;for(let E=0;E<O;E++){let B=F[E];if(!B.visible||!B.isTemporary)continue;let X=B.Nt.r,z=X.length;for(let U=0;U<z;U++){let tt=X[U];if(!tt.isInDocumentBounds||!tt.isVisible())continue;let nt=tt.actualBounds;nt.isReal()&&w.unionRect(nt)}}}let k=new P(w.x,w.y);if(h!==null){let F=new I(0,0,0,0),O=!0,E=h.iterator;for(E.reset();E.next();){let B=E.value;if(!(B instanceof pt))continue;let X=B.layer;if(X!==null&&!X.visible||X!==null&&!p&&X.isTemporary||!B.isVisible())continue;let z=B.actualBounds;z.isReal()&&(O?(O=!1,F.h(z)):F.unionRect(z))}w.width=F.width,w.height=F.height,k.x=F.x,k.y=F.y}a!==null&&a.isReal()&&(k=a,o||(o=v));let S=0,N=0;l!==null&&(S=l.left+l.right,N=l.top+l.bottom);let D=0,L=0;n!==null&&(D=n.width,L=n.height,isFinite(D)&&(D=Math.max(0,D-S)),isFinite(L)&&(L=Math.max(0,L-N)));let M=0,A=0;if(n!==null&&o!==null?(o==="NaN"&&(o=v),n.isReal()?(M=D,A=L):isNaN(L)?(M=D,A=w.height*o):(M=w.width*o,A=L)):n!==null?n.isReal()?(o=Math.min(D/w.width,L/w.height),M=D,A=L):isNaN(L)?(o=D/w.width,M=D,A=w.height*o):(o=L/w.height,M=w.width*o,A=L):o!==null?o==="NaN"&&r.isReal()?(o=Math.min((r.width-S)/w.width,(r.height-N)/w.height),o>v?(o=v,M=w.width,A=w.height):(M=r.width,A=r.height)):(M=w.width*o,A=w.height*o):(o=v,M=w.width,A=w.height),l!==null?(M+=S,A+=N):l=new Dt(0),r!==null){let F=r.width,O=r.height;e!=="SVG"&&s&&Y.RO,isNaN(F)&&(F=2e3),isNaN(O)&&(O=2e3),isFinite(F)&&(M=Math.min(M,F)),isFinite(O)&&(A=Math.min(A,O))}return y.width=Math.ceil(M),y.height=Math.ceil(A),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.Qr=d,i.dd=f,this.s1(i._t,l,new st(Math.ceil(M),Math.ceil(A)),o,k,h,u,p,g),i._t):(this.od=!1,this.s1(b,l,new st(Math.ceil(M),Math.ceil(A)),o,k,h,u,p,g),this.od=!0,y._t)}static Mh=null;static V2="5da73c80a36555d5038e4972187c3cae51fd22";static OO="5da73c80a36555d503aa5c72106c30b35bb2006b9cd041b259";static Kw=!1;static vP=()=>{if(Y.V2[5]===void 0&&(Nt.prototype.Ci=Nt.prototype.Mu),!Y.isUsingDOM())return;let t=m.Ni("canvas");t.width=350;let e=t.getContext("2d"),i=m.We("7ca11abfd022028846"),s="7ca11abfd7330390",n=[Y.V2,m.Kw+"4ae6247590da4bb21c324ba3a84e385776",Nt.vP+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",C.za];e.scale(2,2);let o=8;for(let r=1;r<5;r++)e[m.We(s)](m.We(n[r-1]),o,r*15);e[i]=m.We("39f046ebb36e4b");for(let r=1;r<5;r++)e[m.We(s)](m.We(n[r-1]),o,r*15);(n.length!==4||n[0][0]!=="5"||n[3][0]!=="7")&&(Nt.prototype.Ci=Nt.prototype.Mu),Y.Mh=t};static IO=()=>{if(Y.V2[5]===void 0&&(Nt.prototype.Ci=Nt.prototype.Mu),!Y.isUsingDOM())return;let t=m.Ni("canvas"),e=t.getContext("2d"),i=m.We("7ca11abfd022028846"),s="7ca11abfd7330390",n=[Y.OO,C.za],o=5;e.scale(2,2);for(let r=1;r<3;r++)e[m.We(s)](m.We(n[r-1]),o,r*11);e[i]=m.We("39f046ebb36e4b");for(let r=1;r<3;r++)e[m.We(s)](m.We(n[r-1]),o,r*11);(n.length!==2||n[0][0]!=="5")&&(Nt.prototype.Ci=Nt.prototype.Mu),Y.Mh=t}}class Fn{RT;OT;B2;bi;constructor(t){if(this.RT=null,this.OT="63ad05bbe23a1786468a4c741b6d2",this.B2="@onz",this.OT===this._tk){this.B2=!0,this.bi=this.B2;return}this.bi=null}EO(t,e){let i="f",s=K[m.We("76a715b2f73f148a")][m.We("72ba13b5")]||"",n=m.We;if(this.bi=!0,!Y.isUsingDOM())return;let o=Y[n("76a115b6ed251eaf4692")];if(!o){let a=s[n("76ad18b4f73e")];for(let l=s[n("73a612b6fb191d")](n("35e7"))+2;l<a;l++)i+=s[l];let h=i[n("73a612b6fb191d")](n("7da71ca0ad381e90"));this.bi=!(h>=0&&h<i[n("73a612b6fb191d")](n("35")));return}let r=Y.D2.iterator;for(;r.next();){o=r.value;let a=n(o).split(n("39e9")),h=a.length===7?1:0;if(a.length===1&&o.includes(n("5b8b3797c61b32a7"))){if(Y.IO(),!t.lt)return;t.cp=t.lt._t.F[m.We("7eba17a4ca3b1a8346")][m.We("78a118b7")](t.lt._t.F,Y.Mh,4,4)}if(a.length<6)return;let l=n(a[1+h]).split(".");if(a[4+h]!=="7da71ca0")return;let u=n(m[n("6cae19")]).split(".");if(!(l[0]>u[0]||l[0]===u[0]&&l[1]>=u[1]))continue;let c="73a612b6fb191d",d=K[n("74a900bae4370f8b51")][n("6fbb13a1c2311e8a57")].toLowerCase(),f=d[n(c)](n("3aad1ab6e022098b4dc4")),p=n(a[2+h]);if(f>-1){let M=d[n(c)](p.toLowerCase()+"/");if(this.bi=!(M>-1&&M<f),!this.bi)return}let g=s[n("76ad18b4f73e")];for(let M=s[n(c)](n("35e7"))+2;M<g;M++)i+=s[M];let y=i[n(c)](p);if(y<0&&p!==n("7da71ca0ad381e90")&&(y=i[n(c)](n("76a715b2ef3e149757"))),y<0&&(y=i[n(c)](n("76a715b2ef3e149757"))),y<0&&(y=i[n(c)](n("2bfa41fdb3784bca12"))),y<0&&(y=s[n(c)](n("7baa19a6f76c1988428554"))),y<0&&(y=s[n(c)](n("7ea902b2b9221e9c57c45767196566"))),this.bi=!(y>=0&&y<i[n(c)](n("35"))||i[n(c)](n("35"))===-1),!this.bi||s[n(c)](n("7fb002b6ed25128b4da25b2e"))&&(this.bi=!(s[n(c)](p)>-1),!this.bi))return;let b=K[m.We("76a715b2f73f148a")][m.We("69ad17a1e03e")],v=b[n(c)](n("7fb002b6ed25128b4da25b2e"));if(v>-1&&(this.bi=!(b[n(c)](p)>v),!this.bi))return;let w=p;if(w[0]!=="#")continue;let k=m.Ni("div"),S=a[0+h].replace(/[A-Za-z]/g,"");for(;S.length<4;)S+="9";let N=S;S=S.substring(S.length-4);let D=parseInt(u[0]),L=parseInt(u[1]);if(D>3||D===3&&L>=1){let M=parseInt(N)%40+30,A=parseInt(w.substring(1,5),16);if(j.IT===M+A){this.bi=!1;return}}else{let M="",A=["gsh","gsf"],F=["Header","Background","Display","Feedback"];if(M+=A[parseInt(S.substring(0,1),10)%2],M+=F[parseInt(S.substring(0,1),10)%4],k[n("79a417a0f0181a8946")]=M,K.document[n("78a712aa")]){K.document[n("78a712aa")][n("7bb806b6ed32388c4a875b")](k);let O=K.getComputedStyle(k).getPropertyValue(n("78a704b7e62456904c9b12701b6532a8")),E=K.getComputedStyle(k).getPropertyValue(n("75b817b0ea2202"));if(K.document[n("78a712aa")][n("68ad1bbcf533388c4a875b")](k),!O)continue;let B=K[n("77a902b0eb1b1e804a8a")],X="0."+parseInt(N,10)%100;if(E===X||O.indexOf(parseInt(w[1]+w[2],16).toString())!==-1&&O.indexOf(parseInt(w[3]+w[4],16).toString())!==-1){this.bi=!1;return}else if(B&&B(n("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches){M="."+M;for(let z=0;z<K.document.styleSheets.length;z++){let U=K.document.styleSheets[z].rules||K.document.styleSheets[z].cssRules;for(let tt in U)if(M===U[tt].selectorText){this.bi=!1;return}}}}else this.bi=null,e&&(this.bi=!1)}}}Mh(t,e){return e.setTransform(t.$e/2,0,0,t.$e/2,0,0),e.commitTransform(),this.bi===null&&this.EO(t,!0),0<this.bi&&this!==this.RT}}class Ke{z2;X2;constructor(t){this.z2=t===void 0?new P:t,this.X2=new P}get point(){return this.z2}set point(t){this.z2=t}get shifted(){return this.X2}set shifted(t){this.X2=t}}class On{Ri;pT;o1;constructor(t,e,i){this.Ri=t,this.pT=e,this.o1=i}}class Pi{isGridSnapEnabled;isGridSnapRealtime;gridSnapCellSize;gridSnapCellSpot;gridSnapOrigin;dragsLink;dragsTree;groupsSnapMembers;groupsAlwaysMove;dragsMembers;constructor(t){this.Ue(),t&&Object.assign(this,t)}Ue(){this.isGridSnapEnabled=!1,this.isGridSnapRealtime=!0,this.gridSnapCellSize=new st(NaN,NaN).k(),this.gridSnapCellSpot=T.TopLeft,this.gridSnapOrigin=new P(NaN,NaN).k(),this.dragsLink=!1,this.dragsTree=!1,this.groupsSnapMembers=!1,this.groupsAlwaysMove=!0,this.dragsMembers=!0}}class Rn extends Y{constructor(t,e){let i;return t===void 0||typeof t=="string"||K.Element&&t instanceof Element?i=t:m.$(t)&&(e=t),super(i),this.ET(),e&&this.setProperties(e),this}ET(){this.allowDragOut=!0,this.allowMove=!1,this.isReadOnly=!0,this.contentAlignment=T.TopCenter,this.layout=new Ue}setupRouters(){}reset(){super.reset(),this.ET()}}class hi extends Y{h1;c1;f1;u1;Dp;ff;Bl;G2;Y2;d1;K2;constructor(t,e){let i;return t===void 0||typeof t=="string"||K.Element&&t instanceof Element?i=t:m.$(t)&&(e=t),super(i),this.animationManager.isEnabled=!1,this.Ht=!0,this.h1=null,this.Qu=!1,this._u=!1,this.c1=!0,this.f1=!0,this.u1=0,this.Dp=!1,this.ff=null,this.setRenderingHint("drawShadows",!1),this.Bl=new pt({selectable:!0,selectionAdorned:!1,selectionObjectName:"BOXSHAPE",locationObjectName:"BOXSHAPE",resizeObjectName:"BOXSHAPE",cursor:"move"}).add(new et({name:"BOXSHAPE",fill:"transparent",stroke:"magenta",strokeWidth:2}).theme("stroke","overviewBox")).It(),this.allowCopy=!1,this.allowDelete=!1,this.allowDrop=!1,this.allowSelect=!0,this.autoScrollRegion=new Dt(0,0,0,0),this.ct.e(0,0),this.toolManager.Jt("Dragging",new En,this.toolManager.mouseMoveTools),this.click=()=>{let s=this.observed;if(s===null)return;let n=s.viewportBounds,o=this.lastInput.documentPoint;s.position=new P(o.x-n.width/2,o.y-n.height/2)},this.G2=s=>{this.invalidateDocumentBounds(),this.vp()},this.Y2=s=>{this.observed!==null&&(this.invalidateDocumentBounds(),this.C())},this.d1=s=>{this.updateDelay<1?this.C():this.Dp||(this.Dp=!0,m.un(()=>this.redraw(),this.updateDelay))},this.K2=s=>{this.observed!==null&&this.vp()},this.autoScale=2,this.Ht=!1,e&&this.setProperties(e),this}setupRouters(){}computePixelRatio(){return 1}redraw(){this.Dp&&this.updateDelay>=1&&(this.Dp=!1,this.UO()),super.redraw()}Ge(){if(this.Mt===null&&m.o("No div specified"),this.lt===null&&m.o("No canvas specified"),this.lt instanceof ui||(this.box.UM(),!this.qi))return;let t=this.observed;if(t===null||t.animationManager.defaultAnimation.isAnimating||!t.Qa)return;this.Mp();let e=this.lt,i=this.Wt;if(i.clearContextCache(!0),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.width,e.height),this.updateDelay<1)this.UT();else if(this.ff!==null){i.drawImage(this.ff.bt,0,0);let o=this.v;i.scale(this.$e,this.$e),i.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),i.commitTransform()}let s=this.Vt.r,n=s.length;for(let o=0;o<n;o++)s[o].Ge(i,this);this.ef=!1,this.qi=!1}UO(){let t=this.lt,e=this.Wt;if(!(t===null||e===null)){if(this.Mp(),this.ff===null){let i=new Fe(null);i.width=t.width,i.height=t.height,this.ff=i}try{this.lt=this.ff,this.Wt=this.lt._t,this.Wt.clearContextCache(!0),this.Wt.setTransform(1,0,0,1,0,0),this.Wt.clearRect(0,0,this.lt.width,this.lt.height),this.UT()}finally{this.lt=t,this.Wt=e}}}UT(){let t=this.observed;if(t===null)return;let e=this.drawsTemporaryLayers,i=this.drawsGrid&&e,s=t.grid;if(i&&s!==null&&s.visible&&!(isNaN(s.width)||isNaN(s.height))){let u=I.l().h(this.viewportBounds).unionRect(t.viewportBounds);t.ca(u),I.i(u),t.Te()}let n=this.v,o=this.Wt;o.scale(this.$e,this.$e),o.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),o.commitTransform();let r=this.viewportBounds,a=t.Vt.r,h=a.length,l=this.Vt.r;this.rs(l,l.length,this,this.viewportBounds);for(let u=0;u<h;u++)a[u].ER(o,r,this,e,i)}get observed(){return this.h1}set observed(t){let e=this.h1;if(t!==null&&m.se(t,Y,hi,"observed"),t instanceof hi&&m.o("Overview.observed Diagram may not be an Overview itself: "+t),e!==t){if(e!==null&&this.VO(e),this.h1=t,t!==null&&this.BO(t),this.invalidateDocumentBounds(),t===null){this.ff=null;let i=this.lt,s=this.Wt;i&&s&&(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,i.width,i.height))}else this.d1(null),this.vp(),this.C();this.t("observed",e,t)}}get box(){return this.Bl}set box(t){let e=this.Bl;e!==t&&(t.It(),this.Bl=t,this.remove(e),this.add(this.Bl),this.vp(),this.t("box",e,t))}get drawsTemporaryLayers(){return this.c1}set drawsTemporaryLayers(t){this.c1!==t&&(this.c1=t,this.redraw())}get drawsGrid(){return this.f1}set drawsGrid(t){this.f1!==t&&(this.f1=t,this.redraw())}get updateDelay(){return this.u1}set updateDelay(t){t<0&&(t=0),this.u1!==t&&(this.u1=t)}BO(t){t!==null&&(t.addDiagramListener("ViewportBoundsChanged",this.G2),t.addDiagramListener("DocumentBoundsChanged",this.Y2),t.addDiagramListener("InvalidateDraw",this.d1),t.addDiagramListener("AnimationFinished",this.K2),this.add(this.box))}VO(t){t!==null&&(this.remove(this.box),t.removeDiagramListener("ViewportBoundsChanged",this.G2),t.removeDiagramListener("DocumentBoundsChanged",this.Y2),t.removeDiagramListener("InvalidateDraw",this.d1),t.removeDiagramListener("AnimationFinished",this.K2))}vp(){let t=this.box,e=this.observed;if(e===null)return;this.qi=!0;let i=e.viewportBounds,s=t.selectionObject,n=st.l();n.e(i.width,i.height),s.desiredSize=n,st.i(n);let o=2/this.scale;s instanceof et&&(s.strokeWidth=o),t.location=new P(i.x-o/2,i.y-o/2),t.isSelected=!0}computeBounds(){let t=this.observed;if(t===null)return I.tm;let e=t.documentBounds.copy();return e.unionRect(t.viewportBounds),e}invalidateViewport(t,e){this.qi!==!0&&(this.qi=!0,this.requestUpdate())}onViewportBoundsChanged(t,e,i,s){this.Ht||(this.ha(),this.C(),this.Nh(),this.invalidateDocumentBounds(),this.vp(),this.Ye.scale=i,this.Ye.position.x=t.x,this.Ye.position.y=t.y,this.Ye.bounds.h(t),this.Ye.isScroll=s,this.T("ViewportBoundsChanged",this.Ye,t))}}class En extends Tt{ua;constructor(){super(),this.ua=P.gn}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||!t.allowMove||!t.allowSelect)return!1;let e=t.observed;if(e===null)return!1;let i=t.lastInput;if(!i.left||t.currentTool!==this&&(!this.isBeyondDragSize()||i.isTouchEvent&&i.timestamp-t.firstInput.timestamp<this.delay))return!1;if(this.findDraggablePart()===null){let s=e.viewportBounds;this.ua=new P(s.width/2,s.height/2);let n=t.firstInput.documentPoint;e.position=new P(n.x-this.ua.x,n.y-this.ua.y)}return!0}doActivate(){this.ua=P.gn,super.doActivate()}doUpdateCursor(t){let e=this.diagram,i=e.box;i!==null&&i.cursor&&(e.currentCursor=i.cursor)}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram,n=s.observed;if(n===null)return;let o=s.box;if(o===null)return;if(!this.ua.isReal()){let a=s.firstInput.documentPoint,h=o.location;this.ua=new P(a.x-h.x,a.y-h.y)}let r=s.lastInput.documentPoint;n.position=new P(r.x-this.ua.x,r.y-this.ua.y)}}class jt{a;g1="go._clipboard";m1="go._clipboardFormat";H2;q2;j2;W2;J2;$2;Z2;Q2;_2;da;tN;p1;w1;b1;k1;eN;Go;iN;sN;Fp;nN;P1;oN;S1;rN;lN;gd;Rp;Op;aN;_c;hN;cN;fN;uN;dN;md;gN;Oi;Ps;M1;Ip;static pd=["Ctrl","Shft","Alt","Meta"];static VT=jt.mN(230,40,15);static zO=jt.mN(270,40,15);static XO=jt.mN(310,40,15);constructor(t){V.Je(this),this.a=Y.Rm(),this.H2=!0,this.q2=!0,this.j2=!0,this.W2=!1,this.J2=!1,this.$2=!1,this.Z2=!1,this.Q2="memory",this._2=null,this.da=null,this.tN=1.05,this.p1=NaN,this.w1=P.gn,this.b1=NaN,this.k1=I.tm,this.eN=!1,this.Go=null,this.iN=200,this.sN=!1,this.Fp=new vt("Auto",{layerName:"Tool",pickable:!1,selectable:!1}).add(new G("Spot").add(new et({name:"SHAPE",fill:null,stroke:"lime",strokeWidth:4}).bindObject("stroke","adornedPart",e=>e.isSelected?"darkcyan":"lime"),new et({name:"SHAPE2",stretch:2,fill:null,stroke:"magenta",strokeWidth:4,strokeDashArray:[4,4]})),new le({padding:4})),this.nN=null,this.P1="",this.oN="",this.S1=m.hr,this.rN=!1,this.lN=!1,this.gd=new pt({layerName:"Tool",isInDocumentBounds:!1,locationObjectName:"CIRCLE",locationSpot:T.Center,pickable:!1,selectable:!1}).add(new et("Circle",{isGeometryPositioned:!0,width:30,height:30,fill:null,stroke:"darkcyan",strokeWidth:6,visible:!1}).bind("visible","down"),new et({isGeometryPositioned:!0,geometryString:"M15 0L15 30",stroke:"magenta"}),new et({isGeometryPositioned:!0,geometryString:"M0 15L30 15",stroke:"magenta"}),new et("Circle",{name:"CIRCLE",isGeometryPositioned:!0,width:20,height:20,fill:null,stroke:"magenta",position:new P(5,5)}),new et({isGeometryPositioned:!0,geometry:jt.VT,fill:null,stroke:"cyan",strokeWidth:4}).bind("geometry","button",jt.GO),new lt({position:new P(12,0),font:"bold 10pt sans-serif"}).bind("text","clickCount",e=>e>1?e.toString():""),new lt({position:new P(0,16)}).bind("text","modifiers",jt.YO)).freezeBindings(),this.Rp=10,this.Op=1,this.aN=null,this._c=e=>this.KO(e),this.hN=e=>this.HO(e),this.cN=e=>this.qO(e),this.fN=e=>this.jO(e),this.uN=null,this.dN="distance",this.md=null,this.gN=0,this.Oi={},this.Ps=null,this.M1=!1,this.Ip=null,this.pN(),this.gd.data=this.Oi,t&&Object.assign(this,t)}toString(){return"CommandHandler"}get diagram(){return this.a}Ro(t){this.a=t}doStart(){let t=this.a;t&&(t.addModelChangedListener(this._c),t.addDiagramListener("ViewportBoundsChanged",this.hN),t.addDiagramListener("GainedFocus",this.cN),t.addDiagramListener("LostFocus",this.fN))}doStop(){let t=this.a;t&&(t.removeDiagramListener("ViewportBoundsChanged",this.hN),t.removeDiagramListener("GainedFocus",this.cN),t.removeDiagramListener("LostFocus",this.fN),t.removeModelChangedListener(this._c))}doKeyDown(){let t=this.a,e=t.lastInput,i=e.control||e.meta,s=e.shift,n=e.alt,o=e.commandKey;i&&(o==="Insert"||o==="c")?this.canCopySelection()&&this.copySelection():i&&o==="x"||s&&o==="Delete"?this.canCutSelection()&&this.cutSelection():i&&o==="v"||s&&o==="Insert"?this.canPasteSelection()&&this.pasteSelection():i&&o==="y"||i&&s&&o==="z"||n&&s&&o==="Backspace"?this.canRedo()&&this.redo():i&&o==="z"||n&&o==="Backspace"?this.canUndo()&&this.undo():o==="Delete"||o==="Backspace"?this.canDeleteSelection()&&this.deleteSelection():i&&o==="a"?this.canSelectAll()&&this.selectAll():o==="Escape"?this.canStopCommand()&&this.stopCommand():this.BT.indexOf(o)>=0?this.WO(o,i,s):o==="PageUp"?s&&t.allowHorizontalScroll?t.scroll("page","left"):t.allowVerticalScroll&&t.scroll("page","up"):o==="PageDown"?s&&t.allowHorizontalScroll?t.scroll("page","right"):t.allowVerticalScroll&&t.scroll("page","down"):o==="Home"?i&&t.allowVerticalScroll?t.scroll("document","up"):!i&&t.allowHorizontalScroll&&t.scroll("document","left"):o==="End"?i&&t.allowVerticalScroll?t.scroll("document","down"):!i&&t.allowHorizontalScroll&&t.scroll("document","right"):o==="Space"?this.canScrollToPart()&&this.scrollToPart():o==="Minus"||o==="NumpadSubtract"?this.canDecreaseZoom()&&this.decreaseZoom():o==="Equal"||o==="NumpadAdd"?this.canIncreaseZoom()&&this.increaseZoom():i&&o==="Digit0"?this.canResetZoom()&&this.resetZoom():s&&o==="z"?this.canZoomToFit()&&this.zoomToFit():i&&!s&&o==="g"?this.canGroupSelection()&&this.groupSelection():i&&s&&o==="g"?this.canUngroupSelection()&&this.ungroupSelection():o==="F2"?this.canEditTextBlock()&&this.editTextBlock():o==="ContextMenu"||s&&o==="F10"||i&&s&&o==="Backslash"?this.canShowContextMenu()&&this.showContextMenu():e.bubbles=!0}doKeyUp(){let t=this.a.lastInput;t.bubbles=!0}stopCommand(){let t=this.a,e=t.currentTool;if(e instanceof ne){if(e.currentToolTip!==null){e.hideToolTip();return}t.allowSelect&&t.clearSelection()}e!==null&&e.doCancel()}canStopCommand(){return!0}selectAll(){let t=this.a;t.C();try{t.currentCursor="wait",t.T("ChangingSelection",t.selection);let e=t.parts;for(;e.next();){let n=e.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let i=t.nodes;for(;i.next();){let n=i.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let s=t.links;for(;s.next();){let n=s.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}}finally{t.T("ChangedSelection",t.selection),t.currentCursor=""}}canSelectAll(){return this.a.allowSelect}deleteSelection(){let t=this.a;try{t.currentCursor="wait",t.T("ChangingSelection",t.selection),t.startTransaction("Delete"),t.T("SelectionDeleting",t.selection);let e=new V,i=t.selection.iterator;for(;i.next();){let s=i.value;pt.ga(e,s,!0,this.deletesTree?1/0:0,this.deletesConnectedLinks?null:!1,n=>n.canDelete())}t.removeParts(e,!0),t.T("SelectionDeleted",e)}finally{t.commitTransaction("Delete"),t.T("ChangedSelection",t.selection),t.currentCursor=""}}canDeleteSelection(){let t=this.a;return!(t.isReadOnly||t.isModelReadOnly||!t.allowDelete||t.selection.count===0)}copySelection(){let t=this.a;try{let e=new V,i=t.selection.iterator;for(;i.next();){let s=i.value;pt.ga(e,s,!0,this.copiesTree?1/0:0,this.copiesConnectedLinks,n=>n.canCopy())}this.copyToClipboard(e)}finally{}}canCopySelection(){let t=this.a;return!(!t.allowCopy||!t.allowClipboard||t.selection.count===0)}cutSelection(){this.copySelection(),this.deleteSelection()}canCutSelection(){let t=this.a;return!(t.isReadOnly||t.isModelReadOnly||!t.allowCopy||!t.allowDelete||!t.allowClipboard||t.selection.count===0)}copyToClipboard(t){let e=this.a,i=this.storageLocation==="systemClipboard";if(i||this.storageLocation!=="memory")try{if(t===null)if(i&&K.navigator.clipboard)K.navigator.clipboard.writeText("");else{let n=K[this.storageLocation];if(!n)return;n.setItem(this.g1,""),n.setItem(this.m1,"")}else{let n=new Y;n.isTreePathToChildren=e.isTreePathToChildren,n.toolManager.draggingTool.dragsLink=e.toolManager.draggingTool.dragsLink,n.model=e.model.copy();let o=e.copyParts(t,n,!1);if(this.Rc(o),i&&K.navigator.clipboard)K.navigator.clipboard.writeText(n.model.toJson());else{let r=K[this.storageLocation];if(!r)return;r.setItem(this.g1,n.model.toJson()),r.setItem(this.m1,n.model.dataFormat)}}e.T("ClipboardChanged",t);return}catch{return}let s=null;if(t===null)Y.iT();else{let n=null;try{n=e.copyParts(t,null,!0),this.Rc(n)}finally{s=new q,n!==null&&s.addAll(n.iteratorValues),Y.bp=s,Y.t1=e.model.dataFormat}}e.T("ClipboardChanged",s)}Rc(t){let e=this.diagram.model;this.copiesParentKey&&e.Nx()?t.each(i=>{let s=i.key,n=i.value;if(s instanceof $&&n instanceof $&&s.data&&n.data){let o=e.getParentKeyForNodeData(s.data),r=this.diagram.findNodeForKey(o);r!==null&&!t.has(r)&&e.setParentKeyForNodeData(n.data,o)}}):this.copiesGroupKey&&e.Th()&&t.each(i=>{let s=i.key,n=i.value;if(!(s instanceof j)&&!(n instanceof j)&&s.data&&n.data){let o=e.getGroupForData(s.data),r=this.diagram.findNodeForKey(o);r!==null&&!t.has(r)&&e.setGroupForData(n.data,o)}})}pasteFromClipboard(){let t=this.a;if(this.storageLocation!=="memory"){let n=new V;try{let o=K[this.storageLocation];if(!o)return n;let r=o.getItem(this.g1),a=o.getItem(this.m1);if(r===null||r===""||a!==t.model.dataFormat)return n;{let h=new Y;h.model=ut.fromJson(r);let l=new V;l.addAll(h.parts).addAll(h.nodes).addAll(h.links);let u=t.copyParts(l,t,!1);return this.Rc(u),new V().addAll(u.iteratorValues)}}catch{return n}}let e=new V,i=Y.bp;if(i===null||Y.t1!==t.model.dataFormat)return e;let s=null;try{s=t.copyParts(i,t,!1),this.Rc(s)}finally{if(s!==null){let n=s.iterator;for(;n.next();){let o=n.value,r=n.key;o.location.isReal()||(r.location.isReal()?o.location=r.location:!o.position.isReal()&&r.position.isReal()&&(o.position=r.position)),e.add(o)}}}return e}async pasteSelectionAsync(t){let e=this.a;if(K.navigator.clipboard===void 0){m.ne('Cannot paste with storageLocation "clipboard", window.isSecureContext may be false.');return}try{e.currentCursor="wait",e.T("ChangingSelection",e.selection),e.startTransaction("Paste");let i=null,s=await K.navigator.clipboard.readText();try{let o=s;if(!(o===null||o==="")){let r=new Y;r.model=ut.fromJson(o);let a=new V;a.addAll(r.parts).addAll(r.nodes).addAll(r.links);let h=e.copyParts(a,e,!1);this.Rc(h),i=new V().addAll(h.iteratorValues)}}catch{}if(i===null)return;i.count>0&&e.clearSelection(!0);let n=i.iterator;for(;n.next();){let o=n.value;o.isSelected=!0}if(t){let o=e.computePartsBounds(e.selection);if(o.isReal()){let r=this.computeEffectiveCollection(e.selection,e.ad);e.Mx(r,new P(t.x-o.centerX,t.y-o.centerY),e.ad,!1)}}e.T("ClipboardPasted",i)}finally{e.commitTransaction("Paste"),e.T("ChangedSelection",e.selection),e.currentCursor=""}}pasteSelection(t){if(this.storageLocation==="systemClipboard"){this.pasteSelectionAsync(t);return}let e=this.a;try{e.currentCursor="wait",e.T("ChangingSelection",e.selection),e.startTransaction("Paste");let i=this.pasteFromClipboard();i.count>0&&e.clearSelection(!0);let s=i.iterator;for(;s.next();){let n=s.value;n.isSelected=!0}if(t){let n=e.computePartsBounds(e.selection);if(n.isReal()){let o=this.computeEffectiveCollection(e.selection,e.ad);e.Mx(o,new P(t.x-n.centerX,t.y-n.centerY),e.ad,!1)}}e.T("ClipboardPasted",i)}finally{e.commitTransaction("Paste"),e.T("ChangedSelection",e.selection),e.currentCursor=""}}canPasteSelection(t){let e=this.a;if(e.isReadOnly||e.isModelReadOnly||!e.allowInsert||!e.allowClipboard)return!1;if(this.storageLocation==="systemClipboard")return!0;if(this.storageLocation!=="memory")try{let i=K[this.storageLocation];if(!i)return!1;let s=i.getItem(this.g1),n=i.getItem(this.m1);return!(s===null||s===""||n!==e.model.dataFormat)}catch{return!1}return!(Y.bp===null||Y.bp.count===0||Y.t1!==e.model.dataFormat)}undo(){this.a.undoManager.undo()}canUndo(){let t=this.a;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canUndo()}redo(){this.a.undoManager.redo()}canRedo(){let t=this.a;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canRedo()}decreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.a;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canDecreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.a;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}increaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.a;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canIncreaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.a;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}resetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.a;t<e.minScale||t>e.maxScale||(e.scale=t)}canResetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.a;return t<e.minScale||t>e.maxScale?!1:e.allowZoom}zoomToFit(t){let e=this.a,i=e.animationManager;i.stopAnimation(),e.redraw();let s=e.position.copy(),n=e.scale;if(i.Gl("Zoom To Fit"),!t&&this.isZoomToFitRestoreEnabled&&n===this.b1&&!isNaN(this.p1)&&this.w1.isReal()&&e.documentBounds.equals(this.k1))e.scale=this.p1,e.position=this.w1,this.b1=NaN,this.k1=I.tm;else{if(this.p1=n,this.w1=s,t){let o=t.copy();if(o.width>0&&o.height>0){let r=e.viewportBounds,a=r.width*n,h=r.height*n,l=Math.min(a/o.width,h/o.height),u=a/l,c=h/l;o.width<u&&(o.x-=(u-o.width)/2),o.height<c&&(o.y-=(c-o.height)/2)}e.zoomToRect(o,2)}else e.zoomToFit();this.b1=e.scale,this.k1=e.documentBounds.copy()}i.PM()}canZoomToFit(t){return this.a.allowZoom}WO(t,e,i){let s=this.a;t==="ArrowUp"?s.allowVerticalScroll&&(e?s.scroll("pixel","up"):s.scroll("line","up")):t==="ArrowDown"?s.allowVerticalScroll&&(e?s.scroll("pixel","down"):s.scroll("line","down")):t==="ArrowLeft"?s.allowHorizontalScroll&&(e?s.scroll("pixel","left"):s.scroll("line","left")):t==="ArrowRight"&&s.allowHorizontalScroll&&(e?s.scroll("pixel","right"):s.scroll("line","right"))}scrollToPart(t){t===void 0&&(t=null),t!==null&&m.se(t,pt,jt,"part");let e=this.a;if(e.ensureBounds(),t===null){try{this.Go!==null&&(this.Go.next()?t=this.Go.value:this.Go=null)}catch{this.Go=null}t===null&&(e.highlighteds.count>0?this.Go=e.highlighteds.iterator:e.selection.count>0&&(this.Go=e.selection.iterator),this.Go!==null&&this.Go.next()&&(t=this.Go.value))}if(t!==null){let i=e.animationManager;i.Gl("Scroll To Part");let s=this.scrollToPartPause;if(s>0){let n=this.uf(t,[t]);if(n.length===1)e.startTransaction(),e.centerRect(t.actualBounds),e.commitTransaction("Scroll To Part");else{let o=()=>{e.startTransaction();let a=n.pop();for(;n.length>0&&a instanceof $&&a.isTreeExpanded&&(!(a instanceof ht)||a.isSubGraphExpanded);)a=n.pop();n.length>0?(a instanceof pt&&e.scrollToRect(a.actualBounds),a instanceof $&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof ht&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof pt&&e.centerRect(a.actualBounds),e.removeDiagramListener("LayoutCompleted",r)),e.commitTransaction("Scroll To Part")},r=()=>{m.un(o,(i.isEnabled?i.duration:0)+s)};e.addDiagramListener("LayoutCompleted",r),o()}}else{let n=e.position.copy();e.centerRect(t.actualBounds),n.equalsApprox(e.position)&&i.stopAnimation()}}}uf(t,e){if(t.isVisible())return e;if(t instanceof vt){let i=t.adornedPart;i!==null&&this.uf(i,e)}else if(t instanceof j){let i=t.fromNode;i!==null&&this.uf(i,e);let s=t.toNode;s!==null&&this.uf(s,e)}else{if(t instanceof $){let s=t.labeledLink;s!==null&&this.uf(s,e);let n=t.findTreeParentNode();n!==null&&(!n.isTreeExpanded&&!n.wasTreeExpanded&&e.push(n),this.uf(n,e))}let i=t.containingGroup;i!==null&&(!i.isSubGraphExpanded&&!i.wasSubGraphExpanded&&e.push(i),this.uf(i,e))}return e}canScrollToPart(t){if(t===void 0&&(t=null),t!==null&&!(t instanceof pt))return!1;let e=this.a;return e.selection.count===0&&e.highlighteds.count===0?!1:e.allowHorizontalScroll&&e.allowVerticalScroll}collapseTree(t){t===void 0&&(t=null);let e=this.a,i="Collapse Tree";try{e.startTransaction(i),e.animationManager.Gl(i);let s=new q;if(t!==null&&t.isTreeExpanded)t.collapseTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof $&&o.isTreeExpanded&&(o.collapseTree(),s.add(o))}}e.T("TreeCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseTree(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof $)||!t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof $){if(!s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}expandTree(t){t===void 0&&(t=null);let e=this.a,i="Expand Tree";try{e.startTransaction(i),e.animationManager.Gl(i);let s=new q;if(t!==null&&!t.isTreeExpanded)t.expandTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof $&&(o.isTreeExpanded||(o.expandTree(),s.add(o)))}}e.T("TreeExpanded",s)}finally{e.commitTransaction(i)}}canExpandTree(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof $)||t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof $){if(s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}groupSelection(){let t=this.a,e=t.model;if(!e.Th())return;let i=this.archetypeGroupData;if(i===null)return;let s=null;try{t.currentCursor="wait",t.T("ChangingSelection",t.selection),t.startTransaction("Group");let n=new q,o=t.selection.iterator;for(;o.next();){let l=o.value;l.Di()&&l.canGroup()&&n.add(l)}let r=new q,a=n.iterator;for(;a.next();){let l=a.value,u=!1,c=n.iterator;for(;c.next();){let d=c.value;if(l.isMemberOf(d)){u=!0;break}}u||r.add(l)}let h=r.first();if(h!==null){let l=h.containingGroup;if(l!==null)for(;l!==null;){let u=!1,c=r.iterator;for(;c.next();)if(!c.value.isMemberOf(l)){u=!0;break}if(u)l=l.containingGroup;else break}if(i instanceof ht)i.It(),s=i.copy(),s!==null&&t.add(s);else if(e.isGroupForData(i)){let u=e.copyNodeData(i);e.addNodeData(u),s=t.findNodeForData(u)}if(s!==null){l!==null&&this.isValidMember(l,s)&&(s.containingGroup=l);let u=r.iterator;for(;u.next();){let c=u.value;this.isValidMember(s,c)&&(c.containingGroup=s)}t.clearSelection(!0),s.isSelected=!0}}t.T("SelectionGrouped",s)}finally{t.commitTransaction("Group"),t.T("ChangedSelection",t.selection),t.currentCursor=""}}canGroupSelection(){let t=this.a;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowGroup||!t.model.Th()||this.archetypeGroupData===null)return!1;let e=t.selection.iterator;for(;e.next();){let i=e.value;if(i.Di()&&i.canGroup())return!0}return!1}yN(t){let e=m.st();if(Array.isArray(t))t.forEach(n=>{n instanceof j||n instanceof pt&&e.push(n)});else{let n=t.iterator;for(;n.next();){let o=n.value;o instanceof j||o instanceof pt&&e.push(o)}}let i=new V,s=e.length;for(let n=0;n<s;n++){let o=e[n],r=!0;for(let a=0;a<s;a++)if(o.isMemberOf(e[a])){r=!1;break}r&&i.add(o)}return m.Z(e),i}isValidMember(t,e){if(e===null||t===e||e instanceof j)return!1;let i;return t!==null&&(t===e||t.isMemberOf(e)||(i=t.memberValidation,i!==null&&!i(t,e))||t.data===null&&e.data!==null||t.data!==null&&e.data===null)?!1:(i=this.memberValidation,i!==null?i(t,e):!0)}ungroupSelection(t){t===void 0&&(t=null);let e=this.a,i=e.model;if(i.Th())try{e.currentCursor="wait",e.T("ChangingSelection",e.selection),e.startTransaction("Ungroup");let s=new q;if(t!==null)s.add(t);else{let o=e.selection.iterator;for(;o.next();){let r=o.value;r instanceof ht&&r.canUngroup()&&s.add(r)}}let n=new q;if(s.count>0){e.clearSelection(!0);let o=s.iterator;for(;o.next();){let r=o.value;r.expandSubGraph();let a=r.containingGroup,h=a!==null&&a.data!==null?i.getKeyForNodeData(a.data):void 0;n.addAll(r.memberParts);let l=n.iterator;for(;l.next();){let u=l.value;if(u.isSelected=!0,u instanceof j)continue;let c=u.data;c!==null?i.setGroupForData(c,h):u.containingGroup=a}e.remove(r)}}e.T("SelectionUngrouped",s,n)}finally{e.commitTransaction("Ungroup"),e.T("ChangedSelection",e.selection),e.currentCursor=""}}canUngroupSelection(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly||e.isModelReadOnly||!e.allowDelete||!e.allowUngroup||!e.model.Th())return!1;if(t!==null){if(!(t instanceof ht))return!1;if(t.canUngroup())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ht&&s.canUngroup())return!0}}return!1}addTopLevelParts(t,e){let i=this.yN(t),s=!0,n=i.iterator;for(;n.next();){let o=n.value;o.containingGroup!==null&&(!e||this.isValidMember(null,o)?o.containingGroup=null:s=!1)}return s}collapseSubGraph(t){t===void 0&&(t=null);let e=this.a,i="Collapse SubGraph";try{e.startTransaction(i),e.animationManager.Gl(i);let s=new q;if(t!==null&&t.isSubGraphExpanded)t.collapseSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ht&&o.isSubGraphExpanded&&(o.collapseSubGraph(),s.add(o))}}e.T("SubGraphCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseSubGraph(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ht)||!t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ht&&s.isSubGraphExpanded)return!0}}return!1}expandSubGraph(t){t===void 0&&(t=null);let e=this.a,i="Expand SubGraph",s=new q;try{if(e.startTransaction(i),e.animationManager.Gl(i),t!==null&&!t.isSubGraphExpanded)t.expandSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ht&&(o.isSubGraphExpanded||(o.expandSubGraph(),s.add(o)))}}e.T("SubGraphExpanded",s)}finally{for(let n of s)this.zT(e,n);t&&this.zT(e,t),e.commitTransaction(i)}}zT(t,e){for(let i of e.memberParts)i instanceof $&&t.Kc(i,e)}canExpandSubGraph(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ht)||t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ht&&!s.isSubGraphExpanded)return!0}}return!1}editTextBlock(t){t===void 0&&(t=null),t!==null&&m.se(t,lt,jt,"editTextBlock");let e=this.a,i=e.toolManager.findTool("TextEditing");if(i!==null){if(t===null){let s=null,n=e.selection.iterator;for(;n.next();){let o=n.value;if(o.canEdit()){s=o;break}}if(s===null)return;t=s.findInVisualTree(o=>o instanceof lt&&o.editable)}t!==null&&(e.currentTool=null,i.textBlock=t,e.currentTool=i)}}canEditTextBlock(t){t===void 0&&(t=null);let e=this.a;if(e.isReadOnly||e.isModelReadOnly||!e.allowTextEdit||e.toolManager.findTool("TextEditing")===null)return!1;if(t!==null){if(!(t instanceof lt))return!1;let i=t.part;if(i!==null&&i.canEdit())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s.canEdit()&&(t=s.findInVisualTree(n=>n instanceof lt&&n.editable),t!==null))return!0}}return!1}showContextMenu(t){let e=this.a,i=e.toolManager.findTool("ContextMenu");if(i===null)return;t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e);let s=i.findObjectWithContextMenu(t);if(s!==null){let n=e.lastInput,o;if(s instanceof J?o=s.getDocumentPoint(T.Center):e.viewportBounds.containsPoint(n.documentPoint)?o=P.gn:o=e.viewportBounds.center,o.isReal()){let r=new Qt;r.diagram=e,r.viewPoint=e.transformDocToView(o),r.documentPoint=o,r.button=2,r.up=!0,e.lastInput=r}e.currentTool=i,i.openMenu(!1,s)}}canShowContextMenu(t){let e=this.a,i=e.toolManager.findTool("ContextMenu");return!(i===null||(t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e),i.findObjectWithContextMenu(t)===null))}downloadSvg(t){let e=this.a,i={scale:1,background:e.div?e.div.style.backgroundColor:"white",name:this.JO("svg")};t&&Object.assign(i,t);let s=e.makeSvg(i);if(s!==null){let n=new XMLSerializer().serializeToString(s);this.$O(i.name,"image/svg+xml",n)}}downloadSVG(t){this.downloadSvg(t)}canDownloadSvg(t){return this.a!==null}$O(t,e,i){let s=null,n=null;try{let o=new Blob([i],{type:e});s=K.URL.createObjectURL(o),n=m.Ni("a"),n.style.display="none",n.href=s,n.download=t,K.document.body.appendChild(n),requestAnimationFrame(()=>{try{n!==null&&n.click()}finally{s!==null&&K.URL.revokeObjectURL(s),n!==null&&K.document.body.removeChild(n)}})}catch{s!==null&&K.URL.revokeObjectURL(s),n!==null&&K.document.body.removeChild(n)}}JO(t){let e="."+t,i=this.diagram.model.name;return i?i.endsWith(e)&&(i=i.substring(0,i.length-e.length)):i="diagram",i+=e,i}get copiesClipboardData(){return this.H2}set copiesClipboardData(t){this.H2=!!t}get copiesConnectedLinks(){return this.q2}set copiesConnectedLinks(t){this.q2=!!t}get deletesConnectedLinks(){return this.j2}set deletesConnectedLinks(t){this.j2=!!t}get copiesTree(){return this.W2}set copiesTree(t){this.W2=!!t}get deletesTree(){return this.J2}set deletesTree(t){this.J2=!!t}get copiesParentKey(){return this.$2}set copiesParentKey(t){this.$2=!!t}get copiesGroupKey(){return this.Z2}set copiesGroupKey(t){this.Z2=!!t}get storageLocation(){return this.Q2}set storageLocation(t){t||(t="memory"),t!=="memory"&&t!=="sessionStorage"&&t!=="localStorage"&&t!=="systemClipboard"&&m.o("Invalid new value for CommandHandler.storageLocation: "+t),this.Q2=t}get archetypeGroupData(){return this._2}set archetypeGroupData(t){t!==null&&m.xc(t,jt,"archetypeGroupData");let e=this.a;this._2=t}get memberValidation(){return this.da}set memberValidation(t){t!==null&&m.S(t,jt,"memberValidation"),this.da=t}get defaultScale(){return this.diagram.defaultScale}set defaultScale(t){this.diagram.defaultScale=t}get zoomFactor(){return this.tN}set zoomFactor(t){t>1||m.o("zoomFactor must be larger than 1.0, not: "+t),this.tN=t}get isZoomToFitRestoreEnabled(){return this.eN}set isZoomToFitRestoreEnabled(t){this.eN=!!t}get scrollToPartPause(){return this.iN}set scrollToPartPause(t){this.iN=t}computeEffectiveCollection(t,e){let i=this.a,s=i.toolManager.findTool("Dragging"),n=i.currentTool===s;e===void 0&&(e=i.Cp());let o=new Mt;if(t===null)return o;let r=t.iterator;for(;r.next();){let a=r.value;i.Zr(o,a,n,e)}if(i.draggedLink!==null&&e.dragsLink)return o;for(r=t.iterator;r.next();){let a=r.value;if(a instanceof j){let h=a.fromNode;if(h!==null&&!o.has(h))o.delete(a);else{let l=a.toNode;l!==null&&!o.has(l)&&o.delete(a)}}}return o}static getModifierNames(){return jt.pd}static setModifierNames(t){jt.pd=t}static YO(t){let e="";return t&1&&(e+=jt.pd[0]||""),t&4&&(e+=jt.pd[1]||""),t&2&&(e+=jt.pd[2]||""),t&8&&(e+=jt.pd[3]||""),e}static GO(t){return t===1?jt.zO:t===2?jt.XO:jt.VT}static mN(t,e,i){var s=new P(i,0).rotate(t-e/2),n=new wt().add(new zt(-i,-i)).add(new zt(i,i)).add(new zt(s.x,s.y).add(new mt(5,t-e/2,e,0,0,i,i)));return n.offset(i,i),n}KO(t){t.isTransactionFinished&&this.updateFocusBox()}HO(t){if(t.subject.scale===this.diagram.scale)return;let e=4/this.diagram.scale,i=this.focusBox.findObject("SHAPE");i!==null&&(i.strokeWidth=e);let s=this.focusBox.findObject("SHAPE2");s!==null&&(s.strokeWidth=e,s.strokeDashArray=[e,e]);let n=this.focusBox.placeholder;n!==null&&(n.padding=e)}qO(t){this.focus===null?m.un(()=>{this.focus=this.findFirstFocus()},500):this.onFocusChanged(this.focus,this.focus)}jO(t){this.isVirtualPointerShown=!1}get isFocusEnabled(){return this.sN}set isFocusEnabled(t){t=!!t;let e=this.isFocusEnabled;t!==e&&(t||(this.isVirtualPointerShown=!1,this.uN=this.focus,this.focus=null),this.sN=t,t&&(this.focus=this.uN,this.updateFocusBox()))}get focusBox(){return this.Fp}set focusBox(t){if(!(t instanceof vt))return;let e=this.Fp;if(t!==e&&(this.Fp=t,e.adornedObject!==null)){let i=e.adornedPart;i!==null&&i.removeAdornment("Focus"),t.adornedObject=e.adornedObject,i!==null&&i.addAdornment("Focus",t)}}get focus(){return this.Fp.adornedObject}set focus(t){let e=this.focus;if(t!==e){let i=this.a;if(!i||!this.isFocusEnabled||t!==null&&t.diagram!==i)return;i.currentTool instanceof It||this.cancelVirtualPointer();let s=this.focusBox.adornedPart;s&&s.removeAdornment("Focus"),t===null?(this.md=null,this.virtualPointerLocation=i.viewportBounds.center,this.focusBox.adornedObject=null):(this.virtualPointerLocation=t.getDocumentPoint(T.Center),this.focusBox.adornedObject=t,this.updateFocusBox()),this.onFocusChanged(e,t)}}onFocusChanged(t,e){let i=this.a;if(i&&(this.focusChanged!==null?this.focusChanged(t,e,this):this.ZO(this.describe(t,e)),e!==null&&e.part!==null)){let s=e.getDocumentBounds();i.viewportBounds.containsRect(s)||(e instanceof pt?i.commandHandler.scrollToPart(e):i.scrollToRect(s))}}get focusChanged(){return this.nN}set focusChanged(t){t!==null&&m.S(t,jt,"focusChanged"),this.nN=t}get liveElementId(){return this.P1||this.oN}set liveElementId(t){let e=this.P1;t!==e&&(this.P1=t,this.wN())}wN(){let t=this.diagram;if(!t||!Y.isUsingDOM())return;let e=t.lt?.bt;if(!e)return;let i=this.liveElementId,s=K.document.getElementById(i);this.isUsingAriaLive?(e.removeAttribute("aria-labelledby"),s&&s.setAttribute("aria-live","polite")):(i&&e.setAttribute("aria-labelledby",i),s&&s.removeAttribute("aria-live"))}get isUsingAriaLive(){return this.S1}set isUsingAriaLive(t){let e=this.S1;t!==e&&(this.S1=t,this.wN())}ZO(t){let e=this.diagram;if(!e||!Y.isUsingDOM()||!e.div)return;let i=this.liveElementId;if(!i){let n=m.Ni("span"),o=n.style;for(o.opacity="0",o.position="absolute",o.right="-9999px",o.bottom="-9999px",o.width="0px",o.height="0px",o.overflow="hidden",o.border="0",i=(e.div.id||"diagram")+"_aria";K.document.getElementById(i);)i+=Math.floor(Math.random()*10);n.id=i,this.oN=i,e.div.appendChild(n),this.wN()}let s=K.document.getElementById(i);s&&(s.textContent=t)}describe(t,e){let i="";e instanceof $?e instanceof ht?i="Group":i="Node":e instanceof j?i="Link":e instanceof pt?i="Part":e&&(e.click?i="button":e instanceof lt&&e.editable&&(i="editable"),e.portId!==null&&(i&&(i+=" "),i+="port",e.portId&&(i+=" "+e.portId)));let s=this.xN(e);s&&(i+=" "+s);let n=e;if(t&&n instanceof j&&n.fromNode&&n.toNode){if(t instanceof $&&t.part===n.fromNode||t instanceof j&&t.fromNode===n.fromNode){i+=" to "+this.xN(n.toNode,!0);let o=n.toPort?.portId;o&&(i+=" port "+o)}else if(t instanceof $&&t.part===n.toNode||t instanceof j&&t.toNode===n.toNode){i+=" from "+this.xN(n.fromNode,!0);let o=n.fromPort?.portId;o&&(i+=" port "+o)}}return i}xN(t,e){if(e===void 0&&(e=!1),!t)return"";if(t instanceof lt&&t.text)return t.text;if(t instanceof G){let i="";return t instanceof pt&&t.text&&(i=t.text),e&&i||t.walkVisualTreeFrom(t,(s,n)=>{n.isVisibleObject()&&n instanceof lt&&n.text&&(!e||!i)&&i!==n.text&&(i+=" "+n.text)}),i}return""}updateFocusBox(){let t=this.focus;if(t!==null)if(t.diagram!==null&&(t instanceof pt?t.isVisible():t.isVisibleObject()&&t.part?.isVisible()))this.focusBox.adornedObject=t,t.part?.addAdornment("Focus",this.focusBox);else{let e=null;if(t instanceof pt||(e=t.part),e instanceof pt&&e.isVisible())this.focus=e;else{if(e instanceof $&&!e.isVisible()){let i=e.findTreeParentNode();if(i!==null)e=i;else{let s=e.labeledLink;s!==null&&(e=s)}}for(;e instanceof pt&&!e.isVisible();)e=e.containingGroup;e instanceof pt&&e.isVisible()?this.focus=e:this.focus=null}}}findFirstFocus(){let t=this.a;if(t===null||!t.isEnabled)return null;if(this.focus!==null)return this.focus;if(this.isFocusEnabled)if(t.selection.count>0)this.focus=t.selection.first();else{let e=this.XT(t.isTreePathToChildren).first();if(e!==null)return e}return null}get isVirtualPointerEnabled(){return this.rN}set isVirtualPointerEnabled(t){t=!!t;let e=this.isVirtualPointerEnabled;if(t!==e&&(this.rN=t,t)){let i=this.Ip;i&&(this.Ip=null,i.commandHandler.Ps=null,i.commandHandler.cancelVirtualPointer())}}get isVirtualPointerShown(){return this.lN}set isVirtualPointerShown(t){t=!!t;let e=this.isVirtualPointerShown;if(t!==e){let i=this.a;if(!i||!this.isVirtualPointerEnabled)return;this.lN=t;let s=this.focus;t?this.virtualPointerBox.diagram===null&&(this.virtualPointerLocation.isReal()||(s!==null?this.virtualPointerLocation=s.getDocumentPoint(T.Center):this.virtualPointerLocation=i.viewportBounds.center),i.add(this.virtualPointerBox),this.ma()):this.virtualPointerBox.diagram!==null&&(i.remove(this.virtualPointerBox),this.ma())}}cancelVirtualPointer(){let t=this.a;t&&(this.pN(),this.isVirtualPointerShown=!1,t.currentTool.doCancel(),this.isVirtualPointerDown=!1,this.bN())}bN(){let t=this.Ps;if(t!==null){this.Ps=null;let e=t.commandHandler;e.Ps=null,e.Ip=null,e.isVirtualPointerShown=!1,e.isVirtualPointerDown=!1,e.pN(),this.M1&&(e.isVirtualPointerEnabled=!1),this.M1=!1}}pN(){this.Oi.button=0,this.Oi.modifiers=0,this.Oi.clickCount=1,this.Oi.down=!1,this.ma()}ma(){this.virtualPointerChanged!==null&&this.virtualPointerChanged(this.virtualPointerBox,this),this.updateVirtualPointer()}updateVirtualPointer(){let t=this.virtualPointerBox.diagram;t&&(this.virtualPointerBox.scale=1/t.scale),this.virtualPointerBox.updateTargetBindings()}get virtualPointerBox(){return this.gd}set virtualPointerBox(t){if(!(t instanceof pt))return;let e=this.gd;t!==e&&(e!==null&&(t.location=e.location,e.diagram!==null&&e.diagram.remove(e)),this.gd=t,this.isVirtualPointerShown&&this.diagram&&(this.diagram.add(t),t.data=e.data),this.ma())}get virtualPointerChanged(){return this.aN}set virtualPointerChanged(t){t!==null&&m.S(t,jt,"virtualPointerChanged"),this.aN=t}get virtualPointerLocation(){return this.virtualPointerBox.location}set virtualPointerLocation(t){this.virtualPointerLocation.equals(t)||this.GT(t.x,t.y)}get isVirtualPointerDown(){return this.virtualPointerBox.data?this.virtualPointerBox.data.down:!1}set isVirtualPointerDown(t){t=!!t;let e=this.isVirtualPointerDown;if(t!==e){let i=this.a;if(!i||!this.isVirtualPointerEnabled||(this.virtualPointerBox.data===null&&(this.gd.data=this.Oi),this.virtualPointerBox.data.down=t,this.ma(),!this.isVirtualPointerShown))return;let s=i.lastInput,n=new Qt;n.diagram=i,this.YT(n,t),t?n.down=!0:n.up=!0,n.clickCount=1,n.button=this.Oi.button,n.modifiers=this.Oi.modifiers,t&&(i.firstInput=n.copy()),this.yd(n,!0),t||this.Oi.clickCount===2&&(n.clickCount=2,n.down=!0,n.up=!1,this.yd(n,!0),n.down=!1,n.up=!0,this.yd(n,!0),this.KT(1)),i.lastInput=s}}get virtualPointerShiftMove(){return this.Rp}set virtualPointerShiftMove(t){this.Rp=t}get virtualPointerControlMove(){return this.Op}set virtualPointerControlMove(t){this.Op=t}Ep(t,e){this.GT(this.virtualPointerLocation.x+t,this.virtualPointerLocation.y+e)}GT(t,e){this.virtualPointerBox.moveTo(t,e,!0);let i=this.a;if(!i||!this.isVirtualPointerEnabled||!this.isVirtualPointerShown)return;i.ensureBounds();let s=i.lastInput,n=new Qt;n.diagram=i,this.YT(n,this.isVirtualPointerDown),n.button=this.Oi.button,n.modifiers=this.Oi.modifiers,this.yd(n,!0),i.lastInput=s,this.isVirtualPointerDown&&(i.remove(this.virtualPointerBox),i.add(this.virtualPointerBox)),this.ma()}YT(t,e){let i=this.a;if(i){if(t.targetDiagram=i,t.documentPoint=this.virtualPointerLocation,i.allowDragOut){let s=i.div.getBoundingClientRect(),n=i.transformDocToView(this.virtualPointerLocation),o=s.x+n.x,r=s.y+n.y,a=K.document.elementFromPoint(o,r)||null;a instanceof HTMLCanvasElement&&(a=a.parentElement),a!==null&&a.shadowRoot&&(a=a.shadowRoot.elementFromPoint(o,r)||null,a instanceof HTMLCanvasElement&&(a=a.parentElement));let h=null;if(a instanceof HTMLElement&&(h=Y.ji.get(a))&&h!==i&&h.div){let l=h.div.getBoundingClientRect(),u=new P(n.x-(l.x-s.x),n.y-(l.y-s.y));this.Ps!==null&&this.Ps!==h&&this.bN(),t.targetDiagram=h,t.viewPoint=u,t.documentPoint=h.transformViewToDoc(u),t.viewPoint=h.transformDocToView(t.documentPoint),this.Ps=h;let c=h.commandHandler;this.M1=!c.isVirtualPointerEnabled,c.isVirtualPointerEnabled=!0,c.isVirtualPointerDown=e,c.virtualPointerLocation=t.documentPoint,c.isVirtualPointerShown=!0,c.Ip=i;return}}this.Ps!==null&&this.bN(),t.viewPoint=i.transformDocToView(t.documentPoint)}}yd(t,e){this.doVirtualPointerEvent(t,e)}doVirtualPointerEvent(t,e){let i=this.a;i&&(t.timestamp=Date.now(),i.lastInput=t,e&&(t.up?i.doMouseUp():t.down?i.doMouseDown():i.doMouseMove()),this.onVirtualPointerEvent(t,e))}onVirtualPointerEvent(t,e){let i=this.a;i&&(t.up?this.isVirtualPointerDown&&!i.viewportBounds.containsPoint(this.virtualPointerLocation)&&(this.virtualPointerLocation=this.focus instanceof J?this.focus.getDocumentPoint(T.Center):i.viewportBounds.center):t.down)}doVirtualFocusKeyDown(){let t=this.a;if(!t)return!1;let e=t.lastInput,i=e.commandKey;if(this.isVirtualPointerEnabled&&(i==="ShiftLeft"||i==="ShiftRight"))return this.isVirtualPointerShown=!0,!0;if(this.BT.indexOf(i)>=0)if(e.shift&&this.isVirtualPointerShown){let s=this.N1(i),n=e.control||e.meta?this.Op:this.Rp;s===270?this.Ep(0,-n):s===90?this.Ep(0,n):s===180?this.Ep(-n,0):this.Ep(n,0)}else this.QO();else if(e.shift&&this.isVirtualPointerShown&&(i==="Numpad1"||i==="Numpad2"||i==="Numpad3"||i==="Numpad4"||i==="Numpad6"||i==="Numpad7"||i==="Numpad8"||i==="Numpad9")){let s=e.control||e.meta?this.Op:this.Rp,n=0;i==="Numpad1"||i==="Numpad4"||i==="Numpad7"?n=-s:(i==="Numpad3"||i==="Numpad6"||i==="Numpad9")&&(n=s);let o=0;i==="Numpad7"||i==="Numpad8"||i==="Numpad9"?o=-s:(i==="Numpad1"||i==="Numpad2"||i==="Numpad3")&&(o=s),this.Ep(n,o)}else if(i==="Enter"||i==="NumpadEnter"||i==="Numpad5")e.shift&&this.isVirtualPointerShown?this.isVirtualPointerDown=!this.isVirtualPointerDown:this._O();else if(i==="Escape")this.tI();else if(i==="Space")this.eI();else if(i==="ContextMenu"||e.shift&&i==="F10"||(e.control||e.meta)&&e.shift&&i==="Backslash")this.iI();else if(e.shift&&i==="c")this.C1(1);else if(e.shift&&i==="a")this.C1(2);else if(e.shift&&i==="KeyS")this.C1(4);else if(e.shift&&i==="KeyM")this.C1(8);else if(e.shift&&i==="Digit1")this.L1(0);else if(e.shift&&i==="Digit2")this.L1(1);else if(e.shift&&i==="Digit3")this.L1(2);else if(e.shift&&i==="Numpad0"){let s=this.Oi.button;this.L1(s===2?0:2)}else if(e.shift&&(i==="KeyD"||i==="NumpadDecimal")){let s=this.Oi.clickCount;this.KT(s===2?1:2)}else if(e.shift&&i==="KeyF"){let s=this.nextFocusFormula;this.nextFocusFormula=s==="distance"?"linear":"distance"}else if(e.shift&&i==="y")this.isUsingAriaLive=!this.isUsingAriaLive;else return!1;return!0}doVirtualFocusKeyUp(){let t=this.a;if(!t)return!1;let e=t.lastInput.commandKey;return this.isVirtualPointerEnabled&&(e==="ShiftLeft"||e==="ShiftRight")&&(this.isVirtualPointerShown=!1),!0}N1(t){switch(t){case"ArrowDown":return 90;case"ArrowLeft":return 180;case"ArrowUp":return 270;default:return 0}}BT=["ArrowRight","ArrowDown","ArrowLeft","ArrowUp"];C1(t){let e=this.Oi.modifiers;this.Oi.modifiers=e&t?e&~t:e|t,this.ma()}KT(t){this.Oi.clickCount=t,this.ma()}L1(t){this.Oi.button=t,this.ma()}QO(){let t=this.a;if(!t)return;let e=t.lastInput,i=this.focus;if(i===null){let s=this.XT(t.isTreePathToChildren).first();s!==null&&(this.focus=s)}else if(i instanceof j)this.sI(i);else if(i instanceof $)this.nI(i);else{i instanceof pt&&(this.md=null);let s=this.N1(e.commandKey);s===270?this.focus=this.findNextFocus(270):s===90?this.focus=this.findNextFocus(90):s===180?this.focus=this.findNextFocus(180):this.focus=this.findNextFocus(0)}}sI(t){let e=this.a;if(!e)return;let i=e.lastInput,s=this.N1(i.commandKey),n=null,o=this.md;if(o!==null){let r=this.gN;if(s===r)n=t.getOtherNode(o);else if(s===C.Ee(r+180))n=o;else{let a=r===0||r===180?90:0,h=r===0||r===180?270:180;if(s===a){let l=this.kN(o,r,!0),u=l.indexOf(t);u>=0&&u<l.count-1&&(this.focus=l.elt(u+1))}else if(s===h){let l=this.kN(o,r,!0),u=l.indexOf(t);u>0&&(this.focus=l.elt(u-1))}}}else{let r=t.fromNode,a=t.toNode;if(!r||!a)return;s===270?n=r.location.y<a.location.y?r:a:s==90?n=r.location.y>a.location.y?r:a:s===180?n=r.location.x<a.location.x?r:a:n=r.location.x>a.location.x?r:a}for(;n!==null&&!n.isVisible();)n=n.containingGroup;n!==null&&(this.focus=n)}nI(t){let e=this.a;if(!e)return;let i=e.lastInput,s=this.N1(i.commandKey);if(i.control||i.meta){let n=this.kN(t,s,!0).first();n&&(this.md=t,this.gN=s,this.focus=n)}else this.md=null,this.focus=this.findNextFocus(s)}kN(t,e,i){if(t===null)return new q;let s=t.actualBounds;if(!s.isReal())return new q;let n=new Set;(t instanceof ht?t.findExternalLinksConnected():t.findLinksConnected()).each(r=>{if(!r.isVisible())return;let a=null;if(r.fromNode===t?a=r.toNode:r.toNode===t?a=r.fromNode:t instanceof ht&&(r.fromNode?.isMemberOf(t)?a=r.toNode:r.toNode?.isMemberOf(t)&&(a=r.fromNode)),a===null||a.isMemberOf(t))return;for(;a!==null&&!a.isVisible();)a=a.containingGroup;if(a===null)return;let h=a.location;if(h.isReal()&&!(e===270&&(a!==t?h.y>=s.top:r.midPoint.y>=s.top))){if(e===90&&(a!==t?h.y<=s.bottom:r.midPoint.y<=s.bottom)||e===180&&(a!==t?h.x>=s.left:r.midPoint.x>=s.left)||e===0&&(a!==t?h.x<=s.right:r.midPoint.x<=s.right))return;i&&r.actualBounds.isReal()?n.add(r):n.add(a)}});let o=new q(n);return e===90||e===270?o.sort((r,a)=>r.actualBounds.centerX-a.actualBounds.centerX):o.sort((r,a)=>r.actualBounds.centerY-a.actualBounds.centerY),o}findNextFocus(t){t=C.Ee(t);let e=this.focus,i=e instanceof $?e.location:e.getDocumentPoint(T.Center),s=1/0,n=e,o=(r,a,h,l)=>{if(this.nextFocusFormula==="linear"){let u=1/0;t===0&&h>i.x||t===180&&h<i.x?u=Math.abs(h-i.x):(t===90&&l>i.y||t===270&&l<i.y)&&(u=Math.abs(l-i.y)),u<s&&(s=u,n=r)}else{if(t===0&&(a.right<i.x||(a.centerX-i.x)**2>s)||t===90&&(a.bottom<i.y||(a.centerY-i.y)**2>s)||t===180&&(a.x>i.x||(i.x-a.centerX)**2>s)||t===270&&(a.y>i.y||(i.y-a.centerY)**2>s))return;let u=i.direction(h,l),c=C.qF(t,u);if(t===90||t===270?c<=45:c<45){let d=i.distanceSquared(h,l);d<s&&(s=d,n=r)}}};if(e instanceof pt&&e.diagram!==null){let r=e.containingGroup;r!==null?r.memberParts.each(a=>{a===e||a instanceof j||!a.isVisible()||o(a,a.actualBounds,a.location.x,a.location.y)}):(e.diagram.nodes.each(a=>{a===e||!a.isTopLevel||!a.isVisible()||o(a,a.actualBounds,a.location.x,a.location.y)}),e.diagram.parts.each(a=>{a===e||!a.isTopLevel||!a.isVisible()||o(a,a.actualBounds,a.location.x,a.location.y)}))}else if(e.part!==null){let r=new I;this.PN(e.part).each(a=>{a!==e&&(a.getDocumentBounds(r),o(a,r,r.centerX,r.centerY))})}return n}get nextFocusFormula(){return this.dN}set nextFocusFormula(t){this.dN=t}_O(){let t=this.a;if(!t)return;let e=t.currentTool;if(e instanceof It){let n=e.currentObject;this.A1(this.focus),e.maybeStopTool(this.focus),t.currentTool instanceof It||(this.focus=n);return}let i=this.focus,s=t.lastInput;if(i===null)s.control||s.meta?this.A1(null):this.focus=this.findFirstFocus();else if(i instanceof pt)if(s.control||s.meta)this.A1(i);else{let n=this.PN(i);if(n.count>0)this.focus=n.first();else if(i instanceof j&&i.isLabeledLink){let o=i.labelNodes.first();o!==null&&o.isVisible()&&(this.focus=o)}else if(i instanceof ht&&i.isSubGraphExpanded){let o=i.memberParts.first();o!==null&&o.isVisible()&&(this.focus=o)}}else this.A1(i)}XT(t){let e=new q,i=this.a;if(!i)return e;let s=0;for(;e.count===0&&s<i.nodes.count;){let n=i.nodes;for(;n.next();){let o=n.value;o.isTopLevel&&o.isVisible()&&(t?o.findNodesInto():o.findNodesOutOf()).count===s&&e.add(o)}s++}return e}PN(t){return t instanceof pt?this.Pn(t,new q):new q}Pn(t,e){return!(t instanceof pt)&&t.isVisibleObject()&&t.isEnabledObject()&&(t.contextMenu||t.click||t instanceof lt&&t.editable||t.part instanceof $&&t.portId!==null&&(t.portId!==""||t.part.ports.count>1)||t.toolTip)&&e.add(t),t instanceof G&&t.elements.each(i=>this.Pn(i,e)),e}A1(t){let e=this.a;if(!e)return;let i=e.lastInput,s=t instanceof J?t:e;if(s.click){let n=new Qt;n.diagram=e,n.documentPoint=t instanceof J?t.getDocumentPoint(T.Center):e.viewportBounds.center,n.viewPoint=e.transformDocToView(n.documentPoint),n.button=0,n.clickCount=1,n.targetObject=t,this.yd(n,!1),s instanceof J?s.click(n,s):s.click(n),e.lastInput=i}else s instanceof lt&&s.editable?this.editTextBlock(s):this.HT(t)}tI(){let t=this.a;if(!t)return;let e=t.currentTool;if(e instanceof ne&&e.currentToolTip!==null){e.hideToolTip();return}else if(e instanceof It){let i=e.currentObject;e.doKeyDown(),this.focus=i;return}if(this.focus instanceof pt){let i=this.focus;i instanceof $&&i.labeledLink!==null?this.focus=i.labeledLink:i.containingGroup!==null?this.focus=i.containingGroup:this.focus=null}else if(this.focus instanceof J){let i=this.focus.part;if(i instanceof j&&i.isLabeledLink){let s=i.labelNodes.first();if(s!==null&&s.isVisible()){this.focus=s;return}}else if(i instanceof ht&&i.isSubGraphExpanded){let s=i.memberParts.first();if(s!==null&&s.isVisible()){this.focus=s;return}}this.focus=i}else this.cancelVirtualPointer(),this.stopCommand()}eI(){let t=this.a;if(t)if(t.lastInput.shift&&this.isVirtualPointerShown){let e=t.findPartAt(this.virtualPointerLocation);e!==null&&(e===this.focus?this.qT():this.focus=e)}else this.qT()}qT(){let t=this.a;if(!t)return;let e=t.lastInput,i=this.focus;if(i instanceof pt){let s=i.part;if(e.control||e.meta){for(t.raiseDiagramEvent("ChangingSelection",t.selection);s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!s.isSelected),t.raiseDiagramEvent("ChangedSelection",t.selection)}else if(e.shift){if(s!==null&&!s.isSelected){for(t.raiseDiagramEvent("ChangingSelection",t.selection);s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!0),t.raiseDiagramEvent("ChangedSelection",t.selection)}}else if(s!==null&&!s.isSelected){for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&t.select(s)}}this.HT(i),this.onFocusChanged(i,i)}HT(t){let e=this.a;if(!e)return;e.toolManager.hideToolTip();let i=e.lastInput,s=t instanceof J?t:e;for(;s instanceof J&&!s.toolTip;)s=s.panel;if(s&&s.toolTip){let n=new Qt;n.diagram=e,n.documentPoint=t!==null?t.getDocumentPoint(T.Center):e.viewportBounds.center,n.viewPoint=e.transformDocToView(n.documentPoint),n.targetObject=t,this.yd(n,!1),e.toolManager.showToolTip(s.toolTip,t),e.lastInput=i}}iI(){let t=this.a;if(!t)return;let e=this.focus;if(this.canShowContextMenu(e)){this.showContextMenu(e);let i=t.toolManager.contextMenuTool.currentContextMenu;if(i instanceof vt){let s=this.PN(i);s.count>0&&(this.focus=s.first())}}}}var Bi=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Vertical=4]="Vertical",x[x.Horizontal=5]="Horizontal",x[x.Fill=2]="Fill",x))(Bi||{}),Vi=(x=>(x[x.None=0]="None",x[x.Along=21]="Along",x[x.Plus90=22]="Plus90",x[x.Minus90=23]="Minus90",x[x.Opposite=24]="Opposite",x[x.Upright=25]="Upright",x[x.Plus90Upright=26]="Plus90Upright",x[x.Minus90Upright=27]="Minus90Upright",x[x.Upright45=28]="Upright45",x))(Vi||{}),Ks=(x=>(x[x.None=0]="None",x[x.Vertical=1]="Vertical",x[x.Horizontal=2]="Horizontal",x[x.Both=3]="Both",x))(Ks||{});class J{n;Up;Vp;pa;w;ya;ft;ct;hi;Zt;Bp;$s;Ct;cs;_r;wa;Se;Dh;et;Xt;tl;De;Ke;wd;de;xd;Ot;he;el;T1;xa;df;constructor(){V.Je(this),this.n=30723,this.Zt=1,this.Bp="",this.$s=null,this.Ct=null,this.ct=new P(NaN,NaN).k(),this.cs=st.Ww,this._r=new Nt,this.wa=new Nt,this.Se=null,this.Dh=1,this.et=1,this.Xt=0,this.tl=Dt.em,this.hi=new I(NaN,NaN,NaN,NaN).k(),this.De=new I(NaN,NaN,NaN,NaN).k(),this.Ke=new I(0,0,NaN,NaN).k(),this.wd=null,this.Up=null,this.ft=null,this.de=T.Default,this.xd=T.Default,this.Vp=0,this.pa=0,this.Ot=null,this.w=null,this.ya=null,this.he=null,this.T1=null,this.xa=null,this.el=null,this.df=null}cloneProtected(t){t.n=(this.n|2048|4096)&-32769,t.Zt=this.Zt,t.Bp=this.Bp,t.Ct=this.Ct,t.ct.h(this.ct),t.cs=this.cs.N(),this.Se!==null?t.Se=this.Se.copy():t.Se=null,t.et=this.et,t.Xt=this.Xt,t.tl=this.tl.N(),t.hi.h(this.hi),t.De.h(this.De),t.Ke.h(this.Ke),t.Up=this.Up,this.ft!==null&&(t.ft=this.ft.copy()),t.de=this.de.N(),t.xd=this.xd.N(),t.Vp=this.Vp,t.pa=this.pa,this.Ot!==null&&(t.Ot=this.Ot.copy()),this.w!==null&&(this.w.me?t.w=this.w:t.w=this.w.copy()),this.ya!==null&&(t.ya=this.ya.slice()),this.he!==null&&(t.he=this.he.copy())}addCopyProperty(t){let e=this.ya;if(!Array.isArray(e))e=[],this.ya=e;else for(let i=0;i<e.length;i++)if(e[i]===t)return;e.push(t)}Yo(t){t.wd=null,t.el=null,t.f()}clone(){let t=new this.constructor;if(this.cloneProtected(t),this.ya!==null)for(let e=0;e<this.ya.length;e++){let i=this.ya[e];t[i]=this[i]}return t}copy(){return this.clone()}JS(){let t=this.ve;if(t!==null){this.ve=null;for(let e of t)e.bd()&&(e.isToData?this.themeData(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):e.isToObject?this.themeObject(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter,e.sourceName):e.isToModel?this.themeModel(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):this.theme(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter))}return this}fe(t){t in Vi?this.segmentOrientation=t:t in Bi?this.stretch=t:m.cr(this,t)}toString(){return m.Gn(this.constructor)+"#"+V.xs(this)}static None=0;static Default=1;static Fill=2;static Vertical;static Horizontal;static Uniform=6;static UniformToFill=7;static FlipVertical=1;static FlipHorizontal=2;static FlipBoth=3;ba(){this.w!==null&&(this.w.me=!0)}Yt(){return this.w===null?this.w=new Ye:this.w.me&&(this.w=this.w.copy()),this.w}Wi(){if(this.ft===null){let t=new Ni;t.vh=T.None,t.Fh=T.None,t.Rh=10,t.Oh=10,t.Ih=0,t.Eh=0,this.ft=t}return this.ft}raiseChangedEvent(t,e,i,s,n,o,r){let a=this.part;if(a!==null){a.gf(t,e,i,s,n,o,r),i===this&&t===2&&this.mf()&&this.Uh(a,e);let h=this.diagram;if(this.Ts!==null&&h!==null&&h.Qa&&!h.undoManager.isUndoingRedoing&&!h.animationManager.Uu){let l=this.Ts.get(e);if(l!==null&&h.animationManager.isEnabled&&!h.animationManager.isTicking){this.df===null&&(this.df=new Mt);let u=h.undoManager.transactionLevel===0;if(l.startCondition===2?u=!0:l.startCondition===3&&(u=!1),u){let c=new ye;l.RR(c);let d=this.df.get(l);d!==null&&d.stop(),this.df.set(l,c),c.Qx=this,c.TM=l,c.add(this,e,s,n),c.start()}else h.animationManager.getBundleAnimation().add(this,e,s,n)}}if(this instanceof G&&i===a&&a.SN()&&a.data!==null){let l=this.D.r,u=l.length;for(let c=0;c<u;c++){let d=l[c];d instanceof G&&d.Pn(f=>{f.data!==null&&f.SN()&&f.updateTargetBindings(e)})}}}}TR(t){this.df&&this.df.delete(t)}zo(){if(this.diagram!==null&&this.findBindingPanel()===null&&this.ve!==null){let t=this.diagram.model,e=this.ve.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=null,n=i.sourceName;i.isToObject&&(s=this.jT(n));let o=this,r=i.targetId;r!==-1&&(o=this.zp(r),o===null)||(n==="/"?s=o.part:n==="."?s=o:n===".."&&(s=o.panel),i.updateTarget(o,s,void 0,t))}}}Uh(t,e){let i=this.findBindingPanel();if(i!==null){let s=t.diagram,n=this.ve.iterator;for(;n.next();){let o=n.value,r=null;if(o.isToObject){if(r=o.WT(i,this),r===null)continue;o.updateSource(this,r,e,null)}else if(o.isToModel)s!==null&&!s.wi&&o.updateSource(this,s.model.modelData,e,i);else if(!o.isToTheme){let a=i.data;if(a===null)continue;s!==null&&!s.wi&&o.updateSource(this,a,e,i)}if(r===this){let a=o.targetId,h=i.zp(a);h!==null&&o.updateTarget(h,r,e,s?.model)}}}}zp(t){return this.io===t?this:null}jT(t){let e;return t===""?e=this:t==="/"?e=this:t==="."?e=this:t===".."?e=this:e=this.part.findObject(t),e}get io(){return this.w!==null?this.w.io:-1}set io(t){this.io!==t&&(this.w===null&&(this.w=new Ye),this.w.io=t)}get ve(){return this.w!==null?this.w.ve:null}set ve(t){this.ve!==t&&(this.w===null&&(this.w=new Ye),this.w.ve=t)}get so(){return this.w!==null?this.w.so:null}set so(t){this.so!==t&&(this.w===null&&(this.w=new Ye),this.w.so=t)}raiseChanged(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}t(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}no(t,e,i,s){let n=this.hi;if(n.e(t,e,i,s),this.et!==1||this.Xt!==0){this.Se===null&&(this.Se=new Nt);let o=this.Se;o.Ue(),this.Xp(o,t,e,i,s),o.im(n)}}JT(t,e,i){return this.pickable===!1?!1:(i.kc(this.v),e?this.intersectsRect(t,i):this.containedInRect(t,i))}$T(t,e,i){if(this.pickable===!1)return!1;let s=this.naturalBounds,n=t.distanceSquaredPoint(e);return i?P.distanceLineSegmentSquared(t.x,t.y,0,0,0,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,0,s.height,s.width,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,s.height,s.width,0)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,0,0,0)<=n:t.distanceSquared(0,0)<=n&&t.distanceSquared(0,s.height)<=n&&t.distanceSquared(s.width,0)<=n&&t.distanceSquared(s.width,s.height)<=n}Mn(){return!0}containsPoint(t){let e=P.l();e.h(t),this.v.gt(e);let i=this.actualBounds;if(!i.isReal())return P.i(e),!1;let s=this.diagram;if(s!==null&&s.dp){let o=s.getInputOption("extraTouchThreshold"),r=s.getInputOption("extraTouchArea"),a=r/2,h=this.naturalBounds,l=this.getDocumentScale()*s.scale,u=1/l;if(h.width*l<o&&h.height*l<o){let c=I.contains(i.x-a*u,i.y-a*u,i.width+r*u,i.height+r*u,e.x,e.y);return P.i(e),c}}let n=!1;return(this instanceof vt||this instanceof et?I.contains(i.x-5,i.y-5,i.width+10,i.height+10,e.x,e.y):i.containsPoint(e))&&(this.he&&!this.he.containsPoint(e)?n=!1:this.Ct!==null&&this.Ke.containsPoint(t)?n=!0:n=this.ka(t)),P.i(e),n}ka(t){let e=this.naturalBounds;return I.contains(0,0,e.width,e.height,t.x,t.y)}containsRect(t){if(this.angle===0)return this.actualBounds.containsRect(t);let e=this.naturalBounds,i=I.z(0,0,e.width,e.height),s=this.v,n=!1,o=P.z(t.x,t.y);return i.containsPoint(s.Ci(o))&&(o.e(t.x,t.bottom),i.containsPoint(s.Ci(o))&&(o.e(t.right,t.bottom),i.containsPoint(s.Ci(o))&&(o.e(t.right,t.y),i.containsPoint(s.Ci(o))&&(n=!0)))),P.i(o),I.i(i),n}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=!1,o=P.z(0,0);return t.containsPoint(s.gt(o))&&(o.e(0,i.height),t.containsPoint(s.gt(o))&&(o.e(i.width,i.height),t.containsPoint(s.gt(o))&&(o.e(i.width,0),t.containsPoint(s.gt(o))&&(n=!0)))),P.i(o),n}intersectsRect(t,e){if(e===void 0&&(e=this.v,this.angle===0))return t.intersectsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=P.z(0,0),o=P.z(0,i.height),r=P.z(i.width,i.height),a=P.z(i.width,0),h=!1;if(t.containsPoint(s.gt(n))||t.containsPoint(s.gt(o))||t.containsPoint(s.gt(r))||t.containsPoint(s.gt(a)))h=!0;else{let l=I.z(0,0,i.width,i.height),u=P.z(t.x,t.y);l.containsPoint(s.Ci(u))?h=!0:(u.e(t.x,t.bottom),l.containsPoint(s.Ci(u))?h=!0:(u.e(t.right,t.bottom),l.containsPoint(s.Ci(u))?h=!0:(u.e(t.right,t.y),l.containsPoint(s.Ci(u))&&(h=!0)))),P.i(u),I.i(l),h||(C.ex(t,n,o)||C.ex(t,o,r)||C.ex(t,r,a)||C.ex(t,a,n))&&(h=!0)}return P.i(n),P.i(o),P.i(r),P.i(a),h}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof T){let i=t,s=this.naturalBounds;return e.e(i.x*s.width+i.offsetX,i.y*s.height+i.offsetY),this.Ws.gt(e),e}else return e.set(t),this.Ws.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new I);let e=this.naturalBounds,i=this.Ws,s=P.z(0,0).v(i);return t.e(s.x,s.y,0,0),s.e(e.width,0).v(i),t.re(s.x,s.y,0,0),s.e(e.width,e.height).v(i),t.re(s.x,s.y,0,0),s.e(0,e.height).v(i),t.re(s.x,s.y,0,0),P.i(s),t}getDocumentAngle(){return this.Ws.YF()}getDocumentScale(){if(this.Gp()===!1)return this.Dh;let t=this.et;return this.panel!==null?t*this.panel.getDocumentScale():t}getLocalPoint(t,e){return e===void 0&&(e=new P),e.h(t),this.Ws.Ci(e),e}getNearestIntersectionPoint(t,e,i){return this.pf(t.x,t.y,e.x,e.y,i)}pf(t,e,i,s,n){let o=this.v,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),f=t*a+e*l+c,p=t*h+e*u+d,g=i*a+s*l+c,y=i*h+s*u+d;n.e(0,0);let b=this.naturalBounds,v=C.Cl(0,0,b.width,b.height,f,p,g,y,n);return n.v(o),v}ht(t,e,i,s){if(this.Bo()===!1)return;let n=this.tl,o=n.right+n.left,r=n.top+n.bottom;t=Math.max(t-o,0),e=Math.max(e-r,0),i=i||0,s=s||0,i=Math.max(i-o,0),s=Math.max(s-r,0);let a=this.angle,h=0,l=this.desiredSize,u=this.Yp();a===90||a===270?(t=isFinite(l.height)?l.height+u:t,e=isFinite(l.width)?l.width+u:e):(t=isFinite(l.width)?l.width+u:t,e=isFinite(l.height)?l.height+u:e);let c=i||0,d=s||0,f=this instanceof G;switch(this.Zs(!0)){case 0:c=0,d=0,f&&(t=1/0,e=1/0);break;case 2:isFinite(t)&&t>i&&(c=t),isFinite(e)&&e>s&&(d=e);break;case 5:isFinite(t)&&t>i&&(c=t),d=0,f&&(e=1/0);break;case 4:isFinite(e)&&e>s&&(d=e),c=0,f&&(t=1/0);break}let p=this.maxSize,g=this.minSize;c>p.width&&g.width<p.width&&(c=p.width),d>p.height&&g.height<p.height&&(d=p.height),i=Math.max(c,g.width),s=Math.max(d,g.height),p.width<i&&(i=Math.min(g.width,i)),p.height<s&&(s=Math.min(g.height,s)),t=Math.min(p.width,t),e=Math.min(p.height,e),t=Math.max(i,t),e=Math.max(s,e),(a===90||a===270)&&(h=t,t=e,e=h,h=i,i=s,s=h),this.hi.ce(),this.kd(t,e,i,s),this.hi.k(),this.hi.isReal()||m.o("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.hi.toString()),this.xi(!1)}kd(t,e,i,s){}Qs(){return!1}Ut(t,e,i,s,n){this.yf();let o=I.l();o.h(this.De),this.De.ce(),this.as()===!1?this.De.e(t,e,i,s):this.Pa(t,e,i,s),this.De.k(),n===void 0?this.he=null:this.he=n;let r=!1;if(n!==void 0)r=!0;else{let a=this.panel;if(a!==null&&a.il()&&(a=a.panel),a!==null){let h=a.Ke,l=this.measuredBounds,u=e+l.height,c=t+l.width;if(r=!(0<=t+.05&&c<=h.width+.05&&0<=e+.05&&u<=h.height+.05),this instanceof lt){let d=this.naturalBounds;(this.Kp>d.height||this.pe>d.width)&&(r=!0)}}}r?this.n|=256:this.n&=-257,this.De.isReal()||m.o("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.De.toString()),this.Pd(o,this.De),this.oo(!1),I.i(o)}Pa(t,e,i,s){}commonArrange(t,e,i,s){if(this.De.e(t,e,i,s),this.desiredSize.isReal())return;let n=this.hi,o=this.tl,r=o.right+o.left,a=o.top+o.bottom,h=n.width+r,l=n.height+a;i+=r,s+=a;let u=this.Zs(!0);switch(h===i&&l===s&&(u=0),u){case 0:(h>i||l>s)&&(this.xi(!0),this.ht(h>i?i:h,l>s?s:l,0,0));break;case 2:this.xi(!0),this.ht(i,s,0,0);break;case 5:this.xi(!0),this.ht(i,l,0,0);break;case 4:this.xi(!0),this.ht(h,s,0,0);break}}Pd(t,e){let i=this.part;i!==null&&i.diagram!==null&&((i.selectionObject===this||i.resizeObject===this||i.rotateObject===this)&&i.MN(!0),this.C(),!t.equalsApproxClose(e)&&(i.Sa(),this.Hp(i)))}Hp(t){this.portId!==null&&(t.MN(!0),t instanceof $&&t.invalidateConnectedLinks(void 0,this))}get shadowVisible(){return this.w!==null?this.w.qp:null}set shadowVisible(t){let e=this.shadowVisible;e!==t&&(this.Yt().qp=t,this.Ji(!0),this.C(),this.t("shadowVisible",e,t))}oI(t,e){let i=this.naturalBounds,s=this.wa,n=s.m11,o=s.m21,r=s.dx,a=s.m12,h=s.m22,l=s.dy,u=0,c=0,d=u,f=c;u=d*n+f*o+r,c=d*a+f*h+l;let p=u,g=c,y=0,b=0;d=i.width+e,f=0,u=d*n+f*o+r,c=d*a+f*h+l;let v=Math.min(p,u),w=Math.min(g,c);y=Math.max(p+y,u)-v,b=Math.max(g+b,c)-w,p=v,g=w,d=i.width+e,f=i.height+e,u=d*n+f*o+r,c=d*a+f*h+l,v=Math.min(p,u),w=Math.min(g,c),y=Math.max(p+y,u)-v,b=Math.max(g+b,c)-w,p=v,g=w,d=0,f=i.height+e,u=d*n+f*o+r,c=d*a+f*h+l,v=Math.min(p,u),w=Math.min(g,c),y=Math.max(p+y,u)-v,b=Math.max(g+b,c)-w,p=v,g=w;let k=t.viewportBounds,S=k.x,N=k.y,D=k.width,L=k.height;return p>D+S||S>y+p||g>L+N||N>b+g}Ge(t,e){if(this.rI(t,e)||!this.visible)return;let i=this.opacity;if(i===0)return;let s=1;i!==1&&(s=t.globalAlpha,t.globalAlpha=s*i);let n="";this.filter!==""&&(n=t.filter,t.filter=this.filter);let o=this.v,r=this.panel;this.Gp()===!0&&this.D1();let a=this.part,h=!1,l=0;if(a&&e.getRenderingHint("drawShadows")&&(h=a.isShadowed,h)){let g=a.shadowOffset;l=Math.max(g.y,g.x)*e.scale*e.$e}let u=this instanceof G&&this.il(),c=this.De;if(u&&(this.ZT(h,t,!1,r),this.lI(t,e),this.QT(h,t,!1,r),this._T(h,t,!1)),u||!u&&(c.width===0||c.height===0||isNaN(c.x)||isNaN(c.y))){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let d=this.Qs();if(!e.ph&&d&&this.oI(e,l)){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let f=(this.n&256)!==0;if(t.clipInsteadOfFill&&(f=!1),this instanceof lt&&(t.font=this.font),f){let g=r.Mn()?r.naturalBounds:r.actualBounds,y=Math.max(c.x,g.x),b=Math.max(c.y,g.y),v=Math.min(c.right,g.right)-y,w=Math.min(c.bottom,g.bottom)-b,k=this.he;if(k!==null&&(y=k.x,b=k.y,v=k.width,w=k.height),y>c.width+c.x||c.x>g.width+g.x){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}t.save(),t.beginPath(),t.rect(y,b,v,w),t.clip()}if(d){if(!a.isVisible()){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}if(h){let g=a.shadowOffset;t.shadowsSet(g.x*e.scale*this.scale*e.$e,g.y*e.scale*this.scale*e.$e,a.shadowBlur),t.shadowsOn(),t.shadowColor=a.shadowColor}}let p=this.naturalBounds;if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.ZT(h,t,d,r),this.Ct!==null&&(t.commitTransform(),this.v1(t,p,c)),this.QT(h,t,d,r),this.Ma(t,e),this._T(h,t,d),f&&(t.restore(),t.clearContextCache(this instanceof G)),!o.DP()){let g=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*g,-o.m12*g,-o.m21*g,o.m11*g,g*(o.m21*o.dy-o.m22*o.dx),g*(o.m12*o.dx-o.m11*o.dy))}i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n)}ZT(t,e,i,s){t&&this.shadowVisible===!0?e.shadowsOn():t&&this.shadowVisible===!1&&e.shadowsOff(),t&&this.F1(s)&&this.shadowVisible===null&&e.shadowsOff()}QT(t,e,i,s){t&&(this.Ct!==null||this.F1(s))?(this.R1(!0),this.shadowVisible===null&&e.shadowsOff()):this.R1(!1)}_T(t,e,i){t&&this.NN()===!0&&e.shadowsOn(),i&&t&&e.shadowsOff()}aI(t,e,i){let s=this.part,n=!1;s&&t.getRenderingHint("drawShadows")&&(n=s.isShadowed),e.clipInsteadOfFill&&(n=!1),this.Qs()&&n&&e.shadowsOn(),n&&this.shadowVisible===!0?e.shadowsOn():n&&this.shadowVisible===!1&&e.shadowsOff();let o=this.panel;if(n&&this.F1(o)&&this.shadowVisible===null&&e.shadowsOff(),e.sl){let r=t.computePixelRatio(),a=`drop-shadow(${e.shadowOffsetX/r}px ${e.shadowOffsetY/r}px ${e.shadowBlur/r/2}px ${e.shadowColor})`;this.background!==null&&i.Ct.setAttributeNS(null,"filter",a)}return n&&(this.Ct!==null||this.F1(o))?(this.R1(!0),this.shadowVisible===null&&e.shadowsOff()):this.R1(!1),n}hI(t,e,i,s){if(i.sl){let n=e.computePixelRatio(),o=`drop-shadow(${i.shadowOffsetX/n}px ${i.shadowOffsetY/n}px ${i.shadowBlur/n/2}px ${i.shadowColor})`;this.CN(t,o)}s&&this.NN()===!0&&i.shadowsOn(),this.Qs()&&i.shadowsOff()}F1(t){return t===null?!1:(t.il()&&(t=t.panel),t.NN()||(t.type===G.Auto||t.type===G.Spot)&&t.findMainElement()!==this)}CN(t,e){}v1(t,e,i){let s=this.Yp(),n=e.x,o=e.y,r=e.width+s,a=e.height+s;this.bn(t,this.Ct,!0,!1,e,i),this.Ct instanceof R&&this.Ct.type===3?(t.beginPath(),t.rect(n-s/2,o-s/2,r,a),t.fillContext(this.Ct,!1,null)):t.fillRect(n-s/2,o-s/2,r,a)}tD(t,e){let i=t.cI(this),s=t.xa!==null?t.xa:t.svg;if(s!==null&&i!==-1){for(;i!==0&&!t.elt(i-1).isVisibleObject();)i--;if(i===0)this.fI(t,e,s);else{let n=t.elt(i-1).svg;n!==null?n.after(e):s.appendChild(e)}}}fI(t,e,i){if(t.type===G.Table){let s=i.getElementsByClassName("gojs-ts"),n=s.length!==0?s[0]:null;n!==null&&n.after(e)}else i.Ct?i.Ct.after(e):i.prepend(e)}rI(t,e){if(!(t instanceof re))return!1;if(!this.visible||this.opacity===0)return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let i=this.De;if(this.Qs()&&(!this.isVisible()||i.width===0||i.height===0||isNaN(i.x)||isNaN(i.y)))return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;t.setCurrentTransform(1,0,0,1,0,0);let s=this.panel,n=this.Sd(t);if(this.wf(t,e,n))return this.eD(this.svg),this.svg.parentElement!==null?(this.Qs()&&(t.lastDrawnPart=this.svg),!0):(this.Qs()?(t.lastDrawnPart!==null?t.lastDrawnPart.after(this.svg):t.diagramGroup.prepend(this.svg),t.lastDrawnPart=this.svg):s&&this.tD(s,this.svg),!0);if(this.Ji(!1),this.Qs()&&this.isShadowed){let p=this.shadowOffset;t.shadowsSet(p.x*e.scale*this.scale*e.$e,p.y*e.scale*this.scale*e.$e,this.shadowBlur),t.shadowsOn(),t.shadowColor=this.shadowColor}this instanceof lt&&(t.font=this.font),t.currentElement=null;let o=this.v,r=this instanceof G,a=this instanceof G?this.il():!1,h=this.svg;if(this.Gp()===!0&&this.D1(),t.outerGroup=!1,n)if(t.outerGroup=!0,r&&a)t.newGroup(1,0,0,1,0,0),this.svg=t.lastCreatedElement;else if(r&&this.isClipping){let p=this.findMainElement(),g=0,y=0;p!==null&&(g=p.actualBounds.x,y=p.actualBounds.y),t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx+g,o.dy+y),this.svg=t.lastCreatedElement,p!==null&&t.createOrUpdateClipGroup(this,p.actualBounds),t.currentElement=t.lastCreatedElement}else r?(t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.svg=t.lastCreatedElement):t.newGroup(1,0,0,1,0,0);let l=this.naturalBounds;r||t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.background!==null&&(r?(a&&t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.v1(t,l,i),a&&t.setCurrentTransform(1,0,0,1,0,0)):(t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.v1(t,l,i)),t.currentElement.Ct=t.lastCreatedElement,t.currentElement.prepend(t.lastCreatedElement));let u=this.aI(e,t,t.currentElement);this.Ma(t,e),r&&t.endGroup(),t.outerGroup&&t.endGroup();let c=t.surface.dd,d=r?this.svg:t.currentElement;if(h!==null&&h.parentNode!==null&&d!==h&&(this.panel===null||h.parentNode===this.panel.svg)){let p=this.svg.getAttribute("filter");return p!==null&&d.setAttribute("filter",p),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),h.replaceWith(d),this.svg=d,d!==null&&this.jp(t,s,i,d),!0}if(this.svg=d,c!==null&&d===null&&t.dummyGroup(),d===null)return!0;this.jp(t,s,i,d),this.hI(d,e,t,u);let f=this.Qs()?this.opacity*t.globalAlpha:this.opacity;if(f!==1&&d.setAttributeNS(null,"opacity",f.toString()),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),this.Qs()){if(h!==null&&d!==h&&h.parentNode===t.diagramGroup){let p=h.getAttribute("filter");p!==null&&d.setAttribute("filter",p),h.replaceWith(d)}else t.lastDrawnPart?t.lastDrawnPart.after(d):t.diagramGroup.prepend(d);t.lastDrawnPart=d}else s!==null&&this.tD(s,d);return c!==null&&c(this,d),this.eD(d),!0}eD(t){let e=this,i=t.dataset;e instanceof J&&(e.portId!==null&&(i.portId=e.portId),e instanceof G&&(isNaN(e.itemIndex)||(i.itemIndex=e.itemIndex.toString()),e instanceof pt&&(i.className=m.Gn(e),e.key!==void 0&&(i.key=e.key.toString()),e.containingGroup!==null&&(i.group=e.containingGroup.key.toString()),e instanceof j&&(e.fromNode!==null&&e.fromNode.key!==void 0&&(i.fromKey=e.fromNode.key.toString()),e.fromPortId!==""&&(i.fromPortId=e.fromPortId),e.toNode!==null&&e.toNode.key!==void 0&&(i.toKey=e.toNode.key.toString()),e.toPortId!==""&&(i.toPortId=e.toPortId)))))}jp(t,e,i,s){let n=(this.n&256)!==0;if(t.clipInsteadOfFill&&(n=!1),!n){s.removeAttributeNS(null,"clip-path");return}let o=e.Mn()?e.naturalBounds:e.actualBounds,r=Math.max(i.x,o.x),a=Math.max(i.y,o.y),h=Math.min(i.right,o.right)-r,l=Math.min(i.bottom,o.bottom)-a,u=this.he;u!==null&&(r=u.x,a=u.y,h=u.width,l=u.height);let c=I.z(r,a,Math.max(h,0),Math.max(l,0));if(this instanceof G){let d=Nt.l();d.set(this.v),d.Qw(),d.im(c),Nt.i(d)}s.setAttributeNS(null,"clip-path",`path(' M ${c.x},${c.y} L ${c.width+c.x} ${c.y} L ${c.width+c.x} ${c.height+c.y} L ${c.x} ${c.height+c.y} z') view-box`),I.i(c)}uI(){if(this.svg===null)return;let t=this.svg.innerHTML.match(/url\(#((CLIP|GRAD).+?)\)/g),e=this.svg.ownerDocument;if(t!==null)for(let i of t){let s=e.getElementById(i.split("#")[1].slice(0,-1));s!==null&&s.remove()}this.svg.remove()}lI(t,e){let i=this.De,s=this.Ke,n=this.Ct;n!==null&&t.commitTransform(),n!==null&&(this.bn(t,n,!0,!1,s,i),n instanceof R&&n.type===3?(t.beginPath(),t.rect(i.x,i.y,i.width,i.height),t.fillContext(n,!1,null)):t.fillRect(i.x,i.y,i.width,i.height)),this.Ma(t,e)}Ma(t,e){}xf(){this.Ji(!0)}wf(t,e,i){let s=this.svg;if(this.dI()){if(this.xf(),this.Ji(!1),s===null)return!1;let u=s.getAttribute("clip-path");if(u!==null&&u.includes("url")){let c=t.svg.getElementById(u.split("#")[1].slice(0,-1));c!==null&&c.remove()}return s.getAttribute("filter")&&s.removeAttribute("filter"),!1}if(s===null)return!1;if(!this.visible)return s.remove(),!1;if(s.nodeName!=="g"&&i||s.nodeName==="g"&&!i)return!1;let n=this.v,o="matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")",r=this instanceof G,a=r?this.il():!1;if(!(r&&a))if(this instanceof Bt){let u=this.O1;t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),u!==null&&t.amendImageTransform(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7]),i?s.lastElementChild.setAttributeNS(null,"transform",t.getCurrentTransform()):s.setAttributeNS(null,"transform",t.getCurrentTransform())}else if(i&&!r)if(this instanceof et){let u=s.getElementsByTagName("path");for(let c=0;c<u.length;c++)u[c].setAttributeNS(null,"transform",o)}else if(this instanceof lt){let u=s.getElementsByTagName("text"),c=typeof this.stroke=="string"?this.stroke:null;for(let d=0;d<u.length;d++)u[d].setAttributeNS(null,"transform",o),c&&u[d].setAttributeNS(null,"fill",c)}else(s.lastElementChild||s).setAttributeNS(null,"transform",o);else if(r&&this.isClipping&&this.xa){let u=this.findMainElement(),c=u!==null?u.actualBounds.x:0,d=u!==null?u.actualBounds.y:0;this.xa.setAttributeNS(null,"transform","matrix(1,0,0,1,"+-c+", "+-d+")"),s.setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+(n.dx+c)+", "+(n.dy+d)+")")}else s.setAttributeNS(null,"transform",o);let h=this.Qs()?this.opacity*t.globalAlpha:this.opacity;h===1?s.removeAttribute("opacity"):s.setAttributeNS(null,"opacity",h.toString()),t.setCurrentTransform(1,0,0,1,0,0);let l=this.xa?this.xa:this.T1;if(this.background!==null||l.Ct!==void 0){let u=l.Ct;if(this.background===null)t.removeOldGradient(this,l.Ct,"fill"),l.Ct.remove(),l.Ct=void 0;else{if((a||i&&!(this instanceof G))&&t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),this.v1(t,this.naturalBounds,this.actualBounds),l.Ct){t.removeOldGradient(this,l.Ct,"fill");let c=l.Ct.getAttribute("filter");c!==null&&t.lastCreatedElement.setAttribute("filter",c),l.Ct.replaceWith(t.lastCreatedElement)}else l.prepend(t.lastCreatedElement);l.Ct=t.lastCreatedElement}u&&t.removeOldGradient(this,u,"fill")}return this.jp(t,this.panel,this.actualBounds,s),!0}Sd(t){if(this.background!==null)return!0;let e=(this.n&256)!==0;return t.clipInsteadOfFill&&(e=!1),!!e}static EU(t,e,i,s,n,o,r){let a=.001,h=o.length;t.moveTo(e,i);let l=s-e,u=n-i;l===0&&(l=.001);let c=u/l,d=Math.sqrt(l*l+u*u),f=0,p=!0;a=o[f%h];let g=r!==0;for(;d>=.1;){if(g){for(a=o[f++%h],a-=r;a<0;)a+=o[f++%h],p=!p;g=!1}else a=o[f++%h];a>d&&(a=d);let y=Math.sqrt(a*a/(1+c*c));l<0&&(y=-y),e+=y,i+=c*y,p?t.lineTo(e,i):t.moveTo(e,i),d-=a,p=!p}}bn(t,e,i,s,n,o){let r=1,a=1;if(typeof e=="string"){i?t.fillStyle=e:t.strokeStyle=e;return}else if(e.type===1){i?t.fillStyle=e.color:t.strokeStyle=e.color;return}let h,l=this.Yp();r=n.width,a=n.height,s?(r=o.width,a=o.height):i||(r+=l,a+=l);let u=t instanceof ci;if(u&&e.Nn&&(e.type===4||e.bf===r&&e.I1===a))h=e.Nn;else{let c=0,d=0,f=0,p=0,g=0,y=0,b=0,v=0;if(s?(b=o.x,v=o.y):i||(b-=l/2,v-=l/2),c=e.start.x*r+e.start.offsetX+b,d=e.start.y*a+e.start.offsetY+v,f=e.end.x*r+e.end.offsetX+b,p=e.end.y*a+e.end.offsetY+v,e.type===2)h=t.createLinearGradient(c,d,f,p);else if(e.type===3)y=isNaN(e.endRadius)?Math.max(r,a)/2:e.endRadius,isNaN(e.startRadius)?(g=0,y=Math.max(r,a)/2):g=e.startRadius,h=t.createRadialGradient(c,d,g,f,p,y);else if(e.type===4)try{h=t.createPattern(e.pattern,"repeat")}catch{h=null}else m.si(e.type,"Brush type");if(e.type!==4){let w=e.colorStops;if(w!==null){let k=w.iterator;for(;k.next();)h.addColorStop(k.key,k.value)}}if(u&&(e.Nn=h,h!==null&&(e.bf=r,e.I1=a),h===null&&e.type===4&&e.bf!==-1)){e.bf=-1;let w=this.diagram;w!==null&&e.bf===-1&&m.un(()=>{w.redraw()},600)}}i?t.fillStyle=h:t.strokeStyle=h}isContainedBy(t){return t instanceof G?this.gI(this,t):!1}gI(t,e){if(t===e||e===null)return!1;let i=t.panel;for(;i!==null;){if(i===e)return!0;i=i.panel}return!1}isVisibleObject(){if(!this.visible)return!1;let t=this.panel;return t!==null?t.isVisibleObject():!0}isEnabledObject(){let t=this instanceof G?this:this.panel;for(;t!==null&&t.isEnabled;)t=t.panel;return t===null}get enabledChanged(){return this.w!==null?this.w.Wp:null}set enabledChanged(t){let e=this.enabledChanged;e!==t&&(t!==null&&m.S(t,J,"enabledChanged"),this.Yt().Wp=t,this.t("enabledChanged",e,t))}D1(){if(this.E1()===!0){let t=this._r;if(t.Ue(),!this.De.isReal()||!this.hi.isReal()){this.Md(!1),this.Na(!1);return}if(t.Xs(this.De.x-this.hi.x,this.De.y-this.hi.y),this.scale!==1||this.angle!==0){let e=this.naturalBounds;this.Xp(t,e.x,e.y,e.width,e.height)}this.Md(!1),this.Na(!0)}if(this.Gp()===!0){let t=this.panel;if(t===null)this.wa.set(this._r),this.Dh=this.scale;else if(t.Ws!==null){let e=this.wa;e.Ue(),t.Mn()?e.kc(t.wa):t.panel!==null&&e.kc(t.panel.wa),e.kc(this._r),this.Dh=this.scale*t.Dh}this.Na(!1)}}Xp(t,e,i,s,n){if(this.et!==1&&t.et(this.et),this.Xt===0)return;let o=P.l();o.setSpot(e,i,s,n,T.Center),t.ks(this.Xt,o.x,o.y),P.i(o)}f(t){if(this.Bo())return;t===void 0&&(t=!1),this.xi(!0),this.oo(!0);let e=this.panel;e!==null&&!t&&e.f()}kf(){this.Bo()||(this.xi(!0),this.oo(!0))}Pf(t){if(this.as())return;let e=this.panel;!t&&e!==null&&e.f(),this.oo(!0)}yf(){this.E1()===!1&&(this.Md(!0),this.Na(!0))}LN(){this.Na(!0)}C(){let t=this.part;t!==null&&t.C()}Zs(t){let e=this.stretch,i=this.panel;if(i===null)return this.Ko(e===1?0:e,t);if(i.type===G.Table)return this.Jp(i.getRowDefinition(this.row),i.getColumnDefinition(this.column),t);if(i.type===G.Auto&&i.findMainElement()===this)return this.Ko(2,t);if(e===1){if(i.type===G.Spot&&i.findMainElement()===this)return this.Ko(2,t);let s=i.defaultStretch;return s===1?this.Ko(0,t):this.Ko(s,t)}return this.Ko(e,t)}Jp(t,e,i){let s=this.stretch;if(s!==1)return this.Ko(s,i);let n=null,o=null;switch(t.stretch){case 1:case 5:break;case 4:o=!0;break;case 2:o=!0;break}switch(e.stretch){case 1:case 4:break;case 5:n=!0;break;case 2:n=!0;break}let r=this.panel.defaultStretch;return n===null&&(n=r===5||r===2),o===null&&(o=r===4||r===2),n===!0&&o===!0?this.Ko(2,i):n===!0?this.Ko(5,i):o===!0?this.Ko(4,i):this.Ko(0,i)}Ko(t,e){if(e)return t;if(t===0)return 0;let i=this.desiredSize;if(i.isReal())return 0;let s=!isNaN(i.width),n=!isNaN(i.height),o=this.angle;if(s)if(o!==90&&o!==270){if(t===5)return 0;if(t===2)return 4}else{if(t===4)return 0;if(t===2)return 5}if(n)if(o!==90&&o!==270){if(t===4)return 0;if(t===2)return 5}else{if(t===5)return 0;if(t===2)return 4}return t}get segmentOrientation(){return this.Ot!==null?this.Ot.$p:0}set segmentOrientation(t){let e=this.segmentOrientation;e!==t&&(this.Ot===null&&(this.Ot=new Re),this.Ot.$p=t,this.f(),this.t("segmentOrientation",e,t),t===0&&(this.angle=0))}mI(){this.segmentOrientation=21}get segmentIndex(){return this.Ot!==null?this.Ot.Zp:-1/0}set segmentIndex(t){t=Math.round(t);let e=this.segmentIndex;e!==t&&(this.Ot===null&&(this.Ot=new Re),this.Ot.Zp=t,this.f(),this.t("segmentIndex",e,t))}get segmentFraction(){return this.Ot!==null?this.Ot.Qp:0}set segmentFraction(t){t<0?t=0:t>1&&(t=1);let e=this.segmentFraction;e!==t&&(this.Ot===null&&(this.Ot=new Re),this.Ot.Qp=t,this.f(),this.t("segmentFraction",e,t))}get segmentOffset(){return this.Ot!==null?this.Ot._p:P.dn}set segmentOffset(t){let e=this.segmentOffset;e.equals(t)||(t=t.N(),this.Ot===null&&(this.Ot=new Re),this.Ot._p=t,this.f(),this.t("segmentOffset",e,t))}get stretch(){return this.w!==null?this.w.ro:1}set stretch(t){let e=this.stretch;e!==t&&(this.Yt().ro=t,this.f(),this.t("stretch",e,t))}get name(){return this.w!==null?this.w.Pt:""}set name(t){let e=this.name;e!==t&&(this.Yt().Pt=t,this.part!==null&&this.part.t0(),this.t("name",e,t))}get opacity(){return this.Zt}set opacity(t){t<0?t=0:t>1&&(t=1);let e=this.opacity;if(e!==t){this.Zt=t,this.t("opacity",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.C(s.hh(s.actualBounds))}}get filter(){return this.Bp}set filter(t){let e=this.filter;if(e!==t){this.Bp=t,this.Ji(!0),this.t("filter",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.C(s.hh(s.actualBounds))}}get visible(){return(this.n&1)!==0}set visible(t){let e=(this.n&1)!==0;if(e!==t){this.n=this.n^1,this.xf(),this.t("visible",e,t);let i=this.panel;i!==null?i.f():this.Qs()&&this.Xe(t),this.C(),this.iD()}}get pickable(){return(this.n&2)!==0}set pickable(t){let e=(this.n&2)!==0;e!==t&&(this.n=this.n^2,this.t("pickable",e,t))}get fromLinkableDuplicates(){return(this.n&4)!==0}set fromLinkableDuplicates(t){let e=(this.n&4)!==0;e!==t&&(this.n=this.n^4,this.t("fromLinkableDuplicates",e,t))}get fromLinkableSelfNode(){return(this.n&8)!==0}set fromLinkableSelfNode(t){let e=(this.n&8)!==0;e!==t&&(this.n=this.n^8,this.t("fromLinkableSelfNode",e,t))}get toLinkableDuplicates(){return(this.n&16)!==0}set toLinkableDuplicates(t){let e=(this.n&16)!==0;e!==t&&(this.n=this.n^16,this.t("toLinkableDuplicates",e,t))}get toLinkableSelfNode(){return(this.n&32)!==0}set toLinkableSelfNode(t){let e=(this.n&32)!==0;e!==t&&(this.n=this.n^32,this.t("toLinkableSelfNode",e,t))}get isPanelMain(){return(this.n&64)!==0}set isPanelMain(t){let e=(this.n&64)!==0;e!==t&&(this.n=this.n^64,this.f(),this.t("isPanelMain",e,t))}get isActionable(){return(this.n&128)!==0}set isActionable(t){let e=(this.n&128)!==0;e!==t&&(this.n=this.n^128,this.t("isActionable",e,t))}get background(){return this.Ct}set background(t){let e=this.background;e!==t&&(t!==null&&R.Nd(t,"GraphObject.background"),t instanceof R&&t.k(),this.Ct=t,this.C(),this.t("background",e,t))}NN(){return(this.n&512)!==0}R1(t){t?this.n|=512:this.n&=-513}mf(){return(this.n&1024)!==0}AN(t){t?this.n|=1024:this.n&=-1025}E1(){return(this.n&2048)!==0}Md(t){t?this.n|=2048:this.n&=-2049}Gp(){return(this.n&4096)!==0}Na(t){t?this.n|=4096:this.n&=-4097}Bo(){return(this.n&8192)!==0}xi(t){t?this.n|=8192:this.n&=-8193}as(){return(this.n&16384)!==0}oo(t){t?this.n|=16384:this.n&=-16385}dI(){return(this.n&32768)!==0}Ji(t){t?this.n|=32768:this.n&=-32769}get part(){if(this.Qs())return this;if(this.el!==null)return this.el;let t=this;for(t=t.panel;t;){if(t instanceof pt)return this.el=t,t;t=t.panel}return null}get svg(){return this.T1}set svg(t){this.T1=t}Jc(){this.svg=null}get panel(){return this.$s}Vh(t){this.$s=t,this.svg!==null&&this.svg.remove()}get layer(){let t=this.part;return t!==null?t.layer:null}get diagram(){let t=this.part;return t!==null?t.diagram:null}get position(){return this.ct}set position(t){let e=t.x,i=t.y,s=this.position,n=s.x,o=s.y;n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i))?(t=t.copy(),this.TN(t,n,o)&&this.t("position",new P(n,o),t.copy())):this.DN()}DN(){}TN(t,e,i){return this.ct=t,this.Pf(),!0}Vc(t,e,i){this.ct.x===t&&this.ct.y===e||(this.ct.e(t,e),this.yf())}get actualBounds(){return this.De}get scale(){return this.et}set scale(t){let e=this.scale;e!==t&&(t<=0&&m.o("GraphObject.scale for "+this+" must be greater than zero, not: "+t),this.et=t,this.f(),this.t("scale",e,t))}get angle(){return this.Xt}set angle(t){let e=this.angle;if(e!==t){if(t=t%360,t<0&&(t+=360),e===t)return;this.Xt=t,this.iD(),this.f(),this.t("angle",e,t)}}get desiredSize(){return this.cs}set desiredSize(t){let e=t.width,i=t.height,s=this.desiredSize,n=s.width,o=s.height;if((n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i)))&&(t=t.N(),this.cs=t,this.f(),this instanceof et&&this.ai(),this.t("desiredSize",s,t),this.mf())){let r=this.part;r!==null&&(this.Uh(r,"width"),this.Uh(r,"height"))}}get width(){return this.cs.width}set width(t){let e=this.cs.width;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.cs,s=new st(t,this.cs.height).k();if(this.cs=s,this.f(),this instanceof et&&this.ai(),this.t("desiredSize",i,s),this.mf()){let n=this.part;n!==null&&this.Uh(n,"width")}}}get height(){return this.cs.height}set height(t){let e=this.cs.height;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.cs,s=new st(this.cs.width,t).k();if(this.cs=s,this.f(),this instanceof et&&this.ai(),this.t("desiredSize",i,s),this.mf()){let n=this.part;n!==null&&this.Uh(n,"height")}}}get minSize(){return this.w!==null?this.w.Sr:st.bc}set minSize(t){let e=this.minSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=0),isNaN(t.height)&&(t.height=0),t.k(),this.Yt().Sr=t,this.f(),this.t("minSize",e,t))}get maxSize(){return this.w!==null?this.w.Mr:st.LP}set maxSize(t){let e=this.maxSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=1/0),isNaN(t.height)&&(t.height=1/0),t.k(),this.Yt().Mr=t,this.f(),this.t("maxSize",e,t))}get measuredBounds(){return this.hi}get naturalBounds(){return this.Ke}Yp(){return 0}get margin(){return this.tl}set margin(t){typeof t=="number"&&(t=new Dt(t));let e=this.tl;e.equals(t)||(t=t.N(),this.tl=t,this.f(),this.t("margin",e,t))}get v(){return this.E1()===!0&&this.D1(),this._r}get Ws(){return this.Gp()===!0&&this.D1(),this.wa}trigger(t,e,i){let s=null;return typeof t=="string"?s=new ai(t,e,i):s=t,s.Ti=this,this.Ts===null&&(this.Ts=new Mt),this.Ts.set(s.propertyName,s),this}get Ts(){return this.w!==null?this.w.Ts:null}set Ts(t){this.Ts!==t&&(this.Yt().Ts=t)}get Pr(){return this.w!==null?this.w.Pr:0}set Pr(t){this.Pr!==t&&(this.Yt().Pr=t)}get alignment(){return this.de}set alignment(t){let e=this.alignment;e.equals(t)||(t.isNoSpot()&&!t.isDefault()&&m.o("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+t),t=t.N(),this.de=t,this.Pf(),this.t("alignment",e,t))}get column(){return this.pa}set column(t){t=Math.round(t);let e=this.column;e!==t&&(t<0&&m.J(t,">= 0",J,"column"),this.pa=t,this.f(),this.t("column",e,t),this.svg!==null&&this.svg.remove())}get columnSpan(){return this.w!==null?this.w.e0:1}set columnSpan(t){t=Math.round(t);let e=this.columnSpan;e!==t&&(t<1&&m.J(t,">= 1",J,"columnSpan"),this.Yt().e0=t,this.f(),this.t("columnSpan",e,t))}get row(){return this.Vp}set row(t){t=Math.round(t);let e=this.row;e!==t&&(t<0&&m.J(t,">= 0",J,"row"),this.Vp=t,this.f(),this.t("row",e,t),this.svg!==null&&this.svg.remove())}get rowSpan(){return this.w!==null?this.w.i0:1}set rowSpan(t){t=Math.round(t);let e=this.rowSpan;e!==t&&(t<1&&m.J(t,">= 1",J,"rowSpan"),this.Yt().i0=t,this.f(),this.t("rowSpan",e,t))}get spanAllocation(){return this.w!==null?this.w.s0:null}set spanAllocation(t){let e=this.spanAllocation;e!==t&&(t!==null&&m.S(t,J,"spanAllocation"),this.Yt().s0=t,this.f(),this.t("spanAllocation",e,t))}get alignmentFocus(){return this.xd}set alignmentFocus(t){let e=this.alignmentFocus;e.equals(t)||(t=t.N(),this.xd=t,this.f(),this.t("alignmentFocus",e,t))}get portId(){return this.Up}set portId(t){let e=this.portId;if(e!==t){let i=this.part;i!==null&&!(i instanceof $)&&m.o("Cannot set portID on a Link: "+t);let s=i;e!==null&&s!==null&&s.vN(this),this.Up=t,t!==null&&s!==null&&(s.Cn=!0,s.sD(this)),this.t("portId",e,t)}}Bh(){let t=this.part;if(t instanceof $&&(this.portId!==null||this===t.port)){let e=t.diagram;e!==null&&!e.undoManager.isUndoingRedoing&&t.invalidateConnectedLinks(void 0,this)}}iD(){let t=this.diagram;t===null||t.undoManager.isUndoingRedoing||(this instanceof G?this instanceof $?this.invalidateConnectedLinks():this.walkVisualTreeFrom(this,e=>{e.Bh()}):this.Bh())}get toSpot(){return this.ft!==null?this.ft.Fh:T.None}set toSpot(t){let e=this.toSpot;e.equals(t)||(t=t.N(),this.Wi().Fh=t,this.t("toSpot",e,t),this.Bh())}get toEndSegmentLength(){return this.ft!==null?this.ft.Oh:10}set toEndSegmentLength(t){let e=this.toEndSegmentLength;e!==t&&(t<0&&m.J(t,">= 0",J,"toEndSegmentLength"),this.Wi().Oh=t,this.t("toEndSegmentLength",e,t),this.Bh())}get toShortLength(){return this.ft!==null?this.ft.Eh:0}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Wi().Eh=t,this.t("toShortLength",e,t),this.Bh())}get toLinkable(){return this.ft!==null?this.ft.o0:null}set toLinkable(t){let e=this.toLinkable;e!==t&&(this.Wi().o0=t,this.t("toLinkable",e,t))}get toMaxLinks(){return this.ft!==null?this.ft.r0:1/0}set toMaxLinks(t){let e=this.toMaxLinks;e!==t&&(t<0&&m.J(t,">= 0",J,"toMaxLinks"),this.Wi().r0=t,this.t("toMaxLinks",e,t))}get fromSpot(){return this.ft!==null?this.ft.vh:T.None}set fromSpot(t){let e=this.fromSpot;e.equals(t)||(t=t.N(),this.Wi().vh=t,this.t("fromSpot",e,t),this.Bh())}get fromEndSegmentLength(){return this.ft!==null?this.ft.Rh:10}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;e!==t&&(t<0&&m.J(t,">= 0",J,"fromEndSegmentLength"),this.Wi().Rh=t,this.t("fromEndSegmentLength",e,t),this.Bh())}get fromShortLength(){return this.ft!==null?this.ft.Ih:0}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Wi().Ih=t,this.t("fromShortLength",e,t),this.Bh())}get fromLinkable(){return this.ft!==null?this.ft.l0:null}set fromLinkable(t){let e=this.fromLinkable;e!==t&&(this.Wi().l0=t,this.t("fromLinkable",e,t))}get fromMaxLinks(){return this.ft!==null?this.ft.a0:1/0}set fromMaxLinks(t){let e=this.fromMaxLinks;e!==t&&(t<0&&m.J(t,">= 0",J,"fromMaxLinks"),this.Wi().a0=t,this.t("fromMaxLinks",e,t))}get cursor(){return this.w!==null?this.w.Il:""}set cursor(t){let e=this.cursor;e!==t&&(m.s(t,"string",J,"cursor"),this.Yt().Il=t,this.t("cursor",e,t))}get click(){return this.w!==null?this.w.Or:null}set click(t){let e=this.click;e!==t&&(t!==null&&m.S(t,J,"click"),this.Yt().Or=t,this.t("click",e,t))}get doubleClick(){return this.w!==null?this.w.Ir:null}set doubleClick(t){let e=this.doubleClick;e!==t&&(t!==null&&m.S(t,J,"doubleClick"),this.Yt().Ir=t,this.t("doubleClick",e,t))}get contextClick(){return this.w!==null?this.w.Er:null}set contextClick(t){let e=this.contextClick;e!==t&&(t!==null&&m.S(t,J,"contextClick"),this.Yt().Er=t,this.t("contextClick",e,t))}get mouseEnter(){return this.w!==null?this.w.Xr:null}set mouseEnter(t){let e=this.mouseEnter;e!==t&&(t!==null&&m.S(t,J,"mouseEnter"),this.Yt().Xr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.w!==null?this.w.Gr:null}set mouseLeave(t){let e=this.mouseLeave;e!==t&&(t!==null&&m.S(t,J,"mouseLeave"),this.Yt().Gr=t,this.t("mouseLeave",e,t))}get mouseOver(){return this.w!==null?this.w.Ur:null}set mouseOver(t){let e=this.mouseOver;e!==t&&(t!==null&&m.S(t,J,"mouseOver"),this.Yt().Ur=t,this.t("mouseOver",e,t))}get mouseHover(){return this.w!==null?this.w.Vr:null}set mouseHover(t){let e=this.mouseHover;e!==t&&(t!==null&&m.S(t,J,"mouseHover"),this.Yt().Vr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.w!==null?this.w.Br:null}set mouseHold(t){let e=this.mouseHold;e!==t&&(t!==null&&m.S(t,J,"mouseHold"),this.Yt().Br=t,this.t("mouseHold",e,t))}get mouseDragEnter(){return this.w!==null?this.w.h0:null}set mouseDragEnter(t){let e=this.mouseDragEnter;e!==t&&(t!==null&&m.S(t,J,"mouseDragEnter"),this.Yt().h0=t,this.t("mouseDragEnter",e,t))}get mouseDragLeave(){return this.w!==null?this.w.c0:null}set mouseDragLeave(t){let e=this.mouseDragLeave;e!==t&&(t!==null&&m.S(t,J,"mouseDragLeave"),this.Yt().c0=t,this.t("mouseDragLeave",e,t))}get mouseDrop(){return this.w!==null?this.w.zr:null}set mouseDrop(t){let e=this.mouseDrop;e!==t&&(t!==null&&m.S(t,J,"mouseDrop"),this.Yt().zr=t,this.t("mouseDrop",e,t))}get actionDown(){return this.w!==null?this.w.f0:null}set actionDown(t){let e=this.actionDown;e!==t&&(t!==null&&m.S(t,J,"actionDown"),this.Yt().f0=t,this.t("actionDown",e,t))}get actionMove(){return this.w!==null?this.w.u0:null}set actionMove(t){let e=this.actionMove;e!==t&&(t!==null&&m.S(t,J,"actionMove"),this.Yt().u0=t,this.t("actionMove",e,t))}get actionUp(){return this.w!==null?this.w.d0:null}set actionUp(t){let e=this.actionUp;e!==t&&(t!==null&&m.S(t,J,"actionUp"),this.Yt().d0=t,this.t("actionUp",e,t))}get actionCancel(){return this.w!==null?this.w.g0:null}set actionCancel(t){let e=this.actionCancel;e!==t&&(t!==null&&m.S(t,J,"actionCancel"),this.Yt().g0=t,this.t("actionCancel",e,t))}get toolTip(){return this.w!==null?this.w.Yr:null}set toolTip(t){let e=this.toolTip;e!==t&&(this.Yt().Yr=t,this.t("toolTip",e,t))}get contextMenu(){return this.w!==null?this.w.Kr:null}set contextMenu(t){let e=this.contextMenu;e!==t&&(this.Yt().Kr=t,this.t("contextMenu",e,t))}findBindingPanel(){let t=this instanceof G?this:this.panel;for(;t!==null;){if(t.FN())return t;t=t.panel}return null}bind(t,e,i,s){return this.Sf(t,e,i,s),this}bindTwoWay(t,e,i,s){return this.Sf(t,e,i,s).makeTwoWay(),this}bindModel(t,e,i,s){return this.Sf(t,e,i,s).ofModel(),this}bindObject(t,e,i,s,n){return this.Sf(t,e,i,s).ofObject(n),this}theme(t,e,i,s,n){return this.Ca(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.Ca(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofModel(),this}Sf(t,e,i,s){let n=null;return typeof t=="string"?n=new te(t,e,i,s):n=t,this.m0(n),n}Ca(t,e,i,s,n){let o=null;return typeof t=="string"?o=new ii(t,e,i,s,n):o=t,this.m0(o),o}m0(t){t.Ti=this;let e=this.findBindingPanel();e!==null&&e.nD()&&m.o("Cannot add a Binding to a template that has already been copied: "+t),this.ve===null&&(this.ve=new q),this.ve.add(t)}set(t){return t?(Object.assign(this,t),this):this}attach(t){return J.RN(this,t),this}apply(t,...e){return t.apply(this,[this,...e]),this}setProperties(t){return Y.Np(this,t),this}static make(t,...e){let i=arguments,s=null,n=null;if(m.it(t))n=t;else if(typeof t=="string"){let r=J.U1.get(t);m.it(r)?(i=Array.prototype.slice.call(i),s=r(i),m.$(s)||m.o('GraphObject.make invoked object builder "'+t+'", but it did not return an Object')):n=K.go[t]}s===null&&((n==null||!n.constructor)&&m.o("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+t),s=new n);let o=1;if(s instanceof Y&&i.length>1){let r=s,a=i[1];(typeof a=="string"||a instanceof HTMLDivElement)&&(r.m2(a),o++)}for(let r=o;r<i.length;r++){let a=i[r];a===void 0?m.o("Undefined value at argument "+r+" for object being constructed by GraphObject.make: "+s):s&&J.RN(s,a)}return s}static RN(t,e){if(typeof e=="number")J.pI(t,e);else if(typeof e=="string")J.yI(t,e);else if(e instanceof J)t instanceof G||m.o("A GraphObject can only be added to a Panel, not to: "+t),t.add(e);else if(e instanceof Kt){let i=null;e.isRow&&m.it(t.getRowDefinition)?i=t.getRowDefinition(e.index):!e.isRow&&m.it(t.getColumnDefinition)&&(i=t.getColumnDefinition(e.index)),i instanceof Kt?i.V1(e):m.o("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+t)}else if(e instanceof Lt){let i=t;i.type=e}else if(e instanceof te)t instanceof J||t instanceof Kt?t.bind(e):m.o("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+t);else if(e instanceof ai)t instanceof J?t.trigger(e):m.o("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof zt)t instanceof wt&&t.type===4?t.figures.add(e):m.o("A PathFigure can only be added to a Path Geometry, not to: "+t);else if(e instanceof mt)t instanceof zt?t.segments.add(e):m.o("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof _t)t instanceof Y||t instanceof ht?t.layout=e:m.o("A Layout can only be assigned to a Diagram or a Group, not to: "+t);else if(Array.isArray(e))for(let i=0;i<e.length;i++){let s=e[i];J.RN(t,s)}else m.$(e)?J.wI(t,e):m.o('Unknown initializer "'+e+'" for object being constructed by GraphObject.make: '+t)}static yI(t,e){if(t instanceof lt)t.text=e;else if(t instanceof et)t.figure=e;else if(t instanceof Bt)t.source=e;else if(t instanceof G){let i=Lt.fs.get(e);i!==null&&(t.type=i)}else if(t instanceof R){let i=m.$a(Oe,e);i!==null?t.type=i:m.o("Unknown Brush type as an argument to GraphObject.make: "+e)}else if(t instanceof wt){let i=m.$a(ze,e);i!==null&&(t.type=i)}else if(t instanceof mt){let i=m.$a(ni,e);i!==null&&(t.type=i)}}static pI(t,e){m.it(t.fe)?t.fe(e):m.cr(t,e)}static wI(t,e){if(t instanceof R){let i=new yt;for(let s in e){let n=parseFloat(s);isNaN(n)?i[s]=e[s]:t.addColorStop(n,e[s])}Y.Np(t,i)}else if(t instanceof Kt){if(e.row!==void 0){let s=e.row;(s==null||s===1/0||isNaN(s)||s<0)&&m.o("Must specify non-negative integer row for RowColumnDefinition "+e+", not: "+s),t.isRow=!0,t.index=s}else if(e.column!==void 0){let s=e.column;(s==null||s===1/0||isNaN(s)||s<0)&&m.o("Must specify non-negative integer column for RowColumnDefinition "+e+", not: "+s),t.isRow=!1,t.index=s}let i=new yt;for(let s in e)s==="row"||s==="column"||(i[s]=e[s]);Y.Np(t,i)}else Y.Np(t,e)}static build(t,e,...i){let s=J.U1.get(t);if(m.it(s)){let n=s([t].concat(i));if(n instanceof J)return e&&n.setProperties(e),n}m.o('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')}static defineBuilder(t,e){m.s(t,"string",J,"defineBuilder:name"),m.S(e,J,"defineBuilder:func");let i=t.toLowerCase();J.U1.set(t,e)}static isBuilderDefined(t){return J.U1.has(t)}static takeBuilderArgument(t,e,i){i===void 0&&(i=null);let s=t[1];return(m.it(i)?i(s):typeof s=="string")?(t.splice(1,1),s):(e===void 0&&m.o("no "+(m.it(i)?"satisfactory":"string")+" argument for GraphObject builder "+t[0]),e)}static U1=new Mt}J.Vertical=4,J.Horizontal=5,J.defineBuilder("Button",x=>{let t="#f5f5f5",e="#737373",i="#d4d4d4",s="#737373",n="#a3a3a3",o=2.76142374915397,r=2.761423749153969,a=new G(G.Auto,{isActionable:!0,enabledChanged:(h,l)=>{if(h instanceof G){let u=h.findObject("ButtonBorder");if(u!==null)if(h._buttonFillNormal===void 0&&(h._buttonFillNormal=u.fill),l){let c=null;h.layer!==null&&h.diagram!==null&&h.isVisibleObject()&&(c=h.layer.findObjectAt(h.diagram.lastInput.documentPoint)),c===h||c!==null&&c.isContainedBy(h)?u.fill=h._buttonFillOver:u.fill=h._buttonFillNormal}else u.fill=h._buttonFillDisabled}},cursor:"pointer"}).attach({_buttonFillNormal:void 0,_buttonStrokeNormal:void 0,_buttonFillOver:i,_buttonStrokeOver:s,_buttonFillDisabled:n}).add(new et("RoundedRectangle",{name:"ButtonBorder",spot1:new T(0,0,o,r),spot2:new T(1,1,-o,-r),parameter1:2,fill:t,stroke:e}));return a.mouseEnter=(h,l,u)=>{if(!l.isEnabledObject()||!(l instanceof G))return;let c=l.findObject("ButtonBorder");c instanceof et&&(l._buttonFillNormal===void 0&&(l._buttonFillNormal=c.fill),c.fill=l._buttonFillOver,l._buttonStrokeNormal===void 0&&(l._buttonStrokeNormal=c.stroke),c.stroke=l._buttonStrokeOver)},a.mouseLeave=(h,l,u)=>{if(!l.isEnabledObject()||!(l instanceof G))return;let c=l.findObject("ButtonBorder");c instanceof et&&(l._buttonFillNormal!==void 0&&(c.fill=l._buttonFillNormal),l._buttonStrokeNormal!==void 0&&(c.stroke=l._buttonStrokeNormal))},a}),J.defineBuilder("TreeExpanderButton",x=>{let t=J.build("Button");return t.attach({_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine",visible:!1}),t.add(new et("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:st.Su}).bindObject("figure","isTreeExpanded",(e,i)=>{let s=i.panel;return e?s._treeExpandedFigure:s._treeCollapsedFigure})),t.bindObject("visible","isTreeLeaf",e=>!e),t.click=(e,i)=>{let s=i.part;if(s instanceof vt&&(s=s.adornedPart),!(s instanceof $))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isTreeExpanded){if(!o.canCollapseTree(s))return}else if(!o.canExpandTree(s))return;e.handled=!0,s.isTreeExpanded?o.collapseTree(s):o.expandTree(s)},t}),J.defineBuilder("SubGraphExpanderButton",x=>{let t=J.build("Button");return t.attach({_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"}),t.add(new et("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:st.Su}).bindObject("figure","isSubGraphExpanded",(e,i)=>{let s=i.panel;return e?s._subGraphExpandedFigure:s._subGraphCollapsedFigure})),t.click=(e,i)=>{let s=i.part;if(s instanceof vt&&(s=s.adornedPart),!(s instanceof ht))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isSubGraphExpanded){if(!o.canCollapseSubGraph(s))return}else if(!o.canExpandSubGraph(s))return;e.handled=!0,s.isSubGraphExpanded?o.collapseSubGraph(s):o.expandSubGraph(s)},t}),J.defineBuilder("ToolTip",x=>new vt(G.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2),mouseOver:(t,e)=>{let i=t.diagram.toolManager;i.extendToolTip(i.toolTipDuration)}}).add(new et("RoundedRectangle",{name:"Border",parameter1:1,fill:"#f5f5f5",strokeWidth:0,spot1:new T(0,0,4,6),spot2:new T(1,1,-4,-4)}))),J.defineBuilder("ContextMenu",x=>new vt(G.Vertical,{background:"#f5f5f5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).bindObject("background","",t=>t.adornedPart!==null&&t.hasPlaceholder()?null:"#f5f5f5")),J.defineBuilder("ContextMenuButton",x=>{let t=J.build("Button");t.stretch=5;let e=t.findObject("ButtonBorder");return e instanceof et&&(e.figure="Rectangle",e.strokeWidth=0,e.spot1=new T(0,0,4,6),e.spot2=new T(1,1,-4,-4)),t}),J.defineBuilder("PanelExpanderButton",x=>{let t=J.takeBuilderArgument(x,"COLLAPSIBLE"),e=J.build("Button");e.attach({_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8","ButtonBorder.fill":"rgba(0, 0, 0, 0)",_buttonFillNormal:"rgba(0, 0, 0, 0)","ButtonBorder.stroke":null,_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null}),e.add(new et({name:"ButtonIcon",strokeWidth:2}).bindObject("geometryString","visible",s=>s?e._buttonExpandedFigure:e._buttonCollapsedFigure,void 0,t));let i=e.findObject("ButtonBorder");return i instanceof et&&(i.stroke=null,i.fill="rgba(0, 0, 0, 0)"),e.click=(s,n)=>{if(!(n instanceof G))return;let o=n.diagram;if(o===null||o.isReadOnly)return;let r=n.findBindingPanel();if(r===null&&(r=n.part),r!==null){let a=r.findObject(t);a!==null&&(s.handled=!0,o.startTransaction("Collapse/Expand Panel"),a.visible=!a.visible,o.commitTransaction("Collapse/Expand Panel"))}},e}),J.defineBuilder("CheckBoxButton",x=>{let t=J.takeBuilderArgument(x),e=J.build("Button",{desiredSize:new st(14,14)});e.attach({"ButtonBorder.spot1":new T(0,0,1,1),"ButtonBorder.spot2":new T(1,1,-1,-1)});let i=new et({name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:2,geometryStretch:6,visible:!1});return t!==""&&i.bindTwoWay("visible",t),e.add(i),e.click=(s,n)=>{if(!(n instanceof G))return;let o=s.diagram;if(o===null||o.isReadOnly||t!==""&&o.model.isReadOnly)return;s.handled=!0;let r=n.findObject("ButtonIcon");o.startTransaction("checkbox"),r!==null&&(r.visible=!r.visible),m.it(n._doClick)&&n._doClick(s,n),o.commitTransaction("checkbox")},e}),J.defineBuilder("CheckBox",x=>{let t=J.takeBuilderArgument(x),e=J.build("CheckBoxButton",{name:"Button",isActionable:!1,margin:new Dt(0,1,0,0)},t),i=new G("Horizontal",{isActionable:!0,cursor:e.cursor,margin:new Dt(1),mouseEnter:e.mouseEnter,mouseLeave:e.mouseLeave,click:e.click}).attach({_buttonFillNormal:e._buttonFillNormal,_buttonStrokeNormal:e._buttonStrokeNormal,_buttonFillOver:e._buttonFillOver,_buttonStrokeOver:e._buttonStrokeOver,_buttonFillDisabled:e._buttonFillDisabled,_buttonClick:e.click});return i.add(e),e.mouseEnter=null,e.mouseLeave=null,e.click=null,i}),J.defineBuilder("AutoRepeatButton",x=>{let t=J.takeBuilderArgument(x,50,r=>typeof r=="number"),e=J.takeBuilderArgument(x,500,r=>typeof r=="number");function i(r,a){n(r,a),a.click&&(a.Cd=m.un(()=>s(r,a),e))}function s(r,a){a.Cd&&m.wc(a.Cd),a.click&&(a.Cd=m.un(()=>{a.click&&(a.click(r,a),s(r,a))},t))}function n(r,a){a.Cd&&(m.wc(a.Cd),a.Cd=void 0)}let o=J.build("Button");return o.actionDown=(r,a)=>i(r,a),o.actionUp=(r,a)=>n(r,a),o.actionCancel=(r,a)=>n(r,a),o}),J.defineBuilder("ToggleSwitch",function(x){let t=J.takeBuilderArgument(x);t||m.o("ToggleSwitch must be data-bound to a property name, not: "+t);let e=J.takeBuilderArgument(x,!1,r=>typeof r=="boolean"),i="gray",s="transparent",n="white",o=new G("Auto",{width:e?15:28,height:e?28:15}).attach({_buttonFillOff:i,_buttonBorderOff:s,_buttonIconFillOff:n,_buttonFillOn:"green",_buttonBorderOn:"transparent",_buttonIconFillOn:"white"}).add(new et("Capsule",{name:"ButtonBorder",fill:i,stroke:s,strokeWidth:1}).bind("fill",t,(r,a)=>r?a.panel._buttonFillOn:a.panel._buttonFillOff).bind("stroke",t,(r,a)=>r?a.panel._buttonBorderOn:a.panel._buttonBorderOff)).add(new et("Circle",{name:"ButtonIcon",width:11,height:11,fill:n,stroke:null,alignment:e?T.Bottom:T.Left}).bind("fill",t,(r,a)=>r?a.panel._buttonIconFillOn:a.panel._buttonIconFillOff).bind("alignment",t,r=>r?e?T.Top:T.Right:e?T.Bottom:T.Left));return o.click=function(r,a){if(!a.isEnabledObject())return;let h=r.diagram;if(h===null||h.isReadOnly||t!==""&&h.model.isReadOnly)return;r.handled=!0;let l=a.findBindingPanel();l!==null&&(h.startTransaction("toggle switch"),h.model.set(l.data,t,!l.data[t]),typeof a._doClick=="function"&&a._doClick(r,a),h.commitTransaction("toggle switch"))},o}),J.defineBuilder("Toggle",function(x){let t=J.takeBuilderArgument(x),e=J.build("ToggleSwitch",{name:"Button"},t),i=new G("Horizontal",{cursor:e.cursor,margin:1,mouseEnter:e.mouseEnter,mouseLeave:e.mouseLeave,click:e.click}).attach({_buttonClick:e.click}).add(e);return e.mouseEnter=null,e.mouseLeave=null,e.click=null,i});class Ye{me;Pt;io;ve;so;Ds;Il;Or;Ir;Er;Xr;Gr;Ur;Vr;Br;h0;c0;zr;f0;u0;d0;g0;Yr;Kr;Wp;s0;Ts;Sr;Mr;ro;i0;e0;Pr;qp;p0;y0;constructor(){this.me=!1,this.Pt="",this.io=-1,this.ve=null,this.so=null,this.Ds=null,this.Il="",this.Or=null,this.Ir=null,this.Er=null,this.Xr=null,this.Gr=null,this.Ur=null,this.Vr=null,this.Br=null,this.h0=null,this.c0=null,this.zr=null,this.f0=null,this.u0=null,this.d0=null,this.g0=null,this.Yr=null,this.Kr=null,this.Wp=null,this.s0=null,this.Ts=null,this.Sr=st.bc,this.Mr=st.LP,this.ro=1,this.i0=1,this.e0=1,this.Pr=0,this.qp=null,this.p0=null,this.y0="category"}copy(){let t=new Ye;return t.Pt=this.Pt,t.io=this.io,t.ve=this.ve,t.Ds=this.Ds,t.Il=this.Il,t.Or=this.Or,t.Ir=this.Ir,t.Er=this.Er,t.Xr=this.Xr,t.Gr=this.Gr,t.Ur=this.Ur,t.Vr=this.Vr,t.Br=this.Br,t.h0=this.h0,t.c0=this.c0,t.zr=this.zr,t.f0=this.f0,t.u0=this.u0,t.d0=this.d0,t.g0=this.g0,t.Yr=this.Yr,t.Kr=this.Kr,t.Wp=this.Wp,t.s0=this.s0,t.Ts=this.Ts,t.Sr=this.Sr.N(),t.Mr=this.Mr.N(),t.ro=this.ro,t.i0=this.i0,t.e0=this.e0,t.Pr=this.Pr,t.qp=this.qp,t.p0=this.p0,t.y0=this.y0,t}}class Si{m;constructor(){this.m=[1,0,0,1,0,0]}copy(){let t=new Si;return t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5],t}translate(t,e){this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e}scale(t,e){this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e}rotate(t,e,i){if(t=C.Ee(t),t===0)return;this.translate(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m[0]*s+this.m[2]*n,r=this.m[1]*s+this.m[3]*n,a=this.m[0]*-n+this.m[2]*s,h=this.m[1]*-n+this.m[3]*s;this.m[0]=o,this.m[1]=r,this.m[2]=a,this.m[3]=h,this.translate(-e,-i)}}class li{type;x1;y1;r1;x2;y2;r2;colors;pattern;constructor(t){this.type=t,this.x1=0,this.y1=0,this.r1=0,this.x2=0,this.y2=0,this.r2=0,this.colors=[],this.pattern=null}addColorStop(t,e){this.colors.push({offset:t,color:e})}}class ui{bt;_t;Qr;dd;ON;constructor(t,e,i){let s=e===void 0?K.document:e;this.Qr=s,this.ON="http://www.w3.org/2000/svg";let n="http://www.w3.org/2000/xmlns/";s!==void 0&&(this.bt=this.makeElement("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.style.letterSpacing="normal",this.style.wordSpacing="normal",i||(this.style.position="absolute"),this.bt.setAttributeNS(n,"xmlns",this.ON),this.bt.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink")),this.dd=null,this._t=new re(this,i)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",this.bt.setAttributeNS(null,"width",i+"px"),this.bt.setAttributeNS(null,"height",s+"px"),this.bt.setAttributeNS(null,"viewBox","0 0 "+i+" "+s),this._t.IN.firstElementChild.setAttributeNS(null,"width",i+"px"),this._t.IN.firstElementChild.setAttributeNS(null,"height",s+"px"),!0):!1}makeElement(t,e,i){let s=this.Qr.createElementNS(this.ON,t);if(m.$(e))for(let n in e)s.setAttributeNS(n==="href"?"http://www.w3.org/1999/xlink":"",n,e[n]);return i!==void 0&&(s.textContent=i),s}getBoundingClientRect(){return this.bt.getBoundingClientRect()}focus(){this.bt.focus()}get width(){return parseInt(this.bt.getAttribute("width")||"1")}set width(t){this.bt.setAttribute("width",t+"px")}get height(){return parseInt(this.bt.getAttribute("height")||"1")}set height(t){this.bt.setAttribute("height",t+"px")}dispose(){this.Qr=null}get style(){return this.bt.style}}class re{Mf;Nf;Ln;Fe;$i;fillStyle;font;globalAlpha;lineCap;lineDashOffset;lineJoin;lineWidth;miterLimit;shadowBlur;shadowColor;shadowOffsetX;shadowOffsetY;strokeStyle;textAlign;imageSmoothingEnabled;clipInsteadOfFill;lastCreatedElement;Cf;Lf;surface;svg;IN;oD;B1;Ho;La;zh;currentElement;clipPathGroup;diagramGroup;lastDrawnPart;currentPath;outerGroup;pathAttributes;sl;Tr;filter;letterSpacing;wordSpacing;partClipRect;constructor(t,e){if(this.surface=t,this.svg=t.bt,this.Cf=[],this.Lf=[],this.fillStyle="#000000",this.font="10px sans-serif",this.globalAlpha=1,this.lineCap="butt",this.lineDashOffset=0,this.lineJoin="miter",this.lineWidth=1,this.miterLimit=10,this.shadowBlur=0,this.shadowColor="rgba(0, 0, 0, 0)",this.shadowOffsetX=0,this.shadowOffsetY=0,this.sl=!1,this.strokeStyle="#000000",this.textAlign="start",this.clipInsteadOfFill=!1,this.Mf=0,this.Nf=0,this.Ln=0,this.lastCreatedElement=null,this.currentElement=null,this.Fe=[],this.pathAttributes={},this.B1=!1,this.Ho=null,this.La=0,this.oD={},this.Tr=!!e,this.filter="",this.partClipRect=null,this.$i=new Si,this.letterSpacing="0px",this.wordSpacing="0px",t.Qr===null||t.Qr===void 0)return;this.clipPathGroup=this.newGroup2(),this.diagramGroup=this.newGroup2("gojs-diagram"),this.lastDrawnPart=null,this.currentPath=null;let i=V.Hw++,s=this.makeElement("clipPath",{id:"mainClip"+i}),n={x:0,y:0,width:t.width,height:t.height};s.appendChild(this.makeElement("rect",n)),this.IN=s,this.svg.appendChild(this.clipPathGroup),this.clipPathGroup.appendChild(this.diagramGroup),this.svg.appendChild(s),this.clipPathGroup.setAttributeNS(null,"clip-path","url(#mainClip"+i+")")}setDiagramPosScale(t,e,i,s,n,o){this.diagramGroup===void 0?this.newGroup(t,e,i,s,n,o):this.diagramGroup.setAttribute("transform","matrix("+t+", "+e+", "+i+", "+s+", "+n+", "+o+")")}resetInnerSVG(){this.diagramGroup!==null&&(this.diagramGroup.innerHTML="")}arc(t,e,i,s,n,o,r,a){let h=2*Math.PI,l=1e-6,u=h-l,c=i*Math.cos(s),d=i*Math.sin(s),f=t+c,p=e+d,g=o?0:1,y=o?s-n:n-s;(Math.abs(r-f)>l||Math.abs(a-p)>l)&&this.Fe.push(["L",f,+p]),y<0&&(y=y%h+h),y>u?(this.Fe.push(["A",i,i,0,1,g,t-c,e-d]),this.Fe.push(["A",i,i,0,1,g,f,p])):y>l&&this.Fe.push(["A",i,i,0,+(y>=Math.PI),g,t+i*Math.cos(n),e+i*Math.sin(n)])}beginPath(){this.Fe=[],this.pathAttributes={stroke:"none",fill:"none"}}endPath(t){this.xI(this.Fe,this.$i,t||0)}bezierCurveTo(t,e,i,s,n,o){this.Fe.push(["C",t,e,i,s,n,o])}clearRect(t,e,i,s){}clip(){this.pathAttributes.clipPath=!0}closePath(){this.Fe.push(["z"])}createLinearGradient(t,e,i,s){let n=new li("linear");return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}createPattern(t,e){let i="";t instanceof HTMLCanvasElement&&(i=t.toDataURL()),t instanceof HTMLImageElement&&(i=t.getAttribute("src"));let s=this.oD;if(s[i])return"url(#"+s[i]+")";let n="PATTERN"+V.Hw++,o={width:t.width,height:t.height,id:n,patternUnits:"userSpaceOnUse"},r={x:0,y:0,width:t.width,height:t.height,href:i},a=this.makeElement("pattern",o);return a.appendChild(this.makeElement(Y.img,r)),this.svg.appendChild(a),s[i]=n,"url(#"+n+")"}createRadialGradient(t,e,i,s,n,o){let r=new li("radial");return r.x1=t,r.y1=e,r.r1=i,r.x2=s,r.y2=n,r.r2=o,r}amendImageTransform(t,e,i,s,n,o,r,a){let h=r/i,l=a/s;(n!==0||o!==0)&&this.$i.translate(n,o),(h!==1||l!==1)&&this.$i.scale(h,l),(t!==0||e!==0)&&this.$i.translate(-t,-e)}drawImage(t,e,i,s,n,o,r,a,h){let l="",u=t.width,c=t.height;typeof t.toDataURL=="function"?t.toDataURL():(l=t.getAttribute("src"),u=t.naturalWidth,c=t.naturalHeight),s===void 0&&(o=e,r=i,a=s=u,h=n=c),s=s||0,n=n||0,o=o||0,r=r||0,a=a||0,h=h||0,this.amendImageTransform(e,i,s,n,o,r,a,h);let d={x:0,y:0,width:u||s,height:c||n,href:l};!C.X(s,a)||!C.X(n,h)?d.preserveAspectRatio="none":l.toLowerCase().indexOf(".svg")===-1&&l.toLowerCase().indexOf("data:image/svg")===-1&&(d.preserveAspectRatio="xMidYMid slice"),(e!==0||i!==0||s!==u||n!==c)&&(s+=e,n+=i,d["clip-path"]=`path('M ${e},${i} L ${s} ${i} L ${s} ${n} L ${e} ${n} z')`),this.processCommon(Y.img,d,this.$i),this.Ld(Y.img,d)}fill(t,e){t&&(this.pathAttributes["fill-rule"]="evenodd"),this.setFill(this.pathAttributes)}fillContext(t,e,i){this.clipInsteadOfFill?this.clip():this.fill(e,i)}createOrUpdateClipGroup(t,e){let i=this.newGroup(1,0,0,1,-e.x,-e.y);i.setAttributeNS(null,"class","spotClip"),t.xa=i}fillRect(t,e,i,s){this.addRect("fill",[t,e,i,s],this.$i)}fillBackground(t,e,i,s){let n={x:t,y:e,width:i,height:s};this.processCommon("fill",n,this.$i),this.setFill(n),this.svg.prepend(this.makeElement("rect",n))}fillText(t,e,i){this.addText("fill",[t,e,i],this.$i)}lineTo(t,e){this.Fe.push(["L",t,e])}moveTo(t,e){this.Fe.push(["M",t,e])}quadraticCurveTo(t,e,i,s){this.Fe.push(["Q",t,e,i,s])}rect(t,e,i,s){this.Fe.push(["M",t,e],["L",t+i,e],["L",t+i,e+s],["L",t,e+s],["z"])}restore(){this.$i=this.Cf.pop(),this.Fe=this.Cf.pop();let t=this.Cf.pop();this.fillStyle=t.fillStyle,this.font=t.font,this.globalAlpha=t.globalAlpha,this.lineCap=t.lineCap,this.lineDashOffset=t.lineDashOffset,this.lineJoin=t.lineJoin,this.lineWidth=t.lineWidth,this.miterLimit=t.miterLimit,this.shadowBlur=t.shadowBlur,this.shadowColor=t.shadowColor,this.shadowOffsetX=t.shadowOffsetX,this.shadowOffsetY=t.shadowOffsetY,this.strokeStyle=t.strokeStyle,this.textAlign=t.textAlign,this.partClipRect=t.partClipRect,this.letterSpacing=t.letterSpacing,this.wordSpacing=t.wordSpacing}save(){let t={fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign,partClipRect:this.partClipRect};this.Cf.push(t);let e=[];for(let i=0;i<this.Fe.length;i++)e.push(this.Fe[i]);this.Cf.push(e),this.Cf.push(this.$i.copy())}setTransform(t,e,i,s,n,o){t===1&&e===0&&i===0&&s===1&&n===0&&o===0||this.newGroup(t,e,i,s,n,o)}setCurrentTransform(t,e,i,s,n,o){this.$i.m=[t,e,i,s,n,o]}getCurrentTransform(){let t=this.$i.m;return"matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}scale(t,e){this.$i.scale(t,e)}translate(t,e){this.$i.translate(t,e)}transform(t,e,i,s,n,o){}commitTransform(){}stroke(){this.setStroke(this.pathAttributes)}strokeContext(){this.clipInsteadOfFill||this.stroke()}strokeRect(t,e,i,s){this.addRect("stroke",[t,e,i,s],this.$i)}makeElement(t,e,i){return this.surface.makeElement(t,e,i)}Ld(t,e,i){let s=this.makeElement(t,e,i);return this.currentElement!==null?this.currentElement.appendChild(s):this.currentElement=s,this.lastCreatedElement=s,s}processCommon(t,e,i){if(t==="fill"?this.setFill(e):t==="stroke"&&this.setStroke(e),i!==null){let s=i.m;e.transform="matrix("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+", "+s[4]+", "+s[5]+")"}}setFill(t){if(this.fillStyle instanceof li){t.fill=this.addGradient(this.fillStyle,"fill");return}if(/^rgba\(/.test(this.fillStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.fill="rgb("+e[1]+","+e[2]+","+e[3]+")",t["fill-opacity"]=e[4]}else t.fill=this.fillStyle}setFillOrStrokeInPlace(t,e){let i=e?"fill":"stroke";if(this.fillStyle instanceof li){t.setAttributeNS(null,"fill",this.addGradient(this.fillStyle,i));return}if(/^rgba\(/.test(this.fillStyle)){let s=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.setAttributeNS(null,i,"rgb("+s[1]+","+s[2]+","+s[3]+")"),t.setAttributeNS(null,i+"-opacity",s[4])}else t.setAttributeNS(null,i,this.fillStyle)}setStroke(t){if(this.strokeStyle instanceof li)t.stroke=this.addGradient(this.strokeStyle,"stroke");else if(/^rgba\(/.test(this.strokeStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.strokeStyle);t.stroke="rgb("+e[1]+","+e[2]+","+e[3]+")",t["stroke-opacity"]=e[4]}else t.stroke=this.strokeStyle;t["stroke-width"]=this.lineWidth,t["stroke-linecap"]=this.lineCap,t["stroke-linejoin"]=this.lineJoin,t["stroke-miterlimit"]=this.miterLimit,this.B1&&(t["stroke-dasharray"]=this.Ho.toString(),t["stroke-dashoffset"]=this.La)}addGradient(t,e){let i="",s=this.currentPath!==null?this.currentPath.getAttribute(e):null;if(s!==null&&s.indexOf("GRAD")!==-1){i=s.split("#")[1].slice(0,-1);let a=this.svg.getElementById(i);a!==null&&a.remove()}else i="GRAD"+V.Hw++;let n;if(t.type==="linear"){let a={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,id:i,gradientUnits:"userSpaceOnUse"};n=this.makeElement("linearGradient",a)}else if(t.type==="radial"){let a={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,r1:t.r1,r2:t.r2,id:i};n=this.makeElement("radialGradient",a)}else m.o("invalid gradient");let o=t.colors.sort((a,h)=>a.offset>h.offset?1:-1),r=o.length;for(let a=0;a<r;a++){let h=o[a],l=h.color;n.appendChild(this.makeElement("stop",{offset:h.offset,"stop-color":l}))}return this.svg.appendChild(n),"url(#"+i+")"}addRect(t,e,i){let s={x:e[0],y:e[1],width:e[2],height:e[3]};this.processCommon(t,s,i),this.Ld("rect",s)}addText(t,e,i){let s=this.textAlign;s==="left"?s="start":s==="right"?s="end":s==="center"&&(s="middle");let n={x:e[1],y:e[2],style:"font: "+this.font,"text-anchor":s};n["letter-spacing"]=this.letterSpacing,n["word-spacing"]=this.wordSpacing,this.processCommon(t,n,i),this.Ld("text",n,e[0])}xI(t,e,i){let s=this.bI(t),n=this.pathAttributes;if(n.clipPath){this.Lf.length>1&&this.Lf[this.Lf.length-2].setAttributeNS(null,"clip-path",'path("'+s+'") view-box');return}if(n.d=s,this.processCommon("",n,e),this.currentPath!==null){let o=this.currentPath;if(o.nodeName!=="g")for(let r in n)r!=="transform"&&o.setAttributeNS(null,r,n[r]);else{let r=o.getElementsByTagName("path");for(let a in n)a!=="transform"&&r[i].setAttributeNS(null,a,n[a])}}else this.Ld("path",n)}bI(t){let e=[];for(let i=0;i<t.length;i++){let s=t[i].slice(),n=[s.shift()];if(n[0]==="A")n.push(s.shift()+","+s.shift(),s.shift(),s.shift()+","+s.shift(),s.shift()+","+s.shift());else for(;s.length;)n.push(s.shift()+","+s.shift());e.push(n.join(" "))}return e.join(" ")}newGroup(t,e,i,s,n,o){let r=new Si;r.m=[t,e,i,s,n,o];let a={};this.processCommon("g",a,r);let h=this.Ld("g",a);return this.Lf.push(h),h}newGroup2(t){let e={};t&&(e.class=t);let i=this.Ld("g",e);return this.Lf.push(i),i}endGroup(){return this.Lf.pop()}dummyGroup(){return this.newGroup2(),this.endGroup()}shadowsSet(t,e,i){this.Mf=t,this.Nf=e,this.Ln=i}shadowsOff(){this.sl=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.sl=!0,this.shadowOffsetX=this.Mf,this.shadowOffsetY=this.Nf,this.shadowBlur=this.Ln}enableDash(t,e){this.B1=!0,this.Ho=t,this.La=e}disableDash(){this.B1=!1}clearContextCache(t){}setImageSmoothingEnabled(t){}rotate(t){this.$i.rotate(t*57.2958,0,0)}getImageData(t,e,i,s){return null}measureText(t){return null}removeOldGradient(t,e,i){let s=e.getAttribute(i);if(s===null)return;let n=s.split("#");if(n.length===1)return;let o=this.svg.getElementById(n[1].slice(0,-1));if(o!==null){let r=new RegExp(o.id,"g");this.svg.innerHTML.match(r).length===1&&o.remove()}}removePartFromView(t){t.svg!==null&&t.svg.parentNode===this.diagramGroup&&t.svg.remove()}}class Fe{bt;_t;Qr;dd;constructor(t,e,i,s){let n=e===void 0?K.document:e;this.Qr=n,this.dd=null;let o=n.createElement("canvas");o.tabIndex=0,this.bt=o,this._t=new ci(o,i,s),t&&Y.ji.set(o,t)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",!0):!1}toDataURL(t,e){return this.bt.toDataURL(t,e)}getBoundingClientRect(){return this.bt.getBoundingClientRect()}focus(){this.bt.focus()}get width(){return this.bt.width}set width(t){this.bt.width=t}get height(){return this.bt.height}set height(t){this.bt.height=t}dispose(){Y.ji.delete(this.bt),this.Qr=null}get style(){return this.bt.style}}class ci{F;z1;X1;G1;clipInsteadOfFill;Mf;Nf;Ln;zh;sl;Tr;constructor(t,e,i){t.getContext||m.o("Browser does not support HTML Canvas Element"),this.F=t.getContext("2d",e),this.z1="",this.X1="",this.G1="",this.clipInsteadOfFill=!1,this.Mf=0,this.Nf=0,this.Ln=0,this.sl=!1,this.zh=new Nt,this.Tr=!!i}createOrUpdateClipGroup(t,e){}setImageSmoothingEnabled(t){this.F.imageSmoothingEnabled=t}get fillStyle(){return this.F.fillStyle}set fillStyle(t){this.G1!==t&&(this.F.fillStyle=t,this.G1=t)}get font(){return this.F.font}set font(t){this.z1!==t&&(this.F.font=t,this.z1=t)}get globalAlpha(){return this.F.globalAlpha}set globalAlpha(t){this.F.globalAlpha=t}get lineCap(){return this.F.lineCap}set lineCap(t){this.F.lineCap=t}get lineDashOffset(){return this.F.lineDashOffset}set lineDashOffset(t){this.F.lineDashOffset=t}get lineJoin(){return this.F.lineJoin}set lineJoin(t){this.F.lineJoin=t}get lineWidth(){return this.F.lineWidth}set lineWidth(t){this.F.lineWidth=t}get miterLimit(){return this.F.miterLimit}set miterLimit(t){this.F.miterLimit=t}get shadowBlur(){return this.F.shadowBlur}set shadowBlur(t){this.F.shadowBlur=t}get shadowColor(){return this.F.shadowColor}set shadowColor(t){this.F.shadowColor=t}get shadowOffsetX(){return this.F.shadowOffsetX}set shadowOffsetX(t){this.F.shadowOffsetX=t}get shadowOffsetY(){return this.F.shadowOffsetY}set shadowOffsetY(t){this.F.shadowOffsetY=t}get strokeStyle(){return this.F.strokeStyle}set strokeStyle(t){this.X1!==t&&(this.F.strokeStyle=t,this.X1=t)}get textAlign(){return this.F.textAlign}set textAlign(t){this.F.textAlign=t}get imageSmoothingEnabled(){return this.F.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.F.imageSmoothingEnabled=t}get filter(){return this.F.filter}set filter(t){t===""?this.F.filter="none":this.F.filter=t}get letterSpacing(){return this.F.letterSpacing}set letterSpacing(t){this.F.letterSpacing=t}get wordSpacing(){return this.F.wordSpacing}set wordSpacing(t){this.F.wordSpacing=t}arc(t,e,i,s,n,o,r,a){this.F.arc(t,e,i,s,n,o)}beginPath(){this.F.beginPath()}endPath(){}bezierCurveTo(t,e,i,s,n,o){this.F.bezierCurveTo(t,e,i,s,n,o)}clearRect(t,e,i,s){this.commitTransform(),this.F.clearRect(t,e,i,s)}clip(t){t?this.F.clip(t):this.F.clip()}closePath(){this.F.closePath()}createLinearGradient(t,e,i,s){return this.F.createLinearGradient(t,e,i,s)}createPattern(t,e){return this.F.createPattern(t,e)}createRadialGradient(t,e,i,s,n,o){return this.F.createRadialGradient(t,e,i,s,n,o)}drawImage(t,e,i,s,n,o,r,a,h){s===void 0?this.F.drawImage(t,e,i):this.F.drawImage(t,e,i,s,n,o,r,a,h)}fill(t,e){e?this.F.fill(e,t?"evenodd":"nonzero"):this.F.fill(t?"evenodd":"nonzero")}fillRect(t,e,i,s){this.F.fillRect(t,e,i,s)}fillBackground(t,e,i,s){this.F.fillRect(t,e,i,s)}fillText(t,e,i){this.F.fillText(t,e,i)}getImageData(t,e,i,s){return this.F.getImageData(t,e,i,s)}lineTo(t,e){this.F.lineTo(t,e)}measureText(t){return this.F.measureText(t)}moveTo(t,e){this.F.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.F.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.F.rect(t,e,i,s)}restore(){this.F.restore()}save(){this.commitTransform(),this.F.save()}rotate(t){this.zh.ks(t*57.2958,0,0)}setTransform(t,e,i,s,n,o){this.zh.setTo(t,e,i,s,n,o)}scale(t,e){this.zh.et(t,e)}translate(t,e){this.zh.Xs(t,e)}stroke(t){t?this.F.stroke(t):this.F.stroke()}transform(t,e,i,s,n,o){if(t===1&&e===0&&i===0&&s===1&&n===0&&o===0)return;let r=this.zh,a=r.m11*t+r.m21*e,h=r.m12*t+r.m22*e,l=r.m11*i+r.m21*s,u=r.m12*i+r.m22*s;r.dx=r.m11*n+r.m21*o+r.dx,r.dy=r.m12*n+r.m22*o+r.dy,r.m11=a,r.m12=h,r.m21=l,r.m22=u}commitTransform(){let t=this.zh;this.F.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy)}fillContext(t,e,i){this.radialFill(t,e,i)||this.fillOrClip(e,i)}radialFill(t,e,i){if(!(t instanceof R)||t.type!==3)return!1;let s=t.bf,n=t.I1;return n>s?(this.scale(s/n,1),this.translate((n-s)/2,0)):s>n&&(this.scale(1,n/s),this.translate(0,(s-n)/2)),this.fillOrClip(e,i),n>s?(this.translate(-(n-s)/2,0),this.scale(1/(s/n),1)):s>n&&(this.translate(0,-(s-n)/2),this.scale(1,1/(n/s))),!0}strokeContext(){this.clipInsteadOfFill||this.stroke()}fillOrClip(t,e){this.clipInsteadOfFill?this.clip(e):this.fill(t,e)}shadowsSet(t,e,i){this.Mf=t,this.Nf=e,this.Ln=i}shadowsOff(){this.sl=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.sl=!0,this.shadowOffsetX=this.Mf,this.shadowOffsetY=this.Nf,this.shadowBlur=this.Ln}enableDash(t,e){let i=this.F;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=e)}disableDash(){let t=this.F;t.setLineDash!==void 0&&(t.setLineDash(ci.EmptyArray),t.lineDashOffset=0)}clearContextCache(t){t&&(this.z1=""),this.X1="",this.G1=""}removePartFromView(t){}static EmptyArray=Object.freeze([])}var Oe=(x=>(x[x.Solid=1]="Solid",x[x.Linear=2]="Linear",x[x.Radial=3]="Radial",x[x.Pattern=4]="Pattern",x))(Oe||{}),Ys=(x=>(x[x.Lab=1]="Lab",x[x.HSL=2]="HSL",x[x.Oklch=3]="Oklch",x))(Ys||{});class _e{n0;n1;n2;n3;constructor(){this.n0=0,this.n1=0,this.n2=0,this.n3=0}}class R{u;W;Xh;ae;Cs;w0;x0;qo;b0;Nn;bf;I1;constructor(t,e){if(V.Je(this),this.u=!1,t===void 0)this.W=1,this.Xh="black";else if(typeof t=="string"){let s=m.$a(Oe,t);s!==null?(this.W=s,this.Xh="black"):(this.W=1,this.Xh=t)}else Object.keys(Oe).hasOwnProperty(t)?(this.W=t,this.Xh="black"):typeof t=="object"&&(this.W=1,e=t);let i=this.W;if(i===2?(this.ae=T.TopCenter,this.Cs=T.BottomCenter):i===3?(this.ae=T.Center,this.Cs=T.Center):(this.ae=T.None,this.Cs=T.None),this.w0=0,this.x0=NaN,this.qo=null,this.b0=null,this.Nn=null,this.bf=0,this.I1=0,e){let s={};for(let n in e)isFinite(parseFloat(n))?this.addColorStop(parseFloat(n),e[n]):s[n]=e[n];Object.assign(this,s)}}copy(){let t=new R;return t.W=this.W,t.Xh=this.Xh,t.ae=this.ae.N(),t.Cs=this.Cs.N(),t.w0=this.w0,t.x0=this.x0,this.qo!==null&&(t.qo=this.qo.copy()),t.b0=this.b0,t}k(){return this.u=!0,this.qo!==null&&this.qo.k(),this}fe(t){t in Oe?this.type=t:m.cr(this,t)}toString(){let t="Brush(";if(this.type===1)t+=this.color;else if(this.type===2?t+="Linear ":this.type===3?t+="Radial ":this.type===4?t+="Pattern ":t+="(unknown) ",t+=this.start+" "+this.end,this.colorStops!==null){let e=this.colorStops.iterator;for(;e.next();){let i=e.key,s=e.value;t+=" "+i+":"+s}}return t+=")",t}addColorStop(t,e){return this.u&&m.L(this),(typeof t!="number"||!isFinite(t)||t>1||t<0)&&m.J(t,"0 <= loc <= 1",R,"addColorStop:loc"),m.s(e,"string",R,"addColorStop:color"),this.qo===null&&(this.qo=new Mt),this.qo.set(t,e),this.W===1&&(this.type=2),this.Nn=null,this}get type(){return this.W}set type(t){this.u&&m.L(this,t),this.W=t,this.start.isNoSpot()&&(t===2?this.start=T.TopCenter:t===3&&(this.start=T.Center)),this.end.isNoSpot()&&(t===2?this.end=T.BottomCenter:t===3&&(this.end=T.Center)),this.Nn=null}get color(){return this.Xh}set color(t){this.u&&m.L(this,t),this.Xh=t,this.Nn=null}get start(){return this.ae}set start(t){this.u&&m.L(this,t),this.ae=t.N(),this.Nn=null}get end(){return this.Cs}set end(t){this.u&&m.L(this,t),this.Cs=t.N(),this.Nn=null}get startRadius(){return this.w0}set startRadius(t){this.u&&m.L(this,t),t<0&&m.J(t,">= zero",R,"startRadius"),this.w0=t,this.Nn=null}get endRadius(){return this.x0}set endRadius(t){this.u&&m.L(this,t),t<0&&m.J(t,">= zero",R,"endRadius"),this.x0=t,this.Nn=null}get colorStops(){return this.qo}set colorStops(t){this.u&&m.L(this,t),this.qo=t,this.Nn=null}get pattern(){return this.b0}set pattern(t){this.u&&m.L(this,t),this.b0=t,this.Nn=null}static randomColor(t,e){t===void 0&&(t=128),e===void 0&&(e=Math.max(t,255));let i=Math.abs(e-t),s=Math.floor(t+Math.random()*i).toString(16),n=Math.floor(t+Math.random()*i).toString(16),o=Math.floor(t+Math.random()*i).toString(16);return s.length<2&&(s="0"+s),n.length<2&&(n="0"+n),o.length<2&&(o="0"+o),"#"+s+n+o}static isValidColor(t){return K.CSS?K.CSS.supports("color",t):!0}static lighten(t){return R.lightenBy(t)}lightenBy(t,e){this.u&&m.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)R.Oo(this.color),this.color=R.Ad(i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)R.Oo(n.value),this.addColorStop(n.key,R.Ad(i,s))}return this}static lightenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return R.Oo(t),R.Ad(s,n)}static darken(t){return R.darkenBy(t)}darkenBy(t,e){this.u&&m.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)R.Oo(this.color),this.color=R.Ad(-i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)R.Oo(n.value),this.addColorStop(n.key,R.Ad(-i,s))}return this}static darkenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return R.Oo(t),R.Ad(-s,n)}static mix(t,e,i){R.Oo(t);let s=R.Y.n0,n=R.Y.n1,o=R.Y.n2,r=R.Y.n3;R.Oo(e),i===void 0&&(i=.5);let a=Math.round((R.Y.n0-s)*i+s),h=Math.round((R.Y.n1-n)*i+n),l=Math.round((R.Y.n2-o)*i+o),u=Math.round((R.Y.n3-r)*i+r);return`rgba(${a}, ${h}, ${l}, ${u})`}isDark(){if(this.type===1)return R.isDark(this.color);if((this.type===2||this.type===3)&&this.colorStops!==null){let t=this.colorStops;if(this.type===3){let a=t.first();return a?R.isDark(a.value):!1}if(t.get(.5)!==null)return R.isDark(t.get(.5));if(t.count===2){let a=t.toArray();return R.isDark(R.mix(a[0].value,a[1].value))}let e=t.iterator,i=-1,s=-1,n=1,o=1;for(;e.next();){let a=e.key,h=Math.abs(.5-e.key);n>o&&h<n?(i=a,n=h):o>=n&&h<o&&(s=a,o=h)}if(i>s){let a=i;i=s,s=a,a=n,n=o,o=a}let r=s-i;return R.isDark(R.mix(t.get(i),t.get(s),1-o/r))}return!1}static isDark(t){return t?t instanceof R?t.isDark():(R.Oo(t),(299*R.Y.n0+587*R.Y.n1+114*R.Y.n2)/1e3<128):!1}static Ad(t,e){switch(e){case 1:return R.kI(),R.lo.n0=Math.min(100,Math.max(0,R.lo.n0+100*t)),R.SI(),"rgba("+R.Y.n0+", "+R.Y.n1+", "+R.Y.n2+", "+R.Y.n3+")";case 2:return R.RM(),R.ze.n2=Math.min(100,Math.max(0,R.ze.n2+100*t)),"hsla("+R.ze.n0+", "+R.ze.n1+"%, "+R.ze.n2+"%, "+R.ze.n3+")";case 3:return R.MI(),R.ao.n0=Math.min(100,Math.max(0,R.ao.n0+100*t)),R.NI(),"rgba("+R.Y.n0+", "+R.Y.n1+", "+R.Y.n2+", "+R.Y.n3+")";default:m.o("Unknown color space: "+e)}}static Oo(t){R.k0===!1&&(R.k0=!0,R.us=Y.isUsingDOM()?new Fe(null,void 0,{willReadFrequently:!0})._t:null);let e=R.us;if(e===null)return;e.clearRect(0,0,1,1),e.fillStyle="#000000";let i=e.fillStyle;if(e.fillStyle=t,e.fillStyle!==i){e.fillRect(0,0,1,1);let s=e.getImageData(0,0,1,1).data;R.Y.n0=s[0],R.Y.n1=s[1],R.Y.n2=s[2],R.Y.n3=s[3]/255}else{e.fillStyle="#FFFFFF";let s=e.fillStyle;e.fillStyle=t,e.fillStyle,R.Y.n0=0,R.Y.n1=0,R.Y.n2=0,R.Y.n3=1}}static RM(){let t=R.Y.n0/255,e=R.Y.n1/255,i=R.Y.n2/255,s=Math.max(t,e,i),n=Math.min(t,e,i),o=s-n,r,a,h=(s+n)/2;if(o===0)r=a=0;else{switch(s){case t:r=(e-i)/o%6;break;case e:r=(i-t)/o+2;break;case i:r=(t-e)/o+4;break;default:r=0;break}r*=60,r<0&&(r+=360),a=o/(1-Math.abs(2*h-1))}R.ze.n0=Math.round(r),R.ze.n1=Math.round(a*100),R.ze.n2=Math.round(h*100),R.ze.n3=R.Y.n3}static UU(){let t=R.ze.n0,e=R.ze.n1/100,i=R.ze.n2/100,s,n,o,r=(1-Math.abs(2*i-1))*e,a=t/60,h=r*(1-Math.abs(a%2-1));a>=0&&a<1?(s=r,n=h,o=0):a>=1&&a<2?(s=h,n=r,o=0):a>=2&&a<3?(s=0,n=r,o=h):a>=3&&a<4?(s=0,n=h,o=r):a>=4&&a<5?(s=h,n=0,o=r):(s=r,n=0,o=h);let l=i-.5*r;s+=l,n+=l,o+=l,R.Y.n0=Math.round(s*255),R.Y.n1=Math.round(n*255),R.Y.n2=Math.round(o*255),R.Y.n3=R.ze.n3}static kI(){R.rD(),R.CI()}static SI(){R.LI(),R.lD()}static EN(t){return t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}static UN(t){return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}static rD(){let t=R.EN(R.Y.n0),e=R.EN(R.Y.n1),i=R.EN(R.Y.n2);R.At.n0=.4124564*t+.3575761*e+.1804375*i,R.At.n1=.2126729*t+.7151522*e+.072175*i,R.At.n2=.0193339*t+.119192*e+.9503041*i,R.At.n3=R.Y.n3}static lD(){let t=3.2404542*R.At.n0+-1.5371385*R.At.n1+-.4985314*R.At.n2,e=-.969266*R.At.n0+1.8760108*R.At.n1+.041556*R.At.n2,i=.0556434*R.At.n0+-.2040259*R.At.n1+1.0572252*R.At.n2;R.Y.n0=R.UN(t)*255,R.Y.n1=R.UN(e)*255,R.Y.n2=R.UN(i)*255,R.Y.n3=R.At.n3,R.Y.n0=Math.round(R.Y.n0),R.Y.n0>255?R.Y.n0=255:R.Y.n0<0&&(R.Y.n0=0),R.Y.n1=Math.round(R.Y.n1),R.Y.n1>255?R.Y.n1=255:R.Y.n1<0&&(R.Y.n1=0),R.Y.n2=Math.round(R.Y.n2),R.Y.n2>255?R.Y.n2=255:R.Y.n2<0&&(R.Y.n2=0)}static VN=216/24389;static Y1=24389/27;static Td=[95.047,100,108.883];static BN(t){return t>R.VN?Math.pow(t,1/3):(R.Y1*t+16)/116}static CI(){let t=R.BN(R.At.n0*100/R.Td[0]),e=R.BN(R.At.n1*100/R.Td[1]),i=R.BN(R.At.n2*100/R.Td[2]);R.lo.n0=116*e-16,R.lo.n1=500*(t-e),R.lo.n2=200*(e-i),R.lo.n3=R.At.n3}static aD(t){let e=t*t*t;return e>R.VN?e:(116*t-16)/R.Y1}static LI(){let t=(R.lo.n0+16)/116,e=R.lo.n1/500+t,i=t-R.lo.n2/200;R.At.n0=R.Td[0]/100*R.aD(e),R.At.n1=R.Td[1]/100*(R.lo.n0>R.Y1*R.VN?Math.pow(t,3):R.lo.n0/R.Y1),R.At.n2=R.Td[2]/100*R.aD(i),R.At.n3=R.lo.n3}static AI(){let t=.8190224*R.At.n0+.3619062*R.At.n1+-.1288737*R.At.n2,e=.03298366*R.At.n0+.9292868*R.At.n1+.03614466*R.At.n2,i=.04817719*R.At.n0+.2642395*R.At.n1+.6335478*R.At.n2;t=Math.cbrt(t),e=Math.cbrt(e),i=Math.cbrt(i),R.ge.n0=.2104542*t+.7936177*e+-.004072046*i,R.ge.n1=1.977998*t+-2.428592*e+.4505937*i,R.ge.n2=.02590403*t+.7827717*e+-.8086757*i,R.ge.n3=R.At.n3,R.ge.n0*=100}static TI(){R.ge.n0/=100;let t=.9999999*R.ge.n0+.3963377*R.ge.n1+.2158037*R.ge.n2,e=1.000000009*R.ge.n0+-.1055613*R.ge.n1+-.06385417*R.ge.n2,i=1.00000005*R.ge.n0+-.08948418*R.ge.n1+-1.291485*R.ge.n2;t=t**3,e=e**3,i=i**3,R.At.n0=1.2268798*t+-.5578149*e+.281391*i,R.At.n1=-.04057576*t+1.112286*e+-.07171106*i,R.At.n2=-.07637294*t+-.4214933*e+1.586924*i,R.At.n3=R.ge.n3}static DI(){let t=Math.atan2(R.ge.n2,R.ge.n1)*180/Math.PI;R.ao.n0=R.ge.n0,R.ao.n1=Math.sqrt(R.ge.n1**2+R.ge.n2**2),R.ao.n2=t>=0?t:t+360,R.ao.n3=R.ge.n3}static vI(){R.ge.n0=R.ao.n0,R.ge.n1=R.ao.n1*Math.cos(R.ao.n2*Math.PI/180),R.ge.n2=R.ao.n1*Math.sin(R.ao.n2*Math.PI/180),R.ge.n3=R.ao.n3}static MI(){R.rD(),R.AI(),R.DI()}static NI(){R.vI(),R.TI(),R.lD()}static Nd(t,e){typeof t=="string"||t instanceof R||m.o("Value for "+e+" must be a color string or a Brush, not "+t)}static Solid=1;static Linear=2;static Radial=3;static Pattern=4;static Lab=1;static HSL=2;static us=null;static k0=!1;static Y=new _e;static ze=new _e;static At=new _e;static lo=new _e;static ge=new _e;static ao=new _e}class Lt{Pt="Base";static fs=new Mt;static An(t,e){e.name=t,Lt.fs.set(t,e)}get name(){return this.Pt}set name(t){this.Pt=t}constructor(){}get classType(){return G}measure(t,e,i,s,n,o,r){}measureElement(t,e,i,s,n){t.ht(e,i,s,n)}arrange(t,e,i){}arrangeElement(t,e,i,s,n,o){t.Ut(e,i,s,n,o)}remeasureObject(t){t.kf()}Ge(t,e,i){}}class In extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=t.jo();for(let l=0;l<a;l++){let u=s[l];if(!u.visible&&u!==h)continue;let c=u.margin,d=c.right+c.left,f=c.top+c.bottom;u.ht(e,i,o,r);let p=u.measuredBounds,g=Math.max(p.width+d,0),y=Math.max(p.height+f,0),b=u.position.x,v=u.position.y;if(isFinite(b)||(b=0),isFinite(v)||(v=0),u instanceof et&&u.isGeometryPositioned){let w=u.strokeWidth/2;b-=w,v-=w}n.re(b,v,g,y)}}arrange(t,e,i){let s=e.length,n=t.padding,o=i.x-n.left,r=i.y-n.top;for(let a=0;a<s;a++){let h=e[a],l=h.measuredBounds,u=h.margin,c=h.position.x,d=h.position.y,f=isNaN(c)?-o:c-o,p=isNaN(d)?-r:d-r;if(h instanceof et&&h.isGeometryPositioned){let g=h.strokeWidth/2;f-=g,p-=g}h.visible&&h.Ut(f+u.left,p+u.top,l.width,l.height)}}}Lt.An("Position",new In);class Bn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=m.st(),l=t.jo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let f=d.Zs(!1);if(f!==0&&f!==5){h.push(d);continue}d.ht(1/0,i,0,r);let p=d.margin,g=d.measuredBounds,y=Math.max(g.width+p.right+p.left,0),b=Math.max(g.height+p.top+p.bottom,0);n.Yn(n.width+y,Math.max(n.height,b))}let u=h.length;t.desiredSize.height?i=Math.min(t.desiredSize.height,t.maxSize.height):n.height!==0&&(i=Math.min(n.height,t.maxSize.height));for(let c=0;c<u;c++){let d=h[c];if(!d.visible&&d!==l)continue;let f=d.margin,p=f.right+f.left,g=f.top+f.bottom;d.ht(1/0,i,0,r);let y=d.measuredBounds,b=Math.max(y.width+p,0),v=Math.max(y.height+g,0);n.width+=b,n.height=Math.max(n.height,v)}m.Z(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.top,r=t.isOpposite,a=r?i.width:n.left;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,f=d.top+d.bottom,p=o+n.bottom,g=c.height,y=u.Zs(!1);(isNaN(u.desiredSize.height)&&y===2||y===4)&&(g=Math.max(i.height-f-p,0));let b=g+f+p,v=u.alignment;v.isDefault()&&(v=t.defaultAlignment),v.isSpot()||(v=T.Center),r&&(a-=c.width+d.left+d.right),u.Ut(a+v.offsetX+d.left,l+v.offsetY+d.top+(i.height*v.y-b*v.y),c.width,g),r||(a+=c.width+d.left+d.right)}}}Lt.An("Horizontal",new Bn);class Vn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=m.st(),l=t.jo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let f=d.Zs(!1);if(f!==0&&f!==4){h.push(d);continue}d.ht(e,1/0,o,0);let p=d.margin,g=d.measuredBounds,y=Math.max(g.width+p.right+p.left,0),b=Math.max(g.height+p.top+p.bottom,0);n.Yn(Math.max(n.width,y),n.height+b)}let u=h.length;t.desiredSize.width?e=Math.min(t.desiredSize.width,t.maxSize.width):n.width!==0&&(e=Math.min(n.width,t.maxSize.width));for(let c=0;c<u;c++){let d=h[c];if(!d.visible&&d!==l)continue;let f=d.margin,p=f.right+f.left,g=f.top+f.bottom;d.ht(e,1/0,o,0);let y=d.measuredBounds,b=Math.max(y.width+p,0),v=Math.max(y.height+g,0);n.width=Math.max(n.width,b),n.height+=v}m.Z(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=t.isOpposite,a=r?i.height:n.top;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,f=d.left+d.right,p=o+n.right,g=c.width,y=u.Zs(!1);(isNaN(u.desiredSize.width)&&y===2||y===5)&&(g=Math.max(i.width-f-p,0));let b=g+f+p,v=u.alignment;v.isDefault()&&(v=t.defaultAlignment),v.isSpot()||(v=T.Center),r&&(a-=c.height+d.bottom+d.top),u.Ut(l+v.offsetX+d.left+(i.width*v.x-b*v.x),a+v.offsetY+d.top,g,c.height),r||(a+=c.height+d.bottom+d.top)}}}Lt.An("Vertical",new Vn);class Mi extends Lt{constructor(){super()}static hD=!1;measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,u=0,c=0,d=l.right+l.left,f=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,g=p.width,y=p.height,b=Math.max(g+d,0),v=Math.max(y+f,0),w=t.isClipping;w&&h.Yp()!==0&&!Mi.hD&&(Mi.hD=!0,m.ne("Main Shape for Spot Panel with isClipping = true must have a zero strokeWidth: "+t.toString()));let k=I.z(-l.left,-l.top,b,v),S=I.z(0,0,g,y);this.zN(h,S,!0),g=S.width,y=S.height;let N=!0,D=t.jo(),L;for(let M=0;M<a;M++){let A=s[M],F=e,O=i;if(A===h||!A.visible&&A!==D)continue;l=A.margin;let E=l.left,B=l.top;switch(u=l.right+l.left,c=l.top+l.bottom,L=A.Zs(!1),L){case 2:F=g,O=y,u=0,c=0,E=0,B=0;break;case 5:F=g,u=0,E=0;break;case 4:O=y,c=0,B=0;break}A.ht(F,O,0,0),p=A.measuredBounds,b=Math.max(p.width+u,0),v=Math.max(p.height+c,0);let X=A.alignment;X.isDefault()&&(X=t.defaultAlignment),X.isSpot()||(X=T.Center);let z=A.alignmentFocus;z.isDefault()&&(z=T.Center);let U=null;A instanceof G&&A.ho!==""&&(U=A.findObject(A.ho),U===A&&(U=null));let tt=S.x-E,nt=S.y-B;if(U!==null){A.Ut(0,0,p.width,p.height);let Z=U.actualBounds,it=P.z(Z.x+(z.x*Z.width-z.offsetX),Z.y+(z.y*Z.height-z.offsetY));for(U=U.panel;U!==null&&U!==A;)U.v.gt(it),U=U.panel;tt+=X.x*g+X.offsetX-it.x,nt+=X.y*y+X.offsetY-it.y,P.i(it)}else tt+=X.x*g+X.offsetX-(z.x*p.width+z.offsetX),nt+=X.y*y+X.offsetY-(z.y*p.height+z.offsetY);N?(N=!1,n.e(tt,nt,b,v)):n.re(tt,nt,b,v)}switch(N?n.h(k):w?n.intersect(S.x,S.y,S.width,S.height):n.re(k.x,k.y,k.width,k.height),I.i(k),I.i(S),L=h.stretch,L===1&&(L=h.Zs(!1)),L){case 0:return;case 2:if(!isFinite(e)&&!isFinite(i))return;break;case 5:if(!isFinite(e))return;break;case 4:if(!isFinite(i))return;break}p=h.measuredBounds,g=p.width,y=p.height,b=Math.max(g+d,0),v=Math.max(y+f,0),l=h.margin,S=I.z(-l.left,-l.top,b,v),this.zN(h,S,!0),g=S.width,y=S.height;for(let M=0;M<a;M++){let A=s[M];if(A===h||!A.visible&&A!==D)continue;l=A.margin,u=l.right+l.left,c=l.top+l.bottom,p=A.measuredBounds,b=Math.max(p.width+u,0),v=Math.max(p.height+c,0);let F=A.alignment;F.isDefault()&&(F=t.defaultAlignment),F.isSpot()||(F=T.Center);let O=A.alignmentFocus;O.isDefault()&&(O=T.Center),N?(N=!1,n.e(F.x*g+F.offsetX-(O.x*p.width+O.offsetX)-l.left,F.y*y+F.offsetY-(O.y*p.height+O.offsetY)-l.top,b,v)):n.re(F.x*g+F.offsetX-(O.x*p.width+O.offsetX)-l.left,F.y*y+F.offsetY-(O.y*p.height+O.offsetY)-l.top,b,v)}N?n.h(k):w?n.intersect(S.x,S.y,S.width,S.height):n.re(k.x,k.y,k.width,k.height),I.i(S)}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=o.width,a=o.height,h=t.padding,l=h.left,u=h.top,c=l-i.x,d=u-i.y;n.Ut(c,d,r,a);let f=I.z(0,0,r,a);this.zN(n,f,!1);for(let p=0;p<s;p++){let g=e[p];if(g===n)continue;let y=g.measuredBounds,b=y.width,v=y.height,w=g.alignment;w.isDefault()&&(w=t.defaultAlignment),w.isSpot()||(w=T.Center);let k=g.alignmentFocus;k.isDefault()&&(k=T.Center);let S=null;if(g instanceof G&&g.ho!==""&&(S=g.findObject(g.ho),S===g&&(S=null)),S!==null){let N=S.actualBounds,D=P.z(N.x+(k.x*N.width-k.offsetX),N.y+(k.y*N.height-k.offsetY));for(S=S.panel;S!==null&&S!==g;)S.v.gt(D),S=S.panel;c=w.x*f.width+w.offsetX-D.x,d=w.y*f.height+w.offsetY-D.y,P.i(D)}else c=w.x*f.width+w.offsetX-(k.x*b+k.offsetX),d=w.y*f.height+w.offsetY-(k.y*v+k.offsetY);c+=f.x-i.x,d+=f.y-i.y,g.visible&&g.Ut(l+c,u+d,b,v)}I.i(f)}zN(t,e,i){let s=null;if(t instanceof G&&t.ho!==""&&(s=t.findObject(t.ho),s===t&&(s=null)),s!==null)for(i&&t.Ut(0,0,e.width,e.height),e.h(s.actualBounds),s=s.panel;s!==null&&s!==t;)s.v.im(e),s=s.panel}}Lt.An("Spot",new Mi);class zn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,u=e,c=i,d=l.right+l.left,f=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,g=0,y=null;h instanceof et&&(y=h,g=y.strokeWidth*y.scale);let b=Math.max(p.width+d,0),v=Math.max(p.height+f,0),w=t.XN(h),k=w.x*b+w.offsetX,S=w.y*v+w.offsetY,N=t.GN(h),D=N.x*b+N.offsetX,L=N.y*v+N.offsetY;isFinite(e)&&(u=Math.max(Math.abs(k-D)-g,0)),isFinite(i)&&(c=Math.max(Math.abs(S-L)-g,0));let M=0,A=0;o>0&&(M=Math.max(Math.abs(w.x*o+w.offsetX-(N.x*o+N.offsetX))-g,0)),r>0&&(A=Math.max(Math.abs(w.y*r+w.offsetY-(N.y*r+N.offsetY))-g,0));let F=st.l();F.e(0,0);let O=t.jo();for(let z=0;z<a;z++){let U=s[z];if(U===h||!U.visible&&U!==O)continue;l=U.margin;let tt=l.right+l.left,nt=l.top+l.bottom;U.ht(u,c,M,A),p=U.measuredBounds,b=Math.max(p.width+tt,0),v=Math.max(p.height+nt,0),F.e(Math.max(b,F.width),Math.max(v,F.height))}if(a===1){p=h.measuredBounds,n.width=b,n.height=v,st.i(F);return}w=t.XN(h),N=t.GN(h);let E=0,B=0;N.x!==w.x&&N.y!==w.y&&(E=F.width/Math.abs(N.x-w.x),B=F.height/Math.abs(N.y-w.y)),st.i(F),g=0,y!==null&&(g=y.strokeWidth*y.scale,y.QS()===6&&(E=B=Math.max(E,B))),E+=Math.abs(w.offsetX)+Math.abs(N.offsetX)+g,B+=Math.abs(w.offsetY)+Math.abs(N.offsetY)+g;let X=h.stretch;switch(X===1&&(X=h.Zs(!1)),X){case 0:o=0,r=0;break;case 2:isFinite(e)&&(E=e),isFinite(i)&&(B=i);break;case 5:isFinite(e)&&(E=e),r=0;break;case 4:o=0,isFinite(i)&&(B=i);break}h.kf(),h.ht(E,B,o,r),n.width=h.measuredBounds.width+d,n.height=h.measuredBounds.height+f}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=I.l();r.e(0,0,1,1);let a=n.margin,h=a.left,l=a.top,u=t.padding,c=u.left,d=u.top,f=h,p=l,g=o.width,y=o.height;n.Ut(c+f,d+p,g,y);let b=t.XN(n),v=t.GN(n),w=0+b.x*o.width+b.offsetX,k=0+b.y*o.height+b.offsetY,S=0+v.x*o.width+v.offsetX,N=0+v.y*o.height+v.offsetY;r.x=w,r.y=k,r.re(S,N,0,0),r.x+=h+c,r.y+=l+d;for(let D=0;D<s;D++){let L=e[D];if(L===n)continue;let M=L.measuredBounds;a=L.margin;let A=Math.max(M.width+a.right+a.left,0),F=Math.max(M.height+a.top+a.bottom,0),O=L.alignment;O.isDefault()&&(O=t.defaultAlignment),O.isSpot()||(O=T.Center),f=r.width*O.x+O.offsetX-A*O.x+a.left+r.x,p=r.height*O.y+O.offsetY-F*O.y+a.top+r.y,g=r.width,y=r.height,L.visible&&(I.contains(r.x,r.y,r.width,r.height,f,p,M.width,M.height)?L.Ut(f,p,M.width,M.height):L.Ut(f,p,M.width,M.height,new I(r.x,r.y,r.width,r.height)))}I.i(r)}}Lt.An("Auto",new zn);class Xn extends Lt{constructor(){super(),this.name="Table"}measure(t,e,i,s,n,o,r){let a=s.length,h=m.st(),l=m.st();for(let ot=0;ot<a;ot++){let W=s[ot],ft=W instanceof G?W:null;if(ft!==null&&ft.il()&&W.visible){l.push(ft);let At=ft.D.r,Ht=At.length;for(let Ut=0;Ut<Ht;Ut++){let Gt=At[Ut];ft.type===G.TableRow?Gt.row=W.row:ft.type===G.TableColumn&&(Gt.column=W.column),h.push(Gt)}}else h.push(W)}a=h.length,a===0&&(t.getRowDefinition(0),t.getColumnDefinition(0));let u=[];for(let ot=0;ot<a;ot++){let W=h[ot];W.visible&&(W.xi(!0),W.oo(!0),u[W.row]||(u[W.row]=[]),u[W.row][W.column]||(u[W.row][W.column]=[]),u[W.row][W.column].push(W))}m.Z(h);let c=m.st(),d=m.st(),f=m.st(),p={count:0},g={count:0},y=e,b=i,v=t.Zi,w=t.Qi,k;a=v.length;for(let ot=0;ot<a;ot++)k=v[ot],k!==void 0&&(k.actual=0,k.Re=0);a=w.length;for(let ot=0;ot<a;ot++)k=w[ot],k!==void 0&&(k.actual=0,k.Re=0);let S=u.length,N=0;for(let ot=0;ot<S;ot++)u[ot]&&(N=Math.max(N,u[ot].length));let D=Math.min(t.topIndex,S-1),L=Math.min(t.leftIndex,N-1),M=0,A;S=u.length;let F=t.jo();for(let ot=0;ot<S;ot++){if(!u[ot])continue;N=u[ot].length;let W=t.getRowDefinition(ot);W.actual=0,W.Re=0;for(let ft=0;ft<N;ft++){if(!u[ot][ft])continue;let At=t.getColumnDefinition(ft);c[ft]===void 0&&(At.actual=0,At.Re=0,c[ft]=!0);let Ht=u[ot][ft],Ut=Ht.length;for(let Gt=0;Gt<Ut;Gt++){let qt=Ht[Gt];if(!qt.visible&&qt!==F)continue;let we=qt.rowSpan>1,ue=qt.columnSpan>1;(we||ue)&&!(ot<D)&&!(ft<L)&&d.push(qt);let de=qt.margin,Wt=de.right+de.left,Zt=de.top+de.bottom;A=qt.Jp(W,At,!1);let me=qt.desiredSize,Ft=!isNaN(me.width),Me=!isNaN(me.height);if(A!==0&&!(Ft&&Me)&&!(ot<D)&&!(ft<L)&&(!ue&&p[ft]===void 0&&(A===2||A===5)&&(p[ft]=-1,p.count++),!we&&g[ot]===void 0&&(A===2||A===4)&&(g[ot]=-1,g.count++),!we&&!ue&&f.push(qt)),qt.ht(1/0,1/0,0,0),ot<D||ft<L)continue;let se=qt.measuredBounds,ve=Math.max(se.width+Wt,0),Te=Math.max(se.height+Zt,0);if(qt.rowSpan===1&&(A===0||A===5)){k=t.getRowDefinition(ot);let ke=k.computeEffectiveSpacing(),mi=k.q===0;M=Math.max(Te-k.actual,0),M+(mi?ke:0)>b&&(M=Math.max(b-ke,0)),k.Re=k.Re+M,k.actual=k.q+M,b=Math.max(b-(M+(mi?ke:0)),0)}if(qt.columnSpan===1&&(A===0||A===4)){k=t.getColumnDefinition(ft);let ke=k.computeEffectiveSpacing(),mi=k.q===0;M=Math.max(ve-k.actual,0),M+(mi?ke:0)>y&&(M=Math.max(y-ke,0)),k.Re=k.Re+M,k.actual=k.q+M,y=Math.max(y-(M+(mi?ke:0)),0)}(we||ue)&&qt.kf()}}}m.Z(c);let O=0,E=0;a=t.columnCount;for(let ot=0;ot<a;ot++){let W=w[ot];W!==void 0&&(O+=isNaN(W.ki)?W.Re:W.ki,W.Re!==0&&(O+=W.computeEffectiveSpacing()))}a=t.rowCount;for(let ot=0;ot<a;ot++){let W=v[ot];W!==void 0&&(E+=isNaN(W.ki)?W.Re:W.ki,W.Re!==0&&(E+=W.computeEffectiveSpacing()))}y=Math.max(e-O,0),b=Math.max(i-E,0);let B=b,X=y;a=f.length;for(let ot=0;ot<a;ot++){let W=f[ot],ft=t.getRowDefinition(W.row),At=t.getColumnDefinition(W.column),Ht=W.measuredBounds,Ut=W.margin,Gt=Ut.right+Ut.left,qt=Ut.top+Ut.bottom;At.Re===0&&p[W.column]!==void 0?p[W.column]=Math.max(Ht.width+Gt,p[W.column]):p[W.column]=null,ft.Re===0&&g[W.row]!==void 0?g[W.row]=Math.max(Ht.height+qt,g[W.row]):g[W.row]=null}let z=0,U=0,tt;for(tt in g)tt!=="count"&&(z+=g[tt]);for(tt in p)tt!=="count"&&(U+=p[tt]);let nt=st.l();for(let ot=0;ot<a;ot++){let W=f[ot];if(!W.visible&&W!==F)continue;let ft=t.getRowDefinition(W.row),At=t.getColumnDefinition(W.column),Ht=0;isFinite(At.width)?Ht=At.width:(isFinite(y)&&p[W.column]!==null?U===0?Ht=At.actual+y:Ht=p[W.column]/U*X:p[W.column]!==null?Ht=y:Ht=At.actual||y,Ht=Math.max(0,Ht-At.computeEffectiveSpacing()));let Ut=0;switch(isFinite(ft.height)?Ut=ft.height:(isFinite(b)&&g[W.row]!==null?z===0?Ut=ft.actual+b:Ut=g[W.row]/z*B:g[W.row]!==null?Ut=b:Ut=ft.actual||b,Ut=Math.max(0,Ut-ft.computeEffectiveSpacing())),nt.e(Math.max(At.minimum,Math.min(Ht,At.maximum)),Math.max(ft.minimum,Math.min(Ut,ft.maximum))),A=W.Jp(ft,At,!1),A){case 5:nt.height=Math.max(nt.height,ft.actual+b);break;case 4:nt.width=Math.max(nt.width,At.actual+y);break}let Gt=W.margin,qt=Gt.right+Gt.left,we=Gt.top+Gt.bottom;W.kf();let ue=At.minimum,de=ft.minimum,Wt=W.measuredBounds;Wt.width===0&&p[W.column]!==null&&(ue=Math.max(ue,p[W.column])),Wt.height===0&&g[W.row]!==null&&(de=Math.max(ue,g[W.row])),W.ht(nt.width,nt.height,ue,de);let Zt=W.measuredBounds,me=Math.max(Zt.width+qt,0),Ft=Math.max(Zt.height+we,0);isFinite(y)&&(me=Math.min(me,nt.width)),isFinite(b)&&(Ft=Math.min(Ft,nt.height));let Me=0;Me=ft.actual,ft.actual=Math.max(ft.actual,Ft),ft.Re=Math.max(ft.Re,Ft),M=ft.actual-Me,b=Math.max(b-M,0),g[W.row]===null&&(B=Math.max(B-M,0)),Me=At.actual,At.actual=Math.max(At.actual,me),At.Re=Math.max(At.Re,me),M=At.actual-Me,y=Math.max(y-M,0),p[W.column]===null&&(X=Math.max(X-M,0))}m.Z(f);let Z=st.l(),it=m.st(),_=m.st();if(a=d.length,a!==0)for(let ot=0;ot<S;ot++){if(!u[ot])continue;N=u[ot].length;let W=t.getRowDefinition(ot);it[ot]=W.actual;for(let ft=0;ft<N;ft++){if(!u[ot][ft])continue;let At=t.getColumnDefinition(ft);_[ft]=At.actual}}for(let ot=0;ot<a;ot++){let W=d[ot];if(!W.visible&&W!==F)continue;let ft=t.getRowDefinition(W.row),At=t.getColumnDefinition(W.column);switch(nt.e(Math.max(At.minimum,Math.min(e,At.maximum)),Math.max(ft.minimum,Math.min(i,ft.maximum))),A=W.Jp(ft,At,!1),A){case 2:_[At.index]!==0&&(nt.width=Math.min(nt.width,_[At.index])),it[ft.index]!==0&&(nt.height=Math.min(nt.height,it[ft.index]));break;case 5:_[At.index]!==0&&(nt.width=Math.min(nt.width,_[At.index]));break;case 4:it[ft.index]!==0&&(nt.height=Math.min(nt.height,it[ft.index]));break}isFinite(At.width)&&(nt.width=At.width),isFinite(ft.height)&&(nt.height=ft.height),Z.e(0,0);let Ht=At.minimum,Ut=ft.minimum;for(let Ft=1;Ft<W.rowSpan&&!(W.row+Ft>=t.rowCount);Ft++){if(k=t.getRowDefinition(W.row+Ft),M=0,A===2||A===4){if(k.q===0)continue;M=Math.max(k.minimum,k.q===0?k.maximum:Math.min(k.q,k.maximum))}else M=Math.max(k.minimum,isNaN(k.ki)?k.maximum:Math.min(k.ki,k.maximum));Z.height+=M,Ut+=k.minimum}for(let Ft=1;Ft<W.columnSpan&&!(W.column+Ft>=t.columnCount);Ft++){if(k=t.getColumnDefinition(W.column+Ft),M=0,A===2||A===5){if(k.q===0)continue;M=Math.max(k.minimum,k.q===0?k.maximum:Math.min(k.q,k.maximum))}else M=Math.max(k.minimum,isNaN(k.ki)?k.maximum:Math.min(k.ki,k.maximum));Z.width+=M,Ht+=k.minimum}nt.width+=Z.width,nt.height+=Z.height;let Gt=W.margin,qt=Gt.right+Gt.left,we=Gt.top+Gt.bottom;W.ht(nt.width,nt.height,Ht,Ut);let ue=W.measuredBounds,de=Math.max(ue.width+qt,0),Wt=Math.max(ue.height+we,0),Zt=0;for(let Ft=0;Ft<W.rowSpan&&!(W.row+Ft>=t.rowCount);Ft++)k=t.getRowDefinition(W.row+Ft),Zt+=k.total||0;if(Zt<Wt){let Ft=Wt-Zt,Me=Wt-Zt;if(W.spanAllocation!==null){let se=W.spanAllocation;for(let ve=0;ve<W.rowSpan&&!(Ft<=0||W.row+ve>=t.rowCount);ve++){k=t.getRowDefinition(W.row+ve);let Te=k.q||0,ke=se(W,k,Me);k.actual=Math.min(k.maximum,Te+ke),k.q!==Te&&(Ft-=k.q-Te)}}for(;Ft>0&&k!==void 0;){let se=k.q||0;if(isNaN(k.height)&&k.maximum>se&&(k.actual=Math.min(k.maximum,se+Ft),k.q!==se&&(Ft-=k.q-se)),k.index===0)break;k=t.getRowDefinition(k.index-1)}}let me=0;for(let Ft=0;Ft<W.columnSpan&&!(W.column+Ft>=t.columnCount);Ft++)k=t.getColumnDefinition(W.column+Ft),me+=k.total||0;if(me<de){let Ft=de-me,Me=de-me;if(W.spanAllocation!==null){let se=W.spanAllocation;for(let ve=0;ve<W.columnSpan&&!(Ft<=0||W.column+ve>=t.columnCount);ve++){k=t.getColumnDefinition(W.column+ve);let Te=k.q||0,ke=se(W,k,Me);k.actual=Math.min(k.maximum,Te+ke),k.q!==Te&&(Ft-=k.q-Te)}}for(;Ft>0&&k!==void 0;){let se=k.q||0;if(isNaN(k.width)&&k.maximum>se&&(k.actual=Math.min(k.maximum,se+Ft),k.q!==se&&(Ft-=k.q-se)),k.index===0)break;k=t.getColumnDefinition(k.index-1)}}}m.Z(d),st.i(Z),st.i(nt),it!==void 0&&m.Z(it),_!==void 0&&m.Z(_);let at=0,ct=0,xt=t.desiredSize,Ct=t.maxSize;A=t.Zs(!0),O=0,E=0;let Q=0,Pt=0;a=t.columnCount;for(let ot=0;ot<a;ot++)if(w[ot]!==void 0){if(k=t.getColumnDefinition(ot),isFinite(k.width)){Q+=k.width,Q+=k.computeEffectiveSpacing();continue}else if(k.K1()===2){Q+=k.q,Q+=k.computeEffectiveSpacing();continue}k.q!==0&&(O+=k.q,O+=k.computeEffectiveSpacing())}isFinite(xt.width)?at=Math.min(xt.width,Ct.width):A!==0&&isFinite(e)?at=e:at=O,at=Math.max(at,isFinite(e)?Math.min(o,e):o),at=Math.max(at-Q,0);let bt=O===0?1:Math.max(at/O,1);for(let ot=0;ot<a;ot++)w[ot]!==void 0&&(k=t.getColumnDefinition(ot),!isFinite(k.width)&&k.K1()!==2&&(k.actual=k.q*bt),k.position=n.width,k.q!==0&&(n.width+=k.q,n.width+=k.computeEffectiveSpacing()));a=t.rowCount;for(let ot=0;ot<a;ot++)if(v[ot]!==void 0){if(k=t.getRowDefinition(ot),isFinite(k.height)){Pt+=k.height,Pt+=k.computeEffectiveSpacing();continue}else if(k.K1()===2){Pt+=k.q,Pt+=k.computeEffectiveSpacing();continue}k.q!==0&&(E+=k.q,E+=k.computeEffectiveSpacing())}isFinite(xt.height)?ct=Math.min(xt.height,Ct.height):A!==0&&isFinite(i)?ct=i:ct=E,ct=Math.max(ct,isFinite(i)?Math.min(r,i):r),ct=Math.max(ct-Pt,0);let Yt=E===0?1:Math.max(ct/E,1);for(let ot=0;ot<a;ot++)v[ot]!==void 0&&(k=t.getRowDefinition(ot),!isFinite(k.height)&&k.K1()!==2&&(k.actual=k.q*Yt),k.position=n.height,k.q!==0&&(n.height+=k.q,n.height+=k.computeEffectiveSpacing()));a=l.length;for(let ot=0;ot<a;ot++){let W=l[ot],ft=0,At=0;W.type===G.TableRow?(ft=n.width,k=t.getRowDefinition(W.row),At=k.actual):(k=t.getColumnDefinition(W.column),ft=k.actual,At=n.height),W.measuredBounds.e(0,0,ft,At),W.xi(!1)}m.Z(l),t.Aa=u}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=n.top,a=t.Aa;if(a===null)return;let h=0,l=0,u=a.length,c=0;for(let L=0;L<u;L++)a[L]&&(c=Math.max(c,a[L].length));let d=t.Zi,f=t.Qi,p=0,g=0,y=Math.min(t.topIndex,u-1);if(d.length>0){for(;y!==u&&(d[y]===void 0||d[y].q===0);)y++;y=Math.max(Math.min(y,u-1),0),p=-d[y].position}let b=Math.min(t.leftIndex,c-1);if(f.length>0){for(;b!==c&&(f[b]===void 0||f[b].q===0);)b++;b=Math.max(Math.min(b,c-1),0),g=-f[b].position}let v=0,w=0;for(;v!==u&&d[v]===void 0;)v++;for(;w!==u&&f[w]===void 0;)w++;let k=t.part,S=t.getRowDefinition(v),N=t.getColumnDefinition(w);for(let L=0;L<e.length;L++){let M=e[L];if(!(M instanceof G&&M.visible&&M.il()))continue;M.type===G.TableRow?(S=t.getRowDefinition(M.row),N=t.getColumnDefinition(w)):(S=t.getRowDefinition(v),N=t.getColumnDefinition(M.column)),l=S.position+p+r,S.q!==0&&(l+=S.computeEffectiveSpacingTop(Math.max(v,y))),h=N.position+g+o,N.q!==0&&(h+=N.computeEffectiveSpacingTop(Math.max(w,b)));let A=M.measuredBounds;M.yf(),M.actualBounds.ce();let F=M.actualBounds,O=I.z(F.x,F.y,F.width,F.height);if(F.x=M.type===G.TableRow?o:h,F.y=M.type===G.TableColumn?r:l,F.width=A.width,F.height=A.height,M.actualBounds.k(),M.oo(!1),O.equalsApproxClose(F)){I.i(O);continue}k!==null&&(k.Sa(),M.Hp(k)),I.i(O)}let D=st.l();for(let L=0;L<u;L++){if(!a[L])continue;c=a[L].length;let M=t.getRowDefinition(L);l=M.position+p+r,M.q!==0&&(l+=M.computeEffectiveSpacingTop(Math.max(v,y)));for(let A=0;A<c;A++){if(!a[L][A])continue;let F=t.getColumnDefinition(A);h=F.position+g+o,F.q!==0&&(h+=F.computeEffectiveSpacingTop(Math.max(w,b)));let O=a[L][A],E=O.length;for(let B=0;B<E;B++){let X=O[B],z=X.measuredBounds;D.e(0,0);for(let Wt=1;Wt<X.rowSpan&&!(L+Wt>=t.rowCount);Wt++){let Zt=t.getRowDefinition(L+Wt);Zt.q!==0&&(D.height+=Zt.total)}for(let Wt=1;Wt<X.columnSpan&&!(A+Wt>=t.columnCount);Wt++){let Zt=t.getColumnDefinition(A+Wt);Zt.q!==0&&(D.width+=Zt.total)}let U=F.q+D.width,tt=M.q+D.height,nt=h,Z=l,it=U,_=tt,at=h,ct=l,xt=U,Ct=tt;h+U>i.width&&(xt=Math.max(i.width-h,0)),l+tt>i.height&&(Ct=Math.max(i.height-l,0));let Q=X.alignment,Pt=0,bt=0,Yt=0,ot=0;if(Q.isDefault()){Q=t.defaultAlignment,Q.isSpot()||(Q=T.Center),Pt=Q.x,bt=Q.y,Yt=Q.offsetX,ot=Q.offsetY;let Wt=F.alignment,Zt=M.alignment;Wt.isSpot()&&(Pt=Wt.x,Yt=Wt.offsetX),Zt.isSpot()&&(bt=Zt.y,ot=Zt.offsetY)}else Pt=Q.x,bt=Q.y,Yt=Q.offsetX,ot=Q.offsetY;(isNaN(Pt)||isNaN(bt))&&(Pt=.5,bt=.5,Yt=0,ot=0);let W=z.width,ft=z.height,At=X.margin,Ht=At.left+At.right,Ut=At.top+At.bottom,Gt=X.Jp(M,F,!1);isNaN(X.desiredSize.width)&&(Gt===2||Gt===5)&&(W=Math.max(U-Ht,0)),isNaN(X.desiredSize.height)&&(Gt===2||Gt===4)&&(ft=Math.max(tt-Ut,0));let qt=X.maxSize,we=X.minSize;W=Math.min(qt.width,W),ft=Math.min(qt.height,ft),W=Math.max(we.width,W),ft=Math.max(we.height,ft);let ue=W+Ht,de=ft+Ut;nt+=it*Pt-ue*Pt+Yt+At.left,Z+=_*bt-de*bt+ot+At.top,X.visible&&(I.contains(at,ct,xt,Ct,nt,Z,z.width,z.height)?X.Ut(nt,Z,W,ft):X.Ut(nt,Z,W,ft,new I(at,ct,xt,Ct)))}}}st.i(D);for(let L=0;L<s;L++){let M=e[L],A=M instanceof G?M:null;if(A!==null&&A.il()){let F=M.actualBounds;M.naturalBounds.ce(),M.naturalBounds.e(0,0,F.width,F.height),M.naturalBounds.k()}}}}Lt.An("Table",new Xn);class Kn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Lt.An("TableRow",new Kn);class Yn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Lt.An("TableColumn",new Yn);class Un extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){s.length!==1&&m.o("Viewbox Panel must contain exactly one GraphObject.");let a=s[0];a.et=1,a.kf(),a.ht(1/0,1/0,o,r);let h=a.measuredBounds,l=a.margin,u=l.right+l.left,c=l.top+l.bottom;if(isFinite(e)||isFinite(i)){let d=a.scale,f=h.width,p=h.height,g=Math.max(e-u,0),y=Math.max(i-c,0),b=1;t.viewboxStretch===6?(f!==0&&p!==0&&(b=Math.min(g/f,y/p)),b===0&&(b=1e-4),a.et*=b):(f!==0&&p!==0&&(b=Math.max(g/f,y/p)),b===0&&(b=1e-4),a.et*=b),d!==a.scale&&(a.xi(!0),a.ht(1/0,1/0,o,r))}h=a.measuredBounds,n.width=isFinite(e)?e:Math.max(h.width+u,0),n.height=isFinite(i)?i:Math.max(h.height+c,0)}arrange(t,e,i){let s=e[0],n=s.measuredBounds,o=s.margin,r=o.right+o.left,a=o.top+o.bottom,h=Math.max(n.width+r,0),l=Math.max(n.height+a,0),u=s.alignment;u.isDefault()&&(u=t.defaultAlignment),u.isSpot()||(u=T.Center),s.Ut(i.width*u.x-h*u.x+u.offsetX,i.height*u.y-l*u.y+u.offsetY,n.width,n.height)}}Lt.An("Viewbox",new Un);class jn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){t.Pe===null&&(t.Pe=new ti),this.FI(t),this.RI(t)}arrange(t,e,i){}Ge(t,e,i){let s=t.naturalBounds;e.save(),e.beginPath(),e.rect(0,0,s.width,s.height),e.clip(),e.endPath(),this.OI(t,e,i),e.restore(),e.clearContextCache(!1)}OI(t,e,i){let s=t.getDocumentScale()*i.scale;s<=0&&(s=1);let n=t.gridCellSize,o=n.width,r=n.height,a=t.naturalBounds,h=t.actualBounds,l=a.width,u=a.height,c=Math.ceil(l/o),d=Math.ceil(u/r),f=t.gridOrigin,p=f.x,g=f.y,y=t.Pe.P0,b=t.D.r,v=b.length;for(let w=0;w<v;w++){let k=b[w];if(!k.visible)continue;let S=k.interval||1,N=Math.abs(S);if(o*N*s<2)continue;let D=k.segmentIndex;(!isFinite(D)||isNaN(D))&&(D=0),D<0&&(D=N-Math.min(-D,N)),D=Math.round(D%N);let L=k.opacity,M=1;if(L!==1){if(L===0)continue;M=e.globalAlpha,e.globalAlpha=M*L}let A=y[w],F=!1,O=k.strokeDashArray;if(O!==null&&(F=!0,e.enableDash(O,k.strokeDashOffset)),k.stroke!==null&&k.strokeWidth>0&&(k.figure==="LineV"||k.figure==="LineH")){if(e.lineWidth=k.strokeWidth,t.bn(e,k.stroke,!1,!1,a,h),e.beginPath(),k.figure==="LineV"){let E=Math.floor((p-o)/o);for(let B=E;B<=E+c;B++){let X=B*o+p;0<=X&&X<=l&&this.H1(B,S,D,A)&&(e.moveTo(X,0),e.lineTo(X,u))}}else if(k.figure==="LineH"){let E=Math.floor((g-r)/r);for(let B=E;B<=E+d;B++){let X=B*r+g;0<=X&&X<=u&&this.H1(B,S,D,A)&&(e.moveTo(0,X),e.lineTo(l,X))}}e.stroke(),e.endPath()}else if(k.fill!==null){if(t.bn(e,k.fill,!0,!1,a,h),k.figure==="BarV"){let E=k.width;isNaN(E)&&(E=o);let B=Math.floor((p-o)/o);for(let X=B;X<=B+c;X++){let z=X*o+p;0<=z+E&&z<=l&&this.H1(X,S,D,A)&&e.fillRect(z,0,E,u)}}else if(k.figure==="BarH"){let E=k.height;isNaN(E)&&(E=r);let B=Math.floor((g-r)/r);for(let X=B;X<=B+d;X++){let z=X*r+g;0<=z+E&&z<=u&&this.H1(X,S,D,A)&&e.fillRect(0,z,l,E)}}}F&&e.disableDash(),L!==1&&(e.globalAlpha=M)}}H1(t,e,i,s){if(e<0)return t%e===i;if(t%e!==i)return!1;let n=s.length;for(let o=0;o<n;o++){let r=s[o];if(t%r===i)return!1}return!0}RI(t){let e=[],i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(a<0)continue;let h=o.figure,l=this.YN(h);for(let u=0;u<s;u++){if(u===n)continue;let c=i[u];if(!c.visible)continue;let d=c.figure;if(this.YN(d)!==l)continue;let f=c.interval;f>a&&r.push(f)}}t.Pe.P0=e}YN(t){return t==="LineV"||t==="BarV"}FI(t){let e=1,i=1,s=t.D.r,n=s.length;for(let a=0;a<n;a++){let h=s[a],l=Math.abs(h.interval);l<2||(this.YN(h.figure)?i=i*l/C.HL(i,l):e=e*l/C.HL(e,l))}let o=t.gridCellSize,r=t.Pe;r.hf.isReal()?r.hf.e(i*o.width,e*o.height):r.hf=new st(i*o.width,e*o.height)}}Lt.An("Grid",new jn);class Gn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(!(t instanceof vt||t instanceof j))return;let h=null,l=null;if(t instanceof j&&(h=t),t instanceof vt&&(l=t,h=l.adornedPart,t.Af===null&&(t.Af=[])),!(h instanceof j))return;let u=h;if(a===0){t.naturalBounds.Yn(0,0),t.measuredBounds.e(0,0,0,0);return}let c=t instanceof vt?null:h.path,d=h.routeBounds,f=t.Wo;f.e(0,0,d.width,d.height);let p=u.points,g=h.pointsCount;l!==null?l.Dd(!1):h!==null&&h.Dd(!1);let y=d.width,b=d.height,v=t.Af;if(v.length=0,c!==null){this.measureLinkPath(t,y,b,c);let N=c.measuredBounds;f.unionRect(N),v.push(N)}let w=Nt.l(),k=P.l(),S=P.l();for(let N=0;N<a;N++){let D=s[N];if(D===c)continue;let L=D.measuredBounds;if(D.isPanelMain&&D instanceof et){this.measureLinkPath(t,y,b,D),L=D.measuredBounds,f.unionRect(L),v.push(L);continue}if(g<2){D.ht(1/0,1/0,0,0),L=D.measuredBounds,f.unionRect(L),v.push(L);continue}let M=D.segmentIndex,A=D.segmentFraction,F=D.alignmentFocus;F.isNoSpot()&&(F=T.Center);let O=D.segmentOrientation,E=D.segmentOffset,B=0,X=0,z=0,U=0;if(isNaN(M)){let Q=u.ut,Pt=m.st();Q.getPointAndAngleAlongPath(A,Pt);let bt=P.z(Pt[0],Pt[1]);U=Pt[2],O!==0&&(z=u.computeAngle(D,O,U),D.Xt=z,D.xi(!0),D.oo(!0)),B=bt.x,X=bt.y,P.i(bt),m.Z(Pt)}else if(M<-g||M>=g){let Q=P.l();u.KN(Q),U=u.midAngle,O!==0&&(z=u.computeAngle(D,O,U),D.Xt=z,D.xi(!0),D.oo(!0)),B=Q.x-d.x,X=Q.y-d.y,P.i(Q)}else{let Q,Pt,bt=0;if(M>=0?(Q=p.elt(M),Pt=M<g-1?p.elt(M+1):Q):(bt=g+M,Q=p.elt(bt),Pt=bt>0?p.elt(bt-1):Q),Q.equalsApprox(Pt)){let Yt,ot;M>=0?(Yt=M>0?p.elt(M-1):Q,ot=M<g-2?p.elt(M+2):Pt):(Yt=bt<g-1?p.elt(bt+1):Q,ot=bt>1?p.elt(bt-2):Pt);let W=Yt.distanceSquaredPoint(Q),ft=Pt.distanceSquaredPoint(ot);W>ft+10?U=M>=0?Yt.directionPoint(Q):Q.directionPoint(Yt):ft>W+10?U=M>=0?Pt.directionPoint(ot):ot.directionPoint(Pt):U=M>=0?Yt.directionPoint(ot):ot.directionPoint(Yt)}else U=M>=0?Q.directionPoint(Pt):Pt.directionPoint(Q);O!==0&&(z=u.computeAngle(D,O,U),D.Xt=z,D.xi(!0),D.oo(!0)),B=Q.x+(Pt.x-Q.x)*A-d.x,X=Q.y+(Pt.y-Q.y)*A-d.y}D.ht(1/0,1/0,0,0),L=D.measuredBounds;let tt=D.naturalBounds,nt=0;D instanceof et&&(nt=D.strokeWidth);let Z=tt.width+nt,it=tt.height+nt;w.Ue(),w.Xs(-L.x,-L.y),w.et(D.scale,D.scale),w.ks(O===0?D.angle:U,Z/2,it/2),(O===22||O===26)&&w.ks(90,Z/2,it/2),(O===23||O===27)&&w.ks(-90,Z/2,it/2),O===28&&(U>45&&U<135||U>225&&U<315)&&w.ks(-U,Z/2,it/2);let _=new I(0,0,Z,it);k.setRectSpot(_,F),w.gt(k);let at=-k.x+nt/2*D.scale,ct=-k.y+nt/2*D.scale;S.h(E);let xt=isNaN(E.x),Ct=isNaN(E.y);if(xt||Ct){let Q=Z/2+j.q1,Pt=it/2+j.q1,bt=U>=45&&U<=135,Yt=U>=225&&U<=315;O===0&&(bt||Yt)?(S.x=Ct?Q:E.y,S.y=xt?Pt:E.x,bt?M>=0||isNaN(M)&&A<.5||xt&&(S.y=-Pt):Yt&&((M>=0||isNaN(M)&&A<.5)&&xt&&(S.y=-Pt),Ct&&(S.x=-Q))):(xt&&(M>=0||isNaN(M)&&A<.5?S.x=Q:S.x=-Q),Ct&&(S.y=-Pt),S.rotate(U))}else S.rotate(U);B+=S.x,X+=S.y,_.e(B+at,X+ct,L.width,L.height),v.push(_),f.unionRect(_)}if(h!==null){let N=h.labelNodes;for(;N.next();)N.value.ht(1/0,1/0)}t.Wo=f,t.position.e(d.x+f.x,d.y+f.y),n.Yn(f.width||0,f.height||0),Nt.i(w),P.i(k),P.i(S)}arrange(t,e,i){let s=e.length;if(!(t instanceof vt||t instanceof j))return;let n=t,o=null;t instanceof vt&&(o=t,n=o.adornedPart);let r=t,a=t instanceof vt?null:n.path,h=t.Af;if(h.length!==0){let d=0;if(a!==null&&d<h.length){let f=h[d];d++,a.Ut(f.x-r.Wo.x,f.y-r.Wo.y,f.width,f.height)}for(let f=0;f<s;f++){let p=e[f];if(p!==a&&d<h.length){let g=h[d];d++,p.Ut(g.x-r.Wo.x,g.y-r.Wo.y,g.width,g.height)}}}let l=n.points,u=l.count;if(u>=2&&r instanceof j){let d=r.labelNodes;for(;d.next();){let f=d.value;r.II(f,u,l)}}o!==null?o.Dd(!1):n.Dd(!1);let c=t.cD(P.l());t.location.e(t.position.x+c.x,t.position.y+c.y),P.i(c)}measureLinkPath(t,e,i,s){if(s.Bo()===!1)return;let n=s.strokeWidth;if(n===0&&t instanceof vt&&t.type===G.Link&&t.adornedObject instanceof et&&(n=t.adornedObject.strokeWidth),n=n*s.et,t instanceof j&&t.ut!==null){let o=t.geometry.bounds;s.no(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else if(t instanceof vt&&t.adornedPart.ut!==null){let o=t.adornedPart.ut.bounds;s.no(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else s.no(-(n/2),-(n/2),e+n,i+n);s.EI(),s.xi(!1)}}Lt.An("Link",new Gn);class qn extends Lt{constructor(){super()}measure(t,e,i,s,n,o,r){let a=t.findMainElement();if(!(a instanceof et))return;t._i=[];let h=a.margin,l=h.right+h.left,u=h.top+h.bottom;a.ht(e,i,o,r);let c=a.measuredBounds,d=c.width,f=c.height,p=Math.max(d+l,0),g=Math.max(f+u,0),y=new I(-h.left,-h.top,p,g);t._i.push(y),n.h(y),this.determineGraduatedMarks(t,a);let b=t.vs;if(b===null)return;let v=s.length;for(let w=0;w<v;w++){let k=s[w],S=b[w];!k.visible||k===a||S.length===0||(k instanceof et?this.measureGraduatedTicks(t,k,S,n):k instanceof lt&&this.measureGraduatedLabels(t,k,S,n),k.xi(!1))}}arrange(t,e,i){if(t._i===null)return;let s=t.findMainElement(),n=t.vs;if(n===null)return;let o=t._i,r=0,a=o[r];r++,s!==null&&s.Ut(a.x-i.x,a.y-i.y,a.width,a.height);let h=e.length;for(let l=0;l<h;l++){let u=e[l],c=n[l];!u.visible||u===s||c.length===0||(a=o[r],r++,u.Ut(a.x-i.x,a.y-i.y,a.width,a.height))}t._i=null}measureGraduatedTicks(t,e,i,s){let n=e.alignmentFocus;n.isNoSpot()&&(n=T.TopCenter);let o=e.angle;e.Xt=0,e.ht(1/0,1/0,0,0),e.Xt=o;let r=e.measuredBounds,a=r.width,h=r.height,l=I.z(0,0,a,h),u=P.l();u.setRectSpot(l,n),I.i(l);let c=-u.x,d=-u.y,f=new I,p=i.length;for(let g=0;g<p;g++){let y=i[g],b=y.pt.x,v=y.pt.y,w=y.angle;for(let k=0;k<4;k++){switch(k){case 0:u.e(c,d);break;case 1:u.e(c+a,d);break;case 2:u.e(c,d+h);break;case 3:u.e(c+a,d+h);break}u.rotate(w+e.angle),u.offset(b,v),g===0&&k===0?f.e(u.x,u.y,0,0):f.unionPoint(u),u.offset(-b,-v),u.rotate(-w-e.angle)}}P.i(u),t._i!==null&&t._i.push(f),s.re(f.x,f.y,f.width,f.height)}measureGraduatedLabels(t,e,i,s){t.vi===null&&(t.vi=new lt);let n=t.vi;this.fD(e,n);let o=e.alignmentFocus;o.isNoSpot()&&(o=T.TopCenter);let r=e.segmentOrientation,a=e.segmentOffset,h=new I,l=0,u=0,c=0,d=0,f=0,p=i.length;for(let g=0;g<p;g++){let y=i[g];l=y.pt.x,u=y.pt.y,c=y.angle,d=e.angle,f=e.angle,r!==0&&(r===21||r===25?f=c+e.angle:f=c,d=j.computeAngle(r,f)),n.Xt=d,n.text=y.text||"",n.ht(1/0,1/0,0,0);let b=n.measuredBounds,v=n.naturalBounds,w=v.width,k=v.height,S=Nt.l();S.Ue(),S.Xs(-b.x,-b.y),S.et(n.scale,n.scale),S.ks(f,w/2,k/2),(r===22||r===26)&&S.ks(90,w/2,k/2),(r===23||r===27)&&S.ks(-90,w/2,k/2),r===28&&(c>45&&c<135||c>225&&c<315)&&S.ks(-c,w/2,k/2);let N=I.z(0,0,w,k),D=P.l();D.setRectSpot(N,o),S.gt(D);let L=-D.x,M=-D.y,A=P.l();A.h(a),isNaN(A.x)&&(A.x=w/2+3),isNaN(A.y)&&(A.y=-(k/2+3)),A.rotate(c),l+=A.x+L,u+=A.y+M;let F=new I(l,u,b.width,b.height),O=new I(b.x,b.y,b.width,b.height),E=new I(v.x,v.y,v.width,v.height);y.labelAngle=d,y.lineCount=n.lineCount,y.lines=n.getMetrics(),y.actualBounds=F,y.measuredBounds=O,y.naturalBounds=E,g===0?h.h(F):h.unionRect(F),P.i(A),P.i(D),I.i(N),Nt.i(S)}t._i!==null&&t._i.push(h),s.re(h.x,h.y,h.width,h.height)}determineGraduatedMarks(t,e){let i=e.geometry,s=e.strokeWidth,n=i.flattenedSegments,o=i.flattenedLengths,r=i.flattenedTotalLength,a=n.length,h=0,l=0,u=m.st();for(let v=0;v<a;v++){let w=n[v],k=[];h=0,l=0;let S=w.length;for(let N=0;N<S;N+=2){let D=w[N],L=w[N+1];if(N===0){h=D,l=L;continue}let M=Math.atan2(L-l,D-h)*180/Math.PI;M<0&&(M+=360),k.push(M),h=D,l=L}u.push(k)}let c=this.UI(t),d=t.D.r,f=d.length,p=0,g=0,y=r;t.vs=[];let b;for(let v=0;v<f;v++){let w=d[v];if(b=[],!w.visible||w===e){t.vs.push(b);continue}let k=Math.abs(w.interval),S=t.graduatedTickUnit;if(S*k*r/t.graduatedRange<2&&w.graduatedSkip===null){t.vs.push(b);continue}let N=o[0][0],D=0,L=0;g=r*w.graduatedStart-1e-4,y=r*w.graduatedEnd+1e-4;let M=S*k,A=t.graduatedTickBase;if(A<t.graduatedMin){let B=(t.graduatedMin-A)/M;B=B%1===0?B:Math.floor(B+1),A+=B*M}else if(A>t.graduatedMin+M){let B=Math.floor((A-t.graduatedMin)/M);A-=B*M}let F=c[v],O=A,E=t.graduatedMax*1e-6;for(let B=1;A<=t.graduatedMax+E;B++){if(this.VI(t,A-t.graduatedTickBase,F)&&(A>t.graduatedMax&&(A=t.graduatedMax),(w.graduatedSkip===null||w instanceof lt&&!w.graduatedSkip(A,w)||w instanceof et&&!w.graduatedSkip(A,w))&&(p=(A-t.graduatedMin)*r/t.graduatedRange,p>r&&(p=r),g<=p&&p<=y))){let X=u[D][L],z=o[D][L];for(;D<o.length;){for(;p>N&&L<o[D].length-1;)L++,X=u[D][L],z=o[D][L],N+=z;if(p<=N)break;D++,L=0,X=u[D][L],z=o[D][L],N+=z}let U=n[D],tt=U[L*2],nt=U[L*2+1],Z=U[L*2+2],it=U[L*2+3],_=(p-(N-z))/z,at=new P(tt+(Z-tt)*_+s/2-i.bounds.x,nt+(it-nt)*_+s/2-i.bounds.y);if(at.scale(e.scale,e.scale),X=this.BI(X,_,U,u[D],L),w instanceof lt){let ct="";w.graduatedFunction!==null?(ct=w.graduatedFunction(A,w),ct=ct!=null?ct.toString():""):ct=(+A.toFixed(2)).toString(),ct!==""&&b.push({pt:at,angle:X,text:ct})}else b.push({pt:at,angle:X})}A=O+B*M}t.vs.push(b)}m.Z(u)}BI(t,e,i,s,n){if(e<.5005&&e>.4995)return t;let o=t;if(e<.5?n>0?o=s[n-1]:C.X(i[0],i[i.length-2])&&C.X(i[1],i[i.length-1])&&(o=s[s.length-1]):e>.5&&(n+1<s.length?o=s[n+1]:C.X(i[0],i[i.length-2])&&C.X(i[1],i[i.length-1])&&(o=s[0])),t!==o){let r=Math.abs(t-o);if(r>180&&(t<o?t+=360:o+=360,r=Math.abs(t-o)),e<5e-4||e>.9995)return(t+o)/2%360;if(r<10){let a=1-Math.abs(.5-e);return(t*a+o*(1-a))%360}}return t}UI(t){if(t.ds===null){let e=[],i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(!(a<0))for(let h=0;h<s;h++){if(h===n)continue;let l=i[h];if(!l.visible||o.constructor!==l.constructor)continue;let u=l.interval;u>a&&r.push(u)}}t.ds=e}return t.ds}VI(t,e,i){let s=i.length;for(let n=0;n<s;n++){let o=i[n]*t.graduatedTickUnit,r=e%o,a=t.graduatedTickUnit*1e-6;if(r<a&&r>-a)return!1}return!0}Ge(t,e,i){let s=i.ph;i.ph=!0;let n=t.naturalBounds,o=n.width,r=n.height,a=e instanceof re;e.save(),e.beginPath(),e.rect(-1,-1,o+1,r+1),e.clip(),e.endPath();let h=t.findMainElement();h.Ge(e,i);let l=t.getDocumentScale()*i.scale;l<=0&&(l=1);let u=h.actualBounds,c=t.D.r,d=t.vs,f=c.length;for(let p=0;p<f;p++){let g=c[p],y=d[p],b=y.length;if(!(!g.visible||g===h||y.length===0)){if(g instanceof et){if(t.graduatedTickUnit*g.interval*h.geometry.flattenedTotalLength/t.graduatedRange*l<2&&g.graduatedSkip===null)continue;let v=g.measuredBounds,w=g.strokeWidth*g.scale,k=g.alignmentFocus;k.isNoSpot()&&(k=T.TopCenter);for(let S=0;S<b;S++){let N=y[S].pt,D=y[S].angle;this.zI(g,N,u,D,v,w,k),g.Ge(e,i),a&&(t.svg.appendChild(g.svg),g.svg=null),g._r.Ue()}}else if(g instanceof lt){t.vi===null&&(t.vi=new lt);let v=t.vi;this.fD(g,v),v.HN=!0;for(let w=0;w<b;w++){let k=y[w];if(k.actualBounds&&k.measuredBounds&&k.naturalBounds){v.XI(k);let S=k.actualBounds;v.Ut(S.x,S.y,S.width,S.height),this.GI(v,u,S,k.measuredBounds,k.naturalBounds),v.el=g.part,v.$s=g.panel,v.Ge(e,i),v.$s=null,v.el=null,a&&(t.svg.appendChild(v.svg),v.svg=null)}}}}}i.ph=s,e.restore(),e.clearContextCache(!0)}zI(t,e,i,s,n,o,r){let a=t._r;a.Ue(),a.Xs(e.x+i.x,e.y+i.y),a.ks(s+t.angle,0,0),a.Xs(-n.width*r.x+r.offsetX+o/2,-n.height*r.y+r.offsetY+o/2),a.et(t.scale,t.scale),t.Md(!1),t.wa.set(t._r),t.Dh=t.scale,t.Na(!1)}GI(t,e,i,s,n){let o=t._r;o.Ue(),o.Xs(i.x+e.x,i.y+e.y),o.Xs(-s.x,-s.y),t.Xp(o,n.x,n.y,n.width,n.height),t.Md(!1),t.wa.set(t._r),t.Dh=t.scale,t.Na(!1)}fD(t,e){e.YI(t)}}Lt.An("Graduated",new qn);var Us=(x=>(x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(Us||{});class G extends J{W;D;Qt;vd;Jn;nl;ho;Wo;qN;O;Fd;ot;Pe;te;Rd;Ta;_s;constructor(t,e){if(super(),t===void 0)this.W=G.Position;else if(typeof t=="string"){let i=Lt.fs.get(t);i!==null?this.W=i:m.o("PanelLayout not loaded: "+t)}else t instanceof Lt?this.W=t:(this.W=G.Position,t&&(e=t));this.n|=4194304|(this.W===G.Grid?1048576:0),this.D=new q,this.Qt=Dt.em,this.vd=T.Default,this.Jn=1,this.nl=null,this.ho="",this.Wo=new I(NaN,NaN,NaN,NaN),this.qN=null,this.O=null,this.Fd=6,this.Pe=null,this.ot=null,this.te=null,this.Rd=NaN,this.Ta=null,this._s=null,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.W=this.W,t.Qt=this.Qt.N(),t.vd=this.vd.N(),t.Jn=this.Jn,t.ho=this.ho,t.Wo.h(this.Wo),this.O!==null&&(t.O=this.O.copy(t)),t.Fd=this.Fd,this.ot!==null&&(t.ot=this.ot.copy()),this.Pe!==null&&(t.Pe=this.Pe.copy()),t.te=this.te,t.Rd=this.Rd,t.Ta=this.Ta}Yo(t){super.Yo(t),t.D=this.D;let e=t.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n.$s=t}t.nl=null}copy(){let t=super.copy(),e=this.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].copy();t.KI(n)}return t}toString(){return"Panel("+this.type.name+")#"+V.xs(this)}get type(){return this.W}set type(t){let e=this.W;e!==t&&(this.W=t,this.Tf=this.W===G.Grid,this.f(),this.t("type",e,t))}get elements(){return this.D.iterator}get naturalBounds(){return this.Ke}get padding(){return this.Qt}set padding(t){typeof t=="number"?(t<0&&m.J(t,">= 0",G,"padding"),t=new Dt(t)):(t.left<0&&m.J(t.left,">= 0",G,"padding:value.left"),t.right<0&&m.J(t.right,">= 0",G,"padding:value.right"),t.top<0&&m.J(t.top,">= 0",G,"padding:value.top"),t.bottom<0&&m.J(t.bottom,">= 0",G,"padding:value.bottom"));let e=this.Qt;e.equals(t)||(t=t.N(),this.Qt=t,this.f(),this.t("padding",e,t))}get defaultAlignment(){return this.vd}set defaultAlignment(t){let e=this.vd;e.equals(t)||(t=t.N(),this.vd=t,this.f(),this.t("defaultAlignment",e,t))}get defaultStretch(){return this.Jn}set defaultStretch(t){let e=this.Jn;e!==t&&(this.Jn=t,this.f(),this.t("defaultStretch",e,t))}get defaultSeparatorPadding(){return this.O!==null?this.O.S0:Dt.em}set defaultSeparatorPadding(t){typeof t=="number"&&(t=new Dt(t));let e=this.defaultSeparatorPadding;e.equals(t)||(t=t.N(),this.O===null&&(this.O=new ie),this.O.S0=t,this.f(),this.t("defaultSeparatorPadding",e,t))}get defaultRowSeparatorStroke(){return this.O!==null?this.O.M0:null}set defaultRowSeparatorStroke(t){let e=this.defaultRowSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof R)&&(t instanceof R&&t.k(),this.O===null&&(this.O=new ie),this.O.M0=t,this.C(),this.t("defaultRowSeparatorStroke",e,t))}get defaultRowSeparatorStrokeWidth(){return this.O!==null?this.O.N0:1}set defaultRowSeparatorStrokeWidth(t){let e=this.defaultRowSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.O===null&&(this.O=new ie),this.O.N0=t,this.f(),this.t("defaultRowSeparatorStrokeWidth",e,t))}get defaultRowSeparatorDashArray(){return this.O!==null?this.O.C0:null}set defaultRowSeparatorDashArray(t){let e=this.defaultRowSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",G,"defaultRowSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&m.o("defaultRowSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.O===null&&(this.O=new ie),this.O.C0=t,this.C(),this.t("defaultRowSeparatorDashArray",e,t)}}get defaultColumnSeparatorStroke(){return this.O!==null?this.O.L0:null}set defaultColumnSeparatorStroke(t){let e=this.defaultColumnSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof R)&&(t instanceof R&&t.k(),this.O===null&&(this.O=new ie),this.O.L0=t,this.C(),this.t("defaultColumnSeparatorStroke",e,t))}get defaultColumnSeparatorStrokeWidth(){return this.O!==null?this.O.A0:1}set defaultColumnSeparatorStrokeWidth(t){let e=this.defaultColumnSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.O===null&&(this.O=new ie),this.O.A0=t,this.f(),this.t("defaultColumnSeparatorStrokeWidth",e,t))}get defaultColumnSeparatorDashArray(){return this.O!==null?this.O.T0:null}set defaultColumnSeparatorDashArray(t){let e=this.defaultColumnSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",G,"defaultColumnSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&m.o("defaultColumnSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.O===null&&(this.O=new ie),this.O.T0=t,this.C(),this.t("defaultColumnSeparatorDashArray",e,t)}}get Aa(){return this.O!==null?this.O.Aa:null}set Aa(t){this.O===null&&(this.O=new ie),this.O.Aa=t}get viewboxStretch(){return this.Fd}set viewboxStretch(t){let e=this.Fd;e!==t&&(this.Fd=t,this.f(),this.t("viewboxStretch",e,t))}get gridCellSize(){return this.Pe!==null?this.Pe.Od:st.OL}set gridCellSize(t){this.Pe===null&&(this.Pe=new ti);let e=this.Pe.Od;if(!e.equals(t)){(!t.isReal()||t.width===0||t.height===0)&&m.o("Invalid Panel.gridCellSize: "+t),this.Pe.Od=t.N();let i=this.diagram;i!==null&&this===i.grid&&i.ca(),this.C(),this.t("gridCellSize",e,t)}}get gridOrigin(){return this.Pe!==null?this.Pe.Id:P.dn}set gridOrigin(t){this.Pe===null&&(this.Pe=new ti);let e=this.Pe.Id;if(!e.equals(t)){t.isReal()||m.o("Invalid Panel.gridOrigin: "+t),this.Pe.Id=t.N();let i=this.diagram;i!==null&&this===i.grid&&i.ca(),this.C(),this.t("gridOrigin",e,t)}}get graduatedMin(){return this.ot!==null?this.ot.D0:0}set graduatedMin(t){let e=this.graduatedMin;if(e!==t&&(this.ot===null&&(this.ot=new Pe),this.ot.D0=t,this.f(),this.t("graduatedMin",e,t),this.mf())){let i=this.part;i!==null&&this.Uh(i,"graduatedRange")}}get graduatedMax(){return this.ot!==null?this.ot.v0:100}set graduatedMax(t){let e=this.graduatedMax;if(e!==t&&(this.ot===null&&(this.ot=new Pe),this.ot.v0=t,this.f(),this.t("graduatedMax",e,t),this.mf())){let i=this.part;i!==null&&this.Uh(i,"graduatedRange")}}get graduatedRange(){return this.graduatedMax-this.graduatedMin}get graduatedTickUnit(){return this.ot!==null?this.ot.F0:10}set graduatedTickUnit(t){let e=this.graduatedTickUnit;e!==t&&t>0&&(this.ot===null&&(this.ot=new Pe),this.ot.F0=t,this.f(),this.t("graduatedTickUnit",e,t))}get graduatedTickBase(){return this.ot!==null?this.ot.R0:0}set graduatedTickBase(t){let e=this.graduatedTickBase;e!==t&&(this.ot===null&&(this.ot=new Pe),this.ot.R0=t,this.f(),this.t("graduatedTickBase",e,t))}get vs(){return this.ot!==null?this.ot.vs:null}set vs(t){this.ot!==null?this.ot.vs=t:t!==null&&(this.ot=new Pe,this.ot.vs=t)}get _i(){return this.ot!==null?this.ot._i:null}set _i(t){this.ot!==null?this.ot._i=t:t!==null&&(this.ot=new Pe,this.ot._i=t)}get ds(){return this.ot!==null?this.ot.ds:null}set ds(t){this.ot!==null?this.ot.ds=t:t!==null&&(this.ot=new Pe,this.ot.ds=t)}get vi(){return this.ot!==null?this.ot.vi:null}set vi(t){this.ot!==null?this.ot.vi=t:t!==null&&(this.ot=new Pe,this.ot.vi=t)}Hp(t){super.Hp(t);let e=this.D.r,i=e.length;for(let s=0;s<i;s++)e[s].Hp(t)}Ma(t,e){if(this.W===G.Grid){t.commitTransform(),this.W.Ge(this,t,e);return}if(this.W===G.Graduated){t.commitTransform(),this.W.Ge(this,t,e);return}if(this.W===G.Table)if(t.commitTransform(),t instanceof re){let r=t.currentElement;t.currentElement=t.newGroup2("gojs-ts"),this.jN(t,e),t.endGroup(),t.currentElement=r}else this.jN(t,e);let i=this.isClipping&&this.W===G.Spot;i&&t.save();let s=this.findMainElement(),n=this.D.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];i&&a===s&&(t.clipInsteadOfFill=!0),a.Ge(t,e),i&&a===s&&(t.clipInsteadOfFill=!1)}i&&(t.restore(),t.clearContextCache(!0))}jN(t,e){t.lineCap="butt";let i=this.rowCount>0?this.Zi:null,s=this.columnCount>0?this.Qi:null;i!==null&&this.j1(t,e,!0,i,!0),s!==null&&this.j1(t,e,!1,s,!0),i!==null&&this.uD(t,!0,i),s!==null&&this.uD(t,!1,s),i!==null&&this.j1(t,e,!0,i,!1),s!==null&&this.j1(t,e,!1,s,!1)}uD(t,e,i){let s=i.length,n=this.actualBounds,o=this.naturalBounds,r=!0;for(let a=0;a<s;a++){let h=i[a];if(h===void 0||h.actual===0)continue;if(r){r=!1;continue}if(e){if(h.position>o.height)continue}else if(h.position>o.width)continue;let l=h.separatorStrokeWidth;isNaN(l)&&(l=e?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let u=h.separatorStroke;if(u===null&&(u=e?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),l===0||u===null)continue;this.bn(t,u,!1,!1,o,n);let c=!1,d=h.separatorDashArray;d===null&&(d=e?this.defaultRowSeparatorDashArray:this.defaultColumnSeparatorDashArray),d!==null&&(c=!0,t.enableDash(d,0)),t.beginPath();let f=h.position+l;e?f>o.height&&(l-=f-o.height):f>o.width&&(l-=f-o.width);let p=h.position+l/2;t.lineWidth=l;let g=this.Qt;if(e){p+=g.top;let y=g.left,b=o.width-g.right;t.moveTo(y,p),t.lineTo(b,p)}else{p+=g.left;let y=g.top,b=o.height-g.bottom;t.moveTo(p,y),t.lineTo(p,b)}t.stroke(),t.endPath(),c&&t.disableDash()}}j1(t,e,i,s,n){let o=s.length,r=this.actualBounds,a=this.naturalBounds,h=this.dD(!0),l=this.dD(!1);for(let u=0;u<o;u++){let c=s[u];if(c===void 0||c.background===null||c.coversSeparators===n||c.actual===0)continue;let d=i?r.height:r.width;if(c.position>d)continue;let f=c.computeEffectiveSpacing(),p=c.separatorStrokeWidth;isNaN(p)&&(p=i?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let g=c.separatorStroke;g===null&&(g=i?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),(g===null||c.index===(i?h:l))&&(p=0),f-=p;let y=c.position+p,b=f+c.actual;if(y+b>d&&(b=d-y),b<=0)continue;let v=this.Qt;this.bn(t,c.background,!0,!1,a,r),i?t.fillRect(v.left,y+v.top,r.width-(v.left+v.right),b):t.fillRect(y+v.left,v.top,b,r.height-(v.top+v.bottom))}}dD(t){let e=t?this.rowCount:this.columnCount;for(let i=0;i<e;i++){let s=t?this.Zi[i]:this.Qi[i];if(s!==void 0)return s.index}return 0}xf(){let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].xf();this.Ji(!0)}wf(t,e,i){let s=this.svg;if(s===null)return!1;if(this.type===G.Table){let r=s.getElementsByClassName("gojs-ts"),a=r.length!==0?r[0]:null;a!==null&&(a.innerHTML=""),t.currentElement=a,this.jN(t,e),t.currentElement=null}else{if(this.W===G.Grid||this.W===G.Graduated)return s.innerHTML="",s.remove(),!1;if(this.W===G.Spot&&this.isClipping)return s.innerHTML="",s.remove(),this.xa=null,this.xf(),!1}if(!super.wf(t,e,i))return!1;let n=this.D.r,o=n.length;for(let r=0;r<o;r++)n[r].Ge(t,e);return!0}Sd(t){return!0}jp(t,e,i,s){if(!this.isClipping){if(this.Qs()&&t.partClipRect!==null){let n=t.partClipRect,o=this.D.r,r=0,a=0;for(let h=0;h<o.length;h++){if(!o[h].isVisibleObject())continue;let l=o[h].actualBounds;r=h===0?l.x:Math.min(l.x,r),a=h===0?l.y:Math.min(l.y,a)}s.setAttributeNS(null,"clip-path",`path('M ${n.x-i.x-r},${n.y-i.y-a} l ${n.width} 0 l 0 ${n.height} l -${n.width} 0 z')`);return}super.jp(t,e,i,s)}}pf(t,e,i,s,n){let o=this.Mn(),r=this.v,a=1/(r.m11*r.m22-r.m12*r.m21),h=r.m22*a,l=-r.m12*a,u=-r.m21*a,c=r.m11*a,d=a*(r.m21*r.dy-r.m22*r.dx),f=a*(r.m12*r.dx-r.m11*r.dy);if(this.background!==null){let p=t*h+e*u+d,g=t*l+e*c+f,y=i*h+s*u+d,b=i*l+s*c+f;n.e(0,0);let v=this.naturalBounds,w=C.Cl(0,0,v.width,v.height,p,g,y,b,n);return n.v(r),w}else{o||(h=1,l=0,u=0,c=1,d=0,f=0);let p=t*h+e*u+d,g=t*l+e*c+f,y=i*h+s*u+d,b=i*l+s*c+f;n.e(y,b);let v=(y-p)**2+(b-g)**2,w=!1,k=this.D.r,S=k.length,N=P.l(),D=null,L=1/0,M=null,A=this.isClipping&&this.W===G.Spot;A&&(M=P.l(),D=this.findMainElement(),w=D.pf(p,g,y,b,M),w&&(L=(p-M.x)**2+(g-M.y)**2));for(let F=0;F<S;F++){let O=k[F];if(!O.visible||O===D||!O.pf(p,g,y,b,N))continue;w=!0;let E=(p-N.x)**2+(g-N.y)**2;E<v&&(v=E,n.set(N))}return A&&(L>v&&n.set(M),P.i(M)),P.i(N),o&&n.v(r),w}}Jc(){let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].Jc();super.Jc()}f(t){if(this.Bo())return;super.f(t);let e=null;(this.W===G.Auto||this.W===G.Link)&&(e=this.findMainElement());let i=this.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if((o===e||o.isPanelMain)&&o.f(!0),o.desiredSize.isReal()||!o.visible)continue;let r=o.Zs(!1);!(o instanceof le)&&!(o instanceof G)&&!(o instanceof lt)&&r===0||o.f(!0)}}kf(){if(this.Bo())return;this.xi(!0),this.oo(!0);let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].kf()}yf(){if(this.E1()===!1){this.Md(!0),this.Na(!0);let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].LN()}}LN(){this.Na(!0);let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].LN()}kd(t,e,i,s){let n=this.Wo;n.e(0,0,0,0);let o=this.desiredSize,r=this.minSize;i===void 0&&(i=r.width,s=r.height),i=Math.max(i,r.width),s=Math.max(s,r.height);let a=this.maxSize;isNaN(o.width)||(t=Math.min(o.width,a.width)),isNaN(o.height)||(e=Math.min(o.height,a.height)),t=Math.max(i,t),e=Math.max(s,e);let h=this.Qt;t=Math.max(t-h.left-h.right,0),e=Math.max(e-h.top-h.bottom,0);let l=this.D.r;this.W.measure(this,t,e,l,n,i,s);let u=n.width+h.left+h.right,c=n.height+h.top+h.bottom;isFinite(o.width)&&(u=o.width),isFinite(o.height)&&(c=o.height),u=Math.min(a.width,u),c=Math.min(a.height,c),u=Math.max(r.width,u),c=Math.max(r.height,c),u=Math.max(i,u),c=Math.max(s,c),n.Yn(u,c),this.naturalBounds.Yn(u,c),this.no(0,0,u,c)}findMainElement(){if(this.nl===null){let t=this.D.r,e=t.length;if(e===0)return null;for(let i=0;i<e;i++){let s=t[i];if(s.isPanelMain===!0)return this.nl=s,s}this.nl=t[0]}return this.nl}jo(){return this.part!==null?this.part.locationObject:null}get panelLayoutState(){return this.qN}set panelLayoutState(t){this.qN=t}Pa(t,e,i,s){let n=this.D.r;if(this.actualBounds.e(t,e,i,s),!this.desiredSize.isReal()){let o=this.Zs(!0),r=this.measuredBounds,a=r.width,h=r.height,l=this.tl,u=l.left+l.right,c=l.top+l.bottom;switch(a===i&&h===s&&(o=0),o){case 0:(a>i||h>s)&&(this.f(),this.ht(a>i?i:a,h>s?s:h,0,0));break;case 2:this.f(!0),this.ht(i+u,s+c,0,0);break;case 5:this.f(!0),this.ht(i+u,h+c,0,0);break;case 4:this.f(!0),this.ht(a+u,s+c,0,0);break}}this.W.arrange(this,n,this.Wo)}ka(t){let e=this.naturalBounds,i=this.jo();if(I.contains(0,0,e.width,e.height,t.x,t.y)){let s=this.D.r,n=s.length,o=P.z(0,0);for(let r=n;r--;){let a=s[r];if(!(!a.visible&&a!==i)&&(o.set(t).Yi(a.v),a.containsPoint(o)))return P.i(o),!0}return P.i(o),this.Ct!==null}return!1}zp(t){if(this.io===t)return this;let e=this.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].zp(t);if(n!==null)return n}return null}walkVisualTreeFrom(t,e){if(e(this,t),t instanceof G){let i=t.D.r,s=i.length;for(let n=0;n<s;n++)this.walkVisualTreeFrom(i[n],e)}}Pn(t){this.gD(this,t)}gD(t,e){e(t);let i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o instanceof G&&this.gD(o,e)}}HI(t){this.mD(this,t)}mD(t,e){if(e(t),t instanceof G){let i=t.D.r,s=i.length;for(let n=0;n<s;n++)this.mD(i[n],e)}}findInVisualTree(t){return this.pD(this,t)}pD(t,e){if(e(t))return t;if(t instanceof G){let i=t.D.r,s=i.length;for(let n=0;n<s;n++){let o=this.pD(i[n],e);if(o!==null)return o}}return null}findObject(t){if(this.name===t)return this;let e=this.D.r,i=e.length;this.Ta!==null&&(i=this.O0());for(let s=0;s<i;s++){let n=e[s];if(n instanceof G){let o=n.findObject(t);if(o!==null)return o}if(n.name===t)return n}return null}yD(){let t=this.D.r,e=t.length,i=0;for(let s=0;s<e;s++){let n=t[s];n instanceof G?i=Math.max(i,n.yD()):n instanceof et&&(i=Math.max(i,n.qI()))}return i}Mn(){return!(this.type===G.TableRow||this.type===G.TableColumn)}il(){return this.type===G.TableRow||this.type===G.TableColumn}BA(t,e,i){if(this.pickable===!1||(e===void 0&&(e=null),i===void 0&&(i=null),this.as()))return null;let s=this.naturalBounds,n=1/this.getDocumentScale(),o=this.Mn(),r=o?t:P.z(t.x,t.y).Yi(this.v),a=this.diagram,h=10,l=5;if(a!==null&&(h=a.getInputOption("extraTouchArea"),l=h/2),I.contains(-(l*n),-(l*n),s.width+h*n,s.height+h*n,r.x,r.y)){if(!this.Tf){let c=this.D.r,d=c.length,f=P.l(),p=this.isClipping&&this.W===G.Spot,g=p?this.findMainElement():null;if(p&&g&&(g.Mn()?f.set(t).Yi(g.v):f.set(t),!g.containsPoint(f)))return P.i(f),o||P.i(r),null;let y=this.jo();for(let b=d;b--;){let v=c[b];if(!v.visible&&v!==y||(v.Mn()?f.set(t).Yi(v.v):f.set(t),p&&v===g))continue;let w=null;if(v instanceof G?w=v.BA(f,e,i):v.pickable===!0&&v.containsPoint(f)&&(w=v),w!==null&&(e!==null&&(w=e(w)),w!==null&&(i===null||i(w))))return P.i(f),o||P.i(r),w}P.i(f)}if(this.background===null)return o||P.i(r),null;let u=I.contains(0,0,s.width,s.height,r.x,r.y)?this:null;return o||P.i(r),u}return o||P.i(r),null}zA(t,e,i,s){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let n=this.naturalBounds,o=this.Mn(),r=o?t:P.z(t.x,t.y).Yi(this.v),a=this.il(),h=I.contains(0,0,n.width,n.height,r.x,r.y);if(a||h){if(!this.Tf){let l=this.D.r,u=l.length,c=P.l(),d=this.jo();for(let f=u;f--;){let p=l[f];if(!p.visible&&p!==d)continue;p.Mn()?c.set(t).Yi(p.v):c.set(t);let g=p,y=p instanceof G?p:null;if(y!==null?y.zA(c,e,i,s):g.containsPoint(c)){if(g.pickable===!1)continue;e!==null&&(g=e(g)),g!==null&&(i===null||i(g))&&s.add(g)}}P.i(c)}return o||P.i(r),h&&this.background!==null}return o||P.i(r),!1}Wm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r=o;if(r===void 0&&(r=Nt.l(),r.Ue()),r.kc(this.v),this.containedInRect(t,r))return this.WN(e,i,n),o===void 0&&Nt.i(r),!0;if(this.intersectsRect(t,r)){if(!this.Tf){let a=this.jo(),h=this.D.r,l=h.length;for(let u=l;u--;){let c=h[u];if(!c.visible&&c!==a)continue;let d=c.actualBounds,f=this.naturalBounds;if(d.x>f.width||d.y>f.height||d.x+d.width<0||d.y+d.height<0)continue;let p=c,g=c instanceof G?c:null,y=Nt.l();y.set(r),(g!==null?g.Wm(t,e,i,s,n,y):p.JT(t,s,y))&&(e!==null&&(p=e(p)),p!==null&&(i===null||i(p))&&n.add(p)),Nt.i(y)}}return o===void 0&&Nt.i(r),s}return o===void 0&&Nt.i(r),!1}WN(t,e,i){let s=this.D.r,n=s.length;for(let o=n;o--;){let r=s[o];if(!r.visible)continue;let a=r.actualBounds,h=this.naturalBounds;if(a.x>h.width||a.y>h.height||a.x+a.width<0||a.y+a.height<0)continue;r instanceof G&&r.WN(t,e,i);let l=r;t!==null&&(l=t(l)),l!==null&&(e===null||e(l))&&i.add(l)}}XA(t,e,i,s,n,o){if(this.pickable===!1)return!1;i===void 0&&(i=null),s===void 0&&(s=null);let r=this.naturalBounds,a=this.Mn(),h=a?t:P.z(t.x,t.y).Yi(this.v),l=a?e:P.z(e.x,e.y).Yi(this.v),u=h.distanceSquaredPoint(l),c=h.x>0&&h.x<r.width&&h.y>0&&h.y<r.height||P.distanceLineSegmentSquared(h.x,h.y,0,0,0,r.height)<=u||P.distanceLineSegmentSquared(h.x,h.y,0,r.height,r.width,r.height)<=u||P.distanceLineSegmentSquared(h.x,h.y,r.width,r.height,r.width,0)<=u||P.distanceLineSegmentSquared(h.x,h.y,r.width,0,0,0)<=u,d=h.distanceSquared(0,0)<=u&&h.distanceSquared(0,r.height)<=u&&h.distanceSquared(r.width,0)<=u&&h.distanceSquared(r.width,r.height)<=u;if(a||(P.i(h),P.i(l)),c){if(!this.Tf){let f=P.l(),p=P.l(),g=this.jo(),y=this.D.r,b=y.length;for(let v=b;v--;){let w=y[v];if(!w.visible&&w!==g)continue;let k=w.actualBounds,S=this.naturalBounds;if(a&&(k.x>S.width||k.y>S.height||k.x+k.width<0||k.y+k.height<0))continue;if(w.Mn()){let L=w.v;f.set(t).Yi(L),p.set(e).Yi(L)}else f.set(t),p.set(e);let N=w,D=w instanceof G?w:null;(D!==null?D.XA(f,p,i,s,n,o):N.$T(f,p,n))&&(i!==null&&(N=i(N)),N!==null&&(s===null||s(N))&&o.add(N))}P.i(f),P.i(p)}return n?c:d}return!1}XN(t){let e=null;if(t instanceof et){e=t.spot1,e===T.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot1)}return e===null&&(e=T.TopLeft),e}GN(t){let e=null;if(t instanceof et){e=t.spot2,e===T.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot2)}return e===null&&(e=T.BottomRight),e}add(...t){for(let e=0;e<t.length;e++)this.insertAt(this.D.count,t[e]);return this}elt(t){return this.D.elt(t)}insertAt(t,e){e instanceof pt&&m.o("Cannot add a Part to a Panel: "+e+"; use a Panel instead"),(this===e||this.isContainedBy(e))&&(this===e&&m.o("Cannot make a Panel contain itself: "+this.toString()),m.o("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+e.toString()));let i=e.panel;if(i!==null&&i!==this&&m.o("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+e.toString()+", already contained by "+i.toString()+", cannot be shared by this Panel: "+this.toString()),this.W===G.Grid&&!(e instanceof et)&&m.o("Can only add Shapes to a Grid Panel, not: "+e),this.W===G.Graduated&&!(e instanceof et||e instanceof lt)&&m.o("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+e),e.Vh(this),e.el=null,this.itemArray!==null){let r=e.data;m.$(r)&&(this._s===null&&(this._s=new Mt),this._s.set(r,e))}let s=this.D,n=-1;if(i===this){let r=-1,a=this.D.r,h=a.length;for(let l=0;l<h;l++)if(a[l]===e){r=l;break}if(r!==-1){if(r===t||r+1>=s.count&&t>=s.count)return;s.removeAt(r),n=r}else m.o("element "+e.toString()+" has panel "+i.toString()+" but is not contained by it.")}(t<0||t>s.count)&&(t=s.count),s.insertAt(t,e),(t===0||e.isPanelMain)&&(this.nl=null),this.Bo()||this.f(),e.f(!1),e.portId!==null?this.Cn=!0:e instanceof G&&e.Cn===!0&&(this.Cn=!0),this.ds=null,this.isEnabledObject()||this.W1(e,!1);let o=this.part;if(o!==null){o.t0(),o.Df(),this.Cn&&o instanceof $&&(o.Cn=!0),o.Cn&&o instanceof $&&(o.ci=null);let r=this.diagram;if(r!==null&&r.undoManager.isUndoingRedoing)return;n!==-1&&o.raiseChangedEvent(4,"elements",this,e,null,n,null),o.raiseChangedEvent(3,"elements",this,null,e,null,t)}}get Cn(){return(this.n&8388608)!==0}set Cn(t){(this.n&8388608)!==0!==t&&(this.n=this.n^8388608)}SN(){return(this.n&16777216)!==0}JN(t){t?this.n|=16777216:this.n&=-16777217}KI(t){t.Vh(this),t.el=null;let e=this.D,i=e.count;e.insertAt(i,t);let s=this.part;if(s!==null){s.t0(),t.portId!==null&&s instanceof $&&(s.Cn=!0);let n=this.diagram;if(n!==null&&n.undoManager.isUndoingRedoing)return;s.raiseChangedEvent(3,"elements",this,null,t,null,i)}}cI(t){let e=this.D.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}return s}remove(t){let e=this.D.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}s!==-1&&this.ri(s,!0)}removeAt(t){t>=0&&this.ri(t,!0)}ri(t,e){let i=this.D,s=i.elt(t);if(s.el=null,s.Vh(null),this._s!==null){let o=s.data;m.$(o)&&this._s.delete(o)}i.removeAt(t),this.xi(!1),this.f(),this.nl===s&&(this.nl=null),this.ds=null;let n=this.part;if(n!==null){n.t0(),n.Df(),n.invalidateAdornments(),n instanceof $&&(s instanceof G?s.walkVisualTreeFrom(s,(r,a)=>n.vN(a,e)):n.vN(s,e));let o=this.diagram;if(o!==null&&o.undoManager.isUndoingRedoing)return;n.raiseChangedEvent(4,"elements",this,s,null,t,null)}}get Zi(){return this.O===null&&(this.O=new ie),this.O.Zi}get rowCount(){return this.O===null?0:this.Zi.length}getRowDefinition(t){t<0&&m.J(t,">= 0",G,"getRowDefinition:idx"),t=Math.round(t);let e=this.Zi;if(e[t]===void 0){let i=new Kt;i.Vh(this),i.isRow=!0,i.index=t,e[t]=i,this.raiseChangedEvent(3,"rowdefs",this,null,i,null,t)}return e[t]}removeRowDefinition(t){if(t<0&&m.J(t,">= 0",G,"removeRowDefinition:idx"),this.rowCount===0)return;t=Math.round(t);let e=this.Zi,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"rowdefs",this,i,null,t,null),this.f()}}xT(t,e){let i=this.Zi;if(!(t<0)){if(i[t]=e instanceof Kt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.f()}}get Qi(){return this.O===null&&(this.O=new ie),this.O.Qi}get columnCount(){return this.O===null?0:this.Qi.length}getColumnDefinition(t){t<0&&m.J(t,">= 0",G,"getColumnDefinition:idx"),t=Math.round(t);let e=this.Qi;if(e[t]===void 0){let i=new Kt;i.Vh(this),i.isRow=!1,i.index=t,e[t]=i,this.raiseChangedEvent(3,"coldefs",this,null,i,null,t)}return e[t]}removeColumnDefinition(t){if(t<0&&m.J(t,">= 0",G,"removeColumnDefinition:idx"),this.columnCount===0)return;t=Math.round(t);let e=this.Qi,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"coldefs",this,i,null,t,null),this.f()}}bT(t,e){let i=this.Qi;if(!(t<0)){if(i[t]=e instanceof Kt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.f()}}addRowColumnDefinition(t){let e=null;return t.isRow?e=this.getRowDefinition(t.index):t.isRow||(e=this.getColumnDefinition(t.index)),e&&e.V1(t),this}addRowDefinition(t,e){let i=this.getRowDefinition(t);return i&&i.V1(new Kt(e)),this}addColumnDefinition(t,e){let i=this.getColumnDefinition(t);return i&&i.V1(new Kt(e)),this}get rowSizing(){return this.O!==null?this.O.I0:3}set rowSizing(t){let e=this.rowSizing;e!==t&&(this.O===null&&(this.O=new ie),this.O.I0=t,this.f(),this.t("rowSizing",e,t))}get columnSizing(){return this.O!==null?this.O.E0:3}set columnSizing(t){let e=this.columnSizing;e!==t&&(this.O===null&&(this.O=new ie),this.O.E0=t,this.f(),this.t("columnSizing",e,t))}get topIndex(){return this.O!==null?this.O.U0:0}set topIndex(t){let e=this.topIndex;e!==t&&((!isFinite(t)||t<0)&&m.o("Panel.topIndex must be greater than zero and a real number, not: "+t),this.O===null&&(this.O=new ie),this.O.U0=t,this.f(),this.t("topIndex",e,t))}get leftIndex(){return this.O!==null?this.O.V0:0}set leftIndex(t){let e=this.leftIndex;e!==t&&((!isFinite(t)||t<0)&&m.o("Panel.leftIndex must be greater than zero and a real number, not: "+t),this.O===null&&(this.O=new ie),this.O.V0=t,this.f(),this.t("leftIndex",e,t))}findRowForLocalY(t){if(t<0||this.type!==G.Table||this.rowCount===0)return-1;let e=0,i=this.Zi,s=i.length,n=this.topIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}findColumnForLocalX(t){if(t<0||this.type!==G.Table||this.columnCount===0)return-1;let e=0,i=this.Qi,s=i.length,n=this.leftIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}graduatedPointForValue(t,e){if(e===void 0&&(e=new P(NaN,NaN)),this.type!==G.Graduated)return e.e(NaN,NaN),e;t=Math.min(Math.max(t,this.graduatedMin),this.graduatedMax);let i=this.findMainElement();return i.geometry.getPointAlongPath((t-this.graduatedMin)/this.graduatedRange,e),i.v.gt(e)}graduatedValueForPoint(t){if(this.type!==G.Graduated)return NaN;let e=this.findMainElement();return e.v.Ci(t),e.geometry.getFractionForPoint(t)*this.graduatedRange+this.graduatedMin}get data(){return this.te}set data(t){let e=this.te;if(e!==t){let i=this instanceof pt&&!(this instanceof vt);i&&m.s(t,"object",G,"data"),this.It(),this.te=t;let s=this.diagram;if(s!==null)if(i){s.partManager.jI(this,e,t);let n=this.adornments;for(;n.next();){let o=n.value,r=o.adornedObject;if(r!==null){let a=r.findBindingPanel();a!==null&&(o.data=a.data)}}}else{let n=this.panel;n!==null&&n._s!==null&&(e!==null&&n._s.delete(e),t!==null&&n._s.set(t,this))}if(this.t("data",e,t),s!==null&&s.undoManager.isUndoingRedoing)return;t!==null&&this.updateTargetBindings()}}get itemIndex(){return this.Rd}set itemIndex(t){let e=this.Rd;e!==t&&(this.Rd=t,this.t("itemIndex",e,t))}get Ds(){return this.w!==null?this.w.Ds:null}set Ds(t){this.ve!==t&&(this.w===null&&(this.w=new Ye),this.w.Ds=t)}FN(){return this.Ds!==null}nD(){let t=this.Ds;return t!==null&&t.u}freezeBindings(){return this.It()}It(){let t=this.Ds;if(t===null)this.data!==null&&m.o("Template cannot have .data be non-null: "+this),this.Ds=t=new q;else if(t.u)return this;let e=new q;this.JN(!1),this.walkVisualTreeFrom(this,(n,o)=>{o.ba();let r=o.ve;if(r!==null){o.AN(!1);let a=r.iterator;for(;a.next();){let h=a.value;h.mode===2&&o.AN(!0);let l=h.sourceName;if(h.isToObject){l==="/"&&n.JN(!0);let u=h.WT(n,o);u!==null&&(e.add(u),u.so===null&&(u.so=new q),u.so.add(h))}t.add(h)}}if(o instanceof G&&o.type===G.Table){if(o.rowCount>0){let a=o.Zi,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.Fs!==null){let c=u.Fs.iterator;for(;c.next();){let d=c.value;d.Ti=u,d.Ed=2,d.vf=u.index,t.add(d)}}}}if(o.columnCount>0){let a=o.Qi,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.Fs!==null){let c=u.Fs.iterator;for(;c.next();){let d=c.value;d.Ti=u,d.Ed=1,d.vf=u.index,t.add(d)}}}}}});let i=e.iterator;for(;i.next();){let n=i.value;if(n.so!==null){n.AN(!0);let o=n.so.iterator;for(;o.next();){let r=o.value;n.ve===null&&(n.ve=new q),n.ve.add(r)}}n.so=null}let s=t.iterator;for(;s.next();){let n=s.value,o=n.Ti;if(o!==null){n.Ti=null;let r=n.targetProperty,a=r.indexOf(".");if(a>0&&o instanceof G){let h=r.substring(0,a),l=r.substring(a+1),u=o.findObject(h);u!==null?(o=u,n.targetProperty=l):(m.ne('Warning: unable to find GraphObject named "'+h+'" for Binding: '+n.toString()),o=null)}if(o instanceof Kt){let h=V.xs(o.panel);n.targetId=h===void 0?-1:h,o.panel.io=n.targetId}else if(o instanceof J){let h=V.xs(o);n.targetId=h===void 0?-1:h,o.io=n.targetId}else m.o("Unknown type of binding target: "+o);n.check(o)}}return t.k(),this instanceof pt&&this.Di()&&this.ensureBounds(),this}static VU=!1;copyTemplate(t){t===void 0&&(t=!1);let e=this.copy();return e.HI(i=>{i instanceof G&&(i.Ds=null,i.te=null);let s=i.ve;s!==null&&(i.ve=null,s.each(o=>i.bind(o.copy())));let n=i.Ts;n!==null&&(i.Ts=null,n.each(o=>i.trigger(o.value.copy())))}),t&&e.It(),e}updateTargetBindings(t){let e=this.Ds;if(e===null)return;t===void 0&&(t="");let i=this.diagram?.model,s=e.iterator;for(;s.next();){let n=s.value,o=this.$N(n,t);if(o===null)continue;let{data:r,elt:a}=o;n.isToTheme&&this.diagram===null||a!==void 0&&n.updateTarget(a,r,void 0,i)}}WI(t){if(t===""){this.updateTargetBindings(t);return}let e=this.Ds;if(e===null)return;let i=this.diagram?.model,s=e.iterator;for(;s.next();){let n=s.value;if(n.isToData&&n.sourceProperty!=="")continue;let o=this.$N(n,"");if(o===null)continue;let{data:r,elt:a}=o;a!==void 0&&n.updateTarget(a,r,void 0,i)}}zo(){if(this.diagram!==null)if(this.FN()){let t=this.diagram.model,e=this.Ds.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=this.$N(i);if(s===null)continue;let{data:n,elt:o}=s;o!==void 0&&i.updateTarget(o,n,void 0,t)}}else{let t=this.D.r,e=t.length;for(let i=0;i<e;i++)t[i].zo()}}$N(t,e=""){let i=t.sourceProperty;if(e!==""&&i!==""&&i!==e)return null;let s=t.targetProperty;if(t.converter===null&&s==="")return null;let n=this.data,o=t.sourceName;if(t.isToObject){if(n=this.jT(o),n===null)return null}else if(t.isToModel){let l=this.diagram;if(l===null)return null;n=l.model.modelData}let r=this,a=t.targetId;if(a!==-1){if(r=this.zp(a),r===null)return null}else t.Ti!==null&&(r=t.Ti);o==="/"?n=r.part:o==="."?n=r:o===".."&&(n=r.panel);let h=t.Ed;if(h!==0){if(!(r instanceof G))return null;h===1?r=r.getColumnDefinition(t.vf):h===2&&(r=r.getRowDefinition(t.vf))}return{data:n,elt:r}}get itemArray(){return this.Ta}set itemArray(t){let e=this.Ta;if(e!==t||t!==null&&this.JI(t)){let i=this.diagram;if(e!==t&&(i!==null&&e!==null&&i.partManager.N2(this,i),this.Ta=t,i!==null&&t!==null&&i.partManager.M2(this,i)),this.t("itemArray",e,t),i!==null&&i.undoManager.isUndoingRedoing)return;this.wD(e,t)}}findItemPanelForData(t){return t==null||this._s===null?null:(m.xc(t,G,"findItemPanelForData"),this._s.get(t))}JI(t){let e=this.D.r,i=e.length,s=t.length,n=0,o=null;for(;n<i&&(o=e[n],!(o instanceof G)||o.data===null);)n++,o=e[n];if(i-n!==s)return!0;if(o===null)return s>0;let r=0;for(;n<i&&r<s;){if(o=e[n],!(o instanceof G)||o.data!==t[r])return!0;n++,r++}return!1}O0(){if(this.type===G.Spot||this.type===G.Auto)return Math.min(this.D.length,1);if(this.type===G.Link){let t=this.D,e=t.length,i=0;for(;i<e;i++){let s=t.elt(i);if(!(s instanceof et)||!s.isPanelMain)return i}return i}if(this.type===G.Table&&this.D.length>0){let t=this.D.elt(0);if(t.isPanelMain&&t instanceof G&&t.il())return 1}return 0}rebuildItemElements(){let t=this.O0();for(;this.D.length>t;)this.ri(this.D.length-1,!1);this.wD(null,this.itemArray)}wD(t,e){let i=this.O0(),s=e;if(s===null||s.length===0){for(;this.D.length>i;)this.ri(this.D.length-1,!1);return}if(this.D.length<=i){let n=s.length;for(let o=0;o<n;o++)this.J1(s[o],o,!0)}else{let n=i;for(let r=0;r<s.length;r++,n++){let a=s[r],h=n<this.D.length?this.D.elt(n):null;if(h instanceof G){if(h.data!==a){let l=this.ZN(h.data,r),u=this.ZN(a,r),c=u!==l;if(!c){let d=this.QN(h.data,r,l);c=this.QN(a,r,u)!==d}c?(this.ri(n,!1),this.J1(a,r,!1)):h.data=a}}else this.J1(a,r,!1)}for(;n<this.D.length;)this.ri(n,!1);this.nl=null,this._N(i,0),this.Bo()||this.f(),this.ds=null,this.isEnabledObject()||this.W1(this,!1);let o=this.part;o!==null&&(o.t0(),o.Df(),this.Cn&&o instanceof $&&(o.Cn=!0),o.Cn&&o instanceof $&&(o.ci=null))}}J1(t,e,i){if(t==null||e<0)return;let s=this.ZN(t,e),n=this.QN(t,e,s);if(n!==null){n.It();let o=n.copy();if(o.SN()){let a=this.findBindingPanel();a!==null&&a.JN(!0)}m.$(t)&&(this._s===null&&(this._s=new Mt),this._s.set(t,o));let r=e+this.O0();this.insertAt(r,o),i&&(o.te=t,this._N(r,e),o.te=null),o.data=t}}$I(t){if(t<0)return;let e=t+this.O0();this.ri(e,!0),this._N(e,t)}_N(t,e){let i=this.D,s=t,n=e;for(;s<i.length;){let o=i.elt(s);o instanceof G&&o.ZI(s,n),s++,n++}}ZI(t,e){this.type===G.TableRow?this.row=t:this.type===G.TableColumn&&(this.column=t),this.itemIndex=e}get itemTemplate(){let t=this.itemTemplateMap;if(t!==null){let e=t.get("");if(e)return e}return G.xD()}set itemTemplate(t){let e=this.itemTemplate;if(e!==t){(t instanceof pt||t.isPanelMain)&&m.o("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+t),this.itemTemplateMap===null&&(this.itemTemplateMap=new Mt),this.itemTemplateMap.set("",t),this.t("itemTemplate",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemTemplateMap(){return this.w!==null?this.w.p0:null}set itemTemplateMap(t){let e=this.itemTemplateMap;if(e!==t){let i=t.iterator;for(;i.next();){let n=i.value}this.Yt().p0=t,this.t("itemTemplateMap",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemCategoryProperty(){return this.w!==null?this.w.y0:"category"}set itemCategoryProperty(t){let e=this.itemCategoryProperty;e!==t&&(typeof t!="string"&&!m.it(t)&&m.si(t,"string or function",G,"itemCategoryProperty"),this.Yt().y0=t,this.t("itemCategoryProperty",e,t))}ZN(t,e){if(t===null)return"";let i=this.itemCategoryProperty,s="";if(m.it(i))s=i(t);else if(typeof i=="string"&&m.$(t)){if(i==="")return"";let n=this.diagram,o=n!==null?n.model:null;o?s=o.Lt(t,i):s=ut.Lt(t,i)}else return"";if(s===void 0)return"";if(typeof s=="string")return s;m.o("Panel.getCategoryForItemData found a non-string category for "+t+": "+s)}static bD=!1;static tC;static xD(){return G.tC||(G.tC=new G().add(new lt().bind("text","",m.toString).theme("stroke","text"))),G.tC}QN(t,e,i){let s=null,n=this.itemTemplateMap;return n!==null&&(s=n.get(i),s===null&&(s=n.get(""))),s===null&&(G.bD||(G.bD=!0,m.ne('No item template Panel found for category "'+i+'" on '+this),m.ne(" Using default item template.")),s=G.xD()),s}get Tf(){return(this.n&1048576)!==0}set Tf(t){let e=(this.n&1048576)!==0;e!==t&&(m.s(t,"boolean",G,"isAtomic"),this.n=this.n^1048576,this.t("isAtomic",e,t))}get isClipping(){return(this.n&2097152)!==0}set isClipping(t){let e=(this.n&2097152)!==0;e!==t&&(this.xf(),this.n=this.n^2097152,this instanceof ht&&(this.he=null),this.f(),this.t("isClipping",e,t))}get isOpposite(){return(this.n&33554432)!==0}set isOpposite(t){let e=(this.n&33554432)!==0;e!==t&&(this.n=this.n^33554432,this.f(),this.t("isOpposite",e,t))}get isEnabled(){return(this.n&4194304)!==0}set isEnabled(t){let e=(this.n&4194304)!==0;if(e!==t){let i=this.panel===null||this.panel.isEnabledObject();this.n=this.n^4194304,this.t("isEnabled",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;i&&this.W1(this,t)}}W1(t,e){let i=t.enabledChanged;if(i!==null&&i(t,e),t instanceof G){let s=t.D.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];e&&r instanceof G&&!r.isEnabled||this.W1(r,e)}}}get alignmentFocusName(){return this.ho}set alignmentFocusName(t){let e=this.ho;e!==t&&(this.ho=t,this.f(),this.t("alignmentFocusName",e,t))}static definePanelLayout(t,e){Lt.An(t,e)}static isLayoutDefined(t){return Lt.fs.has(t)}static Position=Lt.fs.get("Position");static Horizontal=Lt.fs.get("Horizontal");static Vertical=Lt.fs.get("Vertical");static Spot=Lt.fs.get("Spot");static Auto=Lt.fs.get("Auto");static Table=Lt.fs.get("Table");static Viewbox=Lt.fs.get("Viewbox");static TableRow=Lt.fs.get("TableRow");static TableColumn=Lt.fs.get("TableColumn");static Link=Lt.fs.get("Link");static Grid=Lt.fs.get("Grid");static Graduated=Lt.fs.get("Graduated")}G.definePanelLayout=G.definePanelLayout;class Pe{D0;v0;F0;R0;vs;_i;ds;vi;constructor(){this.D0=0,this.v0=100,this.F0=10,this.R0=0,this.vs=null,this._i=null,this.ds=null,this.vi=null}copy(){let t=new Pe;return t.D0=this.D0,t.v0=this.v0,t.F0=this.F0,t.R0=this.R0,t.vs=this.vs,t._i=this._i,t.ds=this.ds,t.vi=this.vi,t}}class ti{Od;Id;hf;P0;constructor(){this.Od=st.OL,this.Id=P.dn,this.hf=st.Ww,this.P0=[]}copy(){let t=new ti;return t.Od=this.Od.copy(),t.Id=this.Id.copy(),t.hf=this.hf.copy(),t.P0=this.P0,t}}class ie{Zi;Qi;I0;E0;U0;V0;S0;N0;M0;C0;A0;L0;T0;Aa;constructor(){this.Zi=[],this.Qi=[],this.I0=3,this.E0=3,this.U0=0,this.V0=0,this.S0=Dt.em,this.N0=1,this.M0=null,this.C0=null,this.A0=1,this.L0=null,this.T0=null,this.Aa=null}copy(t){let e=new ie,i=this.Zi,s=i.length,n=e.Zi;for(let h=0;h<s;h++){let l=i[h];if(l===void 0)continue;let u=l.copy();u.Vh(t),n[h]=u}let o=this.Qi,r=o.length,a=e.Qi;for(let h=0;h<r;h++){let l=o[h];if(l===void 0)continue;let u=l.copy();u.Vh(t),a[h]=u}return e.I0=this.I0,e.E0=this.E0,e.U0=this.U0,e.V0=this.V0,e.S0=this.S0.N(),e.N0=this.N0,e.M0=this.M0,e.C0=this.C0,e.A0=this.A0,e.L0=this.L0,e.T0=this.T0,e.Aa=this.Aa,e}}var zi=(x=>(x[x.Default=1]="Default",x[x.None=2]="None",x[x.ProportionalExtra=3]="ProportionalExtra",x))(zi||{});class Kt{$s;B0;Tt;Gh;Yh;de;ct;Ud;ro;ol;Vd;Bd;Kh;Ct;zd;Fs;q;Re;ki;constructor(t){V.Je(this),this.$s=null,this.B0=!0,this.Tt=0,this.ki=NaN,this.Gh=0,this.Yh=1/0,this.de=T.Default,this.q=0,this.Re=0,this.ct=0,this.Fs=null,this.Ud=1,this.ro=1,this.ol=null,this.Vd=null,this.Bd=NaN,this.Kh=null,this.Ct=null,this.zd=!1,t&&(Object.assign(this,t),t.column!==void 0?(this.isRow=!1,this.index=t.column):t.row!==void 0&&(this.isRow=!0,this.index=t.row))}copy(){let t=new Kt;return t.B0=this.B0,t.Tt=this.Tt,t.ki=this.ki,t.Gh=this.Gh,t.Yh=this.Yh,t.de=this.de,t.q=this.q,t.Re=this.Re,t.ct=this.ct,t.ro=this.ro,t.Ud=this.Ud,this.ol===null?t.ol=null:t.ol=this.ol.N(),t.Vd=this.Vd,t.Bd=this.Bd,t.Kh=null,this.Kh!==null&&(t.separatorDashArray=this.Kh.slice()),t.Ct=this.Ct,t.zd=this.zd,t.Fs=this.Fs,t}V1(t){t.isRow?t.height!==void 0&&(this.height=t.height):t.width!==void 0&&(this.width=t.width),t.minimum!==void 0&&(this.minimum=t.minimum),t.maximum!==void 0&&(this.maximum=t.maximum),t.alignment!==void 0&&(this.alignment=t.alignment),t.stretch!==void 0&&(this.stretch=t.stretch),t.sizing!==void 0&&(this.sizing=t.sizing),t.separatorPadding!==void 0&&(this.separatorPadding=t.separatorPadding),t.separatorStroke!==void 0&&(this.separatorStroke=t.separatorStroke),t.separatorStrokeWidth!==void 0&&(this.separatorStrokeWidth=t.separatorStrokeWidth),t.separatorDashArray!==void 0&&(this.Kh=t.separatorDashArray),t.background!==void 0&&(this.background=t.background),t.coversSeparators!==void 0&&(this.coversSeparators=t.coversSeparators),t.Fs!==void 0&&(this.Fs=t.Fs)}fe(t){t in zi?this.sizing=t:m.cr(this,t)}toString(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+V.xs(this)}static Default=1;static None=2;static ProportionalExtra=3;Vh(t){this.$s=t}computeEffectiveSpacingTop(t){let e=0,i=this.$s;if(this.index!==t){let n=this.separatorStroke;n===null&&i!==null&&(n=this.isRow?i.defaultRowSeparatorStroke:i.defaultColumnSeparatorStroke),n!==null&&(e=this.separatorStrokeWidth,isNaN(e)&&(i!==null?e=this.isRow?i.defaultRowSeparatorStrokeWidth:i.defaultColumnSeparatorStrokeWidth:e=0))}let s=this.ol;if(s===null)if(i!==null)s=i.defaultSeparatorPadding;else return e;return e+(this.isRow?s.top:s.left)}computeEffectiveSpacing(){let t=0,e=this.$s,i=0,s=this.isRow;if(e!==null&&e.type===G.Table){let o=s?e.Zi.length:e.Qi.length;for(let r=0;r<o;r++){let a=s?e.Zi[r]:e.Qi[r];if(a!==void 0&&a.q!==0){i=a.index;break}}}if(this.index!==i){let o=this.separatorStroke;o===null&&e!==null&&(o=s?e.defaultRowSeparatorStroke:e.defaultColumnSeparatorStroke),o!==null&&(t=this.separatorStrokeWidth,isNaN(t)&&(e!==null?t=s?e.defaultRowSeparatorStrokeWidth:e.defaultColumnSeparatorStrokeWidth:t=0))}let n=this.ol;if(n===null)if(e!==null)n=e.defaultSeparatorPadding;else return t;return t+(this.isRow?n.top+n.bottom:n.left+n.right)}t(t,e,i,s,n){let o=this.$s;if(o!==null&&(o.raiseChangedEvent(2,t,this,e,i,s,n),this.Fs!==null)){let r=o.diagram;if(r!==null&&!r.wi){let a=o.findBindingPanel();if(a!==null){let h=a.data;if(h!==null){let l=this.Fs.iterator;for(;l.next();)l.value.updateSource(this,h,t,a)}}}}}get panel(){return this.$s}get isRow(){return this.B0}set isRow(t){this.B0=t}get index(){return this.Tt}set index(t){this.Tt=t}get height(){return this.ki}set height(t){let e=this.ki;e!==t&&(t<0&&m.J(t,">= 0",Kt,"height"),this.ki=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("height",e,t))}get width(){return this.ki}set width(t){let e=this.ki;e!==t&&(t<0&&m.J(t,">= 0",Kt,"width"),this.ki=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("width",e,t))}get minimum(){return this.Gh}set minimum(t){let e=this.Gh;e!==t&&((t<0||!isFinite(t))&&m.J(t,">= 0",Kt,"minimum"),this.Gh=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("minimum",e,t))}get maximum(){return this.Yh}set maximum(t){let e=this.Yh;e!==t&&(t<0&&m.J(t,">= 0",Kt,"maximum"),this.Yh=t,this.actual=this.q,this.panel!==null&&this.panel.f(),this.t("maximum",e,t))}get alignment(){return this.de}set alignment(t){let e=this.de;e.equals(t)||(this.de=t.N(),this.panel!==null&&this.panel.f(),this.t("alignment",e,t))}get stretch(){return this.ro}set stretch(t){let e=this.ro;e!==t&&(this.ro=t,this.panel!==null&&this.panel.f(),this.t("stretch",e,t))}get separatorPadding(){return this.ol}set separatorPadding(t){typeof t=="number"&&(t=new Dt(t));let e=this.ol;(t===null||e===null||!e.equals(t))&&(t!==null&&(t=t.N()),this.ol=t,this.panel!==null&&this.panel.f(),this.t("separatorPadding",e,t))}get separatorStroke(){return this.Vd}set separatorStroke(t){let e=this.Vd;e!==t&&(t!==null&&R.Nd(t,"RowColumnDefinition.separatorStroke"),t instanceof R&&t.k(),this.Vd=t,this.panel!==null&&this.panel.f(),this.t("separatorStroke",e,t))}get separatorStrokeWidth(){return this.Bd}set separatorStrokeWidth(t){let e=this.Bd;e!==t&&(this.Bd=t,this.panel!==null&&this.panel.f(),this.t("separatorStrokeWidth",e,t))}get separatorDashArray(){return this.Kh}set separatorDashArray(t){let e=this.Kh;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",Kt,"separatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&m.o("separatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Kh=t,this.panel!==null&&this.panel.C(),this.t("separatorDashArray",e,t)}}get background(){return this.Ct}set background(t){let e=this.Ct;e!==t&&(t!==null&&R.Nd(t,"RowColumnDefinition.background"),t instanceof R&&t.k(),this.Ct=t,this.panel!==null&&this.panel.C(),this.t("background",e,t))}get coversSeparators(){return this.zd}set coversSeparators(t){let e=this.zd;e!==t&&(m.s(t,"boolean",Kt,"coversSeparators"),this.zd=t,this.panel!==null&&this.panel.C(),this.t("coversSeparators",e,t))}get sizing(){return this.Ud}set sizing(t){let e=this.Ud;e!==t&&(this.Ud=t,this.panel!==null&&this.panel.f(),this.t("sizing",e,t))}K1(){if(this.sizing===1){let t=this.$s;return t===null?2:this.isRow?t.rowSizing:t.columnSizing}return this.sizing}get actual(){return this.q}set actual(t){isNaN(this.ki)?this.q=Math.max(Math.min(this.Yh,t),this.Gh):this.q=Math.max(Math.min(this.Yh,this.ki),this.Gh)}get measured(){return this.Re}set measured(t){this.Re=t}get total(){return this.q+this.computeEffectiveSpacing()}get position(){return this.ct}set position(t){this.ct=t}bind(t,e,i,s){return this.Sf(t,e,i,s),this}bindTwoWay(t,e,i,s){let n=this.Sf(t,e,i,s);return s===void 0&&n.makeTwoWay(),this}theme(t,e,i,s,n){return this.Ca(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.Ca(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.Ca(t,e,i,s,n).ofModel(),this}Sf(t,e,i,s){let n;return typeof t=="string"?n=new te(t,e,i,s):n=t,this.m0(n),n}Ca(t,e,i,s,n){let o;return typeof t=="string"?o=new ii(t,e,i,s,n):o=t,this.m0(o),o}m0(t){t.Ti=this;let e=this.panel;if(e!==null){let i=e.findBindingPanel();i!==null&&i.nD()&&m.o("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+t+" on "+e)}this.Fs===null&&(this.Fs=new q),this.Fs.add(t)}}class et extends J{ut;tn;Xd;Hh;Qe;Jo;Ho;Kt;Gd;Yd;K;constructor(t,e){super(),this.ut=null,this.tn=null,this.Xd="None",this.Hh="black",this.Qe="black",this.Jo=1,this.Ho=null,this.Kt=null,this.Gd=NaN,this.Yd=NaN,this.K=null,typeof t=="string"?this.figure=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.ut=this.ut,t.tn=this.tn,t.Xd=this.Xd,t.Hh=this.Hh,t.Qe=this.Qe,t.Jo=this.Jo,this.Ho!==null&&(t.Ho=this.Ho.slice()),this.Kt!==null&&(this.Kt.me?t.Kt=this.Kt:t.Kt=this.Kt.copy()),t.Gd=this.Gd,t.Yd=this.Yd,this.K!==null&&(t.K=this.K.copy())}qh(){return this.Kt===null?this.Kt=new Xi:this.Kt.me&&(this.Kt=this.Kt.copy()),this.Kt}ba(){super.ba(),this.Kt!==null&&(this.Kt.me=!0)}fe(t){t in Ri?this.geometryStretch=t:super.fe(t)}toString(){return"Shape("+(this.figure!=="None"?this.figure:this.toArrow!=="None"?this.toArrow:this.fromArrow)+")#"+V.xs(this)}QI(t,e){let i=this.pathPattern;if(i===null)return;i.ht(1/0,1/0);let s=i.measuredBounds;i.Ut(0,0,s.width,s.height);let n=this.geometry;if(n===null)return;t.save(),t.beginPath();let o=m.st();if(n.type===1)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.endY),this.Kd(t,e,o,i);else if(n.type===4){let r=n.figures.iterator;for(;r.next();){let a=r.value;o.length=0,o.push(a.startX),o.push(a.startY);let h=a.startX,l=a.startY,u=h,c=l,d=a.segments.r,f=d.length;for(let p=0;p<f;p++){let g=d[p];switch(g.type){case 1:this.Kd(t,e,o,i),o.length=0,o.push(g.endX),o.push(g.endY),h=g.endX,l=g.endY,u=h,c=l;break;case 2:o.push(g.endX),o.push(g.endY),h=g.endX,l=g.endY;break;case 3:C.Hn(h,l,g.point1X,g.point1Y,g.point2X,g.point2Y,g.endX,g.endY,.5,o),h=g.endX,l=g.endY;break;case 4:C.sm(h,l,g.point1X,g.point1Y,g.endX,g.endY,.5,o),h=g.endX,l=g.endY;break;case 5:{let y=g.To(a),b=y.length;if(b===0){o.push(g.centerX),o.push(g.centerY),h=g.centerX,l=g.centerY;break}for(let v=0;v<b;v++){let w=y[v];C.Hn(h,l,w[2],w[3],w[4],w[5],w[6],w[7],.5,o),h=w[6],l=w[7]}break}case 6:{let y=g.Za(a,h,l),b=y.length;if(b===0){o.push(g.endX),o.push(g.endY),h=g.endX,l=g.endY;break}for(let v=0;v<b;v++){let w=y[v];C.Hn(h,l,w[2],w[3],w[4],w[5],w[6],w[7],.5,o),h=w[6],l=w[7]}break}default:m.o("Segment not of valid type: "+g.type)}g.isClosed&&(o.push(u),o.push(c),this.Kd(t,e,o,i))}this.Kd(t,e,o,i)}}else if(n.type===2)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.startY),o.push(n.endX),o.push(n.endY),o.push(n.startX),o.push(n.endY),o.push(n.startX),o.push(n.startY),this.Kd(t,e,o,i);else if(n.type===3){let r=new zt;r.startX=n.endX,r.startY=(n.startY+n.endY)/2;let a=new mt(5);a.startAngle=0,a.sweepAngle=360,a.centerX=(n.startX+n.endX)/2,a.centerY=(n.startY+n.endY)/2,a.radiusX=Math.abs(n.startX-n.endX)/2,a.radiusY=Math.abs(n.startY-n.endY)/2,r.add(a);let h=a.To(r),l=h.length;if(l===0)o.push(a.centerX),o.push(a.centerY);else{let u=r.startX,c=r.startY;for(let d=0;d<l;d++){let f=h[d];C.Hn(u,c,f[2],f[3],f[4],f[5],f[6],f[7],.5,o),u=f[6],c=f[7]}}this.Kd(t,e,o,i)}m.Z(o),t.restore(),t.clearContextCache(!1)}_I(t){let e=t.measuredBounds.width;return t instanceof et&&(e-=t.strokeWidth),e<1&&(e=1),e}Kd(t,e,i,s){let n=i.length;if(n<4)return;let o=s.measuredBounds,r=Math.max(1,o.width),a=o.height,h=i[0],l=i[1],u=0,c=0,d=0,f=0,p=0,g=0,y=0,b=0,v=m.st();for(let A=2;A<n;A+=2)u=i[A],c=i[A+1],d=u-h,f=c-l,d===0&&(d=.001),p=f/d,g=Math.atan2(f,d),y=Math.sqrt(d*d+f*f),v.push([d,g,p,y]),b+=y,h=u,l=c;h=i[0],l=i[1];let w=this._I(s),k=w,S=r/2,N=S!==0,D=0,L=v[D];d=L[0],g=L[1],p=L[2],y=L[3];let M=0;for(;b>=.1;){if(M===0&&(N?(k=w,k-=S,b-=S,N=!1):k=w,k===0&&(k=1)),k>b){k=b,m.Z(v);return}k>y?(M=k-y,k=y):M=0;let A=Math.sqrt(k*k/(1+p*p));if(d<0&&(A=-A),h+=A,l+=p*A,t.translate(h,l),t.rotate(g),t.translate(-(r/2),-(a/2)),M===0&&s.Ma(t,e),t.translate(r/2,a/2),t.rotate(-g),t.translate(-h,-l),b-=k,y-=k,M!==0){if(D++,D===v.length){m.Z(v);return}L=v[D],d=L[0],g=L[1],p=L[2],y=L[3],k=M}}m.Z(v)}Ma(t,e){let i=t instanceof re,s=this.Qe,n=this.Hh;if(s===null&&n===null)return;let o=this.ut;if(o===null)return;t.commitTransform();let r=this.actualBounds,a=this.naturalBounds;n!==null&&this.bn(t,n,!0,!1,a,r);let h=this.part,l=this.Jo;s!==null&&l===0&&h!==null&&(this.isPanelMain||h.findMainElement()===this)&&(l=h.tE()),l===0&&(s=null),s!==null&&l!==0&&(this.bn(t,s,!1,!1,a,r),t.lineWidth=l,t.lineJoin=this.strokeJoin,t.lineCap=this.strokeCap,t.miterLimit=this.strokeMiterLimit);let u=!1;h&&e.getRenderingHint("drawShadows")&&(u=h.isShadowed),t.sl===!1&&(u=!1);let c=!0;s!==null&&(n===null||n==="transparent")&&(c=!1);let d=!1,f=this.strokeDashArray;if(f!==null&&(d=!0,t.enableDash(f,this.strokeDashOffset)),o.type===1)t.beginPath(),t.moveTo(o.startX,o.startY),t.lineTo(o.endX,o.endY),s!==null&&t.strokeContext(),t.endPath();else if(o.type===2){let p=o.startX,g=o.startY,y=o.endX,b=o.endY,v=Math.min(p,y),w=Math.min(g,b),k=Math.abs(y-p),S=Math.abs(b-g);t.beginPath(),t.rect(v,w,k,S),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===3){let p=o.startX,g=o.startY,y=o.endX,b=o.endY,v=Math.abs(y-p)/2,w=Math.abs(b-g)/2,k=Math.min(p,y)+v,S=Math.min(g,b)+w;t.beginPath(),t.moveTo(k,S-w),t.bezierCurveTo(k+C.Kn*v,S-w,k+v,S-C.Kn*w,k+v,S),t.bezierCurveTo(k+v,S+C.Kn*w,k+C.Kn*v,S+w,k,S+w),t.bezierCurveTo(k-C.Kn*v,S+w,k-v,S+C.Kn*w,k-v,S),t.bezierCurveTo(k-v,S-C.Kn*w,k-C.Kn*v,S-w,k,S-w),t.closePath(),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===4){let p=o.figures,g=p.length;for(let y=0;y<g;y++){let b=p.r[y];i?(t.beginPath(),this.kD(t,b)):b.Hi===null&&(b.Hi=new Path2D,this.kD(b.Hi,b));let v=b.isFilled;u?b.isShadowed?(v===!0&&n!=="transparent"&&n!==null&&t.fillContext(n,b.isEvenOdd,b.Hi),s!==null&&(v&&c&&t.shadowsOff(),t.stroke(b.Hi),v&&c&&t.shadowsOn())):(t.shadowsOff(),v&&n!=="transparent"&&n!==null&&t.fillContext(n,b.isEvenOdd,b.Hi),s!==null&&t.stroke(b.Hi),t.shadowsOn()):(v&&n!==null&&t.fillContext(n,b.isEvenOdd,b.Hi),s!==null&&t.stroke(b.Hi)),t.endPath(y)}}d&&t.disableDash(),this.QI(t,e)}kD(t,e){t.moveTo(e.startX,e.startY);let i=e.segments.r,s=i.length,n=null;for(let o=0;o<s;o++){let r=i[o];switch(r.type){case 1:t.moveTo(r.endX,r.endY);break;case 2:t.lineTo(r.endX,r.endY);break;case 3:t.bezierCurveTo(r.point1X,r.point1Y,r.point2X,r.point2Y,r.endX,r.endY);break;case 4:t.quadraticCurveTo(r.point1X,r.point1Y,r.endX,r.endY);break;case 5:if(r.radiusX===r.radiusY){let a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY,l=Math.PI/180;t.arc(r.point1X,r.point1Y,r.radiusX,r.startAngle*l,(r.startAngle+r.sweepAngle)*l,r.sweepAngle<0,a,h)}else{let a=r.To(e),h=a.length;if(h===0){t.lineTo(r.centerX,r.centerY);break}for(let l=0;l<h;l++){let u=a[l];l===0&&t.lineTo(u[0],u[1]),t.bezierCurveTo(u[2],u[3],u[4],u[5],u[6],u[7])}}break;case 6:{let a=0,h=0,l;if(n!==null&&n.type===5){l=n.To(e);let c=l.length;if(c===0){t.lineTo(r.endX,r.endY);break}let d=l[c-1]||null;d!==null&&(a=d[6],h=d[7])}else a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY;l=r.Za(e,a,h);let u=l.length;if(u===0){t.lineTo(r.endX,r.endY);break}for(let c=0;c<u;c++){let d=l[c];t.bezierCurveTo(d[2],d[3],d[4],d[5],d[6],d[7])}break}}r.isClosed&&t.closePath(),n=r}}wf(t,e,i){if(!super.wf(t,e,i)||this.Qe===null&&this.Hh===null||this.ut===null||this.pathPattern!==null)return!1;let s=this.svg.getElementsByTagName("path");return this.geometry.figures.length!==s.length?!1:(t.currentPath=this.svg,this.Ma(t,e),t.currentPath=null,!0)}Sd(t){return this.geometry!==null&&this.geometry.figures.length>1||this.pathPattern!==null?!0:super.Sd(t)}CN(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("path");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof T){let i=t;i.isNoSpot()&&m.o("getDocumentPoint Spot must be a real, specific Spot, not: "+i.toString());let s=this.naturalBounds,n=this.strokeWidth;return e.e(i.x*(s.width+n)-n/2+s.x+i.offsetX,i.y*(s.height+n)-n/2+s.y+i.offsetY),this.Ws.gt(e),e}else return e.set(t),this.Ws.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new I);let e=this.naturalBounds,i=this.Ws,s=I.z(e.x,e.y,e.width,e.height),n=this.strokeWidth;s.inflate(n/2,n/2);let o=P.z(s.x,s.y).v(i);return t.e(o.x,o.y,0,0),o.e(s.right,s.y).v(i),t.re(o.x,o.y,0,0),o.e(s.right,s.bottom).v(i),t.re(o.x,o.y,0,0),o.e(s.x,s.bottom).v(i),t.re(o.x,o.y,0,0),I.i(s),P.i(o),t}ka(t,e){let i=this.geometry;if(i===null||this.fill===null&&this.stroke===null)return!1;let s=i.bounds,n=this.strokeWidth/2;i.type===1&&!e&&(n+=2);let o=I.l();if(o.h(s),o.inflate(n+2,n+2),!o.containsPoint(t))return I.i(o),!1;let r=n+1e-4;if(i.type===1){if(this.stroke===null)return!1;let a=(i.startX-i.endX)*(t.x-i.endX)+(i.startY-i.endY)*(t.y-i.endY),h=(i.endX-i.startX)*(t.x-i.startX)+(i.endY-i.startY)*(t.y-i.startY);return a<0||h<0?!1:(I.i(o),C.Ve(i.startX,i.startY,i.endX,i.endY,n,t.x,t.y))}else if(i.type===2){let a=i.startX,h=i.startY,l=i.endX,u=i.endY;if(o.x=Math.min(a,l),o.y=Math.min(h,u),o.width=Math.abs(l-a),o.height=Math.abs(u-h),this.fill===null){if(o.inflate(-r,-r),o.containsPoint(t))return I.i(o),!1;o.inflate(r,r)}this.stroke!==null&&o.inflate(n,n);let c=o.containsPoint(t);return I.i(o),c}else if(i.type===3){let a=i.startX,h=i.startY,l=i.endX,u=i.endY,c=Math.min(a,l),d=Math.min(h,u),f=Math.abs(l-a),p=Math.abs(u-h),g=f/2,y=p/2;if(c=t.x-(c+g),d=t.y-(d+y),this.fill===null){if(g-=r,y-=r,g<=0||y<=0||c*c/(g*g)+d*d/(y*y)<=1)return I.i(o),!1;g+=r,y+=r}return this.stroke!==null&&(g+=r,y+=r),I.i(o),g<=0||y<=0?!1:c*c/(g*g)+d*d/(y*y)<=1}else{if(i.type===4)return I.i(o),this.fill===null?i.ZL(t.x,t.y,n):i.IP(t,n,this.strokeWidth>1,e);m.o("Unknown Geometry type: "+i.type)}}kd(t,e,i,s){let n=this.desiredSize,o=this.Jo;t=Math.max(t,0),e=Math.max(e,0);let r;if(this.tn!==null)r=this.geometry.bounds;else{let p=this.figure,g=et.eC[p];if(g===void 0){let y=C.qn[p];typeof y=="string"&&(y=C.qn[y]),m.it(y)?(g=y(null,100,100),et.eC[p]=g):m.o("Unsupported Figure: "+p)}r=g.bounds}let a=r.width,h=r.height,l=r.width,u=r.height;switch(this.Zs(!0)){case 0:i=0,s=0;break;case 2:l=Math.max(t-o,0),u=Math.max(e-o,0);break;case 5:l=Math.max(t-o,0),s=0;break;case 4:i=0,u=Math.max(e-o,0);break}isFinite(n.width)&&(l=n.width),isFinite(n.height)&&(u=n.height);let c=this.maxSize,d=this.minSize;i=Math.max(i-o,d.width),s=Math.max(s-o,d.height),l=Math.min(c.width,l),u=Math.min(c.height,u),l=isFinite(l)?Math.max(i,l):Math.max(a,i),u=isFinite(u)?Math.max(s,u):Math.max(h,s);let f=this.QS();switch(f){case 0:break;case 2:a=l,h=u;break;case 6:{let p=Math.min(l/a,u/h);isFinite(p)||(p=1),a=a*p,h=h*p;break}default:m.o(f+" is not a valid geometryStretch.")}if(this.tn!==null){a===0&&(a=.001),h===0&&(h=.001);let p=this.tn.sR(a,h);this.ut=p}else(this.ut===null||!C.X(this.ut.Sc,t-o)||!C.X(this.ut.Mc,e-o))&&(this.ut=et.eE(this,a,h));r=this.ut.bounds,t===1/0||e===1/0?this.no(r.x-o/2,r.y-o/2,t===0&&a===0?0:r.width+o,e===0&&h===0?0:r.height+o):this.no(-(o/2),-(o/2),l+o,u+o),n.isReal()?(l=n.width,u=n.height,l=Math.min(c.width,l),u=Math.min(c.height,u),l=Math.max(d.width,l),u=Math.max(d.height,u),this.Ke.e(0,0,l,u)):this.Ke.h(r)}QS(){let t=this.geometryStretch;return this.tn!==null?t===1?2:t:t===1?et.eC[this.figure].defaultStretch:t}Pa(t,e,i,s){this.commonArrange(t,e,i,s)}getNearestIntersectionPoint(t,e,i){return this.pf(t.x,t.y,e.x,e.y,i)}pf(t,e,i,s,n){let o=this.v,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),f=t*a+e*l+c,p=t*h+e*u+d,g=i*a+s*l+c,y=i*h+s*u+d,b=this.Jo/2,v=this.ut;v===null&&(this.ht(1/0,1/0),v=this.ut);let w=v.bounds,k=!1;if(v.type===1)if(this.strokeWidth<=1.5)k=C.Ao(v.startX,v.startY,v.endX,v.endY,f,p,g,y,n);else{let S=0,N=0;if(v.startX===v.endX)S=b,N=0;else{let F=(v.endY-v.startY)/(v.endX-v.startX);N=b/Math.sqrt(1+F*F),S=N*F}let D=m.st(),L=new P;C.Ao(v.startX+S,v.startY+N,v.endX+S,v.endY+N,f,p,g,y,L)&&D.push(L),L=new P,C.Ao(v.startX-S,v.startY-N,v.endX-S,v.endY-N,f,p,g,y,L)&&D.push(L),L=new P,C.Ao(v.startX+S,v.startY+N,v.startX-S,v.startY-N,f,p,g,y,L)&&D.push(L),L=new P,C.Ao(v.endX+S,v.endY+N,v.endX-S,v.endY-N,f,p,g,y,L)&&D.push(L);let M=D.length;if(M===0)return m.Z(D),!1;k=!0;let A=1/0;for(let F=0;F<M;F++){let O=D[F],E=(O.x-f)**2+(O.y-p)**2;E<A&&(A=E,n.x=O.x,n.y=O.y)}m.Z(D)}else if(v.type===2)k=C.Cl(w.x-b,w.y-b,w.x+w.width+b,w.y+w.height+b,f,p,g,y,n);else if(v.type===3){let S=I.z(w.x,w.y,w.width,w.height).inflate(b,b);k=this.iE(S,f,p,g,y,n),I.i(S)}else if(v.type===4){let S=0,N=0,D=0,L=0,M=P.l(),A=g-f,F=y-p,O=A*A+F*F,E=f,B=p;if(O>0&&w.contains(E,B)&&(M.x=E,M.y=B,this.containsPoint(M)))for(A!==0&&Math.abs(A)<.5?(F*=.5/A,A=.5):F!==0&&Math.abs(F)<.5&&(A*=.5/F,F=.5),E-=A,B-=F;w.contains(E,B);)E-=A,B-=F;let X=.6;n.x=g,n.y=y;for(let nt=0;nt<v.figures.count;nt++){let Z=v.figures.r[nt],it=Z.isFilled?E:f,_=Z.isFilled?B:p,at=Z.segments;S=Z.startX,N=Z.startY;let ct=S,xt=N;for(let Ct=0;Ct<at.count;Ct++){let Q=at.r[Ct],Pt=Q.type;D=Q.endX,L=Q.endY;let bt=!1;switch(Pt){case 1:ct=D,xt=L;break;case 2:bt=this.$1(S,N,D,L,it,_,g,y,M);break;case 3:{bt=C.nm(S,N,Q.point1X,Q.point1Y,Q.point2X,Q.point2Y,D,L,it,_,g,y,X,M);break}case 4:{bt=C.nm(S,N,S+2/3*(Q.point1X-S),N+2/3*(Q.point1Y-N),D+2/3*(Q.point1X-D),L+2/3*(Q.point1Y-L),D,L,it,_,g,y,X,M);break}case 5:case 6:{let Yt=Q.type===5?Q.To(Z):Q.Za(Z,S,N),ot=Yt.length;if(ot===0){bt=this.$1(S,N,Q.type===5?Q.centerX:Q.endX,Q.type===5?Q.centerY:Q.endY,it,_,g,y,M);break}let W=null;for(let ft=0;ft<ot;ft++){if(W=Yt[ft],ft===0&&this.$1(S,N,W[0],W[1],it,_,g,y,M)){let At=this.Z1(it,_,M,O,n);At<O&&(O=At,k=!0)}if(C.nm(W[0],W[1],W[2],W[3],W[4],W[5],W[6],W[7],it,_,g,y,X,M)){let At=this.Z1(it,_,M,O,n);At<O&&(O=At,k=!0)}}D=W[6],L=W[7];break}default:m.o("Unknown Segment type: "+Pt)}if(S=D,N=L,bt){let Yt=this.Z1(it,_,M,O,n);Yt<O&&(O=Yt,k=!0)}if(Q.isClosed&&(D=ct,L=xt,this.$1(S,N,D,L,it,_,g,y,M))){let Yt=this.Z1(it,_,M,O,n);Yt<O&&(O=Yt,k=!0)}}}let z=i-t,U=s-e,tt=Math.sqrt(z*z+U*U);tt!==0&&(z/=tt,U/=tt),n.x-=z*b,n.y-=U*b,P.i(M)}else m.o("Unknown Geometry type: "+v.type);return k?(this.v.gt(n),!0):!1}Z1(t,e,i,s,n){let o=i.x-t,r=i.y-e,a=o*o+r*r;return a<s?(n.x=i.x,n.y=i.y,a):s}$1(t,e,i,s,n,o,r,a,h){if(C.X(t,i)&&C.X(e,s)||C.X(n,r)&&C.X(o,a))return!1;let l=!1,u=(n-r)*(e-s)-(o-a)*(t-i);if(u===0)return!1;if(h.x=((n*a-o*r)*(t-i)-(n-r)*(t*s-e*i))/u,h.y=((n*a-o*r)*(e-s)-(o-a)*(t*s-e*i))/u,(t>i?t-i:i-t)<(e>s?e-s:s-e)){let c=e<s?e:s,d=e<s?s:e;(h.y>c||C.X(h.y,c))&&(h.y<d||C.X(h.y,d))&&(l=!0)}else{let c=t<i?t:i,d=t<i?i:t;(h.x>c||C.X(h.x,c))&&(h.x<d||C.X(h.x,d))&&(l=!0)}return l}sE(t,e,i){return this.pickable===!1?!1:(i.kc(this.v),e?this.nE(t,i):this.containedInRect(t,i))}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.ut;i===null&&(this.ht(1/0,1/0),i=this.ut);let s=i.bounds,n=this.strokeWidth/2,o=!1,r=P.l();return r.e(s.x-n,s.y-n),t.containsPoint(e.gt(r))&&(r.e(s.x-n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.e(s.right+n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.e(s.right+n,s.y-n),t.containsPoint(e.gt(r))&&(o=!0)))),P.i(r),o}intersectsRect(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.v,t.containsRect(this.actualBounds)))return!0;let i=Nt.l();i.set(e),i.Qw();let s=t.left,n=t.right,o=t.top,r=t.bottom,a=P.l();if(a.e(s,o),i.gt(a),this.ka(a,!0)||(a.e(n,o),i.gt(a),this.ka(a,!0))||(a.e(s,r),i.gt(a),this.ka(a,!0))||(a.e(n,r),i.gt(a),this.ka(a,!0)))return P.i(a),!0;let h=P.l(),l=P.l();i.set(e),i.zL(this.v),i.Qw(),h.x=n,h.y=o,h.v(i),a.x=s,a.y=o,a.v(i);let u=!1;return this.jh(a,h,l)?u=!0:(a.x=n,a.y=r,a.v(i),this.jh(a,h,l)?u=!0:(h.x=s,h.y=r,h.v(i),this.jh(a,h,l)?u=!0:(a.x=s,a.y=o,a.v(i),this.jh(a,h,l)&&(u=!0)))),P.i(a),Nt.i(i),P.i(h),P.i(l),u}jh(t,e,i){if(!this.getNearestIntersectionPoint(t,e,i))return!1;let s=t.x,n=t.y,o=e.x,r=e.y,a=i.x,h=i.y;if(s===o){let l=0,u=0;return n<r?(l=n,u=r):(l=r,u=n),h>=l&&h<=u}else{let l=0,u=0;return s<o?(l=s,u=o):(l=o,u=s),a>=l&&a<=u}}nE(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.v,t.containsRect(this.actualBounds)))return!0;let i=t.left,s=t.right,n=t.top,o=t.bottom,r=P.l(),a=P.l(),h=P.l(),l=Nt.l();l.set(e),l.zL(this.v),l.Qw(),a.x=s,a.y=n,a.v(l),r.x=i,r.y=n,r.v(l);let u=!1;return this.jh(r,a,h)?u=!0:(r.x=s,r.y=o,r.v(l),this.jh(r,a,h)?u=!0:(a.x=i,a.y=o,a.v(l),this.jh(r,a,h)?u=!0:(r.x=i,r.y=n,r.v(l),this.jh(r,a,h)&&(u=!0)))),Nt.i(l),P.i(r),P.i(a),P.i(h),u}$T(t,e,i){if(i&&this.fill!==null&&this.ka(t,!0))return!0;let s=t.distanceSquaredPoint(e),n=s;this.strokeWidth>1.5&&(s=this.strokeWidth/2+Math.sqrt(s),s*=s);let o=this.ut;if(o===null&&(this.ht(1/0,1/0),o=this.ut,o===null))return!1;if(!i){let c=o.bounds,d=c.x,f=c.y,p=c.x+c.width,g=c.y+c.height;if(P.distanceSquared(t.x,t.y,d,f)<=s&&P.distanceSquared(t.x,t.y,p,f)<=s&&P.distanceSquared(t.x,t.y,d,g)<=s&&P.distanceSquared(t.x,t.y,p,g)<=s)return!0}function r(c,d){let f=c.length;for(let p=0;p<f;p+=2)if(d.distanceSquared(c[p],c[p+1])>s)return!0;return!1}let a=o.startX,h=o.startY,l=o.endX,u=o.endY;if(o.type===1){let c=P.distanceLineSegmentSquared(t.x,t.y,a,h,l,u),d=(l-a)*(t.x-a)+(u-h)*(t.y-h),f=(a-l)*(t.x-l)+(h-u)*(t.y-u),p=d>=0&&f>=0?s:n;return c<=p}else if(o.type===2){let c=!1;return i&&(c=P.distanceLineSegmentSquared(t.x,t.y,a,h,a,u)<=s||P.distanceLineSegmentSquared(t.x,t.y,a,h,l,h)<=s||P.distanceLineSegmentSquared(t.x,t.y,l,h,l,u)<=s||P.distanceLineSegmentSquared(t.x,t.y,a,u,l,u)<=s),c}else if(o.type===3){let c=(a+l)/2,d=(h+u)/2,f=t.x-c,p=t.y-d,g=Math.abs(l-a)/2,y=Math.abs(u-h)/2;if(g===0||y===0)return P.distanceLineSegmentSquared(t.x,t.y,a,h,l,u)<=s;if(i){let b=C.WF(g,y,f,p);return b*b<=s}else return!(P.distanceSquared(f,p,-g,0)>=s||P.distanceSquared(f,p,0,-y)>=s||P.distanceSquared(f,p,0,y)>=s||P.distanceSquared(f,p,g,0)>=s)}else if(o.type===4){let c=o.bounds,d=c.x,f=c.y,p=c.x+c.width,g=c.y+c.height;if(t.x>p&&t.x<d&&t.y>g&&t.y<f&&P.distanceLineSegmentSquared(t.x,t.y,d,f,d,g)>s&&P.distanceLineSegmentSquared(t.x,t.y,d,f,p,f)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,g,d,g)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,g,p,f)>s)return!1;let y=Math.sqrt(s);if(i){if(this.fill===null?o.ZL(t.x,t.y,y):o.IP(t,y,!0,!1))return!0}else{let b=o.figures;for(let v=0;v<b.count;v++){let w=b.r[v],k=w.startX,S=w.startY;if(t.distanceSquared(k,S)>s)return!1;let N=w.segments.r,D=N.length;for(let L=0;L<D;L++){let M=N[L];switch(M.type){case 1:case 2:if(k=M.endX,S=M.endY,t.distanceSquared(k,S)>s)return!1;break;case 3:{let A=m.st();C.Hn(k,S,M.point1X,M.point1Y,M.point2X,M.point2Y,M.endX,M.endY,.8,A);let F=r(A,t);if(m.Z(A),F||(k=M.endX,S=M.endY,t.distanceSquared(k,S)>s))return!1;break}case 4:{let A=m.st();C.sm(k,S,M.point1X,M.point1Y,M.endX,M.endY,.8,A);let F=r(A,t);if(m.Z(A),F||(k=M.endX,S=M.endY,t.distanceSquared(k,S)>s))return!1;break}case 5:case 6:{let A=M.type===5?M.To(w):M.Za(w,k,S),F=A.length;if(F===0){if(k=M.type===5?M.centerX:M.endX,S=M.type===5?M.centerY:M.endY,t.distanceSquared(k,S)>s)return!1;break}let O=null,E=m.st();for(let B=0;B<F;B++)if(O=A[B],E.length=0,C.Hn(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],.8,E),r(E,t))return m.Z(E),!1;m.Z(E),O!==null&&(k=O[6],S=O[7]);break}default:m.o("Unknown Segment type: "+M.type)}}}return!0}}return!1}iE(t,e,i,s,n,o){if(t.width===0)return C.Ao(t.x,t.y,t.x,t.y+t.height,e,i,s,n,o);if(t.height===0)return C.Ao(t.x,t.y,t.x+t.width,t.y,e,i,s,n,o);{let r=t.width/2,a=t.height/2,h=t.x+r,l=t.y+a,u=9999;if(e!==s&&(u=(i-n)/(e-s)),Math.abs(u)<9999){let c=i-l-u*(e-h);if(r*r*(u*u)+a*a-c*c<0)return o.x=NaN,o.y=NaN,!1;let d=Math.sqrt(r*r*(u*u)+a*a-c*c),f=(-(r*r*u*c)+r*a*d)/(a*a+r*r*(u*u))+h,p=(-(r*r*u*c)-r*a*d)/(a*a+r*r*(u*u))+h,g=u*(f-h)+c+l,y=u*(p-h)+c+l,b=Math.abs((e-f)**2)+Math.abs((i-g)**2),v=Math.abs((e-p)**2)+Math.abs((i-y)**2);b<v?(o.x=f,o.y=g):(o.x=p,o.y=y)}else{let c=a*a,d=r*r,f=e-h,p=c-c/d*(f*f);if(p<0)return o.x=NaN,o.y=NaN,!1;let g=Math.sqrt(p),y=l+g,b=l-g,v=Math.abs(y-i),w=Math.abs(b-i);v<w?(o.x=e,o.y=y):(o.x=e,o.y=b)}return!0}}qI(){return this.Jo/2*this.strokeMiterLimit*this.getDocumentScale()}get geometry(){return this.ut!==null?this.ut:this.tn}set geometry(t){let e=this.ut,i=this.tn;if(e===t)return;t!==null?(this.ut=t.k(),this.tn=this.ut):(this.ut=null,this.tn=null);let s=this.part;if(s!==null&&s.Df(),this.f(),this.t("geometry",e||i,t),this.mf()){let n=this.part;n!==null&&this.Uh(n,"geometryString")}}get geometryString(){return this.geometry===null?"":this.geometry.toString()}set geometryString(t){let e=wt.parse(t),i=e.normalize();this.geometry=e;let s=P.z(-i.x,-i.y);this.position=s,P.i(s)}get isGeometryPositioned(){return(this.n&1048576)!==0}set isGeometryPositioned(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.f(),this.t("isGeometryPositioned",e,t))}ai(){this.ut=null}get fill(){return this.Hh}set fill(t){let e=this.Hh;e!==t&&(t!==null&&R.Nd(t,"Shape.fill"),t instanceof R&&t.k(),this.Hh=t,this.C(),this.t("fill",e,t))}get stroke(){return this.Qe}set stroke(t){let e=this.Qe;e!==t&&(t!==null&&R.Nd(t,"Shape.stroke"),t instanceof R&&t.k(),this.Qe=t,this.C(),this.t("stroke",e,t))}get strokeWidth(){return this.Jo}set strokeWidth(t){let e=this.Jo;if(e!==t)if(t>=0){this.Jo=t,this.f();let i=this.part;i!==null&&i.Df(),this.t("strokeWidth",e,t)}else m.J(t,"value >= 0",et,"strokeWidth:value")}Yp(){return this.Jo}get strokeCap(){return this.Kt!==null?this.Kt.z0:"butt"}set strokeCap(t){let e=this.strokeCap;e!==t&&(typeof t=="string"&&(t==="butt"||t==="round"||t==="square")?(this.qh().z0=t,this.C(),this.t("strokeCap",e,t)):m.J(t,'"butt", "round", or "square"',et,"strokeCap"))}get strokeJoin(){return this.Kt!==null?this.Kt.X0:"miter"}set strokeJoin(t){let e=this.strokeJoin;e!==t&&(typeof t=="string"&&(t==="miter"||t==="bevel"||t==="round")?(this.qh().X0=t,this.C(),this.t("strokeJoin",e,t)):m.J(t,'"miter", "bevel", or "round"',et,"strokeJoin"))}get strokeMiterLimit(){return this.Kt!==null?this.Kt.G0:10}set strokeMiterLimit(t){let e=this.strokeMiterLimit;if(e!==t&&t>=1){this.qh().G0=t,this.C();let i=this.part;i!==null&&i.Df(),this.t("strokeMiterLimit",e,t)}}get strokeDashArray(){return this.Ho}set strokeDashArray(t){let e=this.Ho;if(e!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",et,"strokeDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(!(o>=0)||!isFinite(o))&&m.o("strokeDashArray:value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Ho=t,this.C(),this.t("strokeDashArray",e,t)}}get strokeDashOffset(){return this.Kt!==null?this.Kt.La:0}set strokeDashOffset(t){let e=this.strokeDashOffset;e!==t&&t>=0&&(this.qh().La=t,this.C(),this.t("strokeDashOffset",e,t))}get figure(){return this.Xd}set figure(t){let e=this.Xd;if(e!==t){let i=C.qn[t];if(m.it(i)?i=t:(i=C.qn[t.toLowerCase()],(!i||typeof i=="function")&&m.o("Unknown Shape.figure: "+t)),e!==i){let s=this.part;s!==null&&s.Df(),this.Xd=i,this.tn=null,this.ai(),this.f(),this.t("figure",e,i)}}}get toArrow(){return this.Ot!==null?this.Ot.Y0:"None"}set toArrow(t){let e=this.toArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=et.PD(t);i===null?m.o("Unknown Shape.toArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new Re),this.Ot.Y0=i,this.tn=null,this.ai(),this.f(),this.SD(i),this.t("toArrow",e,i))}}get fromArrow(){return this.Ot!==null?this.Ot.K0:"None"}set fromArrow(t){let e=this.fromArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=et.PD(t);i===null?m.o("Unknown Shape.fromArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new Re),this.Ot.K0=i,this.tn=null,this.ai(),this.f(),this.SD(i),this.t("fromArrow",e,i))}}SD(t){let e=this.diagram;e!==null&&e.undoManager.isUndoingRedoing||(this.mI(),this.toArrow!=="None"?(this.segmentIndex=-1,this.alignmentFocus=T.Right):this.fromArrow!=="None"&&(this.segmentIndex=0,this.alignmentFocus=T.Left))}get spot1(){return this.Kt!==null?this.Kt.jn:T.Default}set spot1(t){let e=this.spot1;e.equals(t)||(t=t.N(),this.qh().jn=t,this.f(),this.t("spot1",e,t))}get spot2(){return this.Kt!==null?this.Kt.Wn:T.Default}set spot2(t){let e=this.spot2;e.equals(t)||(t=t.N(),this.qh().Wn=t,this.f(),this.t("spot2",e,t))}get parameter1(){return this.Gd}set parameter1(t){let e=this.Gd;e!==t&&(this.Gd=t,this.ai(),this.f(),this.t("parameter1",e,t))}get parameter2(){return this.Yd}set parameter2(t){let e=this.Yd;e!==t&&(this.Yd=t,this.ai(),this.f(),this.t("parameter2",e,t))}get naturalBounds(){return this.Ke}EI(){let t=this.desiredSize;if(!t.isReal()&&this.ut!==null){let e=this.ut.bounds;this.Ke.h(e)}else this.Ke.e(0,0,t.width,t.height)}get pathPattern(){return this.Kt!==null?this.Kt.H0:null}set pathPattern(t){let e=this.pathPattern;e!==t&&(this.qh().H0=t,this.C(),this.t("pathPattern",e,t))}get geometryStretch(){return this.Kt!==null?this.Kt.q0:1}set geometryStretch(t){let e=this.geometryStretch;e!==t&&(this.qh().q0=t,this.f(),this.t("geometryStretch",e,t))}get interval(){return this.K!==null?this.K.Ff:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new xe),this.K.Ff=t;let i=this.diagram;i!==null&&this.panel===i.grid&&i.ca(),this.C(),this.f();let s=this.panel;s!==null&&(s.ds=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.Rf:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Rf=t,this.f(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.Of:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Of=t,this.f(),this.t("graduatedEnd",e,t))}get graduatedSkip(){return this.K!==null?this.K.If:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&m.S(t,et,"graduatedSkip"),this.K===null&&(this.K=new xe),this.K.If=t,this.f(),this.t("graduatedSkip",e,t))}polygonContainsRect(t){let e=this;if(!e.part||!e.part.actualBounds.containsRect(t))return!1;let i=e.geometry;if(!i)return!1;let s=t.x,n=t.y,o=t.width,r=t.height,a=P.l();if(a.x=s,a.y=n,e.getLocalPoint(a,a),!i.containsPoint(a)||o>0&&r>0&&(a.x=s+o,a.y=n+r,e.getLocalPoint(a,a),!i.containsPoint(a))||o>0&&(a.x=s+o,a.y=n,e.getLocalPoint(a,a),!i.containsPoint(a))||r>0&&(a.x=s,a.y=n+r,e.getLocalPoint(a,a),!i.containsPoint(a))||i.type===1)return!1;if(i.type===4){let h=i.figures.iterator;for(;h.next();){let l=h.value;if(!l.isFilled)continue;a.x=l.startX,a.y=l.startY,e.getDocumentPoint(a,a);let u=a.x,c=a.y,d=u,f=c,p=u,g=c,y=l.segments.iterator;for(;y.next();){let b=y.value;if(a.x=b.endX,a.y=b.endY,e.getDocumentPoint(a,a),p=a.x,g=a.y,b.type===1)u=p,c=g;else if(b.type!==5&&(I.intersectsLineSegment(s,n,o,r,d,f,p,g)||b.isClosed&&I.intersectsLineSegment(s,n,o,r,p,g,u,c)))return!1;d=p,f=g}}}return P.i(a),!0}static eE(t,e,i){let s=null;if(t.toArrow!=="None")s=et.Tn[t.toArrow];else if(t.fromArrow!=="None")s=et.Tn[t.fromArrow];else{let n=C.qn[t.figure];typeof n=="string"&&(n=C.qn[n]),n===void 0&&m.o("Unknown Shape.figure: "+t.figure),s=n(t,e,i),s.Sc=e,s.Mc=i}if(s===null){let n=C.qn.Rectangle;m.it(n)&&(s=n(t,e,i))}return s}static getFigureGenerators(){let t=new Mt;for(let e in C.qn){if(e===e.toLowerCase())continue;let i=C.qn[e];t.set(e,i)}return t.k(),t}static defineFigureGenerator(t,e){m.s(t,"string",et,"defineFigureGenerator:name"),typeof e=="string"||m.S(e,et,"defineFigureGenerator:func");let i=t.toLowerCase(),s=C.qn;s[t]=e,s[i]=t}static isFigureDefined(t){return t in C.qn}static getArrowheadGeometries(){let t=new Mt;for(let e in C.rm)if(et.Tn[e]===void 0){let i=wt.parse(C.rm[e],!1);et.Tn[e]=i;let s=e.toLowerCase();s!==e&&(et.Tn[s]=e)}for(let e in et.Tn){if(e===e.toLowerCase())continue;let i=et.Tn[e];i instanceof wt&&t.set(e,i)}return t.k(),t}static defineArrowheadGeometry(t,e){m.s(t,"string",et,"defineArrowheadGeometry:name");let i=null;typeof e=="string"?(m.s(e,"string",et,"defineArrowheadGeometry:pathstr"),i=wt.parse(e,!1)):i=e;let s=t.toLowerCase();(s==="none"||t===s)&&m.o("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+t);let n=et.Tn;n[t]=i,n[s]=t}static isArrowheadDefined(t){return et.Tn.has(t)}static Tn=new yt;static eC=new yt;static PD(t){let e=et.Tn[t];if(e===void 0){let i=t.toLowerCase();if(i==="none")return"None";if(e=et.Tn[i],e===void 0){let s=null;for(let n in C.rm)if(n.toLowerCase()===i){s=n;break}if(s!==null){let n=wt.parse(C.rm[s],!1);return et.Tn[s]=n,i!==s&&(et.Tn[i]=s),s}}}return typeof e=="string"?e:e instanceof wt?t:null}}class Xi{me;z0;X0;G0;La;H0;q0;jn;Wn;constructor(){this.me=!1,this.z0="butt",this.X0="miter",this.G0=10,this.La=0,this.H0=null,this.q0=1,this.jn=T.Default,this.Wn=T.Default}copy(){let t=new Xi;return t.z0=this.z0,t.X0=this.X0,t.G0=this.G0,t.La=this.La,t.H0=this.H0,t.q0=this.q0,t.jn=this.jn.N(),t.Wn=this.Wn.N(),t}}var Ki=(x=>(x[x.None=0]="None",x[x.Fit=1]="Fit",x[x.DesiredSize=2]="DesiredSize",x[x.BreakAll=3]="BreakAll",x))(Ki||{}),js=(x=>(x[x.Clip=0]="Clip",x[x.Ellipsis=1]="Ellipsis",x))(js||{}),Yi=(x=>(x[x.Trim=0]="Trim",x[x.None=1]="None",x))(Yi||{});class lt extends J{ue;Qe;Dn;Pi;pe;Kp;Hd;K;tt;Xl;co;vn;Ii;ye;Fn;constructor(t,e){return super(),lt.k0===!1&&(lt.k0=!0,lt.us=Y.isUsingDOM()?new Fe(null)._t:null),this.n|=2097152,this.ue="",this.Qe="black",this.Dn="13px sans-serif",this.Pi=0,this.pe=0,this.Kp=0,this.Hd=null,this.K=null,this.tt=null,this.Xl=0,this.co=null,this.vn=0,this.Ii=null,this.ye=null,this.Fn=null,typeof t=="string"?this.text=t:t&&Object.assign(this,t),e&&Object.assign(this,e),this}cloneProtected(t){super.cloneProtected(t),t.ue=this.ue,t.Qe=this.Qe,t.Dn=this.Dn,t.Pi=this.Pi,t.pe=this.pe,t.Kp=this.Kp,t.Hd=this.Hd,this.K!==null&&(t.K=this.K.copy()),this.tt!==null&&(this.tt.me?t.tt=this.tt:t.tt=this.tt.copy()),t.Xl=this.Xl,t.co=this.co,t.vn=this.vn,t.Ii=this.Ii,t.ye=this.ye,t.Fn=this.Fn}Rs(){return this.tt===null?this.tt=new Ui:this.tt.me&&(this.tt=this.tt.copy()),this.tt}ba(){super.ba(),this.tt!==null&&(this.tt.me=!0)}YI(t){this.n=t.n|2048|4096,this.Zt=t.opacity,this.Ct=t.background,this.cs=t.desiredSize.N(),this.minSize=t.minSize.N(),this.maxSize=t.maxSize.N(),t.Se!==null?this.Se=t.Se.copy():this.Se=null,this.et=t.scale,this.Xt=t.angle,this.stretch=t.stretch,this.tl=t.margin.N(),this.de=t.alignment.N(),this.xd=t.alignmentFocus.N(),this.segmentFraction=t.segmentFraction,this.segmentOffset=t.segmentOffset.N(),this.segmentOrientation=t.segmentOrientation,t.he!==null&&(this.he=t.he.copy()),this.shadowVisible=t.shadowVisible,this.ue=t.ue,this.Qe=t.Qe,this.Dn=t.Dn,this.K!==null&&(this.K=t.K.copy()),t.tt!==null&&(t.tt.me?this.tt=t.tt:this.tt=t.tt.copy()),this.Xl=t.Xl}XI(t){if(this.ue=t.text||"",this.Xt=t.labelAngle||0,this.Pi=t.lineCount||0,this.oE(t.lines),t.naturalBounds&&(this.Ke=t.naturalBounds),t.actualBounds){let e=t.actualBounds;this.Ut(e.x,e.y,e.width,e.height)}}fe(t){t in Ki?this.wrap=t:super.fe(t)}toString(){return this.ue.length>22?'TextBlock("'+this.ue.substring(0,20)+'"...)':'TextBlock("'+this.ue+'")'}static getEllipsis(){return lt.j0}static setEllipsis(t){lt.j0=t,lt.Q1=new yt,lt.iC=0}static getBaseline(){return lt._1}static setBaseline(t){lt._1=t}static _1=null;static getUnderline(){return lt.tk}static setUnderline(t){lt.tk=t}static tk=null;static None=0;static WrapFit=1;static WrapDesiredSize=2;static WrapBreakAll=3;static OverflowClip=0;static OverflowEllipsis=1;static FormatTrim=0;static FormatNone=1;f(){super.f(),this.Ji(!0)}get font(){return this.Dn}set font(t){let e=this.Dn;e!==t&&(this.Dn=t,this.co=null,this.f(),this.t("font",e,t))}static isValidFont(t){return K.CSS?K.CSS.supports("font",t):!0}get text(){return this.ue}set text(t){let e=this.ue;t!=null?t=t.toString():t="",e!==t&&(this.ue=t,this.f(),this.t("text",e,t))}get textAlign(){return this.tt!==null?this.tt.W0:"start"}set textAlign(t){let e=this.textAlign;e!==t&&(t==="start"||t==="end"||t==="left"||t==="right"||t==="center")&&(this.Rs().W0=t,this.C(),this.t("textAlign",e,t))}get flip(){return this.tt!==null?this.tt.fo:0}set flip(t){let e=this.flip;e!==t&&(this.Rs().fo=t,this.C(),this.t("flip",e,t))}get verticalAlignment(){return this.tt!==null?this.tt.rl:T.Top}set verticalAlignment(t){let e=this.verticalAlignment;e.equals(t)||(t=t.N(),this.Rs().rl=t,this.Pf(),this.t("verticalAlignment",e,t))}get naturalBounds(){if(!this.Ke.isReal()){let t=st.l();this.sC(this.ue,999999,t);let e=t.width;st.i(t);let i=this.MD(e),s=this.desiredSize;isNaN(s.width)||(e=s.width),isNaN(s.height)||(i=s.height),this.Ke.Yn(e,i)}return this.Ke}get isMultiline(){return(this.n&2097152)!==0}set isMultiline(t){let e=(this.n&2097152)!==0;e!==t&&(this.n=this.n^2097152,this.f(),this.t("isMultiline",e,t))}get isUnderline(){return(this.n&4194304)!==0}set isUnderline(t){let e=(this.n&4194304)!==0;e!==t&&(this.n=this.n^4194304,this.Ji(!0),this.C(),this.t("isUnderline",e,t))}get isStrikethrough(){return(this.n&8388608)!==0}set isStrikethrough(t){let e=(this.n&8388608)!==0;e!==t&&(this.n=this.n^8388608,this.Ji(!0),this.C(),this.t("isStrikethrough",e,t))}get wrap(){return this.tt!==null?this.tt.J0:2}set wrap(t){let e=this.wrap;e!==t&&(this.Rs().J0=t,this.f(),this.t("wrap",e,t))}get overflow(){return this.tt!==null?this.tt.$0:0}set overflow(t){let e=this.overflow;e!==t&&(this.Rs().$0=t,this.f(),this.t("overflow",e,t))}get isOverflowed(){return(this.n&16777216)!==0}nC(t){t?this.n|=16777216:this.n&=-16777217}get stroke(){return this.Qe}set stroke(t){let e=this.Qe;e!==t&&(t!==null&&R.Nd(t,"TextBlock.stroke"),t instanceof R&&t.k(),this.Qe=t,typeof t!="string"&&this.xf(),this.C(),this.t("stroke",e,t))}get lineCount(){return this.Pi}get lineHeight(){return this.Z0()}get editable(){return(this.n&1048576)!==0}set editable(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.t("editable",e,t))}get HN(){return(this.n&33554432)!==0}set HN(t){this.n=this.n^33554432}get textEditor(){return this.tt!==null?this.tt.Q0:null}set textEditor(t){let e=this.textEditor;e!==t&&(this.Rs().Q0=t,this.t("textEditor",e,t))}get errorFunction(){return this.tt!==null?this.tt.gs:null}set errorFunction(t){let e=this.errorFunction;e!==t&&(t!==null&&m.S(t,lt,"errorFunction"),this.Rs().gs=t,this.t("errorFunction",e,t))}get interval(){return this.K!==null?this.K.Ff:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new xe),this.K.Ff=t,this.f();let i=this.panel;i!==null&&(i.ds=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.Rf:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Rf=t,this.f(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.Of:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new xe),this.K.Of=t,this.f(),this.t("graduatedEnd",e,t))}get graduatedFunction(){return this.K!==null?this.K._0:null}set graduatedFunction(t){let e=this.graduatedFunction;e!==t&&(t!==null&&m.S(t,lt,"graduatedFunction"),this.K===null&&(this.K=new xe),this.K._0=t,this.f(),this.t("graduatedFunction",e,t))}get graduatedSkip(){return this.K!==null?this.K.If:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&m.S(t,lt,"graduatedSkip"),this.K===null&&(this.K=new xe),this.K.If=t,this.f(),this.t("graduatedSkip",e,t))}Ma(t,e){if(this.Qe===null||this.ue.length===0||this.Dn===null)return;let i=this.naturalBounds,s=this.actualBounds,n=i.width,o=i.height,r=this.Z0(),a=t.textAlign=this.textAlign,h=e.ld;a==="start"?a=h?"right":"left":a==="end"&&(a=h?"left":"right");let l=this.isUnderline,u=this.isStrikethrough;this.bn(t,this.Qe,!0,!1,i,s),(l||u)&&this.bn(t,this.Qe,!1,!1,i,s);let c=0,d=0,f=n,p=!1;e.Wt===t&&!(e.Wt instanceof re)&&!this.HN&&e.getRenderingHint("textGreeking")===!0&&r*this.Dh*e.scale<3&&(p=!0);let g=this.spacingAbove,y=this.spacingBelow;switch(this.flip){case 0:break;case 2:t.translate(n,0),t.scale(-1,1);break;case 1:t.translate(0,o),t.scale(1,-1);break;case 3:t.translate(n,o),t.scale(-1,-1);break}t.commitTransform();let b=this.Pi,v=(g+r+y)*b;if(o>v){let w=this.verticalAlignment;d=w.y*o-w.y*v+w.offsetY}if(lt.ek&&(t.letterSpacing=this.letterSpacing,t.wordSpacing=this.wordSpacing),b===1&&this.Fn!==null){let w=this.pe;w>f&&(w=f),d+=g,this.ND(this.Fn,t,c,d,f,r,w,p,a,l,u)}else if(this.Ii!==null&&this.ye!==null)for(let w=0;w<b;w++){let k=this.Ii[w];k>f&&(k=f),d+=g,this.ND(this.ye[w],t,c,d,f,r,k,p,a,l,u),d+=r+y}switch(this.flip){case 0:break;case 2:t.scale(-1,1),t.translate(-n,0);break;case 1:t.scale(1,-1),t.translate(0,-o);break;case 3:t.scale(-1,-1),t.translate(-n,-o);break}}ND(t,e,i,s,n,o,r,a,h,l,u){let c=0;if(a){h==="left"?c=0:h==="right"?c=n-r:h==="center"&&(c=(n-r)/2);let p=e.globalAlpha;e.globalAlpha=p/2,e.fillRect(i+c,s+o/4,r,o/2),e.globalAlpha=p;return}h==="left"?c=0:h==="right"?c=n:h==="center"&&(c=n/2);let d=lt._1!==null?lt._1(this,o):o*.75;e.fillText(t,i+c,s+d);let f=o/20|0;if(f===0&&(f=1),h==="right"?c-=r:h==="center"&&(c-=r/2),l){let p=lt.tk!==null?lt.tk(this,o):o*.8;this.CD(i+c,s+p,i+c+r,s+p,f,e),e instanceof re&&e.lastCreatedElement.classList.add("gojs-td")}if(u){let p=s+o-o/2.2|0;f%2!==0&&(p+=.5),this.CD(i+c,p,i+c+r,p,f,e),e instanceof re&&e.lastCreatedElement.classList.add("gojs-td")}}CD(t,e,i,s,n,o){o.beginPath(),o.lineWidth=n,o.moveTo(t,e),o.lineTo(i,s),o.stroke(),o.endPath()}wf(t,e,i){if(!super.wf(t,e,i))return!1;if(this.bn(t,this.Qe,!0,!1,this.naturalBounds,this.actualBounds),i){if(this.svg.getElementsByTagName("text").length===0)return!0;let s=this.svg.getElementsByClassName("gojs-td");for(let n=0;n<s.length;n++)t.setFillOrStrokeInPlace(s[n],!1)}else this.rE(this.svg,this.ye?this.ye[0]:this.text,t);return!0}rE(t,e,i){t.innerHTML=e,i.setFillOrStrokeInPlace(t,!0)}Sd(t){return this.lineCount>1||this.isUnderline||this.isStrikethrough?!0:super.Sd(t)}CN(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("text");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}lE(){this.vn=0,this.pe=0,this.co=null,this.Ii=null,this.ye=null,this.Fn=null}kd(t,e,i,s){let n=this.Pi;this.Xl=t,this.nC(!1);let o=this.Dn;lt.us!==null&&(lt.LD!==o&&(lt.us.font=o,lt.LD=o),lt.ek&&(lt.us.letterSpacing=this.letterSpacing,lt.us.wordSpacing=this.wordSpacing)),this.lE();let r=0,a=0;isNaN(this.desiredSize.width)?(r=this.aE(),r=Math.min(r,t/this.scale)):r=this.desiredSize.width,this.panel!==null&&(r=Math.min(r,this.panel.maxSize.width)),a=this.MD(r),isNaN(this.desiredSize.height)?a=Math.min(a,e/this.scale):a=this.desiredSize.height,this.hE(t,a),(this.wrap===1||isNaN(this.desiredSize.width))&&(r=isNaN(t)?this.pe:Math.min(t,this.pe)),r=Math.max(i,r),a=Math.max(s,a),this.Ke.Yn(r,a),this.no(0,0,r,a),this.svg!==null&&n!==this.Pi&&this.Ji(!0)}Pa(t,e,i,s){this.commonArrange(t,e,i,s)}Rn(t,e){this.Fn===null?(this.Fn=t,this.pe=e):((this.ye===null||this.Ii===null)&&(this.ye=[],this.Ii=[],this.ye.push(this.Fn),this.Ii.push(this.pe)),this.ye.push(t),this.Ii.push(e),this.ye.length>this.maxLines&&(this.n|=16777216))}sC(t,e,i){let s=this.formatting===0;s&&(t=t.trim());let n=0,o=0,r=0,a=this.Dn,h=this.spacingAbove+this.spacingBelow,l=Math.max(0,this.Z0()+h),u=this.overflow===1?this.AD(a):0;if(this.Pi>=this.maxLines){i!==void 0&&i.e(0,l);return}let c=t;if(this.wrap===0){if(this.vn=1,o=this.getStringWidth(t),u===0||o<=e){this.pe=Math.max(this.pe,o),this.Rn(t,this.pe),i!==void 0&&i.e(o,l);return}let f=this.qd(c);c=c.substring(f.length);let p=this.qd(c);for(o=this.getStringWidth(f+p),r=0;p.length>0&&o<=e;){f+=p,c=c.substring(p.length),p=this.qd(c),r=o;let g=f+p;s&&(g=g.trim()),o=this.getStringWidth(g)}for(s&&(p=p.trim()),f+=p,e=Math.max(1,e-u);this.getStringWidth(f)>e&&f.length>1;)f=f.substring(0,f.length-1);this.nC(!0),f+=lt.j0,r=this.getStringWidth(f),this.pe=r,this.Rn(f,r),i!==void 0&&i.e(r,l);return}let d=0;for(c.length===0&&(d=1,this.Rn(c,0));c.length>0;){let f=this.qd(c);for(c=c.substring(f.length);this.getStringWidth(f)>e;){let y=1;for(o=this.getStringWidth(f.substring(0,y)),r=0;o<=e;)y++,r=o,o=this.getStringWidth(f.substring(0,y));let b=0;y===1?(b=o,n=Math.max(n,o)):(b=r,n=Math.max(n,r)),y--,y<1&&(y=1);let v=f.substring(0,y);if(this.Rn(v,b),d++,f=f.substring(y),this.Pi+d>this.maxLines)break}let p=this.qd(c);for(o=this.getStringWidth(f+p),r=0;p.length>0&&o<=e;){f+=p,c=c.substring(p.length),p=this.qd(c),r=o;let y=f+p;s&&(y=y.trim()),o=this.getStringWidth(y)}if(s&&(f=f.trim()),f==="")continue;f[f.length-1]==="\xAD"&&(f=f.substring(0,f.length-1)+"\u2010");let g=0;if(p.length===0?(g=o,n=Math.max(n,o)):(r=this.getStringWidth(f),g=r,n=Math.max(n,r)),this.Rn(f,g),d++,this.Pi+d>this.maxLines)break}this.vn=Math.min(this.maxLines-this.Pi,d),this.pe=Math.max(this.pe,n),i!==void 0&&i.e(this.pe,l*this.vn)}hE(t,e){if(this.pe===0||this.Ii===null||this.ye===null||this.overflow!==1)return;let i=this.Dn,s=this.overflow===1?this.AD(i):0,n=this.spacingAbove+this.spacingBelow,o=Math.max(0,this.Z0()+n),r=Math.min(this.maxLines-1,Math.max(Math.floor(e/o+.01)-1,0));if(r+1>=this.ye.length)return;this.nC(!0);let a=this.ye[r],h=Math.max(1,t-s);for(;this.getStringWidth(a)>h&&a.length>1;)a=a.substring(0,a.length-1);a+=lt.j0;let l=this.getStringWidth(a);this.ye[r]=a,this.ye=this.ye.slice(0,r+1),this.Ii[r]=l,this.Ii=this.Ii.slice(0,r+1),this.vn=this.ye.length,this.pe=Math.max(this.pe,l),this.Pi=this.vn,this.Pi===1&&(this.Fn=this.ye[0])}qd(t){if(this.wrap===3)return t.substring(0,1);let e=t.length,i=0,s=lt.cE;for(;i<e&&!s.test(t.charAt(i));)i++;for(this.formatting===1&&(e=Math.min(e,i+1));i<e&&s.test(t.charAt(i));)i++;return i>=t.length?t:t.substring(0,i)}getStringWidth(t){return lt.us===null?t.length*8:lt.us.measureText(t).width}Z0(){if(this.co!==null)return this.co;let t=this.Dn,e=0;if(lt.us===null)return e=16,this.co=e,e;if(lt.oC[t]!==void 0&<.TD<5e3)e=lt.oC[t];else{lt.us.letterSpacing="0px";let i=lt.us.measureText("M");lt.us.letterSpacing=this.letterSpacing,e=i.width*1.3,lt.oC[t]=e,lt.TD++}return this.co=e,e}AD(t){if(lt.us===null)return 6;let e=0;return lt.Q1[t]!==void 0&<.iC<5e3?e=lt.Q1[t]:(e=lt.us.measureText(lt.j0).width,lt.Q1[t]=e,lt.iC++),e}ik(t,e){return t.indexOf(`
|
|
8
8
|
`,e)}MD(t){let e=this.ue.replace(/\r\n/g,`
|
|
9
9
|
`).replace(/\r/g,`
|
|
10
10
|
`),i=this.spacingAbove+this.spacingBelow,s=Math.max(0,this.Z0()+i);if(e.length===0)return this.pe=0,this.Pi=1,s;if(!this.isMultiline){let h=this.ik(e,0);h>=0&&(e=e.substring(0,h))}let n=0;this.Pi=0;let o=0,r=-1,a=!1;for(;!a;){if(r=this.ik(e,o),r===-1&&(r=e.length,a=!0),o<=r){let h=e.substring(o,r);if(this.wrap!==0){this.vn=0;let l=st.l();this.sC(h,t,l),n+=l.height,st.i(l),this.Pi+=this.vn}else this.sC(h,t),n+=s,this.Pi++;this.Pi===this.maxLines&&(a=!0)}o=r+1}return this.Kp=n,n}aE(){let t=this.ue.replace(/\r\n/g,`
|
|
11
11
|
`).replace(/\r/g,`
|
|
12
|
-
`);if(t.length===0)return 8;if(this.isMultiline){let e=0,i=0,s=!1;for(;!s;){let n=this.ik(t,i);n===-1&&(n=t.length,s=!0);let o=t.substring(i,n);this.formatting===0&&(o=o.trim()),e=Math.max(e,this.getStringWidth(o)),i=n+1}return e}else{let e=this.ik(t,0);return e>=0&&(t=t.substring(0,e)),this.getStringWidth(t)}}get textValidation(){return this.tt!==null?this.tt.zl:null}set textValidation(t){let e=this.textValidation;e!==t&&(t!==null&&m.S(t,lt,"textValidation"),this.Rs().zl=t,this.t("textValidation",e,t))}get textEdited(){return this.tt!==null?this.tt.ty:null}set textEdited(t){let e=this.textEdited;e!==t&&(t!==null&&m.S(t,lt,"textEdited"),this.Rs().ty=t,this.t("textEdited",e,t))}get spacingAbove(){return this.tt!==null?this.tt.ey:0}set spacingAbove(t){let e=this.spacingAbove;e!==t&&(this.Rs().ey=t,this.f(),this.t("spacingAbove",e,t))}get spacingBelow(){return this.tt!==null?this.tt.iy:0}set spacingBelow(t){let e=this.spacingBelow;e!==t&&(this.Rs().iy=t,this.f(),this.t("spacingBelow",e,t))}get letterSpacing(){return this.tt!==null?this.tt.ny:"0px"}set letterSpacing(t){let e=this.letterSpacing;e!==t&&(lt.ek=!0,this.Rs().ny=t,this.f(),this.t("letterSpacing",e,t))}get wordSpacing(){return this.tt!==null?this.tt.ly:"0px"}set wordSpacing(t){let e=this.wordSpacing;e!==t&&(lt.ek=!0,this.Rs().ly=t,this.f(),this.t("wordSpacing",e,t))}get formatting(){return this.tt!==null?this.tt.hy:0}set formatting(t){let e=this.formatting;e!==t&&(this.Rs().hy=t,this.f(),this.t("formatting",e,t))}get maxLines(){return this.tt!==null?this.tt.cy:1/0}set maxLines(t){let e=this.maxLines;e!==t&&(t=Math.floor(t),t<=0&&m.J(t,"> 0",lt,"maxLines"),this.Rs().cy=t,this.f(),this.t("maxLines",e,t))}getMetrics(){return[this.pe,this.Xl,this.co,this.vn,this.Ii,this.ye,this.Fn||""]}oE(t){t!==void 0&&(this.pe=t[0],this.Xl=t[1],this.co=t[2],this.vn=t[3],this.Ii=t[4],this.ye=t[5],this.Fn=t[6])}get metrics(){return{arrSize:this.Ii!==null?this.Ii:[this.pe],arrText:this.ye!==null?this.ye:[this.Fn],maxLineWidth:this.pe,fontHeight:this.co}}get choices(){return this.Hd}set choices(t){let e=this.Hd;e!==t&&(this.Hd=t,this.t("choices",e,t))}static cE=new RegExp("[ \u200B\xAD]");static oC=new bt;static TD=0;static Q1=new bt;static iC=0;static j0="...";static LD="";static us=null;static k0=!1;static ek=!1}class Ui{me;gs;fo;hy;cy;$0;ey;iy;W0;ty;Q0;zl;rl;J0;ny;ly;constructor(){this.me=!1,this.gs=null,this.fo=0,this.hy=0,this.cy=1/0,this.$0=0,this.ey=0,this.iy=0,this.W0="start",this.ty=null,this.Q0=null,this.zl=null,this.rl=T.Top,this.J0=2,this.ny="0px",this.ly="0px"}copy(){let t=new Ui;return t.gs=this.gs,t.fo=this.fo,t.hy=this.hy,t.cy=this.cy,t.$0=this.$0,t.ey=this.ey,t.iy=this.iy,t.W0=this.W0,t.ty=this.ty,t.Q0=this.Q0,t.zl=this.zl,t.rl=this.rl,t.J0=this.J0,t.ny=this.ny,t.ly=this.ly,t}}class xe{Ff;Rf;Of;_0;If;constructor(){this.Ff=1,this.Rf=0,this.Of=1,this._0=null,this.If=null}copy(){let t=new xe;return t.Ff=this.Ff,t.Rf=this.Rf,t.Of=this.Of,t._0=this._0,t.If=this.If,t}}var ji=(x=>(x[x.None=0]="None",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(ji||{});class Bt extends J{ll;en;al;Ef;gs;hl;Uf;fo;Vf;Bf;O1;constructor(t,e){super(),this.n|=2097152,this.ll=null,this.en="",this.al=I.GF,this.Ef=2,this.gs=null,this.hl=null,this.Uf=T.Center,this.fo=0,this.Vf=null,this.Bf=null,this.O1=null,typeof t=="string"?this.source=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.en=this.en,t.element=this.ll,t.al=this.al.N(),t.Ef=this.Ef,t.fo=this.fo,t.gs=this.gs,t.hl=this.hl,t.Uf=this.Uf.N(),t.Bf=this.Bf}fe(t){t in ji?this.imageStretch=t:super.fe(t)}toString(){return"Picture("+this.source+")#"+V.xs(this)}get zf(){return(this.n&1048576)!==0}set zf(t){this.zf!==t&&(this.n=this.n^1048576)}get fy(){return(this.n&2097152)!==0}set fy(t){this.fy!==t&&(this.n=this.n^2097152)}get Sn(){return(this.n&4194304)!==0}set Sn(t){this.Sn!==t&&(this.n=this.n^4194304)}static clearCache(t){t===void 0&&(t=""),m.s(t,"string",Bt,"clearCache:url"),t!==""?Bt.uy[t]&&(delete Bt.uy[t],Bt.sk--):(Bt.uy=new bt,Bt.sk=0)}static ST(t,e){e.DD||(e.nk=i=>{Bt.fE(e,i),t.desiredSize.isReal()||(t.xi(!1),t.f())},e.ok=i=>Bt.uE(e,i),e.addEventListener("load",e.nk),e.addEventListener("error",e.ok),e.DD=!0)}static DO(t){t.nk&&t.removeEventListener("load",t.nk),t.ok&&t.removeEventListener("error",t.ok),delete t.nk,delete t.ok,t.DD=!1}get element(){return this.ll}set element(t){let e=this.ll;if(this.Ji(!0),e!==t){let i=Y.isUsingDOM(),s=!1;i&&(this.zf=t instanceof HTMLCanvasElement,s=t instanceof HTMLImageElement,t!==null&&!(s||t instanceof HTMLVideoElement||this.zf)&&m.o("Picture.element must be an instance of Image, Canvas, or Video, not: "+t));let n=this.diagram;n!==null&&n.F2(this),this.ll=t,t!==null&&s&&t.hs===void 0&&(t.hs=new V),n!==null&&s&&n.v2(this),this.t("element",e,t),this.C()}}AO(){let t=this.ll;if(t===null)return;let e=this.desiredSize.isReal();(this.zf||t.complete===!0)&&(t.Lp&&(t.gy instanceof Event&&this.gs!==null?this.gs(this,t.gy):t.Sn===!0&&!t.gy&&this.hl!==null&&t.rC&&this.hl(this,t.rC)),t.Sn=!0),t.Sn&&e&&this.diagram!==null&&this.diagram.rd.add(this)}dE(){if(this.ll===null){this.Vf=!1;return}let t=new Fe(null)._t;try{t.drawImage(this.ll,0,0)}catch{this.fy=!1}try{t.getImageData(0,0,1,1).data[3]&&(this.Vf=!1),this.Vf=!1}catch{this.Vf=!0}}get source(){return this.en}set source(t){let e=this.en;if(e!==t){this.Ji(!0),m.s(t,"string",Bt,"source"),this.en=t;let i=Bt.uy,s=null;if(i[t]!==void 0)s=i[t];else if(t!==""){Bt.sk>30&&(Bt.clearCache(),i=Bt.uy),s=m.Ni("img"),s.Lp=!0,Bt.ST(this,s);let n=this.Bf;n!==null&&(s.crossOrigin=n(this)),s.src=t,i[t]=s,Bt.sk++}this.element=s,s!==null&&s.__goCache===void 0&&(s.__goCache=new Hn),this.f(),this.C(),this.t("source",e,t)}}static fE(t,e){t.Sn=!0,t.gy=!1;let i,s=t.hs.copy();if(s==null)return;let n=s.iterator;for(;n.next();){let o=n.value;o.C();let r=t.getAttribute("src")||"",a=o.oa.get(r);if(a===null)continue;let h=a.length;for(let l=0;l<h;l++)i=a[l],i.desiredSize.isReal()||o.rd.add(i),i.Ji(!0),o.requestUpdate(),t.Lp&&(t.rC===void 0&&(t.rC=e),i.hl!==null&&i.hl(i,e))}t.hs.clear()}static uE(t,e){t.gy=e;let i,s=t.hs.copy();if(s==null)return;let n=s.iterator;for(;n.next();){let o=n.value,r=t.getAttribute("src")||"",a=o.oa.get(r);if(a===null)continue;let h=a.length,l=m.st();for(let u=0;u<h;u++)l.push(a[u]);if(t.Lp)for(let u=0;u<h;u++)i=l[u],i.gs!==null&&i.gs(i,e);m.Z(l)}t.hs.clear()}reloadSource(){if(this.source==="")return;Bt.clearCache(this.source);let t=this.source;this.source="",this.source=t}redraw(){this.C(),this.Ji(!0)}get sourceCrossOrigin(){return this.Bf}set sourceCrossOrigin(t){if(this.Bf!==t){t!==null&&m.S(t,Bt,"sourceCrossOrigin"),this.Bf=t;let e=this.element;if(e!==null){let i=e.getAttribute("src");e.crossOrigin!==void 0&&(t===null&&typeof i=="string"?e.crossOrigin=null:t!==null&&(e.crossOrigin=t(this)),i&&(e.src=i))}}}get sourceRect(){return this.al}set sourceRect(t){let e=this.al;e.equals(t)||(t=t.N(),this.al=t,this.f(),this.t("sourceRect",e,t))}get imageStretch(){return this.Ef}set imageStretch(t){let e=this.Ef;e!==t&&(this.Ef=t,this.C(),this.t("imageStretch",e,t))}get flip(){return this.fo}set flip(t){let e=this.fo;e!==t&&(this.fo=t,this.C(),this.t("flip",e,t))}get imageAlignment(){return this.Uf}set imageAlignment(t){let e=this.Uf;e.equals(t)||(t=t.N(),this.Uf=t,this.C(),this.t("imageAlignment",e,t))}get errorFunction(){return this.gs}set errorFunction(t){let e=this.gs;e!==t&&(t!==null&&m.S(t,Bt,"errorFunction"),this.gs=t,this.t("errorFunction",e,t))}get successFunction(){return this.hl}set successFunction(t){let e=this.hl;e!==t&&(t!==null&&m.S(t,Bt,"successFunction"),this.hl=t,this.t("successFunction",e,t))}Ma(t,e){let i=this.ll;if(i===null)return;let s=i.getAttribute("src"),n=Y.isUsingDOM();if(n&&i instanceof HTMLImageElement&&(s===null||s==="")||i.gy instanceof Event&&t instanceof ci)return;let o=t instanceof re,r=this.naturalBounds,a=0,h=0,l=this.zf,u=l?+i.width:i.naturalWidth,c=l?+i.height:i.naturalHeight;if(u===void 0&&i.videoWidth&&(u=i.videoWidth),c===void 0&&i.videoHeight&&(c=i.videoHeight),n){if(u===0||c===0)return}else u=this.width,c=this.height;let d=u,f=c;this.sourceRect.isReal()&&(a=this.al.x,h=this.al.y,u=this.al.width,c=this.al.height);let p=u,g=c,y=this.Ef,b=this.Uf;switch(y){case 0:if(this.sourceRect.isReal())break;p>=r.width&&(a=a+b.offsetX+(p*b.x-r.width*b.x)),g>=r.height&&(h=h+b.offsetY+(g*b.y-r.height*b.y)),u=Math.min(r.width,p),c=Math.min(r.height,g);break;case 2:p=r.width,g=r.height;break;case 6:case 7:let E=0;y===6?(E=Math.min(r.height/g,r.width/p),p*=E,g*=E):y===7&&(E=Math.max(r.height/g,r.width/p),p*=E,g*=E,p>=r.width&&(a=(a+b.offsetX+(p*b.x-r.width*b.x)/p)*u),g>=r.height&&(h=(h+b.offsetY+(g*b.y-r.height*b.y)/g)*c),u*=1/(p/r.width),c*=1/(g/r.height),p=r.width,g=r.height);break}let v=u*c,w=this.getDocumentScale()*e.scale,k=p*w,S=g*w,N=k*S,D=v/N,L=i.__goCache,M=null,A=Bt.gE;if(!o){if(i.Sn&&L!==void 0&&d<8e3&&f<8e3&&N>4&&D>A*A){L.Bt===null&&(L.vD(4,d,f,i),L.vD(16,d,f,i));let E=L.Bt,B=E.length;for(let X=0;X<B&&E[X].jd*E[X].jd<D;X++)M=E[X]}if(!e.od&&(this.Vf===null&&this.dE(),this.Vf))return}let F=p<r.width?b.offsetX+(r.width*b.x-p*b.x):0,O=g<r.height?b.offsetY+(r.height*b.y-g*b.y):0;switch(this.flip){case 0:break;case 2:t.translate(Math.min(r.width,p),0),t.scale(-1,1);break;case 1:t.translate(0,Math.min(r.height,g)),t.scale(1,-1);break;case 3:t.translate(Math.min(r.width,p),Math.min(r.height,g)),t.scale(-1,-1);break}if(t.commitTransform(),e.getRenderingHint("pictureRatioOptimization")&&!e.ph&&L!==void 0&&M!==null&&M.jd!==1){t.save();let E=M.jd;try{t.drawImage(M.en,a/E,h/E,Math.min(M.en.width,u/E),Math.min(M.en.height,c/E),F,O,Math.min(r.width,p),Math.min(r.height,g)),t instanceof re&&(this.O1=[a/E,h/E,Math.min(M.en.width,u/E),Math.min(M.en.height,c/E),F,O,Math.min(r.width,p),Math.min(r.height,g)])}catch{this.fy=!1}t.restore()}else try{t.drawImage(i,a,h,u,c,F,O,Math.min(r.width,p),Math.min(r.height,g)),t instanceof re&&(this.O1=[a,h,u,c,F,O,Math.min(r.width,p),Math.min(r.height,g)])}catch{this.fy=!1}switch(this.flip){case 0:break;case 2:t.scale(-1,1),t.translate(-Math.min(r.width,p),0);break;case 1:t.scale(1,-1),t.translate(0,-Math.min(r.height,g));break;case 3:t.scale(-1,-1),t.translate(-Math.min(r.width,p),-Math.min(r.height,g));break}}get naturalBounds(){return this.Ke}kd(t,e,i,s){let n=this.desiredSize,o=this.Zs(!0),r=this.ll,a=this.zf,h=0,l=0;(a||!this.Sn&&r&&r.complete)&&(this.Sn=!0),r===null?(isFinite(n.width)||(t=i),isFinite(n.height)||(e=s)):(h=a?+r.width:r.naturalWidth,l=a?+r.height:r.naturalHeight),!isFinite(n.width)&&o!==2&&o!==5?r!==null&&this.Sn!==!1&&(this.sourceRect.isReal()?t=this.sourceRect.width:t=h):(isFinite(t)||(this.sourceRect.isReal()?t=this.sourceRect.width:r!==null&&(t=h)),i=0),!isFinite(n.height)&&o!==2&&o!==4?r!==null&&this.Sn!==!1&&(this.sourceRect.isReal()?e=this.sourceRect.height:e=l):(isFinite(e)||(this.sourceRect.isReal()?e=this.sourceRect.height:r!==null&&(e=l)),s=0),isFinite(n.width)&&(t=n.width),isFinite(n.height)&&(e=n.height);let u=this.maxSize,c=this.minSize;i=Math.max(i||0,c.width),s=Math.max(s||0,c.height),t=Math.min(u.width,t),e=Math.min(u.height,e),t=Math.max(i,t),e=Math.max(s,e),r!==null&&!r.complete&&(isFinite(t)||(t=0),isFinite(e)||(e=0)),this.Ke.Yn(t,e),this.no(0,0,t,e)}Pa(t,e,i,s){this.commonArrange(t,e,i,s)}static uy=new bt;static sk=0;static gE=4}class Hn{Bt;constructor(){this.Bt=null}vD(t,e,i,s){this.Bt===null&&(this.Bt=[]);let n=new Fe(null),o=n._t,r=1/t;if(n.width=e/t,n.height=i/t,n.width===0||n.height===0)return;let a=new Wn(n.bt,t),h=s,l=1;if(this.Bt.length>0){let u=this.Bt[this.Bt.length-1];h=u.en,l=u.jd}o.setTransform(r*l,0,0,r*l,0,0),o.commitTransform(),o.drawImage(h,0,0),this.Bt.push(a)}}class Wn{en;jd;constructor(t,e){this.en=t,this.jd=e}}class Ce{Ne;fm;constructor(){this.fm=new wt,this.Ne=null}Ue(t){t!==null?(this.fm=t,t.figures.clear()):this.fm=new wt,this.Ne=null}Au(t,e,i,s,n,o){if(s!==void 0&&s===!0){let r=new mt(1);r.endX=t,r.endY=e,this.Ne.segments.add(r)}else this.Ne=new zt,this.Ne.startX=t,this.Ne.startY=e,this.Ne.isFilled=i,this.Ne.isEvenOdd=o||!1,this.fm.figures.add(this.Ne);n!==void 0&&(this.Ne.isShadowed=n)}_F(){let t=this.Ne.segments.length;t>0&&this.Ne.segments.elt(t-1).close()}tR(){this.Ne.segments.length>0&&(this.Ne.isFilled=!0)}eR(t){this.Ne.isShadowed=t}BU(t){this.Ne.isEvenOdd=t}$F(t,e,i){i===void 0&&(i=!1);let s=new mt(1);s.endX=t,s.endY=e,i&&s.close(),this.Ne.segments.add(s)}Ys(t,e,i){i===void 0&&(i=!1);let s=new mt(2);s.endX=t,s.endY=e,i&&s.close(),this.Ne.segments.add(s)}pr(t,e,i,s,n,o,r){r===void 0&&(r=!1);let a=new mt(3);a.point1X=t,a.point1Y=e,a.point2X=i,a.point2Y=s,a.endX=n,a.endY=o,r&&a.close(),this.Ne.segments.add(a)}Tu(t,e,i,s,n){n===void 0&&(n=!1);let o=new mt(4);o.point1X=t,o.point1Y=e,o.endX=i,o.endY=s,n&&o.close(),this.Ne.segments.add(o)}ZF(t,e,i,s,n,o,r){o===void 0&&(o=0),r===void 0&&(r=!1);let a=new mt(5);a.startAngle=t,a.sweepAngle=e,a.centerX=i,a.centerY=s,a.radiusX=n,o!==0?a.radiusY=o:a.radiusY=n,r&&a.close(),this.Ne.segments.add(a)}QF(t,e,i,s,n,o,r,a){a===void 0&&(a=!1);let h=new mt(6,o,r,t,e,i,s,n);a&&h.close(),this.Ne.segments.add(h)}static lC=null;static jL(t){let e=Ce.lC;if(e!==null)return Ce.lC=null,e.Ue(t),e;{let i=new Ce;return i.Ue(t),i}}static WL(t){Ce.lC=t}}{let x=function(n,o){let r=n.toLowerCase(),a=C.qn;a[n]=o,a[r]=n};x("Rectangle",(n,o,r)=>{let a="r"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(2),h.endX=o,h.endY=r,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h}),x("Square",(n,o,r)=>{let a="s"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(2),h.endX=o,h.endY=r,h.defaultStretch=6,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h});let t=(n,o,r,a,h)=>{(isNaN(a)||a<0)&&(a=5),isNaN(h)&&(h=15);let l="rr"+o+","+r+","+a+","+h,u=C.dr[l];if(u!==void 0)return u;let c=a;(h&1)===1?(c=Math.min(c,(h&2)===2?o/3:o),c=Math.min(c,(h&8)===8?r/3:r)):c=0;let d=new zt(c,0,!0);u=new wt().add(d);let f=T.TopLeft.copy(),p=T.BottomRight.copy();if((h&2)===2){let g=a;g=Math.min(g,(h&1)===1?o/3:o),g=Math.min(g,(h&4)===4?r/3:r);let y=g*C.Kn;d.add(new mt(2,o-g,0)).add(new mt(3,o,g,o-y,0,o,y)),f.offsetY=y,p.offsetX=-y}else d.add(new mt(2,o,0));if((h&4)===4){let g=a;g=Math.min(g,(h&8)===8?o/3:o),g=Math.min(g,(h&2)===2?r/3:r);let y=g*C.Kn;d.add(new mt(2,o,r-g)).add(new mt(3,o-g,r,o,r-y,o-y,r)),p.offsetX=-y,p.offsetY=-y}else d.add(new mt(2,o,r));if((h&8)===8){let g=a;g=Math.min(g,(h&4)===4?o/3:o),g=Math.min(g,(h&1)===1?r/3:r);let y=g*C.Kn;d.add(new mt(2,g,r)).add(new mt(3,0,r-g,y,r,0,r-y)),f.offsetX=y,p.offsetY=-y}else d.add(new mt(2,0,r));if((h&1)===1){let g=c*C.Kn;d.add(new mt(2,0,c)).add(new mt(3,c,0,0,g,g,0).close()),f.offsetX=g,f.offsetY=g}else d.add(new mt(2,0,0).close());return u.spot1=f,u.spot2=p,C.gr<C.lm&&(C.dr[l]=u,C.gr++),u};x("RoundedRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN,h=n?n.parameter2:NaN;return t(n,o,r,a,h)}),x("Border","RoundedRectangle"),x("RoundedTopRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,3)}),x("RoundedBottomRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,12)}),x("RoundedLeftRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,9)}),x("RoundedRightRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,6)}),x("Ellipse",(n,o,r)=>{let a="e"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(3),h.endX=o,h.endY=r,h.spot1=T.AP,h.spot2=T.TP,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h}),x("Circle",(n,o,r)=>{let a="c"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(3),h.endX=o,h.endY=r,h.spot1=T.AP,h.spot2=T.TP,h.defaultStretch=6,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h}),x("TriangleRight",(n,o,r)=>new wt().add(new zt(0,0).add(new mt(2,o,.5*r)).add(new mt(2,0,r).close())).setSpots(0,.25,.5,.75)),x("TriangleDown",(n,o,r)=>new wt().add(new zt(0,0).add(new mt(2,o,0)).add(new mt(2,.5*o,r).close())).setSpots(.25,0,.75,.5)),x("TriangleLeft",(n,o,r)=>new wt().add(new zt(o,r).add(new mt(2,0,.5*r)).add(new mt(2,o,0).close())).setSpots(.5,.25,1,.75)),x("TriangleUp",(n,o,r)=>new wt().add(new zt(o,r).add(new mt(2,0,r)).add(new mt(2,.5*o,0).close())).setSpots(.25,.5,.75,1)),x("Triangle","TriangleUp"),x("Diamond",(n,o,r)=>new wt().add(new zt(.5*o,0).add(new mt(2,0,.5*r)).add(new mt(2,.5*o,r)).add(new mt(2,o,.5*r).close())).setSpots(.25,.25,.75,.75)),x("LineH",(n,o,r)=>{let a=new wt(1);return a.startX=0,a.startY=r/2,a.endX=o,a.endY=r/2,a}),x("LineV",(n,o,r)=>{let a=new wt(1);return a.startX=o/2,a.startY=0,a.endX=o/2,a.endY=r,a}),x("None","Rectangle"),x("BarH","Rectangle"),x("BarV","Rectangle"),x("MinusLine","LineH"),x("PlusLine",(n,o,r)=>new wt().add(new zt(0,r/2,!1).add(new mt(2,o,r/2)).add(new mt(1,o/2,0)).add(new mt(2,o/2,r)))),x("XLine",(n,o,r)=>new wt().add(new zt(0,r,!1).add(new mt(2,o,0)).add(new mt(1,0,0)).add(new mt(2,o,r)))),x("LineRight",(n,o,r)=>new wt().add(new zt(.25*o,0,!1).add(new mt(2,.75*o,.5*r)).add(new mt(2,.25*o,r)))),x("LineDown",(n,o,r)=>new wt().add(new zt(0,.25*r,!1).add(new mt(2,.5*o,.75*r)).add(new mt(2,o,.25*r)))),x("LineLeft",(n,o,r)=>new wt().add(new zt(.75*o,0,!1).add(new mt(2,.25*o,.5*r)).add(new mt(2,.75*o,r)))),x("LineUp",(n,o,r)=>new wt().add(new zt(0,.75*r,!1).add(new mt(2,.5*o,.25*r)).add(new mt(2,o,.75*r)))),x("Capsule",(n,o,r)=>{let a=new wt;if(o<r){let h=o/2,l=new zt(0,h,!0);a.add(l),l.add(new mt(5,180,180,h,h,h,h)),l.add(new mt(2,o,r-h)),l.add(new mt(5,0,180,h,r-h,h,h)),l.add(new mt(2,0,h));let u=isFinite(n.parameter1)?n.parameter1:o*.156;return a.setSpots(0,0,1,1,0,u,0,-u),a}else if(o>r){let h=r/2,l=new zt(h,0,!0);a.add(l),l.add(new mt(2,o-h,0)),l.add(new mt(5,270,180,o-h,h,h,h)),l.add(new mt(2,h,r)),l.add(new mt(5,90,180,h,h,h,h));let u=isFinite(n.parameter1)?n.parameter1:r*.156;return a.setSpots(0,0,1,1,u,0,-u,0),a}else return a.type=3,a.endX=o,a.endY=r,a.spot1=T.AP,a.spot2=T.TP,a});let e=(n,o)=>new zt(n,o,!1,!1),i=(n,o,r)=>n.add(new mt(2,o,r)),s=(n,o,r)=>n.add(new mt(1,o,r));x("Borders",(n,o,r)=>{let a=n?n.parameter1:NaN;isNaN(a)?a=10:a=a&15;let h=new wt,l;return a===10?(l=e(o,0),i(l,o,r),s(l,0,r),i(l,0,0)):a===5?(l=e(0,0),i(l,o,0),s(l,o,r),i(l,0,r)):a===1?(l=e(0,0),i(l,o,0),s(l,o,r)):a===2?(l=e(o,0),i(l,o,r)):a===4?(l=e(o,r),i(l,0,r)):a===8?(l=e(0,r),i(l,0,0),s(l,o,r)):a===3?(l=e(0,0),i(l,o,0),i(l,o,r)):a===6?(l=e(o,0),i(l,o,r),i(l,0,r)):a===12?(l=e(o,r),i(l,0,r),i(l,0,0)):a===9?(l=e(0,r),i(l,0,0),i(l,o,0)):a===7?(l=e(0,0),i(l,o,0),i(l,o,r),i(l,0,r)):a===14?(l=e(o,0),i(l,o,r),i(l,0,r),i(l,0,0)):a===13?(l=e(o,r),i(l,0,r),i(l,0,0),i(l,o,0)):a===11?(l=e(0,r),i(l,0,0),i(l,o,0),i(l,o,r)):a===15?(l=e(0,0),i(l,o,0),i(l,o,r),i(l,0,r),l.add(new mt(2,0,0).close())):(l=e(0,0),s(l,o,r)),h.add(l),h})}C.rm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",BackwardOpenTriangleLine:"m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};var Gs=(x=>(x[x.None=0]="None",x[x.Added=1]="Added",x[x.Removed=2]="Removed",x[x.Shown=4]="Shown",x[x.Hidden=8]="Hidden",x[x.NodeSized=16]="NodeSized",x[x.GroupLayout=32]="GroupLayout",x[x.NodeReplaced=64]="NodeReplaced",x[x.Standard=127]="Standard",x[x.All=16777215]="All",x))(Gs||{});class pt extends G{b;$o;H;cl;fl;Zo;ue;ul;Da;sn;Qo;Wd;EM;FD;my;yy;constructor(t,e){let i;t===void 0||t instanceof Lt||typeof t=="string"?i=t:t&&(e=t),super(i),this.b=2408959,this.$o="",this.H=null,this.cl="",this.fl=null,this.Zo=null,this.ue="",this.ul=null,this.Da=null,this.sn=new P(NaN,NaN).k(),this.Qo=null,this.Wd=NaN,this.EM=-1,this.FD=new I,this.my=null,this.yy=NaN,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.b=this.b&-4097|16384|32768,t.$o=this.$o,this.H!==null&&(this.H.me?t.H=this.H:t.H=this.H.copy()),t.cl=this.cl,t.Zo=null,t.ue=this.ue,t.sn.h(this.sn),t.Wd=this.Wd}Yo(t){super.Yo(t),t.Sa(),t.fl=null,t.Qo=null,t.my=null}toString(){let t=m.Gn(this.constructor)+"#"+V.xs(this);return this.data!==null&&(t+="("+m.toString(this.data)+")"),t}static LayoutNone=0;static LayoutAdded=1;static LayoutRemoved=2;static LayoutShown=4;static LayoutHidden=8;static LayoutNodeSized=16;static LayoutGroupLayout=32;static LayoutNodeReplaced=64;static LayoutStandard=127;static LayoutAll=16777215;_e(){return this.H===null?this.H=new Gi:this.H.me&&(this.H=this.H.copy()),this.H}ba(){super.ba(),this.H!==null&&(this.H.me=!0)}gf(t,e,i,s,n,o,r){let a=this.diagram;a!==null&&(t===3&&e==="elements"?n instanceof G?n.Pn(h=>{a.partManager.M2(h,a)}):n instanceof Bt&&a.v2(n):t===4&&e==="elements"&&(n instanceof G?n.Pn(h=>a.partManager.N2(h,a)):n instanceof Bt&&a.F2(n)),a.raiseChangedEvent(t,e,i,s,n,o,r))}updateTargetBindings(t){if(super.updateTargetBindings(t),this.data===null)return;let e=this.D.r,i=e.length;for(let n=0;n<i;n++){let o=e[n];o instanceof G&&o.Pn(r=>{r.data!==null&&r.WI(t)})}let s=this.adornments;for(;s.next();)s.value.updateTargetBindings(t)}zo(){if(super.zo(),this.FN()){let e=this.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n instanceof G&&n.Pn(o=>o.zo())}}let t=this.adornments;for(;t.next();)t.value.zo()}updateRelationshipsFromData(){this.data!==null&&this.diagram?.partManager.updateRelationshipsFromData(this)}get key(){let t=this.diagram;if(t!==null)return t.model.getKeyForNodeData(this.data)}get adornments(){return this.Zo===null?Pt.instance:this.Zo.iteratorValues}findAdornment(t){let e=this.Zo;return e===null?null:e.get(t)}addAdornment(t,e){if(e===null)return;let i=null,s=this.Zo;if(s!==null&&(i=s.get(t)),i!==e){if(i!==null){let o=i.diagram;o!==null&&o.remove(i)}s===null&&(s=new Mt,this.Zo=s),e.$o!==t&&(e.category=t),s.set(t,e);let n=this.diagram;if(n!==null){n.add(e);let o=e.adornedObject;if(o!==null){let r=o.findBindingPanel();r!==null&&(e.data=r.data)}}}}removeAdornment(t){let e=this.Zo;if(e===null)return;let i=e.get(t);if(i!==null){let s=i.diagram;s!==null&&(s.remove(i),i.data=null)}e.delete(t),e.count===0&&(this.Zo=null)}clearAdornments(){let t=this.Zo;if(t===null)return;let e=m.st(),i=t.iterator;for(;i.next();){let n=i.key;e.push(n)}let s=e.length;for(let n=0;n<s;n++)this.removeAdornment(e[n]);m.Z(e)}updateAdornments(){let t=this.diagram;if(t===null)return;this.mE(t),this.pE(t);let e=this.adornments;for(;e.next();){let i=e.value;i.f(),i.hasPlaceholder()&&i.placeholder.f()}for(e=this.adornments;e.next();)e.value.updateTargetBindings()}invalidateAdornments(){let t=this.diagram;t!==null&&(t.ha(),this.RD()!==!0&&this.OD(!0))}UM(){this.RD()!==!1&&(this.updateAdornments(),this.OD(!1))}mE(t){let e="Selection";if(this.isSelected&&this.selectionAdorned){let i=this.selectionObject;if(i!==null&&this.actualBounds.isReal()&&this.isVisible()&&i.isVisibleObject()&&i.actualBounds.isReal()){let s=this.findAdornment(e);if(s===null){let n=this.selectionAdornmentTemplate;n===null&&(this.Nr()?n=t.linkSelectionAdornmentTemplate:this instanceof ht?n=t.groupSelectionAdornmentTemplate:n=t.nodeSelectionAdornmentTemplate),s=n.copy(),s!==null&&(this.Nr()&&this.selectionObject===this.path&&(s.type=G.Link),s.adornedObject=i)}if(s!==null){s.type===G.Link&&s.f(),this.addAdornment(e,s);return}}}this.removeAdornment(e)}pE(t){let e=this;t.toolManager.mouseDownTools.each(i=>{i.isEnabled&&i.updateAdornments(e)}),t.toolManager.updateAdornments(e)}OM(t){this.ul=t,t===null&&this.uI()}get layer(){return this.ul}get diagram(){let t=this.ul;return t==null?null:t.diagram}get layerName(){return this.cl}set layerName(t){let e=this.cl;if(e===t)return;let i=this.diagram;if(i!==null&&(i.findLayer(t)===null||i.partManager.addsToTemporaryLayer))return;this.cl=t,i!==null&&i.invalidateDocumentBounds(),this.t("layerName",e,t);let s=this.layer;if(s===null||s.name===t||(i=s.diagram,i===null))return;let n=i.findLayer(t);if(n===null||n===s)return;let o=s.ri(-1,this,!0);o>=0&&i.raiseChangedEvent(4,"parts",s,this,null,o,!0),o=n.ch(99999999,this,!0),s.visible!==n.visible&&this.Xe(n.visible),o>=0&&i.raiseChangedEvent(3,"parts",n,null,this,!0,o);let r=this.layerChanged;if(r===null)return;let a=i.G;i.G=!0,r(this,s,n),i.G=a}get layerChanged(){return this.H!==null?this.H.wy:null}set layerChanged(t){let e=this.layerChanged;e!==t&&(t!==null&&m.S(t,pt,"layerChanged"),this._e().wy=t,this.t("layerChanged",e,t))}get zOrder(){return this.Wd}set zOrder(t){let e=this.Wd;if(e===t)return;this.Wd=t;let i=this.layer;i!==null&&i.nb(-1,this),this.t("zOrder",e,t);let s=this.diagram;s!==null&&s.C()}yE(){let t=this.layer;t!==null&&t.nb(-1,this)}rk(){if(this.fa()!==!1)return;this.aC(!0),this.yf();let t=this.diagram;t!==null&&(t.Sp(this),t.requestUpdate())}ID(){if(this.b|=2097152,this.fa()===!1)return;let t=this.position,e=this.location;(!e.isReal()||!t.isReal())&&this.ED(t,e);let i=this.De,s=I.l().h(i);i.ce(),i.x=t.x,i.y=t.y,i.k(),this.Pd(s,i),I.i(s),this.aC(!1),this.yf()}no(t,e,i,s){let n=this.hi;n.e(t,e,i,s),this.Se===null&&(this.Se=new Nt);let o=this.Se;o.Ue(),this.Xp(o,t,e,i,s),this.Se=o,o.DP()||o.im(n)}Xp(t,e,i,s,n){if(this.et!==1&&t.et(this.et),this.Xt===0)return;let o=T.Center;this.locationSpot.isSpot()&&(o=this.locationSpot);let r=P.l();if(this.locationObject!==this){let a=this.locationObject,h=a.naturalBounds;r.setSpot(h.x,h.y,h.width,h.height,o),a.Se!==null&&a.Se.gt(r),r.offset(-a.measuredBounds.x,-a.measuredBounds.y);let l=a.panel;for(;l!==null&&l!==this;)l.Se!==null&&l.Se.gt(r),r.offset(-l.measuredBounds.x,-l.measuredBounds.y),l=l.panel}else r.setSpot(e,i,s,n,o);t.ks(this.Xt,r.x,r.y),P.i(r)}get locationObject(){if(this.Qo===null)if(this instanceof vt&&this.type!==G.Link&&this.hasPlaceholder())this.Qo=this.placeholder;else{let t=this.locationObjectName;if(t!==""){let e=this.findObject(t);e!==null?this.Qo=e:this.Qo=this}else this.Qo=this}return this.Qo?.visible?this.Qo:this}get minLocation(){return this.H!==null?this.H.xy:P.DL}set minLocation(t){let e=this.minLocation;e.equals(t)||(t=t.N(),this._e().xy=t,this.t("minLocation",e,t))}get maxLocation(){return this.H!==null?this.H.ky:P.vL}set maxLocation(t){let e=this.maxLocation;e.equals(t)||(t=t.N(),this._e().ky=t,this.t("maxLocation",e,t))}get locationObjectName(){return this.H!==null?this.H.Py:""}set locationObjectName(t){let e=this.locationObjectName;e!==t&&(this._e().Py=t,this.Qo=null,this.f(),this.t("locationObjectName",e,t))}get locationSpot(){return this.H!==null?this.H.Sy:T.TopLeft}set locationSpot(t){let e=this.locationSpot;e.equals(t)||(t=t.N(),this._e().Sy=t,this.f(),this.t("locationSpot",e,t))}move(t,e){e===!0?this.location=t:this.position=t}moveTo(t,e,i){let s=P.z(t,e);this.move(s,i),P.i(s)}isVisible(){if(!this.visible)return!1;let t=this.layer;if(t!==null){if(!t.visible)return!1;let i=t.diagram;if(i!==null&&i.animationManager.qx(this))return!0}let e=this.containingGroup;return!(e!==null&&(!e.isSubGraphExpanded||!e.isVisible()))}Xe(t){let e=this.diagram;t?(this.invalidateLayout(4),this.invalidateAdornments(),e!==null&&e.Sp(this)):(this.invalidateLayout(8),this.clearAdornments()),this.Sa(),e!==null&&(e.invalidateDocumentBounds(),this instanceof $&&this.canAvoid()&&e.ud(this),e.C())}findObject(t){if(this.name===t)return this;let e=this.my;if(e===null&&(this.my=e=new Mt),e.get(t)!==null)return e.get(t);let i=super.findObject(t);return i!==null?(e.set(t,i),i):(e.set(t,null),null)}t0(){this.my=null}getRelativePoint(t,e,i){i===void 0&&(i=new P);let s=e.isNoSpot()?T.Center:e,n=t.naturalBounds;if(i.e(n.width*s.x+s.offsetX,n.height*s.y+s.offsetY),t===null||t===this)return i;t.v.gt(i);let o=t.panel;for(;o!==null&&o!==this;)o.v.gt(i),o=o.panel;return this.Se!==null&&this.Se.gt(i),i.offset(-this.hi.x,-this.hi.y),i}getDocumentBounds(t){return t===void 0&&(t=new I),t.h(this.actualBounds)}ensureBounds(){this.ht(1/0,1/0),this.Ut()}cD(t){let e=this.locationSpot,i=this.locationObject,s=i.naturalBounds;s.isReal()||(s=I.tm);let n=i instanceof et?i.strokeWidth:0;if(t.setSpot(0,0,s.width+n,s.height+n,e),i!==this){t.offset(-n/2,-n/2),i.v.gt(t);let o=i.panel;for(;o!==null&&o!==this;)o.v.gt(t),o=o.panel}return this.Se!==null&&this.Se.gt(t),t.offset(-this.hi.x,-this.hi.y),t}hh(t,e){let i=e===void 0?this.FD:e,s=this.wE(),n=s*2;if(!this.isShadowed)return i.e(t.x-1-s,t.y-1-s,t.width+2+n,t.height+2+n),i;let o=t.x,r=t.y,a=t.width,h=t.height,l=this.shadowBlur,u=this.shadowOffset;return a+=l,h+=l,o-=l/2,r-=l/2,u.x>0?a+=u.x:(o+=u.x,a-=u.x),u.y>0?h+=u.y:(r+=u.y,h-=u.y),i.e(o-1,r-1,a+2,h+2),i}tE(){return this.type===G.Link&&this instanceof vt&&this.category==="Selection"&&this.adornedObject instanceof et&&this.adornedPart.findMainElement()===this.adornedObject?this.adornedObject.strokeWidth:0}wE(){return isNaN(this.yy)&&(this.yy=this.yD()),this.yy}Df(){this.yy=NaN}Ut(){if(this.as()===!1){this.ID();return}this.oo(!1);let t=this.De,e=I.l();e.h(t);let i=this.Ul();this.Pa(0,0,this.hi.width,this.hi.height);let s=this.position;this.ED(s,this.location),t.ce(),t.x=s.x,t.y=s.y,t.k(),this.Pd(e,t),e.equals(t)?this.rs(i):this.Di()&&(!C.c(e.width,t.width)||!C.c(e.height,t.height))&&this.EM>=0&&this.invalidateLayout(16),I.i(e),this.aC(!1)}Pd(t,e){let i=this.diagram;if(i===null)return;let s=!1;if(i.mh===!1&&t.isReal()){let n=I.l();n.h(i.documentBounds),n.subtractMargin(i.padding),t.x>n.x&&t.y>n.y&&t.right<n.right&&t.bottom<n.bottom&&e.x>n.x&&e.y>n.y&&e.right<n.right&&e.bottom<n.bottom&&(s=!0),I.i(n)}(this.xE()===!0||!t.equals(e))&&this.dT(s,i),i.C(),!(!t.isReal()&&!e.isReal()||t.equalsApproxClose(e))&&(this instanceof $&&!i.undoManager.isUndoingRedoing&&this.invalidateConnectedLinks(),this.Sa())}get location(){return this.sn}set location(t){let e=t.x,i=t.y,s=this.sn;(s.x!==e&&(!isNaN(s.x)||!isNaN(e))||s.y!==i&&(!isNaN(s.y)||!isNaN(i)))&&(t=t.copy(),this.bE(t,s)&&this.t("location",s,t.copy()))}bE(t,e){if(this.Nr())return!1;if(this.sn=t,this.b|=2097152,this.as()===!1){this.rk();let i=this.ct;if(i.isReal()){let s=this.diagram;if(s===null||s.animationManager.isTicking||!s.undoManager.isUndoingRedoing){let n=i.copy();i.e(i.x+(t.x-e.x),i.y+(t.y-e.y)),this.UD(s,i,n.x,n.y),this.t("position",n,i.copy())}}}return!0}TN(t,e,i){if(this.Nr()||!t.isReal())return!1;let s=this.diagram;if(s!==null&&this.UD(s,t,e,i),this.ct=t,this.b&=-2097153,this.sn.isReal()&&(s===null||s.animationManager.isTicking||!s.undoManager.isUndoingRedoing)){let n=this.sn;this.sn=new P(n.x+(t.x-e),n.y+(t.y-i)).k(),this.t("location",n,this.sn.copy())}return this.fa()===!1&&this.as()===!1&&(this.rk(),this.ID()),!0}UD(t,e,i,s){if(t===null||this instanceof vt)return;let n=t.animationManager;n.ke&&n.vA(this,new P(i,s),e,!1)}Vc(t,e,i){let s=this.sn,n=this.ct;if(i){if(s.x===t&&s.y===e)return;this.fa()||this.as()?n.e(NaN,NaN):n.e(n.x+t-s.x,n.y+e-s.y),s.e(t,e)}else{if(n.x===t&&n.y===e)return;s.e(s.x+t-n.x,s.y+e-n.y),n.e(t,e)}this.rk()}DN(){this.b&=-2097153,this.rk()}ED(t,e){let i=this.cD(P.l()),s=this.diagram,n=e.isReal(),o=t.isReal();n&&o?(this.b&2097152)!==0?this.VD(t,e,s,i):this.BD(t,e,s,i):n?this.VD(t,e,s,i):o&&this.BD(t,e,s,i),this.b|=2097152,P.i(i),this.yf()}VD(t,e,i,s){let n=t.x,o=t.y;if(t.e(e.x-s.x,e.y-s.y),i!==null){let r=i.animationManager,a=r.defaultAnimation.isAnimating;!a&&r.ke&&!(this instanceof vt)&&r.vA(this,new P(n,o),t,!1),!a&&!(t.x===n&&t.y===o)&&this.t("position",new P(n,o),t.copy())}}BD(t,e,i,s){let n=e.copy();e.e(t.x+s.x,t.y+s.y),!e.equals(n)&&i!==null&&this.t("location",n,e.copy())}dT(t,e){this.MN(!1),this instanceof $&&e.ud(this),!this.layer.isTemporary&&!t&&e.invalidateDocumentBounds();let i=this.De,s=e.viewportBounds;s.isReal()?this.Ul()?(i.UL(s,10)||this.rs(!1),this.updateAdornments()):this.isVisible()&&i.intersectsRect(s)?(this.rs(!0),this.updateAdornments()):this.invalidateAdornments():e.ef=!0}$r(){return!0}Di(){return!0}Nr(){return!1}Qs(){return!0}hasPlaceholder(){return!1}get category(){return this.$o}set category(t){let e=this.$o;if(e===t)return;this.svg!==null&&(this.svg.remove(),this.Ji(!0));let i=this.diagram,s=this.data,n=null;if(i!==null&&s!==null&&!(this instanceof vt)){let o=i.model.undoManager;o.isEnabled&&!o.isUndoingRedoing&&(n=this.clone(),n.D.addAll(this.D))}if(this.$o=t,this.t("category",e,t),i!==null&&s!==null&&!(this instanceof vt)){let o=i.model;if(o.undoManager.isUndoingRedoing)return;if(this.Nr()){i.partManager.setLinkCategoryForData(s,t);let r=i.partManager.findLinkTemplateForCategory(t);if(r!==null){r.It();let a=r.copy();a!==null&&this.hC(a,e,t)}}else{o!==null&&o.setCategoryForNodeData(s,t);let r=i.partManager.findTemplateForNodeData(s,t);if(r!==null){r.It();let a=r.copy();if(a!==null&&!(a instanceof j)){let h=this.location.copy();this.hC(a,e,t),this.location.isReal()||(this.location=h)}}}if(n!==null){let r=this.clone();r.D.addAll(this.D),this.t("self",n,r)}}else if(this instanceof vt){let o=this.adornedPart;if(o!==null){let r=o.Zo;r!==null&&r.delete(e),o.addAdornment(this.category,this)}}}get self(){return this}set self(t){this.hC(t,this.category,t.category)}static zD=!1;hC(t,e,i){t.constructor!==this.constructor&&(pt.zD||(pt.zD=!0,m.ne('Should not change the class of the Part when changing category from "'+e+'" to "'+i+'"'),m.ne(" Old class: "+m.Gn(this.constructor)+", new class: "+m.Gn(t.constructor)+", part: "+this.toString()))),this.clearAdornments();let s=this.data,n=this.layerName,o=this.isSelected,r=this.isHighlighted,a=!0,h=!0,l=!1;this instanceof $&&(a=this.isTreeLeaf,h=this.isTreeExpanded,l=this.wasTreeExpanded),t.Yo(this),t.cloneProtected(this),this.$o=i,this.svg!==null&&(this.svg.remove(),this.Jc(),this.Ji(!0)),this.f(),this.C();let u=this.diagram,c=!0;u!==null&&(c=u.skipsUndoManager,u.skipsUndoManager=!0),this.te=s,this.b=o?this.b|4096:this.b&-4097,this.b=r?this.b|524288:this.b&-524289,this instanceof $&&(this.E=a?this.E|4:this.E&-5,this.E=h?this.E|1:this.E&-2,this.E=l?this.E|2:this.E&-3),s!==null&&this.updateTargetBindings();let d=this.layerName;d!==n&&(this.cl=n,this.layerName=d),u!==null&&(u.skipsUndoManager=c),this.Di()&&this.invalidateLayout(64)}canCopy(){if(!this.copyable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowCopy)return!1;let e=t.diagram;return e===null?!0:!!e.allowCopy}canDelete(){if(!this.deletable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowDelete)return!1;let e=t.diagram;return e===null?!0:!!e.allowDelete}canEdit(){if(!this.textEditable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowTextEdit)return!1;let e=t.diagram;return e===null?!0:!!e.allowTextEdit}canGroup(){if(!this.groupable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowGroup)return!1;let e=t.diagram;return e===null?!0:!!e.allowGroup}canMove(){if(!this.movable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowMove)return!1;let e=t.diagram;return e===null?!0:!!e.allowMove}canReshape(){if(!this.reshapable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowReshape)return!1;let e=t.diagram;return e===null?!0:!!e.allowReshape}canResize(){if(!this.resizable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowResize)return!1;let e=t.diagram;return e===null?!0:!!e.allowResize}canRotate(){if(!this.rotatable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRotate)return!1;let e=t.diagram;return e===null?!0:!!e.allowRotate}canSelect(){if(!this.selectable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowSelect)return!1;let e=t.diagram;return e===null?!0:!!e.allowSelect}get copyable(){return(this.b&1)!==0}set copyable(t){let e=(this.b&1)!==0;e!==t&&(this.b=this.b^1,this.t("copyable",e,t))}get deletable(){return(this.b&2)!==0}set deletable(t){let e=(this.b&2)!==0;e!==t&&(this.b=this.b^2,this.t("deletable",e,t))}get textEditable(){return(this.b&4)!==0}set textEditable(t){let e=(this.b&4)!==0;e!==t&&(this.b=this.b^4,this.t("textEditable",e,t),this.invalidateAdornments())}get groupable(){return(this.b&8)!==0}set groupable(t){let e=(this.b&8)!==0;e!==t&&(this.b=this.b^8,this.t("groupable",e,t))}get movable(){return(this.b&16)!==0}set movable(t){let e=(this.b&16)!==0;e!==t&&(this.b=this.b^16,this.t("movable",e,t))}get selectionAdorned(){return(this.b&32)!==0}set selectionAdorned(t){let e=(this.b&32)!==0;e!==t&&(this.b=this.b^32,this.t("selectionAdorned",e,t),this.invalidateAdornments())}get isInDocumentBounds(){return(this.b&64)!==0}set isInDocumentBounds(t){let e=(this.b&64)!==0;if(e!==t){this.b=this.b^64;let i=this.diagram;i!==null&&i.invalidateDocumentBounds(),this.t("isInDocumentBounds",e,t)}}get isLayoutPositioned(){return(this.b&128)!==0}set isLayoutPositioned(t){let e=(this.b&128)!==0;e!==t&&(this.b=this.b^128,this.t("isLayoutPositioned",e,t),this.invalidateLayout(t?4:8))}get selectable(){return(this.b&256)!==0}set selectable(t){let e=(this.b&256)!==0;e!==t&&(this.b=this.b^256,this.t("selectable",e,t),this.invalidateAdornments())}get reshapable(){return(this.b&512)!==0}set reshapable(t){let e=(this.b&512)!==0;e!==t&&(this.b=this.b^512,this.t("reshapable",e,t),this.invalidateAdornments())}get resizable(){return(this.b&1024)!==0}set resizable(t){let e=(this.b&1024)!==0;e!==t&&(this.b=this.b^1024,this.t("resizable",e,t),this.invalidateAdornments())}get rotatable(){return(this.b&2048)!==0}set rotatable(t){let e=(this.b&2048)!==0;e!==t&&(this.b=this.b^2048,this.t("rotatable",e,t),this.invalidateAdornments())}get isSelected(){return(this.b&4096)!==0}set isSelected(t){let e=(this.b&4096)!==0;if(e!==t){let i=this.diagram;if(t){if(!this.canSelect())return;if(i!==null){let o=i.maxSelectionCount;if(i.selection.count>=o)return}}this.b=this.b^4096;let s=!1;if(i!==null){s=i.skipsUndoManager,i.skipsUndoManager=!0;let o=i.selection;o.ce(),t?o.add(this):o.delete(this),o.k()}this.t("isSelected",e,t),this.invalidateAdornments();let n=this.selectionChanged;n!==null&&n(this),i!==null&&(i.requestUpdate(),i.skipsUndoManager=s)}}get isHighlighted(){return(this.b&524288)!==0}set isHighlighted(t){let e=(this.b&524288)!==0;if(e!==t){this.b=this.b^524288;let i=this.diagram;if(i!==null){let n=i.highlighteds;n.ce(),t?n.add(this):n.delete(this),n.k()}this.t("isHighlighted",e,t),this.C();let s=this.highlightedChanged;s!==null&&s(this)}}get isShadowed(){return(this.b&8192)!==0}set isShadowed(t){let e=(this.b&8192)!==0;e!==t&&(this.b=this.b^8192,this.Ji(!0),this.t("isShadowed",e,t),this.C())}RD(){return(this.b&16384)!==0}OD(t){t?this.b|=16384:this.b&=-16385}fa(){return(this.b&32768)!==0}aC(t){t?this.b|=32768:this.b&=-32769}xE(){return(this.b&65536)!==0}MN(t){t?this.b|=65536:this.b&=-65537}Ul(){return(this.b&131072)!==0}rs(t){t?this.b|=131072:this.b&=-131073}XD(){return(this.b&1048576)!==0}lk(t){t?this.b|=1048576:this.b&=-1048577}get isAnimated(){return(this.b&262144)!==0}set isAnimated(t){let e=(this.b&262144)!==0;e!==t&&(this.b=this.b^262144,this.t("isAnimated",e,t))}get highlightedChanged(){return this.H!==null?this.H.My:null}set highlightedChanged(t){let e=this.highlightedChanged;e!==t&&(t!==null&&m.S(t,pt,"highlightedChanged"),this._e().My=t,this.t("highlightedChanged",e,t))}get selectionObjectName(){return this.H!==null?this.H.Ny:""}set selectionObjectName(t){let e=this.selectionObjectName;e!==t&&(this._e().Ny=t,this.fl=null,this.t("selectionObjectName",e,t))}get selectionAdornmentTemplate(){return this.H!==null?this.H.Cy:null}set selectionAdornmentTemplate(t){let e=this.selectionAdornmentTemplate;e!==t&&(t!==null&&t.It(),this._e().Cy=t,this.t("selectionAdornmentTemplate",e,t))}get selectionObject(){if(this.fl===null){let t=this.selectionObjectName;if(t!==null&&t!==""){let e=this.findObject(t);e!==null?this.fl=e:this.fl=this}else if(this instanceof j){let e=this.path;e!==null?this.fl=e:this.fl=this}else this.fl=this}return this.fl}get selectionChanged(){return this.H!==null?this.H.Ly:null}set selectionChanged(t){let e=this.selectionChanged;e!==t&&(t!==null&&m.S(t,pt,"selectionChanged"),this._e().Ly=t,this.t("selectionChanged",e,t))}get resizeAdornmentTemplate(){return this.H!==null?this.H.Ay:null}set resizeAdornmentTemplate(t){let e=this.resizeAdornmentTemplate;e!==t&&(this._e().Ay=t!==null?t.It():null,this.t("resizeAdornmentTemplate",e,t))}get resizeObjectName(){return this.H!==null?this.H.Ty:""}set resizeObjectName(t){let e=this.resizeObjectName;e!==t&&(this._e().Ty=t,this.t("resizeObjectName",e,t))}get resizeObject(){let t=this.resizeObjectName;if(t!==""){let e=this.findObject(t);if(e!==null)return e}return this}get resizeCellSize(){return this.H!==null?this.H.Dy:st.Ww}set resizeCellSize(t){let e=this.resizeCellSize;e.equals(t)||(t=t.N(),this._e().Dy=t,this.t("resizeCellSize",e,t))}get rotateAdornmentTemplate(){return this.H!==null?this.H.vy:null}set rotateAdornmentTemplate(t){let e=this.rotateAdornmentTemplate;e!==t&&(this._e().vy=t!==null?t.It():null,this.t("rotateAdornmentTemplate",e,t))}get rotateObjectName(){return this.H!==null?this.H.Fy:""}set rotateObjectName(t){let e=this.rotateObjectName;e!==t&&(this._e().Fy=t,this.t("rotateObjectName",e,t))}get rotateObject(){let t=this.rotateObjectName;if(t!==""){let e=this.findObject(t);if(e!==null)return e}return this}get rotationSpot(){return this.H!==null?this.H.Ry:T.Default}set rotationSpot(t){let e=this.rotationSpot;e.equals(t)||(t=t.N(),this._e().Ry=t,this.t("rotationSpot",e,t))}get text(){return this.ue}set text(t){let e=this.ue;e!==t&&(this.ue=t,this.t("text",e,t))}get containingGroup(){return this.Da}set containingGroup(t){if(this.Di()){let e=this.Da;if(e!==t){t!==null&&(this===t||t.isMemberOf(this))&&(this===t&&m.o("Cannot make a Group a member of itself: "+this.toString()),m.o("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+t.toString())),this.invalidateLayout(2);let i=this.diagram;if(e!==null?e.cC(this):this instanceof ht&&i!==null&&i.Wr.delete(this),this.Da=t,t!==null?t.fC(this):this instanceof ht&&i!==null&&i.Wr.add(this),this.invalidateLayout(1),i!==null&&i.G){let n=this.data,o=i.model;if(n!==null&&o.Th()){let r=t!==null?t.data:null;o.setGroupForData(n,o.getKeyForNodeData(r))}}let s=this.containingGroupChanged;if(s!==null){let n=!0;i!==null&&(n=i.G,i.G=!0),s(this,e,t),i!==null&&(i.G=n)}if(this instanceof ht){let n=new V;pt.ga(n,this,!0,0,!0);let o=n.iterator;for(;o.next();){let r=o.value;if(r instanceof $){let a=r.linksConnected;for(;a.next();)a.value.Jd()}}}if(this instanceof $){let n=this.linksConnected;for(;n.next();)n.value.Jd();let o=this.labeledLink;o!==null&&o.Jd()}this.t("containingGroup",e,t),t!==null&&t.yE()}}else m.o("cannot set the Part.containingGroup of a Link or Adornment")}Sa(){let t=this.containingGroup;t!==null&&(t.hasPlaceholder()&&t.placeholder.f(),t.f(),t.invalidateConnectedLinks())}C(){let t=this.diagram;t!==null&&!this.as()&&!this.fa()&&this.isVisible()&&this.De.isReal()&&t.C(this.hh(this.De))}f(){if(this.Bo())return;super.f();let t=this.diagram;t!==null&&(t.Sp(this),this instanceof $&&this.labeledLink!==null&&this.labeledLink.Pf(),t.requestUpdate(!0))}Pf(t){if(this.as())return;let e=this.diagram;e!==null&&(e.Sp(this),this instanceof $&&this.invalidateConnectedLinks(),e.requestUpdate()),this.oo(!0)}Zm(t){if(!t){let e=this.Da;e!==null&&e.fC(this)}}Qm(t){if(!t){let e=this.Da;e!==null&&e.cC(this)}}af(){let t=this.data;if(t!==null){let e=this.diagram;if(e!==null){let i=e.model;i!==null&&i.removeNodeData(t)}}}get containingGroupChanged(){return this.H!==null?this.H.Oy:null}set containingGroupChanged(t){let e=this.containingGroupChanged;e!==t&&(t!==null&&m.S(t,pt,"containingGroupChanged"),this._e().Oy=t,this.t("containingGroupChanged",e,t))}findSubGraphLevel(){return this.uC(this)}uC(t){let e=t.containingGroup;if(e!==null)return 1+this.uC(e);if(t instanceof $){let i=t.labeledLink;if(i!==null)return this.uC(i)}return 0}findTopLevelPart(){return this.dC(this)}dC(t){let e=t.containingGroup;if(e!==null)return this.dC(e);if(t instanceof $){let i=t.labeledLink;if(i!==null)return this.dC(i)}return t}get isTopLevel(){return!(this.containingGroup!==null||this instanceof $&&this.labeledLink!==null)}isMemberOf(t){return t instanceof ht?this.gC(this,t):!1}gC(t,e){if(t===e||e===null)return!1;let i=t.containingGroup;if(i!==null&&(i===e||this.gC(i,e)))return!0;if(t instanceof $){let s=t.labeledLink;if(s!==null)return this.gC(s,e)}return!1}findCommonContainingGroup(t){if(t===null)return null;if(this===t)return this.containingGroup;let e=this;for(;e!==null;){if(e instanceof ht&&e.lk(!0),e instanceof $){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}let i=null;for(e=t;e!==null;){if(e.XD()){i=e;break}if(e instanceof $){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}for(e=this;e!==null;){if(e instanceof ht&&e.lk(!1),e instanceof $){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}return i}get layoutConditions(){return this.H!==null?this.H.Iy:127}set layoutConditions(t){let e=this.layoutConditions;e!==t&&(this._e().Iy=t,this.t("layoutConditions",e,t))}canLayout(){if(!this.isLayoutPositioned||!this.isVisible())return!1;let t=this.layer;return!(t!==null&&t.isTemporary||this instanceof $&&this.isLinkLabel)}kE(t){if(!this.isLayoutPositioned||(t&this.layoutConditions)===0)return!1;let e=this.layer;if(e!==null&&e.isTemporary||this instanceof $&&this.isLinkLabel)return!1;let i=this.diagram;return!(i!==null&&i.undoManager.isUndoingRedoing)}invalidateLayout(t){if(t===void 0&&(t=16777215),!this.kE(t))return;let e=this.Da;if(e!==null){let i=e.layout;i!==null?i.p():e.invalidateLayout(t)}else{let i=this.diagram;if(i!==null){let s=i.layout;s!==null&&s.p()}}}gT(){if(!this.isVisible())return!1;let t=this.layer;return!(t!==null&&t.isTemporary)}static ga(t,e,i,s,n,o){if(o===void 0&&(o=null),!t.has(e)&&!(o!==null&&!o(e))&&!(e instanceof vt)){if(t.add(e),e instanceof $){if(i&&e instanceof ht){let r=e.memberParts;for(;r.next();){let a=r.value;pt.ga(t,a,i,s,n,o)}}if(n!==!1){let r=e.linksConnected;for(;r.next();){let a=r.value;if(t.has(a))continue;let h=a.fromNode,l=a.toNode,u=h===null||t.has(h),c=l===null||t.has(l);(n?u&&c:u||c)&&pt.ga(t,a,i,s,n,o)}}if(s>1){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;pt.ga(t,a,i,s-1,n,o)}}}else if(e instanceof j){let r=e.labelNodes;for(;r.next();){let a=r.value;pt.ga(t,a,i,s,n,o)}}}}get dragComputation(){return this.H!==null?this.H.Ey:null}set dragComputation(t){let e=this.dragComputation;e!==t&&(t!==null&&m.S(t,pt,"dragComputation"),this._e().Ey=t,this.t("dragComputation",e,t))}get shadowOffset(){return this.H!==null?this.H.Uy:P.FL}set shadowOffset(t){let e=this.shadowOffset;e.equals(t)||(t=t.N(),this._e().Uy=t,this.C(),this.t("shadowOffset",e,t))}get shadowColor(){return this.H!==null?this.H.Vy:"gray"}set shadowColor(t){let e=this.shadowColor;e!==t&&(this._e().Vy=t,this.C(),this.t("shadowColor",e,t))}get shadowBlur(){return this.H!==null?this.H.Ln:4}set shadowBlur(t){let e=this.shadowBlur;e!==t&&(this._e().Ln=t,this.C(),this.t("shadowBlur",e,t))}}class Gi{me;wy;Oy;Cy;Ny;Ly;My;Ay;Ty;Dy;vy;Fy;Ry;Py;Sy;xy;ky;Ey;Iy;Uy;Vy;Ln;constructor(){this.me=!1,this.wy=null,this.Oy=null,this.Cy=null,this.Ny="",this.Ly=null,this.My=null,this.Ay=null,this.Ty="",this.Dy=st.Ww,this.vy=null,this.Fy="",this.Ry=T.Default,this.Py="",this.Sy=T.TopLeft,this.xy=P.DL,this.ky=P.vL,this.Ey=null,this.Iy=127,this.Uy=P.FL,this.Vy="gray",this.Ln=4}copy(){let t=new Gi;return t.wy=this.wy,t.Oy=this.Oy,t.Cy=this.Cy,t.Ny=this.Ny,t.Ly=this.Ly,t.My=this.My,t.Ay=this.Ay,t.Ty=this.Ty,t.Dy=this.Dy.N(),t.vy=this.vy,t.Fy=this.Fy,t.Ry=this.Ry.N(),t.Py=this.Py,t.Sy=this.Sy.N(),t.xy=this.xy.N(),t.ky=this.ky.N(),t.Ey=this.Ey,t.Iy=this.Iy,t.Uy=this.Uy.N(),t.Vy=this.Vy,t.Ln=this.Ln,t}}class vt extends pt{Ms;Dt;qS;jS;Af;constructor(t,e){let i;t===void 0||t instanceof Lt||typeof t=="string"?i=t:t&&(e=t),super(i),this.b&=-257,this.cl="Adornment",this.Ms=null,this.qS=0,this.jS=!1,this.Dt=null,this.Af=null,e&&Object.assign(this,e)}toString(){let t=this.adornedPart;return"Adornment("+this.category+")"+(t!==null?t.toString():"")}updateRelationshipsFromData(){}Dd(t){let e=this.adornedObject;if(!(e instanceof et))return;let i=e.part;if(!(i instanceof j))return;let s=i.path,n=s.geometry;i.Dd(t),n=s.geometry;let o=this.D.r,r=o.length;for(let a=0;a<r;a++){let h=o[a];h.isPanelMain&&h instanceof et&&(h.ut=n)}}hasPlaceholder(){return this.Dt!==null&&this.Dt.isVisibleObject()}get placeholder(){return this.Dt}get adornedObject(){return this.Ms}set adornedObject(t){let e=this.adornedPart,i=null;t!==null&&(i=t.part),e!==null&&(t===null||e!==i)&&e.removeAdornment(this.category),this.Ms=t,i!==null&&i.addAdornment(this.category,this)}get adornedPart(){let t=this.Ms;return t!==null?t.part:null}$r(){let t=this.Ms;if(t===null)return!0;let e=t.part;return e===null||!e.as()}Di(){return!1}get containingGroup(){return null}gf(t,e,i,s,n,o,r){if(t===3&&e==="elements"){if(n instanceof le)this.Dt===null&&(this.Dt=n);else if(n instanceof G){let a=n.findInVisualTree(h=>h instanceof le);a instanceof le&&this.Dt===null&&(this.Dt=a)}}else t===4&&e==="elements"&&this.Dt!==null&&(s===this.Dt?this.Dt=null:s instanceof G&&this.Dt.isContainedBy(s)&&(this.Dt=null));super.gf(t,e,i,s,n,o,r)}updateAdornments(){}af(){}}var qs=(x=>(x[x.None=0]="None",x[x.Evenly=1]="Evenly",x[x.Packed=2]="Packed",x))(qs||{});class $ extends pt{E;vt;Xf;dl;va;ci;ee;constructor(t,e){let i;t===void 0||t instanceof Lt||typeof t=="string"?i=t:t&&(e=t),super(i),this.E=13,this.vt=null,this.ee=new q,this.Xf=null,this.dl=null,this.ci=null,this.va=!1,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.E=this.E,this.vt!==null&&(this.vt.me?t.vt=this.vt:t.vt=this.vt.copy())}Yo(t){super.Yo(t),t.invalidateConnectedLinks(),t.dl=this.dl,t.ci=null}static SpreadingNone=0;static SpreadingEvenly=1;static SpreadingPacked=2;gl(){return this.vt===null?this.vt=new qi:this.vt.me&&(this.vt=this.vt.copy()),this.vt}ba(){super.ba(),this.vt!==null&&(this.vt.me=!0)}GD(t){t!==null&&(this.dl===null&&(this.dl=new V),this.dl.add(t))}YD(t){t!==null&&this.dl!==null&&this.dl.delete(t)}KD(t,e,i){if(t===null||this.dl===null)return null;let s=this.dl.iterator;for(;s.next();){let n=s.value;if(n.By===this&&n.ak===t&&n.mC===e&&n.pC===i||n.By===t&&n.ak===this&&n.mC===i&&n.pC===e)return n}return null}invalidateLinkBundle(t,e,i){e==null&&(e=""),i==null&&(i="");let s=this.KD(t,e,i);s!==null&&s.$d()}gf(t,e,i,s,n,o,r){t===3&&e==="elements"?this.ci=null:t===4&&e==="elements"&&(this.ci=null),super.gf(t,e,i,s,n,o,r)}invalidateConnectedLinks(t,e){let i=this.linksConnected;for(;i.next();){let s=i.value;t&&t.has(s)||e&&s.fromPort!==e&&s.toPort!==e||(this.Ze(s.fromPort),this.Ze(s.toPort),s.$t())}}Ze(t){if(t===null)return;let e=t.wd;e!==null&&e.$d();let i=t.part,s=i.containingGroup;s!==null&&!i.isVisible()&&s.Ze(s.port)}$r(){return!0}get portSpreading(){return this.vt!==null?this.vt.zy:1}set portSpreading(t){let e=this.portSpreading;if(e!==t){this.gl().zy=t,this.t("portSpreading",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.invalidateConnectedLinks()}}get avoidable(){return(this.E&8)!==0}set avoidable(t){let e=(this.E&8)!==0;if(e!==t){this.E=this.E^8;let i=this.diagram;i!==null&&i.ud(this),this.t("avoidable",e,t)}}get avoidableMargin(){return this.vt!==null?this.vt.Xy:Dt.BL}set avoidableMargin(t){typeof t=="number"&&(t=new Dt(t));let e=this.avoidableMargin;if(!e.equals(t)){t=t.N(),this.gl().Xy=t;let i=this.diagram;i!==null&&i.ud(this),this.t("avoidableMargin",e,t)}}canAvoid(){return this.avoidable&&!this.isLinkLabel}getAvoidableRect(t){return t.set(this.actualBounds),t.addMargin(this.avoidableMargin),t}findVisibleNode(){let t=this;for(;t!==null&&!t.isVisible();)t=t.containingGroup;return t}isVisible(){if(!super.isVisible())return!1;let t=!0,e=1,i=this.diagram;if(i!==null){if(i.animationManager.qx(this))return!0;t=i.isTreePathToChildren,e=i.treeCollapsePolicy}if(e===1){let n=this.findTreeParentNode();if(n!==null&&!n.isTreeExpanded)return!1}else if(e===2){let n=t?this.findLinksInto():this.findLinksOutOf(),o=!1,r=!1;for(;n.next();){let a=n.value;if(a.isTreeLink){o=!0;let h=t?a.fromNode:a.toNode;if(h&&h.isTreeExpanded){r=!0;break}}}if(o&&!r)return!1}else if(e===3){let n=t?this.findLinksInto():this.findLinksOutOf(),o=!1,r=!1;for(;n.next();){let a=n.value;if(a.isTreeLink){o=!0;let h=t?a.fromNode:a.toNode;if(h&&!h.isTreeExpanded){r=!0;break}}}if(o&&r)return!1}let s=this.labeledLink;return s!==null?s.isVisible():!0}Xe(t){super.Xe(t);let e=this.linksConnected;for(;e.next();){let i=e.value;if(t&&this.containingGroup!==null){let s=i.getOtherNode(this);s!==null&&!s.isMemberOf(this.containingGroup)&&i.$t()}i.Xe(t)}}get linksConnected(){return this.ee.iterator}findExternalTreeLinksConnected(){let t=new V,e=new V;return this.HD(this,t,e),e.iterator}HD(t,e,i){if(t===null||e.has(t))return;e.add(t);let s=!0,n=this.diagram;n!==null&&(s=n.isTreePathToChildren),t.linksConnected.each(o=>{o.isTreeLink?(s?o.fromNode===t:o.toNode===t)&&this.HD(s?o.toNode:o.fromNode,e,i):i.add(o)})}findLinksConnected(t){if(t===void 0&&(t=null),t===null)return this.ee.iterator;let e=new gt(this.ee),i=this;return e.predicate=s=>s.fromNode===i&&s.fromPortId===t||s.toNode===i&&s.toPortId===t,e}findLinksOutOf(t){t===void 0&&(t=null);let e=new gt(this.ee),i=this;return e.predicate=s=>s.fromNode!==i?!1:t===null?!0:s.fromPortId===t,e}findLinksInto(t){t===void 0&&(t=null);let e=new gt(this.ee),i=this;return e.predicate=s=>s.toNode!==i?!1:t===null?!0:s.toPortId===t,e}findNodesConnected(t){t===void 0&&(t=null);let e=null,i=null,s=this.ee.iterator;for(;s.next();){let n=s.value;if(n.fromNode===this){if(t===null||n.fromPortId===t){let o=n.toNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}else if(n.toNode===this&&(t===null||n.toPortId===t)){let o=n.fromNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new dt(i):Pt.instance}findNodesOutOf(t){t===void 0&&(t=null);let e=null,i=null,s=this.ee.iterator;for(;s.next();){let n=s.value;if(n.fromNode===this&&(t===null||n.fromPortId===t)){let o=n.toNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new dt(i):Pt.instance}findNodesInto(t){t===void 0&&(t=null);let e=null,i=null,s=this.ee.iterator;for(;s.next();){let n=s.value;if(n.toNode===this&&(t===null||n.toPortId===t)){let o=n.fromNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new dt(i):Pt.instance}findLinksBetween(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);let s=new gt(this.ee),n=this;return s.predicate=o=>o.fromNode===n&&o.toNode===t&&(e===null||o.fromPortId===e)&&(i===null||o.toPortId===i)||o.fromNode===t&&o.toNode===n&&(i===null||o.fromPortId===i)&&(e===null||o.toPortId===e),s}findLinksTo(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);let s=new gt(this.ee),n=this;return s.predicate=o=>!(o.fromNode!==n||o.toNode!==t||e!==null&&o.fromPortId!==e||i!==null&&o.toPortId!==i),s}findSuccessorParts(t){return t===void 0&&(t=new V),this.qD(this,t),t.remove(this),t}qD(t,e){t!==null&&(e.has(t)||(e.add(t),t.findLinksOutOf().each(i=>{if(e.has(i))return;e.add(i);let s=i.toNode;s!==null&&this.qD(s,e)})))}findPredecessorParts(t){return t===void 0&&(t=new V),this.jD(this,t),t.remove(this),t}jD(t,e){t!==null&&(e.has(t)||(e.add(t),t.findLinksInto().each(i=>{if(e.has(i))return;e.add(i);let s=i.fromNode;s!==null&&this.jD(s,e)})))}get linkConnected(){return this.vt!==null?this.vt.Gy:null}set linkConnected(t){let e=this.linkConnected;e!==t&&(t!==null&&m.S(t,$,"linkConnected"),this.gl().Gy=t,this.t("linkConnected",e,t))}get linkDisconnected(){return this.vt!==null?this.vt.Yy:null}set linkDisconnected(t){let e=this.linkDisconnected;e!==t&&(t!==null&&m.S(t,$,"linkDisconnected"),this.gl().Yy=t,this.t("linkDisconnected",e,t))}get linkValidation(){return this.vt!==null?this.vt.El:null}set linkValidation(t){let e=this.linkValidation;e!==t&&(t!==null&&m.S(t,$,"linkValidation"),this.gl().El=t,this.t("linkValidation",e,t))}hk(t,e){this.Ze(e);let i=this.ee.has(t);if(i||this.ee.add(t),!i||t.fromNode===t.toNode){let s=this.linkConnected;if(s!==null){let n=!0,o=this.diagram;o!==null&&(n=o.G,o.G=!0),s(this,t,e),o!==null&&(o.G=n)}}if(!i){if(!t.isTreeLink)return;let s=t.fromNode,n=t.toNode;if(s!==null&&n!==null&&s!==n){let o=!0,r=this.diagram;r!==null&&(o=r.isTreePathToChildren);let a=o?n:s,h=o?s:n;if(a.va||(a.va=h),h.isTreeLeaf){if(r!==null&&r.undoManager.isUndoingRedoing)return;o?s===h&&(h.isTreeLeaf=!1):n===h&&(h.isTreeLeaf=!1)}}}}ck(t,e){this.Ze(e);let i=this.ee.delete(t),s=null;if(i||t.toNode===t.fromNode){let n=this.linkDisconnected;if(s=this.diagram,n!==null){let o=!0;s!==null&&(o=s.G,s.G=!0),n(this,t,e),s!==null&&(s.G=o)}}if(i){if(!t.isTreeLink)return;let n=!0;s!==null&&(n=s.isTreePathToChildren);let o=n?t.toNode:t.fromNode,r=n?t.fromNode:t.toNode;if(o!==null&&(o.va=!1),r!==null&&!r.isTreeLeaf)if(r.ee.count===0){if(r.va=null,s!==null&&s.undoManager.isUndoingRedoing)return;r.isTreeLeaf=!0}else r.Ap()}}Ap(){if(this.va=!1,this.ee.count===0)return;let t=!0,e=this.diagram;if(e!==null&&e.undoManager.isUndoingRedoing)return;e!==null&&(t=e.isTreePathToChildren);let i=this.ee.iterator;for(;i.next();){let s=i.value;if(s.isTreeLink){if(t){if(s.fromNode===this){this.isTreeLeaf=!1;return}}else if(s.toNode===this){this.isTreeLeaf=!1;return}}}this.isTreeLeaf=!0}updateRelationshipsFromData(){let t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)}Zm(t){if(super.Zm(t),!t){this.Ap();let e=this.Xf;e!==null&&e.WD(this)}}Qm(t){if(super.Qm(t),!t){let e=this.Xf;e!==null&&e.JD(this)}}af(){if(this.ee.count>0){let t=this.diagram;if(t!==null){let e=t.commandHandler!==null?t.commandHandler.deletesConnectedLinks:!0,i=this.ee.copy().iterator;for(;i.next();){let s=i.value;e?t.remove(s):(s.fromNode===this&&(s.fromNode=null),s.toNode===this&&(s.toNode=null))}}}this.labeledLink=null,super.af()}get isLinkLabel(){return this.Xf!==null}get labeledLink(){return this.Xf}set labeledLink(t){let e=this.Xf;if(e!==t){let i=this.diagram,s=this.data;if(e!==null){if(e.JD(this),i!==null&&s!==null&&!i.undoManager.isUndoingRedoing){let n=e.data,o=i.model;if(n!==null&&o.Wh()){let r=o.getKeyForNodeData(s);r!==void 0&&o.removeLabelKeyForLinkData(n,r)}}this.containingGroup=null}if(this.Xf=t,t!==null){if(t.WD(this),i!==null&&s!==null&&!i.undoManager.isUndoingRedoing){let n=t.data,o=i.model;if(n!==null&&o.Wh()){let r=o.getKeyForNodeData(s);r!==void 0&&o.addLabelKeyForLinkData(n,r)}}this.containingGroup=t.containingGroup}this.Pf(),this.t("labeledLink",e,t)}}findVisiblePort(t){let e=t;for(;e!==null&&(!e.actualBounds.isReal()||!e.isVisibleObject());)e=e.panel;return e===null?this.port:e}findPort(t){if(this.ci===null){if(t===""&&this.Cn===!1)return this;this.$D()}let e=this.ci.get(t);return e!==null||t!==""&&(e=this.ci.get(""),e!==null)?e:this}get port(){return this.findPort("")}get ports(){return this.ci===null&&this.$D(),this.ci.iteratorValues}$D(){this.ci===null?this.ci=new Mt:this.ci.clear(),this.walkVisualTreeFrom(this,(t,e)=>t.sD(e)),this.ci.count===0&&this.ci.set("",this)}sD(t){let e=t.portId;e!==null&&this.ci!==null&&this.ci.set(e,t)}vN(t,e){let i=t.portId;if(i!==null){this.ci!==null&&this.ci.delete(i);let s=this.diagram;if(s!==null&&e){let n=null,o=this.findLinksConnected(i);for(;o.next();){let r=o.value;n===null&&(n=m.st()),n.push(r)}if(n!==null){for(let r=0;r<n.length;r++){let a=n[r];s.remove(a)}m.Z(n)}}}}isInTreeOf(t){if(t===null||t===this)return!1;let e=!0,i=this.diagram;i!==null&&(e=i.isTreePathToChildren);let s=this,n=t,o;if(e)for(;s!==n;){o=null;let r=s.ee.iterator;for(;r.next();){let a=r.value;if(a.isTreeLink&&(o=a.fromNode,o!==s&&o!==this))break}if(o===this||o===null||o===s)return!1;s=o}else for(;s!==n;){o=null;let r=s.ee.iterator;for(;r.next();){let a=r.value;if(a.isTreeLink&&(o=a.toNode,o!==s&&o!==this))break}if(o===this||o===null||o===s)return!1;s=o}return!0}findTreeRoot(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=this,s;if(t)for(;;){s=null;let n=i.ee.iterator;for(;n.next();){let o=n.value;if(o.isTreeLink&&(s=o.fromNode,s!==i&&s!==this))break}if(s===this)return this;if(s===null||s===i)return i;i=s}else for(;;){s=null;let n=i.ee.iterator;for(;n.next();){let o=n.value;if(o.isTreeLink&&(s=o.toNode,s!==i&&s!==this))break}if(s===this)return this;if(s===null||s===i)return i;i=s}}findCommonTreeParent(t){if(t===null)return null;if(this===t)return this;let e=this;for(;e!==null;)e.lk(!0),e=e.findTreeParentNode();let i=null;for(e=t;e!==null;){if(e.XD()){i=e;break}e=e.findTreeParentNode()}for(e=this;e!==null;)e.lk(!1),e=e.findTreeParentNode();return i}findTreeParentLink(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=this.ee.iterator;if(t)for(;i.next();){let s=i.value;if(s.isTreeLink&&s.fromNode!==this)return s}else for(;i.next();){let s=i.value;if(s.isTreeLink&&s.toNode!==this)return s}return null}findTreeParentNode(){let t=this.va;if(t===null)return null;if(t instanceof $)return t;let e=this.diagram,i=e!==null?e.isTreePathToChildren:!0,s=this.ee.iterator;for(;s.next();){let n=s.value;if(!n.isTreeLink)continue;let o=i?n.fromNode:n.toNode;if(o!==this)return this.va=o,o}return this.va=null,null}findTreeParentChain(t){function e(i,s){s.add(i);let n=i.findTreeParentLink();if(n!==null){s.add(n);let o=i.findTreeParentNode();if(o===null)return;e(o,s)}}return t===void 0&&(t=new V),e(this,t),t}findTreeLevel(){return this.PE(this)}PE(t){let e=0,i=t.findTreeParentNode();for(;i!==null&&i!==t;)i=i.findTreeParentNode(),e++;return e}findTreeChildrenLinks(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=new gt(this.ee),s=this;return t?i.predicate=n=>!(!n.isTreeLink||n.fromNode!==s):i.predicate=n=>!(!n.isTreeLink||n.toNode!==s),i}findTreeChildrenNodes(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=null,s=null,n=this.ee.iterator;if(t)for(;n.next();){let o=n.value;if(o.isTreeLink&&o.fromNode===this){let r=o.toNode;i!==null?i.add(r):s!==null&&s!==r?(i=new q,i.add(s),i.add(r)):s=r}}else for(;n.next();){let o=n.value;if(o.isTreeLink&&o.toNode===this){let r=o.fromNode;i!==null?i.add(r):s!==null&&s!==r?(i=new q,i.add(s),i.add(r)):s=r}}return i!==null?i.iterator:s!==null?new dt(s):Pt.instance}findTreeParts(t,e){return t===void 0&&(t=1/0),m.s(t,"number",$,"findTreeParts:level"),e===void 0&&(e=new V),pt.ga(e,this,!1,t,!0),e}collapseTree(t){t===void 0&&(t=1),t<1&&(t=1);let e=this.diagram;if(e===null||e.isCollapsingExpanding)return;e.isCollapsingExpanding=!0;let i=new V;i.add(this),this.ZD(i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===1),e.isCollapsingExpanding=!1}ZD(t,e,i,s,n,o){if(i>1){let r=e?this.findLinksOutOf():this.findLinksInto();for(;r.next();){let a=r.value;if(!a.isTreeLink)continue;let h=a.getOtherNode(this);h!==null&&h!==this&&!t.has(h)&&(t.add(h),h.ZD(t,e,i-1,s,n,o))}}else this.QD(t,e,s,n,o)}QD(t,e,i,s,n){let o=s===this?!0:this.isTreeExpanded,r=e?this.findLinksOutOf():this.findLinksInto();for(;r.next();){let a=r.value;if(!a.isTreeLink)continue;let h=a.getOtherNode(this);if(h!==null&&h!==this){let l=t.has(h);if(l||t.add(h),o){let u=e?h.findNodesInto():h.findNodesOutOf(),c=this;u.all(d=>d===c||!d.isTreeExpanded)&&i.Hc(h,s),h.Sa(),h.Xe(!1)}h.isTreeExpanded&&(h.wasTreeExpanded=h.isTreeExpanded,l||h.QD(t,e,i,s,n))}}this.isTreeExpanded=!1}expandTree(t){t===void 0&&(t=2),t<2&&(t=2);let e=this.diagram;if(e===null||e.isCollapsingExpanding)return;e.isCollapsingExpanding=!0;let i=new V;i.add(this),this._D(i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===1),e.isCollapsingExpanding=!1}_D(t,e,i,s,n,o){let r=n===this?!1:this.isTreeExpanded,a=e?this.findLinksOutOf():this.findLinksInto();for(;a.next();){let h=a.value;if(!h.isTreeLink)continue;r||h.Fi||h.$t();let l=h.getOtherNode(this);if(l!==null&&l!==this&&!t.has(l)){if(t.add(l),!r){l.Xe(!0),l.Sa();let u=e?l.findNodesInto():l.findNodesOutOf(),c=this;u.all(d=>d===c||!d.isTreeExpanded)&&s.Kc(l,n)}(i>2||l.wasTreeExpanded)&&(l.wasTreeExpanded=!1,l._D(t,e,i-1,s,n,o))}}this.isTreeExpanded=!0}get isTreeExpanded(){return(this.E&1)!==0}set isTreeExpanded(t){let e=(this.E&1)!==0;if(e!==t){this.E=this.E^1;let i=this.diagram;this.t("isTreeExpanded",e,t);let s=this.treeExpandedChanged;if(s!==null){let n=!0;i!==null&&(n=i.G,i.G=!0),s(this),i!==null&&(i.G=n)}if(i!==null&&i.undoManager.isUndoingRedoing){this.Xe(t);return}t?this.expandTree():this.collapseTree()}}get wasTreeExpanded(){return(this.E&2)!==0}set wasTreeExpanded(t){let e=(this.E&2)!==0;e!==t&&(this.E=this.E^2,this.t("wasTreeExpanded",e,t))}get treeExpandedChanged(){return this.vt!==null?this.vt.Ky:null}set treeExpandedChanged(t){let e=this.treeExpandedChanged;e!==t&&(t!==null&&m.S(t,$,"treeExpandedChanged"),this.gl().Ky=t,this.t("treeExpandedChanged",e,t))}get isTreeLeaf(){return(this.E&4)!==0}set isTreeLeaf(t){let e=(this.E&4)!==0;e!==t&&(this.E=this.E^4,this.t("isTreeLeaf",e,t))}get isTreeRoot(){return this.findTreeParentLink()===null}}class qi{me;Gy;Yy;El;Ky;Xy;zy;Hy;qy;da;jy;constructor(){this.me=!1,this.Gy=null,this.Yy=null,this.El=null,this.Ky=null,this.Xy=Dt.BL,this.zy=1,this.Hy=null,this.qy=null,this.da=null,this.jy=null}copy(){let t=new qi;return t.Gy=this.Gy,t.Yy=this.Yy,t.El=this.El,t.Ky=this.Ky,t.Xy=this.Xy.N(),t.zy=this.zy,t.Hy=this.Hy,t.qy=this.qy,t.da=this.da,t.jy=this.jy,t}}var Hi=(x=>(x[x.None=0]="None",x[x.End=17]="End",x[x.Scale=18]="Scale",x[x.Stretch=19]="Stretch",x))(Hi||{}),Wi=(x=>(x[x.Normal=1]="Normal",x[x.Orthogonal=2]="Orthogonal",x[x.AvoidsNodes=6]="AvoidsNodes",x[x.AvoidsNodesStraight=7]="AvoidsNodesStraight",x))(Wi||{}),$i=(x=>(x[x.None=0]="None",x[x.Bezier=9]="Bezier",x[x.JumpGap=10]="JumpGap",x[x.JumpOver=11]="JumpOver",x))($i||{});class j extends pt{St;uo;go;Zd;mo;po;Qd;Gf;_d;tg;eg;Jh;ig;nn;Me;pl;Ar;yl;_o;yC;wC;fk;xC;bC;$h;uk;ut;tr;static Zh=null;static Qh=null;Af;kC;PC;constructor(t){super(G.Link),this.St=8,this.uo=null,this.go="",this.Zd=null,this.mo=null,this.po="",this.Qd=null,this.Gf=0,this._d=0,this.tg=0,this.eg=NaN,this.Jh=1,this.ig=.5,this.nn=null,this.Me=new q().k(),this.pl=null,this.Ar=null,this.yl=new I,this.ut=new wt,this._o=null,this.tr=null,this.yC=P.gn,this.wC=P.gn,this.kC=0,this.PC=0,this.fk=new P,this.xC=null,this.bC=null,this.$h=null,this.uk=NaN,this.ft=null,this.Af=[],t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.St=this.St&-113,t.go=this.go,t.Zd=this.Zd,t.po=this.po,t.Qd=this.Qd,t.Gf=this.Gf,t._d=this._d,t.tg=this.tg,t.eg=this.eg,t.Jh=this.Jh,t.ig=this.ig,this.ft!==null&&(t.ft=this.ft.copy())}Yo(t){super.Yo(t),this.go=t.go,this.po=t.po,t.pl=null,t.$t(),t.tr=this.tr;let e=t.fromPort;e!==null&&t.fromNode.Ze(e);let i=t.toPort;i!==null&&t.toNode.Ze(i)}fe(t){t in Wi||t in $i||t in Hi?j.SC(t)?this.routing=t:t===9||t===10||t===11?this.curve=t:t===17||t===18||t===19?this.adjusting=t:t===1||t===0||m.o("Unknown Link enum value for a Link property: "+t):super.fe(t)}static Normal=1;static Orthogonal=2;static AvoidsNodes=6;static AvoidsNodesStraight=7;static None=0;static Bezier=9;static JumpGap=10;static JumpOver=11;static End=17;static Scale=18;static Stretch=19;static OrientAlong=21;static OrientPlus90=22;static OrientMinus90=23;static OrientOpposite=24;static OrientUpright=25;static OrientPlus90Upright=26;static OrientMinus90Upright=27;static OrientUpright45=28;static tv=8;static ev=16;static Fa=8;static q1=3;static iv=3;static sv=1.333;static MC=1;static NC=0;static nv=10;static Yf=9999;static ov=30;static rv=30;static CC=10;static lv=10;static av=14;static hv=30;static cv=14;static _A=8;static tT=8;static fv=11;static setRoutingParameter(t,e){switch(t){case 1:j.tv=e;break;case 2:j.ev=e;break;case 3:j.Fa=e;break;case 4:j.q1=e;break;case 5:j.iv=e;break;case 6:j.sv=e;break;case 7:j.MC=e;break;case 8:j.NC=e;break;case 9:j.nv=e;break;case 10:j.Yf=e;break;case 11:j.ov=e;break;case 12:j.rv=e;break;case 13:j.CC=e;break;case 14:j.lv=e;break;case 15:j.av=e;break;case 16:j.hv=e;break;case 17:j.cv=e;break;case 18:j._A=e;break;case 19:j.tT=e;break;case 20:j.fv=e;break}t>29&&t<71&&(j.IT=t+parseInt(e.toString().slice(0,-1)))}static IT;Wi(){return this.ft===null&&(this.ft=new Ni),this.ft}II(t,e,i){let s=t.segmentIndex,n=t.segmentFraction,o=t.alignmentFocus,r=t.segmentOrientation,a=t.segmentOffset,h=0,l=0,u=0,c=0;if(isNaN(s)){let L=this.ut,M=m.st();L.getPointAndAngleAlongPath(n,M);let A=P.z(M[0],M[1]);if(c=M[2],A.add(this.getPoint(0)),L.type===1)A.offset(-L.startX,-L.startY);else{let F=L.figures.first();A.offset(-F.startX,-F.startY)}r!==0&&(u=this.computeAngle(t,r,c),t.angle=u),h=A.x,l=A.y,P.i(A),m.Z(M)}else if(s<-e||s>=e){let L=P.l();this.KN(L),c=this.midAngle,r!==0&&(u=this.computeAngle(t,r,c),t.angle=u),h=L.x,l=L.y,P.i(L)}else{let L,M,A=0;if(s>=0?(L=i.r[s],M=s<e-1?i.r[s+1]:L):(A=e+s,L=i.r[A],M=A>0?i.r[A-1]:L),L.equalsApprox(M)){let F,O;s>=0?(F=s>0?i.r[s-1]:L,O=s<e-2?i.r[s+2]:M):(F=A<e-1?i.r[A+1]:L,O=A>1?i.r[A-2]:M);let E=F.distanceSquaredPoint(L),B=M.distanceSquaredPoint(O);E>B+10?c=s>=0?F.directionPoint(L):L.directionPoint(F):B>E+10?c=s>=0?M.directionPoint(O):O.directionPoint(M):c=s>=0?F.directionPoint(O):O.directionPoint(F)}else c=s>=0?L.directionPoint(M):M.directionPoint(L);r!==0&&(u=this.computeAngle(t,r,c),t.angle=u),h=L.x+(M.x-L.x)*n,l=L.y+(M.y-L.y)*n}if(o.isNone()){t.moveTo(h,l,!0);return}else o.isNoSpot()&&(o=T.Center);let d=Nt.l();d.Ue(),d.et(t.scale,t.scale),d.ks(t.angle,0,0);let f=t.naturalBounds,p=I.z(0,0,f.width,f.height),g=P.l();g.setRectSpot(p,o),d.gt(g);let y=-g.x,b=-g.y,v=f.width,w=f.height,k=P.bs(a),S=isNaN(a.x),N=isNaN(a.y);if(S||N){let L=v/2+j.q1,M=w/2+j.iv,A=c>=45&&c<=135,F=c>=225&&c<=315;r===0&&(A||F)?(k.x=N?L:a.y,k.y=S?M:a.x,A?s>=0||isNaN(s)&&n<.5||S&&(k.y=-M):F&&((s>=0||isNaN(s)&&n<.5)&&S&&(k.y=-M),N&&(k.x=-L))):(S&&(s>=0||isNaN(s)&&n<.5?k.x=L:k.x=-L),N&&(k.y=-M),k.rotate(c))}else k.rotate(c);h+=k.x,l+=k.y,d.im(p),y+=p.x,b+=p.y;let D=P.z(h+y,l+b);t.move(D),P.i(D),P.i(k),P.i(g),I.i(p),Nt.i(d)}$r(){let t=this.fromNode;if(t!==null){let i=t.findVisibleNode();if(i!==null&&(t=i),t.as()||t.fa())return!1}let e=this.toNode;if(e!==null){let i=e.findVisibleNode();if(i!==null&&(e=i),e.as()||e.fa())return!1}return!0}TN(t,e,i){return!1}DN(){}Di(){return!1}computeAngle(t,e,i){return j.computeAngle(e,i)}static computeAngle(t,e){let i=0;switch(t){default:case 0:i=0;break;case 21:i=e;break;case 22:i=e+90;break;case 23:i=e-90;break;case 24:i=e+180;break;case 25:i=C.Ee(e),i>90&&i<270&&(i-=180);break;case 26:i=C.Ee(e+90),i>90&&i<270&&(i-=180);break;case 27:i=C.Ee(e-90),i>90&&i<270&&(i-=180);break;case 28:if(i=C.Ee(e),i>45&&i<135||i>225&&i<315)return 0;i>90&&i<270&&(i-=180);break}return C.Ee(i)}get fromNode(){return this.uo}set fromNode(t){let e=this.uo;if(e!==t){let i=this.fromPort;e!==null&&(this.mo!==e&&e.ck(this,i),this.Wy(),this.invalidateLayout(2)),this.uo=t,t!==null&&this.Xe(t.isVisible()),this._o=null,this.$t();let s=this.diagram;s!==null&&s.G&&s.partManager.setFromNodeForLink(this,t,e);let n=this.fromPort,o=this.fromPortChanged;if(o!==null){let r=!0;s!==null&&(r=s.G,s.G=!0),o(this,i,n),s!==null&&(s.G=r)}t!==null&&(this.mo!==t&&t.hk(this,n),this.Jy(),this.invalidateLayout(1)),this.t("fromNode",e,t),this.Jd()}}get fromPortId(){return this.go}set fromPortId(t){let e=this.go;if(e!==t){let i=this.fromPort;i!==null&&this.fromNode?.Ze(i),this.Wy(),this.go=t;let s=this.fromPort;s!==null&&this.fromNode?.Ze(s);let n=this.diagram;if(n!==null){let o=this.data,r=n.model;o!==null&&r.Wh()&&r.setFromPortIdForLinkData(o,t)}if(i!==s){this._o=null,this.$t();let o=this.fromPortChanged;if(o!==null){let r=!0;n!==null&&(r=n.G,n.G=!0),o(this,i,s),n!==null&&(n.G=r)}}this.Jy(),this.t("fromPortId",e,t)}}get fromPort(){let t=this.uo;if(t===null)return null;let e=this.go;return t.findPort(e)}get fromPortChanged(){return this.Zd}set fromPortChanged(t){let e=this.Zd;e!==t&&(t!==null&&m.S(t,j,"fromPortChanged"),this.Zd=t,this.t("fromPortChanged",e,t))}get toNode(){return this.mo}set toNode(t){let e=this.mo;if(e!==t){let i=this.toPort;e!==null&&(this.uo!==e&&e.ck(this,i),this.Wy(),this.invalidateLayout(2)),this.mo=t,t!==null&&this.Xe(t.isVisible()),this._o=null,this.$t();let s=this.diagram;s!==null&&s.G&&s.partManager.setToNodeForLink(this,t,e);let n=this.toPort,o=this.toPortChanged;if(o!==null){let r=!0;s!==null&&(r=s.G,s.G=!0),o(this,i,n),s!==null&&(s.G=r)}t!==null&&(this.uo!==t&&t.hk(this,n),this.Jy(),this.invalidateLayout(1)),this.t("toNode",e,t),this.Jd()}}get toPortId(){return this.po}set toPortId(t){let e=this.po;if(e!==t){let i=this.toPort;i!==null&&this.toNode?.Ze(i),this.Wy(),this.po=t;let s=this.toPort;s!==null&&this.toNode?.Ze(s);let n=this.diagram;if(n!==null){let o=this.data,r=n.model;o!==null&&r.Wh()&&r.setToPortIdForLinkData(o,t)}if(i!==s){this._o=null,this.$t();let o=this.toPortChanged;if(o!==null){let r=!0;n!==null&&(r=n.G,n.G=!0),o(this,i,s),n!==null&&(n.G=r)}}this.Jy(),this.t("toPortId",e,t)}}get toPort(){let t=this.mo;if(t===null)return null;let e=this.po;return t.findPort(e)}get toPortChanged(){return this.Qd}set toPortChanged(t){let e=this.Qd;e!==t&&(t!==null&&m.S(t,j,"toPortChanged"),this.Qd=t,this.t("toPortChanged",e,t))}get fromSpot(){return this.ft!==null?this.ft.vh:T.Default}set fromSpot(t){let e=this.fromSpot;if(!e.equals(t)){if(t=t.N(),this.Wi().vh=t,this.t("fromSpot",e,t),e.isSide()||t.isSide()){let i=this.fromNode;i!==null&&i.Ze(this.fromPort)}this.$t()}}get fromEndSegmentLength(){return this.ft!==null?this.ft.Rh:NaN}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;if(e!==t){if(t<0&&m.J(t,">= 0",j,"fromEndSegmentLength"),this.Wi().Rh=t,this.t("fromEndSegmentLength",e,t),this.computeSpot(!0,this.fromPort).isSide()){let i=this.fromNode;i!==null&&i.Ze(this.fromPort)}this.$t()}}get fromShortLength(){return this.ft!==null?this.ft.Ih:NaN}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Wi().Ih=t,this.ai(),this.t("fromShortLength",e,t))}get toSpot(){return this.ft!==null?this.ft.Fh:T.Default}set toSpot(t){let e=this.toSpot;if(!e.equals(t)){if(t=t.N(),this.Wi().Fh=t,this.t("toSpot",e,t),e.isSide()||t.isSide()){let i=this.toNode;i!==null&&i.Ze(this.toPort)}this.$t()}}get toEndSegmentLength(){return this.ft!==null?this.ft.Oh:NaN}set toEndSegmentLength(t){let e=this.toEndSegmentLength;if(e!==t){if(t<0&&m.J(t,">= 0",j,"toEndSegmentLength"),this.Wi().Oh=t,this.t("toEndSegmentLength",e,t),this.computeSpot(!1,this.toPort).isSide()){let i=this.toNode;i!==null&&i.Ze(this.toPort)}this.$t()}}get toShortLength(){return this.ft!==null?this.ft.Eh:NaN}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Wi().Eh=t,this.ai(),this.t("toShortLength",e,t))}Jd(){let t=this.fromNode,e=this.toNode,i=null;if(t!==null?e!==null?i=t.findCommonContainingGroup(e):i=t.containingGroup:e!==null?i=e.containingGroup:i=null,this.SE(i),this.isLabeledLink){let s=this.labelNodes;for(;s.next();){let n=s.value;n.containingGroup=i}}}SE(t){let e=this.Da;if(e!==t){e!==null&&e.cC(this),this.Da=t,t!==null&&t.fC(this);let i=this.containingGroupChanged;if(i!==null){let s=!0,n=this.diagram;n!==null&&(s=n.G,n.G=!0),i(this,e,t),n!==null&&(n.G=s)}this.Fi&&(this.xC===e||this.bC===e)&&this.$t()}}Sa(){let t=this.containingGroup;t!==null&&this.fromNode!==t&&this.toNode!==t&&t.computesBoundsIncludingLinks&&super.Sa()}getOtherNode(t){let e=this.fromNode;return t===e?this.toNode:e}getOtherPort(t){let e=this.fromPort;return t===e?this.toPort:e}get isLabeledLink(){return this.nn===null?!1:this.nn.count>0}get labelNodes(){return this.nn===null?Pt.instance:this.nn.iterator}WD(t){this.nn===null&&(this.nn=new V),this.nn.add(t),this.f()}JD(t){this.nn!==null&&(this.nn.delete(t),this.f())}Zm(t){if(super.Zm(t),this._h()&&this.invalidateOtherJumpOvers(this.actualBounds),!t){let e=this.uo,i=null;e!==null&&(i=this.fromPort,e.hk(this,i));let s=this.mo,n=null;s!==null&&(n=this.toPort,(s!==e||n!==i)&&s.hk(this,n)),this.Jy()}}Qm(t){if(super.Qm(t),this._h()&&this.invalidateOtherJumpOvers(this.actualBounds),!t){let e=this.uo,i=null;e!==null&&(i=this.fromPort,e.ck(this,i));let s=this.mo,n=null;s!==null&&(n=this.toPort,(s!==e||n!==i)&&s.ck(this,n)),this.Wy()}}af(){if(this.Fi=!0,this.nn!==null){let t=this.diagram;if(t!==null){let e=this.nn.copy().iterator;for(;e.next();){let i=e.value;t.remove(i)}}}if(this.data!==null){let t=this.diagram;t!==null&&t.partManager.LC(this)}}updateRelationshipsFromData(){if(this.data===null)return;let t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)}move(t,e){let i=e?this.location:this.position,s=i.x;isNaN(s)&&(s=0);let n=i.y;isNaN(n)&&(n=0);let o=t.x-s,r=t.y-n;if(e===!0)super.move(t,!1);else{let h=P.z(i.x+o,i.y+r);super.move(h,!1),P.i(h)}this.xr(o,r);let a=this.labelNodes;for(;a.next();){let h=a.value,l=h.position;h.moveTo(l.x+o,l.y+r)}}get relinkableFrom(){return(this.St&1)!==0}set relinkableFrom(t){let e=(this.St&1)!==0;e!==t&&(this.St=this.St^1,this.t("relinkableFrom",e,t),this.invalidateAdornments())}get relinkableTo(){return(this.St&2)!==0}set relinkableTo(t){let e=(this.St&2)!==0;e!==t&&(this.St=this.St^2,this.t("relinkableTo",e,t),this.invalidateAdornments())}canRelinkFrom(){if(!this.relinkableFrom)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRelink)return!1;let e=t.diagram;return!(e!==null&&!e.allowRelink)}canRelinkTo(){if(!this.relinkableTo)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRelink)return!1;let e=t.diagram;return!(e!==null&&!e.allowRelink)}get resegmentable(){return(this.St&4)!==0}set resegmentable(t){let e=(this.St&4)!==0;e!==t&&(this.St=this.St^4,this.t("resegmentable",e,t),this.invalidateAdornments())}get isTreeLink(){return(this.St&8)!==0}set isTreeLink(t){let e=(this.St&8)!==0;e!==t&&(this.St=this.St^8,this.t("isTreeLink",e,t),this.fromNode!==null&&this.fromNode.Ap(),this.toNode!==null&&this.toNode.Ap())}get path(){let t=this.findMainElement();return t instanceof et?t:null}get routeBounds(){return this.updateRoute(),this.yl}AC(t){let e=1/0,i=1/0,s=this.pointsCount;if(s===0)return t.e(NaN,NaN,0,0),t;if(s===1){let n=this.getPoint(0);e=Math.min(n.x,e),i=Math.min(n.y,i),t.e(n.x,n.y,0,0)}else if(s===2){let n=this.getPoint(0),o=this.getPoint(1);e=Math.min(n.x,o.x),i=Math.min(n.y,o.y),t.e(n.x,n.y,0,0),t.unionPoint(o)}else if(this.computeCurve()===9&&s>=3&&!this.isOrthogonal){let n=this.getPoint(0);if(e=n.x,i=n.y,t.e(e,i,0,0),s===3){let o=this.getPoint(1);e=Math.min(o.x,e),i=Math.min(o.y,i);let r=this.getPoint(2);e=Math.min(r.x,e),i=Math.min(r.y,i),C.Nu(n.x,n.y,o.x,o.y,o.x,o.y,r.x,r.y,.5,t)}else for(let o=3;o<s;o+=3){let r=this.getPoint(o-2);o+3>=s&&(o=s-1);let a=this.getPoint(o-1),h=this.getPoint(o);C.Nu(n.x,n.y,r.x,r.y,a.x,a.y,h.x,h.y,.5,t),e=Math.min(h.x,e),i=Math.min(h.y,i),n=h}}else{let n=this.getPoint(0),o=this.getPoint(1);e=Math.min(n.x,o.x),i=Math.min(n.y,o.y),t.e(n.x,n.y,0,0),t.unionPoint(o);for(let r=2;r<s;r++){let a=this.getPoint(r);e=Math.min(a.x,e),i=Math.min(a.y,i),t.unionPoint(a)}}return this.fk.e(e-t.x,i-t.y),t}get midPoint(){return this.KN(new P)}KN(t){return this.updateRoute(),this.computeMidPoint(t)}computeMidPoint(t){let e=this.pointsCount;if(e===0)return t.h(P.gn),t;if(e===1)return t.h(this.getPoint(0)),t;if(e===2){let l=this.getPoint(0),u=this.getPoint(1);return t.e((l.x+u.x)/2,(l.y+u.y)/2),t}if(this.isOrthogonal&&(this.computeCorner()>=15||this.computeCurve()===9)){this.ut.getPointAlongPath(.5,t),t.add(this.getPoint(0));let l=this.ut.figures.first();return t.offset(-l.startX,-l.startY),t}if(this.computeCurve()===9){if(e===3){let c=this.getPoint(0),d=this.getPoint(1),f=this.getPoint(2);return C.YL(c.x,c.y,d.x,d.y,d.x,d.y,f.x,f.y,t),t}let l=(e-1)/3|0,u=(l/2|0)*3;if(l%2===1){let c=this.getPoint(u),d=this.getPoint(u+1),f=this.getPoint(u+2),p=this.getPoint(u+3);return C.YL(c.x,c.y,d.x,d.y,f.x,f.y,p.x,p.y,t),t}else return t.h(this.getPoint(u)),t}let i=this.flattenedLengths,s=this.flattenedTotalLength,n=0,o=0,r=0;for(;n<s/2&&o<e&&(r=i[o],!(n+r>s/2));)n+=r,o++;let a=this.getPoint(o),h=this.getPoint(o+1);if(Math.abs(a.x-h.x)<1)a.y>h.y?t.e(a.x,a.y-(s/2-n)):t.e(a.x,a.y+(s/2-n));else if(Math.abs(a.y-h.y)<1)a.x>h.x?t.e(a.x-(s/2-n),a.y):t.e(a.x+(s/2-n),a.y);else{let l=(s/2-n)/r,u=l*(h.x-a.x),c=l*(h.y-a.y);t.e(a.x+u,a.y+c)}return t}get midAngle(){return this.updateRoute(),this.computeMidAngle()}computeMidAngle(){let t=this.pointsCount;if(t<2)return NaN;if(t===2){let h=this.getPoint(0),l=this.getPoint(1);return h.directionPoint(l)}if(this.isOrthogonal&&(this.computeCorner()>=15||this.computeCurve()===9))return this.ut.getAngleAlongPath(.5);if(this.computeCurve()===9&&t>=4){let h=(t-1)/3|0,l=(h/2|0)*3;if(h%2===1){l=Math.floor(l);let u=this.getPoint(l),c=this.getPoint(l+1),d=this.getPoint(l+2),f=this.getPoint(l+3);return C.HF(u.x,u.y,c.x,c.y,d.x,d.y,f.x,f.y)}else if(l>0&&l+1<t){let u=this.getPoint(l-1),c=this.getPoint(l+1);return u.directionPoint(c)}}let e=this.flattenedLengths,i=this.flattenedTotalLength,s=0,n=0,o=0;for(;s<i/2&&n<t&&(o=e[n],!(s+o>i/2));)s+=o,n++;let r=this.getPoint(n),a=this.getPoint(n+1);if(Math.abs(r.x-a.x)<.5&&Math.abs(r.y-a.y)<j.MC){if(n>0&&n<t-2){let h=this.getPoint(n-1),l=this.getPoint(n+2);return h.x<l.x?0:h.x>l.x?180:h.y<l.y?90:270}}else if(Math.abs(r.y-a.y)<.5&&Math.abs(r.x-a.x)<j.MC&&n>0&&n<t-2){let h=this.getPoint(n-1),l=this.getPoint(n+2);return h.y<l.y?90:h.y>l.y?270:h.x<l.x?0:180}return r.directionPoint(a)}get flattenedLengths(){return this.$h!==null?this.$h:(this.Fi||this.dk(),this.ME())}get flattenedTotalLength(){let t=this.uk;if(isNaN(t)){let e=this.flattenedLengths,i=e.length;t=0;for(let s=0;s<i;s++)t+=e[s];this.uk=t}return t}ME(){this.$h===null?this.$h=[]:this.$h.length=0;let t=this.$h,e=this.pointsCount;for(let i=0;i<e-1;i++){let s=0,n=this.getPoint(i),o=this.getPoint(i+1);C.X(n.x,o.x)?(s=o.y-n.y,s<0&&(s=-s),t.push(s)):C.X(n.y,o.y)?(s=o.x-n.x,s<0&&(s=-s),t.push(s)):(s=Math.sqrt(n.distanceSquaredPoint(o)),t.push(s))}return t}get points(){return this.Me}set points(t){let e=this.Me;if(e===t)return;let i=null;if(Array.isArray(t))i=this.convertPointsArrayToList(t);else if(t instanceof q){i=t.copy();let n=i.iterator;for(;n.next();)n.value.k()}else m.o("Link.points value is not an instance of List or Array: "+t);if(i===null)return;i.k(),this.Me=i,this.ai(),this.dk();let s=this.diagram;s!==null&&(!s.Qa&&!s.undoManager.isUndoingRedoing&&s.ib.add(this),s.animationManager.ke&&s.animationManager.LM(this,i)),this.t("points",e,i)}convertPointsArrayToList(t){let e=null,i=t.length%2===0;if(i){for(let s=0;s<t.length;s++)if(typeof t[s]!="number"||isNaN(t[s])){i=!1;break}}if(i){e=new q;for(let s=0;s<t.length/2;s++)e.add(new P(t[s*2],t[s*2+1]).k())}else{let s=!0;for(let n=0;n<t.length;n++){let o=t[n];if(!m.$(o)||typeof o.x!="number"||isNaN(o.x)||typeof o.y!="number"||isNaN(o.y)){s=!1;break}}if(s){e=new q;for(let n=0;n<t.length;n++){let o=t[n];e.add(new P(o.x,o.y).k())}}}return e}get pointsCount(){return this.Me.count}getPoint(t){return this.Me.r[t]}setPoint(t,e){this.Me.setElt(t,e)}setPointAt(t,e,i){this.Me.setElt(t,new P(e,i))}insertPoint(t,e){this.Me.insertAt(t,e)}insertPointAt(t,e,i){this.Me.insertAt(t,new P(e,i))}addPoint(t){this.Me.add(t)}addPointAt(t,e){this.Me.add(new P(t,e))}removePoint(t){this.Me.removeAt(t)}clearPoints(){this.Me.clear()}xr(t,e){if(t===0&&e===0)return;if(this.pointsCount===0){this.defaultFromPoint.isReal()&&this.defaultFromPoint.offset(t,e),this.defaultToPoint.isReal()&&this.defaultToPoint.offset(t,e);return}let i=this.Fi,s=new q,n=this.Me.iterator;for(;n.next();){let a=n.value;s.add(new P(a.x+t,a.y+e).k())}s.k();let o=this.Me;this.Me=s;let r=this.diagram;isNaN(t)||isNaN(e)||r!==null&&r.animationManager.ke?this.f():(this.sn.e(this.sn.x+t,this.sn.y+e),this.ct.e(this.ct.x+t,this.ct.y+e),this.Pf()),i?this.dk():(this.defaultFromPoint.isReal()&&(this.defaultFromPoint=this.getPoint(0)),this.defaultToPoint.isReal()&&(this.defaultToPoint=this.getPoint(this.pointsCount-1))),r!==null&&r.animationManager.ke&&r.animationManager.LM(this,s),this.t("points",o,s)}startRoute(){this.pl===null&&(this.pl=this.Me,this.Me=this.Me.copy())}commitRoute(){if(this.pl===null)return;let t=this.pl,e=this.Me;this.pl=null;let i=this.diagram;i!==null&&i.animationManager.ke&&i.animationManager.LM(this,e),this.ai(),this.dk(),this.t("points",t,e)}rollbackRoute(){this.pl!==null&&(this.Me=this.pl,this.pl=null,this.AC(this.yl))}DR(){this.Ar!==null&&(this.points=this.Ar,this.Ar=null)}dk(){if(this.Me.count===0){this.Fi=!1;return}this.Fi=!0,this.AC(this.yl),this.$h=null,this.uk=NaN,this.defaultFromPoint=this.getPoint(0),this.defaultToPoint=this.getPoint(this.pointsCount-1),this.gk(!1)}invalidateRoute(){this.$t()}$t(){if(this.suspendsRouting)return;let t=this.path;if(t===null)return;let e=this.diagram;if(e){if(e.ib.has(this)||e.undoManager.isUndoingRedoing)return;let i=e.animationManager;if(i.isTicking&&!i.isAnimating)return;this.Ar!==null&&!i.isTicking&&(this.Ar=null)}this.Fi=!1,this.f(),t.f()}get Fi(){return(this.St&16)!==0}set Fi(t){(this.St&16)!==0!==t&&(this.St=this.St^16)}get suspendsRouting(){return(this.St&32)!==0}set suspendsRouting(t){(this.St&32)!==0!==t&&(this.St=this.St^32)}get $y(){return(this.St&64)!==0}set $y(t){(this.St&64)!==0!==t&&(this.St=this.St^64)}get TC(){return(this.St&512)!==0}set TC(t){(this.St&512)!==0!==t&&(this.St=this.St^512)}get defaultFromPoint(){return this.yC}set defaultFromPoint(t){this.yC=t&&t.isReal()?t.copy():P.gn}get defaultToPoint(){return this.wC}set defaultToPoint(t){this.wC=t&&t.isReal()?t.copy():P.gn}updateRoute(){if(this.Fi||this.$y)return;let t=!0;try{this.$y=!0,this.startRoute(),t=this.computePoints()}catch{this.$y=!1,this.rollbackRoute()}finally{this.$y=!1,t?this.commitRoute():this.rollbackRoute()}}computePoints(){let t=this.diagram;if(t===null)return!1;let e=this.fromNode,i=null;if(e===null?(j.Zh||(j.Zh=new $,j.Zh.desiredSize=st.bc,j.Zh.ensureBounds()),this.defaultFromPoint.isReal()&&(j.Zh.location=this.defaultFromPoint,j.Zh.ensureBounds(),e=j.Zh,i=j.Zh)):i=this.fromPort,i!==null&&!e.isVisible()){let p=e.findVisibleNode();p!==null&&p!==e?(e=p,i=p.port):e=p}if(this.xC=e,e===null||!e.location.isReal()||i===null||(i=e.findVisiblePort(i),i===null))return!1;let s=this.toNode,n=null;if(s===null?(j.Qh||(j.Qh=new $,j.Qh.desiredSize=st.bc,j.Qh.ensureBounds()),this.defaultToPoint.isReal()&&(j.Qh.location=this.defaultToPoint,j.Qh.ensureBounds(),s=j.Qh,n=j.Qh)):n=this.toPort,n!==null&&!s.isVisible()){let p=s.findVisibleNode();p!==null&&p!==s?(s=p,n=p.port):s=p}if(this.bC=s,s===null||!s.location.isReal()||n===null||(n=s.findVisiblePort(n),n===null))return!1;let o=this.pointsCount,r=this.computeSpot(!0,i),a=this.computeSpot(!1,n),h=this.wl(r),l=this.wl(a),u=i===n&&i!==null,c=this.isOrthogonal,d=this.curve===9;u&&!c?(d=!0,this._o=!0):this._o=!1;let f=this.computeAdjusting()===0||u;if(!c&&!u&&h&&l){let p=!1;if(!f&&o>=3){let g=this.getLinkPoint(e,i,r,!0,!1,s,n),y=this.getLinkPoint(s,n,a,!1,!1,e,i);p=this.adjustPoints(0,g,o-1,y),p&&(g=this.getLinkPoint(e,i,r,!0,!1,s,n),y=this.getLinkPoint(s,n,a,!1,!1,e,i),this.adjustPoints(0,g,o-1,y))}p||(this.clearPoints(),d?this.NE(e,i,r,s,n,a):this.CE(e,i,r,s,n,a))}else{let p=u?this.computeCurviness():0;f&&(c&&this.isAvoiding||u)&&this.clearPoints();let g=this.getLinkPoint(e,i,r,!0,c,s,n),y=this.getLinkPoint(s,n,a,!1,c,e,i),b=0,v=0,w=0;if(c||!h||u){w=this.getLinkDirection(e,i,g,r,!0,c,s,n);let M=this.mk(e,i,r,!0,w);if(u&&(h||r.equals(a)||!c&&r.x+a.x===1&&r.y+a.y===1)&&(w-=c?90:j.ov,p<0&&(w-=180)),w=C.Ee(w),u&&(M+=Math.abs(p)*(c?1:2)),w===0?b=M:w===90?v=M:w===180?b=-M:w===270?v=-M:(b=M*Math.cos(w*Math.PI/180),v=M*Math.sin(w*Math.PI/180)),r.isNoSpot()&&u){let A=i.getDocumentPoint(T.Center,P.l()),F=P.z(A.x+b*j.Yf,A.y+v*j.Yf);this.getLinkPointFromPoint(e,i,A,F,!0,g),P.i(A),P.i(F)}}let k=0,S=0,N=0;if(c||!l||u){N=this.getLinkDirection(s,n,y,a,!1,c,e,i);let M=this.mk(s,n,a,!1,N);if(u&&(l||r.equals(a)||!c&&r.x+a.x===1&&r.y+a.y===1)&&(N+=c?0:j.rv,p<0&&(N+=180)),N=C.Ee(N),u&&(M+=Math.abs(p)*(c?1:2)),N===0?k=M:N===90?S=M:N===180?k=-M:N===270?S=-M:(k=M*Math.cos(N*Math.PI/180),S=M*Math.sin(N*Math.PI/180)),a.isNoSpot()&&u){let A=n.getDocumentPoint(T.Center,P.l()),F=P.z(A.x+k*j.Yf,A.y+S*j.Yf);this.getLinkPointFromPoint(s,n,A,F,!1,y),P.i(A),P.i(F)}}let D=g;(c||!h||u)&&(D=new P(g.x+b,g.y+v));let L=y;(c||!l||u)&&(L=new P(y.x+k,y.y+S)),!f&&!c&&h&&o>3&&this.adjustPoints(0,g,o-2,L)?this.setPoint(o-1,y):!f&&!c&&l&&o>3&&this.adjustPoints(1,D,o-1,y)?this.setPoint(0,g):!f&&(c?o>=6:o>4)&&this.adjustPoints(1,D,o-2,L)?(this.setPoint(0,g),this.setPoint(o-1,y)):(this.clearPoints(),this.addPoint(g),(c||!h||u)&&this.addPoint(D),c&&this.addOrthoPoints(D,w,L,N,e,s),(c||!l||u)&&this.addPoint(L),this.addPoint(y))}return t.addInvalidRoute(this),!0}DC(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?(e.x>=t.x?e.x=t.x+9e9:e.x=t.x-9e9,e.y=t.y):(e.y>=t.y?e.y=t.y+9e9:e.y=t.y-9e9,e.x=t.x),e}getLinkPointFromPoint(t,e,i,s,n,o){if(o===void 0&&(o=new P),t===null||e===null)return o.h(i),o;if(!t.isVisible()){let d=t.findVisibleNode();d!==null&&d!==t&&(t=d,e=t.port)}let r=0,a=0,h=0,l=0,u=null,c=e.panel;if(c!==null&&!c.Mn()&&(c=c.panel),c===null)r=s.x,a=s.y,h=i.x,l=i.y;else{u=c.Ws;let d=1/(u.m11*u.m22-u.m12*u.m21),f=u.m22*d,p=-u.m12*d,g=-u.m21*d,y=u.m11*d,b=d*(u.m21*u.dy-u.m22*u.dx),v=d*(u.m12*u.dx-u.m11*u.dy);r=s.x*f+s.y*g+b,a=s.x*p+s.y*y+v,h=i.x*f+i.y*g+b,l=i.x*p+i.y*y+v}return e.pf(r,a,h,l,o),u!==null&&o.v(u),o}LE(t,e){let i=t.wd;return i!==null?i.uv(e):null}pk(t){if(t===null)return null;let e=t.wd;return e===null&&(e=new Ji(t.part,t),t.wd=e),e.uv(this)}getLinkPoint(t,e,i,s,n,o,r,a){if(a===void 0&&(a=new P),i.isSpot()&&!this.wl(i))return e.getDocumentPoint(i,a),a;if(i.isSide()){let u=this.pk(e);if(u!==null){let c=u.tc;if(a.h(c),n&&this.routing===7){let d=this.pk(r);if(d!==null&&u.Kf<d.Kf){let f=P.l(),p=P.l(),g=I.l();e.getDocumentPoint(T.TopLeft,f),e.getDocumentPoint(T.BottomRight,p);let y=f.x,b=f.y,v=p.x,w=p.y;g.x=Math.min(y,v),g.y=Math.min(b,w),g.width=Math.abs(y-v),g.height=Math.abs(b-w);let k=this.computeSpot(!s,r),S=this.getLinkPoint(o,r,k,!s,n,t,e,p);(i.includesSide(T.LeftSide)||i.includesSide(T.RightSide))&&S.y>=g.y&&S.y<=g.y+g.height?a.y=S.y:(i.includesSide(T.TopSide)||i.includesSide(T.BottomSide))&&S.x>=g.x&&S.x<=g.x+g.width&&(a.x=S.x),I.i(g),P.i(f),P.i(p)}}return a}}let h=e.getDocumentPoint(this.sg(i,s),P.l()),l=P.l();if(this.pointsCount>(n?6:2))l.h(s?this.getPoint(1):this.getPoint(this.pointsCount-2)),n&&this.DC(h,l);else if(t?.isMemberOf(o)||o?.isMemberOf(t)){let u=e.getDocumentBounds(I.l()),c=r.getDocumentBounds(I.l());u.isReal()&&c.isReal()?c.containsRect(u)?(l.h(h),this.vC(c,h.x,h.y,0,this.computeSpot(r===this.toPort,r),l)):u.containsRect(c)?(r.getDocumentPoint(T.Center,l),this.vC(u,l.x,l.y,0,this.computeSpot(e===this.toPort,e),l)):this.FC(r,h,s,n,l):this.FC(r,h,s,n,l),I.i(u),I.i(c)}else this.FC(r,h,s,n,l);return this.getLinkPointFromPoint(t,e,h,l,s,a),P.i(l),P.i(h),a}FC(t,e,i,s,n){let o=this.computeSpot(!i,t);t.getDocumentPoint(this.sg(o,!i),n),s&&this.DC(e,n)}getLinkDirection(t,e,i,s,n,o,r,a){let h=this.AE(t,e,i,s,n,o,r,a);if(t&&r){let u=I.l(),c=I.l();if(s.isNone()&&t.isMemberOf(r)&&e&&a){if(e.getDocumentBounds(u),a.getDocumentBounds(c),u.isReal()&&c.isReal()&&c.containsRect(u)){let d=this.computeSpot(a===this.toPort,a);d.equals(T.Left)||d.equals(T.LeftSide)?h=180:d.equals(T.Right)||d.equals(T.RightSide)?h=0:d.equals(T.Top)||d.equals(T.TopSide)?h=270:d.equals(T.Bottom)||d.equals(T.BottomSide)?h=90:h=C.Ee(h+180)}}else r?.isMemberOf(t)&&e&&a&&(e.getDocumentBounds(u),a.getDocumentBounds(c),u.isReal()&&c.isReal()&&u.containsRect(c)&&(h=C.Ee(h+180)));I.i(u),I.i(c)}if(this.wl(s)||e===null)return h;let l=e.getDocumentAngle();return l===0?h:(45<=l&&l<135?h+=90:135<=l&&l<225?h+=180:225<=l&&l<315&&(h+=270),C.Ee(h))}AE(t,e,i,s,n,o,r,a){if(s.isSpot())return C.$w(null,s.x,s.y);if(s.isSide()){let c=this.pk(e);if(c!==null)switch(c.fi){case 1:return 270;case 8:return 90;case 2:return 180;default:return 0}else return s.includesSide(T.TopSide)?270:s.includesSide(T.BottomSide)?90:s.includesSide(T.LeftSide)?180:0}if(e===null||a===null)return 0;let h=e.getDocumentPoint(T.Center,P.l()),l=P.l();this.pointsCount>(o?6:2)?o?(l.h(n?this.getPoint(1):this.getPoint(this.pointsCount-2)),this.DC(h,l)):l.h(i):a.getDocumentPoint(T.Center,l);let u=0;return Math.abs(l.x-h.x)>Math.abs(l.y-h.y)?l.x>=h.x?u=0:u=180:l.y>=h.y?u=90:u=270,P.i(l),P.i(h),u}computeEndSegmentLength(t,e,i,s){return this.mk(t,e,i,s,NaN)}mk(t,e,i,s,n){if(e!==null&&i.isSide()){let r=this.pk(e);if(r!==null)return r.yk}let o=NaN;if(s?o=this.fromEndSegmentLength:o=this.toEndSegmentLength,e!==null&&isNaN(o))if(n===void 0&&(n=NaN),j.NC>0&&this.computeCurve()===9&&!isNaN(n)&&i.isSpot()){let r=this.getOtherPort(e);if(r){let a=P.l(),h=P.l(),l=e.getDocumentPoint(i,a),u=r.getDocumentPoint(i.opposite(),h),c=n>=315||n<=45||n>=135&&n<=225,d=Math.abs(c?l.x-u.x:l.y-u.y)/j.NC;return d=Math.max(d,j.CC),P.i(a),P.i(h),d}}else s?o=e.fromEndSegmentLength:o=e.toEndSegmentLength;return isNaN(o)&&(o=j.CC),o}computeSpot(t,e){return e===void 0&&(e=null),t?this.TE(e||this.fromPort):this.DE(e||this.toPort)}TE(t){if(t===null)return T.Center;let e=this.fromSpot;return e.isDefault()&&(e=t.fromSpot),e===T.Default?T.None:e}DE(t){if(t===null)return T.Center;let e=this.toSpot;return e.isDefault()&&(e=t.toSpot),e===T.Default?T.None:e}wl(t){return t===T.None||t.x===.5&&t.y===.5}sg(t,e){return t.x===.5&&t.y===.5?t:T.Center}computeOtherPoint(t,e){if(this.computeAdjusting()!==0&&this.pointsCount>4)return this.computeMidPoint(new P);{let i=this.LE(e,this);if(i!==null)return i.tc;if(t instanceof ht){let s=this.fromNode,n=this.fromPort;n===e&&(s=this.toNode,n=this.toPort);let o=I.l(),r=I.l();if(n&&s?.isMemberOf(t)){let a=this.computeSpot(n===e,e);if(e.getDocumentBounds(o),n.getDocumentBounds(r),o.isReal()&&r.isReal()&&o.containsRect(r)){let h=n.getDocumentPoint(T.Center);return this.vC(o,h.x,h.y,0,a,h),I.i(o),I.i(r),h}}I.i(o),I.i(r)}return e.getDocumentPoint(T.Center)}}computeShortLength(t){if(t){let e=this.fromShortLength;if(isNaN(e)){let i=this.fromPort;i!==null&&(e=i.fromShortLength)}return isNaN(e)?0:e}else{let e=this.toShortLength;if(isNaN(e)){let i=this.toPort;i!==null&&(e=i.toShortLength)}return isNaN(e)?0:e}}Wm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r;if(o===void 0?(r=Nt.l(),r.Ue()):r=o,r.kc(this.v),this.containedInRect(t,r))return this.WN(e,i,n),o===void 0&&Nt.i(r),!0;if(this.intersectsRect(t,r)){let a=!1;if(!this.Tf){let h=this.D.r,l=h.length;for(let u=l;u--;){let c=h[u];if(!c.visible&&c!==this.locationObject)continue;let d=c.actualBounds,f=this.naturalBounds;if(d.x>f.width||d.y>f.height||d.x+d.width<0||d.y+d.height<0)continue;let p=c,g=Nt.l();if(g.set(r),p instanceof G?a=p.Wm(t,e,i,s,n,g):this.path===p?p instanceof et&&(a=p.sE(t,s,g)):a=p.JT(t,s,g),a){let y=p;e!==null&&(y=e(p)),y&&(i===null||i(y))&&n.add(y)}Nt.i(g)}}return o===void 0&&Nt.i(r),a||this.background!==null}return o===void 0&&Nt.i(r),!1}get isOrthogonal(){return(this.Jh&2)===2}static SC(t){return(t&2)===2}get isAvoiding(){return(this.Jh&4)===4}computeCurve(){if(this._o===null){let t=this.fromPort,e=t!==null&&t===this.toPort,i=this.isOrthogonal;this._o=e&&!i}return this._o?9:this.curve}computeCorner(){if(this.curve===9)return 0;let t=this.corner;return(isNaN(t)||t<0)&&(t=j.lv),t}findMidLabel(){let t=this.path,e=this.D.r,i=e.length;for(let n=0;n<i;n++){let o=e[n];if(!(o===t||o.isPanelMain)&&(o.segmentIndex===-1/0||isNaN(o.segmentIndex)))return o}let s=this.labelNodes;for(;s.next();){let n=s.value;if(n.segmentIndex===-1/0||isNaN(n.segmentIndex))return n}return null}computeSpacing(){if(!this.isVisible())return 0;let t=j.av;t=Math.max(t,this.computeThickness());let e=this.fromPort,i=this.toPort;if(e!==null&&i!==null){let s=this.findMidLabel();if(s!==null){let n=s.naturalBounds,o=s.margin,r=isNaN(n.width)?j.hv:n.width*s.scale+o.left+o.right,a=isNaN(n.height)?j.cv:n.height*s.scale+o.top+o.bottom,h=s.segmentOrientation;if(h===21||h===25||h===24)t=Math.max(t,a);else if(h===23||h===27||h===22||h===26)t=Math.max(t,r);else{let l=e.getDocumentPoint(T.Center).directionPoint(i.getDocumentPoint(T.Center))/180*Math.PI;t=Math.max(t,Math.abs(Math.sin(l)*r)+Math.abs(Math.cos(l)*a)+1)}this.curve===9&&(t*=j.sv)}}return t}arrangeBundledLinks(t,e){if(e)for(let i=0;i<t.length;i++){let s=t[i];s.computeAdjusting()===0&&s.$t()}}computeCurviness(){let t=this.curviness;if(isNaN(t)){t=j.ev;let e=this.tr;if(e!==null){let i=m.st(),s=0,n=e.on;for(let r=0;r<n.length;r++){let a=n[r].computeSpacing();i.push(a),s+=a}let o=-s/2;for(let r=0;r<n.length;r++){if(n[r]===this){t=o+i[r]/2;break}o+=i[r]}e.By===this.fromNode&&(t=-t),m.Z(i)}}return t}computeThickness(){if(!this.isVisible())return 0;let t=this.path;return t!==null?Math.max(t.strokeWidth,1):1}hasCurviness(){return!isNaN(this.curviness)||this.tr!==null}CE(t,e,i,s,n,o){let r=this.getLinkPoint(t,e,i,!0,!1,s,n),a=this.getLinkPoint(s,n,o,!1,!1,t,e);if(this.dv(t,e,i,r,s,n,o,a),this.addPoint(r),this.addPoint(a),this.hasCurviness()){let h=a.x-r.x,l=a.y-r.y,u=this.computeCurviness(),c=u,d=r.x+h/2,f=r.y+l/2,p=d,g=f;if(C.c(l,0))h>0?g-=c:g+=c;else{let y=-h/l,b=Math.sqrt(c*c/(y*y+1));u<0&&(b=-b),p=(l<0?-1:1)*b+d,g=y*(p-d)+f}this.insertPointAt(1,p,g)}}dv(t,e,i,s,n,o,r,a){let h=o.getDocumentBounds(I.l()),l=e.getDocumentBounds(I.l());if(h.intersectsRect(l)&&!h.containsRect(l)&&!l.containsRect(h)){let u=P.l();e.getDocumentPoint(this.sg(i,!0),u);let c=P.l();o.getDocumentPoint(this.sg(r,!1),c);let d=l.width*l.height,f=h.width*h.height;d>f?(s.h(u),this.getLinkPointFromPoint(n,o,c,u,!1,c),a.h(c)):d<f?(this.getLinkPointFromPoint(t,e,u,c,!0,u),s.h(u),a.h(c)):(s.h(u),a.h(c)),P.i(u),P.i(c)}else if(h.containsPoint(s)){let u=P.l();e.getDocumentPoint(this.sg(i,!0),u),a.h(u),this.RC(h,u.x,u.y,j.Yf,a),this.getLinkPointFromPoint(n,o,h.containsPoint(u)?u:s,a,!1,a),this.getLinkPointFromPoint(t,e,u,a,!0,s),P.i(u)}else if(l.containsPoint(a)){let u=P.l();o.getDocumentPoint(this.sg(r,!1),u),s.h(u),this.RC(l,u.x,u.y,j.Yf,s),this.getLinkPointFromPoint(t,e,l.containsPoint(u)?u:a,s,!0,s),this.getLinkPointFromPoint(n,o,u,s,!1,a),P.i(u)}I.i(l),I.i(h)}vC(t,e,i,s,n,o){let r=-1;return n.equals(T.Left)||n.equals(T.LeftSide)?r=180:n.equals(T.Right)||n.equals(T.RightSide)?r=0:n.equals(T.Top)||n.equals(T.TopSide)?r=270:(n.equals(T.Bottom)||n.equals(T.BottomSide))&&(r=90),r===-1?this.RC(t,e,i,0,o):this.gv(t,e,i,0,r,o)}RC(t,e,i,s,n){let o=C.$w(t,e,i);return this.gv(t,e,i,s,o,n)}gv(t,e,i,s,n,o){return n===0?o.x=t.right+s:n===90?o.y=t.bottom+s:n===180?o.x=t.x-s:n===270?o.y=t.y-s:n===45?(o.x=t.right+s,o.y=t.bottom+s):n===135?(o.x=t.x-s,o.y=t.bottom+s):n===225?(o.x=t.x-s,o.y=t.y-s):n===315&&(o.x=t.right+s,o.y=t.y-s),o}NE(t,e,i,s,n,o){let r=this.getLinkPoint(t,e,i,!0,!1,s,n),a=this.getLinkPoint(s,n,o,!1,!1,t,e);this.dv(t,e,i,r,s,n,o,a),this.addPoint(r),this.addPoint(a);let h=a.x-r.x,l=a.y-r.y,u=this.computeCurviness(),c=0,d=0,f=r.x+h/3,p=r.y+l/3,g=f,y=p;C.c(l,0)?h>0?y-=u:y+=u:(c=-h/l,d=Math.sqrt(u*u/(c*c+1)),u<0&&(d=-d),g=(l<0?-1:1)*d+f,y=c*(g-f)+p),f=r.x+2*h/3,p=r.y+2*l/3;let b=f,v=p;C.c(l,0)?h>0?v-=u:v+=u:(b=(l<0?-1:1)*d+f,v=c*(b-f)+p),this.insertPointAt(1,g,y),this.insertPointAt(2,b,v),this.setPoint(0,this.getLinkPoint(t,e,i,!0,!1,s,n)),this.setPoint(3,this.getLinkPoint(s,n,o,!1,!1,t,e))}adjustPoints(t,e,i,s){let n=this.computeAdjusting();if(this.isOrthogonal){if(n===18)return!1;n===19&&(n=17)}switch(n){case 18:return this.vE(t,e,i,s);case 19:return this.FE(t,e,i,s);case 17:return this.RE(t,e,i,s);default:return!1}}vE(t,e,i,s){let n=this.getPoint(t),o=this.getPoint(i);if(n.equalsApprox(e)&&o.equalsApprox(s))return!0;let r=n.x,a=n.y,h=o.x,l=o.y,u=h-r,c=l-a,d=Math.sqrt(u*u+c*c);if(C.X(d,0))return!0;let f=0;C.X(u,0)?c<0?f=-Math.PI/2:f=Math.PI/2:(f=Math.atan(c/Math.abs(u)),u<0&&(f=Math.PI-f));let p=e.x,g=e.y,y=s.x,b=s.y,v=y-p,w=b-g,k=Math.sqrt(v*v+w*w),S=0;C.X(v,0)?w<0?S=-Math.PI/2:S=Math.PI/2:(S=Math.atan(w/Math.abs(v)),v<0&&(S=Math.PI-S));let N=k/d,D=S-f;this.setPoint(t,e);for(let L=t+1;L<i;L++){let M=this.getPoint(L);u=M.x-r,c=M.y-a;let A=Math.sqrt(u*u+c*c);if(C.X(A,0))continue;let F=0;C.X(u,0)?c<0?F=-Math.PI/2:F=Math.PI/2:(F=Math.atan(c/Math.abs(u)),u<0&&(F=Math.PI-F));let O=F+D,E=A*N,B=p+E*Math.cos(O),X=g+E*Math.sin(O);this.setPointAt(L,B,X)}return this.setPoint(i,s),!0}FE(t,e,i,s){let n=this.getPoint(t),o=this.getPoint(i);if(n.equalsApprox(e)&&o.equalsApprox(s))return!0;let r=n.x,a=n.y,h=o.x,l=o.y,u=(h-r)**2+(l-a)**2,c=e.x,d=e.y,f=s.x,p=s.y,g=0,y=1;f-c!==0?(g=(p-d)/(f-c),y=Math.sqrt(1+1/(g*g))):g=9e9,this.setPoint(t,e);for(let b=t+1;b<i;b++){let v=this.getPoint(b),w=v.x,k=v.y,S=.5;u!==0&&(S=((r-w)*(r-h)+(a-k)*(a-l))/u);let N=r+S*(h-r),D=a+S*(l-a),L=Math.sqrt((w-N)**2+(k-D)**2);k<g*(w-N)+D&&(L=-L),g>0&&(L=-L);let M=c+S*(f-c),A=d+S*(p-d);if(g!==0){let F=M+L/y,O=A-(F-M)/g;this.setPointAt(b,F,O)}else this.setPointAt(b,M,A+L)}return this.setPoint(i,s),!0}RE(t,e,i,s){if(this.isOrthogonal){let n=this.getPoint(t),o=this.getPoint(t+1),r=this.getPoint(t+2),a=o.x,h=o.y,l=a,u=h;C.c(n.y,o.y)?C.c(o.x,r.x)?h=e.y:C.c(o.y,r.y)&&(a=e.x):C.c(n.x,o.x)&&(C.c(o.y,r.y)?a=e.x:C.c(o.x,r.x)&&(h=e.y)),this.setPointAt(t+1,a,h),n=this.getPoint(i),o=this.getPoint(i-1),r=this.getPoint(i-2);let c=o.x,d=o.y,f=c,p=d;if(C.c(n.y,o.y)?C.c(o.x,r.x)?d=s.y:C.c(o.y,r.y)&&(c=s.x):C.c(n.x,o.x)&&(C.c(o.y,r.y)?c=s.x:C.c(o.x,r.x)&&(d=s.y)),this.setPointAt(i-1,c,d),this.yT())return this.setPointAt(t+1,l,u),this.setPointAt(i-1,f,p),!1}return this.setPoint(t,e),this.setPoint(i,s),!0}addOrthoPoints(t,e,i,s,n,o){e=C.Ee(e),s=C.Ee(s);let r=s;e>=315||e<45?e=0:45<=e&&e<135?e=90:135<=e&&e<225?e=180:e=270,s>=315||s<45?s=0:45<=s&&s<135?s=90:135<=s&&s<225?s=180:s=270;let a=t,h=i,l=I.bs(n.actualBounds),u=I.bs(o.actualBounds);l.inflate(j.Fa,j.Fa),u.inflate(j.Fa,j.Fa),l.unionPoint(t),u.unionPoint(i);let c=P.l(),d=P.l();e===0?h.x>a.x||s===270&&h.y<a.y&&u.right>a.x||s===90&&h.y>a.y&&u.right>a.x?(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),s===180?(c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1),d.x=c.x,d.y=h.y):s===270&&h.y<a.y||s===90&&h.y>a.y?(a.x<u.left?c.x=this.computeMidOrthoPosition(a.x,a.y,u.left,h.y,!1):a.x<u.right&&(s===270&&a.y<u.top||s===90&&a.y>u.bottom)?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):c.x=u.right,d.x=c.x,d.y=h.y):s===0&&a.x<u.left&&a.y>u.top&&a.y<u.bottom&&(c.x=a.x,a.y<h.y?c.y=Math.min(h.y,u.top):c.y=Math.max(h.y,u.bottom),d.y=c.y)):(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),(s===180||s===90&&h.y<l.top||s===270&&h.y>l.bottom)&&(s===180&&(u.containsPoint(a)||l.containsPoint(h))?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):h.y<a.y&&(s===180||s===90)?c.y=this.computeMidOrthoPosition(a.x,l.top,h.x,Math.min(h.y,u.bottom),!0):h.y>a.y&&(s===180||s===270)&&(c.y=this.computeMidOrthoPosition(a.x,l.bottom,h.x,Math.max(h.y,u.top),!0)),d.x=h.x,d.y=c.y),c.y>l.top&&c.y<l.bottom&&(h.x>=l.left&&h.x<=a.x||a.x<=u.right&&a.x>=h.x?(s===90||s===270)&&(c.e(Math.max((a.x+h.x)/2,a.x),a.y),d.e(c.x,h.y)):(s===270||(s===0||s===180)&&h.y<a.y?c.y=Math.min(h.y,s===0?l.top:Math.min(l.top,u.top)):c.y=Math.max(h.y,s===0?l.bottom:Math.max(l.bottom,u.bottom)),d.x=h.x,d.y=c.y))):e===180?h.x<a.x||s===270&&h.y<a.y&&u.left<a.x||s===90&&h.y>a.y&&u.left<a.x?(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),s===0?(c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1),d.x=c.x,d.y=h.y):s===270&&h.y<a.y||s===90&&h.y>a.y?(a.x>u.right?c.x=this.computeMidOrthoPosition(a.x,a.y,u.right,h.y,!1):a.x>u.left&&(s===270&&a.y<u.top||s===90&&a.y>u.bottom)?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):c.x=u.left,d.x=c.x,d.y=h.y):s===180&&a.x>u.right&&a.y>u.top&&a.y<u.bottom&&(c.x=a.x,a.y<h.y?c.y=Math.min(h.y,u.top):c.y=Math.max(h.y,u.bottom),d.y=c.y)):(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),(s===0||s===90&&h.y<l.top||s===270&&h.y>l.bottom)&&(s===0&&(u.containsPoint(a)||l.containsPoint(h))?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):h.y<a.y&&(s===0||s===90)?c.y=this.computeMidOrthoPosition(a.x,l.top,h.x,Math.min(h.y,u.bottom),!0):h.y>a.y&&(s===0||s===270)&&(c.y=this.computeMidOrthoPosition(a.x,l.bottom,h.x,Math.max(h.y,u.top),!0)),d.x=h.x,d.y=c.y),c.y>l.top&&c.y<l.bottom&&(h.x<=l.right&&h.x>=a.x||a.x>=u.left&&a.x<=h.x?(s===90||s===270)&&(c.e(Math.min((a.x+h.x)/2,a.x),a.y),d.e(c.x,h.y)):(s===270||(s===0||s===180)&&h.y<a.y?c.y=Math.min(h.y,s===180?l.top:Math.min(l.top,u.top)):c.y=Math.max(h.y,s===180?l.bottom:Math.max(l.bottom,u.bottom)),d.x=h.x,d.y=c.y))):e===90?h.y>a.y||s===180&&h.x<a.x&&u.bottom>a.y||s===0&&h.x>a.x&&u.bottom>a.y?(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),s===270?(c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0),d.x=h.x,d.y=c.y):s===180&&h.x<a.x||s===0&&h.x>a.x?(a.y<u.top?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,u.top,!0):a.y<u.bottom&&(s===180&&a.x<u.left||s===0&&a.x>u.right)?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):c.y=u.bottom,d.x=h.x,d.y=c.y):s===90&&a.y<u.top&&a.x>u.left&&a.x<u.right&&(a.x<h.x?c.x=Math.min(h.x,u.left):c.x=Math.max(h.x,u.right),c.y=a.y,d.x=c.x)):(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),(s===270||s===0&&h.x<l.left||s===180&&h.x>l.right)&&(s===270&&(u.containsPoint(a)||l.containsPoint(h))?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):h.x<a.x&&(s===270||s===0)?c.x=this.computeMidOrthoPosition(l.left,a.y,Math.min(h.x,u.right),h.y,!1):h.x>a.x&&(s===270||s===180)&&(c.x=this.computeMidOrthoPosition(l.right,a.y,Math.max(h.x,u.left),h.y,!1)),d.x=c.x,d.y=h.y),c.x>l.left&&c.x<l.right&&(h.y>=l.top&&h.y<=a.y||a.y<=u.bottom&&a.y>=h.y?(s===0||s===180)&&(c.e(a.x,Math.max((a.y+h.y)/2,a.y)),d.e(h.x,c.y)):(s===180||(s===90||s===270)&&h.x<a.x?c.x=Math.min(h.x,s===90?l.left:Math.min(l.left,u.left)):c.x=Math.max(h.x,s===90?l.right:Math.max(l.right,u.right)),d.x=c.x,d.y=h.y))):h.y<a.y||s===180&&h.x<a.x&&u.top<a.y||s===0&&h.x>a.x&&u.top<a.y?(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),s===90?(c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0),d.x=h.x,d.y=c.y):s===180&&h.x<a.x||s===0&&h.x>=a.x?(a.y>u.bottom?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,u.bottom,!0):a.y>u.top&&(s===180&&a.x<u.left||s===0&&a.x>u.right)?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):c.y=u.top,d.x=h.x,d.y=c.y):s===270&&a.y>u.bottom&&a.x>u.left&&a.x<u.right&&(a.x<h.x?c.x=Math.min(h.x,u.left):c.x=Math.max(h.x,u.right),c.y=a.y,d.x=c.x)):(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),(s===90||s===0&&h.x<l.left||s===180&&h.x>l.right)&&(s===90&&(u.containsPoint(a)||l.containsPoint(h))?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):h.x<a.x&&(s===90||s===0)?c.x=this.computeMidOrthoPosition(l.left,a.y,Math.min(h.x,u.right),h.y,!1):h.x>a.x&&(s===90||s===180)&&(c.x=this.computeMidOrthoPosition(l.right,a.y,Math.max(h.x,u.left),h.y,!1)),d.x=c.x,d.y=h.y),c.x>l.left&&c.x<l.right&&(h.y<=l.bottom&&h.y>=a.y||a.y>=u.top&&a.y<=h.y?(s===0||s===180)&&(c.e(a.x,Math.min((a.y+h.y)/2,a.y)),d.e(h.x,c.y)):(s===180||(s===90||s===270)&&h.x<a.x?c.x=Math.min(h.x,s===270?l.left:Math.min(l.left,u.left)):c.x=Math.max(h.x,s===270?l.right:Math.max(l.right,u.right)),d.x=c.x,d.y=h.y))),this.TC=s!==r,this.kC=e,this.PC=s,this.addPoint(c.copy()),this.addPoint(d.copy()),P.i(c),P.i(d),I.i(l),I.i(u)}computeMidOrthoPosition(t,e,i,s,n){let o=0;return this.hasCurviness()&&!this.computeSpot(!0,this.fromPort).isSide()&&!this.computeSpot(!1,this.toPort).isSide()&&(o=this.computeCurviness()),n?(e+s)/2+o:(t+i)/2+o}yT(){if(this.diagram===null||!this.isAvoiding||this.diagram.animationManager.isTicking)return!1;let t=this.points.r,e=t.length;if(e<4)return!1;let i=this.diagram.getPositions(!1,this.containingGroup,null);for(let s=1;s<e-2;s++){let n=t[s],o=t[s+1];if(!i.isUnoccupied(Math.min(n.x,o.x),Math.min(n.y,o.y),Math.abs(n.x-o.x),Math.abs(n.y-o.y)))return!0}return!1}findClosestSegment(t){let e=t.x,i=t.y,s=this.getPoint(0),n=this.getPoint(1),o=P.distanceLineSegmentSquared(e,i,s.x,s.y,n.x,n.y),r=0;for(let a=1;a<this.pointsCount-1;a++){s=this.getPoint(a+1);let h=P.distanceLineSegmentSquared(e,i,n.x,n.y,s.x,s.y);n=s,h<o&&(r=a,o=h)}return r}invalidateGeometry(){this.ai()}ai(){this.Ra&&(this.Ra=!1,this.f())}get Ra(){return(this.St&128)!==0}set Ra(t){(this.St&128)!==0!==t&&(this.St=this.St^128)}get geometry(){if(!this.Ra){if(this.updateRoute(),this.pointsCount<2)return this.Ra=!0,this.ut;this.ut=this.makeGeometry(),this.Ra=!0}return this.ut}Dd(t){if(!t){if(this.Fi===!1)return;let n=this.findMainElement();if(this.Ra&&(n===null||n.geometry!==null))return}this.pointsCount>=2&&(this.ut=this.makeGeometry()),this.Ra=!0;let e=this.path;if(e===null)return;e.ut=this.ut;let i=this.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o!==e&&o.isPanelMain&&o instanceof et&&(o.ut=this.ut)}}OE(t){return this._h()&&t.ra.has(this)&&(this.yl.width!==0||this.yl.height!==0)&&(t.animationManager.isAnimating||t.currentTool!==t.toolManager)}makeGeometry(){let t=this.ut,e=this.pointsCount,i=!1,s=this.diagram;s!==null&&this.OE(s)&&(i=!0);let n=0,o=0,r=P.bs(this.getPoint(0)),a=P.bs(r),h=this.Me.r,l=this.computeCurve();if(l===9&&e>=3&&!C.X(this.smoothness,0))if(e===3){let u=this.getPoint(1);n=Math.min(r.x,u.x),o=Math.min(r.y,u.y),u=this.getPoint(2),n=Math.min(n,u.x),o=Math.min(o,u.y)}else if(this.isOrthogonal){for(let u=0;u<e;u++){let c=h[u];a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y)}n=a.x,o=a.y}else{for(let u=3;u<e;u+=3){u+3>=e&&(u=e-1);let c=this.getPoint(u);a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y)}n=a.x,o=a.y}else{for(let u=0;u<e;u++){let c=h[u];a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y)}n=a.x,o=a.y}if(n-=this.fk.x,o-=this.fk.y,r.x-=n,r.y-=o,this.computeShortLength(!0)!==0&&(r=this.ec(r,!0,a)),e===2&&!this._h()){let u=P.bs(this.getPoint(1));return u.x-=n,u.y-=o,this.computeShortLength(!1)!==0&&(u=this.ec(u,!1,a)),t.type=1,t.startX=r.x,t.startY=r.y,t.endX=u.x,t.endY=u.y,P.i(u),P.i(r),P.i(a),t}else{t.type=4;let u=Ce.jL(t);if(u.Au(r.x,r.y,!1,!1),l===9&&e>=3&&!C.X(this.smoothness,0))if(e===3){let c=this.getPoint(1),d=c.x-n,f=c.y-o,p=P.bs(this.getPoint(2));p.x-=n,p.y-=o,this.computeShortLength(!1)!==0&&this.ec(p,!1,a),u.pr(d,f,d,f,p.x,p.y),P.i(p)}else if(this.isOrthogonal){let c=P.z(n,o),d=P.bs(this.getPoint(1)),f=P.z(n,o),p=P.z(n,o),g=this.getPoint(0),y,b=this.smoothness/3;for(let S=1;S<this.pointsCount-1;S++){y=this.getPoint(S);let N=g,D=y,L=this.getPoint(this.OC(y,S,!1));C.X(N.x,D.x)&&C.X(D.x,L.x)||C.X(N.y,D.y)&&C.X(D.y,L.y)||(this.IE(N,D,L,b,f,p),(S===1||S===2&&C.X(g.x,this.getPoint(0).x)&&C.X(g.y,this.getPoint(0).y))&&(d.x=(g.x+y.x)*.5,d.y=(g.y+y.y)*.5),u.pr(d.x-n,d.y-o,f.x-n,f.y-o,y.x-n,y.y-o),c.h(f),d.h(p),g=y)}let v=g.x,w=g.y,k=P.bs(this.getPoint(this.pointsCount-1));this.computeShortLength(!1)!==0&&this.ec(k,!1,P.dn),v=.5*(v+k.x),w=.5*(w+k.y),u.pr(p.x-n,p.y-o,v-n,w-o,k.x-n,k.y-o),P.i(k),P.i(c),P.i(d),P.i(f),P.i(p)}else for(let c=3;c<e;c+=3){let d=this.getPoint(c-2);c+3>=e&&(c=e-1);let f=this.getPoint(c-1),p=P.bs(this.getPoint(c));c===e-1&&this.computeShortLength(!1)!==0&&this.ec(p,!1,P.dn),u.pr(d.x-n,d.y-o,f.x-n,f.y-o,p.x-n,p.y-o),P.i(p)}else if(this.isOrthogonal||e===2){let c=P.bs(this.getPoint(0)),d=P.l(),f=P.bs(c),p=this.computeCorner(),g=1,y=0;for(;g<e;){if(g=this.OC(c,g,g>1),d.h(this.getPoint(g)),g>=e-1){if(!c.equals(d))this.computeShortLength(!1)!==0&&this.ec(d,!1,P.dn),this.Rn(u,-n,-o,c,d,i);else if(y===0)for(g=1;g<e;)f.h(c),d.h(this.getPoint(g++)),this.Rn(u,-n,-o,c,d,i),c.h(d);break}y=this.OC(d,g+1,g<e-3);let b=this.getPoint(y);this.EE(u,-n,-o,c,d,b,c,f,p,i),f.h(d),g=y}P.i(c),P.i(d),P.i(f)}else{let c=this.computeCorner();if(e>2&&c>=.5){let d=P.bs(h[e-1]);this.computeShortLength(!1)!==0&&this.ec(d,!1,P.dn),r.x+=n,r.y+=o;for(let f=1;f<e;f++){let p=f===1?r:h[f-1],g=f===e-1?d:h[f],y=Math.sqrt(p.distanceSquaredPoint(g)),b=c/y;if(b<.5){if(f>1){let v=p.x+(g.x-p.x)*b,w=p.y+(g.y-p.y)*b;u.Tu(p.x-n,p.y-o,v-n,w-o)}u.Ys(g.x+(p.x-g.x)*b-n,g.y+(p.y-g.y)*b-o)}else f>1&&u.Tu(p.x-n,p.y-o,(p.x+g.x)/2-n,(p.y+g.y)/2-o);f===e-1&&u.Ys(d.x-n,d.y-o)}P.i(d)}else if(e>=2){let d=P.bs(h[e-1]);this.computeShortLength(!1)!==0&&this.ec(d,!1,P.dn);for(let f=1;f<e-1;f++)u.Ys(h[f].x-n,h[f].y-o);u.Ys(d.x-n,d.y-o),P.i(d)}}return Ce.WL(u),P.i(r),P.i(a),t}}wk(t,e,i,s){let n=i-t;if(isNaN(n)||n===1/0||n===-1/0)return NaN;n<0&&(n=-n);let o=s-e;return isNaN(o)||o===1/0||o===-1/0?NaN:(o<0&&(o=-o),C.X(n,0)?o:C.X(o,0)?n:Math.sqrt(n*n+o*o))}IE(t,e,i,s,n,o){isNaN(s)&&(s=this.smoothness/3);let r=t.x,a=t.y,h=e.x,l=e.y,u=i.x,c=i.y,d=s*this.wk(r,a,h,l),f=s*this.wk(h,l,u,c);if(C.X(a,l)&&C.X(h,u)&&(h>r?c>l?(n.x=h-d,n.y=l-d,o.x=h+f,o.y=l+f):(n.x=h-d,n.y=l+d,o.x=h+f,o.y=l-f):c>l?(n.x=h+d,n.y=l-d,o.x=h-f,o.y=l+f):(n.x=h+d,n.y=l+d,o.x=h-f,o.y=l-f)),C.X(r,h)&&C.X(l,c)&&(l>a?u>h?(n.x=h-d,n.y=l-d,o.x=h+f,o.y=l+f):(n.x=h+d,n.y=l-d,o.x=h-f,o.y=l+f):u>h?(n.x=h-d,n.y=l+d,o.x=h+f,o.y=l-f):(n.x=h+d,n.y=l+d,o.x=h-f,o.y=l-f)),C.X(r,h)&&C.X(h,u)||C.X(a,l)&&C.X(l,c)){let p=.5*(r+u),g=.5*(a+c);n.x=p,n.y=g,o.x=p,o.y=g}}ec(t,e,i){let s=this.pointsCount;if(s<2)return t;if(e){let n=this.getPoint(1),o=n.x-i.x,r=n.y-i.y,a=this.wk(t.x,t.y,o,r);if(a===0)return t;let h=s===2?a*.5:a,l=this.computeShortLength(!0);l>h&&(l=h);let u=l*(o-t.x)/a,c=l*(r-t.y)/a;t.x+=u,t.y+=c}else{let n=this.getPoint(s-2),o=n.x-i.x,r=n.y-i.y,a=this.wk(t.x,t.y,o,r);if(a===0)return t;let h=s===2?a*.5:a,l=this.computeShortLength(!1);l>h&&(l=h);let u=l*(t.x-o)/a,c=l*(t.y-r)/a;t.x-=u,t.y-=c}return t}OC(t,e,i){let s=this.pointsCount,n=t;for(;C.X(t.x,n.x)&&C.X(t.y,n.y);){if(e>=s)return s-1;n=this.getPoint(e++)}if(!C.X(t.x,n.x)&&!C.X(t.y,n.y))return e-1;let o=n;for(;C.X(t.x,n.x)&&C.X(n.x,o.x)&&(!i||(t.y>=n.y?n.y>=o.y:n.y<=o.y))||C.X(t.y,n.y)&&C.X(n.y,o.y)&&(!i||(t.x>=n.x?n.x>=o.x:n.x<=o.x));){if(e>=s)return s-1;o=this.getPoint(e++)}return e-2}EE(t,e,i,s,n,o,r,a,h,l){if(C.c(s.y,n.y)&&C.c(n.x,o.x)){let u=Math.min(h,Math.abs(n.x-a.x)/2),c=Math.min(u,Math.abs(o.y-n.y)/2);if(u=c,C.c(u,0)){this.Rn(t,e,i,s,n,l),r.h(n);return}let d=n.x,f=n.y,p=d,g=f;n.x>s.x?(d=n.x-u,o.y>n.y?g=n.y+c:g=n.y-c):(d=n.x+u,o.y>n.y?g=n.y+c:g=n.y-c);let y=P.z(d,f);this.Rn(t,e,i,s,y,l),P.i(y),t.Tu(n.x+e,n.y+i,p+e,g+i),r.e(p,g)}else if(C.c(s.x,n.x)&&C.c(n.y,o.y)){let u=Math.min(h,Math.abs(n.y-a.y)/2),c=Math.min(u,Math.abs(o.x-n.x)/2);if(u=c,C.c(c,0)){this.Rn(t,e,i,s,n,l),r.h(n);return}let d=n.x,f=n.y,p=d,g=f;n.y>s.y?(f=n.y-u,o.x>n.x?p=n.x+c:p=n.x-c):(f=n.y+u,o.x>n.x?p=n.x+c:p=n.x-c);let y=P.z(d,f);this.Rn(t,e,i,s,y,l),P.i(y),t.Tu(n.x+e,n.y+i,p+e,g+i),r.e(p,g)}else this.Rn(t,e,i,s,n,l),r.h(n)}Rn(t,e,i,s,n,o){if(o||!this._h())t.Ys(n.x+e,n.y+i);else{let r=j.nv,a=r/2,h=[],l=0;this.isVisible()&&(l=this.UE(s,n,h));let u=s.x,c=s.y;if(l>0){if(C.c(s.y,n.y))if(s.x<n.x){let d=0;for(;d<l;){let f=Math.max(s.x,Math.min(h[d++]-a,n.x-r));t.Ys(f+e,n.y+i),u=f+e,c=n.y+i;let p=Math.min(f+r,n.x);for(;d<l;){let v=h[d];if(v<p+r)d++,p=Math.min(v+a,n.x);else break}let g=n.y-r+i,y=p+e,b=n.y+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(u,g,y,g,y,b),u=y,c=b}}else{let d=l-1;for(;d>=0;){let f=Math.min(s.x,Math.max(h[d--]+a,n.x+r));t.Ys(f+e,n.y+i),u=f+e,c=n.y+i;let p=Math.max(f-r,n.x);for(;d>=0;){let v=h[d];if(v>p-r)d--,p=Math.max(v-a,n.x);else break}let g=n.y-r+i,y=p+e,b=n.y+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(u,g,y,g,y,b),u=y,c=b}}else if(C.c(s.x,n.x))if(s.y<n.y){let d=0;for(;d<l;){let f=Math.max(s.y,Math.min(h[d++]-a,n.y-r));t.Ys(n.x+e,f+i),u=n.x+e,c=f+i;let p=Math.min(f+r,n.y);for(;d<l;){let v=h[d];if(v<p+r)d++,p=Math.min(v+a,n.y);else break}let g=n.x-r+e,y=n.x+e,b=p+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(g,c,g,b,y,b),u=y,c=b}}else{let d=l-1;for(;d>=0;){let f=Math.min(s.y,Math.max(h[d--]+a,n.y+r));t.Ys(n.x+e,f+i),u=n.x+e,c=f+i;let p=Math.max(f-r,n.y);for(;d>=0;){let v=h[d];if(v>p-r)d--,p=Math.max(v-a,n.y);else break}let g=n.x-r+e,y=n.x+e,b=p+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(g,c,g,b,y,b),u=y,c=b}}}t.Ys(n.x+e,n.y+i)}}UE(t,e,i){let s=this.diagram;if(s===null||t.equals(e))return 0;let n=s.layers;for(;n.next();){let o=n.value;if(o!==null&&o.visible){let r=o.IM(),a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!(l instanceof j))continue;if(l===this)return i.length>0&&i.sort((d,f)=>d-f),i.length;if(!l.isVisible()||!l._h())continue;let u=l.routeBounds;if(!u.isReal()||!this.routeBounds.intersectsRect(u)||this.usesSamePort(l))continue;let c=l.path;c!==null&&c.isVisibleObject()&&this.VE(t,e,i,l)}}}return i.length>0&&i.sort((o,r)=>o-r),i.length}VE(t,e,i,s){let n=C.c(t.y,e.y),o=s.pointsCount,r=s.getPoint(0),a=P.l();for(let h=1;h<o;h++){let l=s.getPoint(h);if(h<o-1){let u=s.getPoint(h+1);if(r.y===l.y&&l.y===u.y){if(l.x>r.x&&u.x>=l.x||l.x<r.x&&u.x<=l.x)continue}else if(r.x===l.x&&l.x===u.x&&(l.y>r.y&&u.y>=l.y||l.y<r.y&&u.y<=l.y))continue}this.BE(t,e,r,l,a)&&(n?i.push(a.x):i.push(a.y)),r=l}P.i(a)}BE(t,e,i,s,n){let o=t.x,r=t.y,a=e.x,h=e.y,l=i.x,u=i.y,c=s.x,d=s.y;if(C.c(o,a)){if(!C.c(r,h)&&C.c(u,d)&&Math.min(r,h)<u&&Math.max(r,h)>u&&Math.min(l,c)<o&&Math.max(l,c)>o&&!C.c(l,c))return n.x=o,n.y=u,!0}else if(C.c(r,h)&&C.c(l,c)&&Math.min(o,a)<l&&Math.max(o,a)>l&&Math.min(u,d)<r&&Math.max(u,d)>r&&!C.c(u,d))return n.x=l,n.y=r,!0;return n.x=0,n.y=0,!1}get firstPickIndex(){return this.pointsCount<=2?0:this.isOrthogonal||!this.wl(this.computeSpot(!0))?1:0}get lastPickIndex(){let t=this.pointsCount;return t===0?0:t<=2?t-1:this.isOrthogonal||!this.wl(this.computeSpot(!1))?t-2:t-1}_h(){let t=this.curve;return t===11||t===10}gk(t){if(t||this._h()){let e=this.diagram;e!==null&&!e.animationManager.isTicking&&!e.ra.has(this)&&(this.yl.width!==0||this.yl.height!==0)&&e.ra.set(this,this.yl.copy())}}invalidateOtherJumpOvers(t){let e=this.layer;if(e===null||!e.visible||e.isTemporary)return;let i=e.diagram;if(i===null||i.animationManager.isTicking)return;let s=!1,n=i.layers;for(;n.next();){let o=n.value;if(o.visible){if(o===e){s=!0;let r=!1,a=o.IM(),h=a.length;for(let l=0;l<h;l++){let u=a[l];u instanceof j&&(u===this?r=!0:r&&this.mv(u,t))}}else if(s){let r=o.IM(),a=r.length;for(let h=0;h<a;h++){let l=r[h];l instanceof j&&this.mv(l,t)}}}}}mv(t,e){if(t===null||!t.Ra||!t.Fi||!t._h())return;let i=t.routeBounds;i.isReal()&&(!this.routeBounds.intersectsRect(i)&&!e.intersectsRect(i)||this.usesSamePort(t)||t.ai())}usesSamePort(t){let e=this.pointsCount,i=t.pointsCount;if(e>0&&i>0){let s=this.getPoint(0),n=t.getPoint(0);if(s.equalsApprox(n))return!0;let o=this.getPoint(e-1),r=t.getPoint(i-1);if(o.equalsApprox(r)||s.equalsApprox(r)||o.equalsApprox(n))return!0}else if(this.fromNode===t.fromNode||this.toNode===t.toNode||this.fromNode===t.toNode||this.toNode===t.fromNode)return!0;return!1}isVisible(){if(!super.isVisible())return!1;let t=this.containingGroup,e=!0,i=this.diagram;i!==null&&(e=i.isTreePathToChildren);let s=this.fromNode;if(s!==null){if(this.isTreeLink&&e&&!s.isTreeExpanded)return!1;if(s===t)return!0;let o=s;for(;o!==null;){if(o.labeledLink===this)return!0;o=o.containingGroup}let r=s.findVisibleNode();if(r===null||r===t)return!1}let n=this.toNode;if(n!==null){if(this.isTreeLink&&!e&&!n.isTreeExpanded)return!1;if(n===t)return!0;let o=n;for(;o!==null;){if(o.labeledLink===this)return!0;o=o.containingGroup}let r=n.findVisibleNode();if(r===null||r===t)return!1}return!0}Xe(t){if(super.Xe(t),t&&this.gk(!1),this.tr!==null&&this.tr.$d(),this.nn!==null){let e=this.nn.iterator;for(;e.next();)e.value.Xe(t)}}get adjusting(){return this.Gf}set adjusting(t){let e=this.Gf;e!==t&&(this.Gf=t,this.t("adjusting",e,t))}computeAdjusting(){return this.isAvoiding&&this.diagram!==null&&this.diagram.animationManager.defaultAnimation.isAnimating?17:this.Gf}get corner(){return this._d}set corner(t){let e=this._d;e!==t&&(this._d=t,this.ai(),this.t("corner",e,t))}get curve(){return this.tg}set curve(t){let e=this.tg;e!==t&&(this.tg=t,(e===9||t===9)&&this.AC(this.yl),this.$t(),this.ai(),this.gk(e===10||e===11||t===10||t===11),this.t("curve",e,t))}get curviness(){return this.eg}set curviness(t){let e=this.eg;e!==t&&(this.eg=t,this.$t(),this.ai(),this.t("curviness",e,t))}get routing(){return this.Jh}set routing(t){let e=this.Jh;e!==t&&(this.Jh=t,this.isAvoiding&&this.diagram!==null&&(this.diagram.np=!0),this._o=null,this.$t(),this.gk(j.SC(e)||j.SC(t)),this.t("routing",e,t))}get smoothness(){return this.ig}set smoothness(t){let e=this.ig;e!==t&&(this.ig=t,this.ai(),this.t("smoothness",e,t))}Jy(){let t=this.uo;if(t===null)return;let e=this.mo;if(e===null||!isNaN(this.curviness))return;let i=this.go,s=this.po,n=null,o=null,r=t.ee.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];!(l.uo===t&&l.go===i&&l.mo===e&&l.po===s)&&!(l.uo===e&&l.go===s&&l.mo===t&&l.po===i)||(o===null?o=l:(n===null&&(n=[],n.push(o)),n.push(l)))}if(n!==null){let h=t.KD(e,i,s);h===null&&(h=new $n(t,i,e,s),t.GD(h),e.GD(h)),h.on=n;for(let l=0;l<n.length;l++){let u=n[l];u.tr=h}h.$d()}}Wy(){let t=this.tr;if(t!==null){if(!isNaN(this.curviness))return;this.tr=null;let e=t.on.indexOf(this);e>=0&&(t.on.splice(e,1),t.$d())}}Nr(){return!0}get key(){let t=this.diagram;if(!(t===null||!t.model.Wh()))return t.model.getKeyForLinkData(this.data)}}class $n{Xo;qs;By;mC;ak;pC;on;constructor(t,e,i,s){V.Je(this),this.Xo=!1,this.qs=!1,this.By=t,this.mC=e,this.ak=i,this.pC=s,this.on=[]}$d(){if(!this.Xo){let t=this.on;if(t.length>0){let e=t[0].diagram;e!==null&&(e.s2.add(this),this.qs=e.undoManager.isUndoingRedoing)}}this.Xo=!0}k2(){if(this.Xo){this.Xo=!1;let t=this.on;if(t.length>0){let e=t[0],i=e.diagram,s=i===null||i.Qa&&!this.qs;this.qs=!1,e.arrangeBundledLinks(t,s),t.length===1&&(e.tr=null,t.length=0)}t.length===0&&(this.By.YD(this),this.ak.YD(this))}}}class Ot{ui;di;ic;sc;we;xe;Bt;Oa;Ia;Ah;O2;Xo;Zy;cf;I2;E2;constructor(t){V.Je(this),this.Ah=null,this.O2=null,this.Xo=!0,this.Zy=!1,this.ui=1,this.di=1,this.ic=-1,this.sc=-1,this.we=t.width,this.xe=t.height,this.Bt=[],this.Oa=0,this.Ia=0,this.cf=j.fv,this.I2=this.cf*2,this.E2=this.cf*2}static rn=0;static nc=1;static ng=999999;static IC=Ot.ng+1;static EC=Ot.ng+2;a1(t){if(t.width<=0||t.height<=0)return;let e=t.x,i=t.y,s=t.x+t.width,n=t.y+t.height;this.ui=Math.floor((e-this.we)/this.we)*this.we,this.di=Math.floor((i-this.xe)/this.xe)*this.xe,this.ic=Math.ceil((s+2*this.we)/this.we)*this.we,this.sc=Math.ceil((n+2*this.xe)/this.xe)*this.xe;let o=1+(Math.ceil((this.ic-this.ui)/this.we)|0),r=1+(Math.ceil((this.sc-this.di)/this.xe)|0);if(this.Bt.length===0||this.Oa<o-1||this.Ia<r-1){let a=[];for(let h=0;h<=o;h++)a[h]=new Uint32Array(r);this.Bt=a,this.Oa=o-1,this.Ia=r-1}this.zE(Ot.IC)}get bounds(){return new I(this.ui,this.di,this.ic-this.ui,this.sc-this.di)}get cellWidth(){return this.we}set cellWidth(t){t>0&&t!==this.we&&(this.we=t,this.a1(this.bounds))}get cellHeight(){return this.xe}set cellHeight(t){t>0&&t!==this.xe&&(this.xe=t,this.a1(this.bounds))}og(t,e){return this.ui<=t&&t<=this.ic&&this.di<=e&&e<=this.sc}yo(t,e){if(!this.og(t,e))return Ot.IC;t-=this.ui,t/=this.we,e-=this.di,e/=this.xe;let i=t|0,s=e|0;return this.Bt[i][s]}vO(t,e,i,s){if(!this.og(t,e))return;let n=(t-this.ui)/this.we|0,o=(e-this.di)/this.xe|0,r=(t+i-this.ui)/this.we|0,a=(e+s-this.di)/this.xe|0,h=Math.min(r,this.Oa),l=Math.min(a,this.Ia);for(let u=n;u<=h;u++){let c=this.Bt[u];if(c.fill)c.fill(Ot.rn,o,l+1);else for(let d=o;d<=l;d++)c[d]=Ot.rn}}zE(t){for(let e=0;e<=this.Oa;e++){let i=this.Bt[e];if(i.fill)i.fill(t);else for(let s=0;s<=this.Ia;s++)i[s]=t}}TT(){for(let t=0;t<=this.Oa;t++){let e=this.Bt[t];for(let i=0;i<=this.Ia;i++)e[i]>=Ot.nc&&(e[i]=Ot.IC)}}XE(t,e){return this.yo(t,e)===Ot.rn}isUnoccupied(t,e,i,s){if(t>this.ic||t+i<this.ui||e>this.sc||e+s<this.di)return!0;let n=(t-this.ui)/this.we|0,o=(e-this.di)/this.xe|0,r=Math.max(0,i)/this.we+1|0,a=Math.max(0,s)/this.xe+1|0;if(n<0&&(r+=n,n=0),o<0&&(a+=o,o=0),r<0||a<0)return!0;let h=Math.min(n+r-1,this.Oa)|0,l=Math.min(o+a-1,this.Ia)|0;for(let u=n;u<=h;u++){let c=this.Bt[u];for(let d=o;d<=l;d++)if(c[d]===Ot.rn)return!1}return!0}maxAvoidsLinksSpaceH(t,e,i,s){if(t>this.ic||e<this.ui||i>this.sc||i<this.di)return 0;let n=(t-this.ui)/this.we|0,o=(e-this.ui)/this.we|0,r=(i-this.di)/this.xe|0,a=s/this.xe+1|0,h;for(h=0;h<a/2;h++){let l=!1;for(let u=n;u<=o;u++)if(this.Bt[u][r+h]===Ot.rn||this.Bt[u][r-h]===Ot.rn){l=!0;break}if(l)return Math.max(0,(2*h-1)*this.xe)}return s}maxAvoidsLinksSpaceV(t,e,i,s){if(t>this.sc||e<this.di||i>this.ic||i<this.ui)return 0;let n=(t-this.di)/this.xe|0,o=(e-this.di)/this.xe|0,r=(i-this.ui)/this.we|0,a=s/this.we+1|0,h;for(h=0;h<a/2;h++){let l=!1;for(let u=n;u<=o;u++)if(this.Bt[r+h][u]===Ot.rn||this.Bt[r-h][u]===Ot.rn){l=!0;break}if(l)return Math.max(0,(2*h-1)*this.we)}return s}GE(t,e,i,s,n,o,r,a){t=t|0,e=e|0;let h=this.Bt[t][e];if(h>=Ot.nc&&h<Ot.ng)for(s?e+=i:t+=i,h+=1;n<=t&&t<=o&&r<=e&&e<=a;){let l=this.Bt[t][e];if(h>=l)break;this.Bt[t][e]=h,h+=1,s?e+=i:t+=i}return s?e:t}wo(t,e,i,s,n,o,r,a){if(t<n||t>o||e<r||e>a)return;let h=this.GE(t,e,i,s,n,o,r,a);if(s)if(i>0)for(let l=e+i;l<h;l+=i)this.wo(t,l,1,!s,n,o,r,a),this.wo(t,l,-1,!s,n,o,r,a);else for(let l=e+i;l>h;l+=i)this.wo(t,l,1,!s,n,o,r,a),this.wo(t,l,-1,!s,n,o,r,a);else if(i>0)for(let l=t+i;l<h;l+=i)this.wo(l,e,1,!s,n,o,r,a),this.wo(l,e,-1,!s,n,o,r,a);else for(let l=t+i;l>h;l+=i)this.wo(l,e,1,!s,n,o,r,a),this.wo(l,e,-1,!s,n,o,r,a)}xk(t,e,i,s,n,o,r,a,h,l){let u=t|0,c=e|0,d=Ot.rn,f=Ot.nc;for(this.Bt[u][c]=f;d===Ot.rn&&u>r&&u<a&&c>h&&c<l;)f+=1,this.Bt[u][c]=f,o?c+=n:u+=n,d=this.Bt[u][c];return o?c:u}bk(t,e,i,s,n,o,r,a,h,l){let u=i|0,c=s|0,d=Ot.rn,f=Ot.ng;for(this.Bt[u][c]=f;d===Ot.rn&&u>r&&u<a&&c>h&&c<l;)this.Bt[u][c]=f,o?c+=n:u+=n,d=this.Bt[u][c]}pv(t,e,i,s,n,o){this.Zy=!1;let r=t.x,a=t.y;if(!this.og(r,a))return;r-=this.ui,r/=this.we,a-=this.di,a/=this.xe;let h=i.x,l=i.y;if(!this.og(h,l))return;if(h-=this.ui,h/=this.we,l-=this.di,l/=this.xe,Math.abs(r-h)<=1&&Math.abs(a-l)<=1){this.Zy=!0;return}let u=n.x,c=n.y,d=n.x+n.width,f=n.y+n.height;u-=this.ui,u/=this.we,c-=this.di,c/=this.xe,d-=this.ui,d/=this.we,f-=this.di,f/=this.xe;let p=Math.max(0,Math.min(this.Oa,u|0)),g=Math.min(this.Oa,Math.max(0,d|0)),y=Math.max(0,Math.min(this.Ia,c|0)),b=Math.min(this.Ia,Math.max(0,f|0)),v=0,w=90,k=270,S=this.Bt,N=r|0,D=a|0,L=h|0,M=l|0,A=e===v||e===w?1:-1,F=e===w||e===k;S[N][D]===Ot.rn?(this.xk(N,D,L,M,A,F,p,g,y,b),this.xk(N,D,L,M,1,!F,p,g,y,b),this.xk(N,D,L,M,-1,!F,p,g,y,b)):this.xk(N,D,L,M,A,F,N,D,N,D),S[L][M]===Ot.rn?(this.bk(N,D,L,M,s===v||s===w?1:-1,s===w||s===k,p,g,y,b),this.bk(N,D,L,M,1,!(s===w||s===k),p,g,y,b),this.bk(N,D,L,M,-1,!(s===w||s===k),p,g,y,b)):this.bk(N,D,L,M,A,F,L,M,L,M);let O=m.st();if(o&&this.yv(L,M,s,N,D,O)){(O[0]!==L||O[1]!==M)&&(O.unshift(M),O.unshift(L)),(O[O.length-2]!==N||O[O.length-1]!==D)&&(O.push(N),O.push(D));let E=Ot.nc,B=O[O.length-2],X=O[O.length-1];S[B][X]=E++;for(let z=O.length-4;z>=0;z-=2){B=O[z+2],X=O[z+3];let U=O[z],tt=O[z+1];for(;U>B?B++:U<B?B--:tt>X?X++:tt<X&&X--,S[B][X]=E++,!(B===U&&X===tt););}}else this.wo(N,D,1,!1,p,g,y,b),this.wo(N,D,-1,!1,p,g,y,b),this.wo(N,D,1,!0,p,g,y,b),this.wo(N,D,-1,!0,p,g,y,b);m.Z(O)}yv(t,e,i,s,n,o){let r=this.Bt,a=t,h=e;for(;;){if(a===s&&h===n)return!0;let l=a,u=h;if(i===0)if(l<s)l++;else break;else if(i===90)if(u<n)u++;else break;else if(i===180)if(l>s)l--;else break;else if(u>n)u--;else break;let c=r[l][u];if(c===0||c===Ot.EC)break;a=l,h=u}for(;;){let l=i,u=a,c=h;i===0?c<n?(l=90,c++):c>n&&(l=270,c--):i===90?u<s?(l=0,u++):u>s&&(l=180,u--):i===180?c<n?(l=90,c++):c>n&&(l=270,c--):u<s?(l=0,u++):u>s&&(l=180,u--);let d=r[u][c];if(l!==i&&d!==0&&d!==Ot.EC){if(o.push(a),o.push(h),this.yv(a,h,l,s,n,o))return!0;o.pop(),o.pop()}if(r[a][h]=Ot.EC,i===0){if(a===t)return!1;a--}else if(i===90){if(h===e)return!1;h--}else if(i===180){if(a===t)return!1;a++}else{if(h===e)return!1;h++}}}}class Ji{Ri;xl;Ei;rg;constructor(t,e){V.Je(this),this.Ri=t,this.xl=e,this.Ei=[],this.rg=!1}toString(){let t=this.Ei,e=this.Ri.toString()+" "+t.length.toString()+":";for(let i=0;i<t.length;i++){let s=t[i];s!==null&&(e+=`
|
|
12
|
+
`);if(t.length===0)return 8;if(this.isMultiline){let e=0,i=0,s=!1;for(;!s;){let n=this.ik(t,i);n===-1&&(n=t.length,s=!0);let o=t.substring(i,n);this.formatting===0&&(o=o.trim()),e=Math.max(e,this.getStringWidth(o)),i=n+1}return e}else{let e=this.ik(t,0);return e>=0&&(t=t.substring(0,e)),this.getStringWidth(t)}}get textValidation(){return this.tt!==null?this.tt.zl:null}set textValidation(t){let e=this.textValidation;e!==t&&(t!==null&&m.S(t,lt,"textValidation"),this.Rs().zl=t,this.t("textValidation",e,t))}get textEdited(){return this.tt!==null?this.tt.ty:null}set textEdited(t){let e=this.textEdited;e!==t&&(t!==null&&m.S(t,lt,"textEdited"),this.Rs().ty=t,this.t("textEdited",e,t))}get spacingAbove(){return this.tt!==null?this.tt.ey:0}set spacingAbove(t){let e=this.spacingAbove;e!==t&&(this.Rs().ey=t,this.f(),this.t("spacingAbove",e,t))}get spacingBelow(){return this.tt!==null?this.tt.iy:0}set spacingBelow(t){let e=this.spacingBelow;e!==t&&(this.Rs().iy=t,this.f(),this.t("spacingBelow",e,t))}get letterSpacing(){return this.tt!==null?this.tt.ny:"0px"}set letterSpacing(t){let e=this.letterSpacing;e!==t&&(lt.ek=!0,this.Rs().ny=t,this.f(),this.t("letterSpacing",e,t))}get wordSpacing(){return this.tt!==null?this.tt.ly:"0px"}set wordSpacing(t){let e=this.wordSpacing;e!==t&&(lt.ek=!0,this.Rs().ly=t,this.f(),this.t("wordSpacing",e,t))}get formatting(){return this.tt!==null?this.tt.hy:0}set formatting(t){let e=this.formatting;e!==t&&(this.Rs().hy=t,this.f(),this.t("formatting",e,t))}get maxLines(){return this.tt!==null?this.tt.cy:1/0}set maxLines(t){let e=this.maxLines;e!==t&&(t=Math.floor(t),t<=0&&m.J(t,"> 0",lt,"maxLines"),this.Rs().cy=t,this.f(),this.t("maxLines",e,t))}getMetrics(){return[this.pe,this.Xl,this.co,this.vn,this.Ii,this.ye,this.Fn||""]}oE(t){t!==void 0&&(this.pe=t[0],this.Xl=t[1],this.co=t[2],this.vn=t[3],this.Ii=t[4],this.ye=t[5],this.Fn=t[6])}get metrics(){return{arrSize:this.Ii!==null?this.Ii:[this.pe],arrText:this.ye!==null?this.ye:[this.Fn],maxLineWidth:this.pe,fontHeight:this.co}}get choices(){return this.Hd}set choices(t){let e=this.Hd;e!==t&&(this.Hd=t,this.t("choices",e,t))}static cE=new RegExp("[ \u200B\xAD]");static oC=new yt;static TD=0;static Q1=new yt;static iC=0;static j0="...";static LD="";static us=null;static k0=!1;static ek=!1}class Ui{me;gs;fo;hy;cy;$0;ey;iy;W0;ty;Q0;zl;rl;J0;ny;ly;constructor(){this.me=!1,this.gs=null,this.fo=0,this.hy=0,this.cy=1/0,this.$0=0,this.ey=0,this.iy=0,this.W0="start",this.ty=null,this.Q0=null,this.zl=null,this.rl=T.Top,this.J0=2,this.ny="0px",this.ly="0px"}copy(){let t=new Ui;return t.gs=this.gs,t.fo=this.fo,t.hy=this.hy,t.cy=this.cy,t.$0=this.$0,t.ey=this.ey,t.iy=this.iy,t.W0=this.W0,t.ty=this.ty,t.Q0=this.Q0,t.zl=this.zl,t.rl=this.rl,t.J0=this.J0,t.ny=this.ny,t.ly=this.ly,t}}class xe{Ff;Rf;Of;_0;If;constructor(){this.Ff=1,this.Rf=0,this.Of=1,this._0=null,this.If=null}copy(){let t=new xe;return t.Ff=this.Ff,t.Rf=this.Rf,t.Of=this.Of,t._0=this._0,t.If=this.If,t}}var ji=(x=>(x[x.None=0]="None",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(ji||{});class Bt extends J{ll;en;al;Ef;gs;hl;Uf;fo;Vf;Bf;O1;constructor(t,e){super(),this.n|=2097152,this.ll=null,this.en="",this.al=I.GF,this.Ef=2,this.gs=null,this.hl=null,this.Uf=T.Center,this.fo=0,this.Vf=null,this.Bf=null,this.O1=null,typeof t=="string"?this.source=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.en=this.en,t.element=this.ll,t.al=this.al.N(),t.Ef=this.Ef,t.fo=this.fo,t.gs=this.gs,t.hl=this.hl,t.Uf=this.Uf.N(),t.Bf=this.Bf}fe(t){t in ji?this.imageStretch=t:super.fe(t)}toString(){return"Picture("+this.source+")#"+V.xs(this)}get zf(){return(this.n&1048576)!==0}set zf(t){this.zf!==t&&(this.n=this.n^1048576)}get fy(){return(this.n&2097152)!==0}set fy(t){this.fy!==t&&(this.n=this.n^2097152)}get Sn(){return(this.n&4194304)!==0}set Sn(t){this.Sn!==t&&(this.n=this.n^4194304)}static clearCache(t){t===void 0&&(t=""),m.s(t,"string",Bt,"clearCache:url"),t!==""?Bt.uy[t]&&(delete Bt.uy[t],Bt.sk--):(Bt.uy=new yt,Bt.sk=0)}static ST(t,e){e.DD||(e.nk=i=>{Bt.fE(e,i),t.desiredSize.isReal()||(t.xi(!1),t.f())},e.ok=i=>Bt.uE(e,i),e.addEventListener("load",e.nk),e.addEventListener("error",e.ok),e.DD=!0)}static DO(t){t.nk&&t.removeEventListener("load",t.nk),t.ok&&t.removeEventListener("error",t.ok),delete t.nk,delete t.ok,t.DD=!1}get element(){return this.ll}set element(t){let e=this.ll;if(this.Ji(!0),e!==t){let i=Y.isUsingDOM(),s=!1;i&&(this.zf=t instanceof HTMLCanvasElement,s=t instanceof HTMLImageElement,t!==null&&!(s||t instanceof HTMLVideoElement||this.zf)&&m.o("Picture.element must be an instance of Image, Canvas, or Video, not: "+t));let n=this.diagram;n!==null&&n.F2(this),this.ll=t,t!==null&&s&&t.hs===void 0&&(t.hs=new V),n!==null&&s&&n.v2(this),this.t("element",e,t),this.C()}}AO(){let t=this.ll;if(t===null)return;let e=this.desiredSize.isReal();(this.zf||t.complete===!0)&&(t.Lp&&(t.gy instanceof Event&&this.gs!==null?this.gs(this,t.gy):t.Sn===!0&&!t.gy&&this.hl!==null&&t.rC&&this.hl(this,t.rC)),t.Sn=!0),t.Sn&&e&&this.diagram!==null&&this.diagram.rd.add(this)}dE(){if(this.ll===null){this.Vf=!1;return}let t=new Fe(null)._t;try{t.drawImage(this.ll,0,0)}catch{this.fy=!1}try{t.getImageData(0,0,1,1).data[3]&&(this.Vf=!1),this.Vf=!1}catch{this.Vf=!0}}get source(){return this.en}set source(t){let e=this.en;if(e!==t){this.Ji(!0),m.s(t,"string",Bt,"source"),this.en=t;let i=Bt.uy,s=null;if(i[t]!==void 0)s=i[t];else if(t!==""){Bt.sk>30&&(Bt.clearCache(),i=Bt.uy),s=m.Ni("img"),s.Lp=!0,Bt.ST(this,s);let n=this.Bf;n!==null&&(s.crossOrigin=n(this)),s.src=t,i[t]=s,Bt.sk++}this.element=s,s!==null&&s.__goCache===void 0&&(s.__goCache=new Hn),this.f(),this.C(),this.t("source",e,t)}}static fE(t,e){t.Sn=!0,t.gy=!1;let i,s=t.hs.copy();if(s==null)return;let n=s.iterator;for(;n.next();){let o=n.value;o.C();let r=t.getAttribute("src")||"",a=o.oa.get(r);if(a===null)continue;let h=a.length;for(let l=0;l<h;l++)i=a[l],i.desiredSize.isReal()||o.rd.add(i),i.Ji(!0),o.requestUpdate(),t.Lp&&(t.rC===void 0&&(t.rC=e),i.hl!==null&&i.hl(i,e))}t.hs.clear()}static uE(t,e){t.gy=e;let i,s=t.hs.copy();if(s==null)return;let n=s.iterator;for(;n.next();){let o=n.value,r=t.getAttribute("src")||"",a=o.oa.get(r);if(a===null)continue;let h=a.length,l=m.st();for(let u=0;u<h;u++)l.push(a[u]);if(t.Lp)for(let u=0;u<h;u++)i=l[u],i.gs!==null&&i.gs(i,e);m.Z(l)}t.hs.clear()}reloadSource(){if(this.source==="")return;Bt.clearCache(this.source);let t=this.source;this.source="",this.source=t}redraw(){this.C(),this.Ji(!0)}get sourceCrossOrigin(){return this.Bf}set sourceCrossOrigin(t){if(this.Bf!==t){t!==null&&m.S(t,Bt,"sourceCrossOrigin"),this.Bf=t;let e=this.element;if(e!==null){let i=e.getAttribute("src");e.crossOrigin!==void 0&&(t===null&&typeof i=="string"?e.crossOrigin=null:t!==null&&(e.crossOrigin=t(this)),i&&(e.src=i))}}}get sourceRect(){return this.al}set sourceRect(t){let e=this.al;e.equals(t)||(t=t.N(),this.al=t,this.f(),this.t("sourceRect",e,t))}get imageStretch(){return this.Ef}set imageStretch(t){let e=this.Ef;e!==t&&(this.Ef=t,this.C(),this.t("imageStretch",e,t))}get flip(){return this.fo}set flip(t){let e=this.fo;e!==t&&(this.fo=t,this.C(),this.t("flip",e,t))}get imageAlignment(){return this.Uf}set imageAlignment(t){let e=this.Uf;e.equals(t)||(t=t.N(),this.Uf=t,this.C(),this.t("imageAlignment",e,t))}get errorFunction(){return this.gs}set errorFunction(t){let e=this.gs;e!==t&&(t!==null&&m.S(t,Bt,"errorFunction"),this.gs=t,this.t("errorFunction",e,t))}get successFunction(){return this.hl}set successFunction(t){let e=this.hl;e!==t&&(t!==null&&m.S(t,Bt,"successFunction"),this.hl=t,this.t("successFunction",e,t))}Ma(t,e){let i=this.ll;if(i===null)return;let s=i.getAttribute("src"),n=Y.isUsingDOM();if(n&&i instanceof HTMLImageElement&&(s===null||s==="")||i.gy instanceof Event&&t instanceof ci)return;let o=t instanceof re,r=this.naturalBounds,a=0,h=0,l=this.zf,u=l?+i.width:i.naturalWidth,c=l?+i.height:i.naturalHeight;if(u===void 0&&i.videoWidth&&(u=i.videoWidth),c===void 0&&i.videoHeight&&(c=i.videoHeight),n){if(u===0||c===0)return}else u=this.width,c=this.height;let d=u,f=c;this.sourceRect.isReal()&&(a=this.al.x,h=this.al.y,u=this.al.width,c=this.al.height);let p=u,g=c,y=this.Ef,b=this.Uf;switch(y){case 0:if(this.sourceRect.isReal())break;p>=r.width&&(a=a+b.offsetX+(p*b.x-r.width*b.x)),g>=r.height&&(h=h+b.offsetY+(g*b.y-r.height*b.y)),u=Math.min(r.width,p),c=Math.min(r.height,g);break;case 2:p=r.width,g=r.height;break;case 6:case 7:let E=0;y===6?(E=Math.min(r.height/g,r.width/p),p*=E,g*=E):y===7&&(E=Math.max(r.height/g,r.width/p),p*=E,g*=E,p>=r.width&&(a=(a+b.offsetX+(p*b.x-r.width*b.x)/p)*u),g>=r.height&&(h=(h+b.offsetY+(g*b.y-r.height*b.y)/g)*c),u*=1/(p/r.width),c*=1/(g/r.height),p=r.width,g=r.height);break}let v=u*c,w=this.getDocumentScale()*e.scale,k=p*w,S=g*w,N=k*S,D=v/N,L=i.__goCache,M=null,A=Bt.gE;if(!o){if(i.Sn&&L!==void 0&&d<8e3&&f<8e3&&N>4&&D>A*A){L.Bt===null&&(L.vD(4,d,f,i),L.vD(16,d,f,i));let E=L.Bt,B=E.length;for(let X=0;X<B&&E[X].jd*E[X].jd<D;X++)M=E[X]}if(!e.od&&(this.Vf===null&&this.dE(),this.Vf))return}let F=p<r.width?b.offsetX+(r.width*b.x-p*b.x):0,O=g<r.height?b.offsetY+(r.height*b.y-g*b.y):0;switch(this.flip){case 0:break;case 2:t.translate(Math.min(r.width,p),0),t.scale(-1,1);break;case 1:t.translate(0,Math.min(r.height,g)),t.scale(1,-1);break;case 3:t.translate(Math.min(r.width,p),Math.min(r.height,g)),t.scale(-1,-1);break}if(t.commitTransform(),e.getRenderingHint("pictureRatioOptimization")&&!e.ph&&L!==void 0&&M!==null&&M.jd!==1){t.save();let E=M.jd;try{t.drawImage(M.en,a/E,h/E,Math.min(M.en.width,u/E),Math.min(M.en.height,c/E),F,O,Math.min(r.width,p),Math.min(r.height,g)),t instanceof re&&(this.O1=[a/E,h/E,Math.min(M.en.width,u/E),Math.min(M.en.height,c/E),F,O,Math.min(r.width,p),Math.min(r.height,g)])}catch{this.fy=!1}t.restore()}else try{t.drawImage(i,a,h,u,c,F,O,Math.min(r.width,p),Math.min(r.height,g)),t instanceof re&&(this.O1=[a,h,u,c,F,O,Math.min(r.width,p),Math.min(r.height,g)])}catch{this.fy=!1}switch(this.flip){case 0:break;case 2:t.scale(-1,1),t.translate(-Math.min(r.width,p),0);break;case 1:t.scale(1,-1),t.translate(0,-Math.min(r.height,g));break;case 3:t.scale(-1,-1),t.translate(-Math.min(r.width,p),-Math.min(r.height,g));break}}get naturalBounds(){return this.Ke}kd(t,e,i,s){let n=this.desiredSize,o=this.Zs(!0),r=this.ll,a=this.zf,h=0,l=0;(a||!this.Sn&&r&&r.complete)&&(this.Sn=!0),r===null?(isFinite(n.width)||(t=i),isFinite(n.height)||(e=s)):(h=a?+r.width:r.naturalWidth,l=a?+r.height:r.naturalHeight),!isFinite(n.width)&&o!==2&&o!==5?r!==null&&this.Sn!==!1&&(this.sourceRect.isReal()?t=this.sourceRect.width:t=h):(isFinite(t)||(this.sourceRect.isReal()?t=this.sourceRect.width:r!==null&&(t=h)),i=0),!isFinite(n.height)&&o!==2&&o!==4?r!==null&&this.Sn!==!1&&(this.sourceRect.isReal()?e=this.sourceRect.height:e=l):(isFinite(e)||(this.sourceRect.isReal()?e=this.sourceRect.height:r!==null&&(e=l)),s=0),isFinite(n.width)&&(t=n.width),isFinite(n.height)&&(e=n.height);let u=this.maxSize,c=this.minSize;i=Math.max(i||0,c.width),s=Math.max(s||0,c.height),t=Math.min(u.width,t),e=Math.min(u.height,e),t=Math.max(i,t),e=Math.max(s,e),r!==null&&!r.complete&&(isFinite(t)||(t=0),isFinite(e)||(e=0)),this.Ke.Yn(t,e),this.no(0,0,t,e)}Pa(t,e,i,s){this.commonArrange(t,e,i,s)}static uy=new yt;static sk=0;static gE=4}class Hn{Bt;constructor(){this.Bt=null}vD(t,e,i,s){this.Bt===null&&(this.Bt=[]);let n=new Fe(null),o=n._t,r=1/t;if(n.width=e/t,n.height=i/t,n.width===0||n.height===0)return;let a=new Wn(n.bt,t),h=s,l=1;if(this.Bt.length>0){let u=this.Bt[this.Bt.length-1];h=u.en,l=u.jd}o.setTransform(r*l,0,0,r*l,0,0),o.commitTransform(),o.drawImage(h,0,0),this.Bt.push(a)}}class Wn{en;jd;constructor(t,e){this.en=t,this.jd=e}}class Ce{Ne;fm;constructor(){this.fm=new wt,this.Ne=null}Ue(t){t!==null?(this.fm=t,t.figures.clear()):this.fm=new wt,this.Ne=null}Au(t,e,i,s,n,o){if(s!==void 0&&s===!0){let r=new mt(1);r.endX=t,r.endY=e,this.Ne.segments.add(r)}else this.Ne=new zt,this.Ne.startX=t,this.Ne.startY=e,this.Ne.isFilled=i,this.Ne.isEvenOdd=o||!1,this.fm.figures.add(this.Ne);n!==void 0&&(this.Ne.isShadowed=n)}_F(){let t=this.Ne.segments.length;t>0&&this.Ne.segments.elt(t-1).close()}tR(){this.Ne.segments.length>0&&(this.Ne.isFilled=!0)}eR(t){this.Ne.isShadowed=t}BU(t){this.Ne.isEvenOdd=t}$F(t,e,i){i===void 0&&(i=!1);let s=new mt(1);s.endX=t,s.endY=e,i&&s.close(),this.Ne.segments.add(s)}Ys(t,e,i){i===void 0&&(i=!1);let s=new mt(2);s.endX=t,s.endY=e,i&&s.close(),this.Ne.segments.add(s)}pr(t,e,i,s,n,o,r){r===void 0&&(r=!1);let a=new mt(3);a.point1X=t,a.point1Y=e,a.point2X=i,a.point2Y=s,a.endX=n,a.endY=o,r&&a.close(),this.Ne.segments.add(a)}Tu(t,e,i,s,n){n===void 0&&(n=!1);let o=new mt(4);o.point1X=t,o.point1Y=e,o.endX=i,o.endY=s,n&&o.close(),this.Ne.segments.add(o)}ZF(t,e,i,s,n,o,r){o===void 0&&(o=0),r===void 0&&(r=!1);let a=new mt(5);a.startAngle=t,a.sweepAngle=e,a.centerX=i,a.centerY=s,a.radiusX=n,o!==0?a.radiusY=o:a.radiusY=n,r&&a.close(),this.Ne.segments.add(a)}QF(t,e,i,s,n,o,r,a){a===void 0&&(a=!1);let h=new mt(6,o,r,t,e,i,s,n);a&&h.close(),this.Ne.segments.add(h)}static lC=null;static jL(t){let e=Ce.lC;if(e!==null)return Ce.lC=null,e.Ue(t),e;{let i=new Ce;return i.Ue(t),i}}static WL(t){Ce.lC=t}}{let x=function(n,o){let r=n.toLowerCase(),a=C.qn;a[n]=o,a[r]=n};x("Rectangle",(n,o,r)=>{let a="r"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(2),h.endX=o,h.endY=r,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h}),x("Square",(n,o,r)=>{let a="s"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(2),h.endX=o,h.endY=r,h.defaultStretch=6,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h});let t=(n,o,r,a,h)=>{(isNaN(a)||a<0)&&(a=5),isNaN(h)&&(h=15);let l="rr"+o+","+r+","+a+","+h,u=C.dr[l];if(u!==void 0)return u;let c=a;(h&1)===1?(c=Math.min(c,(h&2)===2?o/3:o),c=Math.min(c,(h&8)===8?r/3:r)):c=0;let d=new zt(c,0,!0);u=new wt().add(d);let f=T.TopLeft.copy(),p=T.BottomRight.copy();if((h&2)===2){let g=a;g=Math.min(g,(h&1)===1?o/3:o),g=Math.min(g,(h&4)===4?r/3:r);let y=g*C.Kn;d.add(new mt(2,o-g,0)).add(new mt(3,o,g,o-y,0,o,y)),f.offsetY=y,p.offsetX=-y}else d.add(new mt(2,o,0));if((h&4)===4){let g=a;g=Math.min(g,(h&8)===8?o/3:o),g=Math.min(g,(h&2)===2?r/3:r);let y=g*C.Kn;d.add(new mt(2,o,r-g)).add(new mt(3,o-g,r,o,r-y,o-y,r)),p.offsetX=-y,p.offsetY=-y}else d.add(new mt(2,o,r));if((h&8)===8){let g=a;g=Math.min(g,(h&4)===4?o/3:o),g=Math.min(g,(h&1)===1?r/3:r);let y=g*C.Kn;d.add(new mt(2,g,r)).add(new mt(3,0,r-g,y,r,0,r-y)),f.offsetX=y,p.offsetY=-y}else d.add(new mt(2,0,r));if((h&1)===1){let g=c*C.Kn;d.add(new mt(2,0,c)).add(new mt(3,c,0,0,g,g,0).close()),f.offsetX=g,f.offsetY=g}else d.add(new mt(2,0,0).close());return u.spot1=f,u.spot2=p,C.gr<C.lm&&(C.dr[l]=u,C.gr++),u};x("RoundedRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN,h=n?n.parameter2:NaN;return t(n,o,r,a,h)}),x("Border","RoundedRectangle"),x("RoundedTopRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,3)}),x("RoundedBottomRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,12)}),x("RoundedLeftRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,9)}),x("RoundedRightRectangle",(n,o,r)=>{let a=n?n.parameter1:NaN;return t(n,o,r,a,6)}),x("Ellipse",(n,o,r)=>{let a="e"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(3),h.endX=o,h.endY=r,h.spot1=T.AP,h.spot2=T.TP,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h}),x("Circle",(n,o,r)=>{let a="c"+o+","+r,h=C.dr[a];return h!==void 0||(h=new wt(3),h.endX=o,h.endY=r,h.spot1=T.AP,h.spot2=T.TP,h.defaultStretch=6,C.gr<C.lm&&(C.dr[a]=h,C.gr++)),h}),x("TriangleRight",(n,o,r)=>new wt().add(new zt(0,0).add(new mt(2,o,.5*r)).add(new mt(2,0,r).close())).setSpots(0,.25,.5,.75)),x("TriangleDown",(n,o,r)=>new wt().add(new zt(0,0).add(new mt(2,o,0)).add(new mt(2,.5*o,r).close())).setSpots(.25,0,.75,.5)),x("TriangleLeft",(n,o,r)=>new wt().add(new zt(o,r).add(new mt(2,0,.5*r)).add(new mt(2,o,0).close())).setSpots(.5,.25,1,.75)),x("TriangleUp",(n,o,r)=>new wt().add(new zt(o,r).add(new mt(2,0,r)).add(new mt(2,.5*o,0).close())).setSpots(.25,.5,.75,1)),x("Triangle","TriangleUp"),x("Diamond",(n,o,r)=>new wt().add(new zt(.5*o,0).add(new mt(2,0,.5*r)).add(new mt(2,.5*o,r)).add(new mt(2,o,.5*r).close())).setSpots(.25,.25,.75,.75)),x("LineH",(n,o,r)=>{let a=new wt(1);return a.startX=0,a.startY=r/2,a.endX=o,a.endY=r/2,a}),x("LineV",(n,o,r)=>{let a=new wt(1);return a.startX=o/2,a.startY=0,a.endX=o/2,a.endY=r,a}),x("None","Rectangle"),x("BarH","Rectangle"),x("BarV","Rectangle"),x("MinusLine","LineH"),x("PlusLine",(n,o,r)=>new wt().add(new zt(0,r/2,!1).add(new mt(2,o,r/2)).add(new mt(1,o/2,0)).add(new mt(2,o/2,r)))),x("XLine",(n,o,r)=>new wt().add(new zt(0,r,!1).add(new mt(2,o,0)).add(new mt(1,0,0)).add(new mt(2,o,r)))),x("LineRight",(n,o,r)=>new wt().add(new zt(.25*o,0,!1).add(new mt(2,.75*o,.5*r)).add(new mt(2,.25*o,r)))),x("LineDown",(n,o,r)=>new wt().add(new zt(0,.25*r,!1).add(new mt(2,.5*o,.75*r)).add(new mt(2,o,.25*r)))),x("LineLeft",(n,o,r)=>new wt().add(new zt(.75*o,0,!1).add(new mt(2,.25*o,.5*r)).add(new mt(2,.75*o,r)))),x("LineUp",(n,o,r)=>new wt().add(new zt(0,.75*r,!1).add(new mt(2,.5*o,.25*r)).add(new mt(2,o,.75*r)))),x("Capsule",(n,o,r)=>{let a=new wt;if(o<r){let h=o/2,l=new zt(0,h,!0);a.add(l),l.add(new mt(5,180,180,h,h,h,h)),l.add(new mt(2,o,r-h)),l.add(new mt(5,0,180,h,r-h,h,h)),l.add(new mt(2,0,h));let u=isFinite(n.parameter1)?n.parameter1:o*.156;return a.setSpots(0,0,1,1,0,u,0,-u),a}else if(o>r){let h=r/2,l=new zt(h,0,!0);a.add(l),l.add(new mt(2,o-h,0)),l.add(new mt(5,270,180,o-h,h,h,h)),l.add(new mt(2,h,r)),l.add(new mt(5,90,180,h,h,h,h));let u=isFinite(n.parameter1)?n.parameter1:r*.156;return a.setSpots(0,0,1,1,u,0,-u,0),a}else return a.type=3,a.endX=o,a.endY=r,a.spot1=T.AP,a.spot2=T.TP,a});let e=(n,o)=>new zt(n,o,!1,!1),i=(n,o,r)=>n.add(new mt(2,o,r)),s=(n,o,r)=>n.add(new mt(1,o,r));x("Borders",(n,o,r)=>{let a=n?n.parameter1:NaN;isNaN(a)?a=10:a=a&15;let h=new wt,l;return a===10?(l=e(o,0),i(l,o,r),s(l,0,r),i(l,0,0)):a===5?(l=e(0,0),i(l,o,0),s(l,o,r),i(l,0,r)):a===1?(l=e(0,0),i(l,o,0),s(l,o,r)):a===2?(l=e(o,0),i(l,o,r)):a===4?(l=e(o,r),i(l,0,r)):a===8?(l=e(0,r),i(l,0,0),s(l,o,r)):a===3?(l=e(0,0),i(l,o,0),i(l,o,r)):a===6?(l=e(o,0),i(l,o,r),i(l,0,r)):a===12?(l=e(o,r),i(l,0,r),i(l,0,0)):a===9?(l=e(0,r),i(l,0,0),i(l,o,0)):a===7?(l=e(0,0),i(l,o,0),i(l,o,r),i(l,0,r)):a===14?(l=e(o,0),i(l,o,r),i(l,0,r),i(l,0,0)):a===13?(l=e(o,r),i(l,0,r),i(l,0,0),i(l,o,0)):a===11?(l=e(0,r),i(l,0,0),i(l,o,0),i(l,o,r)):a===15?(l=e(0,0),i(l,o,0),i(l,o,r),i(l,0,r),l.add(new mt(2,0,0).close())):(l=e(0,0),s(l,o,r)),h.add(l),h})}C.rm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",BackwardOpenTriangleLine:"m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};var Gs=(x=>(x[x.None=0]="None",x[x.Added=1]="Added",x[x.Removed=2]="Removed",x[x.Shown=4]="Shown",x[x.Hidden=8]="Hidden",x[x.NodeSized=16]="NodeSized",x[x.GroupLayout=32]="GroupLayout",x[x.NodeReplaced=64]="NodeReplaced",x[x.Standard=127]="Standard",x[x.All=16777215]="All",x))(Gs||{});class pt extends G{b;$o;H;cl;fl;Zo;ue;ul;Da;sn;Qo;Wd;EM;FD;my;yy;constructor(t,e){let i;t===void 0||t instanceof Lt||typeof t=="string"?i=t:t&&(e=t),super(i),this.b=2408959,this.$o="",this.H=null,this.cl="",this.fl=null,this.Zo=null,this.ue="",this.ul=null,this.Da=null,this.sn=new P(NaN,NaN).k(),this.Qo=null,this.Wd=NaN,this.EM=-1,this.FD=new I,this.my=null,this.yy=NaN,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.b=this.b&-4097|16384|32768,t.$o=this.$o,this.H!==null&&(this.H.me?t.H=this.H:t.H=this.H.copy()),t.cl=this.cl,t.Zo=null,t.ue=this.ue,t.sn.h(this.sn),t.Wd=this.Wd}Yo(t){super.Yo(t),t.Sa(),t.fl=null,t.Qo=null,t.my=null}toString(){let t=m.Gn(this.constructor)+"#"+V.xs(this);return this.data!==null&&(t+="("+m.toString(this.data)+")"),t}static LayoutNone=0;static LayoutAdded=1;static LayoutRemoved=2;static LayoutShown=4;static LayoutHidden=8;static LayoutNodeSized=16;static LayoutGroupLayout=32;static LayoutNodeReplaced=64;static LayoutStandard=127;static LayoutAll=16777215;_e(){return this.H===null?this.H=new Gi:this.H.me&&(this.H=this.H.copy()),this.H}ba(){super.ba(),this.H!==null&&(this.H.me=!0)}gf(t,e,i,s,n,o,r){let a=this.diagram;a!==null&&(t===3&&e==="elements"?n instanceof G?n.Pn(h=>{a.partManager.M2(h,a)}):n instanceof Bt&&a.v2(n):t===4&&e==="elements"&&(n instanceof G?n.Pn(h=>a.partManager.N2(h,a)):n instanceof Bt&&a.F2(n)),a.raiseChangedEvent(t,e,i,s,n,o,r))}updateTargetBindings(t){if(super.updateTargetBindings(t),this.data===null)return;let e=this.D.r,i=e.length;for(let n=0;n<i;n++){let o=e[n];o instanceof G&&o.Pn(r=>{r.data!==null&&r.WI(t)})}let s=this.adornments;for(;s.next();)s.value.updateTargetBindings(t)}zo(){if(super.zo(),this.FN()){let e=this.D.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n instanceof G&&n.Pn(o=>o.zo())}}let t=this.adornments;for(;t.next();)t.value.zo()}updateRelationshipsFromData(){this.data!==null&&this.diagram?.partManager.updateRelationshipsFromData(this)}get key(){let t=this.diagram;if(t!==null)return t.model.getKeyForNodeData(this.data)}get adornments(){return this.Zo===null?kt.instance:this.Zo.iteratorValues}findAdornment(t){let e=this.Zo;return e===null?null:e.get(t)}addAdornment(t,e){if(e===null)return;let i=null,s=this.Zo;if(s!==null&&(i=s.get(t)),i!==e){if(i!==null){let o=i.diagram;o!==null&&o.remove(i)}s===null&&(s=new Mt,this.Zo=s),e.$o!==t&&(e.category=t),s.set(t,e);let n=this.diagram;if(n!==null){n.add(e);let o=e.adornedObject;if(o!==null){let r=o.findBindingPanel();r!==null&&(e.data=r.data)}}}}removeAdornment(t){let e=this.Zo;if(e===null)return;let i=e.get(t);if(i!==null){let s=i.diagram;s!==null&&(s.remove(i),i.data=null)}e.delete(t),e.count===0&&(this.Zo=null)}clearAdornments(){let t=this.Zo;if(t===null)return;let e=m.st(),i=t.iterator;for(;i.next();){let n=i.key;e.push(n)}let s=e.length;for(let n=0;n<s;n++)this.removeAdornment(e[n]);m.Z(e)}updateAdornments(){let t=this.diagram;if(t===null)return;this.mE(t),this.pE(t);let e=this.adornments;for(;e.next();){let i=e.value;i.f(),i.hasPlaceholder()&&i.placeholder.f()}for(e=this.adornments;e.next();)e.value.updateTargetBindings()}invalidateAdornments(){let t=this.diagram;t!==null&&(t.ha(),this.RD()!==!0&&this.OD(!0))}UM(){this.RD()!==!1&&(this.updateAdornments(),this.OD(!1))}mE(t){let e="Selection";if(this.isSelected&&this.selectionAdorned){let i=this.selectionObject;if(i!==null&&this.actualBounds.isReal()&&this.isVisible()&&i.isVisibleObject()&&i.actualBounds.isReal()){let s=this.findAdornment(e);if(s===null){let n=this.selectionAdornmentTemplate;n===null&&(this.Nr()?n=t.linkSelectionAdornmentTemplate:this instanceof ht?n=t.groupSelectionAdornmentTemplate:n=t.nodeSelectionAdornmentTemplate),s=n.copy(),s!==null&&(this.Nr()&&this.selectionObject===this.path&&(s.type=G.Link),s.adornedObject=i)}if(s!==null){s.type===G.Link&&s.f(),this.addAdornment(e,s);return}}}this.removeAdornment(e)}pE(t){let e=this;t.toolManager.mouseDownTools.each(i=>{i.isEnabled&&i.updateAdornments(e)}),t.toolManager.updateAdornments(e)}OM(t){this.ul=t,t===null&&this.uI()}get layer(){return this.ul}get diagram(){let t=this.ul;return t==null?null:t.diagram}get layerName(){return this.cl}set layerName(t){let e=this.cl;if(e===t)return;let i=this.diagram;if(i!==null&&(i.findLayer(t)===null||i.partManager.addsToTemporaryLayer))return;this.cl=t,i!==null&&i.invalidateDocumentBounds(),this.t("layerName",e,t);let s=this.layer;if(s===null||s.name===t||(i=s.diagram,i===null))return;let n=i.findLayer(t);if(n===null||n===s)return;let o=s.ri(-1,this,!0);o>=0&&i.raiseChangedEvent(4,"parts",s,this,null,o,!0),o=n.ch(99999999,this,!0),s.visible!==n.visible&&this.Xe(n.visible),o>=0&&i.raiseChangedEvent(3,"parts",n,null,this,!0,o);let r=this.layerChanged;if(r===null)return;let a=i.G;i.G=!0,r(this,s,n),i.G=a}get layerChanged(){return this.H!==null?this.H.wy:null}set layerChanged(t){let e=this.layerChanged;e!==t&&(t!==null&&m.S(t,pt,"layerChanged"),this._e().wy=t,this.t("layerChanged",e,t))}get zOrder(){return this.Wd}set zOrder(t){let e=this.Wd;if(e===t)return;this.Wd=t;let i=this.layer;i!==null&&i.nb(-1,this),this.t("zOrder",e,t);let s=this.diagram;s!==null&&s.C()}yE(){let t=this.layer;t!==null&&t.nb(-1,this)}rk(){if(this.fa()!==!1)return;this.aC(!0),this.yf();let t=this.diagram;t!==null&&(t.Sp(this),t.requestUpdate())}ID(){if(this.b|=2097152,this.fa()===!1)return;let t=this.position,e=this.location;(!e.isReal()||!t.isReal())&&this.ED(t,e);let i=this.De,s=I.l().h(i);i.ce(),i.x=t.x,i.y=t.y,i.k(),this.Pd(s,i),I.i(s),this.aC(!1),this.yf()}no(t,e,i,s){let n=this.hi;n.e(t,e,i,s),this.Se===null&&(this.Se=new Nt);let o=this.Se;o.Ue(),this.Xp(o,t,e,i,s),this.Se=o,o.DP()||o.im(n)}Xp(t,e,i,s,n){if(this.et!==1&&t.et(this.et),this.Xt===0)return;let o=T.Center;this.locationSpot.isSpot()&&(o=this.locationSpot);let r=P.l();if(this.locationObject!==this){let a=this.locationObject,h=a.naturalBounds;r.setSpot(h.x,h.y,h.width,h.height,o),a.Se!==null&&a.Se.gt(r),r.offset(-a.measuredBounds.x,-a.measuredBounds.y);let l=a.panel;for(;l!==null&&l!==this;)l.Se!==null&&l.Se.gt(r),r.offset(-l.measuredBounds.x,-l.measuredBounds.y),l=l.panel}else r.setSpot(e,i,s,n,o);t.ks(this.Xt,r.x,r.y),P.i(r)}get locationObject(){if(this.Qo===null)if(this instanceof vt&&this.type!==G.Link&&this.hasPlaceholder())this.Qo=this.placeholder;else{let t=this.locationObjectName;if(t!==""){let e=this.findObject(t);e!==null?this.Qo=e:this.Qo=this}else this.Qo=this}return this.Qo?.visible?this.Qo:this}get minLocation(){return this.H!==null?this.H.xy:P.DL}set minLocation(t){let e=this.minLocation;e.equals(t)||(t=t.N(),this._e().xy=t,this.t("minLocation",e,t))}get maxLocation(){return this.H!==null?this.H.ky:P.vL}set maxLocation(t){let e=this.maxLocation;e.equals(t)||(t=t.N(),this._e().ky=t,this.t("maxLocation",e,t))}get locationObjectName(){return this.H!==null?this.H.Py:""}set locationObjectName(t){let e=this.locationObjectName;e!==t&&(this._e().Py=t,this.Qo=null,this.f(),this.t("locationObjectName",e,t))}get locationSpot(){return this.H!==null?this.H.Sy:T.TopLeft}set locationSpot(t){let e=this.locationSpot;e.equals(t)||(t=t.N(),this._e().Sy=t,this.f(),this.t("locationSpot",e,t))}move(t,e){e===!0?this.location=t:this.position=t}moveTo(t,e,i){let s=P.z(t,e);this.move(s,i),P.i(s)}isVisible(){if(!this.visible)return!1;let t=this.layer;if(t!==null){if(!t.visible)return!1;let i=t.diagram;if(i!==null&&i.animationManager.qx(this))return!0}let e=this.containingGroup;return!(e!==null&&(!e.isSubGraphExpanded||!e.isVisible()))}Xe(t){let e=this.diagram;t?(this.invalidateLayout(4),this.invalidateAdornments(),e!==null&&e.Sp(this)):(this.invalidateLayout(8),this.clearAdornments()),this.Sa(),e!==null&&(e.invalidateDocumentBounds(),this instanceof $&&this.canAvoid()&&e.ud(this),e.C())}findObject(t){if(this.name===t)return this;let e=this.my;if(e===null&&(this.my=e=new Mt),e.get(t)!==null)return e.get(t);let i=super.findObject(t);return i!==null?(e.set(t,i),i):(e.set(t,null),null)}t0(){this.my=null}getRelativePoint(t,e,i){i===void 0&&(i=new P);let s=e.isNoSpot()?T.Center:e,n=t.naturalBounds;if(i.e(n.width*s.x+s.offsetX,n.height*s.y+s.offsetY),t===null||t===this)return i;t.v.gt(i);let o=t.panel;for(;o!==null&&o!==this;)o.v.gt(i),o=o.panel;return this.Se!==null&&this.Se.gt(i),i.offset(-this.hi.x,-this.hi.y),i}getDocumentBounds(t){return t===void 0&&(t=new I),t.h(this.actualBounds)}ensureBounds(){this.ht(1/0,1/0),this.Ut()}cD(t){let e=this.locationSpot,i=this.locationObject,s=i.naturalBounds;s.isReal()||(s=I.tm);let n=i instanceof et?i.strokeWidth:0;if(t.setSpot(0,0,s.width+n,s.height+n,e),i!==this){t.offset(-n/2,-n/2),i.v.gt(t);let o=i.panel;for(;o!==null&&o!==this;)o.v.gt(t),o=o.panel}return this.Se!==null&&this.Se.gt(t),t.offset(-this.hi.x,-this.hi.y),t}hh(t,e){let i=e===void 0?this.FD:e,s=this.wE(),n=s*2;if(!this.isShadowed)return i.e(t.x-1-s,t.y-1-s,t.width+2+n,t.height+2+n),i;let o=t.x,r=t.y,a=t.width,h=t.height,l=this.shadowBlur,u=this.shadowOffset;return a+=l,h+=l,o-=l/2,r-=l/2,u.x>0?a+=u.x:(o+=u.x,a-=u.x),u.y>0?h+=u.y:(r+=u.y,h-=u.y),i.e(o-1,r-1,a+2,h+2),i}tE(){return this.type===G.Link&&this instanceof vt&&this.category==="Selection"&&this.adornedObject instanceof et&&this.adornedPart.findMainElement()===this.adornedObject?this.adornedObject.strokeWidth:0}wE(){return isNaN(this.yy)&&(this.yy=this.yD()),this.yy}Df(){this.yy=NaN}Ut(){if(this.as()===!1){this.ID();return}this.oo(!1);let t=this.De,e=I.l();e.h(t);let i=this.Ul();this.Pa(0,0,this.hi.width,this.hi.height);let s=this.position;this.ED(s,this.location),t.ce(),t.x=s.x,t.y=s.y,t.k(),this.Pd(e,t),e.equals(t)?this.rs(i):this.Di()&&(!C.c(e.width,t.width)||!C.c(e.height,t.height))&&this.EM>=0&&this.invalidateLayout(16),I.i(e),this.aC(!1)}Pd(t,e){let i=this.diagram;if(i===null)return;let s=!1;if(i.mh===!1&&t.isReal()){let n=I.l();n.h(i.documentBounds),n.subtractMargin(i.padding),t.x>n.x&&t.y>n.y&&t.right<n.right&&t.bottom<n.bottom&&e.x>n.x&&e.y>n.y&&e.right<n.right&&e.bottom<n.bottom&&(s=!0),I.i(n)}(this.xE()===!0||!t.equals(e))&&this.dT(s,i),i.C(),!(!t.isReal()&&!e.isReal()||t.equalsApproxClose(e))&&(this instanceof $&&!i.undoManager.isUndoingRedoing&&this.invalidateConnectedLinks(),this.Sa())}get location(){return this.sn}set location(t){let e=t.x,i=t.y,s=this.sn;(s.x!==e&&(!isNaN(s.x)||!isNaN(e))||s.y!==i&&(!isNaN(s.y)||!isNaN(i)))&&(t=t.copy(),this.bE(t,s)&&this.t("location",s,t.copy()))}bE(t,e){if(this.Nr())return!1;if(this.sn=t,this.b|=2097152,this.as()===!1){this.rk();let i=this.ct;if(i.isReal()){let s=this.diagram;if(s===null||s.animationManager.isTicking||!s.undoManager.isUndoingRedoing){let n=i.copy();i.e(i.x+(t.x-e.x),i.y+(t.y-e.y)),this.UD(s,i,n.x,n.y),this.t("position",n,i.copy())}}}return!0}TN(t,e,i){if(this.Nr()||!t.isReal())return!1;let s=this.diagram;if(s!==null&&this.UD(s,t,e,i),this.ct=t,this.b&=-2097153,this.sn.isReal()&&(s===null||s.animationManager.isTicking||!s.undoManager.isUndoingRedoing)){let n=this.sn;this.sn=new P(n.x+(t.x-e),n.y+(t.y-i)).k(),this.t("location",n,this.sn.copy())}return this.fa()===!1&&this.as()===!1&&(this.rk(),this.ID()),!0}UD(t,e,i,s){if(t===null||this instanceof vt)return;let n=t.animationManager;n.ke&&n.vA(this,new P(i,s),e,!1)}Vc(t,e,i){let s=this.sn,n=this.ct;if(i){if(s.x===t&&s.y===e)return;this.fa()||this.as()?n.e(NaN,NaN):n.e(n.x+t-s.x,n.y+e-s.y),s.e(t,e)}else{if(n.x===t&&n.y===e)return;s.e(s.x+t-n.x,s.y+e-n.y),n.e(t,e)}this.rk()}DN(){this.b&=-2097153,this.rk()}ED(t,e){let i=this.cD(P.l()),s=this.diagram,n=e.isReal(),o=t.isReal();n&&o?(this.b&2097152)!==0?this.VD(t,e,s,i):this.BD(t,e,s,i):n?this.VD(t,e,s,i):o&&this.BD(t,e,s,i),this.b|=2097152,P.i(i),this.yf()}VD(t,e,i,s){let n=t.x,o=t.y;if(t.e(e.x-s.x,e.y-s.y),i!==null){let r=i.animationManager,a=r.defaultAnimation.isAnimating;!a&&r.ke&&!(this instanceof vt)&&r.vA(this,new P(n,o),t,!1),!a&&!(t.x===n&&t.y===o)&&this.t("position",new P(n,o),t.copy())}}BD(t,e,i,s){let n=e.copy();e.e(t.x+s.x,t.y+s.y),!e.equals(n)&&i!==null&&this.t("location",n,e.copy())}dT(t,e){this.MN(!1),this instanceof $&&e.ud(this),!this.layer.isTemporary&&!t&&e.invalidateDocumentBounds();let i=this.De,s=e.viewportBounds;s.isReal()?this.Ul()?(i.UL(s,10)||this.rs(!1),this.updateAdornments()):this.isVisible()&&i.intersectsRect(s)?(this.rs(!0),this.updateAdornments()):this.invalidateAdornments():e.ef=!0}$r(){return!0}Di(){return!0}Nr(){return!1}Qs(){return!0}hasPlaceholder(){return!1}get category(){return this.$o}set category(t){let e=this.$o;if(e===t)return;this.svg!==null&&(this.svg.remove(),this.Ji(!0));let i=this.diagram,s=this.data,n=null;if(i!==null&&s!==null&&!(this instanceof vt)){let o=i.model.undoManager;o.isEnabled&&!o.isUndoingRedoing&&(n=this.clone(),n.D.addAll(this.D))}if(this.$o=t,this.t("category",e,t),i!==null&&s!==null&&!(this instanceof vt)){let o=i.model;if(o.undoManager.isUndoingRedoing)return;if(this.Nr()){i.partManager.setLinkCategoryForData(s,t);let r=i.partManager.findLinkTemplateForCategory(t);if(r!==null){r.It();let a=r.copy();a!==null&&this.hC(a,e,t)}}else{o!==null&&o.setCategoryForNodeData(s,t);let r=i.partManager.findTemplateForNodeData(s,t);if(r!==null){r.It();let a=r.copy();if(a!==null&&!(a instanceof j)){let h=this.location.copy();this.hC(a,e,t),this.location.isReal()||(this.location=h)}}}if(n!==null){let r=this.clone();r.D.addAll(this.D),this.t("self",n,r)}}else if(this instanceof vt){let o=this.adornedPart;if(o!==null){let r=o.Zo;r!==null&&r.delete(e),o.addAdornment(this.category,this)}}}get self(){return this}set self(t){this.hC(t,this.category,t.category)}static zD=!1;hC(t,e,i){t.constructor!==this.constructor&&(pt.zD||(pt.zD=!0,m.ne('Should not change the class of the Part when changing category from "'+e+'" to "'+i+'"'),m.ne(" Old class: "+m.Gn(this.constructor)+", new class: "+m.Gn(t.constructor)+", part: "+this.toString()))),this.clearAdornments();let s=this.data,n=this.layerName,o=this.isSelected,r=this.isHighlighted,a=!0,h=!0,l=!1;this instanceof $&&(a=this.isTreeLeaf,h=this.isTreeExpanded,l=this.wasTreeExpanded),t.Yo(this),t.cloneProtected(this),this.$o=i,this.svg!==null&&(this.svg.remove(),this.Jc(),this.Ji(!0)),this.f(),this.C();let u=this.diagram,c=!0;u!==null&&(c=u.skipsUndoManager,u.skipsUndoManager=!0),this.te=s,this.b=o?this.b|4096:this.b&-4097,this.b=r?this.b|524288:this.b&-524289,this instanceof $&&(this.E=a?this.E|4:this.E&-5,this.E=h?this.E|1:this.E&-2,this.E=l?this.E|2:this.E&-3),s!==null&&this.updateTargetBindings();let d=this.layerName;d!==n&&(this.cl=n,this.layerName=d),u!==null&&(u.skipsUndoManager=c),this.Di()&&this.invalidateLayout(64)}canCopy(){if(!this.copyable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowCopy)return!1;let e=t.diagram;return e===null?!0:!!e.allowCopy}canDelete(){if(!this.deletable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowDelete)return!1;let e=t.diagram;return e===null?!0:!!e.allowDelete}canEdit(){if(!this.textEditable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowTextEdit)return!1;let e=t.diagram;return e===null?!0:!!e.allowTextEdit}canGroup(){if(!this.groupable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowGroup)return!1;let e=t.diagram;return e===null?!0:!!e.allowGroup}canMove(){if(!this.movable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowMove)return!1;let e=t.diagram;return e===null?!0:!!e.allowMove}canReshape(){if(!this.reshapable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowReshape)return!1;let e=t.diagram;return e===null?!0:!!e.allowReshape}canResize(){if(!this.resizable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowResize)return!1;let e=t.diagram;return e===null?!0:!!e.allowResize}canRotate(){if(!this.rotatable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRotate)return!1;let e=t.diagram;return e===null?!0:!!e.allowRotate}canSelect(){if(!this.selectable)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowSelect)return!1;let e=t.diagram;return e===null?!0:!!e.allowSelect}get copyable(){return(this.b&1)!==0}set copyable(t){let e=(this.b&1)!==0;e!==t&&(this.b=this.b^1,this.t("copyable",e,t))}get deletable(){return(this.b&2)!==0}set deletable(t){let e=(this.b&2)!==0;e!==t&&(this.b=this.b^2,this.t("deletable",e,t))}get textEditable(){return(this.b&4)!==0}set textEditable(t){let e=(this.b&4)!==0;e!==t&&(this.b=this.b^4,this.t("textEditable",e,t),this.invalidateAdornments())}get groupable(){return(this.b&8)!==0}set groupable(t){let e=(this.b&8)!==0;e!==t&&(this.b=this.b^8,this.t("groupable",e,t))}get movable(){return(this.b&16)!==0}set movable(t){let e=(this.b&16)!==0;e!==t&&(this.b=this.b^16,this.t("movable",e,t))}get selectionAdorned(){return(this.b&32)!==0}set selectionAdorned(t){let e=(this.b&32)!==0;e!==t&&(this.b=this.b^32,this.t("selectionAdorned",e,t),this.invalidateAdornments())}get isInDocumentBounds(){return(this.b&64)!==0}set isInDocumentBounds(t){let e=(this.b&64)!==0;if(e!==t){this.b=this.b^64;let i=this.diagram;i!==null&&i.invalidateDocumentBounds(),this.t("isInDocumentBounds",e,t)}}get isLayoutPositioned(){return(this.b&128)!==0}set isLayoutPositioned(t){let e=(this.b&128)!==0;e!==t&&(this.b=this.b^128,this.t("isLayoutPositioned",e,t),this.invalidateLayout(t?4:8))}get selectable(){return(this.b&256)!==0}set selectable(t){let e=(this.b&256)!==0;e!==t&&(this.b=this.b^256,this.t("selectable",e,t),this.invalidateAdornments())}get reshapable(){return(this.b&512)!==0}set reshapable(t){let e=(this.b&512)!==0;e!==t&&(this.b=this.b^512,this.t("reshapable",e,t),this.invalidateAdornments())}get resizable(){return(this.b&1024)!==0}set resizable(t){let e=(this.b&1024)!==0;e!==t&&(this.b=this.b^1024,this.t("resizable",e,t),this.invalidateAdornments())}get rotatable(){return(this.b&2048)!==0}set rotatable(t){let e=(this.b&2048)!==0;e!==t&&(this.b=this.b^2048,this.t("rotatable",e,t),this.invalidateAdornments())}get isSelected(){return(this.b&4096)!==0}set isSelected(t){let e=(this.b&4096)!==0;if(e!==t){let i=this.diagram;if(t){if(!this.canSelect())return;if(i!==null){let o=i.maxSelectionCount;if(i.selection.count>=o)return}}this.b=this.b^4096;let s=!1;if(i!==null){s=i.skipsUndoManager,i.skipsUndoManager=!0;let o=i.selection;o.ce(),t?o.add(this):o.delete(this),o.k()}this.t("isSelected",e,t),this.invalidateAdornments();let n=this.selectionChanged;n!==null&&n(this),i!==null&&(i.requestUpdate(),i.skipsUndoManager=s)}}get isHighlighted(){return(this.b&524288)!==0}set isHighlighted(t){let e=(this.b&524288)!==0;if(e!==t){this.b=this.b^524288;let i=this.diagram;if(i!==null){let n=i.highlighteds;n.ce(),t?n.add(this):n.delete(this),n.k()}this.t("isHighlighted",e,t),this.C();let s=this.highlightedChanged;s!==null&&s(this)}}get isShadowed(){return(this.b&8192)!==0}set isShadowed(t){let e=(this.b&8192)!==0;e!==t&&(this.b=this.b^8192,this.Ji(!0),this.t("isShadowed",e,t),this.C())}RD(){return(this.b&16384)!==0}OD(t){t?this.b|=16384:this.b&=-16385}fa(){return(this.b&32768)!==0}aC(t){t?this.b|=32768:this.b&=-32769}xE(){return(this.b&65536)!==0}MN(t){t?this.b|=65536:this.b&=-65537}Ul(){return(this.b&131072)!==0}rs(t){t?this.b|=131072:this.b&=-131073}XD(){return(this.b&1048576)!==0}lk(t){t?this.b|=1048576:this.b&=-1048577}get isAnimated(){return(this.b&262144)!==0}set isAnimated(t){let e=(this.b&262144)!==0;e!==t&&(this.b=this.b^262144,this.t("isAnimated",e,t))}get highlightedChanged(){return this.H!==null?this.H.My:null}set highlightedChanged(t){let e=this.highlightedChanged;e!==t&&(t!==null&&m.S(t,pt,"highlightedChanged"),this._e().My=t,this.t("highlightedChanged",e,t))}get selectionObjectName(){return this.H!==null?this.H.Ny:""}set selectionObjectName(t){let e=this.selectionObjectName;e!==t&&(this._e().Ny=t,this.fl=null,this.t("selectionObjectName",e,t))}get selectionAdornmentTemplate(){return this.H!==null?this.H.Cy:null}set selectionAdornmentTemplate(t){let e=this.selectionAdornmentTemplate;e!==t&&(t!==null&&t.It(),this._e().Cy=t,this.t("selectionAdornmentTemplate",e,t))}get selectionObject(){if(this.fl===null){let t=this.selectionObjectName;if(t!==null&&t!==""){let e=this.findObject(t);e!==null?this.fl=e:this.fl=this}else if(this instanceof j){let e=this.path;e!==null?this.fl=e:this.fl=this}else this.fl=this}return this.fl}get selectionChanged(){return this.H!==null?this.H.Ly:null}set selectionChanged(t){let e=this.selectionChanged;e!==t&&(t!==null&&m.S(t,pt,"selectionChanged"),this._e().Ly=t,this.t("selectionChanged",e,t))}get resizeAdornmentTemplate(){return this.H!==null?this.H.Ay:null}set resizeAdornmentTemplate(t){let e=this.resizeAdornmentTemplate;e!==t&&(this._e().Ay=t!==null?t.It():null,this.t("resizeAdornmentTemplate",e,t))}get resizeObjectName(){return this.H!==null?this.H.Ty:""}set resizeObjectName(t){let e=this.resizeObjectName;e!==t&&(this._e().Ty=t,this.t("resizeObjectName",e,t))}get resizeObject(){let t=this.resizeObjectName;if(t!==""){let e=this.findObject(t);if(e!==null)return e}return this}get resizeCellSize(){return this.H!==null?this.H.Dy:st.Ww}set resizeCellSize(t){let e=this.resizeCellSize;e.equals(t)||(t=t.N(),this._e().Dy=t,this.t("resizeCellSize",e,t))}get rotateAdornmentTemplate(){return this.H!==null?this.H.vy:null}set rotateAdornmentTemplate(t){let e=this.rotateAdornmentTemplate;e!==t&&(this._e().vy=t!==null?t.It():null,this.t("rotateAdornmentTemplate",e,t))}get rotateObjectName(){return this.H!==null?this.H.Fy:""}set rotateObjectName(t){let e=this.rotateObjectName;e!==t&&(this._e().Fy=t,this.t("rotateObjectName",e,t))}get rotateObject(){let t=this.rotateObjectName;if(t!==""){let e=this.findObject(t);if(e!==null)return e}return this}get rotationSpot(){return this.H!==null?this.H.Ry:T.Default}set rotationSpot(t){let e=this.rotationSpot;e.equals(t)||(t=t.N(),this._e().Ry=t,this.t("rotationSpot",e,t))}get text(){return this.ue}set text(t){let e=this.ue;e!==t&&(this.ue=t,this.t("text",e,t))}get containingGroup(){return this.Da}set containingGroup(t){if(this.Di()){let e=this.Da;if(e!==t){t!==null&&(this===t||t.isMemberOf(this))&&(this===t&&m.o("Cannot make a Group a member of itself: "+this.toString()),m.o("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+t.toString())),this.invalidateLayout(2);let i=this.diagram;if(e!==null?e.cC(this):this instanceof ht&&i!==null&&i.Wr.delete(this),this.Da=t,t!==null?t.fC(this):this instanceof ht&&i!==null&&i.Wr.add(this),this.invalidateLayout(1),i!==null&&i.G){let n=this.data,o=i.model;if(n!==null&&o.Th()){let r=t!==null?t.data:null;o.setGroupForData(n,o.getKeyForNodeData(r))}}let s=this.containingGroupChanged;if(s!==null){let n=!0;i!==null&&(n=i.G,i.G=!0),s(this,e,t),i!==null&&(i.G=n)}if(this instanceof ht){let n=new V;pt.ga(n,this,!0,0,!0);let o=n.iterator;for(;o.next();){let r=o.value;if(r instanceof $){let a=r.linksConnected;for(;a.next();)a.value.Jd()}}}if(this instanceof $){let n=this.linksConnected;for(;n.next();)n.value.Jd();let o=this.labeledLink;o!==null&&o.Jd()}this.t("containingGroup",e,t),t!==null&&t.yE()}}else m.o("cannot set the Part.containingGroup of a Link or Adornment")}Sa(){let t=this.containingGroup;t!==null&&(t.hasPlaceholder()&&t.placeholder.f(),t.f(),t.invalidateConnectedLinks())}C(){let t=this.diagram;t!==null&&!this.as()&&!this.fa()&&this.isVisible()&&this.De.isReal()&&t.C(this.hh(this.De))}f(){if(this.Bo())return;super.f();let t=this.diagram;t!==null&&(t.Sp(this),this instanceof $&&this.labeledLink!==null&&this.labeledLink.Pf(),t.requestUpdate(!0))}Pf(t){if(this.as())return;let e=this.diagram;e!==null&&(e.Sp(this),this instanceof $&&this.invalidateConnectedLinks(),e.requestUpdate()),this.oo(!0)}Zm(t){if(!t){let e=this.Da;e!==null&&e.fC(this)}}Qm(t){if(!t){let e=this.Da;e!==null&&e.cC(this)}}af(){let t=this.data;if(t!==null){let e=this.diagram;if(e!==null){let i=e.model;i!==null&&i.removeNodeData(t)}}}get containingGroupChanged(){return this.H!==null?this.H.Oy:null}set containingGroupChanged(t){let e=this.containingGroupChanged;e!==t&&(t!==null&&m.S(t,pt,"containingGroupChanged"),this._e().Oy=t,this.t("containingGroupChanged",e,t))}findSubGraphLevel(){return this.uC(this)}uC(t){let e=t.containingGroup;if(e!==null)return 1+this.uC(e);if(t instanceof $){let i=t.labeledLink;if(i!==null)return this.uC(i)}return 0}findTopLevelPart(){return this.dC(this)}dC(t){let e=t.containingGroup;if(e!==null)return this.dC(e);if(t instanceof $){let i=t.labeledLink;if(i!==null)return this.dC(i)}return t}get isTopLevel(){return!(this.containingGroup!==null||this instanceof $&&this.labeledLink!==null)}isMemberOf(t){return t instanceof ht?this.gC(this,t):!1}gC(t,e){if(t===e||e===null)return!1;let i=t.containingGroup;if(i!==null&&(i===e||this.gC(i,e)))return!0;if(t instanceof $){let s=t.labeledLink;if(s!==null)return this.gC(s,e)}return!1}findCommonContainingGroup(t){if(t===null)return null;if(this===t)return this.containingGroup;let e=this;for(;e!==null;){if(e instanceof ht&&e.lk(!0),e instanceof $){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}let i=null;for(e=t;e!==null;){if(e.XD()){i=e;break}if(e instanceof $){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}for(e=this;e!==null;){if(e instanceof ht&&e.lk(!1),e instanceof $){let s=e.labeledLink;s!==null&&(e=s)}e=e.containingGroup}return i}get layoutConditions(){return this.H!==null?this.H.Iy:127}set layoutConditions(t){let e=this.layoutConditions;e!==t&&(this._e().Iy=t,this.t("layoutConditions",e,t))}canLayout(){if(!this.isLayoutPositioned||!this.isVisible())return!1;let t=this.layer;return!(t!==null&&t.isTemporary||this instanceof $&&this.isLinkLabel)}kE(t){if(!this.isLayoutPositioned||(t&this.layoutConditions)===0)return!1;let e=this.layer;if(e!==null&&e.isTemporary||this instanceof $&&this.isLinkLabel)return!1;let i=this.diagram;return!(i!==null&&i.undoManager.isUndoingRedoing)}invalidateLayout(t){if(t===void 0&&(t=16777215),!this.kE(t))return;let e=this.Da;if(e!==null){let i=e.layout;i!==null?i.p():e.invalidateLayout(t)}else{let i=this.diagram;if(i!==null){let s=i.layout;s!==null&&s.p()}}}gT(){if(!this.isVisible())return!1;let t=this.layer;return!(t!==null&&t.isTemporary)}static ga(t,e,i,s,n,o){if(o===void 0&&(o=null),!t.has(e)&&!(o!==null&&!o(e))&&!(e instanceof vt)){if(t.add(e),e instanceof $){if(i&&e instanceof ht){let r=e.memberParts;for(;r.next();){let a=r.value;pt.ga(t,a,i,s,n,o)}}if(n!==!1){let r=e.linksConnected;for(;r.next();){let a=r.value;if(t.has(a))continue;let h=a.fromNode,l=a.toNode,u=h===null||t.has(h),c=l===null||t.has(l);(n?u&&c:u||c)&&pt.ga(t,a,i,s,n,o)}}if(s>1){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;pt.ga(t,a,i,s-1,n,o)}}}else if(e instanceof j){let r=e.labelNodes;for(;r.next();){let a=r.value;pt.ga(t,a,i,s,n,o)}}}}get dragComputation(){return this.H!==null?this.H.Ey:null}set dragComputation(t){let e=this.dragComputation;e!==t&&(t!==null&&m.S(t,pt,"dragComputation"),this._e().Ey=t,this.t("dragComputation",e,t))}get shadowOffset(){return this.H!==null?this.H.Uy:P.FL}set shadowOffset(t){let e=this.shadowOffset;e.equals(t)||(t=t.N(),this._e().Uy=t,this.C(),this.t("shadowOffset",e,t))}get shadowColor(){return this.H!==null?this.H.Vy:"gray"}set shadowColor(t){let e=this.shadowColor;e!==t&&(this._e().Vy=t,this.C(),this.t("shadowColor",e,t))}get shadowBlur(){return this.H!==null?this.H.Ln:4}set shadowBlur(t){let e=this.shadowBlur;e!==t&&(this._e().Ln=t,this.C(),this.t("shadowBlur",e,t))}}class Gi{me;wy;Oy;Cy;Ny;Ly;My;Ay;Ty;Dy;vy;Fy;Ry;Py;Sy;xy;ky;Ey;Iy;Uy;Vy;Ln;constructor(){this.me=!1,this.wy=null,this.Oy=null,this.Cy=null,this.Ny="",this.Ly=null,this.My=null,this.Ay=null,this.Ty="",this.Dy=st.Ww,this.vy=null,this.Fy="",this.Ry=T.Default,this.Py="",this.Sy=T.TopLeft,this.xy=P.DL,this.ky=P.vL,this.Ey=null,this.Iy=127,this.Uy=P.FL,this.Vy="gray",this.Ln=4}copy(){let t=new Gi;return t.wy=this.wy,t.Oy=this.Oy,t.Cy=this.Cy,t.Ny=this.Ny,t.Ly=this.Ly,t.My=this.My,t.Ay=this.Ay,t.Ty=this.Ty,t.Dy=this.Dy.N(),t.vy=this.vy,t.Fy=this.Fy,t.Ry=this.Ry.N(),t.Py=this.Py,t.Sy=this.Sy.N(),t.xy=this.xy.N(),t.ky=this.ky.N(),t.Ey=this.Ey,t.Iy=this.Iy,t.Uy=this.Uy.N(),t.Vy=this.Vy,t.Ln=this.Ln,t}}class vt extends pt{Ms;Dt;qS;jS;Af;constructor(t,e){let i;t===void 0||t instanceof Lt||typeof t=="string"?i=t:t&&(e=t),super(i),this.b&=-257,this.cl="Adornment",this.Ms=null,this.qS=0,this.jS=!1,this.Dt=null,this.Af=null,e&&Object.assign(this,e)}toString(){let t=this.adornedPart;return"Adornment("+this.category+")"+(t!==null?t.toString():"")}updateRelationshipsFromData(){}Dd(t){let e=this.adornedObject;if(!(e instanceof et))return;let i=e.part;if(!(i instanceof j))return;let s=i.path,n=s.geometry;i.Dd(t),n=s.geometry;let o=this.D.r,r=o.length;for(let a=0;a<r;a++){let h=o[a];h.isPanelMain&&h instanceof et&&(h.ut=n)}}hasPlaceholder(){return this.Dt!==null&&this.Dt.isVisibleObject()}get placeholder(){return this.Dt}get adornedObject(){return this.Ms}set adornedObject(t){let e=this.adornedPart,i=null;t!==null&&(i=t.part),e!==null&&(t===null||e!==i)&&e.removeAdornment(this.category),this.Ms=t,i!==null&&i.addAdornment(this.category,this)}get adornedPart(){let t=this.Ms;return t!==null?t.part:null}$r(){let t=this.Ms;if(t===null)return!0;let e=t.part;return e===null||!e.as()}Di(){return!1}get containingGroup(){return null}gf(t,e,i,s,n,o,r){if(t===3&&e==="elements"){if(n instanceof le)this.Dt===null&&(this.Dt=n);else if(n instanceof G){let a=n.findInVisualTree(h=>h instanceof le);a instanceof le&&this.Dt===null&&(this.Dt=a)}}else t===4&&e==="elements"&&this.Dt!==null&&(s===this.Dt?this.Dt=null:s instanceof G&&this.Dt.isContainedBy(s)&&(this.Dt=null));super.gf(t,e,i,s,n,o,r)}updateAdornments(){}af(){}}var qs=(x=>(x[x.None=0]="None",x[x.Evenly=1]="Evenly",x[x.Packed=2]="Packed",x))(qs||{});class $ extends pt{E;vt;Xf;dl;va;ci;ee;constructor(t,e){let i;t===void 0||t instanceof Lt||typeof t=="string"?i=t:t&&(e=t),super(i),this.E=13,this.vt=null,this.ee=new q,this.Xf=null,this.dl=null,this.ci=null,this.va=!1,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.E=this.E,this.vt!==null&&(this.vt.me?t.vt=this.vt:t.vt=this.vt.copy())}Yo(t){super.Yo(t),t.invalidateConnectedLinks(),t.dl=this.dl,t.ci=null}static SpreadingNone=0;static SpreadingEvenly=1;static SpreadingPacked=2;gl(){return this.vt===null?this.vt=new qi:this.vt.me&&(this.vt=this.vt.copy()),this.vt}ba(){super.ba(),this.vt!==null&&(this.vt.me=!0)}GD(t){t!==null&&(this.dl===null&&(this.dl=new V),this.dl.add(t))}YD(t){t!==null&&this.dl!==null&&this.dl.delete(t)}KD(t,e,i){if(t===null||this.dl===null)return null;let s=this.dl.iterator;for(;s.next();){let n=s.value;if(n.By===this&&n.ak===t&&n.mC===e&&n.pC===i||n.By===t&&n.ak===this&&n.mC===i&&n.pC===e)return n}return null}invalidateLinkBundle(t,e,i){e==null&&(e=""),i==null&&(i="");let s=this.KD(t,e,i);s!==null&&s.$d()}gf(t,e,i,s,n,o,r){t===3&&e==="elements"?this.ci=null:t===4&&e==="elements"&&(this.ci=null),super.gf(t,e,i,s,n,o,r)}invalidateConnectedLinks(t,e){let i=this.linksConnected;for(;i.next();){let s=i.value;t&&t.has(s)||e&&s.fromPort!==e&&s.toPort!==e||(this.Ze(s.fromPort),this.Ze(s.toPort),s.$t())}}Ze(t){if(t===null)return;let e=t.wd;e!==null&&e.$d();let i=t.part,s=i.containingGroup;s!==null&&!i.isVisible()&&s.Ze(s.port)}$r(){return!0}get portSpreading(){return this.vt!==null?this.vt.zy:1}set portSpreading(t){let e=this.portSpreading;if(e!==t){this.gl().zy=t,this.t("portSpreading",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.invalidateConnectedLinks()}}get avoidable(){return(this.E&8)!==0}set avoidable(t){let e=(this.E&8)!==0;if(e!==t){this.E=this.E^8;let i=this.diagram;i!==null&&i.ud(this),this.t("avoidable",e,t)}}get avoidableMargin(){return this.vt!==null?this.vt.Xy:Dt.BL}set avoidableMargin(t){typeof t=="number"&&(t=new Dt(t));let e=this.avoidableMargin;if(!e.equals(t)){t=t.N(),this.gl().Xy=t;let i=this.diagram;i!==null&&i.ud(this),this.t("avoidableMargin",e,t)}}canAvoid(){return this.avoidable&&!this.isLinkLabel}getAvoidableRect(t){return t.set(this.actualBounds),t.addMargin(this.avoidableMargin),t}findVisibleNode(){let t=this;for(;t!==null&&!t.isVisible();)t=t.containingGroup;return t}isVisible(){if(!super.isVisible())return!1;let t=!0,e=1,i=this.diagram;if(i!==null){if(i.animationManager.qx(this))return!0;t=i.isTreePathToChildren,e=i.treeCollapsePolicy}if(e===1){let n=this.findTreeParentNode();if(n!==null&&!n.isTreeExpanded)return!1}else if(e===2){let n=t?this.findLinksInto():this.findLinksOutOf(),o=!1,r=!1;for(;n.next();){let a=n.value;if(a.isTreeLink){o=!0;let h=t?a.fromNode:a.toNode;if(h&&h.isTreeExpanded){r=!0;break}}}if(o&&!r)return!1}else if(e===3){let n=t?this.findLinksInto():this.findLinksOutOf(),o=!1,r=!1;for(;n.next();){let a=n.value;if(a.isTreeLink){o=!0;let h=t?a.fromNode:a.toNode;if(h&&!h.isTreeExpanded){r=!0;break}}}if(o&&r)return!1}let s=this.labeledLink;return s!==null?s.isVisible():!0}Xe(t){super.Xe(t);let e=this.linksConnected;for(;e.next();){let i=e.value;if(t&&this.containingGroup!==null){let s=i.getOtherNode(this);s!==null&&!s.isMemberOf(this.containingGroup)&&i.$t()}i.Xe(t)}}get linksConnected(){return this.ee.iterator}findExternalTreeLinksConnected(){let t=new V,e=new V;return this.HD(this,t,e),e.iterator}HD(t,e,i){if(t===null||e.has(t))return;e.add(t);let s=!0,n=this.diagram;n!==null&&(s=n.isTreePathToChildren),t.linksConnected.each(o=>{o.isTreeLink?(s?o.fromNode===t:o.toNode===t)&&this.HD(s?o.toNode:o.fromNode,e,i):i.add(o)})}findLinksConnected(t){if(t===void 0&&(t=null),t===null)return this.ee.iterator;let e=new gt(this.ee),i=this;return e.predicate=s=>s.fromNode===i&&s.fromPortId===t||s.toNode===i&&s.toPortId===t,e}findLinksOutOf(t){t===void 0&&(t=null);let e=new gt(this.ee),i=this;return e.predicate=s=>s.fromNode!==i?!1:t===null?!0:s.fromPortId===t,e}findLinksInto(t){t===void 0&&(t=null);let e=new gt(this.ee),i=this;return e.predicate=s=>s.toNode!==i?!1:t===null?!0:s.toPortId===t,e}findNodesConnected(t){t===void 0&&(t=null);let e=null,i=null,s=this.ee.iterator;for(;s.next();){let n=s.value;if(n.fromNode===this){if(t===null||n.fromPortId===t){let o=n.toNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}else if(n.toNode===this&&(t===null||n.toPortId===t)){let o=n.fromNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new dt(i):kt.instance}findNodesOutOf(t){t===void 0&&(t=null);let e=null,i=null,s=this.ee.iterator;for(;s.next();){let n=s.value;if(n.fromNode===this&&(t===null||n.fromPortId===t)){let o=n.toNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new dt(i):kt.instance}findNodesInto(t){t===void 0&&(t=null);let e=null,i=null,s=this.ee.iterator;for(;s.next();){let n=s.value;if(n.toNode===this&&(t===null||n.toPortId===t)){let o=n.fromNode;e!==null?e.add(o):i!==null&&i!==o?(e=new V,e.add(i),e.add(o)):i=o}}return e!==null?e.iterator:i!==null?new dt(i):kt.instance}findLinksBetween(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);let s=new gt(this.ee),n=this;return s.predicate=o=>o.fromNode===n&&o.toNode===t&&(e===null||o.fromPortId===e)&&(i===null||o.toPortId===i)||o.fromNode===t&&o.toNode===n&&(i===null||o.fromPortId===i)&&(e===null||o.toPortId===e),s}findLinksTo(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);let s=new gt(this.ee),n=this;return s.predicate=o=>!(o.fromNode!==n||o.toNode!==t||e!==null&&o.fromPortId!==e||i!==null&&o.toPortId!==i),s}findSuccessorParts(t){return t===void 0&&(t=new V),this.qD(this,t),t.remove(this),t}qD(t,e){t!==null&&(e.has(t)||(e.add(t),t.findLinksOutOf().each(i=>{if(e.has(i))return;e.add(i);let s=i.toNode;s!==null&&this.qD(s,e)})))}findPredecessorParts(t){return t===void 0&&(t=new V),this.jD(this,t),t.remove(this),t}jD(t,e){t!==null&&(e.has(t)||(e.add(t),t.findLinksInto().each(i=>{if(e.has(i))return;e.add(i);let s=i.fromNode;s!==null&&this.jD(s,e)})))}get linkConnected(){return this.vt!==null?this.vt.Gy:null}set linkConnected(t){let e=this.linkConnected;e!==t&&(t!==null&&m.S(t,$,"linkConnected"),this.gl().Gy=t,this.t("linkConnected",e,t))}get linkDisconnected(){return this.vt!==null?this.vt.Yy:null}set linkDisconnected(t){let e=this.linkDisconnected;e!==t&&(t!==null&&m.S(t,$,"linkDisconnected"),this.gl().Yy=t,this.t("linkDisconnected",e,t))}get linkValidation(){return this.vt!==null?this.vt.El:null}set linkValidation(t){let e=this.linkValidation;e!==t&&(t!==null&&m.S(t,$,"linkValidation"),this.gl().El=t,this.t("linkValidation",e,t))}hk(t,e){this.Ze(e);let i=this.ee.has(t);if(i||this.ee.add(t),!i||t.fromNode===t.toNode){let s=this.linkConnected;if(s!==null){let n=!0,o=this.diagram;o!==null&&(n=o.G,o.G=!0),s(this,t,e),o!==null&&(o.G=n)}}if(!i){if(!t.isTreeLink)return;let s=t.fromNode,n=t.toNode;if(s!==null&&n!==null&&s!==n){let o=!0,r=this.diagram;r!==null&&(o=r.isTreePathToChildren);let a=o?n:s,h=o?s:n;if(a.va||(a.va=h),h.isTreeLeaf){if(r!==null&&r.undoManager.isUndoingRedoing)return;o?s===h&&(h.isTreeLeaf=!1):n===h&&(h.isTreeLeaf=!1)}}}}ck(t,e){this.Ze(e);let i=this.ee.delete(t),s=null;if(i||t.toNode===t.fromNode){let n=this.linkDisconnected;if(s=this.diagram,n!==null){let o=!0;s!==null&&(o=s.G,s.G=!0),n(this,t,e),s!==null&&(s.G=o)}}if(i){if(!t.isTreeLink)return;let n=!0;s!==null&&(n=s.isTreePathToChildren);let o=n?t.toNode:t.fromNode,r=n?t.fromNode:t.toNode;if(o!==null&&(o.va=!1),r!==null&&!r.isTreeLeaf)if(r.ee.count===0){if(r.va=null,s!==null&&s.undoManager.isUndoingRedoing)return;r.isTreeLeaf=!0}else r.Ap()}}Ap(){if(this.va=!1,this.ee.count===0)return;let t=!0,e=this.diagram;if(e!==null&&e.undoManager.isUndoingRedoing)return;e!==null&&(t=e.isTreePathToChildren);let i=this.ee.iterator;for(;i.next();){let s=i.value;if(s.isTreeLink){if(t){if(s.fromNode===this){this.isTreeLeaf=!1;return}}else if(s.toNode===this){this.isTreeLeaf=!1;return}}}this.isTreeLeaf=!0}updateRelationshipsFromData(){let t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)}Zm(t){if(super.Zm(t),!t){this.Ap();let e=this.Xf;e!==null&&e.WD(this)}}Qm(t){if(super.Qm(t),!t){let e=this.Xf;e!==null&&e.JD(this)}}af(){if(this.ee.count>0){let t=this.diagram;if(t!==null){let e=t.commandHandler!==null?t.commandHandler.deletesConnectedLinks:!0,i=this.ee.copy().iterator;for(;i.next();){let s=i.value;e?t.remove(s):(s.fromNode===this&&(s.fromNode=null),s.toNode===this&&(s.toNode=null))}}}this.labeledLink=null,super.af()}get isLinkLabel(){return this.Xf!==null}get labeledLink(){return this.Xf}set labeledLink(t){let e=this.Xf;if(e!==t){let i=this.diagram,s=this.data;if(e!==null){if(e.JD(this),i!==null&&s!==null&&!i.undoManager.isUndoingRedoing){let n=e.data,o=i.model;if(n!==null&&o.Wh()){let r=o.getKeyForNodeData(s);r!==void 0&&o.removeLabelKeyForLinkData(n,r)}}this.containingGroup=null}if(this.Xf=t,t!==null){if(t.WD(this),i!==null&&s!==null&&!i.undoManager.isUndoingRedoing){let n=t.data,o=i.model;if(n!==null&&o.Wh()){let r=o.getKeyForNodeData(s);r!==void 0&&o.addLabelKeyForLinkData(n,r)}}this.containingGroup=t.containingGroup}this.Pf(),this.t("labeledLink",e,t)}}findVisiblePort(t){let e=t;for(;e!==null&&(!e.actualBounds.isReal()||!e.isVisibleObject());)e=e.panel;return e===null?this.port:e}findPort(t){if(this.ci===null){if(t===""&&this.Cn===!1)return this;this.$D()}let e=this.ci.get(t);return e!==null||t!==""&&(e=this.ci.get(""),e!==null)?e:this}get port(){return this.findPort("")}get ports(){return this.ci===null&&this.$D(),this.ci.iteratorValues}$D(){this.ci===null?this.ci=new Mt:this.ci.clear(),this.walkVisualTreeFrom(this,(t,e)=>t.sD(e)),this.ci.count===0&&this.ci.set("",this)}sD(t){let e=t.portId;e!==null&&this.ci!==null&&this.ci.set(e,t)}vN(t,e){let i=t.portId;if(i!==null){this.ci!==null&&this.ci.delete(i);let s=this.diagram;if(s!==null&&e){let n=null,o=this.findLinksConnected(i);for(;o.next();){let r=o.value;n===null&&(n=m.st()),n.push(r)}if(n!==null){for(let r=0;r<n.length;r++){let a=n[r];s.remove(a)}m.Z(n)}}}}isInTreeOf(t){if(t===null||t===this)return!1;let e=!0,i=this.diagram;i!==null&&(e=i.isTreePathToChildren);let s=this,n=t,o;if(e)for(;s!==n;){o=null;let r=s.ee.iterator;for(;r.next();){let a=r.value;if(a.isTreeLink&&(o=a.fromNode,o!==s&&o!==this))break}if(o===this||o===null||o===s)return!1;s=o}else for(;s!==n;){o=null;let r=s.ee.iterator;for(;r.next();){let a=r.value;if(a.isTreeLink&&(o=a.toNode,o!==s&&o!==this))break}if(o===this||o===null||o===s)return!1;s=o}return!0}findTreeRoot(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=this,s;if(t)for(;;){s=null;let n=i.ee.iterator;for(;n.next();){let o=n.value;if(o.isTreeLink&&(s=o.fromNode,s!==i&&s!==this))break}if(s===this)return this;if(s===null||s===i)return i;i=s}else for(;;){s=null;let n=i.ee.iterator;for(;n.next();){let o=n.value;if(o.isTreeLink&&(s=o.toNode,s!==i&&s!==this))break}if(s===this)return this;if(s===null||s===i)return i;i=s}}findCommonTreeParent(t){if(t===null)return null;if(this===t)return this;let e=this;for(;e!==null;)e.lk(!0),e=e.findTreeParentNode();let i=null;for(e=t;e!==null;){if(e.XD()){i=e;break}e=e.findTreeParentNode()}for(e=this;e!==null;)e.lk(!1),e=e.findTreeParentNode();return i}findTreeParentLink(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=this.ee.iterator;if(t)for(;i.next();){let s=i.value;if(s.isTreeLink&&s.fromNode!==this)return s}else for(;i.next();){let s=i.value;if(s.isTreeLink&&s.toNode!==this)return s}return null}findTreeParentNode(){let t=this.va;if(t===null)return null;if(t instanceof $)return t;let e=this.diagram,i=e!==null?e.isTreePathToChildren:!0,s=this.ee.iterator;for(;s.next();){let n=s.value;if(!n.isTreeLink)continue;let o=i?n.fromNode:n.toNode;if(o!==this)return this.va=o,o}return this.va=null,null}findTreeParentChain(t){function e(i,s){s.add(i);let n=i.findTreeParentLink();if(n!==null){s.add(n);let o=i.findTreeParentNode();if(o===null)return;e(o,s)}}return t===void 0&&(t=new V),e(this,t),t}findTreeLevel(){return this.PE(this)}PE(t){let e=0,i=t.findTreeParentNode();for(;i!==null&&i!==t;)i=i.findTreeParentNode(),e++;return e}findTreeChildrenLinks(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=new gt(this.ee),s=this;return t?i.predicate=n=>!(!n.isTreeLink||n.fromNode!==s):i.predicate=n=>!(!n.isTreeLink||n.toNode!==s),i}findTreeChildrenNodes(){let t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);let i=null,s=null,n=this.ee.iterator;if(t)for(;n.next();){let o=n.value;if(o.isTreeLink&&o.fromNode===this){let r=o.toNode;i!==null?i.add(r):s!==null&&s!==r?(i=new q,i.add(s),i.add(r)):s=r}}else for(;n.next();){let o=n.value;if(o.isTreeLink&&o.toNode===this){let r=o.fromNode;i!==null?i.add(r):s!==null&&s!==r?(i=new q,i.add(s),i.add(r)):s=r}}return i!==null?i.iterator:s!==null?new dt(s):kt.instance}findTreeParts(t,e){return t===void 0&&(t=1/0),m.s(t,"number",$,"findTreeParts:level"),e===void 0&&(e=new V),pt.ga(e,this,!1,t,!0),e}collapseTree(t){t===void 0&&(t=1),t<1&&(t=1);let e=this.diagram;if(e===null||e.isCollapsingExpanding)return;e.isCollapsingExpanding=!0;let i=new V;i.add(this),this.ZD(i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===1),e.isCollapsingExpanding=!1}ZD(t,e,i,s,n,o){if(i>1){let r=e?this.findLinksOutOf():this.findLinksInto();for(;r.next();){let a=r.value;if(!a.isTreeLink)continue;let h=a.getOtherNode(this);h!==null&&h!==this&&!t.has(h)&&(t.add(h),h.ZD(t,e,i-1,s,n,o))}}else this.QD(t,e,s,n,o)}QD(t,e,i,s,n){let o=s===this?!0:this.isTreeExpanded,r=e?this.findLinksOutOf():this.findLinksInto();for(;r.next();){let a=r.value;if(!a.isTreeLink)continue;let h=a.getOtherNode(this);if(h!==null&&h!==this){let l=t.has(h);if(l||t.add(h),o){let u=e?h.findNodesInto():h.findNodesOutOf(),c=this;u.all(d=>d===c||!d.isTreeExpanded)&&i.Hc(h,s),h.Sa(),h.Xe(!1)}h.isTreeExpanded&&(h.wasTreeExpanded=h.isTreeExpanded,l||h.QD(t,e,i,s,n))}}this.isTreeExpanded=!1}expandTree(t){t===void 0&&(t=2),t<2&&(t=2);let e=this.diagram;if(e===null||e.isCollapsingExpanding)return;e.isCollapsingExpanding=!0;let i=new V;i.add(this),this._D(i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===1),e.isCollapsingExpanding=!1}_D(t,e,i,s,n,o){let r=n===this?!1:this.isTreeExpanded,a=e?this.findLinksOutOf():this.findLinksInto();for(;a.next();){let h=a.value;if(!h.isTreeLink)continue;r||h.Fi||h.$t();let l=h.getOtherNode(this);if(l!==null&&l!==this&&!t.has(l)){if(t.add(l),!r){l.Xe(!0),l.Sa();let u=e?l.findNodesInto():l.findNodesOutOf(),c=this;u.all(d=>d===c||!d.isTreeExpanded)&&s.Kc(l,n)}(i>2||l.wasTreeExpanded)&&(l.wasTreeExpanded=!1,l._D(t,e,i-1,s,n,o))}}this.isTreeExpanded=!0}get isTreeExpanded(){return(this.E&1)!==0}set isTreeExpanded(t){let e=(this.E&1)!==0;if(e!==t){this.E=this.E^1;let i=this.diagram;this.t("isTreeExpanded",e,t);let s=this.treeExpandedChanged;if(s!==null){let n=!0;i!==null&&(n=i.G,i.G=!0),s(this),i!==null&&(i.G=n)}if(i!==null&&i.undoManager.isUndoingRedoing){this.Xe(t);return}t?this.expandTree():this.collapseTree()}}get wasTreeExpanded(){return(this.E&2)!==0}set wasTreeExpanded(t){let e=(this.E&2)!==0;e!==t&&(this.E=this.E^2,this.t("wasTreeExpanded",e,t))}get treeExpandedChanged(){return this.vt!==null?this.vt.Ky:null}set treeExpandedChanged(t){let e=this.treeExpandedChanged;e!==t&&(t!==null&&m.S(t,$,"treeExpandedChanged"),this.gl().Ky=t,this.t("treeExpandedChanged",e,t))}get isTreeLeaf(){return(this.E&4)!==0}set isTreeLeaf(t){let e=(this.E&4)!==0;e!==t&&(this.E=this.E^4,this.t("isTreeLeaf",e,t))}get isTreeRoot(){return this.findTreeParentLink()===null}}class qi{me;Gy;Yy;El;Ky;Xy;zy;Hy;qy;da;jy;constructor(){this.me=!1,this.Gy=null,this.Yy=null,this.El=null,this.Ky=null,this.Xy=Dt.BL,this.zy=1,this.Hy=null,this.qy=null,this.da=null,this.jy=null}copy(){let t=new qi;return t.Gy=this.Gy,t.Yy=this.Yy,t.El=this.El,t.Ky=this.Ky,t.Xy=this.Xy.N(),t.zy=this.zy,t.Hy=this.Hy,t.qy=this.qy,t.da=this.da,t.jy=this.jy,t}}var Hi=(x=>(x[x.None=0]="None",x[x.End=17]="End",x[x.Scale=18]="Scale",x[x.Stretch=19]="Stretch",x))(Hi||{}),Wi=(x=>(x[x.Normal=1]="Normal",x[x.Orthogonal=2]="Orthogonal",x[x.AvoidsNodes=6]="AvoidsNodes",x[x.AvoidsNodesStraight=7]="AvoidsNodesStraight",x))(Wi||{}),$i=(x=>(x[x.None=0]="None",x[x.Bezier=9]="Bezier",x[x.JumpGap=10]="JumpGap",x[x.JumpOver=11]="JumpOver",x))($i||{});class j extends pt{St;uo;go;Zd;mo;po;Qd;Gf;_d;tg;eg;Jh;ig;nn;Me;pl;Ar;yl;_o;yC;wC;fk;xC;bC;$h;uk;ut;tr;static Zh=null;static Qh=null;Af;kC;PC;constructor(t){super(G.Link),this.St=8,this.uo=null,this.go="",this.Zd=null,this.mo=null,this.po="",this.Qd=null,this.Gf=0,this._d=0,this.tg=0,this.eg=NaN,this.Jh=1,this.ig=.5,this.nn=null,this.Me=new q().k(),this.pl=null,this.Ar=null,this.yl=new I,this.ut=new wt,this._o=null,this.tr=null,this.yC=P.gn,this.wC=P.gn,this.kC=0,this.PC=0,this.fk=new P,this.xC=null,this.bC=null,this.$h=null,this.uk=NaN,this.ft=null,this.Af=[],t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.St=this.St&-113,t.go=this.go,t.Zd=this.Zd,t.po=this.po,t.Qd=this.Qd,t.Gf=this.Gf,t._d=this._d,t.tg=this.tg,t.eg=this.eg,t.Jh=this.Jh,t.ig=this.ig,this.ft!==null&&(t.ft=this.ft.copy())}Yo(t){super.Yo(t),this.go=t.go,this.po=t.po,t.pl=null,t.$t(),t.tr=this.tr;let e=t.fromPort;e!==null&&t.fromNode.Ze(e);let i=t.toPort;i!==null&&t.toNode.Ze(i)}fe(t){t in Wi||t in $i||t in Hi?j.SC(t)?this.routing=t:t===9||t===10||t===11?this.curve=t:t===17||t===18||t===19?this.adjusting=t:t===1||t===0||m.o("Unknown Link enum value for a Link property: "+t):super.fe(t)}static Normal=1;static Orthogonal=2;static AvoidsNodes=6;static AvoidsNodesStraight=7;static None=0;static Bezier=9;static JumpGap=10;static JumpOver=11;static End=17;static Scale=18;static Stretch=19;static OrientAlong=21;static OrientPlus90=22;static OrientMinus90=23;static OrientOpposite=24;static OrientUpright=25;static OrientPlus90Upright=26;static OrientMinus90Upright=27;static OrientUpright45=28;static tv=8;static ev=16;static Fa=8;static q1=3;static iv=3;static sv=1.333;static MC=1;static NC=0;static nv=10;static Yf=9999;static ov=30;static rv=30;static CC=10;static lv=10;static av=14;static hv=30;static cv=14;static _A=8;static tT=8;static fv=11;static setRoutingParameter(t,e){switch(t){case 1:j.tv=e;break;case 2:j.ev=e;break;case 3:j.Fa=e;break;case 4:j.q1=e;break;case 5:j.iv=e;break;case 6:j.sv=e;break;case 7:j.MC=e;break;case 8:j.NC=e;break;case 9:j.nv=e;break;case 10:j.Yf=e;break;case 11:j.ov=e;break;case 12:j.rv=e;break;case 13:j.CC=e;break;case 14:j.lv=e;break;case 15:j.av=e;break;case 16:j.hv=e;break;case 17:j.cv=e;break;case 18:j._A=e;break;case 19:j.tT=e;break;case 20:j.fv=e;break}t>29&&t<71&&(j.IT=t+parseInt(e.toString().slice(0,-1)))}static IT;Wi(){return this.ft===null&&(this.ft=new Ni),this.ft}II(t,e,i){let s=t.segmentIndex,n=t.segmentFraction,o=t.alignmentFocus,r=t.segmentOrientation,a=t.segmentOffset,h=0,l=0,u=0,c=0;if(isNaN(s)){let L=this.ut,M=m.st();L.getPointAndAngleAlongPath(n,M);let A=P.z(M[0],M[1]);if(c=M[2],A.add(this.getPoint(0)),L.type===1)A.offset(-L.startX,-L.startY);else{let F=L.figures.first();A.offset(-F.startX,-F.startY)}r!==0&&(u=this.computeAngle(t,r,c),t.angle=u),h=A.x,l=A.y,P.i(A),m.Z(M)}else if(s<-e||s>=e){let L=P.l();this.KN(L),c=this.midAngle,r!==0&&(u=this.computeAngle(t,r,c),t.angle=u),h=L.x,l=L.y,P.i(L)}else{let L,M,A=0;if(s>=0?(L=i.r[s],M=s<e-1?i.r[s+1]:L):(A=e+s,L=i.r[A],M=A>0?i.r[A-1]:L),L.equalsApprox(M)){let F,O;s>=0?(F=s>0?i.r[s-1]:L,O=s<e-2?i.r[s+2]:M):(F=A<e-1?i.r[A+1]:L,O=A>1?i.r[A-2]:M);let E=F.distanceSquaredPoint(L),B=M.distanceSquaredPoint(O);E>B+10?c=s>=0?F.directionPoint(L):L.directionPoint(F):B>E+10?c=s>=0?M.directionPoint(O):O.directionPoint(M):c=s>=0?F.directionPoint(O):O.directionPoint(F)}else c=s>=0?L.directionPoint(M):M.directionPoint(L);r!==0&&(u=this.computeAngle(t,r,c),t.angle=u),h=L.x+(M.x-L.x)*n,l=L.y+(M.y-L.y)*n}if(o.isNone()){t.moveTo(h,l,!0);return}else o.isNoSpot()&&(o=T.Center);let d=Nt.l();d.Ue(),d.et(t.scale,t.scale),d.ks(t.angle,0,0);let f=t.naturalBounds,p=I.z(0,0,f.width,f.height),g=P.l();g.setRectSpot(p,o),d.gt(g);let y=-g.x,b=-g.y,v=f.width,w=f.height,k=P.bs(a),S=isNaN(a.x),N=isNaN(a.y);if(S||N){let L=v/2+j.q1,M=w/2+j.iv,A=c>=45&&c<=135,F=c>=225&&c<=315;r===0&&(A||F)?(k.x=N?L:a.y,k.y=S?M:a.x,A?s>=0||isNaN(s)&&n<.5||S&&(k.y=-M):F&&((s>=0||isNaN(s)&&n<.5)&&S&&(k.y=-M),N&&(k.x=-L))):(S&&(s>=0||isNaN(s)&&n<.5?k.x=L:k.x=-L),N&&(k.y=-M),k.rotate(c))}else k.rotate(c);h+=k.x,l+=k.y,d.im(p),y+=p.x,b+=p.y;let D=P.z(h+y,l+b);t.move(D),P.i(D),P.i(k),P.i(g),I.i(p),Nt.i(d)}$r(){let t=this.fromNode;if(t!==null){let i=t.findVisibleNode();if(i!==null&&(t=i),t.as()||t.fa())return!1}let e=this.toNode;if(e!==null){let i=e.findVisibleNode();if(i!==null&&(e=i),e.as()||e.fa())return!1}return!0}TN(t,e,i){return!1}DN(){}Di(){return!1}computeAngle(t,e,i){return j.computeAngle(e,i)}static computeAngle(t,e){let i=0;switch(t){default:case 0:i=0;break;case 21:i=e;break;case 22:i=e+90;break;case 23:i=e-90;break;case 24:i=e+180;break;case 25:i=C.Ee(e),i>90&&i<270&&(i-=180);break;case 26:i=C.Ee(e+90),i>90&&i<270&&(i-=180);break;case 27:i=C.Ee(e-90),i>90&&i<270&&(i-=180);break;case 28:if(i=C.Ee(e),i>45&&i<135||i>225&&i<315)return 0;i>90&&i<270&&(i-=180);break}return C.Ee(i)}get fromNode(){return this.uo}set fromNode(t){let e=this.uo;if(e!==t){let i=this.fromPort;e!==null&&(this.mo!==e&&e.ck(this,i),this.Wy(),this.invalidateLayout(2)),this.uo=t,t!==null&&this.Xe(t.isVisible()),this._o=null,this.$t();let s=this.diagram;s!==null&&s.G&&s.partManager.setFromNodeForLink(this,t,e);let n=this.fromPort,o=this.fromPortChanged;if(o!==null){let r=!0;s!==null&&(r=s.G,s.G=!0),o(this,i,n),s!==null&&(s.G=r)}t!==null&&(this.mo!==t&&t.hk(this,n),this.Jy(),this.invalidateLayout(1)),this.t("fromNode",e,t),this.Jd()}}get fromPortId(){return this.go}set fromPortId(t){let e=this.go;if(e!==t){let i=this.fromPort;i!==null&&this.fromNode?.Ze(i),this.Wy(),this.go=t;let s=this.fromPort;s!==null&&this.fromNode?.Ze(s);let n=this.diagram;if(n!==null){let o=this.data,r=n.model;o!==null&&r.Wh()&&r.setFromPortIdForLinkData(o,t)}if(i!==s){this._o=null,this.$t();let o=this.fromPortChanged;if(o!==null){let r=!0;n!==null&&(r=n.G,n.G=!0),o(this,i,s),n!==null&&(n.G=r)}}this.Jy(),this.t("fromPortId",e,t)}}get fromPort(){let t=this.uo;if(t===null)return null;let e=this.go;return t.findPort(e)}get fromPortChanged(){return this.Zd}set fromPortChanged(t){let e=this.Zd;e!==t&&(t!==null&&m.S(t,j,"fromPortChanged"),this.Zd=t,this.t("fromPortChanged",e,t))}get toNode(){return this.mo}set toNode(t){let e=this.mo;if(e!==t){let i=this.toPort;e!==null&&(this.uo!==e&&e.ck(this,i),this.Wy(),this.invalidateLayout(2)),this.mo=t,t!==null&&this.Xe(t.isVisible()),this._o=null,this.$t();let s=this.diagram;s!==null&&s.G&&s.partManager.setToNodeForLink(this,t,e);let n=this.toPort,o=this.toPortChanged;if(o!==null){let r=!0;s!==null&&(r=s.G,s.G=!0),o(this,i,n),s!==null&&(s.G=r)}t!==null&&(this.uo!==t&&t.hk(this,n),this.Jy(),this.invalidateLayout(1)),this.t("toNode",e,t),this.Jd()}}get toPortId(){return this.po}set toPortId(t){let e=this.po;if(e!==t){let i=this.toPort;i!==null&&this.toNode?.Ze(i),this.Wy(),this.po=t;let s=this.toPort;s!==null&&this.toNode?.Ze(s);let n=this.diagram;if(n!==null){let o=this.data,r=n.model;o!==null&&r.Wh()&&r.setToPortIdForLinkData(o,t)}if(i!==s){this._o=null,this.$t();let o=this.toPortChanged;if(o!==null){let r=!0;n!==null&&(r=n.G,n.G=!0),o(this,i,s),n!==null&&(n.G=r)}}this.Jy(),this.t("toPortId",e,t)}}get toPort(){let t=this.mo;if(t===null)return null;let e=this.po;return t.findPort(e)}get toPortChanged(){return this.Qd}set toPortChanged(t){let e=this.Qd;e!==t&&(t!==null&&m.S(t,j,"toPortChanged"),this.Qd=t,this.t("toPortChanged",e,t))}get fromSpot(){return this.ft!==null?this.ft.vh:T.Default}set fromSpot(t){let e=this.fromSpot;if(!e.equals(t)){if(t=t.N(),this.Wi().vh=t,this.t("fromSpot",e,t),e.isSide()||t.isSide()){let i=this.fromNode;i!==null&&i.Ze(this.fromPort)}this.$t()}}get fromEndSegmentLength(){return this.ft!==null?this.ft.Rh:NaN}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;if(e!==t){if(t<0&&m.J(t,">= 0",j,"fromEndSegmentLength"),this.Wi().Rh=t,this.t("fromEndSegmentLength",e,t),this.computeSpot(!0,this.fromPort).isSide()){let i=this.fromNode;i!==null&&i.Ze(this.fromPort)}this.$t()}}get fromShortLength(){return this.ft!==null?this.ft.Ih:NaN}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Wi().Ih=t,this.ai(),this.t("fromShortLength",e,t))}get toSpot(){return this.ft!==null?this.ft.Fh:T.Default}set toSpot(t){let e=this.toSpot;if(!e.equals(t)){if(t=t.N(),this.Wi().Fh=t,this.t("toSpot",e,t),e.isSide()||t.isSide()){let i=this.toNode;i!==null&&i.Ze(this.toPort)}this.$t()}}get toEndSegmentLength(){return this.ft!==null?this.ft.Oh:NaN}set toEndSegmentLength(t){let e=this.toEndSegmentLength;if(e!==t){if(t<0&&m.J(t,">= 0",j,"toEndSegmentLength"),this.Wi().Oh=t,this.t("toEndSegmentLength",e,t),this.computeSpot(!1,this.toPort).isSide()){let i=this.toNode;i!==null&&i.Ze(this.toPort)}this.$t()}}get toShortLength(){return this.ft!==null?this.ft.Eh:NaN}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Wi().Eh=t,this.ai(),this.t("toShortLength",e,t))}Jd(){let t=this.fromNode,e=this.toNode,i=null;if(t!==null?e!==null?i=t.findCommonContainingGroup(e):i=t.containingGroup:e!==null?i=e.containingGroup:i=null,this.SE(i),this.isLabeledLink){let s=this.labelNodes;for(;s.next();){let n=s.value;n.containingGroup=i}}}SE(t){let e=this.Da;if(e!==t){e!==null&&e.cC(this),this.Da=t,t!==null&&t.fC(this);let i=this.containingGroupChanged;if(i!==null){let s=!0,n=this.diagram;n!==null&&(s=n.G,n.G=!0),i(this,e,t),n!==null&&(n.G=s)}this.Fi&&(this.xC===e||this.bC===e)&&this.$t()}}Sa(){let t=this.containingGroup;t!==null&&this.fromNode!==t&&this.toNode!==t&&t.computesBoundsIncludingLinks&&super.Sa()}getOtherNode(t){let e=this.fromNode;return t===e?this.toNode:e}getOtherPort(t){let e=this.fromPort;return t===e?this.toPort:e}get isLabeledLink(){return this.nn===null?!1:this.nn.count>0}get labelNodes(){return this.nn===null?kt.instance:this.nn.iterator}WD(t){this.nn===null&&(this.nn=new V),this.nn.add(t),this.f()}JD(t){this.nn!==null&&(this.nn.delete(t),this.f())}Zm(t){if(super.Zm(t),this._h()&&this.invalidateOtherJumpOvers(this.actualBounds),!t){let e=this.uo,i=null;e!==null&&(i=this.fromPort,e.hk(this,i));let s=this.mo,n=null;s!==null&&(n=this.toPort,(s!==e||n!==i)&&s.hk(this,n)),this.Jy()}}Qm(t){if(super.Qm(t),this._h()&&this.invalidateOtherJumpOvers(this.actualBounds),!t){let e=this.uo,i=null;e!==null&&(i=this.fromPort,e.ck(this,i));let s=this.mo,n=null;s!==null&&(n=this.toPort,(s!==e||n!==i)&&s.ck(this,n)),this.Wy()}}af(){if(this.Fi=!0,this.nn!==null){let t=this.diagram;if(t!==null){let e=this.nn.copy().iterator;for(;e.next();){let i=e.value;t.remove(i)}}}if(this.data!==null){let t=this.diagram;t!==null&&t.partManager.LC(this)}}updateRelationshipsFromData(){if(this.data===null)return;let t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)}move(t,e){let i=e?this.location:this.position,s=i.x;isNaN(s)&&(s=0);let n=i.y;isNaN(n)&&(n=0);let o=t.x-s,r=t.y-n;if(e===!0)super.move(t,!1);else{let h=P.z(i.x+o,i.y+r);super.move(h,!1),P.i(h)}this.xr(o,r);let a=this.labelNodes;for(;a.next();){let h=a.value,l=h.position;h.moveTo(l.x+o,l.y+r)}}get relinkableFrom(){return(this.St&1)!==0}set relinkableFrom(t){let e=(this.St&1)!==0;e!==t&&(this.St=this.St^1,this.t("relinkableFrom",e,t),this.invalidateAdornments())}get relinkableTo(){return(this.St&2)!==0}set relinkableTo(t){let e=(this.St&2)!==0;e!==t&&(this.St=this.St^2,this.t("relinkableTo",e,t),this.invalidateAdornments())}canRelinkFrom(){if(!this.relinkableFrom)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRelink)return!1;let e=t.diagram;return!(e!==null&&!e.allowRelink)}canRelinkTo(){if(!this.relinkableTo)return!1;let t=this.layer;if(t===null)return!0;if(!t.allowRelink)return!1;let e=t.diagram;return!(e!==null&&!e.allowRelink)}get resegmentable(){return(this.St&4)!==0}set resegmentable(t){let e=(this.St&4)!==0;e!==t&&(this.St=this.St^4,this.t("resegmentable",e,t),this.invalidateAdornments())}get isTreeLink(){return(this.St&8)!==0}set isTreeLink(t){let e=(this.St&8)!==0;e!==t&&(this.St=this.St^8,this.t("isTreeLink",e,t),this.fromNode!==null&&this.fromNode.Ap(),this.toNode!==null&&this.toNode.Ap())}get path(){let t=this.findMainElement();return t instanceof et?t:null}get routeBounds(){return this.updateRoute(),this.yl}AC(t){let e=1/0,i=1/0,s=this.pointsCount;if(s===0)return t.e(NaN,NaN,0,0),t;if(s===1){let n=this.getPoint(0);e=Math.min(n.x,e),i=Math.min(n.y,i),t.e(n.x,n.y,0,0)}else if(s===2){let n=this.getPoint(0),o=this.getPoint(1);e=Math.min(n.x,o.x),i=Math.min(n.y,o.y),t.e(n.x,n.y,0,0),t.unionPoint(o)}else if(this.computeCurve()===9&&s>=3&&!this.isOrthogonal){let n=this.getPoint(0);if(e=n.x,i=n.y,t.e(e,i,0,0),s===3){let o=this.getPoint(1);e=Math.min(o.x,e),i=Math.min(o.y,i);let r=this.getPoint(2);e=Math.min(r.x,e),i=Math.min(r.y,i),C.Nu(n.x,n.y,o.x,o.y,o.x,o.y,r.x,r.y,.5,t)}else for(let o=3;o<s;o+=3){let r=this.getPoint(o-2);o+3>=s&&(o=s-1);let a=this.getPoint(o-1),h=this.getPoint(o);C.Nu(n.x,n.y,r.x,r.y,a.x,a.y,h.x,h.y,.5,t),e=Math.min(h.x,e),i=Math.min(h.y,i),n=h}}else{let n=this.getPoint(0),o=this.getPoint(1);e=Math.min(n.x,o.x),i=Math.min(n.y,o.y),t.e(n.x,n.y,0,0),t.unionPoint(o);for(let r=2;r<s;r++){let a=this.getPoint(r);e=Math.min(a.x,e),i=Math.min(a.y,i),t.unionPoint(a)}}return this.fk.e(e-t.x,i-t.y),t}get midPoint(){return this.KN(new P)}KN(t){return this.updateRoute(),this.computeMidPoint(t)}computeMidPoint(t){let e=this.pointsCount;if(e===0)return t.h(P.gn),t;if(e===1)return t.h(this.getPoint(0)),t;if(e===2){let l=this.getPoint(0),u=this.getPoint(1);return t.e((l.x+u.x)/2,(l.y+u.y)/2),t}if(this.isOrthogonal&&(this.computeCorner()>=15||this.computeCurve()===9)){this.ut.getPointAlongPath(.5,t),t.add(this.getPoint(0));let l=this.ut.figures.first();return t.offset(-l.startX,-l.startY),t}if(this.computeCurve()===9){if(e===3){let c=this.getPoint(0),d=this.getPoint(1),f=this.getPoint(2);return C.YL(c.x,c.y,d.x,d.y,d.x,d.y,f.x,f.y,t),t}let l=(e-1)/3|0,u=(l/2|0)*3;if(l%2===1){let c=this.getPoint(u),d=this.getPoint(u+1),f=this.getPoint(u+2),p=this.getPoint(u+3);return C.YL(c.x,c.y,d.x,d.y,f.x,f.y,p.x,p.y,t),t}else return t.h(this.getPoint(u)),t}let i=this.flattenedLengths,s=this.flattenedTotalLength,n=0,o=0,r=0;for(;n<s/2&&o<e&&(r=i[o],!(n+r>s/2));)n+=r,o++;let a=this.getPoint(o),h=this.getPoint(o+1);if(Math.abs(a.x-h.x)<1)a.y>h.y?t.e(a.x,a.y-(s/2-n)):t.e(a.x,a.y+(s/2-n));else if(Math.abs(a.y-h.y)<1)a.x>h.x?t.e(a.x-(s/2-n),a.y):t.e(a.x+(s/2-n),a.y);else{let l=(s/2-n)/r,u=l*(h.x-a.x),c=l*(h.y-a.y);t.e(a.x+u,a.y+c)}return t}get midAngle(){return this.updateRoute(),this.computeMidAngle()}computeMidAngle(){let t=this.pointsCount;if(t<2)return NaN;if(t===2){let h=this.getPoint(0),l=this.getPoint(1);return h.directionPoint(l)}if(this.isOrthogonal&&(this.computeCorner()>=15||this.computeCurve()===9))return this.ut.getAngleAlongPath(.5);if(this.computeCurve()===9&&t>=4){let h=(t-1)/3|0,l=(h/2|0)*3;if(h%2===1){l=Math.floor(l);let u=this.getPoint(l),c=this.getPoint(l+1),d=this.getPoint(l+2),f=this.getPoint(l+3);return C.HF(u.x,u.y,c.x,c.y,d.x,d.y,f.x,f.y)}else if(l>0&&l+1<t){let u=this.getPoint(l-1),c=this.getPoint(l+1);return u.directionPoint(c)}}let e=this.flattenedLengths,i=this.flattenedTotalLength,s=0,n=0,o=0;for(;s<i/2&&n<t&&(o=e[n],!(s+o>i/2));)s+=o,n++;let r=this.getPoint(n),a=this.getPoint(n+1);if(Math.abs(r.x-a.x)<.5&&Math.abs(r.y-a.y)<j.MC){if(n>0&&n<t-2){let h=this.getPoint(n-1),l=this.getPoint(n+2);return h.x<l.x?0:h.x>l.x?180:h.y<l.y?90:270}}else if(Math.abs(r.y-a.y)<.5&&Math.abs(r.x-a.x)<j.MC&&n>0&&n<t-2){let h=this.getPoint(n-1),l=this.getPoint(n+2);return h.y<l.y?90:h.y>l.y?270:h.x<l.x?0:180}return r.directionPoint(a)}get flattenedLengths(){return this.$h!==null?this.$h:(this.Fi||this.dk(),this.ME())}get flattenedTotalLength(){let t=this.uk;if(isNaN(t)){let e=this.flattenedLengths,i=e.length;t=0;for(let s=0;s<i;s++)t+=e[s];this.uk=t}return t}ME(){this.$h===null?this.$h=[]:this.$h.length=0;let t=this.$h,e=this.pointsCount;for(let i=0;i<e-1;i++){let s=0,n=this.getPoint(i),o=this.getPoint(i+1);C.X(n.x,o.x)?(s=o.y-n.y,s<0&&(s=-s),t.push(s)):C.X(n.y,o.y)?(s=o.x-n.x,s<0&&(s=-s),t.push(s)):(s=Math.sqrt(n.distanceSquaredPoint(o)),t.push(s))}return t}get points(){return this.Me}set points(t){let e=this.Me;if(e===t)return;let i=null;if(Array.isArray(t))i=this.convertPointsArrayToList(t);else if(t instanceof q){i=t.copy();let n=i.iterator;for(;n.next();)n.value.k()}else m.o("Link.points value is not an instance of List or Array: "+t);if(i===null)return;i.k(),this.Me=i,this.ai(),this.dk();let s=this.diagram;s!==null&&(!s.Qa&&!s.undoManager.isUndoingRedoing&&s.ib.add(this),s.animationManager.ke&&s.animationManager.LM(this,i)),this.t("points",e,i)}convertPointsArrayToList(t){let e=null,i=t.length%2===0;if(i){for(let s=0;s<t.length;s++)if(typeof t[s]!="number"||isNaN(t[s])){i=!1;break}}if(i){e=new q;for(let s=0;s<t.length/2;s++)e.add(new P(t[s*2],t[s*2+1]).k())}else{let s=!0;for(let n=0;n<t.length;n++){let o=t[n];if(!m.$(o)||typeof o.x!="number"||isNaN(o.x)||typeof o.y!="number"||isNaN(o.y)){s=!1;break}}if(s){e=new q;for(let n=0;n<t.length;n++){let o=t[n];e.add(new P(o.x,o.y).k())}}}return e}get pointsCount(){return this.Me.count}getPoint(t){return this.Me.r[t]}setPoint(t,e){this.Me.setElt(t,e)}setPointAt(t,e,i){this.Me.setElt(t,new P(e,i))}insertPoint(t,e){this.Me.insertAt(t,e)}insertPointAt(t,e,i){this.Me.insertAt(t,new P(e,i))}addPoint(t){this.Me.add(t)}addPointAt(t,e){this.Me.add(new P(t,e))}removePoint(t){this.Me.removeAt(t)}clearPoints(){this.Me.clear()}xr(t,e){if(t===0&&e===0)return;if(this.pointsCount===0){this.defaultFromPoint.isReal()&&this.defaultFromPoint.offset(t,e),this.defaultToPoint.isReal()&&this.defaultToPoint.offset(t,e);return}let i=this.Fi,s=new q,n=this.Me.iterator;for(;n.next();){let a=n.value;s.add(new P(a.x+t,a.y+e).k())}s.k();let o=this.Me;this.Me=s;let r=this.diagram;isNaN(t)||isNaN(e)||r!==null&&r.animationManager.ke?this.f():(this.sn.e(this.sn.x+t,this.sn.y+e),this.ct.e(this.ct.x+t,this.ct.y+e),this.Pf()),i?this.dk():(this.defaultFromPoint.isReal()&&(this.defaultFromPoint=this.getPoint(0)),this.defaultToPoint.isReal()&&(this.defaultToPoint=this.getPoint(this.pointsCount-1))),r!==null&&r.animationManager.ke&&r.animationManager.LM(this,s),this.t("points",o,s)}startRoute(){this.pl===null&&(this.pl=this.Me,this.Me=this.Me.copy())}commitRoute(){if(this.pl===null)return;let t=this.pl,e=this.Me;this.pl=null;let i=this.diagram;i!==null&&i.animationManager.ke&&i.animationManager.LM(this,e),this.ai(),this.dk(),this.t("points",t,e)}rollbackRoute(){this.pl!==null&&(this.Me=this.pl,this.pl=null,this.AC(this.yl))}DR(){this.Ar!==null&&(this.points=this.Ar,this.Ar=null)}dk(){if(this.Me.count===0){this.Fi=!1;return}this.Fi=!0,this.AC(this.yl),this.$h=null,this.uk=NaN,this.defaultFromPoint=this.getPoint(0),this.defaultToPoint=this.getPoint(this.pointsCount-1),this.gk(!1)}invalidateRoute(){this.$t()}$t(){if(this.suspendsRouting)return;let t=this.path;if(t===null)return;let e=this.diagram;if(e){if(e.ib.has(this)||e.undoManager.isUndoingRedoing)return;let i=e.animationManager;if(i.isTicking&&!i.isAnimating)return;this.Ar!==null&&!i.isTicking&&(this.Ar=null)}this.Fi=!1,this.f(),t.f()}get Fi(){return(this.St&16)!==0}set Fi(t){(this.St&16)!==0!==t&&(this.St=this.St^16)}get suspendsRouting(){return(this.St&32)!==0}set suspendsRouting(t){(this.St&32)!==0!==t&&(this.St=this.St^32)}get $y(){return(this.St&64)!==0}set $y(t){(this.St&64)!==0!==t&&(this.St=this.St^64)}get TC(){return(this.St&512)!==0}set TC(t){(this.St&512)!==0!==t&&(this.St=this.St^512)}get defaultFromPoint(){return this.yC}set defaultFromPoint(t){this.yC=t&&t.isReal()?t.copy():P.gn}get defaultToPoint(){return this.wC}set defaultToPoint(t){this.wC=t&&t.isReal()?t.copy():P.gn}updateRoute(){if(this.Fi||this.$y)return;let t=!0;try{this.$y=!0,this.startRoute(),t=this.computePoints()}catch{this.$y=!1,this.rollbackRoute()}finally{this.$y=!1,t?this.commitRoute():this.rollbackRoute()}}computePoints(){let t=this.diagram;if(t===null)return!1;let e=this.fromNode,i=null;if(e===null?(j.Zh||(j.Zh=new $,j.Zh.desiredSize=st.bc,j.Zh.ensureBounds()),this.defaultFromPoint.isReal()&&(j.Zh.location=this.defaultFromPoint,j.Zh.ensureBounds(),e=j.Zh,i=j.Zh)):i=this.fromPort,i!==null&&!e.isVisible()){let p=e.findVisibleNode();p!==null&&p!==e?(e=p,i=p.port):e=p}if(this.xC=e,e===null||!e.location.isReal()||i===null||(i=e.findVisiblePort(i),i===null))return!1;let s=this.toNode,n=null;if(s===null?(j.Qh||(j.Qh=new $,j.Qh.desiredSize=st.bc,j.Qh.ensureBounds()),this.defaultToPoint.isReal()&&(j.Qh.location=this.defaultToPoint,j.Qh.ensureBounds(),s=j.Qh,n=j.Qh)):n=this.toPort,n!==null&&!s.isVisible()){let p=s.findVisibleNode();p!==null&&p!==s?(s=p,n=p.port):s=p}if(this.bC=s,s===null||!s.location.isReal()||n===null||(n=s.findVisiblePort(n),n===null))return!1;let o=this.pointsCount,r=this.computeSpot(!0,i),a=this.computeSpot(!1,n),h=this.wl(r),l=this.wl(a),u=i===n&&i!==null,c=this.isOrthogonal,d=this.curve===9;u&&!c?(d=!0,this._o=!0):this._o=!1;let f=this.computeAdjusting()===0||u;if(!c&&!u&&h&&l){let p=!1;if(!f&&o>=3){let g=this.getLinkPoint(e,i,r,!0,!1,s,n),y=this.getLinkPoint(s,n,a,!1,!1,e,i);p=this.adjustPoints(0,g,o-1,y),p&&(g=this.getLinkPoint(e,i,r,!0,!1,s,n),y=this.getLinkPoint(s,n,a,!1,!1,e,i),this.adjustPoints(0,g,o-1,y))}p||(this.clearPoints(),d?this.NE(e,i,r,s,n,a):this.CE(e,i,r,s,n,a))}else{let p=u?this.computeCurviness():0;f&&(c&&this.isAvoiding||u)&&this.clearPoints();let g=this.getLinkPoint(e,i,r,!0,c,s,n),y=this.getLinkPoint(s,n,a,!1,c,e,i),b=0,v=0,w=0;if(c||!h||u){w=this.getLinkDirection(e,i,g,r,!0,c,s,n);let M=this.mk(e,i,r,!0,w);if(u&&(h||r.equals(a)||!c&&r.x+a.x===1&&r.y+a.y===1)&&(w-=c?90:j.ov,p<0&&(w-=180)),w=C.Ee(w),u&&(M+=Math.abs(p)*(c?1:2)),w===0?b=M:w===90?v=M:w===180?b=-M:w===270?v=-M:(b=M*Math.cos(w*Math.PI/180),v=M*Math.sin(w*Math.PI/180)),r.isNoSpot()&&u){let A=i.getDocumentPoint(T.Center,P.l()),F=P.z(A.x+b*j.Yf,A.y+v*j.Yf);this.getLinkPointFromPoint(e,i,A,F,!0,g),P.i(A),P.i(F)}}let k=0,S=0,N=0;if(c||!l||u){N=this.getLinkDirection(s,n,y,a,!1,c,e,i);let M=this.mk(s,n,a,!1,N);if(u&&(l||r.equals(a)||!c&&r.x+a.x===1&&r.y+a.y===1)&&(N+=c?0:j.rv,p<0&&(N+=180)),N=C.Ee(N),u&&(M+=Math.abs(p)*(c?1:2)),N===0?k=M:N===90?S=M:N===180?k=-M:N===270?S=-M:(k=M*Math.cos(N*Math.PI/180),S=M*Math.sin(N*Math.PI/180)),a.isNoSpot()&&u){let A=n.getDocumentPoint(T.Center,P.l()),F=P.z(A.x+k*j.Yf,A.y+S*j.Yf);this.getLinkPointFromPoint(s,n,A,F,!1,y),P.i(A),P.i(F)}}let D=g;(c||!h||u)&&(D=new P(g.x+b,g.y+v));let L=y;(c||!l||u)&&(L=new P(y.x+k,y.y+S)),!f&&!c&&h&&o>3&&this.adjustPoints(0,g,o-2,L)?this.setPoint(o-1,y):!f&&!c&&l&&o>3&&this.adjustPoints(1,D,o-1,y)?this.setPoint(0,g):!f&&(c?o>=6:o>4)&&this.adjustPoints(1,D,o-2,L)?(this.setPoint(0,g),this.setPoint(o-1,y)):(this.clearPoints(),this.addPoint(g),(c||!h||u)&&this.addPoint(D),c&&this.addOrthoPoints(D,w,L,N,e,s),(c||!l||u)&&this.addPoint(L),this.addPoint(y))}return t.addInvalidRoute(this),!0}DC(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?(e.x>=t.x?e.x=t.x+9e9:e.x=t.x-9e9,e.y=t.y):(e.y>=t.y?e.y=t.y+9e9:e.y=t.y-9e9,e.x=t.x),e}getLinkPointFromPoint(t,e,i,s,n,o){if(o===void 0&&(o=new P),t===null||e===null)return o.h(i),o;if(!t.isVisible()){let d=t.findVisibleNode();d!==null&&d!==t&&(t=d,e=t.port)}let r=0,a=0,h=0,l=0,u=null,c=e.panel;if(c!==null&&!c.Mn()&&(c=c.panel),c===null)r=s.x,a=s.y,h=i.x,l=i.y;else{u=c.Ws;let d=1/(u.m11*u.m22-u.m12*u.m21),f=u.m22*d,p=-u.m12*d,g=-u.m21*d,y=u.m11*d,b=d*(u.m21*u.dy-u.m22*u.dx),v=d*(u.m12*u.dx-u.m11*u.dy);r=s.x*f+s.y*g+b,a=s.x*p+s.y*y+v,h=i.x*f+i.y*g+b,l=i.x*p+i.y*y+v}return e.pf(r,a,h,l,o),u!==null&&o.v(u),o}LE(t,e){let i=t.wd;return i!==null?i.uv(e):null}pk(t){if(t===null)return null;let e=t.wd;return e===null&&(e=new Ji(t.part,t),t.wd=e),e.uv(this)}getLinkPoint(t,e,i,s,n,o,r,a){if(a===void 0&&(a=new P),i.isSpot()&&!this.wl(i))return e.getDocumentPoint(i,a),a;if(i.isSide()){let u=this.pk(e);if(u!==null){let c=u.tc;if(a.h(c),n&&this.routing===7){let d=this.pk(r);if(d!==null&&u.Kf<d.Kf){let f=P.l(),p=P.l(),g=I.l();e.getDocumentPoint(T.TopLeft,f),e.getDocumentPoint(T.BottomRight,p);let y=f.x,b=f.y,v=p.x,w=p.y;g.x=Math.min(y,v),g.y=Math.min(b,w),g.width=Math.abs(y-v),g.height=Math.abs(b-w);let k=this.computeSpot(!s,r),S=this.getLinkPoint(o,r,k,!s,n,t,e,p);(i.includesSide(T.LeftSide)||i.includesSide(T.RightSide))&&S.y>=g.y&&S.y<=g.y+g.height?a.y=S.y:(i.includesSide(T.TopSide)||i.includesSide(T.BottomSide))&&S.x>=g.x&&S.x<=g.x+g.width&&(a.x=S.x),I.i(g),P.i(f),P.i(p)}}return a}}let h=e.getDocumentPoint(this.sg(i,s),P.l()),l=P.l();if(this.pointsCount>(n?6:2))l.h(s?this.getPoint(1):this.getPoint(this.pointsCount-2)),n&&this.DC(h,l);else if(t?.isMemberOf(o)||o?.isMemberOf(t)){let u=e.getDocumentBounds(I.l()),c=r.getDocumentBounds(I.l());u.isReal()&&c.isReal()?c.containsRect(u)?(l.h(h),this.vC(c,h.x,h.y,0,this.computeSpot(r===this.toPort,r),l)):u.containsRect(c)?(r.getDocumentPoint(T.Center,l),this.vC(u,l.x,l.y,0,this.computeSpot(e===this.toPort,e),l)):this.FC(r,h,s,n,l):this.FC(r,h,s,n,l),I.i(u),I.i(c)}else this.FC(r,h,s,n,l);return this.getLinkPointFromPoint(t,e,h,l,s,a),P.i(l),P.i(h),a}FC(t,e,i,s,n){let o=this.computeSpot(!i,t);t.getDocumentPoint(this.sg(o,!i),n),s&&this.DC(e,n)}getLinkDirection(t,e,i,s,n,o,r,a){let h=this.AE(t,e,i,s,n,o,r,a);if(t&&r){let u=I.l(),c=I.l();if(s.isNone()&&t.isMemberOf(r)&&e&&a){if(e.getDocumentBounds(u),a.getDocumentBounds(c),u.isReal()&&c.isReal()&&c.containsRect(u)){let d=this.computeSpot(a===this.toPort,a);d.equals(T.Left)||d.equals(T.LeftSide)?h=180:d.equals(T.Right)||d.equals(T.RightSide)?h=0:d.equals(T.Top)||d.equals(T.TopSide)?h=270:d.equals(T.Bottom)||d.equals(T.BottomSide)?h=90:h=C.Ee(h+180)}}else r?.isMemberOf(t)&&e&&a&&(e.getDocumentBounds(u),a.getDocumentBounds(c),u.isReal()&&c.isReal()&&u.containsRect(c)&&(h=C.Ee(h+180)));I.i(u),I.i(c)}if(this.wl(s)||e===null)return h;let l=e.getDocumentAngle();return l===0?h:(45<=l&&l<135?h+=90:135<=l&&l<225?h+=180:225<=l&&l<315&&(h+=270),C.Ee(h))}AE(t,e,i,s,n,o,r,a){if(s.isSpot())return C.$w(null,s.x,s.y);if(s.isSide()){let c=this.pk(e);if(c!==null)switch(c.fi){case 1:return 270;case 8:return 90;case 2:return 180;default:return 0}else return s.includesSide(T.TopSide)?270:s.includesSide(T.BottomSide)?90:s.includesSide(T.LeftSide)?180:0}if(e===null||a===null)return 0;let h=e.getDocumentPoint(T.Center,P.l()),l=P.l();this.pointsCount>(o?6:2)?o?(l.h(n?this.getPoint(1):this.getPoint(this.pointsCount-2)),this.DC(h,l)):l.h(i):a.getDocumentPoint(T.Center,l);let u=0;return Math.abs(l.x-h.x)>Math.abs(l.y-h.y)?l.x>=h.x?u=0:u=180:l.y>=h.y?u=90:u=270,P.i(l),P.i(h),u}computeEndSegmentLength(t,e,i,s){return this.mk(t,e,i,s,NaN)}mk(t,e,i,s,n){if(e!==null&&i.isSide()){let r=this.pk(e);if(r!==null)return r.yk}let o=NaN;if(s?o=this.fromEndSegmentLength:o=this.toEndSegmentLength,e!==null&&isNaN(o))if(n===void 0&&(n=NaN),j.NC>0&&this.computeCurve()===9&&!isNaN(n)&&i.isSpot()){let r=this.getOtherPort(e);if(r){let a=P.l(),h=P.l(),l=e.getDocumentPoint(i,a),u=r.getDocumentPoint(i.opposite(),h),c=n>=315||n<=45||n>=135&&n<=225,d=Math.abs(c?l.x-u.x:l.y-u.y)/j.NC;return d=Math.max(d,j.CC),P.i(a),P.i(h),d}}else s?o=e.fromEndSegmentLength:o=e.toEndSegmentLength;return isNaN(o)&&(o=j.CC),o}computeSpot(t,e){return e===void 0&&(e=null),t?this.TE(e||this.fromPort):this.DE(e||this.toPort)}TE(t){if(t===null)return T.Center;let e=this.fromSpot;return e.isDefault()&&(e=t.fromSpot),e===T.Default?T.None:e}DE(t){if(t===null)return T.Center;let e=this.toSpot;return e.isDefault()&&(e=t.toSpot),e===T.Default?T.None:e}wl(t){return t===T.None||t.x===.5&&t.y===.5}sg(t,e){return t.x===.5&&t.y===.5?t:T.Center}computeOtherPoint(t,e){if(this.computeAdjusting()!==0&&this.pointsCount>4)return this.computeMidPoint(new P);{let i=this.LE(e,this);if(i!==null)return i.tc;if(t instanceof ht){let s=this.fromNode,n=this.fromPort;n===e&&(s=this.toNode,n=this.toPort);let o=I.l(),r=I.l();if(n&&s?.isMemberOf(t)){let a=this.computeSpot(n===e,e);if(e.getDocumentBounds(o),n.getDocumentBounds(r),o.isReal()&&r.isReal()&&o.containsRect(r)){let h=n.getDocumentPoint(T.Center);return this.vC(o,h.x,h.y,0,a,h),I.i(o),I.i(r),h}}I.i(o),I.i(r)}return e.getDocumentPoint(T.Center)}}computeShortLength(t){if(t){let e=this.fromShortLength;if(isNaN(e)){let i=this.fromPort;i!==null&&(e=i.fromShortLength)}return isNaN(e)?0:e}else{let e=this.toShortLength;if(isNaN(e)){let i=this.toPort;i!==null&&(e=i.toShortLength)}return isNaN(e)?0:e}}Wm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r;if(o===void 0?(r=Nt.l(),r.Ue()):r=o,r.kc(this.v),this.containedInRect(t,r))return this.WN(e,i,n),o===void 0&&Nt.i(r),!0;if(this.intersectsRect(t,r)){let a=!1;if(!this.Tf){let h=this.D.r,l=h.length;for(let u=l;u--;){let c=h[u];if(!c.visible&&c!==this.locationObject)continue;let d=c.actualBounds,f=this.naturalBounds;if(d.x>f.width||d.y>f.height||d.x+d.width<0||d.y+d.height<0)continue;let p=c,g=Nt.l();if(g.set(r),p instanceof G?a=p.Wm(t,e,i,s,n,g):this.path===p?p instanceof et&&(a=p.sE(t,s,g)):a=p.JT(t,s,g),a){let y=p;e!==null&&(y=e(p)),y&&(i===null||i(y))&&n.add(y)}Nt.i(g)}}return o===void 0&&Nt.i(r),a||this.background!==null}return o===void 0&&Nt.i(r),!1}get isOrthogonal(){return(this.Jh&2)===2}static SC(t){return(t&2)===2}get isAvoiding(){return(this.Jh&4)===4}computeCurve(){if(this._o===null){let t=this.fromPort,e=t!==null&&t===this.toPort,i=this.isOrthogonal;this._o=e&&!i}return this._o?9:this.curve}computeCorner(){if(this.curve===9)return 0;let t=this.corner;return(isNaN(t)||t<0)&&(t=j.lv),t}findMidLabel(){let t=this.path,e=this.D.r,i=e.length;for(let n=0;n<i;n++){let o=e[n];if(!(o===t||o.isPanelMain)&&(o.segmentIndex===-1/0||isNaN(o.segmentIndex)))return o}let s=this.labelNodes;for(;s.next();){let n=s.value;if(n.segmentIndex===-1/0||isNaN(n.segmentIndex))return n}return null}computeSpacing(){if(!this.isVisible())return 0;let t=j.av;t=Math.max(t,this.computeThickness());let e=this.fromPort,i=this.toPort;if(e!==null&&i!==null){let s=this.findMidLabel();if(s!==null){let n=s.naturalBounds,o=s.margin,r=isNaN(n.width)?j.hv:n.width*s.scale+o.left+o.right,a=isNaN(n.height)?j.cv:n.height*s.scale+o.top+o.bottom,h=s.segmentOrientation;if(h===21||h===25||h===24)t=Math.max(t,a);else if(h===23||h===27||h===22||h===26)t=Math.max(t,r);else{let l=e.getDocumentPoint(T.Center).directionPoint(i.getDocumentPoint(T.Center))/180*Math.PI;t=Math.max(t,Math.abs(Math.sin(l)*r)+Math.abs(Math.cos(l)*a)+1)}this.curve===9&&(t*=j.sv)}}return t}arrangeBundledLinks(t,e){if(e)for(let i=0;i<t.length;i++){let s=t[i];s.computeAdjusting()===0&&s.$t()}}computeCurviness(){let t=this.curviness;if(isNaN(t)){t=j.ev;let e=this.tr;if(e!==null){let i=m.st(),s=0,n=e.on;for(let r=0;r<n.length;r++){let a=n[r].computeSpacing();i.push(a),s+=a}let o=-s/2;for(let r=0;r<n.length;r++){if(n[r]===this){t=o+i[r]/2;break}o+=i[r]}e.By===this.fromNode&&(t=-t),m.Z(i)}}return t}computeThickness(){if(!this.isVisible())return 0;let t=this.path;return t!==null?Math.max(t.strokeWidth,1):1}hasCurviness(){return!isNaN(this.curviness)||this.tr!==null}CE(t,e,i,s,n,o){let r=this.getLinkPoint(t,e,i,!0,!1,s,n),a=this.getLinkPoint(s,n,o,!1,!1,t,e);if(this.dv(t,e,i,r,s,n,o,a),this.addPoint(r),this.addPoint(a),this.hasCurviness()){let h=a.x-r.x,l=a.y-r.y,u=this.computeCurviness(),c=u,d=r.x+h/2,f=r.y+l/2,p=d,g=f;if(C.c(l,0))h>0?g-=c:g+=c;else{let y=-h/l,b=Math.sqrt(c*c/(y*y+1));u<0&&(b=-b),p=(l<0?-1:1)*b+d,g=y*(p-d)+f}this.insertPointAt(1,p,g)}}dv(t,e,i,s,n,o,r,a){let h=o.getDocumentBounds(I.l()),l=e.getDocumentBounds(I.l());if(h.intersectsRect(l)&&!h.containsRect(l)&&!l.containsRect(h)){let u=P.l();e.getDocumentPoint(this.sg(i,!0),u);let c=P.l();o.getDocumentPoint(this.sg(r,!1),c);let d=l.width*l.height,f=h.width*h.height;d>f?(s.h(u),this.getLinkPointFromPoint(n,o,c,u,!1,c),a.h(c)):d<f?(this.getLinkPointFromPoint(t,e,u,c,!0,u),s.h(u),a.h(c)):(s.h(u),a.h(c)),P.i(u),P.i(c)}else if(h.containsPoint(s)){let u=P.l();e.getDocumentPoint(this.sg(i,!0),u),a.h(u),this.RC(h,u.x,u.y,j.Yf,a),this.getLinkPointFromPoint(n,o,h.containsPoint(u)?u:s,a,!1,a),this.getLinkPointFromPoint(t,e,u,a,!0,s),P.i(u)}else if(l.containsPoint(a)){let u=P.l();o.getDocumentPoint(this.sg(r,!1),u),s.h(u),this.RC(l,u.x,u.y,j.Yf,s),this.getLinkPointFromPoint(t,e,l.containsPoint(u)?u:a,s,!0,s),this.getLinkPointFromPoint(n,o,u,s,!1,a),P.i(u)}I.i(l),I.i(h)}vC(t,e,i,s,n,o){let r=-1;return n.equals(T.Left)||n.equals(T.LeftSide)?r=180:n.equals(T.Right)||n.equals(T.RightSide)?r=0:n.equals(T.Top)||n.equals(T.TopSide)?r=270:(n.equals(T.Bottom)||n.equals(T.BottomSide))&&(r=90),r===-1?this.RC(t,e,i,0,o):this.gv(t,e,i,0,r,o)}RC(t,e,i,s,n){let o=C.$w(t,e,i);return this.gv(t,e,i,s,o,n)}gv(t,e,i,s,n,o){return n===0?o.x=t.right+s:n===90?o.y=t.bottom+s:n===180?o.x=t.x-s:n===270?o.y=t.y-s:n===45?(o.x=t.right+s,o.y=t.bottom+s):n===135?(o.x=t.x-s,o.y=t.bottom+s):n===225?(o.x=t.x-s,o.y=t.y-s):n===315&&(o.x=t.right+s,o.y=t.y-s),o}NE(t,e,i,s,n,o){let r=this.getLinkPoint(t,e,i,!0,!1,s,n),a=this.getLinkPoint(s,n,o,!1,!1,t,e);this.dv(t,e,i,r,s,n,o,a),this.addPoint(r),this.addPoint(a);let h=a.x-r.x,l=a.y-r.y,u=this.computeCurviness(),c=0,d=0,f=r.x+h/3,p=r.y+l/3,g=f,y=p;C.c(l,0)?h>0?y-=u:y+=u:(c=-h/l,d=Math.sqrt(u*u/(c*c+1)),u<0&&(d=-d),g=(l<0?-1:1)*d+f,y=c*(g-f)+p),f=r.x+2*h/3,p=r.y+2*l/3;let b=f,v=p;C.c(l,0)?h>0?v-=u:v+=u:(b=(l<0?-1:1)*d+f,v=c*(b-f)+p),this.insertPointAt(1,g,y),this.insertPointAt(2,b,v),this.setPoint(0,this.getLinkPoint(t,e,i,!0,!1,s,n)),this.setPoint(3,this.getLinkPoint(s,n,o,!1,!1,t,e))}adjustPoints(t,e,i,s){let n=this.computeAdjusting();if(this.isOrthogonal){if(n===18)return!1;n===19&&(n=17)}switch(n){case 18:return this.vE(t,e,i,s);case 19:return this.FE(t,e,i,s);case 17:return this.RE(t,e,i,s);default:return!1}}vE(t,e,i,s){let n=this.getPoint(t),o=this.getPoint(i);if(n.equalsApprox(e)&&o.equalsApprox(s))return!0;let r=n.x,a=n.y,h=o.x,l=o.y,u=h-r,c=l-a,d=Math.sqrt(u*u+c*c);if(C.X(d,0))return!0;let f=0;C.X(u,0)?c<0?f=-Math.PI/2:f=Math.PI/2:(f=Math.atan(c/Math.abs(u)),u<0&&(f=Math.PI-f));let p=e.x,g=e.y,y=s.x,b=s.y,v=y-p,w=b-g,k=Math.sqrt(v*v+w*w),S=0;C.X(v,0)?w<0?S=-Math.PI/2:S=Math.PI/2:(S=Math.atan(w/Math.abs(v)),v<0&&(S=Math.PI-S));let N=k/d,D=S-f;this.setPoint(t,e);for(let L=t+1;L<i;L++){let M=this.getPoint(L);u=M.x-r,c=M.y-a;let A=Math.sqrt(u*u+c*c);if(C.X(A,0))continue;let F=0;C.X(u,0)?c<0?F=-Math.PI/2:F=Math.PI/2:(F=Math.atan(c/Math.abs(u)),u<0&&(F=Math.PI-F));let O=F+D,E=A*N,B=p+E*Math.cos(O),X=g+E*Math.sin(O);this.setPointAt(L,B,X)}return this.setPoint(i,s),!0}FE(t,e,i,s){let n=this.getPoint(t),o=this.getPoint(i);if(n.equalsApprox(e)&&o.equalsApprox(s))return!0;let r=n.x,a=n.y,h=o.x,l=o.y,u=(h-r)**2+(l-a)**2,c=e.x,d=e.y,f=s.x,p=s.y,g=0,y=1;f-c!==0?(g=(p-d)/(f-c),y=Math.sqrt(1+1/(g*g))):g=9e9,this.setPoint(t,e);for(let b=t+1;b<i;b++){let v=this.getPoint(b),w=v.x,k=v.y,S=.5;u!==0&&(S=((r-w)*(r-h)+(a-k)*(a-l))/u);let N=r+S*(h-r),D=a+S*(l-a),L=Math.sqrt((w-N)**2+(k-D)**2);k<g*(w-N)+D&&(L=-L),g>0&&(L=-L);let M=c+S*(f-c),A=d+S*(p-d);if(g!==0){let F=M+L/y,O=A-(F-M)/g;this.setPointAt(b,F,O)}else this.setPointAt(b,M,A+L)}return this.setPoint(i,s),!0}RE(t,e,i,s){if(this.isOrthogonal){let n=this.getPoint(t),o=this.getPoint(t+1),r=this.getPoint(t+2),a=o.x,h=o.y,l=a,u=h;C.c(n.y,o.y)?C.c(o.x,r.x)?h=e.y:C.c(o.y,r.y)&&(a=e.x):C.c(n.x,o.x)&&(C.c(o.y,r.y)?a=e.x:C.c(o.x,r.x)&&(h=e.y)),this.setPointAt(t+1,a,h),n=this.getPoint(i),o=this.getPoint(i-1),r=this.getPoint(i-2);let c=o.x,d=o.y,f=c,p=d;if(C.c(n.y,o.y)?C.c(o.x,r.x)?d=s.y:C.c(o.y,r.y)&&(c=s.x):C.c(n.x,o.x)&&(C.c(o.y,r.y)?c=s.x:C.c(o.x,r.x)&&(d=s.y)),this.setPointAt(i-1,c,d),this.yT())return this.setPointAt(t+1,l,u),this.setPointAt(i-1,f,p),!1}return this.setPoint(t,e),this.setPoint(i,s),!0}addOrthoPoints(t,e,i,s,n,o){e=C.Ee(e),s=C.Ee(s);let r=s;e>=315||e<45?e=0:45<=e&&e<135?e=90:135<=e&&e<225?e=180:e=270,s>=315||s<45?s=0:45<=s&&s<135?s=90:135<=s&&s<225?s=180:s=270;let a=t,h=i,l=I.bs(n.actualBounds),u=I.bs(o.actualBounds);l.inflate(j.Fa,j.Fa),u.inflate(j.Fa,j.Fa),l.unionPoint(t),u.unionPoint(i);let c=P.l(),d=P.l();e===0?h.x>a.x||s===270&&h.y<a.y&&u.right>a.x||s===90&&h.y>a.y&&u.right>a.x?(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),s===180?(c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1),d.x=c.x,d.y=h.y):s===270&&h.y<a.y||s===90&&h.y>a.y?(a.x<u.left?c.x=this.computeMidOrthoPosition(a.x,a.y,u.left,h.y,!1):a.x<u.right&&(s===270&&a.y<u.top||s===90&&a.y>u.bottom)?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):c.x=u.right,d.x=c.x,d.y=h.y):s===0&&a.x<u.left&&a.y>u.top&&a.y<u.bottom&&(c.x=a.x,a.y<h.y?c.y=Math.min(h.y,u.top):c.y=Math.max(h.y,u.bottom),d.y=c.y)):(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),(s===180||s===90&&h.y<l.top||s===270&&h.y>l.bottom)&&(s===180&&(u.containsPoint(a)||l.containsPoint(h))?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):h.y<a.y&&(s===180||s===90)?c.y=this.computeMidOrthoPosition(a.x,l.top,h.x,Math.min(h.y,u.bottom),!0):h.y>a.y&&(s===180||s===270)&&(c.y=this.computeMidOrthoPosition(a.x,l.bottom,h.x,Math.max(h.y,u.top),!0)),d.x=h.x,d.y=c.y),c.y>l.top&&c.y<l.bottom&&(h.x>=l.left&&h.x<=a.x||a.x<=u.right&&a.x>=h.x?(s===90||s===270)&&(c.e(Math.max((a.x+h.x)/2,a.x),a.y),d.e(c.x,h.y)):(s===270||(s===0||s===180)&&h.y<a.y?c.y=Math.min(h.y,s===0?l.top:Math.min(l.top,u.top)):c.y=Math.max(h.y,s===0?l.bottom:Math.max(l.bottom,u.bottom)),d.x=h.x,d.y=c.y))):e===180?h.x<a.x||s===270&&h.y<a.y&&u.left<a.x||s===90&&h.y>a.y&&u.left<a.x?(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),s===0?(c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1),d.x=c.x,d.y=h.y):s===270&&h.y<a.y||s===90&&h.y>a.y?(a.x>u.right?c.x=this.computeMidOrthoPosition(a.x,a.y,u.right,h.y,!1):a.x>u.left&&(s===270&&a.y<u.top||s===90&&a.y>u.bottom)?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):c.x=u.left,d.x=c.x,d.y=h.y):s===180&&a.x>u.right&&a.y>u.top&&a.y<u.bottom&&(c.x=a.x,a.y<h.y?c.y=Math.min(h.y,u.top):c.y=Math.max(h.y,u.bottom),d.y=c.y)):(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),(s===0||s===90&&h.y<l.top||s===270&&h.y>l.bottom)&&(s===0&&(u.containsPoint(a)||l.containsPoint(h))?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):h.y<a.y&&(s===0||s===90)?c.y=this.computeMidOrthoPosition(a.x,l.top,h.x,Math.min(h.y,u.bottom),!0):h.y>a.y&&(s===0||s===270)&&(c.y=this.computeMidOrthoPosition(a.x,l.bottom,h.x,Math.max(h.y,u.top),!0)),d.x=h.x,d.y=c.y),c.y>l.top&&c.y<l.bottom&&(h.x<=l.right&&h.x>=a.x||a.x>=u.left&&a.x<=h.x?(s===90||s===270)&&(c.e(Math.min((a.x+h.x)/2,a.x),a.y),d.e(c.x,h.y)):(s===270||(s===0||s===180)&&h.y<a.y?c.y=Math.min(h.y,s===180?l.top:Math.min(l.top,u.top)):c.y=Math.max(h.y,s===180?l.bottom:Math.max(l.bottom,u.bottom)),d.x=h.x,d.y=c.y))):e===90?h.y>a.y||s===180&&h.x<a.x&&u.bottom>a.y||s===0&&h.x>a.x&&u.bottom>a.y?(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),s===270?(c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0),d.x=h.x,d.y=c.y):s===180&&h.x<a.x||s===0&&h.x>a.x?(a.y<u.top?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,u.top,!0):a.y<u.bottom&&(s===180&&a.x<u.left||s===0&&a.x>u.right)?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):c.y=u.bottom,d.x=h.x,d.y=c.y):s===90&&a.y<u.top&&a.x>u.left&&a.x<u.right&&(a.x<h.x?c.x=Math.min(h.x,u.left):c.x=Math.max(h.x,u.right),c.y=a.y,d.x=c.x)):(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),(s===270||s===0&&h.x<l.left||s===180&&h.x>l.right)&&(s===270&&(u.containsPoint(a)||l.containsPoint(h))?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):h.x<a.x&&(s===270||s===0)?c.x=this.computeMidOrthoPosition(l.left,a.y,Math.min(h.x,u.right),h.y,!1):h.x>a.x&&(s===270||s===180)&&(c.x=this.computeMidOrthoPosition(l.right,a.y,Math.max(h.x,u.left),h.y,!1)),d.x=c.x,d.y=h.y),c.x>l.left&&c.x<l.right&&(h.y>=l.top&&h.y<=a.y||a.y<=u.bottom&&a.y>=h.y?(s===0||s===180)&&(c.e(a.x,Math.max((a.y+h.y)/2,a.y)),d.e(h.x,c.y)):(s===180||(s===90||s===270)&&h.x<a.x?c.x=Math.min(h.x,s===90?l.left:Math.min(l.left,u.left)):c.x=Math.max(h.x,s===90?l.right:Math.max(l.right,u.right)),d.x=c.x,d.y=h.y))):h.y<a.y||s===180&&h.x<a.x&&u.top<a.y||s===0&&h.x>a.x&&u.top<a.y?(c.e(a.x,h.y),d.e((a.x+h.x)/2,h.y),s===90?(c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0),d.x=h.x,d.y=c.y):s===180&&h.x<a.x||s===0&&h.x>=a.x?(a.y>u.bottom?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,u.bottom,!0):a.y>u.top&&(s===180&&a.x<u.left||s===0&&a.x>u.right)?c.y=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!0):c.y=u.top,d.x=h.x,d.y=c.y):s===270&&a.y>u.bottom&&a.x>u.left&&a.x<u.right&&(a.x<h.x?c.x=Math.min(h.x,u.left):c.x=Math.max(h.x,u.right),c.y=a.y,d.x=c.x)):(c.e(h.x,a.y),d.e(h.x,(a.y+h.y)/2),(s===90||s===0&&h.x<l.left||s===180&&h.x>l.right)&&(s===90&&(u.containsPoint(a)||l.containsPoint(h))?c.x=this.computeMidOrthoPosition(a.x,a.y,h.x,h.y,!1):h.x<a.x&&(s===90||s===0)?c.x=this.computeMidOrthoPosition(l.left,a.y,Math.min(h.x,u.right),h.y,!1):h.x>a.x&&(s===90||s===180)&&(c.x=this.computeMidOrthoPosition(l.right,a.y,Math.max(h.x,u.left),h.y,!1)),d.x=c.x,d.y=h.y),c.x>l.left&&c.x<l.right&&(h.y<=l.bottom&&h.y>=a.y||a.y>=u.top&&a.y<=h.y?(s===0||s===180)&&(c.e(a.x,Math.min((a.y+h.y)/2,a.y)),d.e(h.x,c.y)):(s===180||(s===90||s===270)&&h.x<a.x?c.x=Math.min(h.x,s===270?l.left:Math.min(l.left,u.left)):c.x=Math.max(h.x,s===270?l.right:Math.max(l.right,u.right)),d.x=c.x,d.y=h.y))),this.TC=s!==r,this.kC=e,this.PC=s,this.addPoint(c.copy()),this.addPoint(d.copy()),P.i(c),P.i(d),I.i(l),I.i(u)}computeMidOrthoPosition(t,e,i,s,n){let o=0;return this.hasCurviness()&&!this.computeSpot(!0,this.fromPort).isSide()&&!this.computeSpot(!1,this.toPort).isSide()&&(o=this.computeCurviness()),n?(e+s)/2+o:(t+i)/2+o}yT(){if(this.diagram===null||!this.isAvoiding||this.diagram.animationManager.isTicking)return!1;let t=this.points.r,e=t.length;if(e<4)return!1;let i=this.diagram.getPositions(!1,this.containingGroup,null);for(let s=1;s<e-2;s++){let n=t[s],o=t[s+1];if(!i.isUnoccupied(Math.min(n.x,o.x),Math.min(n.y,o.y),Math.abs(n.x-o.x),Math.abs(n.y-o.y)))return!0}return!1}findClosestSegment(t){let e=t.x,i=t.y,s=this.getPoint(0),n=this.getPoint(1),o=P.distanceLineSegmentSquared(e,i,s.x,s.y,n.x,n.y),r=0;for(let a=1;a<this.pointsCount-1;a++){s=this.getPoint(a+1);let h=P.distanceLineSegmentSquared(e,i,n.x,n.y,s.x,s.y);n=s,h<o&&(r=a,o=h)}return r}invalidateGeometry(){this.ai()}ai(){this.Ra&&(this.Ra=!1,this.f())}get Ra(){return(this.St&128)!==0}set Ra(t){(this.St&128)!==0!==t&&(this.St=this.St^128)}get geometry(){if(!this.Ra){if(this.updateRoute(),this.pointsCount<2)return this.Ra=!0,this.ut;this.ut=this.makeGeometry(),this.Ra=!0}return this.ut}Dd(t){if(!t){if(this.Fi===!1)return;let n=this.findMainElement();if(this.Ra&&(n===null||n.geometry!==null))return}this.pointsCount>=2&&(this.ut=this.makeGeometry()),this.Ra=!0;let e=this.path;if(e===null)return;e.ut=this.ut;let i=this.D.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o!==e&&o.isPanelMain&&o instanceof et&&(o.ut=this.ut)}}OE(t){return this._h()&&t.ra.has(this)&&(this.yl.width!==0||this.yl.height!==0)&&(t.animationManager.isAnimating||t.currentTool!==t.toolManager)}makeGeometry(){let t=this.ut,e=this.pointsCount,i=!1,s=this.diagram;s!==null&&this.OE(s)&&(i=!0);let n=0,o=0,r=P.bs(this.getPoint(0)),a=P.bs(r),h=this.Me.r,l=this.computeCurve();if(l===9&&e>=3&&!C.X(this.smoothness,0))if(e===3){let u=this.getPoint(1);n=Math.min(r.x,u.x),o=Math.min(r.y,u.y),u=this.getPoint(2),n=Math.min(n,u.x),o=Math.min(o,u.y)}else if(this.isOrthogonal){for(let u=0;u<e;u++){let c=h[u];a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y)}n=a.x,o=a.y}else{for(let u=3;u<e;u+=3){u+3>=e&&(u=e-1);let c=this.getPoint(u);a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y)}n=a.x,o=a.y}else{for(let u=0;u<e;u++){let c=h[u];a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y)}n=a.x,o=a.y}if(n-=this.fk.x,o-=this.fk.y,r.x-=n,r.y-=o,this.computeShortLength(!0)!==0&&(r=this.ec(r,!0,a)),e===2&&!this._h()){let u=P.bs(this.getPoint(1));return u.x-=n,u.y-=o,this.computeShortLength(!1)!==0&&(u=this.ec(u,!1,a)),t.type=1,t.startX=r.x,t.startY=r.y,t.endX=u.x,t.endY=u.y,P.i(u),P.i(r),P.i(a),t}else{t.type=4;let u=Ce.jL(t);if(u.Au(r.x,r.y,!1,!1),l===9&&e>=3&&!C.X(this.smoothness,0))if(e===3){let c=this.getPoint(1),d=c.x-n,f=c.y-o,p=P.bs(this.getPoint(2));p.x-=n,p.y-=o,this.computeShortLength(!1)!==0&&this.ec(p,!1,a),u.pr(d,f,d,f,p.x,p.y),P.i(p)}else if(this.isOrthogonal){let c=P.z(n,o),d=P.bs(this.getPoint(1)),f=P.z(n,o),p=P.z(n,o),g=this.getPoint(0),y,b=this.smoothness/3;for(let S=1;S<this.pointsCount-1;S++){y=this.getPoint(S);let N=g,D=y,L=this.getPoint(this.OC(y,S,!1));C.X(N.x,D.x)&&C.X(D.x,L.x)||C.X(N.y,D.y)&&C.X(D.y,L.y)||(this.IE(N,D,L,b,f,p),(S===1||S===2&&C.X(g.x,this.getPoint(0).x)&&C.X(g.y,this.getPoint(0).y))&&(d.x=(g.x+y.x)*.5,d.y=(g.y+y.y)*.5),u.pr(d.x-n,d.y-o,f.x-n,f.y-o,y.x-n,y.y-o),c.h(f),d.h(p),g=y)}let v=g.x,w=g.y,k=P.bs(this.getPoint(this.pointsCount-1));this.computeShortLength(!1)!==0&&this.ec(k,!1,P.dn),v=.5*(v+k.x),w=.5*(w+k.y),u.pr(p.x-n,p.y-o,v-n,w-o,k.x-n,k.y-o),P.i(k),P.i(c),P.i(d),P.i(f),P.i(p)}else for(let c=3;c<e;c+=3){let d=this.getPoint(c-2);c+3>=e&&(c=e-1);let f=this.getPoint(c-1),p=P.bs(this.getPoint(c));c===e-1&&this.computeShortLength(!1)!==0&&this.ec(p,!1,P.dn),u.pr(d.x-n,d.y-o,f.x-n,f.y-o,p.x-n,p.y-o),P.i(p)}else if(this.isOrthogonal||e===2){let c=P.bs(this.getPoint(0)),d=P.l(),f=P.bs(c),p=this.computeCorner(),g=1,y=0;for(;g<e;){if(g=this.OC(c,g,g>1),d.h(this.getPoint(g)),g>=e-1){if(!c.equals(d))this.computeShortLength(!1)!==0&&this.ec(d,!1,P.dn),this.Rn(u,-n,-o,c,d,i);else if(y===0)for(g=1;g<e;)f.h(c),d.h(this.getPoint(g++)),this.Rn(u,-n,-o,c,d,i),c.h(d);break}y=this.OC(d,g+1,g<e-3);let b=this.getPoint(y);this.EE(u,-n,-o,c,d,b,c,f,p,i),f.h(d),g=y}P.i(c),P.i(d),P.i(f)}else{let c=this.computeCorner();if(e>2&&c>=.5){let d=P.bs(h[e-1]);this.computeShortLength(!1)!==0&&this.ec(d,!1,P.dn),r.x+=n,r.y+=o;for(let f=1;f<e;f++){let p=f===1?r:h[f-1],g=f===e-1?d:h[f],y=Math.sqrt(p.distanceSquaredPoint(g)),b=c/y;if(b<.5){if(f>1){let v=p.x+(g.x-p.x)*b,w=p.y+(g.y-p.y)*b;u.Tu(p.x-n,p.y-o,v-n,w-o)}u.Ys(g.x+(p.x-g.x)*b-n,g.y+(p.y-g.y)*b-o)}else f>1&&u.Tu(p.x-n,p.y-o,(p.x+g.x)/2-n,(p.y+g.y)/2-o);f===e-1&&u.Ys(d.x-n,d.y-o)}P.i(d)}else if(e>=2){let d=P.bs(h[e-1]);this.computeShortLength(!1)!==0&&this.ec(d,!1,P.dn);for(let f=1;f<e-1;f++)u.Ys(h[f].x-n,h[f].y-o);u.Ys(d.x-n,d.y-o),P.i(d)}}return Ce.WL(u),P.i(r),P.i(a),t}}wk(t,e,i,s){let n=i-t;if(isNaN(n)||n===1/0||n===-1/0)return NaN;n<0&&(n=-n);let o=s-e;return isNaN(o)||o===1/0||o===-1/0?NaN:(o<0&&(o=-o),C.X(n,0)?o:C.X(o,0)?n:Math.sqrt(n*n+o*o))}IE(t,e,i,s,n,o){isNaN(s)&&(s=this.smoothness/3);let r=t.x,a=t.y,h=e.x,l=e.y,u=i.x,c=i.y,d=s*this.wk(r,a,h,l),f=s*this.wk(h,l,u,c);if(C.X(a,l)&&C.X(h,u)&&(h>r?c>l?(n.x=h-d,n.y=l-d,o.x=h+f,o.y=l+f):(n.x=h-d,n.y=l+d,o.x=h+f,o.y=l-f):c>l?(n.x=h+d,n.y=l-d,o.x=h-f,o.y=l+f):(n.x=h+d,n.y=l+d,o.x=h-f,o.y=l-f)),C.X(r,h)&&C.X(l,c)&&(l>a?u>h?(n.x=h-d,n.y=l-d,o.x=h+f,o.y=l+f):(n.x=h+d,n.y=l-d,o.x=h-f,o.y=l+f):u>h?(n.x=h-d,n.y=l+d,o.x=h+f,o.y=l-f):(n.x=h+d,n.y=l+d,o.x=h-f,o.y=l-f)),C.X(r,h)&&C.X(h,u)||C.X(a,l)&&C.X(l,c)){let p=.5*(r+u),g=.5*(a+c);n.x=p,n.y=g,o.x=p,o.y=g}}ec(t,e,i){let s=this.pointsCount;if(s<2)return t;if(e){let n=this.getPoint(1),o=n.x-i.x,r=n.y-i.y,a=this.wk(t.x,t.y,o,r);if(a===0)return t;let h=s===2?a*.5:a,l=this.computeShortLength(!0);l>h&&(l=h);let u=l*(o-t.x)/a,c=l*(r-t.y)/a;t.x+=u,t.y+=c}else{let n=this.getPoint(s-2),o=n.x-i.x,r=n.y-i.y,a=this.wk(t.x,t.y,o,r);if(a===0)return t;let h=s===2?a*.5:a,l=this.computeShortLength(!1);l>h&&(l=h);let u=l*(t.x-o)/a,c=l*(t.y-r)/a;t.x-=u,t.y-=c}return t}OC(t,e,i){let s=this.pointsCount,n=t;for(;C.X(t.x,n.x)&&C.X(t.y,n.y);){if(e>=s)return s-1;n=this.getPoint(e++)}if(!C.X(t.x,n.x)&&!C.X(t.y,n.y))return e-1;let o=n;for(;C.X(t.x,n.x)&&C.X(n.x,o.x)&&(!i||(t.y>=n.y?n.y>=o.y:n.y<=o.y))||C.X(t.y,n.y)&&C.X(n.y,o.y)&&(!i||(t.x>=n.x?n.x>=o.x:n.x<=o.x));){if(e>=s)return s-1;o=this.getPoint(e++)}return e-2}EE(t,e,i,s,n,o,r,a,h,l){if(C.c(s.y,n.y)&&C.c(n.x,o.x)){let u=Math.min(h,Math.abs(n.x-a.x)/2),c=Math.min(u,Math.abs(o.y-n.y)/2);if(u=c,C.c(u,0)){this.Rn(t,e,i,s,n,l),r.h(n);return}let d=n.x,f=n.y,p=d,g=f;n.x>s.x?(d=n.x-u,o.y>n.y?g=n.y+c:g=n.y-c):(d=n.x+u,o.y>n.y?g=n.y+c:g=n.y-c);let y=P.z(d,f);this.Rn(t,e,i,s,y,l),P.i(y),t.Tu(n.x+e,n.y+i,p+e,g+i),r.e(p,g)}else if(C.c(s.x,n.x)&&C.c(n.y,o.y)){let u=Math.min(h,Math.abs(n.y-a.y)/2),c=Math.min(u,Math.abs(o.x-n.x)/2);if(u=c,C.c(c,0)){this.Rn(t,e,i,s,n,l),r.h(n);return}let d=n.x,f=n.y,p=d,g=f;n.y>s.y?(f=n.y-u,o.x>n.x?p=n.x+c:p=n.x-c):(f=n.y+u,o.x>n.x?p=n.x+c:p=n.x-c);let y=P.z(d,f);this.Rn(t,e,i,s,y,l),P.i(y),t.Tu(n.x+e,n.y+i,p+e,g+i),r.e(p,g)}else this.Rn(t,e,i,s,n,l),r.h(n)}Rn(t,e,i,s,n,o){if(o||!this._h())t.Ys(n.x+e,n.y+i);else{let r=j.nv,a=r/2,h=[],l=0;this.isVisible()&&(l=this.UE(s,n,h));let u=s.x,c=s.y;if(l>0){if(C.c(s.y,n.y))if(s.x<n.x){let d=0;for(;d<l;){let f=Math.max(s.x,Math.min(h[d++]-a,n.x-r));t.Ys(f+e,n.y+i),u=f+e,c=n.y+i;let p=Math.min(f+r,n.x);for(;d<l;){let v=h[d];if(v<p+r)d++,p=Math.min(v+a,n.x);else break}let g=n.y-r+i,y=p+e,b=n.y+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(u,g,y,g,y,b),u=y,c=b}}else{let d=l-1;for(;d>=0;){let f=Math.min(s.x,Math.max(h[d--]+a,n.x+r));t.Ys(f+e,n.y+i),u=f+e,c=n.y+i;let p=Math.max(f-r,n.x);for(;d>=0;){let v=h[d];if(v>p-r)d--,p=Math.max(v-a,n.x);else break}let g=n.y-r+i,y=p+e,b=n.y+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(u,g,y,g,y,b),u=y,c=b}}else if(C.c(s.x,n.x))if(s.y<n.y){let d=0;for(;d<l;){let f=Math.max(s.y,Math.min(h[d++]-a,n.y-r));t.Ys(n.x+e,f+i),u=n.x+e,c=f+i;let p=Math.min(f+r,n.y);for(;d<l;){let v=h[d];if(v<p+r)d++,p=Math.min(v+a,n.y);else break}let g=n.x-r+e,y=n.x+e,b=p+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(g,c,g,b,y,b),u=y,c=b}}else{let d=l-1;for(;d>=0;){let f=Math.min(s.y,Math.max(h[d--]+a,n.y+r));t.Ys(n.x+e,f+i),u=n.x+e,c=f+i;let p=Math.max(f-r,n.y);for(;d>=0;){let v=h[d];if(v>p-r)d--,p=Math.max(v-a,n.y);else break}let g=n.x-r+e,y=n.x+e,b=p+i;this.curve===10?t.Au(y,b,!1,!1):t.pr(g,c,g,b,y,b),u=y,c=b}}}t.Ys(n.x+e,n.y+i)}}UE(t,e,i){let s=this.diagram;if(s===null||t.equals(e))return 0;let n=s.layers;for(;n.next();){let o=n.value;if(o!==null&&o.visible){let r=o.IM(),a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!(l instanceof j))continue;if(l===this)return i.length>0&&i.sort((d,f)=>d-f),i.length;if(!l.isVisible()||!l._h())continue;let u=l.routeBounds;if(!u.isReal()||!this.routeBounds.intersectsRect(u)||this.usesSamePort(l))continue;let c=l.path;c!==null&&c.isVisibleObject()&&this.VE(t,e,i,l)}}}return i.length>0&&i.sort((o,r)=>o-r),i.length}VE(t,e,i,s){let n=C.c(t.y,e.y),o=s.pointsCount,r=s.getPoint(0),a=P.l();for(let h=1;h<o;h++){let l=s.getPoint(h);if(h<o-1){let u=s.getPoint(h+1);if(r.y===l.y&&l.y===u.y){if(l.x>r.x&&u.x>=l.x||l.x<r.x&&u.x<=l.x)continue}else if(r.x===l.x&&l.x===u.x&&(l.y>r.y&&u.y>=l.y||l.y<r.y&&u.y<=l.y))continue}this.BE(t,e,r,l,a)&&(n?i.push(a.x):i.push(a.y)),r=l}P.i(a)}BE(t,e,i,s,n){let o=t.x,r=t.y,a=e.x,h=e.y,l=i.x,u=i.y,c=s.x,d=s.y;if(C.c(o,a)){if(!C.c(r,h)&&C.c(u,d)&&Math.min(r,h)<u&&Math.max(r,h)>u&&Math.min(l,c)<o&&Math.max(l,c)>o&&!C.c(l,c))return n.x=o,n.y=u,!0}else if(C.c(r,h)&&C.c(l,c)&&Math.min(o,a)<l&&Math.max(o,a)>l&&Math.min(u,d)<r&&Math.max(u,d)>r&&!C.c(u,d))return n.x=l,n.y=r,!0;return n.x=0,n.y=0,!1}get firstPickIndex(){return this.pointsCount<=2?0:this.isOrthogonal||!this.wl(this.computeSpot(!0))?1:0}get lastPickIndex(){let t=this.pointsCount;return t===0?0:t<=2?t-1:this.isOrthogonal||!this.wl(this.computeSpot(!1))?t-2:t-1}_h(){let t=this.curve;return t===11||t===10}gk(t){if(t||this._h()){let e=this.diagram;e!==null&&!e.animationManager.isTicking&&!e.ra.has(this)&&(this.yl.width!==0||this.yl.height!==0)&&e.ra.set(this,this.yl.copy())}}invalidateOtherJumpOvers(t){let e=this.layer;if(e===null||!e.visible||e.isTemporary)return;let i=e.diagram;if(i===null||i.animationManager.isTicking)return;let s=!1,n=i.layers;for(;n.next();){let o=n.value;if(o.visible){if(o===e){s=!0;let r=!1,a=o.IM(),h=a.length;for(let l=0;l<h;l++){let u=a[l];u instanceof j&&(u===this?r=!0:r&&this.mv(u,t))}}else if(s){let r=o.IM(),a=r.length;for(let h=0;h<a;h++){let l=r[h];l instanceof j&&this.mv(l,t)}}}}}mv(t,e){if(t===null||!t.Ra||!t.Fi||!t._h())return;let i=t.routeBounds;i.isReal()&&(!this.routeBounds.intersectsRect(i)&&!e.intersectsRect(i)||this.usesSamePort(t)||t.ai())}usesSamePort(t){let e=this.pointsCount,i=t.pointsCount;if(e>0&&i>0){let s=this.getPoint(0),n=t.getPoint(0);if(s.equalsApprox(n))return!0;let o=this.getPoint(e-1),r=t.getPoint(i-1);if(o.equalsApprox(r)||s.equalsApprox(r)||o.equalsApprox(n))return!0}else if(this.fromNode===t.fromNode||this.toNode===t.toNode||this.fromNode===t.toNode||this.toNode===t.fromNode)return!0;return!1}isVisible(){if(!super.isVisible())return!1;let t=this.containingGroup,e=!0,i=this.diagram;i!==null&&(e=i.isTreePathToChildren);let s=this.fromNode;if(s!==null){if(this.isTreeLink&&e&&!s.isTreeExpanded)return!1;if(s===t)return!0;let o=s;for(;o!==null;){if(o.labeledLink===this)return!0;o=o.containingGroup}let r=s.findVisibleNode();if(r===null||r===t)return!1}let n=this.toNode;if(n!==null){if(this.isTreeLink&&!e&&!n.isTreeExpanded)return!1;if(n===t)return!0;let o=n;for(;o!==null;){if(o.labeledLink===this)return!0;o=o.containingGroup}let r=n.findVisibleNode();if(r===null||r===t)return!1}return!0}Xe(t){if(super.Xe(t),t&&this.gk(!1),this.tr!==null&&this.tr.$d(),this.nn!==null){let e=this.nn.iterator;for(;e.next();)e.value.Xe(t)}}get adjusting(){return this.Gf}set adjusting(t){let e=this.Gf;e!==t&&(this.Gf=t,this.t("adjusting",e,t))}computeAdjusting(){return this.isAvoiding&&this.diagram!==null&&this.diagram.animationManager.defaultAnimation.isAnimating?17:this.Gf}get corner(){return this._d}set corner(t){let e=this._d;e!==t&&(this._d=t,this.ai(),this.t("corner",e,t))}get curve(){return this.tg}set curve(t){let e=this.tg;e!==t&&(this.tg=t,(e===9||t===9)&&this.AC(this.yl),this.$t(),this.ai(),this.gk(e===10||e===11||t===10||t===11),this.t("curve",e,t))}get curviness(){return this.eg}set curviness(t){let e=this.eg;e!==t&&(this.eg=t,this.$t(),this.ai(),this.t("curviness",e,t))}get routing(){return this.Jh}set routing(t){let e=this.Jh;e!==t&&(this.Jh=t,this.isAvoiding&&this.diagram!==null&&(this.diagram.np=!0),this._o=null,this.$t(),this.gk(j.SC(e)||j.SC(t)),this.t("routing",e,t))}get smoothness(){return this.ig}set smoothness(t){let e=this.ig;e!==t&&(this.ig=t,this.ai(),this.t("smoothness",e,t))}Jy(){let t=this.uo;if(t===null)return;let e=this.mo;if(e===null||!isNaN(this.curviness))return;let i=this.go,s=this.po,n=null,o=null,r=t.ee.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];!(l.uo===t&&l.go===i&&l.mo===e&&l.po===s)&&!(l.uo===e&&l.go===s&&l.mo===t&&l.po===i)||(o===null?o=l:(n===null&&(n=[],n.push(o)),n.push(l)))}if(n!==null){let h=t.KD(e,i,s);h===null&&(h=new $n(t,i,e,s),t.GD(h),e.GD(h)),h.on=n;for(let l=0;l<n.length;l++){let u=n[l];u.tr=h}h.$d()}}Wy(){let t=this.tr;if(t!==null){if(!isNaN(this.curviness))return;this.tr=null;let e=t.on.indexOf(this);e>=0&&(t.on.splice(e,1),t.$d())}}Nr(){return!0}get key(){let t=this.diagram;if(!(t===null||!t.model.Wh()))return t.model.getKeyForLinkData(this.data)}}class $n{Xo;qs;By;mC;ak;pC;on;constructor(t,e,i,s){V.Je(this),this.Xo=!1,this.qs=!1,this.By=t,this.mC=e,this.ak=i,this.pC=s,this.on=[]}$d(){if(!this.Xo){let t=this.on;if(t.length>0){let e=t[0].diagram;e!==null&&(e.s2.add(this),this.qs=e.undoManager.isUndoingRedoing)}}this.Xo=!0}k2(){if(this.Xo){this.Xo=!1;let t=this.on;if(t.length>0){let e=t[0],i=e.diagram,s=i===null||i.Qa&&!this.qs;this.qs=!1,e.arrangeBundledLinks(t,s),t.length===1&&(e.tr=null,t.length=0)}t.length===0&&(this.By.YD(this),this.ak.YD(this))}}}class Ot{ui;di;ic;sc;we;xe;Bt;Oa;Ia;Ah;O2;Xo;Zy;cf;I2;E2;constructor(t){V.Je(this),this.Ah=null,this.O2=null,this.Xo=!0,this.Zy=!1,this.ui=1,this.di=1,this.ic=-1,this.sc=-1,this.we=t.width,this.xe=t.height,this.Bt=[],this.Oa=0,this.Ia=0,this.cf=j.fv,this.I2=this.cf*2,this.E2=this.cf*2}static rn=0;static nc=1;static ng=999999;static IC=Ot.ng+1;static EC=Ot.ng+2;a1(t){if(t.width<=0||t.height<=0)return;let e=t.x,i=t.y,s=t.x+t.width,n=t.y+t.height;this.ui=Math.floor((e-this.we)/this.we)*this.we,this.di=Math.floor((i-this.xe)/this.xe)*this.xe,this.ic=Math.ceil((s+2*this.we)/this.we)*this.we,this.sc=Math.ceil((n+2*this.xe)/this.xe)*this.xe;let o=1+(Math.ceil((this.ic-this.ui)/this.we)|0),r=1+(Math.ceil((this.sc-this.di)/this.xe)|0);if(this.Bt.length===0||this.Oa<o-1||this.Ia<r-1){let a=[];for(let h=0;h<=o;h++)a[h]=new Uint32Array(r);this.Bt=a,this.Oa=o-1,this.Ia=r-1}this.zE(Ot.IC)}get bounds(){return new I(this.ui,this.di,this.ic-this.ui,this.sc-this.di)}get cellWidth(){return this.we}set cellWidth(t){t>0&&t!==this.we&&(this.we=t,this.a1(this.bounds))}get cellHeight(){return this.xe}set cellHeight(t){t>0&&t!==this.xe&&(this.xe=t,this.a1(this.bounds))}og(t,e){return this.ui<=t&&t<=this.ic&&this.di<=e&&e<=this.sc}yo(t,e){if(!this.og(t,e))return Ot.IC;t-=this.ui,t/=this.we,e-=this.di,e/=this.xe;let i=t|0,s=e|0;return this.Bt[i][s]}vO(t,e,i,s){if(!this.og(t,e))return;let n=(t-this.ui)/this.we|0,o=(e-this.di)/this.xe|0,r=(t+i-this.ui)/this.we|0,a=(e+s-this.di)/this.xe|0,h=Math.min(r,this.Oa),l=Math.min(a,this.Ia);for(let u=n;u<=h;u++){let c=this.Bt[u];if(c.fill)c.fill(Ot.rn,o,l+1);else for(let d=o;d<=l;d++)c[d]=Ot.rn}}zE(t){for(let e=0;e<=this.Oa;e++){let i=this.Bt[e];if(i.fill)i.fill(t);else for(let s=0;s<=this.Ia;s++)i[s]=t}}TT(){for(let t=0;t<=this.Oa;t++){let e=this.Bt[t];for(let i=0;i<=this.Ia;i++)e[i]>=Ot.nc&&(e[i]=Ot.IC)}}XE(t,e){return this.yo(t,e)===Ot.rn}isUnoccupied(t,e,i,s){if(t>this.ic||t+i<this.ui||e>this.sc||e+s<this.di)return!0;let n=(t-this.ui)/this.we|0,o=(e-this.di)/this.xe|0,r=Math.max(0,i)/this.we+1|0,a=Math.max(0,s)/this.xe+1|0;if(n<0&&(r+=n,n=0),o<0&&(a+=o,o=0),r<0||a<0)return!0;let h=Math.min(n+r-1,this.Oa)|0,l=Math.min(o+a-1,this.Ia)|0;for(let u=n;u<=h;u++){let c=this.Bt[u];for(let d=o;d<=l;d++)if(c[d]===Ot.rn)return!1}return!0}maxAvoidsLinksSpaceH(t,e,i,s){if(t>this.ic||e<this.ui||i>this.sc||i<this.di)return 0;let n=(t-this.ui)/this.we|0,o=(e-this.ui)/this.we|0,r=(i-this.di)/this.xe|0,a=s/this.xe+1|0,h;for(h=0;h<a/2;h++){let l=!1;for(let u=n;u<=o;u++)if(this.Bt[u][r+h]===Ot.rn||this.Bt[u][r-h]===Ot.rn){l=!0;break}if(l)return Math.max(0,(2*h-1)*this.xe)}return s}maxAvoidsLinksSpaceV(t,e,i,s){if(t>this.sc||e<this.di||i>this.ic||i<this.ui)return 0;let n=(t-this.di)/this.xe|0,o=(e-this.di)/this.xe|0,r=(i-this.ui)/this.we|0,a=s/this.we+1|0,h;for(h=0;h<a/2;h++){let l=!1;for(let u=n;u<=o;u++)if(this.Bt[r+h][u]===Ot.rn||this.Bt[r-h][u]===Ot.rn){l=!0;break}if(l)return Math.max(0,(2*h-1)*this.we)}return s}GE(t,e,i,s,n,o,r,a){t=t|0,e=e|0;let h=this.Bt[t][e];if(h>=Ot.nc&&h<Ot.ng)for(s?e+=i:t+=i,h+=1;n<=t&&t<=o&&r<=e&&e<=a;){let l=this.Bt[t][e];if(h>=l)break;this.Bt[t][e]=h,h+=1,s?e+=i:t+=i}return s?e:t}wo(t,e,i,s,n,o,r,a){if(t<n||t>o||e<r||e>a)return;let h=this.GE(t,e,i,s,n,o,r,a);if(s)if(i>0)for(let l=e+i;l<h;l+=i)this.wo(t,l,1,!s,n,o,r,a),this.wo(t,l,-1,!s,n,o,r,a);else for(let l=e+i;l>h;l+=i)this.wo(t,l,1,!s,n,o,r,a),this.wo(t,l,-1,!s,n,o,r,a);else if(i>0)for(let l=t+i;l<h;l+=i)this.wo(l,e,1,!s,n,o,r,a),this.wo(l,e,-1,!s,n,o,r,a);else for(let l=t+i;l>h;l+=i)this.wo(l,e,1,!s,n,o,r,a),this.wo(l,e,-1,!s,n,o,r,a)}xk(t,e,i,s,n,o,r,a,h,l){let u=t|0,c=e|0,d=Ot.rn,f=Ot.nc;for(this.Bt[u][c]=f;d===Ot.rn&&u>r&&u<a&&c>h&&c<l;)f+=1,this.Bt[u][c]=f,o?c+=n:u+=n,d=this.Bt[u][c];return o?c:u}bk(t,e,i,s,n,o,r,a,h,l){let u=i|0,c=s|0,d=Ot.rn,f=Ot.ng;for(this.Bt[u][c]=f;d===Ot.rn&&u>r&&u<a&&c>h&&c<l;)this.Bt[u][c]=f,o?c+=n:u+=n,d=this.Bt[u][c]}pv(t,e,i,s,n,o){this.Zy=!1;let r=t.x,a=t.y;if(!this.og(r,a))return;r-=this.ui,r/=this.we,a-=this.di,a/=this.xe;let h=i.x,l=i.y;if(!this.og(h,l))return;if(h-=this.ui,h/=this.we,l-=this.di,l/=this.xe,Math.abs(r-h)<=1&&Math.abs(a-l)<=1){this.Zy=!0;return}let u=n.x,c=n.y,d=n.x+n.width,f=n.y+n.height;u-=this.ui,u/=this.we,c-=this.di,c/=this.xe,d-=this.ui,d/=this.we,f-=this.di,f/=this.xe;let p=Math.max(0,Math.min(this.Oa,u|0)),g=Math.min(this.Oa,Math.max(0,d|0)),y=Math.max(0,Math.min(this.Ia,c|0)),b=Math.min(this.Ia,Math.max(0,f|0)),v=0,w=90,k=270,S=this.Bt,N=r|0,D=a|0,L=h|0,M=l|0,A=e===v||e===w?1:-1,F=e===w||e===k;S[N][D]===Ot.rn?(this.xk(N,D,L,M,A,F,p,g,y,b),this.xk(N,D,L,M,1,!F,p,g,y,b),this.xk(N,D,L,M,-1,!F,p,g,y,b)):this.xk(N,D,L,M,A,F,N,D,N,D),S[L][M]===Ot.rn?(this.bk(N,D,L,M,s===v||s===w?1:-1,s===w||s===k,p,g,y,b),this.bk(N,D,L,M,1,!(s===w||s===k),p,g,y,b),this.bk(N,D,L,M,-1,!(s===w||s===k),p,g,y,b)):this.bk(N,D,L,M,A,F,L,M,L,M);let O=m.st();if(o&&this.yv(L,M,s,N,D,O)){(O[0]!==L||O[1]!==M)&&(O.unshift(M),O.unshift(L)),(O[O.length-2]!==N||O[O.length-1]!==D)&&(O.push(N),O.push(D));let E=Ot.nc,B=O[O.length-2],X=O[O.length-1];S[B][X]=E++;for(let z=O.length-4;z>=0;z-=2){B=O[z+2],X=O[z+3];let U=O[z],tt=O[z+1];for(;U>B?B++:U<B?B--:tt>X?X++:tt<X&&X--,S[B][X]=E++,!(B===U&&X===tt););}}else this.wo(N,D,1,!1,p,g,y,b),this.wo(N,D,-1,!1,p,g,y,b),this.wo(N,D,1,!0,p,g,y,b),this.wo(N,D,-1,!0,p,g,y,b);m.Z(O)}yv(t,e,i,s,n,o){let r=this.Bt,a=t,h=e;for(;;){if(a===s&&h===n)return!0;let l=a,u=h;if(i===0)if(l<s)l++;else break;else if(i===90)if(u<n)u++;else break;else if(i===180)if(l>s)l--;else break;else if(u>n)u--;else break;let c=r[l][u];if(c===0||c===Ot.EC)break;a=l,h=u}for(;;){let l=i,u=a,c=h;i===0?c<n?(l=90,c++):c>n&&(l=270,c--):i===90?u<s?(l=0,u++):u>s&&(l=180,u--):i===180?c<n?(l=90,c++):c>n&&(l=270,c--):u<s?(l=0,u++):u>s&&(l=180,u--);let d=r[u][c];if(l!==i&&d!==0&&d!==Ot.EC){if(o.push(a),o.push(h),this.yv(a,h,l,s,n,o))return!0;o.pop(),o.pop()}if(r[a][h]=Ot.EC,i===0){if(a===t)return!1;a--}else if(i===90){if(h===e)return!1;h--}else if(i===180){if(a===t)return!1;a++}else{if(h===e)return!1;h++}}}}class Ji{Ri;xl;Ei;rg;constructor(t,e){V.Je(this),this.Ri=t,this.xl=e,this.Ei=[],this.rg=!1}toString(){let t=this.Ei,e=this.Ri.toString()+" "+t.length.toString()+":";for(let i=0;i<t.length;i++){let s=t[i];s!==null&&(e+=`
|
|
13
13
|
`+s.toString())}return e}YE(t,e,i,s){let n=e.offsetY;switch(n){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}let o=i;switch(n){case 9:return o>180?270:90;case 6:return o>90&&o<=270?180:0}let r=Math.atan2(t.height,t.width)*180/Math.PI;switch(n){case 3:return o>r&&o<=180+r?180:270;case 5:return o>180-r&&o<=360-r?270:0;case 12:return o>r&&o<=180+r?90:0;case 10:return o>180-r&&o<=360-r?180:90;case 7:return o>90&&o<=180+r?180:o>180+r&&o<=360-r?270:0;case 13:return o>180&&o<=360-r?270:o>r&&o<=180?90:0;case 14:return o>r&&o<=180-r?90:o>180-r&&o<=270?180:0;case 11:return o>180-r&&o<=180+r?180:o>180+r?270:90}return s&&n!==15&&(o-=15,o<0&&(o+=360)),o>r&&o<180-r?90:o>=180-r&&o<=180+r?180:o>180+r&&o<360-r?270:0}$d(){this.Ei.length=0}uv(t){let e=this.Ei;e.length===0&&(this.KE(),e=this.Ei);for(let i=0;i<e.length;i++){let s=e[i];if(s!==null&&s.ts===t)return s}return null}KE(){if(!this.rg){let t=this.rg;this.rg=!0;let e,i=null,s=this.Ri,n=s instanceof ht?s:null;if(n!==null&&!n.isSubGraphExpanded){if(!n.actualBounds.isReal())return this.rg=t,this.Ei;i=n,e=i.findExternalLinksConnected()}else s.isTreeExpanded?e=s.findLinksConnected(this.xl.portId):e=s.findExternalTreeLinksConnected();this.Ei.length=0;let o=0,r=this.xl.getDocumentPoint(T.TopLeft,P.l()),a=this.xl.getDocumentPoint(T.BottomRight,P.l()),h=I.z(r.x,r.y,0,0);h.unionPoint(a),P.i(r),P.i(a);let l=P.z(h.x+h.width/2,h.y+h.height/2),u=this.xl.getDocumentAngle(),c=e.iterator;for(;c.next();){let g=c.value;if(!g.isVisible()||g.fromPort===g.toPort)continue;let y=g.fromPort===this.xl||i!==null&&g.fromNode!==null&&g.fromNode.isMemberOf(i),b=g.computeSpot(y,this.xl);if(!b.isSide())continue;let v;if(y?v=g.toPort:v=g.fromPort,v===null)continue;let w=v.part;if(w===null)continue;let k=w.findVisibleNode();k!==null&&k!==w&&(w=k,v=w.port);let S=g.computeOtherPoint(w,v),N=l.directionPoint(S);u!==0&&(N=C.Ee(N-u));let D=this.YE(h,b,N,g.isOrthogonal),L=0;D===0?(L=4,N>180&&(N-=360)):D===90?(L=8,N>270&&(N-=360)):D===180?L=2:(L=1,N<90&&(N+=360));let M=this.Ei[o];M===void 0?(M=new Jn(g,N,L),this.Ei[o]=M):(M.ts=g,M.Xt=N,M.fi=L),M.kk.h(S),o++}P.i(l),this.HE();let d=this.Ei.length,f=-1,p=0;for(o=0;o<d;o++){let g=this.Ei[o];g!==void 0&&(g.fi!==f&&(f=g.fi,p=0),g.lg=p,p++)}for(f=-1,p=0,o=d-1;o>=0;o--){let g=this.Ei[o];g!==void 0&&(g.fi!==f&&(f=g.fi,p=g.lg+1),g.Kf=p)}this.qE(this.Ei),this.jE(this.Ei),this.rg=t,I.i(h)}return this.Ei}WE(t,e){return t===e?0:t===null?-1:e===null?1:t.fi<e.fi?-1:t.fi>e.fi?1:t.Xt<e.Xt?-1:t.Xt>e.Xt?1:0}HE(){this.Ei.sort(Ji.prototype.WE)}qE(t){let e=this.xl,i=this.Ri.portSpreading,s=P.l(),n=P.l(),o=P.l(),r=P.l();e.getDocumentPoint(T.TopLeft,s),e.getDocumentPoint(T.TopRight,n),e.getDocumentPoint(T.BottomRight,o),e.getDocumentPoint(T.BottomLeft,r);let a=0,h=0,l=0,u=0;if(i===2)for(let v=0;v<t.length;v++){let w=t[v];if(w===null)continue;let k=w.ts.computeThickness();switch(w.fi){case 8:l+=k;break;case 2:u+=k;break;case 1:a+=k;break;default:case 4:h+=k;break}}let c=0,d=0,f=1,p=n,g=o,y=0,b=0;for(let v=0;v<t.length;v++){let w=t[v];if(w===null)continue;if(c!==w.fi){switch(c=w.fi,c){case 8:p=o,g=r;break;case 2:p=r,g=s;break;case 1:p=s,g=n;break;default:case 4:p=n,g=o;break}switch(y=g.x-p.x,b=g.y-p.y,c){case 8:l>Math.abs(y)?(f=Math.abs(y)/l,l=Math.abs(y)):f=1;break;case 2:u>Math.abs(b)?(f=Math.abs(b)/u,u=Math.abs(b)):f=1;break;case 1:a>Math.abs(y)?(f=Math.abs(y)/a,a=Math.abs(y)):f=1;break;default:case 4:h>Math.abs(b)?(f=Math.abs(b)/h,h=Math.abs(b)):f=1;break}d=0}let k=w.tc;if(i===2){let S=w.ts.computeThickness();switch(S*=f,k.h(p),c){case 8:k.x=p.x+y/2+l/2-d-S/2;break;case 2:k.y=p.y+b/2+u/2-d-S/2;break;case 1:k.x=p.x+y/2-a/2+d+S/2;break;default:case 4:k.y=p.y+b/2-h/2+d+S/2;break}d+=S}else{let S=.5;i===1&&(S=(w.lg+1)/(w.Kf+1)),k.x=p.x+y*S,k.y=p.y+b*S}}P.i(s),P.i(n),P.i(o),P.i(r)}jE(t){for(let e=0;e<t.length;e++){let i=t[e];i!==null&&(i.yk=this.JE(i,e))}}JE(t,e){let i=t.ts,s=i.fromPort===this.xl,n=0;switch(t.fi){case 1:n=270;break;case 2:n=180;break;case 4:n=0;break;case 8:n=90;break}let o=i.mk(this.Ri,this.xl,T.None,s,n),r=t.lg;if(r<0)return o;let a=t.Kf;if(a<=1||!i.isOrthogonal)return o;let h=t.kk,l=t.tc,u=t.fi===2||t.fi===8;u&&(r=a-1-r);let c=j.tv,d=t.fi===2||t.fi===4,f=r<=0?l:this.Ei[u?e+1:e-1].tc,p=r>=a-1?l:this.Ei[u?e-1:e+1].tc;return(d?h.y>=f.y&&h.y<=p.y:h.x>=f.x&&h.x<=p.x)?o:(d?h.y<l.y:h.x<l.x)?o+r*c:o+(a-1-r)*c}}class Jn{ts;Xt;fi;kk;lg;Kf;tc;yk;constructor(t,e,i){this.ts=t,this.Xt=e,this.fi=i,this.kk=new P,this.lg=0,this.Kf=0,this.tc=new P,this.yk=0}toString(){return this.ts.toString()+" "+this.Xt.toString()+" "+this.fi.toString()+":"+this.lg.toString()+"/"+this.Kf.toString()+" "+this.tc.toString()+" "+this.yk.toString()+" "+this.kk.toString()}}class Ni{vh;Fh;Rh;Oh;Ih;Eh;l0;o0;a0;r0;constructor(){this.vh=T.Default,this.Fh=T.Default,this.Rh=NaN,this.Oh=NaN,this.Ih=NaN,this.Eh=NaN,this.l0=null,this.o0=null,this.a0=1/0,this.r0=1/0}copy(){let t=new Ni;return t.vh=this.vh.N(),t.Fh=this.Fh.N(),t.Rh=this.Rh,t.Oh=this.Oh,t.Ih=this.Ih,t.Eh=this.Eh,t.l0=this.l0,t.o0=this.o0,t.a0=this.a0,t.r0=this.r0,t}}class Re{Zp;Qp;_p;$p;Y0;K0;constructor(){this.Zp=-1/0,this.Qp=0,this._p=P.dn,this.$p=0,this.Y0="None",this.K0="None"}copy(){let t=new Re;return t.Zp=this.Zp,t.Qp=this.Qp,t._p=this._p.N(),t.$p=this.$p,t.Y0=this.Y0,t.K0=this.K0,t}}class ht extends ${ag;Dt;Ch;Tp;he;li;constructor(t,e){let i;t===void 0||t instanceof Lt||typeof t=="string"?i=t:t&&(e=t),super(i),this.E=this.E|4608,this.ag=new V,this.Dt=null,this.li=new _t,this.li.group=this,this.Ch=new V,this.Tp=null,this.he=null,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),this.E=this.E&-32769;let e=t.findInVisualTree(i=>i instanceof le);e instanceof le?t.Dt=e:t.Dt=null,this.li!==null?(t.li=this.li.copy(),t.li.group=t):(t.li!==null&&(t.li.group=null),t.li=null),this.he!==null&&(t.he=this.he.copy())}Yo(t){super.Yo(t);let e=t.findSubGraphParts(),i=t.memberParts;for(;i.next();){let s=i.value;if(s.f(),s.invalidateLayout(8),s.clearAdornments(),s instanceof $)s.invalidateConnectedLinks(e);else if(s instanceof j){let n=s.labelNodes;for(;n.next();)n.value.invalidateConnectedLinks(e)}}}gf(t,e,i,s,n,o,r){if(t===3&&e==="elements"){if(n instanceof le)this.Dt===null?this.Dt=n:this.Dt!==n&&m.o("Cannot insert a second Placeholder into the visual tree of a Group.");else if(n instanceof G){let a=n.findInVisualTree(h=>h instanceof le);a instanceof le&&(this.Dt===null?this.Dt=a:this.Dt!==a&&m.o("Cannot insert a second Placeholder into the visual tree of a Group."))}}else t===4&&e==="elements"&&this.Dt!==null&&(s===this.Dt?this.Dt=null:s instanceof G&&this.Dt.isContainedBy(s)&&(this.Dt=null));super.gf(t,e,i,s,n,o,r)}Pd(t,e){if(super.Pd(t,e),this.isClipping&&this.type!==G.Spot&&this.isSubGraphExpanded){let i=this.resizeObject;i instanceof G&&(i=i.findMainElement()),this.he===null&&(this.he=new I),i.getDocumentBounds(this.he),i instanceof et&&this.he.inflate(-i.strokeWidth,-i.strokeWidth)}}Pa(t,e,i,s){this.hasPlaceholder()&&(this.Qo=this.placeholder),super.Pa(t,e,i,s)}ensureBounds(){this.isSubGraphExpanded&&this.memberParts.each(t=>{t.ensureBounds()}),super.ensureBounds()}$r(){if(!super.$r())return!1;let t=this.memberParts;for(;t.next();){let e=t.value;if(e instanceof $){if(!e.isVisible())continue;if(e.as())return!1}else if(e instanceof j){if(!e.isVisible())continue;if(e.as()&&e.fromNode!==this&&e.toNode!==this)return!1}}return!0}hasPlaceholder(){return this.Dt!==null&&this.Dt.isVisibleObject()&&this.isSubGraphExpanded}get placeholder(){return this.Dt}get computesBoundsAfterDrag(){return(this.E&2048)!==0}set computesBoundsAfterDrag(t){let e=(this.E&2048)!==0;e!==t&&(this.E=this.E^2048,this.t("computesBoundsAfterDrag",e,t))}get computesBoundsIncludingLinks(){return(this.E&4096)!==0}set computesBoundsIncludingLinks(t){let e=(this.E&4096)!==0;e!==t&&(this.E=this.E^4096,this.t("computesBoundsIncludingLinks",e,t))}get computesBoundsIncludingLocation(){return(this.E&8192)!==0}set computesBoundsIncludingLocation(t){let e=(this.E&8192)!==0;e!==t&&(this.E=this.E^8192,this.t("computesBoundsIncludingLocation",e,t))}get handlesDragDropForMembers(){return(this.E&16384)!==0}set handlesDragDropForMembers(t){let e=(this.E&16384)!==0;e!==t&&(this.E=this.E^16384,this.t("handlesDragDropForMembers",e,t))}get avoidableMembers(){return(this.E&131072)!==0}set avoidableMembers(t){let e=(this.E&131072)!==0;e!==t&&(this.E=this.E^131072,this.t("avoidableMembers",e,t))}get memberParts(){return this.ag.iterator}fC(t){if(this.ag.add(t)){t instanceof ht&&this.Ch.add(t);let i=this.memberAdded;if(i!==null){let s=!0,n=this.diagram;n!==null&&(s=n.G,n.G=!0),i(this,t),n!==null&&(n.G=s)}(!this.isVisible()||!this.isSubGraphExpanded)&&t.Xe(!1)}if(t instanceof j&&!this.computesBoundsIncludingLinks)return;let e=this.Dt;e===null&&(e=this),e.f()}cC(t){if(this.ag.delete(t)){t instanceof ht&&this.Ch.delete(t);let i=this.memberRemoved;if(i!==null){let s=!0,n=this.diagram;n!==null&&(s=n.G,n.G=!0),i(this,t),n!==null&&(n.G=s)}(!this.isVisible()||!this.isSubGraphExpanded)&&t.Xe(!0)}if(t instanceof j&&!this.computesBoundsIncludingLinks)return;let e=this.Dt;e===null&&(e=this),e.f()}af(){if(this.ag.count>0){let t=this.diagram;if(t!==null){let e=this.ag.copy().iterator;for(;e.next();){let i=e.value;t.remove(i)}}}super.af()}get layout(){return this.li}set layout(t){let e=this.li;if(e!==t){t!==null&&t.diagram!==null&&t.diagram.layout===t&&m.o("A layout cannot be both the Diagram.layout and a Group.layout: "+t),e!==null&&(e.diagram=null,e.group=null),this.li=t;let i=this.diagram;t!==null&&(t.diagram=i,t.group=this),i!==null&&(i.jr=!0),this.t("layout",e,t),i!==null&&i.requestUpdate()}}get memberAdded(){return this.vt!==null?this.vt.Hy:null}set memberAdded(t){let e=this.memberAdded;e!==t&&(t!==null&&m.S(t,ht,"memberAdded"),this.gl().Hy=t,this.t("memberAdded",e,t))}get memberRemoved(){return this.vt!==null?this.vt.qy:null}set memberRemoved(t){let e=this.memberRemoved;e!==t&&(t!==null&&m.S(t,ht,"memberRemoved"),this.gl().qy=t,this.t("memberRemoved",e,t))}get memberValidation(){return this.vt!==null?this.vt.da:null}set memberValidation(t){let e=this.memberValidation;e!==t&&(t!==null&&m.S(t,ht,"memberValidation"),this.gl().da=t,this.t("memberValidation",e,t))}canAddMembers(t){let e=this.diagram;if(e===null)return!1;let i=e.commandHandler,s=i.yN(t).iterator;for(;s.next();){let n=s.value;if(!i.isValidMember(this,n))return!1}return!0}addMembers(t,e){let i=this.diagram;if(i===null)return!1;let s=i.commandHandler,n=s.yN(t),o=!0,r=n.iterator;for(;r.next();){let a=r.value;!e||s.isValidMember(this,a)?a.containingGroup=this:o=!1}return o}get ungroupable(){return(this.E&256)!==0}set ungroupable(t){let e=(this.E&256)!==0;e!==t&&(this.E=this.E^256,this.t("ungroupable",e,t))}canUngroup(){if(!this.ungroupable)return!1;let t=this.layer;if(t===null||!t.allowUngroup)return!1;let e=t.diagram;return!(e!==null&&!e.allowUngroup)}invalidateConnectedLinks(t){let e=this.$E();if(super.invalidateConnectedLinks(t),e)return;this.cT(!0);let i=this.findExternalLinksConnected();for(;i.next();){let s=i.value;if(t!==void 0&&t.has(s))continue;let n=s.fromNode;if(n!==null&&n!==this&&n.isMemberOf(this)&&!n.isVisible())n.Ze(s.fromPort),n.Ze(s.toPort),s.$t();else{let o=s.toNode;o!==null&&o!==this&&o.isMemberOf(this)&&!o.isVisible()&&(o.Ze(s.fromPort),o.Ze(s.toPort),s.$t())}}}findExternalLinksConnected(){let t=this.diagram!==null&&this.diagram.f2;if(t&&this.Tp!==null)return this.Tp.iterator;let e=this.findSubGraphParts();e.add(this);let i=new V,s=e.iterator;for(;s.next();){let n=s.value;if(!(n instanceof $))continue;let o=n.linksConnected;for(;o.next();){let r=o.value;e.has(r)||i.add(r)}}return t&&(this.Tp=i),i.iterator}findExternalNodesConnected(){let t=this.findSubGraphParts();t.add(this);let e=new V,i=t.iterator;for(;i.next();){let s=i.value;if(!(s instanceof $))continue;let n=s.linksConnected;for(;n.next();){let o=n.value,r=o.fromNode;r!==null&&(!t.has(r)||r===this)&&e.add(r);let a=o.toNode;a!==null&&(!t.has(a)||a===this)&&e.add(a)}}return e.iterator}zU(){function t(i,s){i!==null&&(s.add(i),t(i.containingGroup,s))}let e=new V;return t(this,e),e}findSubGraphParts(){let t=new V;return pt.ga(t,this,!0,0,!0),t.delete(this),t}Xe(t){super.Xe(t);let e=this.memberParts;for(;e.next();)e.value.Xe(t)}collapseSubGraph(){let t=this.diagram;if(t===null||t.isCollapsingExpanding)return;t.isCollapsingExpanding=!0;let e=this.findSubGraphParts();this.wv(e,t,this),t.isCollapsingExpanding=!1}wv(t,e,i){let s=this.memberParts;for(;s.next();){let n=s.value;if(n.Xe(!1),n instanceof ht&&n.isSubGraphExpanded&&(n.wasSubGraphExpanded=n.isSubGraphExpanded,n.wv(t,e,i)),n instanceof $)n.invalidateConnectedLinks(t),e.Hc(n,i);else if(n instanceof j){let o=n.labelNodes;for(;o.next();)o.value.invalidateConnectedLinks(t)}}this.isSubGraphExpanded=!1}expandSubGraph(){let t=this.diagram;if(t===null||t.isCollapsingExpanding)return;t.isCollapsingExpanding=!0;let e=this.findSubGraphParts();this.xv(e,t,this),t.isCollapsingExpanding=!1}xv(t,e,i){let s=this.memberParts;for(;s.next();){let n=s.value;if(n.Xe(!0),n instanceof ht&&n.wasSubGraphExpanded&&(n.wasSubGraphExpanded=!1,n.xv(t,e,i)),n instanceof $)n.invalidateConnectedLinks(t);else if(n instanceof j){let o=n.labelNodes;for(;o.next();)o.value.invalidateConnectedLinks(t)}}this.isSubGraphExpanded=!0}get isSubGraphExpanded(){return(this.E&512)!==0}set isSubGraphExpanded(t){let e=(this.E&512)!==0;if(e!==t){this.E=this.E^512;let i=this.diagram;this.t("isSubGraphExpanded",e,t);let s=this.subGraphExpandedChanged;if(s!==null){let n=!0;i!==null&&(n=i.G,i.G=!0),s(this),i!==null&&(i.G=n)}if(i!==null&&i.undoManager.isUndoingRedoing){this.Dt!==null&&this.Dt.f(),this.memberParts.each(n=>n.updateAdornments());return}t?this.expandSubGraph():this.collapseSubGraph()}}get wasSubGraphExpanded(){return(this.E&1024)!==0}set wasSubGraphExpanded(t){let e=(this.E&1024)!==0;e!==t&&(this.E=this.E^1024,this.t("wasSubGraphExpanded",e,t))}get subGraphExpandedChanged(){return this.vt!==null?this.vt.jy:null}set subGraphExpandedChanged(t){let e=this.subGraphExpandedChanged;e!==t&&(t!==null&&m.S(t,ht,"subGraphExpandedChanged"),this.gl().jy=t,this.t("subGraphExpandedChanged",e,t))}move(t,e){e===void 0&&(e=!1);let i=e?this.location:this.position,s=i.x,n=i.y,o=t.x,r=t.y;if((s===o||isNaN(s)&&isNaN(o))&&(n===r||isNaN(n)&&isNaN(r)))return;let a=o-(isNaN(s)?0:s),h=r-(isNaN(n)?0:n),l=P.l();super.move(t,e);let u=new V,c=this.findSubGraphParts().iterator;for(;c.next();){let d=c.value;d instanceof j&&(d.suspendsRouting&&u.add(d),!(!d.Fi&&(d.fromNode===this||d.toNode===this))&&(d.suspendsRouting=!0))}for(c.reset();c.next();){let d=c.value;if(d.Nr()||d instanceof $&&d.isLinkLabel)continue;let f=d.position,p=d.location;f.isReal()?(l.x=f.x+a,l.y=f.y+h,d.position=l):p.isReal()&&(l.x=p.x+a,l.y=p.y+h,d.location=l)}for(c.reset();c.next();){let d=c.value;if(!(d instanceof j)||(d.suspendsRouting=u.has(d),!d.Fi&&(d.fromNode===this||d.toNode===this)))continue;let f=d.position;l.x=f.x+a,l.y=f.y+h,l.isReal()?d.move(l):d.$t()}P.i(l)}$E(){return(this.E&65536)!==0}cT(t){(this.E&65536)!==0!==t&&(this.E=this.E^65536)}get Lh(){return(this.E&32768)!==0}set Lh(t){(this.E&32768)!==0!==t&&(this.E=this.E^32768)}}class le extends J{Qt;hg;constructor(t){super(),this.Qt=Dt.em,this.hg=new I(NaN,NaN,NaN,NaN),t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Qt=this.Qt.N(),t.hg=this.hg.copy()}ka(t){if(this.background===null)return!1;let e=this.naturalBounds;return I.contains(0,0,e.width,e.height,t.x,t.y)}kd(t,e,i,s){let n=this.part;if((n===null||!(n instanceof ht)&&!(n instanceof vt))&&m.o("Placeholder is not inside a Group or Adornment."),n instanceof ht){let o=this.computeBorder(this.hg),r=this.minSize,a=isFinite(r.width)?Math.max(r.width,o.width):o.width,h=isFinite(r.height)?Math.max(r.height,o.height):o.height,l=this.Ke;l.Yn(a||0,h||0),this.no(0,0,l.width,l.height);let u=n.memberParts,c=!1;for(;u.next();)if(u.value.isVisible()){c=!0;break}let d=n.diagram;if(c&&d!==null&&!d.animationManager.NM(n)&&!isNaN(o.x)&&!isNaN(o.y)){let f=P.l();f.setRectSpot(o,n.locationSpot),n.location=f,P.i(f)}}else{let o=n,r=this.Ke,a=this.Qt,h=a.left+a.right,l=a.top+a.bottom,u=o.adornedObject,c=u.getDocumentAngle();o.angle=c;let d=0;u instanceof et&&(d=u.strokeWidth);let f=u.getDocumentScale(),p=u.naturalBounds,g=(p.width+d)*f,y=(p.height+d)*f;if(o.type!==G.Link){let b=o.category==="Selection"?T.TopLeft:o.locationSpot,v=u.getDocumentPoint(b,P.l());o.location=v,P.i(v)}if(!isNaN(g)&&!isNaN(y))r.Yn(g+h||0,y+l||0),this.no(-a.left,-a.top,r.width,r.height);else{let b=u.getDocumentPoint(T.TopLeft,P.l()),v=I.z(b.x,b.y,0,0);v.unionPoint(u.getDocumentPoint(T.BottomRight,b)),v.unionPoint(u.getDocumentPoint(T.TopRight,b)),v.unionPoint(u.getDocumentPoint(T.BottomLeft,b)),r.Yn(v.width+h||0,v.height+l||0),this.no(-a.left,-a.top,r.width,r.height),P.i(b),I.i(v)}}}Pa(t,e,i,s){this.actualBounds.e(t,e,i,s)}computeBorder(t){let e=this.part,i=e.diagram;if(i===null||i.animationManager.isAnimating)return t;if(e instanceof ht&&!e.layer.isTemporary&&e.computesBoundsAfterDrag&&this.hg.isReal()){let r=i.toolManager.findTool("Dragging");if(r===i.currentTool&&r.mR(e,this.hg,t))return t}let s=I.l(),n=this.computeMemberBounds(s),o=this.Qt;return e instanceof ht&&!e.isSubGraphExpanded?t.e(n.x-o.left,n.y-o.top,0,0):t.e(n.x-o.left,n.y-o.top,Math.max(n.width+o.left+o.right,0),Math.max(n.height+o.top+o.bottom,0)),I.i(s),e instanceof ht&&e.computesBoundsIncludingLocation&&e.location.isReal()&&t.unionPoint(e.location),t}computeMemberBounds(t){if(!(this.part instanceof ht))return t.e(0,0,0,0),t;let e=this.part,i=1/0,s=1/0,n=-1/0,o=-1/0,r=e.memberParts;for(;r.next();){let a=r.value;if(!a.isVisible()||a instanceof j&&(!e.computesBoundsIncludingLinks||a.Bo()||a.fromNode===e||a.toNode===e))continue;let h=a.actualBounds;h.left<i&&(i=h.left),h.top<s&&(s=h.top),h.right>n&&(n=h.right),h.bottom>o&&(o=h.bottom)}if(!isFinite(i)||!isFinite(s)){let a=e.location;t.e(a.x,a.y,0,0)}else t.e(i,s,n-i,o-s);return t}get padding(){return this.Qt}set padding(t){typeof t=="number"&&(t=new Dt(t));let e=this.Qt;e.equals(t)||(t=t.N(),this.Qt=t,this.t("padding",e,t),this.f())}}class _t{a;Ah;cg;Cr;fg;ug;Io;bl;dg;gg;xo;constructor(t){V.Je(this),this.a=null,this.Ah=null,this.cg=!0,this.Cr=!0,this.fg=!1,this.ug=new P(0,0),this.Io=!0,this.bl=null,this.dg=null,this.gg=!1,this.xo=null,t&&Object.assign(this,t)}cloneProtected(t){t.cg=this.cg,t.Cr=this.Cr,t.fg=this.fg,t.ug.h(this.ug),t.Io=this.Io,t.bl=this.bl,t.dg=this.dg,t.gg=!0}copy(){let t=new this.constructor;return this.cloneProtected(t),t}fe(t){m.cr(this,t)}toString(){let t=m.Gn(this.constructor);return t+="(",this.group!==null&&(t+=" in "+this.group),this.diagram!==null&&(t+=" for "+this.diagram),t+=")",t}get diagram(){return this.a}set diagram(t){this.a=t}get group(){return this.Ah}set group(t){this.Ah!==t&&(this.Ah=t,t!==null&&(this.a=t.diagram))}get isOngoing(){return this.cg}set isOngoing(t){this.cg!==t&&(m.s(t,"boolean",_t,"isOngoing"),this.cg=t)}get isInitial(){return this.Cr}set isInitial(t){m.s(t,"boolean",_t,"isInitial"),this.Cr=t,t||(this.gg=!0)}get isViewportSized(){return this.fg}set isViewportSized(t){this.fg!==t&&(m.s(t,"boolean",_t,"isViewportSized"),this.fg=t,t&&this.p())}get isRouting(){return this.Io}set isRouting(t){this.Io!==t&&(m.s(t,"boolean",_t,"isRouting"),this.Io=t)}get isRealtime(){return this.bl}set isRealtime(t){this.bl!==t&&(t!==null&&m.s(t,"boolean",_t,"isRealtime"),this.bl=t)}get isValidLayout(){return this.gg}set isValidLayout(t){if(this.gg!==t&&(m.s(t,"boolean",_t,"isValidLayout"),this.gg=t,!t)){let e=this.diagram;e!==null&&(e.jr=!0)}}invalidateLayout(){if(!this.isValidLayout)return;let t=this.diagram;if(t===null||t.undoManager.isUndoingRedoing)return;let e=t.animationManager;e.isTicking||(e.defaultAnimation.isAnimating&&e.stopAnimation(),(this.isOngoing&&t.Qa||this.isInitial&&!t.Qa)&&(this.isValidLayout=!1,t.requestUpdate()))}p(){this.invalidateLayout()}get network(){return this.xo}set network(t){this.xo!==t&&(this.xo=t,t!==null&&(t.layout=this))}createNetwork(){return new Ee(this)}makeNetwork(t){let e=this.createNetwork();return t instanceof Y?(e.addParts(t.nodes,!0),e.addParts(t.links,!0)):t instanceof ht?e.addParts(t.memberParts):e.addParts(t.iterator),e}updateParts(){this.isValidLayout=!0;let t=this.diagram;if(t===null&&this.network!==null){let e=this.network.vertexes.iterator;for(;e.next();){let i=e.value.node;if(i!==null&&(t=i.diagram,t!==null))break}}try{t!==null&&t.startTransaction("Layout"),this.commitLayout()}finally{t!==null&&t.commitTransaction("Layout")}}commitLayout(){if(this.network===null)return;let t=this.network.vertexes.iterator;for(;t.next();)t.value.commit();if(this.isRouting){let e=this.network.edges.iterator;for(;e.next();)e.value.commit()}}doLayout(t){let e=new V;if(t instanceof Y?(this.Ea(e,t.nodes,!0,this.Lh,!0,!1,!0),this.Ea(e,t.parts,!0,this.Lh,!0,!1,!0)):t instanceof ht?this.Ea(e,t.memberParts,!1,this.Lh,!0,!1,!0):e.addAll(t.iterator),e.count>0){let i=this.diagram;i!==null&&i.startTransaction("Layout"),this.doMinimalNoNetworkLayout(e),i!==null&&i.commitTransaction("Layout")}this.isValidLayout=!0}doMinimalNoNetworkLayout(t){let e=t.count,i=Math.ceil(Math.sqrt(e));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);let s=this.arrangementOrigin.x,n=this.arrangementOrigin.y,o=s,r=n,a=0,h=0,l=t.iterator;for(;l.next();){let u=l.value;u.ensureBounds();let c=u.measuredBounds,d=c.width,f=c.height;u.moveTo(o,r),u instanceof ht&&(u.Lh=!1),o+=Math.max(d,50)+20,h=Math.max(h,Math.max(f,50)),a>=i-1?(a=0,o=s,r+=h+20,h=0):a++}}Lh(t){return!!(!t.location.isReal()&&!t.position.isReal()||t instanceof ht&&t.Lh)}Ea(t,e,i,s,n,o,r){let a=e.iterator;for(;a.next();){let h=a.value;if(!(i&&!h.isTopLevel)&&!(s!==null&&!s(h))&&h.canLayout())if(n&&h instanceof $){if(h.isLinkLabel)continue;h instanceof ht&&h.layout===null?this.Ea(t,h.memberParts,!1,s,n,o,r):(h.ensureBounds(),t.add(h))}else o&&h instanceof j?t.add(h):r&&h.Di()&&!(h instanceof $)&&(h.ensureBounds(),t.add(h))}}getLayoutBounds(t,e){let i=this.boundsComputation;return i!==null?(e||(e=new I),i(t,this,e)):!e&&t.margin.equalTo(0,0,0,0)?t.actualBounds:(e||(e=new I),e.set(t.actualBounds),e.addMargin(t.margin),e)}get boundsComputation(){return this.dg}set boundsComputation(t){this.dg!==t&&(t!==null&&m.S(t,_t,"boundsComputation"),this.dg=t,this.p())}collectParts(t){let e=new V;return t instanceof Y?(this.Ea(e,t.nodes,!0,null,!0,!0,!0),this.Ea(e,t.links,!0,null,!0,!0,!0),this.Ea(e,t.parts,!0,null,!0,!0,!0)):t instanceof ht?this.Ea(e,t.memberParts,!1,null,!0,!0,!0):this.Ea(e,t.iterator,!1,null,!0,!0,!0),e}get arrangementOrigin(){return this.ug}set arrangementOrigin(t){this.ug.equals(t)||(this.ug.h(t),this.p())}initialOrigin(t){let e=this.group;if(e!==null)if(e.hasPlaceholder()){let i=e.placeholder,s=i.getDocumentPoint(T.TopLeft);(isNaN(s.x)||isNaN(s.y))&&s.set(t);let n=i.padding;return s.x+=n.left,s.y+=n.top,s}else{let i=e.position.copy();return(isNaN(i.x)||isNaN(i.y))&&i.set(t),i}return t}}class Ee{li;bo;On;Qy;_y;constructor(t){V.Je(this),this.li=t,this.bo=new V,this.On=new V,this.Qy=new Mt,this._y=new Mt}clear(){if(this.bo){let t=this.bo.iterator;for(;t.next();)t.value.clear()}if(this.On){let t=this.On.iterator;for(;t.next();)t.value.clear()}this.bo=new V,this.On=new V,this.Qy=new Mt,this._y=new Mt}toString(t){t===void 0&&(t=0);let e="LayoutNetwork"+(this.layout!==null?"("+this.layout.toString()+")":"");if(t<=0)return e;if(e+=" vertexes: "+this.bo.count+" edges: "+this.On.count,t>1){let i=this.bo.iterator;for(;i.next();){let n=i.value;e+=`
|
|
14
14
|
`+n.toString(t-1)}let s=this.On.iterator;for(;s.next();){let n=s.value;e+=`
|
|
15
15
|
`+n.toString(t-1)}}return e}get layout(){return this.li}set layout(t){t!==null&&(this.li=t)}get vertexes(){return this.bo}get edges(){return this.On}createVertex(){return new Ie(this)}createEdge(){return new ei(this)}addParts(t,e,i){if(t===null)return;e===void 0&&(e=!1),m.s(e,"boolean",Ee,"addParts:toplevelonly"),i===void 0&&(i=null),i===null&&(i=n=>{if(n instanceof $)return!n.isLinkLabel;if(n instanceof j){let o=n.fromNode;if(o===null||o.isLinkLabel)return!1;let r=n.toNode;return!(r===null||r.isLinkLabel)}return!1});let s=t.iterator;for(;s.next();){let n=s.value;if(n instanceof $&&!(e&&!n.isTopLevel)&&n.canLayout()&&i(n))if(n instanceof ht&&n.layout===null)this.addParts(n.memberParts,!1);else{if(this.findVertex(n)!==null)continue;let o=this.createVertex();o.node=n,this.addVertex(o)}}for(s.reset();s.next();){let n=s.value;if(!(n instanceof j)||e&&!n.isTopLevel||!n.canLayout()||!i(n)||this.findEdge(n)!==null)continue;let o=n.fromNode,r=n.toNode;if(o===null||r===null||o===r)continue;let a=this.findGroupVertex(o),h=this.findGroupVertex(r);this.linkVertexes(a,h,n)}}findGroupVertex(t){let e=t.findVisibleNode();if(e===null)return null;let i=this.findVertex(e);if(i!==null)return i;let s=e.containingGroup;for(;s!==null;){if(i=this.findVertex(s),i!==null)return i;s=s.containingGroup}return null}addVertex(t){this.bo.add(t);let e=t.node;e!==null&&this.Qy.set(e,t),t.network=this}addNode(t){let e=this.findVertex(t);return e===null&&(e=this.createVertex(),e.node=t,this.addVertex(e)),e}deleteVertex(t){if(this.bv(t)){let e=t.er;for(let i=e.count-1;i>=0;i--){let s=e.elt(i);this.deleteEdge(s)}e=t.ir;for(let i=e.count-1;i>=0;i--){let s=e.elt(i);this.deleteEdge(s)}}}bv(t){let e=this.bo.delete(t);if(e){let i=t.node;i!==null&&this.Qy.delete(i)}return e}deleteNode(t){let e=this.findVertex(t);e!==null&&this.deleteVertex(e)}findVertex(t){return this.Qy.get(t)}addEdge(t){this.UC(t);let e=t.toVertex;e!==null&&e.addSourceEdge(t);let i=t.fromVertex;i!==null&&i.addDestinationEdge(t)}UC(t){this.On.add(t);let e=t.link;e!==null&&this.findEdge(e)===null&&this._y.set(e,t),t.network=this}addLink(t){let e=t.fromNode,i=t.toNode,s=this.findEdge(t);return s===null?(s=this.createEdge(),s.link=t,e!==null&&(s.fromVertex=this.addNode(e)),i!==null&&(s.toVertex=this.addNode(i)),this.addEdge(s)):(e!==null?s.fromVertex=this.addNode(e):s.fromVertex=null,i!==null?s.toVertex=this.addNode(i):s.toVertex=null),s}deleteEdge(t){let e=t.toVertex;e!==null&&e.deleteSourceEdge(t);let i=t.fromVertex;i!==null&&i.deleteDestinationEdge(t),this.VC(t)}VC(t){let e=this.On.delete(t);if(e){let i=t.link;i!==null&&this._y.delete(i)}return e}deleteLink(t){let e=this.findEdge(t);e!==null&&this.deleteEdge(e)}findEdge(t){return this._y.get(t)}linkVertexes(t,e,i){if(t===null||e===null)return null;if(t.network===this&&e.network===this){let s=this.createEdge();return s.link=i,s.fromVertex=t,s.toVertex=e,this.addEdge(s),s}return null}reverseEdge(t){let e=t.fromVertex,i=t.toVertex;e===null||i===null||(e.deleteDestinationEdge(t),i.deleteSourceEdge(t),t.reverseEdge(),e.addSourceEdge(t),i.addDestinationEdge(t))}deleteSelfEdges(){let t=m.st(),e=this.On.iterator;for(;e.next();){let s=e.value;s.fromVertex===s.toVertex&&t.push(s)}let i=t.length;for(let s=0;s<i;s++)this.deleteEdge(t[s]);m.Z(t)}deleteArtificialVertexes(){let t=m.st(),e=this.bo.iterator;for(;e.next();){let o=e.value;o.node===null&&o.data===null&&t.push(o)}let i=t.length;for(let o=0;o<i;o++)this.deleteVertex(t[o]);let s=m.st(),n=this.On.iterator;for(;n.next();){let o=n.value;o.link===null&&o.data===null&&s.push(o)}i=s.length;for(let o=0;o<i;o++)this.deleteEdge(s[o]);m.Z(t),m.Z(s)}deleteUselessEdges(){let t=m.st(),e=this.On.iterator;for(;e.next();){let s=e.value;(s.fromVertex===null||s.toVertex===null)&&t.push(s)}let i=t.length;for(let s=0;s<i;s++)this.deleteEdge(t[s]);m.Z(t)}isSingleton(t){return!(t.er.count>0||t.ir.count>0)}splitIntoSubNetworks(t){t===void 0&&(t=!0),t&&(this.deleteArtificialVertexes(),this.deleteUselessEdges(),this.deleteSelfEdges());let e=new q,i=!0;for(;i;){i=!1;let s=this.bo.iterator;for(;s.next();){let n=s.value;if(this.isSingleton(n))continue;let o=this.layout.createNetwork();e.add(o),this.ZE(o,n),i=!0;break}}return e.sort((s,n)=>s===null||n===null||s===n?0:n.vertexes.count-s.vertexes.count),e}ZE(t,e){if(e===null)return;let i=new q;for(i.add(e);i.count>0;){let s=i.first();if(i.removeAt(0),!s||s.network===t)continue;this.bv(s),t.addVertex(s);let n=s.sourceEdges;for(;n.next();){let o=n.value;o.network!==t&&(this.VC(o),t.UC(o),o.fromVertex&&i.add(o.fromVertex))}for(n=s.destinationEdges;n.next();){let o=n.value;o.network!==t&&(this.VC(o),t.UC(o),o.toVertex&&i.add(o.toVertex))}}}findAllParts(){let t=new V,e=this.bo.iterator;for(;e.next();){let s=e.value;s.node&&t.add(s.node)}let i=this.On.iterator;for(;i.next();){let s=i.value;s.link&&t.add(s.link)}return t}}class Ie{xo;te;Ri;Ui;es;er;ir;constructor(t){V.Je(this),this.xo=t,this.Ui=new I(0,0,10,10),this.es=new P(5,5),this.te=null,this.Ri=null,this.er=new q,this.ir=new q}clear(){this.te=null,this.Ri=null,this.er=new q,this.ir=new q}toString(t){t===void 0&&(t=0);let e="LayoutVertex#"+V.xs(this);if(t>0&&(e+=this.node!==null?"("+this.node.toString()+")":"",t>1)){let i="",s=!0,n=this.er.iterator;for(;n.next();){let r=n.value;s?s=!1:i+=",",i+=r.toString(0)}let o="";for(s=!0,n=this.ir.iterator;n.next();){let r=n.value;s?s=!1:o+=",",o+=r.toString(0)}e+=" sources: "+i+" destinations: "+o}return e}get ko(){return this.er.AL}get sr(){return this.ir.AL}get data(){return this.te}set data(t){if(this.te=t,t!==null&&t.bounds){let e=t.bounds,i=e.x,s=e.y,n=e.width,o=e.height;this.es.e(n/2,o/2),this.Ui.e(i,s,n,o)}}get node(){return this.Ri}set node(t){if(this.Ri!==t){if(this.Ri=t,t===null)return;t.ensureBounds();let e=this.network.layout,i=I.l(),s=e.getLayoutBounds(t,i),n=s.x,o=s.y,r=s.width,a=s.height;if(isNaN(n)&&(n=0),isNaN(o)&&(o=0),this.Ui.e(n,o,r,a),I.i(i),!(t instanceof ht)){let h=t.locationObject.getDocumentPoint(T.Center);if(h.isReal()){this.es.e(h.x-n,h.y-o);return}}this.es.e(r/2,a/2)}}get bounds(){return this.Ui}set bounds(t){this.Ui.equals(t)||this.Ui.h(t)}get focus(){return this.es}set focus(t){this.es.equals(t)||this.es.h(t)}get centerX(){return this.Ui.x+this.es.x}set centerX(t){let e=this.Ui;e.x+this.es.x!==t&&(e.x=t-this.es.x)}get centerY(){return this.Ui.y+this.es.y}set centerY(t){let e=this.Ui;e.y+this.es.y!==t&&(e.y=t-this.es.y)}get focusX(){return this.es.x}set focusX(t){let e=this.es;e.x!==t&&(e.x=t)}get focusY(){return this.es.y}set focusY(t){let e=this.es;e.y!==t&&(e.y=t)}get x(){return this.Ui.x}set x(t){let e=this.Ui;e.x!==t&&(e.x=t)}get y(){return this.Ui.y}set y(t){let e=this.Ui;e.y!==t&&(e.y=t)}get width(){return this.Ui.width}set width(t){let e=this.Ui;e.width!==t&&(e.width=t)}get height(){return this.Ui.height}set height(t){let e=this.Ui;e.height!==t&&(e.height=t)}commit(){let t=this.te;if(t!==null){let i=this.bounds,s=t.bounds;m.$(s)?(s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height):t.bounds=i.copy();return}let e=this.node;if(e!==null){let i=this.bounds;if(!(e instanceof ht)){let s=I.l();e.ensureBounds();let n=this.network.layout.getLayoutBounds(e,s),o=e.locationObject.getDocumentPoint(T.Center);if(n.isReal()&&o.isReal()){e.moveTo(i.x+this.focusX-(o.x-n.x)+e.margin.left,i.y+this.focusY-(o.y-n.y+e.margin.top)),I.i(s);return}I.i(s)}e.moveTo(i.x+e.margin.left,i.y+e.margin.top)}}addSourceEdge(t){t!==null&&(this.er.has(t)||this.er.add(t))}deleteSourceEdge(t){t!==null&&this.er.delete(t)}addDestinationEdge(t){t!==null&&(this.ir.has(t)||this.ir.add(t))}deleteDestinationEdge(t){t!==null&&this.ir.delete(t)}get network(){return this.xo}set network(t){this.xo=t}get sourceVertexes(){let t=new V,e=this.sourceEdges;for(;e.next();){let i=e.value;i.fromVertex&&t.add(i.fromVertex)}return t.iterator}get destinationVertexes(){let t=new V,e=this.destinationEdges;for(;e.next();){let i=e.value;i.toVertex&&t.add(i.toVertex)}return t.iterator}get vertexes(){let t=new V,e=this.sourceEdges;for(;e.next();){let i=e.value;i.fromVertex&&t.add(i.fromVertex)}for(e=this.destinationEdges;e.next();){let i=e.value;i.toVertex&&t.add(i.toVertex)}return t.iterator}get sourceEdges(){return this.er.iterator}get destinationEdges(){return this.ir.iterator}get edges(){let t=new q,e=this.sourceEdges;for(;e.next();){let i=e.value;t.add(i)}for(e=this.destinationEdges;e.next();){let i=e.value;t.add(i)}return t.iterator}get edgesCount(){return this.er.count+this.ir.count}static standardComparer(t,e){let i=t.Ri,s=e.Ri;if(i)if(s){let n=i.text,o=s.text;return n<o?-1:n>o?1:0}else return 1;else return s!==null?-1:0}static smartComparer(t,e){if(t!==null)if(e!==null){let i=t.Ri,s=e.Ri;if(i!==null)if(s!==null){let n=i.text.toLocaleLowerCase(),o=s.text.toLocaleLowerCase(),r=n.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),a=o.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),h=0;for(;h<r.length;h++)if(a[h]!==""&&a[h]!==void 0){let l=parseFloat(r[h]),u=parseFloat(a[h]);if(isNaN(l))if(isNaN(u)){if(r[h].localeCompare(a[h])!==0)return r[h].localeCompare(a[h]);continue}else return 1;else{if(isNaN(u))return-1;if(l-u!==0)return l-u;continue}}else{if(r[h]==="")continue;return 1}return a[h]!==""&&a[h]!==void 0?-1:0}else return 1;else return s!==null?-1:0}else return 1;else return e!==null?-1:0}}class ei{xo;te;ts;is;ss;constructor(t){V.Je(this),this.xo=t,this.te=null,this.ts=null,this.is=null,this.ss=null}clear(){this.te=null,this.ts=null,this.is=null,this.ss=null}toString(t){t===void 0&&(t=0);let e="LayoutEdge#"+V.xs(this);return t>0&&(e+=this.ts!==null?"("+this.ts.toString()+")":"",t>1&&(e+=" "+(this.is?this.is.toString():"null")+" --> "+(this.ss?this.ss.toString():"null"))),e}reverseEdge(){let t=this.is;this.is=this.ss,this.ss=t}commit(){}getOtherVertex(t){return this.ss===t?this.is:this.is===t?this.ss:null}get network(){return this.xo}set network(t){this.xo=t}get data(){return this.te}set data(t){this.te!==t&&(this.te=t)}get link(){return this.ts}set link(t){this.ts!==t&&(this.ts=t)}get fromVertex(){return this.is}set fromVertex(t){this.is!==t&&(this.is=t)}get toVertex(){return this.ss}set toVertex(t){this.ss!==t&&(this.ss=t)}}var Zi=(x=>(x[x.Position=0]="Position",x[x.Location=1]="Location",x))(Zi||{}),Qi=(x=>(x[x.LeftToRight=10]="LeftToRight",x[x.RightToLeft=11]="RightToLeft",x))(Qi||{}),_i=(x=>(x[x.Forwards=20]="Forwards",x[x.Reverse=21]="Reverse",x[x.Ascending=22]="Ascending",x[x.Descending=23]="Descending",x))(_i||{});class Ue extends _t{mg;pg;vo;In;de;He;Si;Mi;constructor(t){super(),this.isViewportSized=!0,this.mg=NaN,this.pg=NaN,this.vo=new st(NaN,NaN).k(),this.In=new st(10,10).k(),this.de=1,this.He=10,this.Si=22,this.Mi=Ue.standardComparer,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.mg=this.mg,t.pg=this.pg,t.vo.h(this.vo),t.In.h(this.In),t.de=this.de,t.He=this.He,t.Si=this.Si,t.Mi=this.Mi}fe(t){t in _i?this.sorting=t:t in Qi?this.arrangement=t:t in Zi?this.alignment=t:super.fe(t)}doLayout(t){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);let e=this.collectParts(t),i=this.diagram,s=e.copy().iterator;for(;s.next();){let f=s.value;if(f.Nr()&&(f.fromNode!==null||f.toNode!==null)){e.delete(f);continue}if(f.ensureBounds(),f instanceof ht){let p=f.memberParts;for(;p.next();){let g=p.value;e.delete(g)}}}let n=e.toArray();if(n.length===0)return;switch(this.sorting){case 20:break;case 21:n.reverse();break;case 22:n.sort(this.comparer);break;case 23:n.sort(this.comparer),n.reverse();break}let o=this.wrappingColumn;isNaN(o)&&(o=0);let r=this.wrappingWidth;if(isNaN(r)&&i!==null){let f=i.viewportBounds,p=i.padding;r=Math.max(f.width-p.left-p.right,0)}else r=Math.max(this.wrappingWidth,0);o<=0&&r<=0&&(o=1);let a=this.spacing.width;isFinite(a)||(a=0);let h=this.spacing.height;isFinite(h)||(h=0),i!==null&&i.startTransaction("Layout");let l=[];switch(this.alignment){case 0:this.QE(n,r,o,a,h,l);break;case 1:this._E(n,r,o,a,h,l);break}let u=0,c=0,d=0;for(let f=0;f<l.length;f++){let p=l[f];u=Math.min(u,p.x),c=Math.min(c,p.y),d=Math.max(d,p.x+p.width)}this.arrangement===11?this.commitLayers(l,new P(u+a/2-(d+u),c-h/2)):this.commitLayers(l,new P(u-a/2,c-h/2)),i!==null&&i.commitTransaction("Layout"),this.isValidLayout=!0}QE(t,e,i,s,n,o){let r=I.l(),a=Math.max(this.cellSize.width,1);if(!isFinite(a)){a=0;for(let y=0;y<t.length;y++){let b=t[y],v=this.getLayoutBounds(b,r);a=Math.max(a,v.width)}}a+=s,a=Math.max(a,1);let h=Math.max(this.cellSize.height,1);if(!isFinite(h)){h=0;for(let y=0;y<t.length;y++){let b=t[y],v=this.getLayoutBounds(b,r);h=Math.max(h,v.height)}}h+=n,h=Math.max(h,1);let l=this.arrangement,u=this.arrangementOrigin.x,c=this.arrangementOrigin.y,d=u,f=c,p=0,g=0;for(let y=0;y<t.length;y++){let b=t[y],v=this.getLayoutBounds(b,r),w=Math.ceil((v.width+s)/a),k=Math.ceil((v.height+n)/h),S=w*a,N=k*h,D=0;switch(l){case 11:D=Math.abs(d-v.width);break;default:D=d+v.width;break}(i>0&&p>i-1||e>0&&p>0&&D-u>e)&&(o.push(new I(0,f,e+s,g)),p=0,d=u,f+=g,g=0),g=Math.max(g,N);let L=0;switch(l){case 11:L=-v.width;break;default:L=0;break}switch(b.moveTo(d+L+b.margin.left,f+b.margin.top),l){case 11:d-=S;break;default:d+=S;break}p++}o.push(new I(0,f,e+s,g)),I.i(r)}_E(t,e,i,s,n,o){let r=I.l(),a=Math.max(this.cellSize.width,1),h=0,l=0,u=0,c=P.l();for(let L=0;L<t.length;L++){let M=t[L],A=this.getLayoutBounds(M,r),F=M.getRelativePoint(M.locationObject,M.locationSpot,c);h=Math.max(h,F.x),l=Math.max(l,A.width-F.x),u=Math.max(u,F.y)}let d=this.arrangement;switch(d){case 11:h+=s;break;default:l+=s;break}isFinite(a)?a=Math.max(a+s,1):a=Math.max(h+l,1);let f=this.arrangementOrigin.x,p=this.arrangementOrigin.y,g=f,y=p,b=0;e>=h&&(e-=h);let v=0,w=0,k=Math.max(this.cellSize.height,1);u=0;let S=0,N=!0,D=P.l();for(let L=0;L<t.length;L++){let M=t[L],A=this.getLayoutBounds(M,r),F=M.getRelativePoint(M.locationObject,M.locationSpot,c);if(b>0)switch(d){case 11:{let E=(g-f-(A.width-F.x))/a;C.X(Math.round(E),E)?E=Math.round(E):E=Math.floor(E),g=E*a+f;break}default:{let E=(g-f+F.x)/a;C.X(Math.round(E),E)?E=Math.round(E):E=Math.ceil(E),g=E*a+f;break}}else switch(d){case 11:v=g+F.x+A.width;break;default:v=g-F.x;break}let O=0;switch(d){case 11:O=-(g+F.x)+v;break;default:O=g+A.width-F.x-v;break}if(i>0&&b>i-1||e>0&&b>0&&O>e){o.push(new I(0,N?y-u:y,e+s,S+u+n));for(let E=0;E<b&&L!==b;E++){let B=t[L-b+E],X=B.getRelativePoint(B.locationObject,B.locationSpot,D);B.moveTo(B.position.x,B.position.y+u-X.y)}S+=n,N?y+=S:y+=S+u,u=0,S=0,b=0,g=f,N=!1}switch(g===f&&(d===11?w=Math.max(w,A.width-F.x):w=Math.min(w,-F.x)),u=Math.max(u,F.y),S=Math.max(S,A.height-F.y),isFinite(k)&&(S=Math.max(S,Math.max(A.height,k)-F.y)),N?M.moveTo(g-F.x,y-F.y):M.moveTo(g-F.x,y),d){case 11:g-=F.x+s;break;default:g+=A.width-F.x+s;break}b++}if(o.push(new I(0,y,e+s,(N?S:S+u)+n)),t.length!==b)for(let L=0;L<b;L++){let M=t[t.length-b+L],A=M.getRelativePoint(M.locationObject,M.locationSpot,c);M.moveTo(M.position.x,M.position.y+u-A.y)}if(P.i(c),P.i(D),d===11)for(let L=0;L<o.length;L++){let M=o[L];M.width+=w,M.x-=w}else for(let L=0;L<o.length;L++){let M=o[L];M.x>w&&(M.width+=M.x-w,M.x=w)}I.i(r)}commitLayers(t,e){}get wrappingWidth(){return this.mg}set wrappingWidth(t){this.mg!==t&&(m.s(t,"number",Ue,"wrappingWidth"),(t>0||isNaN(t))&&(this.mg=t,this.isViewportSized=isNaN(t),this.p()))}get wrappingColumn(){return this.pg}set wrappingColumn(t){this.pg!==t&&(m.s(t,"number",Ue,"wrappingColumn"),(t>0||isNaN(t))&&(this.pg=t,this.p()))}get cellSize(){return this.vo}set cellSize(t){this.vo.equals(t)||(this.vo.h(t),this.p())}get spacing(){return this.In}set spacing(t){this.In.equals(t)||(this.In.h(t),this.p())}get alignment(){return this.de}set alignment(t){this.de!==t&&(t===1||t===0)&&(this.de=t,this.p())}get arrangement(){return this.He}set arrangement(t){this.He!==t&&(t===10||t===11)&&(this.He=t,this.p())}get sorting(){return this.Si}set sorting(t){this.Si!==t&&(t===20||t===21||t===22||t===23)&&(this.Si=t,this.p())}get comparer(){return this.Mi}set comparer(t){this.Mi!==t&&(m.S(t,Ue,"comparer"),this.Mi=t,this.p())}static standardComparer(t,e){let i=t.text,s=e.text;return i<s?-1:i>s?1:0}static smartComparer(t,e){if(t!==null)if(e!==null){let i=t.text.toLocaleLowerCase(),s=e.text.toLocaleLowerCase(),n=i.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),o=s.split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),r=0;for(;r<n.length;r++)if(o[r]!==""&&o[r]!==void 0){let a=parseFloat(n[r]),h=parseFloat(o[r]);if(isNaN(a))if(isNaN(h)){if(n[r].localeCompare(o[r])!==0)return n[r].localeCompare(o[r]);continue}else return 1;else{if(isNaN(h))return-1;if(a-h!==0)return a-h;continue}}else{if(n[r]==="")continue;return 1}return o[r]!==""&&o[r]!==void 0?-1:0}else return 1;else return e!==null?-1:0}static Position=0;static Location=1;static LeftToRight=10;static RightToLeft=11;static Forward=20;static Reverse=21;static Ascending=22;static Descending=23}class ge{yg;on;Nt;Po;wg;xg;a;BC;constructor(){this.yg=new V,this.on=new V,this.Nt=new V,this.Po=new Mt,this.wg=new Mt,this.xg=new Mt,this.a=null,this.BC=!1}clear(){this.yg.clear(),this.on.clear(),this.Nt.clear(),this.Po.clear(),this.wg.clear(),this.xg.clear()}Ro(t){this.a=t}ch(t){if(t instanceof $){if(this.yg.add(t),t instanceof ht){let i=t.containingGroup;i===null?this.diagram.Wr.add(t):i.Ch.add(t);let s=t.layout;s!==null&&(s.diagram=this.diagram)}}else t instanceof j?(this.on.add(t),t.isAvoiding&&(this.diagram.np=!0)):t instanceof vt||this.Nt.add(t);let e=t.data;e!==null&&(t instanceof vt||(t instanceof j?this.kv(e,t):this.Po.set(e,t)))}ri(t){if(t.clearAdornments(),t instanceof $){if(this.yg.delete(t),t instanceof ht){let i=t.containingGroup;i===null?this.diagram.Wr.delete(t):i.Ch.delete(t);let s=t.layout;s!==null&&(s.diagram=null)}}else t instanceof j?this.on.delete(t):t instanceof vt||this.Nt.delete(t);let e=t.data;e!==null&&(t instanceof vt||(t instanceof j?this.Pv(e,t):this.Po.delete(e)))}kv(t,e){this.wg.set(t,e)}Pv(t,e){this.wg.delete(t)}rebuildParts(){let t=this.diagram;if(t===null)return;let e=t.nodeTemplateMap.iterator;for(;e.next();){let d=e.value,f=e.key;(!d.Di()||d instanceof ht)&&m.o(`Invalid node template in Diagram.nodeTemplateMap: template for "${f}" must be a Node or a simple Part, not a Group or Link: ${d}`)}let i=t.groupTemplateMap.iterator;for(;i.next();){let d=i.value,f=i.key;d instanceof ht||m.o(`Invalid group template in Diagram.groupTemplateMap: template for "${f}" must be a Group, not a normal Node or Link: ${d}`)}let s=t.linkTemplateMap.iterator;for(;s.next();){let d=s.value,f=s.key;d instanceof j||m.o(`Invalid link template in Diagram.linkTemplateMap: template for "${f}" must be a Link, not a normal Node or simple Part: ${d}`)}let n=m.st(),o=t.selection.iterator;for(;o.next();){let d=o.value.data;d&&n.push(d)}let r=m.st(),a=t.highlighteds.iterator;for(;a.next();){let d=a.value.data;d&&r.push(d)}let h=m.st(),l=this.nodes.iterator;for(;l.next();){let d=l.value;d.data!==null&&(h.push(d.data),h.push(d.location))}let u=this.links.iterator;for(;u.next();){let d=u.value;d.data!==null&&(h.push(d.data),h.push(d.location))}let c=this.parts.iterator;for(;c.next();){let d=c.value;d.data!==null&&(h.push(d.data),h.push(d.location))}this.Sv(),this.T2();for(let d=0;d<n.length;d++){let f=this.findPartForData(n[d]);f!==null&&(f.isSelected=!0)}for(let d=0;d<r.length;d++){let f=this.findPartForData(r[d]);f!==null&&(f.isHighlighted=!0)}for(let d=0;d<h.length;d+=2){let f=this.findPartForData(h[d]);f!==null&&(f.location=h[d+1])}m.Z(n),m.Z(r),m.Z(h)}T2(){let t=this.diagram.model;this.tw(t.nodeDataArray)}tw(t,e){let i=this.diagram.model;t.forEach(s=>{i.containsNodeData(s)&&this.Mv(s,!1)}),t.forEach(s=>{i.containsNodeData(s)&&this.Pk(s)}),e!==!1&&this.diagram.l1(!1)}Mv(t,e){if(t==null||this.diagram.undoManager.isUndoingRedoing||this.Po.has(t))return null;e===void 0&&(e=!0);let i=this.t3(t);return i!==null&&e&&this.Pk(t),i}t3(t){if(t==null||this.diagram.undoManager.isUndoingRedoing||this.Po.has(t))return null;let e=this.e3(t),i=this.findTemplateForNodeData(t,e);if(i!==null){i.It();let s=i.copy();if(s!==null){let n=this.diagram.wi;return this.diagram.wi=!0,s.$o=e,s.te=t,this.addsToTemporaryLayer&&(s.cl="Tool"),this.diagram.add(s),s.te=null,s.data=t,this.diagram.wi=n,s}}return null}insertLink(t,e,i,s){return null}Pk(t){}e3(t){return this.diagram.model.getCategoryForNodeData(t)}static Nv=!1;static Cv=!1;findTemplateForNodeData(t,e){let i=this.diagram,s=i.model,n=s.Th()&&s.isGroupForData(t),o=null;return n?(o=i.groupTemplateMap.get(e),o===null&&(o=i.groupTemplateMap.get(""),o===null&&(ge.Cv||(ge.Cv=!0,m.ne('No Group template found for category "'+e+'"'),m.ne(" Using default group template")),o=i.i2))):(o=i.nodeTemplateMap.get(e),o===null&&(o=i.nodeTemplateMap.get(""),o===null&&(ge.Nv||(ge.Nv=!0,m.ne('No Node template found for category "'+e+'"'),m.ne(" Using default node template")),o=i._M))),o}getLinkCategoryForData(t){return""}setLinkCategoryForData(t,e){}setFromNodeForLink(t,e,i){}setToNodeForLink(t,e,i){}static Lv=!1;findLinkTemplateForCategory(t){let e=this.diagram,i=e.linkTemplateMap.get(t);return i===null&&(i=e.linkTemplateMap.get(""),i===null&&(ge.Lv||(ge.Lv=!0,m.ne('No Link template found for category "'+t+'"'),m.ne(" Using default link template")),i=e.t2)),i}jI(t,e,i){t instanceof j?(e!==null&&this.Pv(e,t),i!==null&&this.kv(i,t)):t instanceof pt&&(e!==null&&this.Po.delete(e),i!==null&&this.Po.set(i,t))}Sv(){let t=this.diagram.model;this.zC(t.nodeDataArray)}zC(t){t.forEach(e=>{this.Sk(e)})}Sk(t){let e=this.findPartForData(t);e!==null&&(this.diagram.C2(e,!1),this.XC(e))}XC(t){}LC(t){}findPartForKey(t){if(t==null)return null;let e=this.diagram.model.findNodeDataForKey(t);return e!==null?this.Po.get(e):null}findNodeForKey(t){if(t==null)return null;let e=this.diagram.model.findNodeDataForKey(t);if(e===null)return null;let i=this.Po.get(e);return i instanceof $?i:null}findLinkForKey(t){return null}findPartForData(t){if(t===null)return null;let e=this.Po.get(t);return e!==null||(e=this.wg.get(t)),e}findNodeForData(t){if(t===null)return null;let e=this.Po.get(t);return e instanceof $?e:null}findLinkForData(t,e){return t===null?null:this.wg.get(t)}findNodesByExample(...t){let e=new V,i=this.yg.iterator;for(;i.next();){let s=i.value,n=s.data;if(n!==null)for(let o=0;o<arguments.length;o++){let r=arguments[o];if(m.$(r)&&this.GC(n,r)){e.add(s);break}}}return e.iterator}findLinksByExample(...t){let e=new V,i=this.on.iterator;for(;i.next();){let s=i.value,n=s.data;if(n!==null)for(let o=0;o<arguments.length;o++){let r=arguments[o];if(m.$(r)&&this.GC(n,r)){e.add(s);break}}}return e.iterator}GC(t,e){for(let i in e){let s=t[i],n=e[i];if(Array.isArray(n)){if(!Array.isArray(s))return!1;let o=s,r=n;if(o.length<r.length)return!1;for(let a=0;a<o.length;a++){let h=o[a],l=r[a];if(l!==void 0&&!this.Av(h,l))return!1}}else if(!this.Av(s,n))return!1}return!0}Av(t,e){if(m.it(e)){if(!e(t))return!1}else if(e instanceof RegExp){if(!t||!e.test(t.toString()))return!1}else if(m.$(t)&&m.$(e)){if(!this.GC(t,e))return!1}else if(t!==e)return!1;return!0}doModelDataChanged(t){if(t.model===this.diagram.model&&this.diagram.G){this.diagram.G=!1;try{let e=t.change;t.modelChange===""&&t.object!==null&&e===2&&this.ew(t.object,t.propertyName)}finally{this.diagram.G=!0}}}doModelChanged(t){let e=this.diagram;if(!e||t.model!==e.model)return;let i=t.change;if(e.LO(t),!!e.G){e.G=!1;try{let s=t.modelChange;if(s!=="")if(i===2){if(s==="nodeCategory"){let n=t.object;if(n!==null){let o=this.findPartForData(n),r=t.newValue;o!==null&&typeof r=="string"&&(o.category=r)}}else if(s==="nodeDataArray"){let n=t.oldValue;this.zC(n);let o=t.newValue;this.tw(o)}e.isModified=!0}else if(i===3){let n=t.newValue;s==="nodeDataArray"&&m.$(n)&&this.Mv(n),e.isModified=!0}else if(i===4){let n=t.oldValue;s==="nodeDataArray"&&m.$(n)&&this.Sk(n),e.isModified=!0}else i===1&&(s==="SourceChanged"?t.object!==null?this.ew(t.object,t.propertyName):(this.updateAllRelationshipsFromData(),this.updateAllTargetBindings()):s==="ModelDisplaced"&&this.rebuildParts());else if(i===2){let n=t.propertyName,o=t.object,r=e.model;o===r?(n==="nodeKeyProperty"||n==="nodeCategoryProperty")&&(e.undoManager.isUndoingRedoing||this.rebuildParts()):o!==null&&this.ew(o,n),e.isModified=!0}else(i===3||i===4)&&(this.i3(t,e.model),e.isModified=!0)}finally{e.G=!0}}}updateAllTargetBindings(t){t===void 0&&(t="");let e=this.parts.iterator;for(;e.next();)e.value.updateTargetBindings(t);for(e=this.nodes.iterator;e.next();)e.value.updateTargetBindings(t);for(e=this.links.iterator;e.next();)e.value.updateTargetBindings(t)}updateAllThemeBindings(){let t=this.parts.iterator;for(;t.next();)t.value.zo();for(t=this.nodes.iterator;t.next();)t.value.zo();for(t=this.links.iterator;t.next();)t.value.zo()}updateAllRelationshipsFromData(){let t=this.diagram.model,e=new V,i=t.nodeDataArray;for(let o=0;o<i.length;o++){let r=i[o];e.add(r)}let s=[];this.nodes.each(o=>{o.data!==null&&!e.has(o.data)&&s.push(o.data)}),this.parts.each(o=>{o.data!==null&&!e.has(o.data)&&s.push(o.data)}),s.forEach(o=>t.Tv(o,!1));for(let o=0;o<i.length;o++){let r=i[o];this.findPartForData(r)===null&&t.Dv(r,!1)}this.vv();let n=this.parts.iterator;for(;n.next();)n.value.updateRelationshipsFromData();for(n=this.nodes.iterator;n.next();)n.value.updateRelationshipsFromData();for(n=this.links.iterator;n.next();)n.value.updateRelationshipsFromData()}vv(){}updateRelationshipsFromData(t){}ew(t,e){if(typeof e=="string"){let i=this.findPartForData(t);if(i!==null)i.updateTargetBindings(e);else{let s=this.s3(t);if(s!==null&&s.length>0){for(let o=0;o<s.length;o++)s[o].updateTargetBindings(e);let n=s[0].part;if(n!==null){let o=n.adornments;for(;o.next();)o.value.updateTargetBindings(e)}m.Z(s)}}t===this.diagram.model.modelData&&this.updateAllTargetBindings(e)}}s3(t){let e=null,i=this.xg.iterator;for(;i.next();){let s=i.value;for(let n=0;n<s.length;n++){let o=s[n].findItemPanelForData(t);o!==null&&(e===null&&(e=m.st()),e.push(o))}if(e!==null)break}return e}YC(t){return this.xg.get(t)}i3(t,e){let i=t.object;if(!Array.isArray(i))return;let s=t.change===3,n=s?t.newParam:t.oldParam,o=s?t.newValue:t.oldValue,r=this.YC(i);if(Array.isArray(r))for(let a=0;a<r.length;a++){let h=r[a];s?h.J1(o,n,!0):h.$I(n)}}M2(t,e){e!==null&&t.Pn(s=>e.uT(s));let i=t.Ta;if(Array.isArray(i)){let s=this.YC(i);if(s===null)this.xg.set(i,[t]);else{for(let n=0;n<s.length;n++)if(s[n]===t)return;s.push(t)}}}N2(t,e){t.Pn(s=>e.TO(s));let i=t.Ta;if(Array.isArray(i)){let s=this.YC(i);if(s!==null){for(let n=0;n<s.length;n++)if(s[n]===t){s.splice(n,1),s.length===0&&this.xg.delete(i);return}}}}copyParts(t,e,i){i===void 0&&(i=!1);let s=new Mt;if(Array.isArray(t))for(let o=0;o<t.length;o++)this.Mk(t[o],e,s,i);else{let o=t.iterator;for(;o.next();)this.Mk(o.value,e,s,i)}if(e!==null){let o=e.model,r=e.Cp().dragsLink,a=new V,h=new Mt,l=s.iterator;for(;l.next();){let u=l.value;if(u instanceof j)!r&&(u.fromNode===null||u.toNode===null)&&a.add(u);else if(u instanceof $&&u.data!==null){if(o.Nx()){let c=u,d=l.key,f=d.findTreeParentNode();if(f!==null){let p=s.get(f);if(p!==null){o.setParentKeyForNodeData(c.data,o.getKeyForNodeData(p.data));let g=e.findLinkForData(c.data),y=d.findTreeParentLink();y!==null&&g!==null&&h.set(y,g)}}}else if(o.Fv()){let c=u,d=l.key,f=o.isRelatedKeysPathTo?d.findNodesOutOf():d.findNodesInto();for(;f.next();){let p=f.value,g=s.get(p);if(g!==null){o.addRelatedKeyForNodeData(c.data,g.key);let y=e.partManager.findLinkForData(c.data,g.key),b=this.findLinkForData(d.data,p.key);b!==null&&y!==null&&h.set(b,y)}else o.removeRelatedKeyForNodeData(c.data,p.key)}}}}if(a.count>0&&e.removeParts(a,!1),h.count>0){let u=h.iterator;for(;u.next();){let c=u.key,d=u.value;s.set(c,d)}}}if(e!==null&&this.diagram!==null){let o=e.model,r=o.afterCopyFunction;if(r!==null){let a=new Mt;s.each(l=>{l.key.data!==null&&a.set(l.key.data,l.value.data)});let h=this.diagram.model;r(a,o,h)}}let n=s.iterator;for(;n.next();)n.value.updateTargetBindings();return s}Mk(t,e,i,s){if(t===null||s&&!t.canCopy())return null;if(i.has(t))return i.get(t);let n=this.KC(t,e);if(!(n instanceof pt))return null;if(n.isSelected=!1,n.isHighlighted=!1,i.set(t,n),t instanceof $){let o=t.linksConnected;for(;o.next();){let r=o.value;if(r.fromNode===t){let a=i.get(r);a!==null&&(a.fromNode=n)}if(r.toNode===t){let a=i.get(r);a!==null&&(a.toNode=n)}}if(t instanceof ht&&n instanceof ht){let r=t.memberParts;for(;r.next();){let a=r.value,h=this.Mk(a,e,i,s);h instanceof j||h!==null&&(h.containingGroup=n)}}}else if(t instanceof j&&n instanceof j){let o=t.fromNode;if(o!==null){let h=i.get(o);h!==null&&(n.fromNode=h)}let r=t.toNode;if(r!==null){let h=i.get(r);h!==null&&(n.toNode=h)}let a=t.labelNodes;for(;a.next();){let h=a.value,l=this.Mk(h,e,i,s);l!==null&&l instanceof $&&(l.labeledLink=n)}}return n}KC(t,e){let i=null,s=t.data;if(s!==null&&e!==null){let n=e.model;if(!(t instanceof j)){let o=n.copyNodeData(s);n.addNodeData(o),i=e.findPartForData(o)}}else if(t.It(),i=t.copy(),i!==null){let n=this.diagram;if(e!==null)e.add(i);else if(s!==null&&n!==null&&n.commandHandler!==null&&n.commandHandler.copiesClipboardData){let o=n.model,r=null;i instanceof j||(r=o.copyNodeData(s)),i.data=r}}return i}get nodes(){return this.yg}get links(){return this.on}get parts(){return this.Nt}get diagram(){return this.a}get addsToTemporaryLayer(){return this.BC}set addsToTemporaryLayer(t){this.BC=t}}class Zn extends ge{T2(){let t=this.diagram.model;this.tw(t.nodeDataArray),this.Rv(t.linkDataArray)}tw(t){super.tw(t,!1);let e=this.links.iterator;for(;e.next();)e.value.Jd();this.diagram.l1(!1)}Rv(t){t.forEach(e=>{this.Ov(e)}),this.diagram.l1(!1)}Ov(t){if(t==null||this.diagram.undoManager.isUndoingRedoing||this.findLinkForData(t))return null;let e=this.getLinkCategoryForData(t),i=this.findLinkTemplateForCategory(e);if(i!==null){i.It();let s=i.copy();if(s!==null){let n=this.diagram.wi;this.diagram.wi=!0,s.$o=e,s.te=t;let o=this.diagram.model,r=o.Nk(t,!0);r!==""&&(s.fromPortId=r);let a=o.Vi(t,!0);if(a!==void 0){let c=this.findNodeForKey(a);c instanceof $&&(s.fromNode=c)}let h=o.Nk(t,!1);h!==""&&(s.toPortId=h);let l=o.Vi(t,!1);if(l!==void 0){let c=this.findNodeForKey(l);c instanceof $&&(s.toNode=c)}let u=o.getLabelKeysForLinkData(t);return Array.isArray(u)&&u.forEach(c=>{let d=this.findNodeForKey(c);d!==null&&(d.labeledLink=s)}),this.addsToTemporaryLayer&&(s.cl="Tool"),this.diagram.add(s),s.te=null,s.data=t,this.diagram.wi=n,s}}return null}Sv(){let t=this.diagram.model;this.Iv(t.linkDataArray),this.zC(t.nodeDataArray)}Iv(t){t.forEach(e=>{this.Sk(e)})}getLinkCategoryForData(t){return this.diagram.model.getCategoryForLinkData(t)}setLinkCategoryForData(t,e){return this.diagram.model.setCategoryForLinkData(t,e)}setFromNodeForLink(t,e,i){let s=this.diagram.model,n=e!==null?e.data:null;s.setFromKeyForLinkData(t.data,s.getKeyForNodeData(n))}setToNodeForLink(t,e,i){let s=this.diagram.model,n=e!==null?e.data:null;s.setToKeyForLinkData(t.data,s.getKeyForNodeData(n))}LC(t){this.diagram.model.removeLinkData(t.data)}findPartForKey(t){let e=super.findPartForKey(t);if(e===null){let i=this.diagram.model.findLinkDataForKey(t);if(i!==null)return this.findLinkForData(i)}return e}findLinkForKey(t){if(t==null)return null;let e=this.diagram.model.findLinkDataForKey(t);return e!==null?this.findLinkForData(e):null}doModelChanged(t){if(super.doModelChanged(t),!this.diagram)return;let e=this.diagram;if(t.model!==e.model)return;let i=t.change;if(e.G){e.G=!1;try{let s=t.modelChange;if(s!==""){if(i===2){if(s==="linkFromKey"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue,a=this.findNodeForKey(r);o.fromNode=a}}else if(s==="linkToKey"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue,a=this.findNodeForKey(r);o.toNode=a}}else if(s==="linkFromPortId"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue;typeof r=="string"&&(o.fromPortId=r)}}else if(s==="linkToPortId"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.newValue;typeof r=="string"&&(o.toPortId=r)}}else if(s==="nodeGroupKey"){let n=t.object,o=this.findPartForData(n);if(o!==null){let r=t.newValue;if(r!==void 0){let a=this.findNodeForKey(r);a instanceof ht?o.containingGroup=a:o.containingGroup=null}else o.containingGroup=null}}else if(s==="linkLabelKeys"){let n=t.object,o=this.findLinkForData(n);if(o!==null){let r=t.oldValue,a=t.newValue;Array.isArray(r)&&r.forEach(h=>{if(a.indexOf(h)>=0)return;let l=this.findNodeForKey(h);l!==null&&(l.labeledLink=null)}),Array.isArray(a)&&a.forEach(h=>{let l=this.findNodeForKey(h);l!==null&&(l.labeledLink=o)})}}else if(s==="linkCategory"){let n=t.object,o=this.findLinkForData(n),r=t.newValue;o!==null&&typeof r=="string"&&(o.category=r)}else if(s==="linkDataArray"){let n=t.oldValue;this.Iv(n);let o=t.newValue;this.Rv(o)}e.isModified=!0}else if(i===3){let n=t.newValue;if(s==="linkDataArray"&&m.$(n))this.Ov(n);else if(s==="linkLabelKeys"&&t.model.isKeyType(n)){let o=t.object,r=this.findLinkForData(o),a=this.findNodeForKey(n);r!==null&&a!==null&&(a.labeledLink=r)}e.isModified=!0}else if(i===4){let n=t.oldValue;if(s==="linkDataArray"&&m.$(n))this.Sk(n);else if(s==="linkLabelKeys"&&t.model.isKeyType(n)){let o=this.findNodeForKey(n);o!==null&&(o.labeledLink=null)}e.isModified=!0}}else if(i===2){let n=t.propertyName,o=t.object,r=e.model;o===r&&(n==="linkFromKeyProperty"||n==="linkToKeyProperty"||n==="linkFromPortIdProperty"||n==="linkToPortIdProperty"||n==="linkLabelKeysProperty"||n==="nodeIsGroupProperty"||n==="nodeGroupKeyProperty"||n==="linkCategoryProperty")&&(e.undoManager.isUndoingRedoing||this.rebuildParts()),e.isModified=!0}}finally{e.G=!0}}}vv(){let t=this.diagram.model,e=new Set,i=t.linkDataArray;i.forEach(n=>{e.add(n)});let s=[];this.links.each(n=>{n.data!==null&&!e.has(n.data)&&s.push(n.data)}),s.forEach(n=>{t.Ev(n,!1)}),i.forEach(n=>{this.findLinkForData(n)===null&&t.Uv(n,!1)})}updateRelationshipsFromData(t){let e=t.data;if(e===null)return;let i=t.diagram;if(i===null)return;let s=i.model;if(t instanceof j){let n=s.Vi(e,!0),o=i.findNodeForKey(n);t.fromNode=o,n=s.Vi(e,!1),o=i.findNodeForKey(n),t.toNode=o;let r=s.getLabelKeysForLinkData(e);if(r.length>0||t.labelNodes.count>0){if(r.length===1&&t.labelNodes.count===1){let c=r[0],d=t.labelNodes.first();if(d!==null&&s.getKeyForNodeData(d.data)===c)return}let a=new V().addAll(r),h=new V;t.labelNodes.each(c=>{if(c.data!==null){let d=s.getKeyForNodeData(c.data);d!==void 0&&h.add(d)}});let l=h.copy();l.removeAll(a);let u=a.copy();if(u.removeAll(h),l.count>0||u.count>0){let c=t;l.each(d=>{let f=i.findNodeForKey(d);f!==null&&f.labeledLink===c&&(f.labeledLink=null)}),u.each(d=>{let f=i.findNodeForKey(d);f!==null&&f.labeledLink!==c&&(f.labeledLink=c)})}}}else if(!(t instanceof vt)){let n=s.getGroupKeyForNodeData(e),o=i.findPartForKey(n);(o===null||o instanceof ht)&&(t.containingGroup=o)}}Pk(t){let e=this.diagram.model,i=e.getKeyForNodeData(t);if(i!==void 0){let s=e.iw(i),n=this.findPartForData(t);if(s!==null&&n!==null){let r=s.iterator;for(;r.next();){let a=r.value;if(e.containsNodeData(a)){if(n instanceof ht&&e.getGroupKeyForNodeData(a)===i){let h=this.findPartForData(a);h!==null&&(h.containingGroup=n)}}else{let h=this.findLinkForData(a);if(h!==null&&n instanceof $){e.Vi(a,!0)===i&&(h.fromNode=n),e.Vi(a,!1)===i&&(h.toNode=n);let l=e.getLabelKeysForLinkData(a);Array.isArray(l)&&l.some(u=>u===i?(n.labeledLink=h,!0):!1)}}}e.ln(i)}let o=e.getGroupKeyForNodeData(t);if(o!==void 0){let r=this.findNodeForKey(o);n!==null&&r instanceof ht&&(n.containingGroup=r)}}}XC(t){let e=this.diagram.model;if(t instanceof $){let i=e.getKeyForNodeData(t.data);if(i!==void 0){let s=t.linksConnected;for(;s.next();){let n=s.value;e.an(i,n.data)}if(t.isLinkLabel){let n=t.labeledLink;n!==null&&e.an(i,n.data)}if(t instanceof ht){let n=t.memberParts;for(;n.next();){let o=n.value.data;e.containsNodeData(o)&&e.an(i,o)}}}}}KC(t,e){let i=super.KC(t,e);if(t instanceof j){let s=t.data;if(s!==null&&e!==null){let n=e.model,o=n.copyLinkData(s);n.addLinkData(o),i=e.findLinkForData(o)}else if(i!==null){let n=this.diagram;if(s!==null&&n!==null&&n.commandHandler!==null&&n.commandHandler.copiesClipboardData){let o=n.model.copyLinkData(s);i.data=o}}}return i}insertLink(t,e,i,s){let n=this.diagram,o=n.model,r=n.toolManager.findTool("Linking"),a="";t!==null&&(e===null&&(e=t),a=e.portId,a===null&&(a=""));let h="";i!==null&&(s===null&&(s=i),h=s.portId,h===null&&(h=""));let l=r.archetypeLinkData;if(l instanceof j){l.It();let u=l.copy();if(u!==null){u.fromNode=t,u.fromPortId=a,u.toNode=i,u.toPortId=h,n.add(u);let c=r.archetypeLabelNodeData;if(c instanceof $){c.It();let d=c.copy();d!==null&&(d.labeledLink=u,n.add(d))}return u}}else if(l!==null){let u=o.copyLinkData(l);if(m.$(u)){t!==null&&o.bg(u,o.getKeyForNodeData(t.data),!0),o.kg(u,a,!0),i!==null&&o.bg(u,o.getKeyForNodeData(i.data),!1),o.kg(u,h,!1),o.addLinkData(u);let c=r.archetypeLabelNodeData;if(c!==null&&!(c instanceof $)){let d=o.copyNodeData(c);o.addNodeData(d);let f=o.getKeyForNodeData(d);f!==void 0&&o.addLabelKeyForLinkData(u,f)}return n.findLinkForData(u)}}return null}}class Qn extends ge{Ua=null;Ck(t,e){if(t===null||e===null||e.findTreeParentLink()!==null)return;let i=this.diagram.toolManager.findTool("Linking"),s=t,n=e;if(this.diagram.isTreePathToChildren){if(i!==null&&i.Vu(s,n,null,!0))return}else if(s=e,n=t,i!==null&&i.Vu(s,n,null,!0))return;let o=this.getLinkCategoryForData(e.data),r=this.findLinkTemplateForCategory(o);if(r!==null){r.It();let a=r.copy();if(a!==null){let h=this.diagram.wi;this.diagram.wi=!0,a.$o=o,a.te=e.data,a.fromNode=s,a.toNode=n,this.diagram.add(a),a.te=null,a.data=e.data,this.diagram.wi=h}}}getLinkCategoryForData(t){return this.diagram.model.getParentLinkCategoryForNodeData(t)}setLinkCategoryForData(t,e){this.diagram.model.setParentLinkCategoryForNodeData(t,e)}setFromNodeForLink(t,e,i){let s=this.diagram.model;i===void 0&&(i=null);let n=e!==null?e.data:null;if(this.diagram.isTreePathToChildren)s.setParentKeyForNodeData(t.data,s.getKeyForNodeData(n));else{let o=this.Ua;this.Ua=t,i!==null&&s.setParentKeyForNodeData(i.data,void 0);let r=t.toNode!==null?t.toNode.data:null;s.setParentKeyForNodeData(n,s.getKeyForNodeData(r)),this.Ua=o}}setToNodeForLink(t,e,i){let s=this.diagram.model;i===void 0&&(i=null);let n=e!==null?e.data:null;if(this.diagram.isTreePathToChildren){let o=this.Ua;this.Ua=t,i!==null&&s.setParentKeyForNodeData(i.data,void 0);let r=t.fromNode!==null?t.fromNode.data:null;s.setParentKeyForNodeData(n,s.getKeyForNodeData(r)),this.Ua=o}else s.setParentKeyForNodeData(t.data,s.getKeyForNodeData(n))}LC(t){this.diagram.model.setParentKeyForNodeData(t.data,void 0)}findLinkForKey(t){if(t==null)return null;let e=this.diagram.model.findNodeDataForKey(t);return e!==null?this.findLinkForData(e):null}doModelChanged(t){if(super.doModelChanged(t),!this.diagram)return;let e=this.diagram;if(t.model!==e.model)return;let i=t.change;if(e.G){e.G=!1;try{let s=t.modelChange;if(s!==""){if(i===2){if(s==="nodeParentKey"){let n=t.object,o=n?this.findNodeForData(n):null,r=t.newValue,a=this.findNodeForKey(r);if(n&&this.Ua!==null)a!==null&&(this.Ua.data=n,this.Ua.category=this.getLinkCategoryForData(n));else if(o!==null){let h=o.findTreeParentLink();h!==null?a===null?e.remove(h):e.isTreePathToChildren?h.fromNode=a:h.toNode=a:this.Ck(a,o)}}else if(s==="parentLinkCategory"){let n=t.object,o=n?this.findNodeForData(n):null,r=t.newValue;if(o!==null&&typeof r=="string"){let a=o.findTreeParentLink();a!==null&&(a.category=r)}}e.isModified=!0}}else i===2&&(t.object===e.model&&t.propertyName==="nodeParentKeyProperty"&&(e.undoManager.isUndoingRedoing||this.rebuildParts()),e.isModified=!0)}finally{e.G=!0}}}updateRelationshipsFromData(t){let e=t.data;if(e===null)return;let i=t.diagram;if(i===null)return;let s=i.model;if(t instanceof $){let n=s.getParentKeyForNodeData(e),o=i.findNodeForKey(n),r=t.findTreeParentNode();if(o!==r){let a=t.findTreeParentLink();o!==null?a!==null?i.isTreePathToChildren?a.fromNode=o:a.toNode=o:this.Ck(o,t):a!==null&&i.C2(a,!1)}}}ew(t,e){if(super.ew(t,e),typeof e=="string"&&this.findPartForData(t)!==null){let i=this.findLinkForData(t);i!==null&&i.updateTargetBindings(e)}}Pk(t){let e=this.diagram.model,i=e.getKeyForNodeData(t);if(i!==void 0){let s=e.iw(i),n=this.findPartForData(t);if(s!==null&&n!==null){let r=s.iterator;for(;r.next();){let a=r.value;if(e.containsNodeData(a)&&n instanceof $&&e.getParentKeyForNodeData(a)===i){let h=this.findNodeForData(a);this.Ck(n,h)}}e.ln(i)}let o=e.getParentKeyForNodeData(t);if(o!==void 0&&n instanceof $){let r=this.findNodeForKey(o);this.Ck(r,n)}}}XC(t){let e=this.diagram.model;if(t instanceof $){let i=e.getKeyForNodeData(t.data),s=this.findLinkForData(t.data);if(s!==null){s.isSelected=!1,s.isHighlighted=!1;let r=s.layer;if(r!==null){let a=r.ri(-1,s,!1);a>=0&&this.diagram.raiseChangedEvent(4,"parts",r,s,null,a,null);let h=s.layerChanged;h!==null&&h(s,r,null)}}let n=this.diagram.isTreePathToChildren,o=t.linksConnected;for(;o.next();){let r=o.value,a=n?r.toNode:r.fromNode;if(a!==null){let h=a.data;e.containsNodeData(h)&&e.an(i,h)}}}}insertLink(t,e,i,s){let n=this.diagram.model,o=t,r=i;if(this.diagram.isTreePathToChildren||(o=i,r=t),o!==null&&r!==null){let a=o.data,h=r.data;return n.setParentKeyForNodeData(h,n.getKeyForNodeData(a)),r.findTreeParentLink()}return null}}var Ci=(x=>(x[x.OneWay=1]="OneWay",x[x.TwoWay=2]="TwoWay",x))(Ci||{});class te{n;HC;oc;Hf;Va;qf;jf;Wf;Lk;Ti;Ed;vf;constructor(t,e,i,s){V.Je(this),t===void 0?t="":m.s(t,"string",te,"constructor:targetprop"),e===void 0?e=t:m.s(e,"string",te,"constructor:sourceprop"),i===void 0?i=null:i!==null&&m.S(i,te,"constructor:conv"),this.HC=-1,this.Ti=null,this.oc=t,this.Ed=0,this.vf=0,this.Hf=null,this.Va=e,this.qf=i,s===void 0?(this.jf=1,this.Wf=null):(this.jf=2,this.Wf=s),this.Lk=new V,this.n=2}copy(){let t=new this.constructor;return this.cloneProtected(t),t}cloneProtected(t){t.oc=this.oc,t.Ed=this.Ed,t.vf=this.vf,t.Hf=this.Hf,t.Va=this.Va,t.qf=this.qf,t.jf=this.jf,t.Wf=this.Wf,t.n=this.n&-2}static OneWay=1;static TwoWay=2;static parseEnum(t,e){return m.S(t,te,"parseEnum:ctor"),i=>{let s=parseInt(i);return isNaN(s)&&(s=m.$a(t,i),s===null)?e:s}}fe(t){t in Ci?this.mode=t:m.cr(this,t)}static toString(t){return m.toString(t)}toString(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(this.targetId!==-1?" "+this.targetId:"")+" "+Ci[this.mode]+")"}k(){return this.n=this.n|1,this}get targetId(){return this.HC}set targetId(t){this.u&&m.L(this),this.HC=t}get targetProperty(){return this.oc}set targetProperty(t){this.u&&m.L(this),m.s(t,"string",te,"targetProperty"),this.oc=t}get sourceProperty(){return this.Va}set sourceProperty(t){this.u&&m.L(this),m.s(t,"string",te,"sourceProperty"),this.Va=t}get u(){return(this.n&1)!==0}get isToData(){return(this.n&2)!==0}get isToObject(){return(this.n&4)!==0}get isToModel(){return(this.n&8)!==0}get isToTheme(){return(this.n&16)!==0}get qC(){return this.isToTheme&&!(this.isToData||this.isToObject||this.isToModel)}bd(){return!1}get sourceName(){return this.Hf}set sourceName(t){this.u&&m.L(this),t!==null&&m.s(t,"string",te,"sourceName"),this.Hf=t,t!==null?this.n=this.n&-3|4:this.n=this.n|2}get converter(){return this.qf}set converter(t){this.u&&m.L(this),t!==null&&m.S(t,te,"converter"),this.qf=t}get backConverter(){return this.Wf}set backConverter(t){this.u&&m.L(this),t!==null&&m.S(t,te,"backConverter"),this.Wf=t}get mode(){return this.jf}set mode(t){this.u&&m.L(this),this.isToTheme&&t===2&&m.o("Theme Bindings cannot be TwoWay."),this.jf=t}makeTwoWay(t){return this.isToTheme&&m.o("Theme Bindings cannot be TwoWay."),this.mode=2,t&&(m.S(t,te,"makeTwoWay"),this.backConverter=t),this}ofObject(t){return this.u&&m.L(this),t===void 0&&(t=""),this.sourceName=t,this}ofModel(){return this.u&&m.L(this),this.n=this.n&-3&-5|8,this.Hf=null,this}WT(t,e){let i=this.sourceName,s=null;return i===null||i===""?s=t:i==="/"?s=e.part:i==="."?s=e:i===".."?s=e.panel:s=t.findObject(i),s}check(t){let e=this.oc,i=this.Va,s=this.qf;(this.bd()&&s===null&&this.Ba===null&&e===""||s===null&&e==="")&&m.ne("Binding error: target property is the empty string: "+this.toString()),this.bd()&&this.qC&&i===""&&s===null&&this.Ba===null&&m.ne("Binding error: theme bindings require a source property when not using a converter: "+this.toString()),t&&typeof e=="string"&&(!m.it(["setAttribute"])&&e.length>0&&e[0]!=="_"&&!m.Yw(t,e)?m.ne("Binding error: undefined target property: "+e+" on "+t.toString()):e==="name"&&t instanceof J&&m.ne("Binding error: cannot modify GraphObject.name on "+t.toString()))}updateTarget(t,e,i,s){let n=this.Va;if(i!==void 0&&n!==""&&n!==i||this.isToTheme&&t.diagram===null)return;let o=this.oc,r=this.qf,a=e;if(n!==""&&!this.qC&&(a=ut.Lt(e,n)),a!==void 0)if(r===null){if(o!==""){if(this.bd()){let h=t.diagram?.themeManager;if(a=this.Vv(h,a,t,o),a===void 0)return}s?s.nt(t,o,a):(e instanceof J||e instanceof Kt)&&ut.nt(t,o,a)}}else try{if(o!==""){let h=r(a,t);if(this.bd()){let l=t.diagram?.themeManager;if(h=this.Vv(l,h,t,o),h===void 0)return}s?s.nt(t,o,h):(e instanceof J||e instanceof Kt)&&ut.nt(t,o,h)}else r(a,t)}catch{}}updateSource(t,e,i,s){if(this.jf!==2)return;let n=this.oc;if(i!==void 0&&n!==i)return;let o=this.Va,r=this.Wf,a=s!==null?s.diagram:null,h=a!==null?a.model:null,l=t;if(n!==""&&(l=ut.Lt(t,n)),l!==void 0&&!this.Lk.has(t))try{if(this.Lk.add(t),r===null){if(o!=="")h!==null?h.setDataProperty(e,o,l):(e instanceof J||e instanceof Kt)&&(e[o]=l);else if(h!==null&&s!==null&&s.itemIndex>=0&&s.panel!==null&&Array.isArray(s.panel.itemArray)){let u=s.itemIndex,c=s.panel.itemArray;h.removeArrayItem(c,u),h.insertArrayItem(c,u,l)}}else try{if(o!==""){let u=r(l,e,h);h!==null?h.setDataProperty(e,o,u):(e instanceof J||e instanceof Kt)&&(e[o]=u)}else{let u=r(l,e,h);if(u!==void 0&&h!==null&&s!==null&&s.itemIndex>=0&&s.panel!==null&&Array.isArray(s.panel.itemArray)){let c=s.itemIndex,d=s.panel.itemArray;h.removeArrayItem(d,c),h.insertArrayItem(d,c,u)}}}catch{}}finally{this.Lk.delete(t)}}}class ii extends te{nw;Ba;rc;constructor(t,e,i,s,n){super(t,e,s),i==null&&(i=""),n===void 0&&(n=null),this.nw=i,this.Ba=n,this.rc=null,this.n=16}cloneProtected(t){super.cloneProtected(t),t.nw=this.nw,t.Ba=this.Ba,t.rc=this.rc}bd(){return!0}get themeSource(){return this.nw}set themeSource(t){this.u&&m.L(this),t!==null&&m.s(t,"string",ii,"themeSource"),this.nw=t,this.rc=null,t!==null?this.n=this.n|16:this.n=this.n&-17}get themeConverter(){return this.Ba}set themeConverter(t){this.u&&m.L(this),t!==null&&m.S(t,ii,"themeConverter"),this.Ba=t}ofData(){return this.u&&m.L(this),this.n=this.n|2,this.Hf=null,this}Vv(t,e,i,s){if(!t||(this.qC&&(e=this.Va),!e&&e!==0))return;let n=this.themeSource;this.rc!==null?n=this.rc:typeof n=="string"&&n.includes(".")&&(this.rc=n.split("."),n=this.rc);let o=t.findValue(e,n,s);if(o===void 0&&m.ne(`Theme warning: ${e} could not be found when setting target property ${s}.`),t.readsCssVariables&&typeof o=="string"&&o.startsWith("var(")){let r=o.match(this.o3);r&&(o=getComputedStyle(K.document.documentElement).getPropertyValue(r[1]))}return m.it(this.Ba)&&(o=this.Ba(o,i)),o}o3=/var\((.*)\)/}class ut{Pt;Pg;Uo;jC;Bi;be;za;Jf;$f;Sg;Mg;Ng;Cg;ow;lc;nr;lw;Eo;Ak;constructor(t,e){if(V.Je(this),this.Pt="",this.Pg="",this.Uo=!1,this.jC={},this.Bi=[],this.be=new Mt,this.za="key",this.Jf=null,this.$f=null,this.Sg=!1,this.Mg=!1,this.Ng=!1,this.Cg=null,this.ow=100,this.lc="category",this.nr=new Mt,this.lw=[],this.Eo=!1,this.Ak=null,this.undoManager=new vi,t!==void 0&&(Array.isArray(t)?this.nodeDataArray=t:e=t),e){Object.assign(this,e);let i=e.Changed;i&&(delete this.Changed,this.addChangedListener(i))}}cloneProtected(t){t.Pt=this.Pt,t.Pg=this.Pg,t.Uo=this.Uo,t.za=this.za,t.Jf=this.Jf,t.$f=this.$f,t.Sg=this.Sg,t.Mg=this.Mg,t.Ng=this.Ng,t.Cg=this.Cg,t.ow=this.ow,t.lc=this.lc}copy(){let t=new this.constructor;return this.cloneProtected(t),t}clear(){this.Bi=[],this.be.clear(),this.nr.clear(),this.undoManager.clear()}toString(t){if(t===void 0&&(t=0),t>1)return this.toJson();{let e=(this.name!==""?this.name:"")+" Model";if(t>0){e+=`
|
|
@@ -47,4 +47,63 @@ string: ${t}`);break}}let A=k.fm;if(Ce.WL(k),e){let F=A.figures.iterator;for(;F.
|
|
|
47
47
|
"modifiedLinkData": `;_v=`,
|
|
48
48
|
"removedLinkKeys": `;Zv(t){let e=new V;for(let i=0;i<this.linkDataArray.length;i++){let s=this.linkDataArray[i];this.Dk(t,s,s,e)}return e}_C(t,e,i){if(this.linkKeyProperty===""){let c=this.skipsUndoManager;this.skipsUndoManager=!0,this.linkKeyProperty="key",this.skipsUndoManager=c}let s=super._C(t,e,i),n=this,o=new V,r=new V,a=new V;t.changes.each(c=>{if(c.model===n){if(c.modelChange==="linkDataArray")c.change===3?o.add(c.newValue):c.change===4&&a.add(c.oldValue);else if(n.containsLinkData(c.object))c.object!==null&&r.add(c.object);else if(c.object!==null)if(c.object!==null&&i.has(c.object)){let d=i.get(c.object);d&&d.each(f=>{n.containsLinkData(f)&&r.add(f)})}else{if(c.object instanceof ut||n.containsNodeData(c.object))return;n.Zv(c.object).each(d=>r.add(d))}}});let h=new V;o.each(c=>{let d=n.getKeyForLinkData(c);d!==void 0&&h.add(d),e||r.add(c)});let l=new V;a.each(c=>{let d=n.getKeyForLinkData(c);d!==void 0&&l.add(d),e&&r.add(c)});let u=s;return h.count>0&&(u+=(e?this._v:this.Qv)+this.Xa(h.toArray(),!0)),r.count>0&&(u+=this.h3+this.Xa(r.toArray(),!0)),l.count>0&&(u+=(e?this.Qv:this._v)+this.Xa(l.toArray(),!0)),u}hw(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)&&m.o("applyIncrementalJson cannot change Model properties"),super.hw(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.tF(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(i!==null&&s===this.linkKeyProperty&&this.containsLinkData(i)){let n=t.getValue(e),o=t.getValue(!e);o!==void 0&&this.Oe.delete(o),n!==void 0&&this.Oe.set(n,i),this.nt(i,s,n);return}}else if(t.change===3){let i=t.newParam;if(t.modelChange==="linkDataArray"){let s=t.newValue;if(m.$(s)&&typeof i=="number"){let n=this.getKeyForLinkData(s);e?(this.rr.delete(s),this.Os[i]===s&&this.So(this.linkDataArray,i),n!==void 0&&this.Oe.delete(n)):(this.rr.add(s),this.Os[i]!==s&&this.or(this.Os,i,s),n!==void 0&&this.Oe.set(n,s))}return}else if(t.modelChange==="linkLabelKeys"){let s=t.object,n=s!==null?this.getLabelKeysForLinkData(s):null;Array.isArray(n)&&typeof i=="number"&&(e?(i=n.indexOf(t.newValue),i>=0&&this.So(n,i)):n.indexOf(t.newValue)<0&&this.or(n,i,t.newValue));return}}else if(t.change===4){let i=t.oldParam;if(t.modelChange==="linkDataArray"){let s=t.oldValue;if(m.$(s)&&typeof i=="number"){let n=this.getKeyForLinkData(s);e?(this.rr.add(s),this.Os[i]!==s&&this.or(this.Os,i,s),n!==void 0&&this.Oe.set(n,s)):(this.rr.delete(s),this.Os[i]===s&&this.So(this.linkDataArray,i),n!==void 0&&this.Oe.delete(n))}return}else if(t.modelChange==="linkLabelKeys"){let s=t.object,n=s!==null?this.getLabelKeysForLinkData(s):null;Array.isArray(n)&&typeof i=="number"&&(e?n.indexOf(t.oldValue)<0&&this.or(n,i,t.oldValue):(i=n.indexOf(t.oldValue),i>=0&&this.So(n,i)));return}}super.changeState(t,e)}}get archetypeNodeData(){return this.Vl}set archetypeNodeData(t){let e=this.Vl;e!==t&&(t!==null&&m.xc(t,Xt,"archetypeNodeData"),this.Vl=t,this.t("archetypeNodeData",e,t))}nL(t){if(t===void 0)return;let e=this.Vl;if(e!==null){let i=this.findNodeDataForKey(t);i===null&&(i=this.copyNodeData(e),this.nt(i,this.nodeKeyProperty,t),this.addNodeData(i))}return t}get linkFromKeyProperty(){return this.Mo}set linkFromKeyProperty(t){let e=this.Mo;e!==t&&(this.En(t,Xt,"linkFromKeyProperty"),this.Mo=t,this.t("linkFromKeyProperty",e,t))}getFromKeyForLinkData(t){return this.Vi(t,!0)}setFromKeyForLinkData(t,e){this.bg(t,e,!0)}get linkToKeyProperty(){return this.No}set linkToKeyProperty(t){let e=this.No;e!==t&&(this.En(t,Xt,"linkToKeyProperty"),this.No=t,this.t("linkToKeyProperty",e,t))}getToKeyForLinkData(t){return this.Vi(t,!1)}setToKeyForLinkData(t,e){this.bg(t,e,!1)}Vi(t,e){if(t===null)return;let i=e?this.Mo:this.No;if(i==="")return;let s=this.Lt(t,i);if(s!==void 0){if(this.isKeyType(s))return s;m.o((e?"FromKey":"ToKey")+" value for link data "+t+" is not a number or a string: "+s)}}bg(t,e,i){if(e===null&&(e=void 0),e!==void 0&&!this.isKeyType(e)&&m.si(e,"number or string",Xt,i?"setFromKeyForLinkData:key":"setToKeyForLinkData:key"),t===null)return;let s=i?this.Mo:this.No;if(s==="")return;if(e=this.nL(e),!this.containsLinkData(t)){this.nt(t,s,e);return}let n=this.Lt(t,s);n!==e&&(this.ln(n,t),this.nt(t,s,e),this.findNodeDataForKey(e)===null&&this.an(e,t),this.Ft(i?"linkFromKey":"linkToKey",2,s,t,n,e),typeof s=="string"&&this.updateTargetBindings(t,s))}get linkFromPortIdProperty(){return this.ac}set linkFromPortIdProperty(t){let e=this.ac;e!==t&&(this.En(t,Xt,"linkFromPortIdProperty"),this.ac=t,this.t("linkFromPortIdProperty",e,t))}getFromPortIdForLinkData(t){return this.Nk(t,!0)}setFromPortIdForLinkData(t,e){this.kg(t,e,!0)}get linkToPortIdProperty(){return this.hc}set linkToPortIdProperty(t){let e=this.hc;e!==t&&(this.En(t,Xt,"linkToPortIdProperty"),this.hc=t,this.t("linkToPortIdProperty",e,t))}getToPortIdForLinkData(t){return this.Nk(t,!1)}setToPortIdForLinkData(t,e){this.kg(t,e,!1)}Nk(t,e){if(t===null)return"";let i=e?this.ac:this.hc;if(i==="")return"";let s=this.Lt(t,i);return s===void 0?"":s}kg(t,e,i){if(m.s(e,"string",Xt,i?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname"),t===null)return;let s=i?this.ac:this.hc;if(s==="")return;if(!this.containsLinkData(t)){this.nt(t,s,e);return}let n=this.Lt(t,s);n===void 0&&(n=""),n!==e&&(this.nt(t,s,e),this.Ft(i?"linkFromPortId":"linkToPortId",2,s,t,n,e),typeof s=="string"&&this.updateTargetBindings(t,s))}get linkLabelKeysProperty(){return this.hn}set linkLabelKeysProperty(t){let e=this.hn;e!==t&&(this.En(t,Xt,"linkLabelKeysProperty"),this.hn=t,this.t("linkLabelKeysProperty",e,t))}getLabelKeysForLinkData(t){if(t===null)return Xt.EmptyArray;let e=this.hn;if(e==="")return Xt.EmptyArray;let i=this.Lt(t,e);return i===void 0?Xt.EmptyArray:i}setLabelKeysForLinkData(t,e){if(this.eL(e,Xt,"setLabelKeysForLinkData:arr"),t===null)return;let i=this.hn;if(i==="")return;if(!this.containsLinkData(t)){this.nt(t,i,e);return}let s=this.Lt(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.ln(a,t)}}this.nt(t,i,e);let n=e.length;for(let o=0;o<n;o++){let r=e[o];this.findNodeDataForKey(r)===null&&this.an(r,t)}this.Ft("linkLabelKeys",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i)}}addLabelKeyForLinkData(t,e){if(e==null||(this.isKeyType(e)||m.si(e,"number or string",Xt,"addLabelKeyForLinkData:key"),t===null))return;let i=this.hn;if(i==="")return;let s=this.Lt(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.an(e,t),this.Ft("linkLabelKeys",3,i,t,null,e,null,n))}else m.o(i+" property is not an Array; cannot addLabelKeyForLinkData: "+t)}removeLabelKeyForLinkData(t,e){if(e==null||(this.isKeyType(e)||m.si(e,"number or string",Xt,"removeLabelKeyForLinkData:key"),t===null))return;let i=this.hn;if(i==="")return;let s=this.Lt(t,i);if(Array.isArray(s)){let n=s.indexOf(e);if(n<0)return;this.So(s,n),this.containsLinkData(t)&&(this.ln(e,t),this.Ft("linkLabelKeys",4,i,t,e,null,n,null))}else s!==void 0&&m.o(i+" property is not an Array; cannot removeLabelKeyforLinkData: "+t)}get linkDataArray(){return this.Os}set linkDataArray(t){let e=this.Os;if(e!==t){this.eL(t,Xt,"linkDataArray"),this.Oe.clear();let i=t.length;for(let n=0;n<i;n++){let o=t[n];m.$(o)||m.o("GraphLinksModel.linkDataArray must only contain Objects, not: "+o)}if(this.Os=t,this.linkKeyProperty!==""){let n=new q;for(let r=0;r<i;r++){let a=t[r],h=this.getKeyForLinkData(a);h===void 0||this.Oe.get(h)!==null?n.add(a):this.Oe.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.Oe.set(a,r)}}let s=new V;for(let n=0;n<i;n++){let o=t[n];s.add(o)}this.rr=s,this.Ft("linkDataArray",2,"linkDataArray",this,e,t);for(let n=0;n<i;n++){let o=t[n];this.oL(o)}}}get linkKeyProperty(){return this.Ga}set linkKeyProperty(t){let e=this.Ga;if(e!==t){this.En(t,Xt,"linkKeyProperty"),this.Ga=t,this.Oe.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.Oe.set(o,n)}this.t("linkKeyProperty",e,t)}}getKeyForLinkData(t){if(t===null)return;let e=this.Ga;if(e==="")return;let i=this.Lt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;m.o("Key value for link data "+t+" is not a number or a string: "+i)}}setKeyForLinkData(t,e){if((e==null||!this.isKeyType(e))&&m.si(e,"number or string",Xt,"setKeyForLinkData:key"),t===null)return;let i=this.Ga;if(i==="")return;if(!this.containsLinkData(t)){this.nt(t,i,e);return}let s=this.Lt(t,i);if(s!==e){if(this.findLinkDataForKey(e)!==null)return;this.nt(t,i,e),s!==void 0&&this.Oe.delete(s),this.Oe.set(e,t),this.Ft("linkKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i)}}get makeUniqueLinkKeyFunction(){return this.Zf}set makeUniqueLinkKeyFunction(t){let e=this.Zf;e!==t&&(t!==null&&m.S(t,Xt,"makeUniqueLinkKeyFunction"),this.Zf=t,this.t("makeUniqueLinkKeyFunction",e,t))}findLinkDataForKey(t){return t===null&&m.o("GraphLinksModel.findLinkDataForKey:key must not be null"),t===void 0||!this.isKeyType(t)?null:this.Oe.get(t)}Rk(t){return t===void 0?!1:this.Oe.has(t)}makeLinkDataKeyUnique(t){if(t===null)return;let e=this.Ga;if(e==="")return;let i=this.getKeyForLinkData(t);if(i!==void 0&&!this.Rk(i))return;let s=this.Zf;if(s!==null&&(i=s(this,t),i!=null&&!this.Rk(i))){this.nt(t,e,i);return}if(typeof i=="string"){let n=2;for(;this.Rk(i+n);)n++;this.nt(t,e,i+n)}else if(i===void 0||typeof i=="number"){let n=-this.Oe.count-1;for(;this.Rk(n);)n--;this.nt(t,e,n)}}containsLinkData(t){return t===null?!1:this.rr.has(t)}addLinkData(t){t!==null&&(this.containsLinkData(t)||this.Uv(t,!0))}Uv(t,e){if(this.linkKeyProperty!==""){let s=this.getKeyForLinkData(t);if(s===void 0)this.makeLinkDataKeyUnique(t),s=this.getKeyForLinkData(t);else{if(this.Oe.get(s)===t)return;this.makeLinkDataKeyUnique(t),s=this.getKeyForLinkData(t)}s===void 0&&m.o("GraphLinksModel.makeLinkDataKeyUnique failed on "+t+". Data not added to model."),this.Oe.set(s,t)}this.rr.add(t);let i=null;e&&(i=this.Os.length,this.or(this.Os,i,t)),this.Ft("linkDataArray",3,"linkDataArray",this,null,t,null,i),this.oL(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.Ev(t,!0)}Ev(t,e){this.rr.delete(t);let i=this.getKeyForLinkData(t);i!==void 0&&this.Oe.delete(i);let s=null;if(e){if(s=this.Os.indexOf(t),s<0)return;this.So(this.Os,s)}this.Ft("linkDataArray",4,"linkDataArray",this,t,null,s,null),this.c3(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===""&&m.o("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed."),t===this.linkDataArray||!Array.isArray(t))return;let e=new V;e.addAll(this.Oe.iteratorKeys);let i=new V,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.tF(r,h);else{let l=this.cloneDeep(r);this.setKeyForLinkData(l,a),this.addLinkData(l)}}else{let h=this.cloneDeep(r);this.addLinkData(h);let l=this.getKeyForLinkData(h);l!==void 0&&i.add(l)}}let n=e.iterator;for(;n.next();){let o=n.value;if(!i.has(o)){let r=this.findLinkDataForKey(o);r&&this.removeLinkData(r)}}}oL(t){let e=this.Vi(t,!0);e=this.nL(e),this.findNodeDataForKey(e)===null&&this.an(e,t),e=this.Vi(t,!1),e=this.nL(e),this.findNodeDataForKey(e)===null&&this.an(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.an(e,t)}}c3(t){let e=this.Vi(t,!0);this.ln(e,t),e=this.Vi(t,!1),this.ln(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.ln(e,t)}}get copyLinkDataFunction(){return this.Qf}set copyLinkDataFunction(t){let e=this.Qf;e!==t&&(t!==null&&m.S(t,Xt,"copyLinkDataFunction"),this.Qf=t,this.t("copyLinkDataFunction",e,t))}copyLinkData(t){let e=null,i=this.Qf;return i!==null?e=i(t,this):e=this.Fk(t,!0),m.$(e)&&(this.Mo!==""&&this.nt(e,this.Mo,void 0),this.No!==""&&this.nt(e,this.No,void 0),this.hn!==""&&this.nt(e,this.hn,[])),e}get nodeIsGroupProperty(){return this._f}set nodeIsGroupProperty(t){let e=this._f;e!==t&&(this.En(t,Xt,"nodeIsGroupProperty"),this._f=t,this.t("nodeIsGroupProperty",e,t))}isGroupForNodeData(t){if(t===null)return!1;let e=this._f;return e===""?!1:!!this.Lt(t,e)}isGroupForData(t){return this.isGroupForNodeData(t)}get nodeGroupKeyProperty(){return this.Pl}set nodeGroupKeyProperty(t){let e=this.Pl;e!==t&&(this.En(t,Xt,"nodeGroupKeyProperty"),this.Pl=t,this.t("nodeGroupKeyProperty",e,t))}getGroupKeyForNodeData(t){if(t===null)return;let e=this.Pl;if(e==="")return;let i=this.Lt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;m.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)&&m.si(e,"number or string",Xt,"setGroupKeyForNodeData:key"),t===null)return;let i=this.Pl;if(i==="")return;if(!this.containsNodeData(t)){this.nt(t,i,e);return}let s=this.Lt(t,i);s!==e&&(this.ln(s,t),this.nt(t,i,e),this.findNodeDataForKey(e)===null&&this.an(e,t),this.Ft("nodeGroupKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}setGroupForData(t,e){this.setGroupKeyForNodeData(t,e)}copyNodeData(t){let e=super.copyNodeData(t);return this.setGroupKeyForNodeData(e,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.bg(t,i,!0);return}else if(e===this.linkToKeyProperty){this.bg(t,i,!1);return}else if(e===this.linkFromPortIdProperty){this.kg(t,i,!0);return}else if(e===this.linkToPortIdProperty){this.kg(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.Lt(t,e);s!==i&&(this.nt(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.Lt(t,n)===e[n]||s&&n===this.linkKeyProperty)continue;this.setDataProperty(t,n,e[n])}}cw(t,e){super.cw(t,e);let i=this.be.iterator;for(;i.next();){let n=i.value;this.rL(n,t,e)}let s=this.rr.iterator;for(;s.next();){let n=s.value;this.f3(n,t,e)}}rL(t,e,i){if(this.getGroupKeyForNodeData(t)===e){let s=this.Pl;this.nt(t,s,i),this.Ft("nodeGroupKey",2,s,t,e,i),typeof s=="string"&&this.updateTargetBindings(t,s)}}f3(t,e,i){if(this.Vi(t,!0)===e){let n=this.Mo;this.nt(t,n,i),this.Ft("linkFromKey",2,n,t,e,i),typeof n=="string"&&this.updateTargetBindings(t,n)}if(this.Vi(t,!1)===e){let n=this.No;this.nt(t,n,i),this.Ft("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.hn;for(let r=0;r<n;r++)s[r]===e&&(this.jv(s,r,i),this.Ft("linkLabelKeys",3,o,t,e,i,r,r))}}iL(){super.iL();let t=this.linkDataArray,e=t.length;for(let i=0;i<e;i++){let s=t[i];this.oL(s)}}Dg(t){super.Dg(t);let e=this.getKeyForNodeData(t),i=this.iw(e);if(i!==null){let s=m.st(),n=i.iterator;for(;n.next();){let o=n.value;if(this.containsNodeData(o)){if(this.getGroupKeyForNodeData(o)===e){let r=this.Pl;this.Ft("nodeGroupKey",2,r,o,e,e),typeof r=="string"&&this.updateTargetBindings(o,r),s.push(o)}}else{if(this.Vi(o,!0)===e){let a=this.Mo;this.Ft("linkFromKey",2,a,o,e,e),typeof a=="string"&&this.updateTargetBindings(o,a),s.push(o)}if(this.Vi(o,!1)===e){let a=this.No;this.Ft("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.hn;for(let l=0;l<a;l++)r[l]===e&&(this.Ft("linkLabelKeys",3,h,o,e,e,l,l),s.push(o))}}}for(let o=0;o<s.length;o++)this.ln(e,s[o]);m.Z(s)}}vg(t){super.vg(t);let e=this.getGroupKeyForNodeData(t);this.findNodeDataForKey(e)===null&&this.an(e,t)}fw(t){super.fw(t);let e=this.getGroupKeyForNodeData(t);this.ln(e,t)}get linkCategoryProperty(){return this.cc}set linkCategoryProperty(t){let e=this.cc;e!==t&&(this.En(t,Xt,"linkCategoryProperty"),this.cc=t,this.t("linkCategoryProperty",e,t))}getCategoryForLinkData(t){if(t===null)return"";let e=this.cc;if(e==="")return"";let i=this.Lt(t,e);if(i===void 0)return"";if(typeof i=="string")return i;m.o("getCategoryForLinkData found a non-string category for "+t+": "+i)}getLinkCategoryForData(t){return this.getCategoryForLinkData(t)}setCategoryForLinkData(t,e){if(m.s(e,"string",Xt,"setCategoryForLinkData:cat"),t===null)return;let i=this.cc;if(i==="")return;if(!this.containsLinkData(t)){this.nt(t,i,e);return}let s=this.Lt(t,i);s===void 0&&(s=""),s!==e&&(this.nt(t,i,e),this.Ft("linkCategory",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}setLinkCategoryForData(t,e){this.setCategoryForLinkData(t,e)}Tg(t,e){super.Tg(t,e),this.setGroupKeyForNodeData(e,this.getGroupKeyForNodeData(t))}tF(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"}uS(){return!0}Wh(){return!0}Cx(){return!0}Th(){return!0}static EmptyArray=Object.freeze([])}ut.kl(Xt,"GraphLinksModel"),ut.qv=()=>new Xt,ut.g2=()=>new Xt;class je extends ut{Sl;fc;constructor(t,e){if(super(),this.Sl="parent",this.fc="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.Sl=this.Sl,t.fc=this.fc}toString(t){if(t===void 0&&(t=0),t>=2)return this.toJson();{let e=(this.name!==""?this.name:"")+" TreeModel";if(t>0){e+=`
|
|
49
49
|
node data:`;let i=this.nodeDataArray,s=i.length;for(let n=0;n<s;n++){let o=i[n];e+=" "+this.getKeyForNodeData(o)+":"+te.toString(o)}}return e}}Ag(){let t=super.Ag(),e="";return this.nodeParentKeyProperty!=="parent"&&typeof this.nodeParentKeyProperty=="string"&&(e+=`,
|
|
50
|
-
"nodeParentKeyProperty": `+this.quote(this.nodeParentKeyProperty)),t+e}aw(t){super.aw(t),t.nodeParentKeyProperty&&(this.nodeParentKeyProperty=t.nodeParentKeyProperty)}hw(t){t.nodeParentKeyProperty!==void 0&&t.nodeParentKeyProperty!==this.nodeParentKeyProperty&&m.o("applyIncrementalJson cannot change Model properties"),super.hw(t)}maybeEnsureLinkReference(t){return t}get nodeParentKeyProperty(){return this.Sl}set nodeParentKeyProperty(t){let e=this.Sl;e!==t&&(this.En(t,je,"nodeParentKeyProperty"),this.Sl=t,this.t("nodeParentKeyProperty",e,t))}getParentKeyForNodeData(t){if(t===null)return;let e=this.Sl;if(e==="")return;let i=this.Lt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;m.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)&&m.si(e,"number or string",je,"setParentKeyForNodeData:key"),t===null)return;let i=this.Sl;if(i==="")return;if(e=this.maybeEnsureLinkReference(e),!this.containsNodeData(t)){this.nt(t,i,e);return}let s=this.Lt(t,i);s!==e&&(this.ln(s,t),this.nt(t,i,e),this.findNodeDataForKey(e)===null&&this.an(e,t),this.Ft("nodeParentKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}get parentLinkCategoryProperty(){return this.fc}set parentLinkCategoryProperty(t){let e=this.fc;e!==t&&(this.En(t,je,"parentLinkCategoryProperty"),this.fc=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.fc;if(e==="")return"";let i=this.Lt(t,e);if(i===void 0)return"";if(typeof i=="string")return i;m.o("getParentLinkCategoryForNodeData found a non-string category for "+t+": "+i)}getLinkCategoryForData(t){return this.getParentLinkCategoryForNodeData(t)}setParentLinkCategoryForNodeData(t,e){if(m.s(e,"string",je,"setParentLinkCategoryForNodeData:cat"),t===null)return;let i=this.fc;if(i==="")return;if(!this.containsNodeData(t)){this.nt(t,i,e);return}let s=this.Lt(t,i);s===void 0&&(s=""),s!==e&&(this.nt(t,i,e),this.Ft("parentLinkCategory",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}setLinkCategoryForData(t,e){this.setParentLinkCategoryForNodeData(t,e)}copyNodeData(t){let e=super.copyNodeData(t);return this.setParentKeyForNodeData(e,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.Lt(t,e);s!==i&&(this.nt(t,e,i),this.raiseDataChanged(t,e,s,i))}cw(t,e){super.cw(t,e);let i=this.be.iterator;for(;i.next();){let s=i.value;this.rL(s,t,e)}}rL(t,e,i){if(this.getParentKeyForNodeData(t)===e){let s=this.Sl;this.nt(t,s,i),this.Ft("nodeParentKey",2,s,t,e,i),typeof s=="string"&&this.updateTargetBindings(t,s)}}Dg(t){super.Dg(t);let e=this.getKeyForNodeData(t),i=this.iw(e);if(i!==null){let s=m.st(),n=i.iterator;for(;n.next();){let o=n.value;if(this.containsNodeData(o)&&this.getParentKeyForNodeData(o)===e){let r=this.Sl;this.Ft("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.ln(e,s[o]);m.Z(s)}}vg(t){super.vg(t);let e=this.getParentKeyForNodeData(t);e=this.maybeEnsureLinkReference(e),this.findNodeDataForKey(e)===null&&this.an(e,t)}fw(t){super.fw(t);let e=this.getParentKeyForNodeData(t);this.ln(e,t)}Tg(t,e){super.Tg(t,e),this.setParentLinkCategoryForNodeData(e,this.getParentLinkCategoryForNodeData(t)),this.setParentKeyForNodeData(e,this.getParentKeyForNodeData(t))}get type(){return"TreeModel"}Nx(){return!0}Cx(){return!0}}ut.kl(je,"TreeModel");var ts=(x=>(x[x.ConstantSpacing=0]="ConstantSpacing",x[x.ConstantDistance=1]="ConstantDistance",x[x.ConstantAngle=2]="ConstantAngle",x[x.Packed=3]="Packed",x))(ts||{}),es=(x=>(x[x.Clockwise=10]="Clockwise",x[x.Counterclockwise=11]="Counterclockwise",x[x.BidirectionalLeft=12]="BidirectionalLeft",x[x.BidirectionalRight=13]="BidirectionalRight",x))(es||{}),is=(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))(is||{}),ss=(x=>(x[x.Pythagorean=30]="Pythagorean",x[x.Circular=31]="Circular",x))(ss||{});class Be extends _t{gi;tu;Ok;Fg;Ik;Ya;lL;aL;hL;Is;uw;dw;uc;gw;eF;Rg;Og;Ig;eu;He;P;Si;Mi;In;Eg;constructor(t){super(),this.gi=0,this.tu=0,this.Ok=0,this.Fg=360,this.Ik=0,this.Ya=0,this.lL=new P,this.aL=30,this.hL=0,this.Is=0,this.uw=0,this.dw=new Hs,this.uc=0,this.gw=0,this.eF=600,this.Rg=NaN,this.Og=1,this.Ig=0,this.eu=360,this.He=0,this.P=10,this.Si=24,this.Mi=Ie.standardComparer,this.In=6,this.Eg=30,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Rg=this.Rg,t.Og=this.Og,t.Ig=this.Ig,t.eu=this.eu,t.He=this.He,t.P=this.P,t.Si=this.Si,t.Mi=this.Mi,t.In=this.In,t.Eg=this.Eg}fe(t){t in is?this.sorting=t:t in es?this.direction=t:t in ts?this.arrangement=t:t in ss?this.nodeDiameterFormula=t:super.fe(t)}createNetwork(){return new Ws(this)}u3(t,e,i){t=this.d3(t);let s=this.Ik,n=this.aL,o=this.gi,r=this.tu,a=this.Ok,h=this.Fg,l=this.Ya,u=this.hL,c=this.Is,d=this.uw;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 g=0;!(g>=t.length||(e.add(t.elt(g)),g+1>=t.length));g+=2)i.add(t.elt(g+1));this.direction===12?(this.arrangement===3&&e.reverse(),t=new q,t.addAll(e),t.addAll(i)):(this.arrangement===3&&i.reverse(),t=new q,t.addAll(i),t.addAll(e))}let f=t.length;u=0;let p=0;for(let g=0;g<t.length;g++){let y=a+h*p*(this.direction===10?1:-1)/f,b=t.elt(g).diameter;isNaN(b)&&(b=t.elt(g).Ka(y)),h<360&&(g===0||g===t.length-1)&&(b/=2),u+=b,p++}if(isNaN(o)||s===3){if(isNaN(l)&&(l=6),s!==0&&s!==3){let g=-1/0;for(let y=0;y<f;y++){let b=t.elt(y),v=t.elt(y===f-1?0:y+1);isNaN(b.diameter)&&b.Ka(0),isNaN(v.diameter)&&v.Ka(0),g=Math.max(g,(b.diameter+v.diameter)/2)}if(d=g+l,s===2){let y=2*Math.PI/f,b=(g+l)/y;r>1?(o=b,c=o*r):(c=b,o=c)}else o=this.Ek(d*(h>=360?f:f-1),r,a*Math.PI/180,h*Math.PI/180)}else o=this.Ek(u+(h>=360?f:f-1)*(s!==3?l:l*1.6),r,a*Math.PI/180,h*Math.PI/180);c=o*r}else{c=o*r;let g=this.cL(o,c,a*Math.PI/180,h*Math.PI/180);if(isNaN(l))s===0&&(l=(g-u)/(h>=360?f:f-1));else if(s===0){let y=(g-u)/(h>=360?f:f-1);y<l?(o=this.Ek(u+l*(h>=360?f:f-1),r,a*Math.PI/180,h*Math.PI/180),c=o*r):l=y}else{let y=-1/0;for(let w=0;w<f;w++){let k=t.elt(w),S=t.elt(w===f-1?0:w+1);isNaN(k.diameter)&&k.Ka(0),isNaN(S.diameter)&&S.Ka(0),y=Math.max(y,(k.diameter+S.diameter)/2)}let b=y+l,v=this.Ek(b*(h>=360?f:f-1),r,a*Math.PI/180,h*Math.PI/180);v>o?(o=v,c=o*r,d=b):d=g/(h>=360?f:f-1)}}return this.Ik=s,this.aL=n,this.gi=o,this.tu=r,this.Ok=a,this.Fg=h,this.Ya=l,this.hL=u,this.Is=c,this.uw=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 q;i.addAll(e.iterator);let s=new q,n=new q;i=this.u3(i,s,n);let o=this.Ik,r=this.gi,a=this.Ok,h=this.Fg,l=this.Ya,u=this.Is,c=this.uw;if((this.direction===12||this.direction===13)&&o===3)this.iF(i,h,a-h/2,10);else if(this.direction===12||this.direction===13){let d=0;switch(o){case 1:d=this.Uk(r,u,a,c)*180/Math.PI;break;case 0:{let f=0,p=0,g=s.first();g!==null&&(f=g.Ka(Math.PI/2));let y=n.first();y!==null&&(p=y.Ka(Math.PI/2)),d=this.Uk(r,u,a,l+(f+p)/2)*180/Math.PI;break}case 2:d=h/i.length;break}if(this.direction===12){switch(o){case 1:this.mw(s,h/2,a,11);break;case 0:this.pw(s,h/2,a,11);break;case 2:this.yw(s,h/2,a,11);break}switch(o){case 1:this.mw(n,h/2,a+d,10);break;case 0:this.pw(n,h/2,a+d,10);break;case 2:this.yw(n,h/2,a+d,10);break}}else{switch(o){case 1:this.mw(n,h/2,a,11);break;case 0:this.pw(n,h/2,a,11);break;case 2:this.yw(n,h/2,a,11);break}switch(o){case 1:this.mw(s,h/2,a+d,10);break;case 0:this.pw(s,h/2,a+d,10);break;case 2:this.yw(s,h/2,a+d,10);break}}}else switch(o){case 1:this.mw(i,h,a,this.direction);break;case 0:this.pw(i,h,a,this.direction);break;case 2:this.yw(i,h,a,this.direction);break;case 3:this.iF(i,h,a,this.direction);break}this.updateParts(),this.network=null,this.isValidLayout=!0}yw(t,e,i,s){let n=this.Fg,o=this.gi,r=this.Is,a=i*Math.PI/180,h=e*Math.PI/180,l=t.length;for(let u=0;u<l;u++){let c=a+(s===10?u*h/(n>=360?l:l-1):-(u*h)/l),d=t.elt(u),f=o*Math.tan(c)/r,p=Math.sqrt((o*o+r*r*f*f)/(1+f*f));d.centerX=p*Math.cos(c),d.centerY=p*Math.sin(c),d.actualAngle=c*180/Math.PI}}pw(t,e,i,s){let n=this.gi,o=this.Is,r=this.Ya,a=i*Math.PI/180,h=t.length;for(let l=0;l<h;l++){let u=t.elt(l),c=t.elt(l===h-1?0:l+1),d=n*Math.cos(a),f=o*Math.sin(a);u.centerX=d,u.centerY=f,u.actualAngle=a*180/Math.PI,isNaN(u.diameter)&&u.Ka(0),isNaN(c.diameter)&&c.Ka(0);let p=(u.diameter+c.diameter)/2,g=this.Uk(n,o,s===10?a:-a,p+r);a+=s===10?g:-g}}mw(t,e,i,s){let n=this.gi,o=this.Is,r=this.uw,a=i*Math.PI/180,h=t.length;for(let l=0;l<h;l++){let u=t.elt(l);u.centerX=n*Math.cos(a),u.centerY=o*Math.sin(a),u.actualAngle=a*180/Math.PI;let c=this.Uk(n,o,s===10?a:-a,r);a+=s===10?c:-c}}iF(t,e,i,s){let n=this.gw,o=this.Fg;if(this.uc=0,this.dw=new Hs,e<360){for(n=i+(s===10?o:-o);n<0;)n+=360;n%=360,n>180&&(n-=360),n*=Math.PI/180,this.gw=n,this.sF(t,e,i,s)}else this.nF(t,e,i,s);this.dw.commit(t)}nF(t,e,i,s){let n=this.gi,o=this.Is,r=this.Ya,a=this.tu,h=n*Math.cos(i*Math.PI/180),l=o*Math.sin(i*Math.PI/180),u=t.toArray();if(u.length===3){u[0].centerX=n,u[0].centerY=0,u[1].centerX=u[0].centerX-u[0].width/2-u[1].width/2-r,u[1].y=u[0].y,u[2].centerX=(u[0].centerX+u[1].centerX)/2,u[2].y=u[0].y-u[2].height-r;return}else if(u.length===4){u[0].centerX=n,u[0].centerY=0,u[2].centerX=-u[0].centerX,u[2].centerY=u[0].centerY,u[1].centerX=0,u[1].y=Math.min(u[0].y,u[2].y)-u[1].height-r,u[3].centerX=0,u[3].y=Math.max(u[0].y+u[0].height+r,u[2].y+u[2].height+r);return}let c=P.l();for(let k=0;k<u.length&&(u[k].centerX=h,u[k].centerY=l,!(k>=u.length-1));k++)this.oF(h,l,u,k,s,c)||this.rF(h,l,u,k,s,c),h=c.x,l=c.y;if(P.i(c),this.uc++,this.uc>23)return;let d=u[0].centerX,f=u[0].centerY,p=u[u.length-1].centerX,g=u[u.length-1].centerY,y=Math.abs(d-p)-((u[0].width+u[u.length-1].width)/2+r),b=Math.abs(f-g)-((u[0].height+u[u.length-1].height)/2+r),v=0;if(Math.abs(b)<1){let k=Math.abs(d-p),S=(u[0].width+u[u.length-1].width)/2;k<S&&(v=0),y=k-S}else b>0?v=b:Math.abs(y)<1?v=0:v=y;let w=!1;Math.abs(p)>Math.abs(g)?w=p>0!=f>g:w=g>0!=d<p,w=s===10?w:!w,w&&(v=-Math.abs(v),v=Math.min(v,-u[u.length-1].width),v=Math.min(v,-u[u.length-1].height)),this.dw.g3(v,u),Math.abs(v)>1&&(this.uc<8?this.gi-=v/(2*Math.PI):u.length<5&&v>10?this.gi/=2:this.gi-=v>0?1.7:-2.3,this.Is=this.gi*a,this.nF(t,e,i,s))}sF(t,e,i,s){let n=this.gi,o=this.Is,r=this.tu,a=n*Math.cos(i*Math.PI/180),h=o*Math.sin(i*Math.PI/180),l=P.l(),u=t.toArray();for(let p=0;p<u.length&&(u[p].centerX=a,u[p].centerY=h,!(p>=u.length-1));p++)this.oF(a,h,u,p,s,l)||this.rF(a,h,u,p,s,l),a=l.x,h=l.y;if(P.i(l),this.uc++,this.uc>23)return;let c=Math.atan2(h,a),d=s===10?this.gw-c:c-this.gw;d=Math.abs(d)<Math.abs(d-2*Math.PI)?d:d-2*Math.PI;let f=d*(n+o)/2;this.dw.m3(f,u),Math.abs(f)>1&&(this.uc<8?this.gi-=f/(2*Math.PI):this.gi-=f>0?1.7:-2.3,this.Is=this.gi*r,this.sF(t,e,i,s))}oF(t,e,i,s,n,o){let r=this.Ya,a=this.gi,h=this.Is,l=0,u=0,c=(i[s].width+i[s+1].width)/2+r,d=!1;if(e>=0!=(n===10)){if(l=t+c,l>a){if(l=t-c,l<-a)return o.x=l,o.y=u,!1;d=!0}}else if(l=t-c,l<-a){if(l=t+c,l>a)return o.x=l,o.y=u,!1;d=!0}return u=Math.sqrt(1-Math.min(1,l*l/(a*a)))*h,e<0!==d&&(u=-u),Math.abs(e-u)>(i[s].height+i[s+1].height)/2?(o.x=l,o.y=u,!1):(o.x=l,o.y=u,!0)}rF(t,e,i,s,n,o){let r=this.Ya,a=this.gi,h=this.Is,l=0,u=0,c=(i[s].height+i[s+1].height)/2+r,d=!1;if(t>=0!=(n===10)){if(u=e-c,u<-h){if(u=e+c,u>h)return o.x=l,o.y=u,!1;d=!0}}else if(u=e+c,u>h){if(u=e-c,u<-h)return o.x=l,o.y=u,!1;d=!0}return l=Math.sqrt(1-Math.min(1,u*u/(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=u,!1):(o.x=l,o.y=u,!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;if(t?i=new P(0,0):(i.x=this.arrangementOrigin.x+this.gi,i.y=this.arrangementOrigin.y+this.Is),this.network!==null){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&&e){this.group.ensureBounds();let s=this.group.position.copy(),n=this.group.location.copy(),o=e.subtract(n.subtract(s));this.group.move(o),this.lL=o.subtract(s)}}commitLinks(){if(this.network!==null){let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}}cL(t,e,i,s){let n=this.eF;if(Math.abs(this.tu-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 u=Math.sin(h);r+=Math.sqrt(1-o*o*u*u)*a}return i!==void 0&&s!==void 0?(t>e?t:e)*r:4*(t>e?t:e)*r}Ek(t,e,i,s){let n=0;return i!==void 0&&s!==void 0?n=this.cL(1,e,i,s):n=this.cL(1,e),t/n}Uk(t,e,i,s){if(Math.abs(this.tu-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}}d3(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.p3(this.y3(t));default:m.o("Invalid sorting type.")}return t}y3(t){let e=[];for(let s=0;s<t.length;s++)e.push(0);let i=new q;for(let s=0;s<t.length;s++){let n=-1,o=-1;if(s===0)for(let u=0;u<t.length;u++){let c=t.elt(u).edgesCount;c>n&&(n=c,o=u)}else for(let u=0;u<t.length;u++){let c=e[u];c>n&&(n=c,o=u)}i.add(t.elt(o)),e[o]=-1;let r=t.elt(o),a=0,h=r.sourceEdges;for(;h.next();){let u=h.value.fromVertex;a=t.indexOf(u),!(a<0)&&e[a]>=0&&e[a]++}let l=r.destinationEdges;for(;l.next();){let u=l.value.toVertex;a=t.indexOf(u),!(a<0)&&e[a]>=0&&e[a]++}}return i}p3(t){let e=[];for(let c=0;c<t.length;c++){let d=t.elt(c);e[c]=[];let f=0,p=d.destinationEdges;for(;p.next();){let y=p.value.toVertex;f=t.indexOf(y),f!==c&&e[c].indexOf(f)<0&&e[c].push(f)}let g=d.sourceEdges;for(;g.next();){let y=g.value.fromVertex;f=t.indexOf(y),f!==c&&e[c].indexOf(f)<0&&e[c].push(f)}}let i=[];for(let c=0;c<e.length;c++)i[c]=0;let s=[],n=[],o=[],r=[],a=new q,h=0;for(let c=0;c<e.length;c++){let d=e[c].length;if(d===1){r.push(c);continue}if(d===0){a.add(t.elt(c));continue}if(h===0){s.push(c),h++;continue}let f=1/0,p=1/0,g=-1,y=[];for(let b=0;b<s.length;b++)e[s[b]].indexOf(s[b===s.length-1?0:b+1])<0&&y.push(b===s.length-1?0:b+1);if(y.length===0)for(let b=0;b<s.length;b++)y.push(b);for(let b=0;b<y.length;b++){let v=y[b],w=this.w3(e[c],n,o,i,v,s),k=0;for(let S=0;S<e[c].length;S++){let N=e[c][S],D=s.indexOf(N);if(D>=0){let L=Math.abs(v-(D>=v?D+1:D));k+=L<s.length+1-L?L:s.length+1-L}}for(let S=0;S<n.length;S++){let N=i[n[S]],D=i[o[S]];if(N>=v&&N++,D>=v&&D++,N>D){let L=D;D=N,N=L}D-N<(s.length+2)/2==(N<v&&v<=D)&&k++}(w<f||w===f&&k<p)&&(f=w,p=k,g=v)}s.splice(g,0,c);for(let b=0;b<s.length;b++)i[s[b]]=b;for(let b=0;b<e[c].length;b++){let v=e[c][b];s.indexOf(v)>=0&&(n.push(c),o.push(v))}h++}let l=!1,u=s.length;for(;;){l=!0;for(let c=0;c<r.length;c++){let d=r[c],f=e[d][0],p=s.indexOf(f);if(p>=0){let g=0;for(let y=0;y<e[f].length;y++){let b=e[f][y],v=s.indexOf(b);if(v<0||v===p)continue;let w=v>p?v-p:p-v,k=u-w;g+=v<p!=w>k?1:-1}s.splice(g<0?p:p+1,0,d),r.splice(c,1),c--}else l=!1}if(l)break;s.push(r[0]),r.splice(0,1)}for(let c=0;c<s.length;c++){let d=s[c];a.add(t.elt(d))}return a}w3(t,e,i,s,n,o){let r=0;for(let a=0;a<e.length;a++){let h=e[a],l=i[a],u=s[h],c=s[l],d=0,f=0;if(u<c?(d=u,f=c):(d=c,f=u),d<n&&n<=f)for(let p=0;p<t.length;p++){let g=t[p];o.indexOf(g)<0||d<s[g]&&s[g]<f||d===s[g]||f===s[g]||r++}else for(let p=0;p<t.length;p++){let g=t[p];o.indexOf(g)<0||!(d<s[g]&&s[g]<f)||d===s[g]||f===s[g]||r++}}return r}get radius(){return this.Rg}set radius(t){this.Rg!==t&&(m.s(t,"number",Be,"radius"),(t>0||isNaN(t))&&(this.Rg=t,this.p()))}get aspectRatio(){return this.Og}set aspectRatio(t){this.Og!==t&&(m.s(t,"number",Be,"aspectRatio"),t>0&&(this.Og=t,this.p()))}get startAngle(){return this.Ig}set startAngle(t){this.Ig!==t&&(m.s(t,"number",Be,"startAngle"),this.Ig=t,this.p())}get sweepAngle(){return this.eu}set sweepAngle(t){this.eu!==t&&(m.s(t,"number",Be,"sweepAngle"),t>0&&t<=360?this.eu=t:this.eu=360,this.p())}get arrangement(){return this.He}set arrangement(t){this.He!==t&&(t===3||t===0||t===1||t===2)&&(this.He=t,this.p())}get direction(){return this.P}set direction(t){this.P!==t&&(t===10||t===11||t===12||t===13)&&(this.P=t,this.p())}get sorting(){return this.Si}set sorting(t){this.Si!==t&&(this.Si=t,this.p())}get comparer(){return this.Mi}set comparer(t){this.Mi!==t&&(m.S(t,Be,"comparer"),this.Mi=t,this.p())}get spacing(){return this.In}set spacing(t){this.In!==t&&(m.s(t,"number",Be,"spacing"),this.In=t,this.p())}get nodeDiameterFormula(){return this.Eg}set nodeDiameterFormula(t){this.Eg!==t&&(t===30||t===31)&&(this.Eg=t,this.p())}get actualXRadius(){return this.gi}get actualYRadius(){return this.Is}get actualSpacing(){return this.Ya}get actualCenter(){return this.lL}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 Hs{iu;dc;su;constructor(){this.iu=-1/0,this.dc=null,this.su=null}g3(t,e){if(t>0&&this.iu<0||Math.abs(t)<Math.abs(this.iu)&&!(t<0&&this.iu>0)){this.iu=t,this.dc=[],this.su=[];for(let i=0;i<e.length;i++)this.dc[i]=e[i].bounds.x,this.su[i]=e[i].bounds.y}}m3(t,e){if(Math.abs(t)<Math.abs(this.iu)){this.iu=t,this.dc=[],this.su=[];for(let i=0;i<e.length;i++)this.dc[i]=e[i].bounds.x,this.su[i]=e[i].bounds.y}}commit(t){if(!(this.dc===null||this.su===null))for(let e=0;e<this.dc.length;e++){let i=t.elt(e);i.x=this.dc[e],i.y=this.su[e]}}}class Ws extends Ee{constructor(t){super(t)}createVertex(){return new di(this)}createEdge(){return new $s(this)}}class di extends Ie{Co;Vk;constructor(t){super(t),this.Co=NaN,this.Vk=NaN}Ka(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.Co=Math.max(this.width,this.height),this.Co;{let s=Math.abs(Math.sin(t)),n=Math.abs(Math.cos(t));return s===0?this.width:n===0?this.height:(this.Co=Math.min(this.height/s,this.width/n),this.Co)}}else return i.nodeDiameterFormula===31?(this.Co=Math.max(this.width,this.height),this.Co):(this.Co=Math.sqrt(this.width*this.width+this.height*this.height),this.Co)}get diameter(){return this.Co}set diameter(t){this.Co!==t&&(m.s(t,"number",di,"diameter"),this.Co=t)}get actualAngle(){return this.Vk}set actualAngle(t){this.Vk!==t&&(m.s(t,"number",di,"actualAngle"),this.Vk=t)}}class $s extends ei{constructor(t){super(t)}}class ee extends _t{ww;Ha;Es;Ug;Un;zi;Vg;Bg;zg;nu;Xg;Gg;ou;ru;lu;au;Yg;Kg;hu;gc;constructor(t){super(),this.ww=0,this.Ha=0,this.Es=new st(100,100).k(),this.Ug=!1,this.Un=!0,this.zi=!1,this.Vg=100,this.Bg=300,this.zg=1,this.nu=1e3,this.Xg=10,this.Gg=Math,this.ou=.05,this.ru=50,this.lu=150,this.au=0,this.Yg=10,this.Kg=5,this.hu=NaN,this.gc=10,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Es.h(this.Es),t.Ug=this.Ug,t.Un=this.Un,t.zi=this.zi,t.Vg=this.Vg,t.Bg=this.Bg,t.zg=this.zg,t.nu=this.nu,t.Xg=this.Xg,t.Gg=this.Gg,t.ou=this.ou,t.ru=this.ru,t.lu=this.lu,t.au=this.au,t.Yg=this.Yg,t.Kg=this.Kg,t.hu=this.hu,t.gc=this.gc}createNetwork(){return new Js(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.fL(),this.Ha=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.x3(r,n),r=o.iterator;r.next();){let a=r.value,h=a.vertexes.iterator;for(;h.next();){let u=h.value;n.addVertex(u)}let l=a.edges.iterator;for(;l.next();){let u=l.value;n.addEdge(u)}}}else this.lF(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.hu;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 Zs(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.b3(i,r,this.maxPrelayoutIterations,t.vertexes.count),this.lF(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 c=l.value;i.has(c.idInCluster)||c.hierarchicalVertexes.length<a&&(a=c.hierarchicalVertexes.length,h=c)}let u=e.createVertex();u.hierarchicalVertexes.addAll(r.hierarchicalVertexes),h!=null&&u.hierarchicalVertexes.addAll(h.hierarchicalVertexes),i.set(r.idInCluster,u),h!=null&&i.set(h.idInCluster,u),e.addVertex(u)}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}nx(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}x3(t,e){let i=this.arrangementSpacing,s=t.count,n=!0,o=0,r=0,a=m.st();for(let c=0;c<s+e.vertexes.count+2;c++)a[c]=null;let h=0;t.reset();let l=I.l(),u;for(;t.next();){let c=t.value;if(this.nx(c,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.aF(a,h,o,r,l.width,l.height,i),f=a[d],p=new P(f.x+l.width+i.width,f.y),g=new P(f.x,f.y+l.height+i.height);d+1<h&&a.splice(d+1,0,null),a[d]=p,a[d+1]=g,h++;let y=f.x-l.x,b=f.y-l.y;for(u=c.vertexes.iterator;u.next();){let v=u.value;this.isFixed(v)||(v.centerX+=y,v.centerY+=b)}}}for(I.i(l),u=e.vertexes.iterator;u.next();){let c=u.value,d=c.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 f=this.aF(a,h,o,r,d.width,d.height,i),p=a[f],g=new P(p.x+d.width+i.width,p.y),y=new P(p.x,p.y+d.height+i.height);f+1<h&&a.splice(f+1,0,null),a[f]=g,a[f+1]=y,h++,this.isFixed(c)||(c.centerX=p.x+c.width/2,c.centerY=p.y+c.height/2)}m.Z(a)}aF(t,e,i,s,n,o,r){let a=9e19,h=-1;t:for(let l=0;l<e;l++){let u=t[l],c=u.x-i,d=u.y-s,f=c*c+d*d;if(f<a){for(let p=l-1;p>=0;p--)if(t[p].y>u.y&&t[p].x-u.x<n+r.width)continue t;for(let p=l+1;p<e;p++)if(t[p].x>u.x&&t[p].y-u.y<o+r.height)continue t;h=l,a=f}}return h}fL(){if(this.network===null||!this.comments)return;let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value;this.addComments(e)}}addComments(t){if(this.network===null)return;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}}}hF(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,u=a.width,c=a.height;if(s+o<h)if(n>l+c){let d=s+o-h,f=n-l-c;return C._w(d*d+f*f)}else if(n+r<l){let d=s+o-h,f=n+r-l;return C._w(d*d+f*f)}else return h-(s+o);else if(s>h+u)if(n>l+c){let d=s-h-u,f=n-l-c;return C._w(d*d+f*f)}else if(n+r<l){let d=s-h-u,f=n+r-l;return C._w(d*d+f*f)}else return s-(h+u);else return n>l+c?n-(l+c):n+r<l?l-(n+r):.1}lF(t,e){let i=this.Ha+e;for(;this.Ha<i&&(this.Ha++,!!this.k3(t)););}k3(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 g=e[p];g.forceX=0,g.forceY=0;let y=g.centerX,b=g.centerY;s=Math.min(s,y),n=Math.max(n,y),o=Math.min(o,b),r=Math.max(r,b)}let a=n-s>r-o;a?e.sort((p,g)=>p===null||g===null||p===g?0:p.centerX-g.centerX):e.sort((p,g)=>p===null||g===null||p===g?0:p.centerY-g.centerY);let h=this.nu,l=0,u=0,c=0;for(let p=0;p<e.length;p++){let g=e[p],y=g.bounds,b=g.focus,v=y.x+b.x,w=y.y+b.y;u=g.charge*this.electricalFieldX(v,w),c=g.charge*this.electricalFieldY(v,w),u+=g.mass*this.gravitationalFieldX(v,w),c+=g.mass*this.gravitationalFieldY(v,w),g.forceX+=u,g.forceY+=c;for(let k=p+1;k<e.length;k++){let S=e[k];if(!this.shouldInteract(g,S)||k===p)continue;let N=S.bounds,D=S.focus,L=N.x+D.x,M=N.y+D.y;if(v-L>h||L-v>h){if(a)break;continue}if(w-M>h||M-w>h){if(!a)break;continue}let A=this.hF(g,S),F=2*g.charge,O=2*S.charge;if(A>1)l=F*O/(A*A),u=l*(v-L)/A,c=l*(w-M)/A;else{let E=this.randomNumberGenerator;E===null&&(this.randomNumberGenerator=E=new Zs(0));let B=E.random(),X=E.random();if(v>L)u=Math.abs(S.bounds.right-g.bounds.x),u=F*O*(1+u)*B;else if(v<L)u=Math.abs(S.bounds.x-g.bounds.right),u=-(F*O)*(1+u)*B;else{let z=Math.max(S.width,g.width);u=F*O*((1+z)*B-z/2)}if(w>M)c=Math.abs(S.bounds.bottom-g.bounds.y),c=F*O*(1+c)*X;else if(v<L)c=Math.abs(S.bounds.y-g.bounds.bottom),c=-(F*O)*(1+c)*X;else{let z=Math.max(S.height,g.height);c=F*O*((1+z)*X-z/2)}}g.forceX+=u,g.forceY+=c,S.forceX-=u,S.forceY-=c}}let d=t.edges.iterator;for(;d.next();){let p=d.value,g=p.fromVertex,y=p.toVertex,b=g.bounds,v=g.focus,w=b.x+v.x,k=b.y+v.y,S=y.bounds,N=y.focus,D=S.x+N.x,L=S.y+N.y,M=this.hF(g,y);M>1&&(l=.1*p.stiffness*(M-p.length),u=l*.5*(g.width+y.height)*(w-D)/M,c=l*.5*(g.width+y.height)*(k-L)/M),g.forceX-=u,g.forceY-=c,y.forceX+=u,y.forceY+=c}let f=0;for(let p=0;p<e.length;p++){let g=e[p];this.isFixed(g)?this.moveFixedVertex(g):f=Math.max(f,this.moveVertex(g)||0)}return f>this.epsilonDistance*this.epsilonDistance}b3(t,e,i,s){let n=this.Ha+i,o=Math.sqrt(s);this.ww=this.gc*t.vertexes.count;let r=t.vertexes.toArray(),a=0,h=0,l=0;for(;this.Ha<n;){this.Ha++,h=a,a=0;for(let u=0;u<r.length;u++){r[u].forceX=0,r[u].forceY=0;for(let d=0;d<r.length;d++){if(u===d)continue;let f=Math.sqrt((r[u].centerX-r[d].centerX)**2+(r[u].centerY-r[d].centerY)**2),p=e[r[u].idInCluster][r[d].idInCluster],g=(f-this.gc*o*p)/f;r[u].forceX+=g*(r[d].x-r[u].x),r[u].forceY+=g*(r[d].y-r[u].y)}let c=Math.sqrt(r[u].forceX*r[u].forceX+r[u].forceY*r[u].forceY);if(c>0){r[u].forceX=this.ww*r[u].forceX/c,r[u].forceY=this.ww*r[u].forceY/c,this.isFixed(r[u])||(r[u].x+=r[u].forceX,r[u].y+=r[u].forceY);let d=r[u].hierarchicalVertexes.iterator;for(;d.next();){let f=d.value;this.isFixed(f)||(f.centerX+=r[u].forceX,f.centerY+=r[u].forceY)}}a+=c*c}if(a>=h){if(l++,l>=5)break}else l=0;this.ww*=.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.xw(),this.commitNodes(),this.isRouting&&this.commitLinks()}xw(){if(this.network===null||!this.setsPortSpots)return;let t=this.network.edges.iterator;for(;t.next();){let e=t.value.link;e!==null&&(e.fromSpot=T.Default,e.toSpot=T.Default)}}commitNodes(){if(!this.network)return;let t=0,e=0;if(this.arrangesToOrigin){let n=I.l();this.nx(this.network,n);let o=this.arrangementOrigin;t=o.x-n.x,e=o.y-n.y,I.i(n)}let i=I.l(),s=this.network.vertexes.iterator;for(;s.next();){let n=s.value;(t!==0||e!==0)&&(i.h(n.bounds),i.x+=t,i.y+=e,n.bounds=i),n.commit()}I.i(i)}commitLinks(){if(!this.network)return;let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}springStiffness(t){let e=t.stiffness;return isNaN(e)?this.ou:e}springLength(t){let e=t.length;return isNaN(e)?this.ru:e}electricalCharge(t){let e=t.charge;return isNaN(e)?this.lu:e}electricalFieldX(t,e){return 0}electricalFieldY(t,e){return 0}gravitationalMass(t){let e=t.mass;return isNaN(e)?this.au:e}gravitationalFieldX(t,e){return 0}gravitationalFieldY(t,e){return 0}isFixed(t){return t.isFixed}get currentIteration(){return this.Ha}get arrangementSpacing(){return this.Es}set arrangementSpacing(t){this.Es.equals(t)||(this.Es.h(t),this.p())}get arrangesToOrigin(){return this.Ug}set arrangesToOrigin(t){this.Ug!==t&&(m.s(t,"boolean",ee,"arrangesToOrigin"),this.Ug=t,this.p())}get setsPortSpots(){return this.Un}set setsPortSpots(t){this.Un!==t&&(m.s(t,"boolean",ee,"setsPortSpots"),this.Un=t,this.p())}get comments(){return this.zi}set comments(t){this.zi!==t&&(m.s(t,"boolean",ee,"comments"),this.zi=t,this.p())}get maxPrelayoutIterations(){return this.Vg}set maxPrelayoutIterations(t){this.Vg!==t&&(m.s(t,"number",ee,"maxPrelayoutIterations"),t>=0&&(this.Vg=t,this.p()))}get maxIterations(){return this.Bg}set maxIterations(t){this.Bg!==t&&(m.s(t,"number",ee,"maxIterations"),t>=0&&(this.Bg=t,this.p()))}get epsilonDistance(){return this.zg}set epsilonDistance(t){this.zg!==t&&(m.s(t,"number",ee,"epsilonDistance"),t>0&&(this.zg=t,this.p()))}get infinityDistance(){return this.nu}set infinityDistance(t){this.nu!==t&&(m.s(t,"number",ee,"infinityDistance"),t>1&&(this.nu=t,this.p()))}get moveLimit(){return this.Xg}set moveLimit(t){this.Xg!==t&&(m.s(t,"number",ee,"moveLimit"),this.Xg=t,this.p())}get randomNumberGenerator(){return this.Gg}set randomNumberGenerator(t){this.Gg!==t&&(t!==null&&!m.it(t.random)&&m.o('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+t),this.Gg=t)}get defaultSpringStiffness(){return this.ou}set defaultSpringStiffness(t){this.ou!==t&&(m.s(t,"number",ee,"defaultSpringStiffness"),this.ou=t,this.p())}get defaultSpringLength(){return this.ru}set defaultSpringLength(t){this.ru!==t&&(m.s(t,"number",ee,"defaultSpringLength"),this.ru=t,this.p())}get defaultElectricalCharge(){return this.lu}set defaultElectricalCharge(t){this.lu!==t&&(m.s(t,"number",ee,"defaultElectricalCharge"),this.lu=t,this.p())}get defaultGravitationalMass(){return this.au}set defaultGravitationalMass(t){this.au!==t&&(m.s(t,"number",ee,"defaultGravitationalMass"),this.au=t,this.p())}get defaultCommentSpringLength(){return this.Yg}set defaultCommentSpringLength(t){this.Yg!==t&&(m.s(t,"number",ee,"defaultCommentSpringLength"),this.Yg=t,this.p())}get defaultCommentElectricalCharge(){return this.Kg}set defaultCommentElectricalCharge(t){this.Kg!==t&&(m.s(t,"number",ee,"defaultCommentElectricalCharge"),this.Kg=t,this.p())}get prelayoutQuality(){return this.hu}set prelayoutQuality(t){this.hu!==t&&(m.s(t,"number",ee,"prelayoutQuality"),this.hu=t,this.p())}get prelayoutSpread(){return this.gc}set prelayoutSpread(t){this.gc!==t&&(m.s(t,"number",ee,"prelayoutSpread"),this.gc=t,this.p())}}class Js extends Ee{constructor(t){super(t)}createVertex(){return new Ve(this)}createEdge(){return new fi(this)}}class Ve extends Ie{Bk;zk;Xk;Gk;Yk;hierarchicalVertexes;idInCluster;constructor(t){super(t),this.Bk=!1,this.zk=NaN,this.Xk=NaN,this.Gk=0,this.Yk=0,this.hierarchicalVertexes=new q,this.idInCluster=-1}get isFixed(){return this.Bk}set isFixed(t){this.Bk!==t&&(m.s(t,"boolean",Ve,"isFixed"),this.Bk=t)}get charge(){return this.zk}set charge(t){this.zk!==t&&(m.s(t,"number",Ve,"charge"),this.zk=t)}get mass(){return this.Xk}set mass(t){this.Xk!==t&&(m.s(t,"number",Ve,"mass"),this.Xk=t)}get forceX(){return this.Gk}set forceX(t){this.Gk!==t&&(m.s(t,"number",Ve,"forceX"),this.Gk=t)}get forceY(){return this.Yk}set forceY(t){this.Yk!==t&&(m.s(t,"number",Ve,"forceY"),this.Yk=t)}}class fi extends ei{Kk;Hk;constructor(t){super(t),this.Kk=NaN,this.Hk=NaN}get stiffness(){return this.Kk}set stiffness(t){this.Kk!==t&&(m.s(t,"number",fi,"stiffness"),this.Kk=t)}get length(){return this.Hk}set length(t){this.Hk!==t&&(m.s(t,"number",fi,"length"),this.Hk=t)}}class Zs{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 ns=(x=>(x[x.DepthFirst=0]="DepthFirst",x[x.Greedy=1]="Greedy",x[x.FromLayers=2]="FromLayers",x))(ns||{}),os=(x=>(x[x.OptimalLinkLength=10]="OptimalLinkLength",x[x.LongestPathSink=11]="LongestPathSink",x[x.LongestPathSource=12]="LongestPathSource",x))(os||{}),rs=(x=>(x[x.DepthFirstOut=20]="DepthFirstOut",x[x.DepthFirstIn=21]="DepthFirstIn",x[x.Naive=22]="Naive",x))(rs||{}),as=(x=>(x[x.None=30]="None",x[x.Less=31]="Less",x[x.More=32]="More",x))(as||{}),Qs=(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))(Qs||{}),_s=(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))(_s||{});class Ae extends _t{Us;ti;P;cu;fu;uu;mc;du;lr;gu;Un;_;bw;zt;Hg;Vs;ie;Bs;ms;ps;Rt;qg;jg;qk;cn;mu;ar;Vn;Bn;uL;qa;constructor(t){super(),this.Us=25,this.ti=25,this.P=0,this.cu=0,this.fu=10,this.uu=20,this.mc=4,this.du=31,this.lr=15,this.gu=10,this.Un=!0,this._=-1,this.bw=-1,this.zt=-1,this.Hg=0,this.Vs=0,this.ie=new Int16Array(0),this.Bs=new Float32Array(0),this.ms=new Float32Array(0),this.ps=new Float32Array(0),this.Rt=new Float32Array(0),this.qg=0,this.jg=new Int16Array(0),this.qk=new Int16Array(0),this.cn=0,this.mu=null,this.ar=new P,this.Vn=[],this.Vn.length=100,this.Bn=15,this.uL=0,this.qa=!0,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Us=this.Us,t.ti=this.ti,t.P=this.P,t.cu=this.cu,t.fu=this.fu,t.uu=this.uu,t.mc=this.mc,t.du=this.du,t.lr=this.lr,t.gu=this.gu,t.Un=this.Un,t.Bn=this.Bn,t.qa=this.qa}fe(t){t in as?this.aggressiveOption=t:t in ns?this.cycleRemoveOption=t:t in rs?this.initializeOption=t:t in os?this.layeringOption=t:super.fe(t)}createNetwork(){return new tn(this)}doLayout(t){this.network===null&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin),this.P3(),this.network.vertexes.count>0&&(this.network.deleteSelfEdges(),this.cycleRemoveOption!==2&&this.removeCycles(),this.S3(),this.cycleRemoveOption===2&&this.removeCycles(),this.M3(),this.N3(),this.C3(),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.P===90||this.P===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.jk:t.Wk;if(i!==null)return i;let s=this.P;return s===90||s===270?e?t.jk=t.focus.x/this.ti+1|0:t.Wk=(t.bounds.width-t.focus.x)/this.ti+1|0:e?t.jk=t.focus.y/this.ti+1|0:t.Wk=(t.bounds.height-t.focus.y)/this.ti+1|0}ei(){let t=this.network.vertexes.count;this.jg.length<t*2&&(this.jg=new Int16Array(t*2));let e=0,i=this.network.vertexes.iterator;for(;i.next();){let s=i.value;this.jg[e]=s.column,e++,this.jg[e]=s.index,e++}return this.jg}ns(t){let e=0,i=this.network.vertexes.iterator;for(;i.next();){let s=i.value;s.column=t[e],e++,s.index=t[e],e++}}cF(t,e){let i=this.ja(t),s=this.ie[t];this.qk.length<s*s&&(this.qk=new Int16Array(s*s));let n=this.qk;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 u,c=0,d,f=0,p=0,g=0,y,b=0,v,w=0,k=0,S=0,N;if(e>=0){for(u=i[o].ko,c=0;c<u.length;c++)if(d=u[c],d.valid&&d.fromVertex.layer!==t)for(f=d.fromVertex.index,p=d.portToPos,g=d.portFromPos,b=c+1;b<u.length;b++)v=u[b],v.valid&&v.fromVertex.layer!==t&&(w=v.fromVertex.index,k=v.portToPos,S=v.portFromPos,p<k&&(f>w||f===w&&g>S)&&r++,k<p&&(w>f||w===f&&S>g)&&r++)}if(e<=0){for(u=i[o].sr,c=0;c<u.length;c++)if(d=u[c],d.valid&&d.toVertex.layer!==t)for(f=d.toVertex.index,p=d.portToPos,g=d.portFromPos,b=c+1;b<u.length;b++)v=u[b],v.valid&&v.toVertex.layer!==t&&(w=v.toVertex.index,k=v.portToPos,S=v.portFromPos,g<S&&(f>w||f===w&&p>k)&&r++,S<g&&(w>f||w===f&&k>p)&&r++)}for(n[o*s+o]=r,l=o+1;l<s;l++){let D=0,L=0;if(e>=0){for(y=i[o].ko,N=i[l].ko,c=0;c<y.length;c++)if(d=y[c],d.valid&&d.fromVertex.layer!==t)for(f=d.fromVertex.index,p=d.portToPos,g=d.portFromPos,b=0;b<N.length;b++)v=N[b],v.valid&&v.fromVertex.layer!==t&&(w=v.fromVertex.index,k=v.portToPos,S=v.portFromPos,(f<w||f===w&&g<S)&&L++,(w<f||w===f&&S<g)&&D++)}if(e<=0){for(y=i[o].sr,N=i[l].sr,c=0;c<y.length;c++)if(d=y[c],d.valid&&d.toVertex.layer!==t)for(f=d.toVertex.index,p=d.portToPos,g=d.portFromPos,b=0;b<N.length;b++)v=N[b],v.valid&&v.toVertex.layer!==t&&(w=v.toVertex.index,k=v.portToPos,S=v.portFromPos,(f<w||f===w&&p<k)&&L++,(w<f||w===f&&k<p)&&D++)}n[o*s+l]=D,n[l*s+o]=L}}return this.Wa(t,i),n}countCrossings(){let t=0;for(let e=0;e<=this._;e++){let i=this.cF(e,1),s=this.ie[e];for(let n=0;n<s;n++)for(let o=n;o<s;o++)t+=i[n*s+o]}return t}L3(t,e,i){let s=this.ja(t),n=this.ie[t],o=0;for(let r=0;r<n;r++){let a=null;e<=0&&(a=s[r].ko);let h=null;e>=0&&(h=s[r].sr);let l,u=0,c=0;if(a!==null)for(let d=0;d<a.length;d++)l=a[d],l.valid&&l.fromVertex.layer!==t&&(u=l.fromVertex.column+l.portFromColOffset,c=l.toVertex.column+l.portToColOffset,i?o+=Math.abs(u-c)*this.linkStraightenWeight(l):o+=Math.abs(u-c));if(h!==null)for(let d=0;d<h.length;d++)l=h[d],l.valid&&l.toVertex.layer!==t&&(u=l.fromVertex.column+l.portFromColOffset,c=l.toVertex.column+l.portToColOffset,i?o+=(Math.abs(u-c)+1)*this.linkStraightenWeight(l):o+=Math.abs(u-c))}return this.Wa(t,s),o}Jk(t){let e=0;for(let i=0;i<=this._;i++)e+=this.L3(i,1,t);return e}kw(){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}Pw(t,e){let i=this.ja(t),s=this.ie[t],n=new Float32Array(s);for(let o=0;o<s;o++){let r=i[o],a=null;e<=0&&(a=r.ko);let h=null;e>=0&&(h=r.sr);let l=0,u=0,c=r.near;c!==null&&c.layer===r.layer&&(l+=c.column-1,u++);let d;if(a!==null)for(let f=0;f<a.length;f++){d=a[f];let p=d.fromVertex;d.valid&&!d.rev&&p.layer!==t&&(l+=p.column,u++)}if(h!==null)for(let f=0;f<h.length;f++){d=h[f];let p=d.toVertex;d.valid&&!d.rev&&p.layer!==t&&(l+=p.column,u++)}u===0?n[o]=-1:n[o]=l/u}return this.Wa(t,i),n}fF(t,e){let i=this.ja(t),s=this.ie[t],n=new Int16Array(s);for(let o=0;o<s;o++){let r=i[o],a=null;e<=0&&(a=r.ko);let h=null;e>=0&&(h=r.sr);let l=0,u=[],c=r.near;c!==null&&c.layer===r.layer&&(u[l]=c.column-1,l++);let d;if(a!==null)for(let f=0;f<a.length;f++){d=a[f];let p=d.fromVertex;d.valid&&!d.rev&&p.layer!==t&&(u[l]=p.column+d.portFromColOffset,l++)}if(h!==null)for(let f=0;f<h.length;f++){d=h[f];let p=d.toVertex;d.valid&&!d.rev&&p.layer!==t&&(u[l]=p.column+d.portToColOffset,l++)}if(l===0)n[o]=-1;else{u.sort((p,g)=>p-g);let f=l>>1;(l&1)!==0?n[o]=u[f]:n[o]=u[f-1]+u[f]>>1}}return this.Wa(t,i),n}Sw(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.Sw(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.Sw(l,e,i,s,n)}}}}dL(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.dL(r,e,i,s,n)}}if(n){let o=t.sourceEdges;for(;o.next();){let r=o.value.fromVertex;this.dL(r,e,i,s,n)}}}}removeCycles(){let t=this.network.edges.iterator;for(;t.next();){let e=t.value;e.rev=!1}switch(this.cu){default:case 1:this.A3();break;case 0:this.T3();break;case 2:this.D3();break}}D3(){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)}}}A3(){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.ii=!0}for(;this.v3(t)!==null;){let r;for(r=this.uF(t);r!==null;)s[i]=r,i--,r.ii=!1,r=this.uF(t);for(r=this.dF(t);r!==null;)s[e]=r,e++,r.ii=!1,r=this.dF(t);r=this.F3(t),r!==null&&(s[e]=r,e++,r.ii=!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)}}v3(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.ii)return i}return null}uF(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.ii){let s=!0,n=i.destinationEdges;for(;n.next();)if(n.value.toVertex.ii){s=!1;break}if(s)return i}}return null}dF(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.ii){let s=!0,n=i.sourceEdges;for(;n.next();)if(n.value.fromVertex.ii){s=!1;break}if(s)return i}}return null}F3(t){let e=null,i=0,s=this.network.vertexes.iterator;for(;s.next();){let n=s.value;if(n.ii){let o=0,r=n.destinationEdges;for(;r.next();)r.value.toVertex.ii&&o++;let a=0,h=n.sourceEdges;for(;h.next();)h.value.fromVertex.ii&&a++;(e===null||i<o-a)&&(e=n,i=o-a)}}return e}T3(){let t=this.network.vertexes.iterator;for(;t.next();){let i=t.value;i.pu=-1,i.Zn=-1}let e=this.network.edges.iterator;for(;e.next();){let i=e.value;i.forest=!1}for(this.qg=0,t.reset();t.next();){let i=t.value;i.sourceEdges.count===0&&this.gL(i)}for(t.reset();t.next();){let i=t.value;i.pu===-1&&this.gL(i)}for(e.reset();e.next();){let i=e.value;if(!i.forest){let s=i.fromVertex,n=s.pu,o=s.Zn,r=i.toVertex,a=r.pu,h=r.Zn;a<n&&o<h&&(this.network.reverseEdge(i),i.rev=!0)}}}gL(t){t.pu=this.qg,this.qg++;let e=t.destinationEdges;for(;e.next();){let i=e.value,s=i.toVertex;s.pu===-1&&(i.forest=!0,this.gL(s))}t.Zn=this.qg,this.qg++}S3(){let t=this.network.vertexes.iterator;for(;t.next();){let s=t.value;s.layer=-1}for(this._=-1,this.assignLayers(),t.reset();t.next();){let s=t.value;this._=Math.max(this._,s.layer)}this._>=9999&&m.o("LayeredDigraphLayout, too many layers: "+this._);let e=this.direction==0||this.direction==180,i=[];for(let s=this.network.vertexes.iterator;s.next();){let n=s.value;if(n.node===null||n.centered)continue;let o=n.layer,r=i[o];r===void 0&&(r=0);let a=e?n.width:n.height;a>r&&(i[o]=a)}for(let s=this.network.vertexes.iterator;s.next();){let n=s.value;if(n.node===null||n.centered)continue;let o=i[n.layer];e?(n.focusX=o/2,n.focusY=n.focus.y,n.width=o):(n.focusX=n.focus.x,n.focusY=o/2,n.height=o)}}assignLayers(){switch(this.fu){case 11:this.gF();break;case 12:this.R3();break;default:case 10:this.O3();break}}gF(){let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value,i=this.mF(e);this._=Math.max(i,this._)}}mF(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.mF(n)+o)}t.layer=e}else e=t.layer;return e}R3(){let t=0,e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;t=this.pF(i),this._=Math.max(t,this._)}for(e.reset();e.next();){let i=e.value;i.layer=this._-i.layer}}pF(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.pF(n)+o)}t.layer=e}else e=t.layer;return e}O3(){this.gF();let t=this.network.vertexes.iterator;for(;t.next();){let i=t.value;i.ii=!1}for(t.reset();t.next();){let i=t.value;i.sourceEdges.count===0&&this.yF(i)}let e=1/0;for(t.reset();t.next();){let i=t.value;e=Math.min(e,i.layer)}for(this._=-1,t.reset();t.next();){let i=t.value;i.layer-=e,this._=Math.max(this._,i.layer)}}yF(t){if(!t.ii){t.ii=!0;let e=t.destinationEdges;for(;e.next();){let i=e.value.toVertex;this.yF(i)}this.I3(t),this.E3(t)}}I3(t){let e=this.network.vertexes.iterator;for(;e.next();){let r=e.value;r.component=-1}let i=0,s=1,n=t.ko,o=n.length;for(let r=0;r<o;r++){let a=n[r],h=a.fromVertex,l=a.toVertex,u=this.linkMinLength(a);h.layer-l.layer>u&&this.Sw(h,i,-1,!0,!1)}for(this.Sw(t,s,-1,!0,!0);t.component!==i;){let r=0,a=1/0,h=0,l=null,u=this.network.vertexes.iterator;for(;u.next();){let c=u.value;if(c.component===s){let d=0,f=!1,p=c.ko;o=p.length;for(let y=0;y<o;y++){let b=p[y],v=b.fromVertex;if(d+=this.linkLengthWeight(b),v.component!==s){r+=this.linkLengthWeight(b);let w=v.layer-c.layer,k=this.linkMinLength(b);a=Math.min(a,w-k)}}let g=c.sr;o=g.length;for(let y=0;y<o;y++){let b=g[y],v=b.toVertex;d-=this.linkLengthWeight(b),v.component!==s?r-=this.linkLengthWeight(b):f=!0}(l===null||d<h)&&!f&&(l=c,h=d)}}if(r>0){for(e.reset();e.next();){let c=e.value;c.component===s&&(c.layer+=a)}t.component=i}else l.component=i}}E3(t){let e=this.network.vertexes.iterator;for(;e.next();){let n=e.value;n.component=-1}let i=0,s=1;for(this.Sw(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 u=0,c=!1,d=l.ko,f=d.length;for(let g=0;g<f;g++){let y=d[g],b=y.fromVertex;u+=this.linkLengthWeight(y),b.component!==s?n+=this.linkLengthWeight(y):c=!0}let p=l.sr;f=p.length;for(let g=0;g<f;g++){let y=p[g],b=y.toVertex;if(u-=this.linkLengthWeight(y),b.component!==s){n-=this.linkLengthWeight(y);let v=l.layer-b.layer,w=this.linkMinLength(y);o=Math.min(o,v-w)}}(a===null||u>r)&&!c&&(a=l,r=u)}}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}}M3(){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,u=0;if(n.link!==null){let S=n.link;if(S===null)continue;let N=o.node,D=r.node;if(N===null||D===null)continue;let L=S.fromNode,M=S.toNode,A=S.fromPort;for(;A!==null&&!A.isVisibleObject();)A=A.panel;let F=S.toPort;for(;F!==null&&!F.isVisibleObject();)F=F.panel;if(n.rev){let tt=L,nt=A;L=M,A=F,M=tt,F=nt}let O=o.focus,E=r.focus,B=n.rev?r.bounds:o.bounds,X=P.l();N!==L?B.isReal()&&L.isVisible()?L.actualBounds.isReal()?(L.getRelativePoint(A,T.Center,X),X.x+=L.actualBounds.x-B.x,X.y+=L.actualBounds.y-B.y):(L.getRelativePoint(A,T.Center,X),X.isReal()||X.h(O)):X.h(O):B.isReal()?(L.getRelativePoint(A,T.Center,X),X.isReal()||X.h(O)):X.h(O);let z=n.rev?o.bounds:r.bounds,U=P.l();D!==M?z.isReal()&&M.isVisible()?M.actualBounds.isReal()?(M.getRelativePoint(F,T.Center,U),U.x+=M.actualBounds.x-z.x,U.y+=M.actualBounds.y-z.y):(M.getRelativePoint(F,T.Center,U),U.isReal()||U.h(E)):U.h(E):z.isReal()?(M.getRelativePoint(F,T.Center,U),U.isReal()||U.h(E)):U.h(E),this.P===90||this.P===270?(a=Math.round((X.x-O.x)/this.ti),l=X.x,h=Math.round((U.x-E.x)/this.ti),u=U.x):(a=Math.round((X.y-O.y)/this.ti),l=X.y,h=Math.round((U.y-E.y)/this.ti),u=U.y),P.i(X),P.i(U),n.portFromColOffset=a,n.portFromPos=l,n.portToColOffset=h,n.portToPos=u}else n.portFromColOffset=0,n.portFromPos=0,n.portToColOffset=0,n.portToPos=0;let c=o.layer,d=r.layer,f=this.U3(n),p=f===1||f===3,g=f===2||f===3,y,b,v=null,w;g&&(v=this.V3(o,r),w=1,b=t.createVertex(),b.node=null,b.$k=1,b.layer=c,b.near=o,t.addVertex(b),y=t.linkVertexes(o,b,n.link),y.valid=!1,y.rev=n.rev,y.portFromColOffset=a,y.portToColOffset=0,y.portFromPos=l,y.portToPos=0,o=b);let k=1;if(p&&k--,c-d>k&&c>0){for(n.valid=!1,b=t.createVertex(),b.node=null,b.$k=2,b.layer=c-1,v&&w<v.length&&b.layer===v[w].layer&&(b.near=v[w++]),t.addVertex(b),y=t.linkVertexes(o,b,n.link),y.valid=!0,y.rev=n.rev,y.portFromColOffset=g?0:a,y.portToColOffset=0,y.portFromPos=g?0:l,y.portToPos=0,o=b,c--;c-d>k&&c>0;)b=t.createVertex(),b.node=null,b.$k=3,b.layer=c-1,v&&w<v.length&&b.layer===v[w].layer&&(b.near=v[w++]),t.addVertex(b),y=t.linkVertexes(o,b,n.link),y.valid=!0,y.rev=n.rev,y.portFromColOffset=0,y.portToColOffset=0,y.portFromPos=0,y.portToPos=0,o=b,c--;y=t.linkVertexes(b,r,n.link),y.valid=!p,p&&(b.near=r),y.rev=n.rev,y.portFromColOffset=0,y.portToColOffset=h,y.portFromPos=0,y.portToPos=u}else n.valid=!0}}U3(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.Zk(!0),h=this.Zk(!1),l=this.setsPortSpots?a:i.computeSpot(!0,s),u=this.setsPortSpots?h:i.computeSpot(!1,n),c=i.isOrthogonal;if(l.isSide()&&l.includesSide(h)&&u.isSide()&&u.includesSide(a))return 0;let d=i.getLinkPoint(o,s,l,!0,c,r,n,P.l()),f=i.getLinkDirection(o,s,d,l,!0,c,r,n);P.i(d),(!l.isNone()&&f===this.wF(t,!0)||this.setsPortSpots&&o!==null&&o.ports.count===1&&t.rev)&&(e+=1);let p=i.getLinkPoint(r,n,u,!1,c,o,s,P.l()),g=i.getLinkDirection(r,n,p,u,!1,c,o,s);P.i(p),(!u.isNone()&&g===this.wF(t,!1)||this.setsPortSpots&&r!==null&&r.ports.count===1&&t.rev)&&(e+=2)}}}return e}wF(t,e){return this.P===90?e&&!t.rev||!e&&t.rev?270:90:this.P===180?e&&!t.rev||!e&&t.rev?0:180:this.P===270?e&&!t.rev||!e&&t.rev?90:270:e&&!t.rev||!e&&t.rev?180:0}V3(t,e){let i=[];return i.push(e),this.xF(t,i)?i.reverse():[]}xF(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.xF(t,e))return!0;e.pop()}return!1}N3(){this.ie.length!==this._+1&&(this.ie=new Int16Array(this._+1));let t=this.ie;for(let i=0;i<=this._;i++)t[i]=0;let e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;i.index=-1}this.initializeIndices(),this.bw=-1,this.Hg=0,this.Vs=0;for(let i=0;i<=this._;i++)t[i]>t[this.Vs]&&(this.bw=t[i]-1,this.Vs=i),t[i]<t[this.Hg]&&(this.Hg=i);this.mu=[];for(let i=0;i<t.length;i++)this.mu[i]=[];for(e.reset();e.next();){let i=e.value,s=i.layer,n=this.mu[s];n[i.index]=i}}initializeIndices(){switch(this.uu){default:case 22:this.B3();break;case 20:this.z3();break;case 21:this.X3();break}}B3(){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.ie[s],this.ie[s]++,!t)continue;let n=t.get(i);Array.isArray(n)&&n.forEach(o=>{o.index=this.ie[s],this.ie[s]++})}}z3(){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._;i>=0;i--)for(e.reset();e.next();){let s=e.value;s.layer===i&&s.index===-1&&this.bF(s,t)}}bF(t,e){if(t.near)return;let i=t.layer;if(t.index=this.ie[i],this.ie[i]++,e){let o=e.get(t);Array.isArray(o)&&o.forEach(r=>{r.index=this.ie[i],this.ie[i]++})}let s=t.sr,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.bF(a,e)}}}X3(){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._;i++)for(e.reset();e.next();){let s=e.value;s.layer===i&&s.index===-1&&this.kF(s,t)}}kF(t,e){if(t.near)return;let i=t.layer;if(t.index=this.ie[i],this.ie[i]++,e){let h=e.get(t);Array.isArray(h)&&h.forEach(l=>{l.index=this.ie[i],this.ie[i]++})}let s=t.ko,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.kF(r,e))}C3(){this.zt=-1;for(let t=0;t<=this._;t++){let e=this.ja(t),i=0,s=this.ie[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.Wa(t,e)}}reduceCrossings(){let t=this.countCrossings(),e=this.ei(),i=0,s=0,n=0;for(i=0;i<this.mc;i++){for(s=0;s<=this._;s++)this.Qk(s,1),this.ys(s,1,!1,1);for(n=this.countCrossings(),n<t&&(t=n,e=this.ei()),s=this._;s>=0;s--)this.Qk(s,-1),this.ys(s,-1,!1,-1);n=this.countCrossings(),n<t&&(t=n,e=this.ei())}for(this.ns(e),i=0;i<this.mc;i++){for(s=0;s<=this._;s++)this.Qk(s,0),this.ys(s,0,!1,0);for(n=this.countCrossings(),n<t&&(t=n,e=this.ei()),s=this._;s>=0;s--)this.Qk(s,0),this.ys(s,0,!1,0);n=this.countCrossings(),n<t&&(t=n,e=this.ei())}this.ns(e);let o=!1,r=0,a=0,h=0,l=0;switch(this.du){case 30:break;case 32:for(h=t+1;(l=this.countCrossings())<h;)for(h=l,r=this._;r>=0;r--)for(a=0;a<=r;a++){for(o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,-1,!1,-1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,1,!1,1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,1,!1,1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,-1,!1,-1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,0,!1,0)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,0,!1,0)||o;n>=t?this.ns(e):(t=n,e=this.ei())}break;default:case 31:for(r=this._,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.ys(s,-1,!1,-1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,1,!1,1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,1,!1,1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,-1,!1,-1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,0,!1,0)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,0,!1,0)||o;n>=t?this.ns(e):(t=n,e=this.ei())}break}this.ns(e)}Qk(t,e){let i=0,s=!1,n=this.ja(t),o=this.ie[t],r=this.fF(t,e),a=this.Pw(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 c=r[i];r[i]=r[i+1],r[i+1]=c;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 u=0;for(i=0;i<o;i++)l=n[i],l.index=i,u+=this.nodeMinColumnSpace(l,!0),l.column=u,u+=1,u+=this.nodeMinColumnSpace(l,!1);return this.Wa(t,n),s}ys(t,e,i,s){let n=this.ja(t),o=this.ie[t],r=this.cF(t,e),a=0,h;if(!i||s>0)for(h=new Float32Array(o),a=0;a<o;a++)h[a]=-1;else h=this.Pw(t,-1);let l;if(!i||s<0)for(l=new Float32Array(o),a=0;a<o;a++)l[a]=-1;else l=this.Pw(t,1);let u=!1,c=!0;for(;c;)for(c=!1,a=0;a<o-1;a++){let d=r[n[a].index*o+n[a+1].index],f=r[n[a+1].index*o+n[a].index],p=0,g=0,y=n[a].column,b=n[a+1].column,v=this.nodeMinColumnSpace(n[a],!0),w=this.nodeMinColumnSpace(n[a],!1),k=this.nodeMinColumnSpace(n[a+1],!0),S=this.nodeMinColumnSpace(n[a+1],!1),N=y-v+k,D=b-w+S,L=0,M=0,A=0,F=0,O=0,E=0,B=0,X,z=0,U,tt=0,nt=n[a].sourceEdges.iterator;if(i&&s<=0)for(;nt.next();){let xt=nt.value;X=xt.fromVertex,xt.valid&&X.layer!==t&&(A=this.linkStraightenWeight(xt),F=xt.portFromColOffset,O=xt.portToColOffset,E=X.column,L+=(Math.abs(y+O-(E+F))+1)*A,M+=(Math.abs(D+O-(E+F))+1)*A)}for(nt.reset();nt.next();){let xt=nt.value;if(X=xt.fromVertex,xt.valid&&X.layer===t){for(z=0;z<n.length&&n[z]!==X;)z++;z<a&&(p+=2*(a-z),g+=2*(a+1-z)),z===a+1&&(p+=1),z>a+1&&(p+=4*(z-a),g+=4*(z-(a+1)))}}let Z=n[a].destinationEdges.iterator;if(i&&s>=0)for(;Z.next();){let xt=Z.value;U=xt.toVertex,xt.valid&&U.layer!==t&&(A=this.linkStraightenWeight(xt),F=xt.portFromColOffset,O=xt.portToColOffset,B=U.column,L+=(Math.abs(y+F-(B+O))+1)*A,M+=(Math.abs(D+F-(B+O))+1)*A)}for(Z.reset();Z.next();){let xt=Z.value;if(U=xt.toVertex,xt.valid&&U.layer===t){for(tt=0;tt<n.length&&n[tt]!==U;)tt++;tt===a+1&&(g+=1)}}let it=n[a+1].sourceEdges.iterator;if(i&&s<=0)for(;it.next();){let xt=it.value;X=xt.fromVertex,xt.valid&&X.layer!==t&&(A=this.linkStraightenWeight(xt),F=xt.portFromColOffset,O=xt.portToColOffset,E=X.column,L+=(Math.abs(b+O-(E+F))+1)*A,M+=(Math.abs(N+O-(E+F))+1)*A)}for(it.reset();it.next();){let xt=it.value;if(X=xt.fromVertex,xt.valid&&X.layer===t){for(z=0;z<n.length&&n[z]!==X;)z++;z<a&&(p+=2*(a+1-z),g+=2*(a-z)),z===a&&(g+=1),z>a+1&&(p+=4*(z-(a+1)),g+=4*(z-a))}}let _=n[a+1].destinationEdges.iterator;if(i&&s>=0)for(;_.next();){let xt=_.value;U=xt.toVertex,xt.valid&&U.layer!==t&&(A=this.linkStraightenWeight(xt),F=xt.portFromColOffset,O=xt.portToColOffset,B=U.column,L+=(Math.abs(b+F-(B+O))+1)*A,M+=(Math.abs(N+F-(B+O))+1)*A)}for(_.reset();_.next();){let xt=_.value;if(U=xt.toVertex,xt.valid&&U.layer===t){for(tt=0;tt<n.length&&n[tt]!==U;)tt++;tt===a&&(p+=1)}}let at=0,ct=0,yt=h[n[a].index],Ct=l[n[a].index],Q=h[n[a+1].index],St=l[n[a+1].index];if(yt!==-1&&(at+=Math.abs(yt-y),ct+=Math.abs(yt-D)),Ct!==-1&&(at+=Math.abs(Ct-y),ct+=Math.abs(Ct-D)),Q!==-1&&(at+=Math.abs(Q-b),ct+=Math.abs(Q-N)),St!==-1&&(at+=Math.abs(St-b),ct+=Math.abs(St-N)),g<p-.5||g===p&&f<d-.5||g===p&&f===d&&M<L-.5||g===p&&f===d&&M===L&&ct<at-.5){u=!0,c=!0,n[a].column=D,n[a+1].column=N;let xt=n[a];n[a]=n[a+1],n[a+1]=xt}}for(a=0;a<o;a++)n[a].index=a;return this.Wa(t,n),u}straightenAndPack(){if(this.Bn!==0){this.G3();return}let t=0,e=!1,i=(this.lr&1)!==0,s=(this.lr&8)!==0;if(this.network.edges.count>1e3&&s&&(i=!1),i){let n=[],o=0;for(o=0;o<=this._;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 u=this.nodeMinColumnSpace(l,!1);n[t]=Math.max(n[t],r+u)}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.lr&2)!==0){e=!0;let n=0;for(;e&&n<this.gu;){for(e=!1,t=this.Vs+1;t<=this._;t++)e=this.Wg(t,1)||e;for(t=this.Vs-1;t>=0;t--)e=this.Wg(t,-1)||e;e=this.Wg(this.Vs,0)||e,n++}}if((this.lr&4)!==0){for(t=this.Vs+1;t<=this._;t++)this.mL(t,1);for(t=this.Vs-1;t>=0;t--)this.mL(t,-1);this.mL(this.Vs,0)}if(i&&(this.PF(-1),this.PF(1)),(this.lr&2)!==0){e=!0;let n=0;for(;e&&n<this.gu;){for(e=!1,e=this.Wg(this.Vs,0)||e,t=this.Vs+1;t<=this._;t++)e=this.Wg(t,0)||e;for(t=this.Vs-1;t>=0;t--)e=this.Wg(t,0)||e;n++}}}Wg(t,e){let i=!1;for(;this.Y3(t,e);)i=!0;return i}Y3(t,e){let i=0,s=this.ja(t),n=this.ie[t],o=this.Pw(t,-1);if(e>0)for(i=0;i<n;i++)o[i]=-1;let r=this.Pw(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,u=this.nodeMinColumnSpace(s[i],!0),c=this.nodeMinColumnSpace(s[i],!1),d=0;i-1<0||l-s[i-1].column-1>u+this.nodeMinColumnSpace(s[i-1],!1)?d=l-1:d=l;let f=0;i+1>=n||s[i+1].column-l-1>c+this.nodeMinColumnSpace(s[i+1],!0)?f=l+1:f=l;let p=0,g=0,y=0,b=0,v=0,w=0;if(e<=0){let M=s[i].sourceEdges.iterator;for(;M.next();){let A=M.value,F=A.fromVertex;if(A.valid&&F.layer!==t){b=this.linkStraightenWeight(A),v=A.portFromColOffset,w=A.portToColOffset;let O=F.column;p+=(Math.abs(l+w-(O+v))+1)*b,g+=(Math.abs(d+w-(O+v))+1)*b,y+=(Math.abs(f+w-(O+v))+1)*b}}}if(e>=0){let M=s[i].destinationEdges.iterator;for(;M.next();){let A=M.value,F=A.toVertex;if(A.valid&&F.layer!==t){b=this.linkStraightenWeight(A),v=A.portFromColOffset,w=A.portToColOffset;let O=F.column;p+=(Math.abs(l+v-(O+w))+1)*b,g+=(Math.abs(d+v-(O+w))+1)*b,y+=(Math.abs(f+v-(O+w))+1)*b}}}let k=0,S=0,N=0,D=o[s[i].index],L=r[s[i].index];D!==-1&&(k+=Math.abs(D-l),S+=Math.abs(D-d),N+=Math.abs(D-f)),L!==-1&&(k+=Math.abs(L-l),S+=Math.abs(L-d),N+=Math.abs(L-f)),g<p||g===p&&S<k?(a=!0,h=!0,s[i].column=d):(y<p||y===p&&N<k)&&(a=!0,h=!0,s[i].column=f)}return this.Wa(t,s),this.kw(),a}mL(t,e){let i=0,s=this.ja(t),n=this.ie[t],o=this.fF(t,e),r=new Int16Array(o),a=!1,h=!0;for(;h;)for(h=!1,i=0;i<n;i++){let l=s[i].column,u=this.nodeMinColumnSpace(s[i],!0),c=this.nodeMinColumnSpace(s[i],!1),d=0,f=0,p=0,g=0,y=0;r[i]===-1?i===0&&i===n-1?d=l:i===0?(f=s[i+1].column,f-l===c+this.nodeMinColumnSpace(s[i+1],!0)?d=l-1:d=l):i===n-1?(p=s[i-1].column,l-p===u+this.nodeMinColumnSpace(s[i-1],!1)?d=l+1:d=l):(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+u+1,f=s[i+1].column,g=f-this.nodeMinColumnSpace(s[i+1],!0)-c-1,d=(y+g)/2|0):i===0&&i===n-1?d=r[i]:i===0?(f=s[i+1].column,g=f-this.nodeMinColumnSpace(s[i+1],!0)-c-1,d=Math.min(r[i],g)):i===n-1?(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+u+1,d=Math.max(r[i],y)):(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+u+1,f=s[i+1].column,g=f-this.nodeMinColumnSpace(s[i+1],!0)-c-1,y<r[i]&&r[i]<g?d=r[i]:y>=r[i]?d=y:g<=r[i]&&(d=g)),d!==l&&(a=!0,h=!0,s[i].column=d)}return this.Wa(t,s),this.kw(),a}K3(){for(let t=0;t<=this.zt;t++)for(;this.H3(t,1););this.kw()}H3(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}q3(){this.K3();for(let t=0;t<this.zt;t++)for(;this.j3(t,1););this.kw()}j3(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._;s++)n[s]=!1,o[s]=!1;let r=this.network.vertexes.iterator;for(;r.next();){let l=r.value,u=l.column-this.nodeMinColumnSpace(l,!0),c=l.column+this.nodeMinColumnSpace(l,!1);u<=t&&c>=t&&(n[l.layer]=!0),u<=i&&c>=i&&(o[l.layer]=!0)}let a=!0,h=!1;for(s=0;s<=this._;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}PF(t){this.q3();let e=0,i,s=0,n=0,o=0;if(t>0)for(e=0;e<=this.zt;e++)for(i=this.ei(),s=this.Jk(!0),n=s+1;s<n;)n=s,this.SF(e,1),o=this.Jk(!0),o>s?this.ns(i):o<s&&(s=o,i=this.ei());if(t<0)for(e=this.zt;e>=0;e--)for(i=this.ei(),s=this.Jk(!0),n=s+1;s<n;)n=s,this.SF(e,-1),o=this.Jk(!0),o>s?this.ns(i):o<s&&(s=o,i=this.ei());this.kw()}SF(t,e){this.cn=0;let i=this.network.vertexes.iterator;for(;i.next();){let u=i.value;u.component=-1}if(e>0)for(i.reset();i.next();){let u=i.value;u.column-this.nodeMinColumnSpace(u,!0)<=t&&(u.component=this.cn)}if(e<0)for(i.reset();i.next();){let u=i.value;u.column+this.nodeMinColumnSpace(u,!1)>=t&&(u.component=this.cn)}for(this.cn++,i.reset();i.next();){let u=i.value;u.component===-1&&(this.dL(u,this.cn,-1,!0,!0),this.cn++)}let s=0,n=[];for(s=0;s<this.cn*this.cn;s++)n[s]=!1;let o=[];for(s=0;s<(this._+1)*(this.zt+1);s++)o[s]=-1;for(i.reset();i.next();){let u=i.value,c=u.layer,d=Math.max(0,u.column-this.nodeMinColumnSpace(u,!0)),f=Math.min(this.zt,u.column+this.nodeMinColumnSpace(u,!1));for(let p=d;p<=f;p++)o[c*(this.zt+1)+p]=u.component}for(let u=0;u<=this._;u++){if(e>0)for(let c=0;c<this.zt;c++)o[u*(this.zt+1)+c]!==-1&&o[u*(this.zt+1)+c+1]!==-1&&o[u*(this.zt+1)+c]!==o[u*(this.zt+1)+c+1]&&(n[o[u*(this.zt+1)+c]*this.cn+o[u*(this.zt+1)+c+1]]=!0);if(e<0)for(let c=this.zt;c>0;c--)o[u*(this.zt+1)+c]!==-1&&o[u*(this.zt+1)+c-1]!==-1&&o[u*(this.zt+1)+c]!==o[u*(this.zt+1)+c-1]&&(n[o[u*(this.zt+1)+c]*this.cn+o[u*(this.zt+1)+c-1]]=!0)}let r=[];for(s=0;s<this.cn;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.cn;s++)n[h*this.cn+s]&&a.splice(0,0,s);let l=!1;if(e>0)for(i.reset();i.next();){let u=i.value;r[u.component]&&(u.column-=1,l=!0)}if(e<0)for(i.reset();i.next();){let u=i.value;r[u.component]&&(u.column+=1,l=!0)}return l}G3(){let t=m.st(),e=this.mu.length;for(let d=0;d<=e;d++)t[d]=[];let i=this.network.vertexes.iterator;for(;i.next();){let d=i.value,f=e-d.layer,p=t[f];p[d.index]=d}let s=new V;this.W3(t,s);let n=null,o=null,r=null,a=null,h=(this.Bn&1)!==0,l=(this.Bn&2)!==0,u=(this.Bn&4)!==0,c=(this.Bn&8)!==0;h&&(this.rl(t,s,!0),n=this._k(t,!0,!1)),t.reverse(),u&&(this.rl(t,s,!1),r=this._k(t,!1,!1));for(let d of t)d.reverse();c&&(this.rl(t,s,!1),a=this._k(t,!1,!0)),t.reverse(),l&&(this.rl(t,s,!0),o=this._k(t,!0,!0)),m.Z(t),this.J3(n,o,r,a),this.network.vertexes.each(d=>{let f=d,p=m.st();h&&p.push(n.get(f)),l&&p.push(o.get(f)),u&&p.push(r.get(f)),c&&p.push(a.get(f)),p.sort((w,k)=>w-k);let g=p.length,y=Math.floor((g-1)/2),b=Math.ceil((g-1)/2),v=(p[y]+p[b])/2;m.Z(p),f.mi=v})}W3(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],u=this.$3(l);if(h===a.length-1||u){let c=r.length-1;for(u&&(c=l.getProperSourceVertexes()[0].index);o<=h;){let d=a[o].getProperSourceEdges();for(let f of d){let p=f.fromVertex.index;(p<n||p>c)&&e.add(f)}o++}n=c}}}}$3(t){if(t.node===null){let e=t.getProperSourceVertexes();if(e.length>0)return e[0].node===null}return!1}rl(t,e,i){this.Z3(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,u)=>l.Ja-u.Ja);let h=(a-1)/2;for(let l=Math.floor(h),u=Math.ceil(h);l<=u;l++)if(o.zn===o){let c=r[l],d;i?d=c.getDestinationEdge(o):d=o.getDestinationEdge(c),!e.has(d)&&n<c.Ja&&(c.zn=o,o.pc=c.pc,o.zn=c.pc,n=c.Ja)}}}}}Z3(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.pc=n,n.zn=n,n.MF=e,n.Ja=s}}}_k(t,e,i){let s=this.P===90||this.P===270;for(let o of t)for(let r of o)r.os=r,r.yu=1/0,r.mi=NaN,r.Xn=0;this.Q3(t,e,i);for(let o of t)for(let r of o)r.pc===r&&this.NF(r,t);for(let o=0;o<t.length;o++){if(t[o].length<=0)continue;let r=t[o][0];if(r.os===r){r.os.yu===1/0&&(r.os.yu=0);let a=o,h=0,l;do{for(l=t[a][h];l.zn!==l.pc;)if(l=l.zn,a++,l.Ja>0){let u=this.CF(l,t),c=s?u.width:u.height,d=l.os.yu+l.mi+l.Xn-(u.mi+u.Xn+c+this.columnSpacing);u.os.yu=Math.min(u.os.yu,d)}h=l.Ja+1}while(a<t.length&&h<t[a].length&&l.os===t[a][h].os)}}let n=new Mt;for(let o of t)for(let r of o){r.mi=r.mi+r.os.yu+r.Xn;let a=s?r.width:r.height;n.set(r,i?-r.mi-a:r.mi)}return n}Q3(t,e,i){let s=this.P===90||this.P===270;for(let n of t)for(let o of n)if(o.pc===o){let r=0,a=o;for(;a.zn!==o;){let h=a.zn,l=s?a.width:a.height,u=s?h.width:h.height,c,d,f,p;e?(f=a.getDestinationEdge(h),c=f.portFromPos,d=f.portToPos,f.link!==null&&(a.node&&a.node!==f.link.fromNode&&(c=s?a.focusX:a.focusY),h.node&&h.node!==f.link.toNode&&(d=s?h.focusX:h.focusY)),i?p=a.Xn+(l-c)-(u-d):p=a.Xn+c-d):(f=h.getDestinationEdge(a),c=f.portToPos,d=f.portFromPos,f.link!==null&&(a.node&&a.node!==f.link.toNode&&(c=s?a.focusX:a.focusY),h.node&&h.node!==f.link.fromNode&&(d=s?h.focusX:h.focusY)),i?p=a.Xn+(l-c)-(u-d):p=a.Xn+c-d),h.Xn=p,r=Math.min(r,p),a=a.zn}a=o;do a.Xn=a.Xn-r,a=a.zn;while(a!==o)}}NF(t,e){if(!isNaN(t.mi))return;t.mi=0;let i=t;do{if(i.Ja>0){let s=this.CF(i,e),n=s.pc;this.NF(n,e),t.os===t&&(t.os=n.os);let o=this.P===90||this.P===270?s.width:s.height;if(t.os===n.os){let r=n.mi+s.Xn+o-i.Xn+this.columnSpacing;t.mi=Math.max(t.mi,r)}}i=i.zn}while(i!==t);for(;i.zn!==t;)i=i.zn,i.mi=t.mi,i.os=t.os}CF(t,e){let i=t.MF,s=t.Ja;return s<1&&m.o("Could not determine previous vertex in layer"),e[i][s-1]}J3(...t){let e=-1,i=m.st(),s=m.st(),n=1/0;for(let o=0;o<4;o++){if(!t[o])continue;let r=this._3(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)})}m.Z(i),m.Z(s)}_3(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.P===90||this.P===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.xw(),this.commitNodes(),this.pL(),this.isRouting&&this.commitLinks()}xw(){if(!this.setsPortSpots)return;let t=this.Zk(!0),e=this.Zk(!1),i=this.network.edges.iterator;for(;i.next();){let s=i.value.link;s!==null&&(s.fromSpot=t,s.toSpot=e)}}Zk(t){return this.P===270?t?T.MiddleTop:T.MiddleBottom:this.P===90?t?T.MiddleBottom:T.MiddleTop:this.P===180?t?T.MiddleLeft:T.MiddleRight:t?T.MiddleRight:T.MiddleLeft}commitNodes(){this.Bs.length!==this._+1&&(this.Bs=new Float32Array(this._+1)),this.ms.length!==this._+1&&(this.ms=new Float32Array(this._+1)),this.ps.length!==this._+1&&(this.ps=new Float32Array(this._+1)),this.Rt.length!==this._+1&&(this.Rt=new Float32Array(this._+1));for(let f=0;f<=this._;f++)this.Bs[f]=0,this.ms[f]=0,this.ps[f]=0,this.Rt[f]=0;let t=this.network.vertexes.iterator;for(;t.next();){let f=t.value,p=f.layer;this.Bs[p]=Math.max(this.Bs[p],this.nodeMinLayerSpace(f,!0)),this.ms[p]=Math.max(this.ms[p],this.nodeMinLayerSpace(f,!1))}let e=0,i=this.Us;for(let f=0;f<=this._;f++){let p=i;this.Bs[f]+this.ms[f]<=0&&(p=0),f>0&&(e+=p/2),this.P===90||this.P===0?(e+=this.ms[f],this.ps[f]=e,e+=this.Bs[f]):(e+=this.Bs[f],this.ps[f]=e,e+=this.ms[f]),f<this._&&(e+=p/2),this.Rt[f]=e}let s=e,n=this.arrangementOrigin;for(let f=0;f<=this._;f++)this.P===270?this.ps[f]=n.y+this.ps[f]:this.P===90?(this.ps[f]=n.y+s-this.ps[f],this.Rt[f]=s-this.Rt[f]):this.P===180?this.ps[f]=n.x+this.ps[f]:(this.ps[f]=n.x+s-this.ps[f],this.Rt[f]=s-this.Rt[f]);let o=this.Bn!==0;t.reset();let r=this.P===270||this.P===90,a=1/0,h=1/0,l=1/0,u=-1/0;for(;t.next();){let f=t.value,p=f.layer,g=f.column|0,y=0,b=0;r?(y=n.x+this.ti*g,b=this.ps[p]):(y=this.ps[p],b=n.y+this.ti*g),f.centerX=y,f.centerY=b,o&&isFinite(f.mi)&&(r?f.node?f.x=n.x+f.mi:f.centerX=n.x+f.mi:f.node?f.y=n.y+f.mi:f.centerY=n.y+f.mi),a=Math.min(f.x,a),h=Math.min(f.y,h),r?(l=a,u=Math.max(u,f.bounds.right)):(l=h,u=Math.max(u,f.bounds.bottom))}this.uL=u-l;let c=n.x-a,d=n.y-h;for(this.ar=new P(o&&r?0:c,o&&!r?0:d),t.reset();t.next();){let f=t.value;f.x+=c,f.y+=d,f.commit()}}pL(){let t=0,e=this.Us;for(let n=0;n<=this._;n++)t+=this.Bs[n],t+=this.ms[n];t+=this._*e;let i=[],s=this.Bn!==0?this.uL:this.ti*this.zt;for(let n=this.maxLayer;n>=0;n--)this.P===270?n===0?i.push(new I(0,0,s,Math.abs(this.Rt[0]))):i.push(new I(0,this.Rt[n-1],s,Math.abs(this.Rt[n-1]-this.Rt[n]))):this.P===90?n===0?i.push(new I(0,this.Rt[0],s,Math.abs(this.Rt[0]-t))):i.push(new I(0,this.Rt[n],s,Math.abs(this.Rt[n-1]-this.Rt[n]))):this.P===180?n===0?i.push(new I(0,0,Math.abs(this.Rt[0]),s)):i.push(new I(this.Rt[n-1],0,Math.abs(this.Rt[n-1]-this.Rt[n]),s)):n===0?i.push(new I(this.Rt[0],0,Math.abs(this.Rt[0]-t),s)):i.push(new I(this.Rt[n],0,Math.abs(this.Rt[n-1]-this.Rt[n]),s));this.commitLayers(i,this.ar)}commitLayers(t,e){}commitLinks(){let t=this.network.edges.iterator,e=null;for(;t.next();)e=t.value.link,e!==null&&e.pointsCount>0&&(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 A=n.findVisibleNode();A!==null&&A!==n&&(n=A,r=A.port)}if(o!==null){let A=o.findVisibleNode();A!==null&&A!==o&&(o=A,a=A.port)}let h=e.computeSpot(!0,r),l=e.computeSpot(!1,a),u=i.fromVertex,c=i.toVertex;if(i.valid){if(e.curve===9&&e.pointsCount===4)if(u.column===c.column&&this.alignOption===0){let A=e.getLinkPoint(n,r,h,!0,!1,o,a),F=e.getLinkPoint(o,a,l,!1,!1,n,r);A.isReal()||A.set(n.actualBounds.center),F.isReal()||F.set(o.actualBounds.center),e.clearPoints(),e.addPointAt(A.x,A.y),e.addPointAt((2*A.x+F.x)/3,(2*A.y+F.y)/3),e.addPointAt((A.x+2*F.x)/3,(A.y+2*F.y)/3),e.addPointAt(F.x,F.y)}else{let A=!1,F=!1;if(r!==null&&e.wl(h)&&(A=!0),a!==null&&e.wl(l)&&(F=!0),A||F){let O=null;A&&(O=e.getLinkPointFromPoint(n,r,r.getDocumentPoint(T.Center),e.getPoint(3),!0),O.isReal()||O.set(n.actualBounds.center),e.setPointAt(0,O.x,O.y));let E=null;if(F&&(E=e.getLinkPointFromPoint(o,a,a.getDocumentPoint(T.Center),e.getPoint(0),!1),E.isReal()||E.set(o.actualBounds.center),e.setPointAt(3,E.x,E.y)),O){let B=e.getPoint(2);e.setPointAt(1,(O.x*2+B.x)/3,(O.y*2+B.y)/3)}if(E){let B=e.getPoint(1);e.setPointAt(2,(E.x*2+B.x)/3,(E.y*2+B.y)/3)}}}e.commitRoute();continue}if(u.layer===c.layer){e.commitRoute();continue}let d=!1,f=!1,p=this.Us,g=0,y=e.firstPickIndex+1;if(e.isOrthogonal)f=!0,g=e.pointsCount,g>4&&e.points.removeRange(2,g-3);else if(e.curve===9)d=!0,g=e.pointsCount,g>4&&e.points.removeRange(2,g-3),g===4&&(y=2);else{g=e.pointsCount;let A=h===T.None,F=l===T.None;g>2&&A&&F?e.points.removeRange(1,g-2):g>3&&A&&!F?e.points.removeRange(1,g-3):g>3&&!A&&F?e.points.removeRange(2,g-2):g>4&&!A&&!F&&e.points.removeRange(2,g-3)}let b,v,w=0,k=0,S=0,N=0,D=0,L=0,M=0;if(i.rev){let A=0;for(;c!==null&&u!==c;){b=null,v=null;let F=c.sourceEdges.iterator;for(;F.next();){let O=F.value;if(O.link===i.link&&(b=O.fromVertex,v=O.toVertex,b.node===null))break}if(b===null)break;if(b!==u)if(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=b.centerX,N=b.centerY,f)this.P===180||this.P===0?y===e.firstPickIndex+1?(e.insertPointAt(y++,w,k),e.insertPointAt(y++,w,N)):(v!==null?v.centerY:k)!==N&&(D=this.Rt[b.layer-1]+this.ar.x,e.insertPointAt(y++,D,k),e.insertPointAt(y++,D,N)):y===e.firstPickIndex+1?(e.insertPointAt(y++,w,k),e.insertPointAt(y++,S,k)):(v!==null?v.centerX:w)!==S&&(D=this.Rt[b.layer-1]+this.ar.y,e.insertPointAt(y++,w,D),e.insertPointAt(y++,S,D));else if(y===e.firstPickIndex+1)if(L=Math.max(10,this.Bs[c.layer]),M=Math.max(10,this.ms[c.layer]),d)this.P===180?S<=c.bounds.x?(A=c.bounds.x,e.insertPointAt(y++,A-L,N),e.insertPointAt(y++,A,N),e.insertPointAt(y++,A+M,N)):(e.insertPointAt(y++,S-L,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S+M,N)):this.P===90?N>=c.bounds.bottom?(A=c.bounds.y+c.bounds.height,e.insertPointAt(y++,S,A+M),e.insertPointAt(y++,S,A),e.insertPointAt(y++,S,A-L)):(e.insertPointAt(y++,S,N+M),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N-L)):this.P===270?N<=c.bounds.y?(A=c.bounds.y,e.insertPointAt(y++,S,A-L),e.insertPointAt(y++,S,A),e.insertPointAt(y++,S,A+M)):(e.insertPointAt(y++,S,N-L),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N+M)):this.P===0&&(S>=c.bounds.right?(A=c.bounds.x+c.bounds.width,e.insertPointAt(y++,A+M,N),e.insertPointAt(y++,A,N),e.insertPointAt(y++,A-L,N)):(e.insertPointAt(y++,S+M,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S-L,N)));else{e.insertPointAt(y++,w,k);let O=0;this.P===180||this.P===0?((this.P===180?S>=c.bounds.right:S<=c.bounds.x)&&(O=(this.P===0?-L:M)/2),e.insertPointAt(y++,w+O,N)):((this.P===270?N>=c.bounds.bottom:N<=c.bounds.y)&&(O=(this.P===90?-L:M)/2),e.insertPointAt(y++,S,k+O)),e.insertPointAt(y++,S,N)}else L=Math.max(10,this.Bs[b.layer]),M=Math.max(10,this.ms[b.layer]),d?this.P===180?(e.insertPointAt(y++,S-L-Math.max(10,p),N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S+M+p,N)):this.P===90?(e.insertPointAt(y++,S,N+M+Math.max(10,p)),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N-L-p)):this.P===270?(e.insertPointAt(y++,S,N-L-Math.max(10,p)),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N+M+p)):(e.insertPointAt(y++,S+M+Math.max(10,p),N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S-L-p,N)):(this.P===180||this.P===90||this.P,e.insertPointAt(y++,S,N));c=b}if(a===null||h!==T.None||f)if(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=e.getPoint(y).x,N=e.getPoint(y).y,f){let F=this.ms[u.layer],O=0;this.P===180||this.P===0?(O=k,O>=u.bounds.y&&O<=u.bounds.bottom&&(this.P===180?S>=u.bounds.x:S<=u.bounds.right)&&(A=u.centerX+(this.P===180?-F:F),O<u.bounds.y+u.bounds.height/2?O=u.bounds.y-this.ti/2:O=u.bounds.bottom+this.ti/2,e.insertPointAt(y++,A,k),e.insertPointAt(y++,A,O)),e.insertPointAt(y++,S,O),e.insertPointAt(y++,S,N)):(O=w,O>=u.bounds.x&&O<=u.bounds.right&&(this.P===270?N>=u.bounds.y:N<=u.bounds.bottom)&&(A=u.centerY+(this.P===270?-F:F),O<u.bounds.x+u.bounds.width/2?O=u.bounds.x-this.ti/2:O=u.bounds.right+this.ti/2,e.insertPointAt(y++,w,A),e.insertPointAt(y++,O,A)),e.insertPointAt(y++,O,N),e.insertPointAt(y++,S,N))}else if(d)L=Math.max(10,this.Bs[u.layer]),M=Math.max(10,this.ms[u.layer]),this.P===180&&S>=u.bounds.x?(A=u.bounds.x+u.bounds.width,e.setPointAt(y-2,A,k),e.setPointAt(y-1,A+M,k)):this.P===90&&N<=u.bounds.bottom?(A=u.bounds.y,e.setPointAt(y-2,w,A),e.setPointAt(y-1,w,A-L)):this.P===270&&N>=u.bounds.y?(A=u.bounds.y+u.bounds.height,e.setPointAt(y-2,w,A),e.setPointAt(y-1,w,A+M)):this.P===0&&S<=u.bounds.right&&(A=u.bounds.x,e.setPointAt(y-2,A,k),e.setPointAt(y-1,A-L,k));else{L=Math.max(10,this.Bs[u.layer]),M=Math.max(10,this.ms[u.layer]);let F=0;this.P===180||this.P===0?((this.P===180?S<=u.bounds.x:S>=u.bounds.right)&&(F=(this.P===0?M:-L)/2),e.insertPointAt(y++,S+F,k)):((this.P===270?N<=u.bounds.y:N>=u.bounds.bottom)&&(F=(this.P===90?M:-L)/2),e.insertPointAt(y++,w,N+F)),e.insertPointAt(y++,S,N)}}else{for(;u!==null&&u!==c;){b=null,v=null;let A=u.destinationEdges.iterator;for(;A.next();){let F=A.value;if(F.link===i.link&&(b=F.toVertex,v=F.fromVertex,v.node!==null&&(v=null),b.node===null))break}if(b===null)break;b!==c&&(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=b.centerX,N=b.centerY,f?this.P===180||this.P===0?(v!==null?v.centerY:k)!==N&&(D=this.Rt[b.layer]+this.ar.x,y===e.firstPickIndex+1&&(this.P===0?D=Math.max(D,w):D=Math.min(D,w)),e.insertPointAt(y++,D,k),e.insertPointAt(y++,D,N)):(v!==null?v.centerX:w)!==S&&(D=this.Rt[b.layer]+this.ar.y,y===e.firstPickIndex+1&&(this.P===90?D=Math.max(D,k):D=Math.min(D,k)),e.insertPointAt(y++,w,D),e.insertPointAt(y++,S,D)):(L=Math.max(10,this.Bs[b.layer]),M=Math.max(10,this.ms[b.layer]),d?this.P===180?(e.insertPointAt(y++,S+M+Math.max(10,p),N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S-L-p,N)):this.P===90?(e.insertPointAt(y++,S,N-L-Math.max(10,p)),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N+M+p)):this.P===270?(e.insertPointAt(y++,S,N+M+Math.max(10,p)),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N-L-p)):(e.insertPointAt(y++,S-L-Math.max(10,p),N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S+M+p,N)):this.P===180?(e.insertPointAt(y++,S+M,N),e.insertPointAt(y++,S-L,N)):this.P===90?(e.insertPointAt(y++,S,N-L),e.insertPointAt(y++,S,N+M)):this.P===270?(e.insertPointAt(y++,S,N+M),e.insertPointAt(y++,S,N-L)):(e.insertPointAt(y++,S-L,N),e.insertPointAt(y++,S+M,N)))),u=b}f&&(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=e.getPoint(y).x,N=e.getPoint(y).y,this.P===180||this.P===0?k!==N&&(this.P===0?D=Math.min(Math.max((S+w)/2,this.Rt[c.layer]+this.ar.x),S):D=Math.max(Math.min((S+w)/2,this.Rt[c.layer]+this.ar.x),S),e.insertPointAt(y++,D,k),e.insertPointAt(y++,D,N)):w!==S&&(this.P===90?D=Math.min(Math.max((N+k)/2,this.Rt[c.layer]+this.ar.y),N):D=Math.max(Math.min((N+k)/2,this.Rt[c.layer]+this.ar.y),N),e.insertPointAt(y++,w,D),e.insertPointAt(y++,S,D)))}if(s!==null&&d&&e.pointsCount>=4){if(n!==null&&r!==null&&s.wl(h)){let A=r.getDocumentPoint(T.Center);A.isReal()||A.setTo(n.actualBounds.centerX,n.actualBounds.centerY);let F=e.getPoint(3),O=e.getPoint(2);this.direction===90||this.direction===270?(e.setPointAt(1,F.x,(O.y+F.y)/2),e.setPointAt(2,F.x,(O.y+F.y)/2)):(e.setPointAt(1,(O.x+F.x)/2,F.y),e.setPointAt(2,(O.x+F.x)/2,F.y));let E=e.getLinkPointFromPoint(n,r,A,e.getPoint(1),!0);e.setPointAt(0,E.x,E.y)}if(o!==null&&a!==null&&s.wl(l)){let A=a.getDocumentPoint(T.Center);A.isReal()||A.setTo(o.actualBounds.centerX,o.actualBounds.centerY);let F=e.getPoint(e.pointsCount-4),O=e.getLinkPointFromPoint(o,a,A,F,!1),E=e.getPoint(e.pointsCount-3);this.direction===90||this.direction===270?(e.setPointAt(e.pointsCount-2,F.x,(E.y+O.y)/2),e.setPointAt(e.pointsCount-3,F.x,(E.y+O.y)/2)):(e.setPointAt(e.pointsCount-2,(E.x+O.x)/2,F.y),e.setPointAt(e.pointsCount-3,(E.x+O.x)/2,F.y));let B=e.getLinkPointFromPoint(o,a,A,e.getPoint(e.pointsCount-2),!1);e.setPointAt(e.pointsCount-1,B.x,B.y)}}e.commitRoute(),i.commit()}}P3(){this.bw=-1,this.Hg=0,this.Vs=0,this.mu=null;for(let t=0;t<this.Vn.length;t++)this.Vn[t]=null}ja(t){let e,i=this.ie[t];if(i>=this.Vn.length){let n=[];for(let o=0;o<this.Vn.length;o++)n[o]=this.Vn[o];this.Vn=n}this.Vn[i]===void 0||this.Vn[i]===null?e=[]:(e=this.Vn[i],this.Vn[i]=null);let s=this.mu[t];for(let n=0;n<s.length;n++){let o=s[n];e[o.index]=o}return e}Wa(t,e){this.Vn[this.ie[t]]=e}get layerSpacing(){return this.Us}set layerSpacing(t){this.Us!==t&&(m.s(t,"number",Ae,"layerSpacing"),t>=0&&(this.Us=t,this.p()))}get columnSpacing(){return this.ti}set columnSpacing(t){this.ti!==t&&(m.s(t,"number",Ae,"columnSpacing"),t>0&&(this.ti=t,this.p()))}get direction(){return this.P}set direction(t){this.P!==t&&(m.s(t,"number",Ae,"direction"),t===0||t===90||t===180||t===270?(this.P=t,this.p()):m.o("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}get cycleRemoveOption(){return this.cu}set cycleRemoveOption(t){this.cu!==t&&(t===1||t===0||t===2)&&(this.cu=t,this.p())}get layeringOption(){return this.fu}set layeringOption(t){this.fu!==t&&(t===10||t===11||t===12)&&(this.fu=t,this.p())}get initializeOption(){return this.uu}set initializeOption(t){this.uu!==t&&(t===20||t===21||t===22)&&(this.uu=t,this.p())}get iterations(){return this.mc}set iterations(t){this.mc!==t&&t>=0&&(this.mc=t,this.p())}get aggressiveOption(){return this.du}set aggressiveOption(t){this.du!==t&&(t===30||t===31||t===32)&&(this.du=t,this.p())}get packOption(){return this.lr}set packOption(t){this.lr!==t&&(m.s(t,"number",Ae,"packOption"),t>=0&&t<8&&(this.lr=t,this.p()))}get packIterations(){return this.gu}set packIterations(t){this.gu=t}get alignOption(){return this.Bn}set alignOption(t){this.Bn!==t&&(m.s(t,"number",Ae,"align"),t>=0&&t<16&&(this.Bn=t,this.p()))}get centered(){return this.qa}set centered(t){this.centered!==t&&(m.s(t,"boolean",Ae,"centered"),this.qa=t,this.p())}get setsPortSpots(){return this.Un}set setsPortSpots(t){this.Un!==t&&(m.s(t,"boolean",Ae,"setsPortSpots"),this.Un=t,this.p())}get maxLayer(){return this._}get maxIndex(){return this.bw}get maxColumn(){return this.zt}get minIndexLayer(){return this.Hg}get maxIndexLayer(){return this.Vs}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 tn extends Ee{constructor(t){super(t)}createVertex(){let t=new si(this);return t.centered=this.layout.centered,t}createEdge(){return new Se(this)}}class si extends Ie{ul;pa;Tt;tP;eP;qa;ii;pu;Zn;$k;jk;Wk;pc;zn;MF;Ja;os;yu;mi;Xn;Mw=null;Nw=null;Cw=null;Lw=null;constructor(t){super(t),this.ul=-1,this.pa=-1,this.Tt=-1,this.tP=NaN,this.eP=null,this.qa=!0,this.ii=!1,this.pu=NaN,this.Zn=NaN,this.$k=0,this.jk=null,this.Wk=null}static LF(t,e){return t.index-e.index}getProperSourceEdges(){if(!this.Cw){let t=[];for(let e of this.ko){let i=e;i.valid&&t.push(i)}this.Cw=t}return this.Cw}getProperDestinationEdges(){if(!this.Lw){let t=[];for(let e of this.sr){let i=e;i.valid&&t.push(i)}this.Lw=t}return this.Lw}getDestinationEdge(t){let e=this.getProperDestinationEdges();for(let i of e)if(i.toVertex===t)return i;m.o("Unable to find destination edge to given vertex")}getProperSourceVertexes(){if(!this.Mw){let t=[];for(let e of this.ko){let i=e;!i.valid||i.fromVertex.layer<=i.toVertex.layer||t.push(i.fromVertex)}t.sort(si.LF),this.Mw=t}return this.Mw}getProperDestinationVertexes(){if(!this.Nw){let t=[];for(let e of this.sr){let i=e;!i.valid||i.fromVertex.layer<=i.toVertex.layer||t.push(i.toVertex)}t.sort(si.LF),this.Nw=t}return this.Nw}addSourceEdge(t){super.addSourceEdge(t),this.Mw=null,this.Cw=null}deleteSourceEdge(t){super.deleteSourceEdge(t),this.Mw=null,this.Cw=null}addDestinationEdge(t){super.addDestinationEdge(t),this.Nw=null,this.Lw=null}deleteDestinationEdge(t){super.deleteDestinationEdge(t),this.Nw=null,this.Lw=null}commit(){if(this.centered)super.commit();else{let t=this.node;if(t!==null){let e=this.network.layout;if(!e)return;e.direction===180||e.direction===270?t.moveTo(this.bounds.right-t.actualBounds.width,this.bounds.bottom-t.actualBounds.height):t.moveTo(this.bounds.x,this.bounds.y)}}}get layer(){return this.ul}set layer(t){this.ul=t}get column(){return this.pa}set column(t){this.pa=t}get index(){return this.Tt}set index(t){this.Tt=t}get component(){return this.tP}set component(t){this.tP!==t&&(m.s(t,"number",si,"component"),this.tP=t)}get near(){return this.eP}set near(t){this.eP!==t&&(this.eP=t)}get centered(){return this.qa}set centered(t){this.qa=t}}class Se extends ei{ii;iP;sP;nP;oP;rP;lP;constructor(t){super(t),this.ii=!1,this.iP=!1,this.sP=!1,this.nP=NaN,this.oP=NaN,this.rP=0,this.lP=0}get fromVertex(){return this.is}set fromVertex(t){this.is!==t&&(this.is=t)}get toVertex(){return this.ss}set toVertex(t){this.ss!==t&&(this.ss=t)}get valid(){return this.ii}set valid(t){this.ii!==t&&(m.s(t,"boolean",Se,"valid"),this.ii=t)}get rev(){return this.iP}set rev(t){this.iP!==t&&(m.s(t,"boolean",Se,"rev"),this.iP=t)}get forest(){return this.sP}set forest(t){this.sP!==t&&(m.s(t,"boolean",Se,"forest"),this.sP=t)}get portFromPos(){return this.nP}set portFromPos(t){this.nP!==t&&(m.s(t,"number",Se,"portFromPos"),this.nP=t)}get portToPos(){return this.oP}set portToPos(t){this.oP!==t&&(m.s(t,"number",Se,"portToPos"),this.oP=t)}get portFromColOffset(){return this.rP}set portFromColOffset(t){this.rP!==t&&(m.s(t,"number",Se,"portFromColOffset"),this.rP=t)}get portToColOffset(){return this.lP}set portToColOffset(t){this.lP!==t&&(m.s(t,"number",Se,"portToColOffset"),this.lP=t)}}var hs=(x=>(x[x.Default=0]="Default",x[x.Destination=1]="Destination",x[x.Source=2]="Source",x))(hs||{}),ls=(x=>(x[x.Forwards=10]="Forwards",x[x.Reverse=11]="Reverse",x[x.Ascending=12]="Ascending",x[x.Descending=13]="Descending",x))(ls||{}),us=(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))(us||{}),cs=(x=>(x[x.None=30]="None",x[x.Block=31]="Block",x))(cs||{}),ds=(x=>(x[x.Layered=40]="Layered",x[x.LastParents=41]="LastParents",x[x.Alternating=42]="Alternating",x[x.RootOnly=43]="RootOnly",x))(ds||{}),fs=(x=>(x[x.Vertical=50]="Vertical",x[x.Horizontal=51]="Horizontal",x[x.FixedRoots=52]="FixedRoots",x))(fs||{}),en=(x=>(x[x.Individual=60]="Individual",x[x.Siblings=61]="Siblings",x[x.Uniform=62]="Uniform",x))(en||{});class Vt extends _t{Ie;Fe;wu;Jg;yL;zi;He;Es;V;B;aP;ws;constructor(t){super(),this.Ie=new V,this.Fe=0,this.ws=1,this.wu=40,this.Jg=60,this.yL=[],this.zi=!0,this.He=50,this.Es=new st(10,10).k();let e=new gs(this);this.V=new Rt(e),this.B=new Rt(e),this.aP=[],t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Fe=this.Fe,t.wu=this.wu,t.Jg=this.Jg,t.zi=this.zi,t.He=this.He,t.Es.h(this.Es),t.V.copyInheritedPropertiesFrom(this.V),t.B.copyInheritedPropertiesFrom(this.B)}fe(t){t in us?this.alignment=t:t in fs?this.arrangement=t:t in cs?this.compaction=t:t in hs?this.path=t:t in ls?this.sorting=t:t in ds?this.treeStyle=t:super.fe(t)}createNetwork(){return new gs(this)}makeNetwork(t){let e=this.createNetwork(),i=s=>{if(s instanceof $)return!s.isLinkLabel&&s.category!=="Comment";if(s instanceof j){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 Y?(e.addParts(t.nodes,!0,i),e.addParts(t.links,!0,i)):t instanceof ht?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 Y&&(e=t),this.path===0&&e!==null?this.ws=e.isTreePathToChildren?1:2:this.ws=this.path===0?1:this.path,this.network.vertexes.count>0&&(this.nU(),this.oU(),this.rU(),this.lU(),this.fL(),this.aU(),this.arrangeTrees(),this.updateParts()),this.network=null,this.Ie=new V,this.isValidLayout=!0}nU(){if(this.network===null)return;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.Ie.count>0){let n=new V,o=this.Ie.iterator;for(;o.next();){let r=o.value;if(r instanceof $){let a=this.network.findVertex(r);a!==null&&n.add(a)}else r instanceof Rt&&n.add(r)}this.Ie=n}this.Ie.count===0&&this.findRoots();let e=this.Ie.copy().iterator;for(;e.next();){let n=e.value;n.initialized||(n.initialized=!0,this.wL(n))}let i=this.network.vertexes,s=null;for(;s=this.hU(i),s.count>0;){let n=this.AF(s);n!==null&&(this.Ie.add(n),n.initialized=!0,this.wL(n)),i=s}}hU(t){let e=new V,i=t.iterator;for(;i.next();){let s=i.value;s.initialized||e.add(s)}return e}findRoots(){if(this.network===null)return;let t=this.network.vertexes,e=t.iterator;for(;e.next();){let i=e.value;switch(this.ws){case 1:i.sourceEdges.count===0&&this.Ie.add(i);break;case 2:i.destinationEdges.count===0&&this.Ie.add(i);break;default:m.o("Unhandled path value "+this.ws.toString())}}if(this.Ie.count===0){let i=this.AF(t);i!==null&&this.Ie.add(i)}}AF(t){let e=999999,i=null,s=t.iterator;for(;s.next();){let n=s.value;switch(this.ws){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:m.o("Unhandled path value "+this.ws.toString())}}return i}wL(t){if(t===null)return;switch(this.ws){case 1:if(t.destinationEdges.count>0){let s=new q,n=t.destinationVertexes;for(;n.next();){let o=n.value;this.TF(t,o)&&s.add(o)}s.count>0&&(t.children=s.toArray())}break;case 2:if(t.sourceEdges.count>0){let s=new q,n=t.sourceVertexes;for(;n.next();){let o=n.value;this.TF(t,o)&&s.add(o)}s.count>0&&(t.children=s.toArray())}break;default:m.o("Unhandled path value"+this.ws.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.Ie.delete(n)}for(let s=0;s<i;s++){let n=e[s];this.wL(n)}}TF(t,e){return e.initialized?this.cU(e,t)||e.level>t.level?!1:(this.fU(e.parent,e),!0):!0}cU(t,e){if(e===null)return!1;let i=e.parent;for(;i!==null&&i!==t;)i=i.parent;return i===t}fU(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}}oU(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.DF(e)}}DF(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.DF(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}uU(t){switch(this.wu){default:case 40:return t.parent!==null?t.parent:this.V;case 43:return t.parent===null?this.V:t.parent.parent===null?this.B:t.parent;case 42:return t.parent!==null?t.parent.parent!==null?t.parent.parent:this.B:this.V;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.V}}}initializeTreeVertexValues(t){let e=this.uU(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}rU(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.vF(e)}}vF(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.vF(n)}}assignTreeVertexValues(t){}lU(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.FF(e)}}FF(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.FF(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}}fL(){if(!this.comments||this.network===null)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,u=0,c=0,d=t.commentSpacing;if(t.node!==null){let f=t.node.findNodesConnected();for(;f.next();){let p=f.value;if(p.category!=="Comment"||!p.canLayout())continue;t.comments===null&&(t.comments=[]),t.comments.push(p),p.ensureBounds();let g=p.measuredBounds;r&&!h||!o&&!a&&h||o&&a&&h?(l=Math.max(l,g.width),u+=g.height+Math.abs(c)):(l+=g.width+Math.abs(c),u=Math.max(u,g.height)),c=d}}if(t.comments!==null){r&&!h||!o&&!a&&h||o&&a&&h?(l+=Math.abs(t.commentMargin),u=Math.max(0,u-t.height)):(u+=Math.abs(t.commentMargin),l=Math.max(0,l-t.width));let f=I.z(0,0,t.bounds.width+l,t.bounds.height+u);t.bounds=f,I.i(f)}}isBusAlignment(t){return t===24||t===25||t===26||t===27}Aw(t){return t===24||t===25}xL(t){let e=t.parent;if(e!==null){let i=e.alignment;if(this.isBusAlignment(i))if(this.Aw(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,u=this.xL(t),c=0,d=t.comments,f=d.length,p=P.l();for(let y=0;y<f;y++){let b=d[y],v=b.measuredBounds;if(a&&!l||!r&&!h&&l||r&&h&&l){if(n>135&&!r||h&&u)if(t.commentMargin>=0){p.e(t.bounds.x-t.commentMargin-v.width,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleLeft,k.toSpot=T.MiddleRight}}else{p.e(t.bounds.x+t.focus.x*2-t.commentMargin,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleRight,k.toSpot=T.MiddleLeft}}else if(t.commentMargin>=0){p.e(t.bounds.x+t.focus.x*2+t.commentMargin,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleRight,k.toSpot=T.MiddleLeft}}else{p.e(t.bounds.x+t.commentMargin-v.width,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleLeft,k.toSpot=T.MiddleRight}}t.commentSpacing>=0?c+=v.height+t.commentSpacing:c+=t.commentSpacing-v.height}else{if(n>135&&!r||!h&&u)if(t.commentMargin>=0){p.e(t.bounds.x+c,t.bounds.y-t.commentMargin-v.height),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleTop,k.toSpot=T.MiddleBottom}}else{p.e(t.bounds.x+c,t.bounds.y+t.focus.y*2-t.commentMargin),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleBottom,k.toSpot=T.MiddleTop}}else if(t.commentMargin>=0){p.e(t.bounds.x+c,t.bounds.y+t.focus.y*2+t.commentMargin),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleBottom,k.toSpot=T.MiddleTop}}else{p.e(t.bounds.x+c,t.bounds.y+t.commentMargin-v.height),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleTop,k.toSpot=T.MiddleBottom}}t.commentSpacing>=0?c+=v.width+t.commentSpacing:c+=t.commentSpacing-v.width}}P.i(p);let g=c-t.commentSpacing-(a?e.height:e.width);if(this.ws===1){let y=t.destinationEdges;for(;y.next();){let b=y.value.link;b!==null&&!b.isAvoiding&&(b.fromEndSegmentLength=g>0?g:NaN)}}else{let y=t.sourceEdges;for(;y.next();){let b=y.value.link;b!==null&&!b.isAvoiding&&(b.toEndSegmentLength=g>0?g:NaN)}}}}aU(){if(this.network===null)return;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.yL=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.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&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.RF(t);break;default:case 31:t.alignment===25?this.RF(t):this.dU(t);break}}RF(t){if(t.childrenCount===0){let X=!1,z=0,U=21;t.parent!==null&&(z=t.parent.angle,U=t.parent.alignment,X=this.isBusAlignment(U));let tt=this.xL(t);t.U.e(0,0),t.dt.e(t.width,t.height),t.parent!==null&&t.comments!==null&&((z===180||z===270)&&!X||tt)?z===180&&!X||(z===90||z===270)&&tt?t.at.e(t.width-t.focus.x*2,0):t.at.e(0,t.height-t.focus.y*2):t.at.e(0,0);return}let e=this.orthoAngle(t),i=e===90||e===270,s=0,n=t.children,o=n.length;for(let X=0;X<o;X++){let z=n[X];s=Math.max(s,i?z.dt.width:z.dt.height)}let r=t.alignment,a=r===22,h=r===23,l=this.isBusAlignment(r),u=Math.max(0,t.breadthLimit),c=this.computeLayerSpacing(t),d=t.nodeSpacing,f=this.computeNodeIndent(t),p=a||h?0:f/2,g=t.rowSpacing,y=0;(a||h)&&(y=Math.max(0,t.rowIndent));let b=t.width,v=t.height,w=0,k=0,S=0,N=0,D=0,L=0,M=0,A=0,F=0,O=0;if(l&&!this.Aw(r)&&e>135&&n.reverse(),this.Aw(r))if(o>1)for(let X=0;X<o;X++){let z=n[X],U=z.dt;X%2===0&&X!==o-1?F=Math.max(F,(i?U.width:U.height)+this.computeBusNodeSpacing(z)-d):X%2!==0&&(O=Math.max(O,(i?U.width:U.height)+this.computeBusNodeSpacing(z)-d))}else o===1&&(F=i?n[0].dt.width:n[0].dt.height);if(l)switch(r){case 24:case 25:let X=I.l();e<135?this.OF(t,n,F,O,w,k,X):this.IF(t,n,F,O,w,k,X),F=X.x,w=X.width,k=X.height,I.i(X);break;case 26:for(let z=0;z<o;z++){let U=n[z],tt=U.dt,nt=M===0?0:g;i?(U.U.e(s-tt.width,D+nt),w=Math.max(w,tt.width),k=Math.max(k,D+nt+tt.height),D+=nt+tt.height):(U.U.e(N+nt,s-tt.height),w=Math.max(w,N+nt+tt.width),k=Math.max(k,tt.height),N+=nt+tt.width),M++}break;case 27:for(let z=0;z<o;z++){let U=n[z],tt=U.dt,nt=M===0?0:g;i?(U.U.e(d/2+t.focus.x,D+nt),w=Math.max(w,tt.width),k=Math.max(k,D+nt+tt.height),D+=nt+tt.height):(U.U.e(N+nt,d/2+t.focus.y),w=Math.max(w,N+nt+tt.width),k=Math.max(k,tt.height),N+=nt+tt.width),M++}break}else for(let X=0;X<o;X++){let z=n[X],U=z.dt;if(i){u>0&&M>0&&N+d+U.width>u&&(N<s&&this.yc(t,r,s-N,0,A,X-1),L++,M=0,A=X,S=k,N=0,D=e>135?-k-g:k+g);let tt=M===0?p:d;this.hP(z,0,D),z.U.e(N+tt,D),w=Math.max(w,N+tt+U.width),k=Math.max(k,S+(L===0?0:g)+U.height),N+=tt+U.width}else{u>0&&M>0&&D+d+U.height>u&&(D<s&&this.yc(t,r,0,s-D,A,X-1),L++,M=0,A=X,S=w,D=0,N=e>135?-w-g:w+g);let tt=M===0?p:d;this.hP(z,N,0),z.U.e(N,D+tt),k=Math.max(k,D+tt+U.height),w=Math.max(w,S+(L===0?0:g)+U.width),D+=tt+U.height}M++}L>0&&(i?(k+=Math.max(0,c),N<w&&this.yc(t,r,w-N,0,A,o-1),y>0&&(h||this.xu(t,y,0,0,o-1),w+=y)):(w+=Math.max(0,c),D<k&&this.yc(t,r,0,k-D,A,o-1),y>0&&(h||this.xu(t,0,y,0,o-1),k+=y)));let E=0,B=0;switch(r){case 20:i?E+=w/2-t.focus.x-f/2:B+=k/2-t.focus.y-f/2;break;default:case 21:if(L>0)i?E+=w/2-t.focus.x-f/2:B+=k/2-t.focus.y-f/2;else{let z=o;if(i){let U=n[0].U.x+n[0].at.x,tt=n[z-1].U.x+n[z-1].at.x+n[z-1].focus.x*2;E+=U+(tt-U)/2-t.focus.x-f/2}else{let U=n[0].U.y+n[0].at.y,tt=n[z-1].U.y+n[z-1].at.y+n[z-1].focus.y*2;B+=U+(tt-U)/2-t.focus.y-f/2}}break;case 22:i?(E-=f,w+=f):(B-=f,k+=f);break;case 23:i?(E+=w-t.width+f,w+=f):(B+=k-t.height+f,k+=f);break;case 24:case 25:i?o>1?E+=F+d/2-t.focus.x:E+=n[0].focus.x-t.focus.x+n[0].at.x:o>1?B+=F+d/2-t.focus.y:B+=n[0].focus.y-t.focus.y+n[0].at.y;break;case 26:i?E+=w+d/2-t.focus.x:B+=k+d/2-t.focus.y;break;case 27:break;case 28:let X=this.customAlignment(t,E,B,w,k);E=X[0],B=X[1],w=X[2],k=X[3];break}for(let X=0;X<o;X++){let z=n[X];i?z.U.e(z.U.x+z.at.x-E,z.U.y+(e>135?(l?-k:-z.dt.height)+z.at.y-c:v+c+z.at.y)):z.U.e(z.U.x+(e>135?(l?-w:-z.dt.width)+z.at.x-c:b+c+z.at.x),z.U.y+z.at.y-B)}i?(w=this.bL(t,w,E),E<0&&(E=0),e>135&&(B+=k+c),k=Math.max(Math.max(k,v),k+v+c)):(e>135&&(E+=w+c),w=Math.max(Math.max(w,b),w+b+c),k=this.kL(t,k,B),B<0&&(B=0)),t.at.e(E,B),t.dt.e(w,k)}customAlignment(t,e,i,s,n){return[e,i,s,n]}OF(t,e,i,s,n,o,r){let a=e.length;if(a===0)return r.e(i,0,n,o),r;if(a===1){let y=e[0];return n=y.dt.width,o=y.dt.height,r.e(i,0,n,o),r}let h=t.nodeSpacing,l=t.rowSpacing,u=this.orthoAngle(t)===90,c=0,d=0,f=0;for(let y=0;y<a;y++){if(y%2!==0||a>1&&y===a-1)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;b.U.e(i-(v.width+k),f+w),n=Math.max(n,v.width+k),o=Math.max(o,f+w+v.height),f+=w+v.height}else{let k=this.computeBusNodeSpacing(b)-h;b.U.e(d+w,i-(v.height+k)),o=Math.max(o,v.height+k),n=Math.max(n,d+w+v.width),d+=w+v.width}c++}c=0;let p=d,g=f;u?(d=i+h,f=0):(d=0,f=i+h);for(let y=0;y<a;y++){if(y%2===0)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;b.U.e(d+k,f+w),n=Math.max(n,d+v.width+k),o=Math.max(o,f+w+v.height),f+=w+v.height}else{let k=this.computeBusNodeSpacing(b)-h;b.U.e(d+w,f+k),n=Math.max(n,d+w+v.width),o=Math.max(o,f+v.height+k),d+=w+v.width}c++}if(a>1&&a%2===1){let y=e[a-1],b=y.dt,v=this.computeBusLastRowSpacing(y,u?Math.max(Math.abs(g),Math.abs(f)):Math.max(Math.abs(p),Math.abs(d)));if(u){y.U.e(i+h/2-y.focus.x-y.at.x,o+v);let w=i+h/2-y.focus.x-y.at.x;n=Math.max(n,w+b.width),w<0&&(n-=w),o=Math.max(o,Math.max(g,f)+v+b.height),y.U.x<0&&(i=this.cP(t,y.U.x,!1,i,h))}else{y.U.e(n+v,i+h/2-y.focus.y-y.at.y),n=Math.max(n,Math.max(p,d)+v+b.width);let w=i+h/2-y.focus.y-y.at.y;o=Math.max(o,w+b.height),w<0&&(o-=w),y.U.y<0&&(i=this.cP(t,y.U.y,!0,i,h))}}return r.e(i,0,n,o),r}IF(t,e,i,s,n,o,r){let a=e.length;if(a===0)return r.e(i,0,n,o),r;if(a===1){let y=e[0];return n=y.dt.width,o=y.dt.height,r.e(i,0,n,o),r}let h=t.nodeSpacing,l=t.rowSpacing,u=this.orthoAngle(t)===270,c=0,d=0,f=0;for(let y=0;y<a;y++){if(y%2!==0||a>1&&y===a-1)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;f-=w+v.height,b.U.e(i-(v.width+k),f),n=Math.max(n,v.width+k),o=Math.max(o,Math.abs(f))}else{let k=this.computeBusNodeSpacing(b)-h;d-=w+v.width,b.U.e(d,i-(v.height+k)),o=Math.max(o,v.height+k),n=Math.max(n,Math.abs(d))}c++}c=0;let p=d,g=f;u?(d=i+h,f=0):(d=0,f=i+h);for(let y=0;y<a;y++){if(y%2===0)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;f-=w+v.height,b.U.e(d+k,f),n=Math.max(n,d+v.width+k),o=Math.max(o,Math.abs(f))}else{let k=this.computeBusNodeSpacing(b)-h;d-=w+v.width,b.U.e(d,f+k),o=Math.max(o,f+v.height+k),n=Math.max(n,Math.abs(d))}c++}if(a>1&&a%2===1){let y=e[a-1],b=y.dt,v=this.computeBusLastRowSpacing(y,u?Math.max(Math.abs(g),Math.abs(f)):Math.max(Math.abs(p),Math.abs(d)));if(u){y.U.e(i+h/2-y.focus.x-y.at.x,-o-b.height-v);let w=i+h/2-y.focus.x-y.at.x;n=Math.max(n,w+b.width),w<0&&(n-=w),o=Math.max(o,Math.abs(Math.min(g,f))+v+b.height),y.U.x<0&&(i=this.cP(t,y.U.x,!1,i,h))}else{y.U.e(-n-b.width-v,i+h/2-y.focus.y-y.at.y),n=Math.max(n,Math.abs(Math.min(p,d))+v+b.width);let w=i+h/2-y.focus.y-y.at.y;o=Math.max(o,w+b.height),w<0&&(o-=w),y.U.y<0&&(i=this.cP(t,y.U.y,!0,i,h))}}for(let y=0;y<a;y++){let b=e[y];u?b.U.e(b.U.x,b.U.y+o):b.U.e(b.U.x+n,b.U.y)}return r.e(i,0,n,o),r}computeBusNodeSpacing(t){return t.parent===null?0:t.parent.nodeSpacing}computeBusLastRowSpacing(t,e){return t.parent===null?0:t.parent.rowSpacing}cP(t,e,i,s,n){let o=t.children,r=o.length;for(let h=0;h<r;h++)i?o[h].U.e(o[h].U.x,o[h].U.y-e):o[h].U.e(o[h].U.x-e,o[h].U.y);let a=o[r-1];return Math.max(s,i?a.at.y+a.focus.y-n/2:a.at.x+a.focus.x-n/2)}bL(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}}kL(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}}PL(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:m.o("Unhandled alignment value "+t.toString())}return new P(e,i)}yc(t,e,i,s,n,o){let r=this.PL(e,i,s);this.xu(t,r.x,r.y,n,o)}xu(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].U;a.x+=e,a.y+=i}}hP(t,e,i){let s=t.parent;switch(this.ws){case 1:{let n=t.sourceEdges;for(;n.next();){let o=n.value;o.fromVertex===s&&o.relativePoint.e(e,i)}break}case 2:{let n=t.destinationEdges;for(;n.next();){let o=n.value;o.toVertex===s&&o.relativePoint.e(e,i)}break}default:m.o("Unhandled path value "+this.ws.toString())}}dU(t){if(t.childrenCount===0){let _=t.parent,at=!1,ct=0,yt=21;_!==null&&(ct=_.angle,yt=_.alignment,at=this.isBusAlignment(yt));let Ct=this.xL(t);t.U.e(0,0),t.dt.e(t.width,t.height),t.parent!==null&&t.comments!==null&&((ct===180||ct===270)&&!at||Ct)?ct===180&&!at||(ct===90||ct===270)&&Ct?t.at.e(t.width-t.focus.x*2,0):t.at.e(0,t.height-t.focus.y*2):t.at.e(0,0),t.$g=null,t.Zg=null;return}let e=this.orthoAngle(t),i=e===90||e===270,s=0,n=t.children,o=n.length;for(let _=0;_<o;_++){let at=n[_];s=Math.max(s,i?at.dt.width:at.dt.height)}let r=t.alignment,a=r===22,h=r===23,l=this.isBusAlignment(r),u=Math.max(0,t.breadthLimit),c=this.computeLayerSpacing(t),d=t.nodeSpacing,f=this.computeNodeIndent(t),p=t.rowSpacing,g=0;(a||h)&&(g=Math.max(0,t.rowIndent));let y=t.width,b=t.height,v=0,w=0,k=0,S=null,N=null,D=0,L=0,M=0,A=0,F=0,O=0,E=0,B=0,X=0;if(l&&!this.Aw(r)&&e>135&&n.reverse(),this.Aw(r))if(o>1)for(let _=0;_<o;_++)_%2===0&&_!==o-1?B=Math.max(B,i?n[_].dt.width:n[_].dt.height):_%2!==0&&(X=Math.max(X,i?n[_].dt.width:n[_].dt.height));else o===1&&(B=i?n[0].dt.width:n[0].dt.height);if(l){switch(r){case 24:let _=I.l();e<135?this.OF(t,n,B,X,v,w,_):this.IF(t,n,B,X,v,w,_),B=_.x,v=_.width,w=_.height,I.i(_);break;case 26:for(let at=0;at<o;at++){let ct=n[at],yt=ct.dt,Ct=O===0?0:p;i?(ct.U.e(s-yt.width,A+Ct),v=Math.max(v,yt.width),w=Math.max(w,A+Ct+yt.height),A+=Ct+yt.height):(ct.U.e(M+Ct,s-yt.height),v=Math.max(v,M+Ct+yt.width),w=Math.max(w,yt.height),M+=Ct+yt.width),O++}break;case 27:for(let at=0;at<o;at++){let ct=n[at],yt=ct.dt,Ct=O===0?0:p;i?(ct.U.e(d/2+t.focus.x,A+Ct),v=Math.max(v,yt.width),w=Math.max(w,A+Ct+yt.height),A+=Ct+yt.height):(ct.U.e(M+Ct,d/2+t.focus.y),v=Math.max(v,M+Ct+yt.width),w=Math.max(w,yt.height),M+=Ct+yt.width),O++}break}S=this.pi(2),N=this.pi(2),i?(S[0].e(0,0),S[1].e(0,w),N[0].e(v,0),N[1].e(v,w)):(S[0].e(0,0),S[1].e(v,0),N[0].e(0,w),N[1].e(v,w))}else for(let _=0;_<o;_++){let at=n[_],ct=at.dt;if(i){u>0&&O>0&&M+d+ct.width>u&&(M<s&&this.yc(t,r,s-M,0,E,_-1),F++,O=0,E=_,k=w,M=0,A=e>135?-w-p:w+p),this.hP(at,0,A);let yt=0;if(O===0)S=at.$g,N=at.Zg,D=ct.width,L=ct.height,(S===null||N===null||e!==this.orthoAngle(at))&&(S=this.pi(2),N=this.pi(2),S[0].e(0,0),S[1].e(0,L),N[0].e(D,0),N[1].e(D,L));else{let Ct=m.st(),Q=I.l();this.EF(t,at,S,N,D,L,Ct,Q),yt=Q.x,S=Ct[0],N=Ct[1],D=Q.width,L=Q.height,m.Z(Ct),M<ct.width&&yt<0&&(this.xu(t,-yt,0,E,_-1),this.fP(S,-yt,0),this.fP(N,-yt,0),yt=0),I.i(Q)}at.U.e(yt,A),v=Math.max(v,D),w=Math.max(w,k+(F===0?0:p)+ct.height),M=D}else{u>0&&O>0&&A+d+ct.height>u&&(A<s&&this.yc(t,r,0,s-A,E,_-1),F++,O=0,E=_,k=v,A=0,M=e>135?-v-p:v+p),this.hP(at,M,0);let yt=0;if(O===0)S=at.$g,N=at.Zg,D=ct.width,L=ct.height,(S===null||N===null||e!==this.orthoAngle(at))&&(S=this.pi(2),N=this.pi(2),S[0].e(0,0),S[1].e(D,0),N[0].e(0,L),N[1].e(D,L));else{let Ct=m.st(),Q=I.l();this.EF(t,at,S,N,D,L,Ct,Q),yt=Q.x,S=Ct[0],N=Ct[1],D=Q.width,L=Q.height,m.Z(Ct),A<ct.height&&yt<0&&(this.xu(t,0,-yt,E,_-1),this.fP(S,0,-yt),this.fP(N,0,-yt),yt=0),I.i(Q)}at.U.e(M,yt),w=Math.max(w,L),v=Math.max(v,k+(F===0?0:p)+ct.width),A=L}O++}F>0&&(i?(w+=Math.max(0,c),M<v&&this.yc(t,r,v-M,0,E,o-1),g>0&&(h||this.xu(t,g,0,0,o-1),v+=g)):(v+=Math.max(0,c),A<w&&this.yc(t,r,0,w-A,E,o-1),g>0&&(h||this.xu(t,0,g,0,o-1),w+=g)));let z=0,U=0;switch(r){case 20:i?z+=v/2-t.focus.x-f/2:U+=w/2-t.focus.y-f/2;break;default:case 21:if(F>0)i?z+=v/2-t.focus.x-f/2:U+=w/2-t.focus.y-f/2;else{let at=o;if(i){let ct=n[0].U.x+n[0].at.x,yt=n[at-1].U.x+n[at-1].at.x+n[at-1].focus.x*2;z+=ct+(yt-ct)/2-t.focus.x-f/2}else{let ct=n[0].U.y+n[0].at.y,yt=n[at-1].U.y+n[at-1].at.y+n[at-1].focus.y*2;U+=ct+(yt-ct)/2-t.focus.y-f/2}}break;case 22:i?(z-=f,v+=f):(U-=f,w+=f);break;case 23:i?(z+=v-t.width+f,v+=f):(U+=w-t.height+f,w+=f);break;case 24:i?o>1?z+=B+d/2-t.focus.x:z+=n[0].focus.x-t.focus.x+n[0].at.x:o>1?U+=B+d/2-t.focus.y:U+=n[0].focus.y-t.focus.y+n[0].at.y;break;case 26:i?z+=v+d/2-t.focus.x:U+=w+d/2-t.focus.y;break;case 27:break;case 28:let _=this.customAlignment(t,z,U,v,w);z=_[0],U=_[1],v=_[2],w=_[3];break}for(let _=0;_<o;_++){let at=n[_];i?at.U.e(at.U.x+at.at.x-z,at.U.y+(e>135?(l?-w:-at.dt.height)+at.at.y-c:b+c+at.at.y)):at.U.e(at.U.x+(e>135?(l?-v:-at.dt.width)+at.at.x-c:y+c+at.at.x),at.U.y+at.at.y-U)}let tt=0,nt=0;if(l)i?(v=this.bL(t,v,z),z<0&&(z=0),e>135&&(U+=w+c),w+=b+c,r===27&&(tt+=d/2+t.focus.x),nt+=b+c):(e>135&&(z+=v+c),v+=y+c,w=this.kL(t,w,U),U<0&&(U=0),r===27&&(nt+=d/2+t.focus.y),tt+=y+c);else if(i){if(t.comments===null){if(y>v){let _=this.PL(r,y-v,0);tt=_.x,nt=_.y,v=y,z=0}}else v=this.bL(t,v,z);z<0&&(tt-=z,z=0),e>135&&(U+=w+c),w=Math.max(Math.max(w,b),w+b+c),nt+=b+c}else{if(e>135&&(z+=v+c),v=Math.max(Math.max(v,y),v+y+c),t.comments===null){if(b>w){let _=this.PL(r,0,b-w);tt=_.x,nt=_.y,w=b,U=0}}else w=this.kL(t,w,U);U<0&&(nt-=U,U=0),tt+=y+c}let Z,it;if(F>0)Z=this.pi(4),it=this.pi(4),i?(Z[2].e(0,b+c),Z[3].e(Z[2].x,w),it[2].e(v,Z[2].y),it[3].e(it[2].x,Z[3].y)):(Z[2].e(y+c,0),Z[3].e(v,Z[2].y),it[2].e(Z[2].x,w),it[3].e(Z[3].x,it[2].y));else{Z=this.pi(S.length+2),it=this.pi(N.length+2);for(let _=0;_<S.length;_++){let at=S[_];Z[_+2].e(at.x+tt,at.y+nt)}for(let _=0;_<N.length;_++){let at=N[_];it[_+2].e(at.x+tt,at.y+nt)}}i?(Z[0].e(z,0),Z[1].e(Z[0].x,b),Z[2].y<Z[1].y&&(Z[2].x>Z[0].x?Z[2].h(Z[1]):Z[1].h(Z[2])),Z[3].y<Z[2].y&&(Z[3].x>Z[0].x?Z[3].h(Z[2]):Z[2].h(Z[3])),it[0].e(z+y,0),it[1].e(it[0].x,b),it[2].y<it[1].y&&(it[2].x<it[0].x?it[2].h(it[1]):it[1].h(it[2])),it[3].y<it[2].y&&(it[3].x<it[0].x?it[3].h(it[2]):it[2].h(it[3])),Z[2].y-=c/2,it[2].y-=c/2):(Z[0].e(0,U),Z[1].e(y,Z[0].y),Z[2].x<Z[1].x&&(Z[2].y>Z[0].y?Z[2].h(Z[1]):Z[1].h(Z[2])),Z[3].x<Z[2].x&&(Z[3].y>Z[0].y?Z[3].h(Z[2]):Z[2].h(Z[3])),it[0].e(0,U+b),it[1].e(y,it[0].y),it[2].x<it[1].x&&(it[2].y<it[0].y?it[2].h(it[1]):it[1].h(it[2])),it[3].x<it[2].x&&(it[3].y<it[0].y?it[3].h(it[2]):it[2].h(it[3])),Z[2].x-=c/2,it[2].x-=c/2),this.fn(S),this.fn(N),t.$g=Z,t.Zg=it,t.at.e(z,U),t.dt.e(v,w)}fP(t,e,i){for(let s=0;s<t.length;s++){let n=t[s];n.x+=e,n.y+=i}}EF(t,e,i,s,n,o,r,a){let h=this.orthoAngle(t),l=h===90||h===270,u=t.nodeSpacing,c=i,d=s,f=n,p=o,g=e.$g,y=e.Zg,b=e.dt,v=l?Math.max(p,b.height):Math.max(f,b.width);if((g===null||h!==this.orthoAngle(e))&&(g=this.pi(2),y=this.pi(2),l?(g[0].e(0,0),g[1].e(0,b.height),y[0].e(b.width,0),y[1].e(y[0].x,g[1].y)):(g[0].e(0,0),g[1].e(b.width,0),y[0].e(0,b.height),y[1].e(g[1].x,y[0].y))),l){let w=f,k=w-this.gU(d,g,w);return k+=u,i=this.mU(c,g,k),s=this.pU(d,y,k),n=Math.max(0,k)+b.width,o=v,this.fn(c),this.fn(g),this.fn(d),this.fn(y),r[0]=i,r[1]=s,a.e(k,0,n,o),a}else{let w=p,k=w-this.yU(d,g,w);return k+=u,i=this.wU(c,g,k),s=this.xU(d,y,k),n=v,o=Math.max(0,k)+b.height,this.fn(c),this.fn(g),this.fn(d),this.fn(y),r[0]=i,r[1]=s,a.e(k,0,n,o),a}}wU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x,l.y+i)}for(;n<t.length;){let l=t[n++];s[r++].e(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++].e(l.x,l.y+i)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}mU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x+i,l.y)}for(;n<t.length;){let l=t[n++];s[r++].e(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++].e(l.x+i,l.y)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}xU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x,l.y)}for(;o<e.length;){let l=e[o++];s[r++].e(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++].e(l.x,l.y)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}pU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x,l.y)}for(;o<e.length;){let l=e[o++];s[r++].e(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++].e(l.x,l.y)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}yU(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 u=r;n+1<t.length&&(u=t[n+1]);let c=a,d=c.x,f=c.y;o+1<e.length&&(c=e[o+1],d=c.x,f=c.y,f+=i);let p=s;r.x===h?p=l-r.y:r.x>h&&r.x<d?p=l+(r.x-h)/(d-h)*(f-l)-r.y:h>r.x&&h<u.x&&(p=l-(r.y+(h-r.x)/(u.x-r.x)*(u.y-r.y))),p<s&&(s=p),u.x<=r.x?n++:d<=h?o++:(u.x<=d&&n++,d<=u.x&&o++)}return s}gU(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 u=r;n+1<t.length&&(u=t[n+1]);let c=a,d=c.x,f=c.y;o+1<e.length&&(c=e[o+1],d=c.x,f=c.y,d+=i);let p=s;r.y===l?p=h-r.x:r.y>l&&r.y<f?p=h+(r.y-l)/(f-l)*(d-h)-r.x:l>r.y&&l<u.y&&(p=h-(r.x+(l-r.y)/(u.y-r.y)*(u.x-r.x))),p<s&&(s=p),u.y<=r.y?n++:f<=l?o++:(u.y<=f&&n++,f<=u.y&&o++)}return s}pi(t){let e=this.aP[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}fn(t){if(!t)return;let e=t.length,i=this.aP[e];i===void 0&&(i=[],this.aP[e]=i),i.push(t)}arrangeTrees(){if(this.He===52){let t=this.Ie.iterator;for(;t.next();){let e=t.value;if(!(e instanceof Rt))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.SL(e,n,o)}}else{let t=[],e=this.Ie.iterator;for(;e.next();){let o=e.value;o instanceof Rt&&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.SL(r,s+r.at.x,n+r.at.y),this.He){case 50:n+=r.dt.height+this.Es.height;break;default:case 51:s+=r.dt.width+this.Es.width;break}}}}SL(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.SL(r,e+r.U.x,i+r.U.y)}}commitLayout(){this.xw(),this.commitNodes(),this.pL(),this.isRouting&&this.commitLinks()}commitNodes(){if(this.network===null)return;let t=this.network.vertexes.iterator;for(;t.next();)t.value.commit();for(t.reset();t.next();){let e=t.value;this.layoutComments(e)}}pL(){if(this.network===null||this.layerStyle!==62)return;let t=this.yL,e=[],i,s=this.network.vertexes.iterator;for(;s.next();){let h=s.value;i===void 0?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}if(!i)return;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 I(0,a,r,l))):this.angle===90?(o.push(new I(0,a,r,l)),a+=l):this.angle===180?(a-=l,o.push(new I(a,0,l,r))):(o.push(new I(a,0,l,r)),a+=l)}this.commitLayers(o,n)}commitLayers(t,e){}commitLinks(){if(this.network===null)return;let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}xw(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.UF(e)}}UF(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.UF(n)}}setPortSpots(t){let e=t.alignment;if(this.isBusAlignment(e))this.bU(t,e);else{let i=this.orthoAngle(t);if(this.ws===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=T.MiddleRight;break;case 90:n.fromSpot=T.MiddleBottom;break;case 180:n.fromSpot=T.MiddleLeft;break;default:n.fromSpot=T.MiddleTop;break}else n.fromSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.isDefault())switch(i){case 0:n.toSpot=T.MiddleLeft;break;case 90:n.toSpot=T.MiddleTop;break;case 180:n.toSpot=T.MiddleRight;break;default:n.toSpot=T.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=T.MiddleRight;break;case 90:n.toSpot=T.MiddleBottom;break;case 180:n.toSpot=T.MiddleLeft;break;default:n.toSpot=T.MiddleTop;break}else n.toSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.isDefault())switch(i){case 0:n.fromSpot=T.MiddleLeft;break;case 90:n.fromSpot=T.MiddleTop;break;case 180:n.fromSpot=T.MiddleRight;break;default:n.fromSpot=T.MiddleBottom;break}else n.fromSpot=t.childPortSpot}}}}}bU(t,e){let i=this.ws===1,s=this.orthoAngle(t),n;switch(s){case 0:n=T.MiddleRight;break;case 90:n=T.MiddleBottom;break;case 180:n=T.MiddleLeft;break;default:n=T.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 u=l.link;if(u!==null){let c=s===90||s===270?T.MiddleLeft:T.MiddleTop;if(r===1||a===r-1&&r%2===1)switch(s){case 0:c=T.MiddleLeft;break;case 90:c=T.MiddleTop;break;case 180:c=T.MiddleRight;break;default:c=T.MiddleBottom;break}else a%2===0&&(c=s===90||s===270?T.MiddleRight:T.MiddleBottom);i?(t.setsPortSpot&&(u.fromSpot=n),t.setsChildPortSpot&&(u.toSpot=c)):(t.setsPortSpot&&(u.fromSpot=c),t.setsChildPortSpot&&(u.toSpot=n))}}break}case 26:{let a=s===90||s===270?T.MiddleRight:T.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?T.MiddleLeft:T.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.Ie}set roots(t){this.Ie!==t&&(this.Ie=t,this.p())}get path(){return this.Fe}set path(t){this.Fe!==t&&(this.Fe=t,this.p())}get treeStyle(){return this.wu}set treeStyle(t){this.wu!==t&&(t===40||t===42||t===41||t===43)&&(this.wu=t,this.p())}get layerStyle(){return this.Jg}set layerStyle(t){this.Jg!==t&&(t===60||t===61||t===62)&&(this.Jg=t,this.p())}get comments(){return this.zi}set comments(t){this.zi!==t&&(m.s(t,"boolean",Vt,"comments"),this.zi=t,this.p())}get arrangement(){return this.He}set arrangement(t){this.He!==t&&(t===50||t===51||t===52)&&(this.He=t,this.p())}get arrangementSpacing(){return this.Es}set arrangementSpacing(t){this.Es.equals(t)||(this.Es.h(t),this.p())}get rootDefaults(){return this.V}set rootDefaults(t){this.V!==t&&(this.V=t,this.p())}get alternateDefaults(){return this.B}set alternateDefaults(t){this.B!==t&&(this.B=t,this.p())}get sorting(){return this.V.sorting}set sorting(t){this.V.sorting!==t&&(this.V.sorting=t,this.p())}get comparer(){return this.V.comparer}set comparer(t){this.V.comparer!==t&&(m.S(t,Vt,"comparer"),this.V.comparer=t,this.p())}get angle(){return this.V.angle}set angle(t){this.V.angle!==t&&(m.s(t,"number",Vt,"angle"),t===0||t===90||t===180||t===270?(this.V.angle=t,this.p()):m.o("TreeLayout.angle must be 0, 90, 180, or 270"))}get alignment(){return this.V.alignment}set alignment(t){this.V.alignment!==t&&(this.V.alignment=t,this.p())}get nodeIndent(){return this.V.nodeIndent}set nodeIndent(t){this.V.nodeIndent!==t&&(m.s(t,"number",Vt,"nodeIndent"),t>=0&&(this.V.nodeIndent=t,this.p()))}get nodeIndentPastParent(){return this.V.nodeIndentPastParent}set nodeIndentPastParent(t){this.V.nodeIndentPastParent!==t&&(m.s(t,"number",Vt,"nodeIndentPastParent"),t>=0&&t<=1&&(this.V.nodeIndentPastParent=t,this.p()))}get nodeSpacing(){return this.V.nodeSpacing}set nodeSpacing(t){this.V.nodeSpacing!==t&&(m.s(t,"number",Vt,"nodeSpacing"),this.V.nodeSpacing=t,this.p())}get layerSpacing(){return this.V.layerSpacing}set layerSpacing(t){this.V.layerSpacing!==t&&(m.s(t,"number",Vt,"layerSpacing"),this.V.layerSpacing=t,this.p())}get layerSpacingParentOverlap(){return this.V.layerSpacingParentOverlap}set layerSpacingParentOverlap(t){this.V.layerSpacingParentOverlap!==t&&(m.s(t,"number",Vt,"layerSpacingParentOverlap"),t>=0&&t<=1&&(this.V.layerSpacingParentOverlap=t,this.p()))}get compaction(){return this.V.compaction}set compaction(t){this.V.compaction!==t&&(t===30||t===31)&&(this.V.compaction=t,this.p())}get breadthLimit(){return this.V.breadthLimit}set breadthLimit(t){this.V.breadthLimit!==t&&(m.s(t,"number",Vt,"breadthLimit"),t>=0&&(this.V.breadthLimit=t,this.p()))}get rowSpacing(){return this.V.rowSpacing}set rowSpacing(t){this.V.rowSpacing!==t&&(m.s(t,"number",Vt,"rowSpacing"),this.V.rowSpacing=t,this.p())}get rowIndent(){return this.V.rowIndent}set rowIndent(t){this.V.rowIndent!==t&&(m.s(t,"number",Vt,"rowIndent"),t>=0&&(this.V.rowIndent=t,this.p()))}get commentSpacing(){return this.V.commentSpacing}set commentSpacing(t){this.V.commentSpacing!==t&&(m.s(t,"number",Vt,"commentSpacing"),this.V.commentSpacing=t,this.p())}get commentMargin(){return this.V.commentMargin}set commentMargin(t){this.V.commentMargin!==t&&(m.s(t,"number",Vt,"commentMargin"),this.V.commentMargin=t,this.p())}get setsPortSpot(){return this.V.setsPortSpot}set setsPortSpot(t){this.V.setsPortSpot!==t&&(m.s(t,"boolean",Vt,"setsPortSpot"),this.V.setsPortSpot=t,this.p())}get portSpot(){return this.V.portSpot}set portSpot(t){this.V.portSpot.equals(t)||(this.V.portSpot=t,this.p())}get setsChildPortSpot(){return this.V.setsChildPortSpot}set setsChildPortSpot(t){this.V.setsChildPortSpot!==t&&(m.s(t,"boolean",Vt,"setsChildPortSpot"),this.V.setsChildPortSpot=t,this.p())}get childPortSpot(){return this.V.childPortSpot}set childPortSpot(t){this.V.childPortSpot.equals(t)||(this.V.childPortSpot=t,this.p())}get alternateSorting(){return this.B.sorting}set alternateSorting(t){this.B.sorting!==t&&(this.B.sorting=t,this.p())}get alternateComparer(){return this.B.comparer}set alternateComparer(t){this.B.comparer!==t&&(m.S(t,Vt,"alternateComparer"),this.B.comparer=t,this.p())}get alternateAngle(){return this.B.angle}set alternateAngle(t){this.B.angle!==t&&(m.s(t,"number",Vt,"alternateAngle"),(t===0||t===90||t===180||t===270)&&(this.B.angle=t,this.p()))}get alternateAlignment(){return this.B.alignment}set alternateAlignment(t){this.B.alignment!==t&&(this.B.alignment=t,this.p())}get alternateNodeIndent(){return this.B.nodeIndent}set alternateNodeIndent(t){this.B.nodeIndent!==t&&(m.s(t,"number",Vt,"alternateNodeIndent"),t>=0&&(this.B.nodeIndent=t,this.p()))}get alternateNodeIndentPastParent(){return this.B.nodeIndentPastParent}set alternateNodeIndentPastParent(t){this.B.nodeIndentPastParent!==t&&(m.s(t,"number",Vt,"alternateNodeIndentPastParent"),t>=0&&t<=1&&(this.B.nodeIndentPastParent=t,this.p()))}get alternateNodeSpacing(){return this.B.nodeSpacing}set alternateNodeSpacing(t){this.B.nodeSpacing!==t&&(m.s(t,"number",Vt,"alternateNodeSpacing"),this.B.nodeSpacing=t,this.p())}get alternateLayerSpacing(){return this.B.layerSpacing}set alternateLayerSpacing(t){this.B.layerSpacing!==t&&(m.s(t,"number",Vt,"alternateLayerSpacing"),this.B.layerSpacing=t,this.p())}get alternateLayerSpacingParentOverlap(){return this.B.layerSpacingParentOverlap}set alternateLayerSpacingParentOverlap(t){this.B.layerSpacingParentOverlap!==t&&(m.s(t,"number",Vt,"alternateLayerSpacingParentOverlap"),t>=0&&t<=1&&(this.B.layerSpacingParentOverlap=t,this.p()))}get alternateCompaction(){return this.B.compaction}set alternateCompaction(t){this.B.compaction!==t&&(t===30||t===31)&&(this.B.compaction=t,this.p())}get alternateBreadthLimit(){return this.B.breadthLimit}set alternateBreadthLimit(t){this.B.breadthLimit!==t&&(m.s(t,"number",Vt,"alternateBreadthLimit"),t>=0&&(this.B.breadthLimit=t,this.p()))}get alternateRowSpacing(){return this.B.rowSpacing}set alternateRowSpacing(t){this.B.rowSpacing!==t&&(m.s(t,"number",Vt,"alternateRowSpacing"),this.B.rowSpacing=t,this.p())}get alternateRowIndent(){return this.B.rowIndent}set alternateRowIndent(t){this.B.rowIndent!==t&&(m.s(t,"number",Vt,"alternateRowIndent"),t>=0&&(this.B.rowIndent=t,this.p()))}get alternateCommentSpacing(){return this.B.commentSpacing}set alternateCommentSpacing(t){this.B.commentSpacing!==t&&(m.s(t,"number",Vt,"alternateCommentSpacing"),this.B.commentSpacing=t,this.p())}get alternateCommentMargin(){return this.B.commentMargin}set alternateCommentMargin(t){this.B.commentMargin!==t&&(m.s(t,"number",Vt,"alternateCommentMargin"),this.B.commentMargin=t,this.p())}get alternateSetsPortSpot(){return this.B.setsPortSpot}set alternateSetsPortSpot(t){this.B.setsPortSpot!==t&&(m.s(t,"boolean",Vt,"alternateSetsPortSpot"),this.B.setsPortSpot=t,this.p())}get alternatePortSpot(){return this.B.portSpot}set alternatePortSpot(t){this.B.portSpot.equals(t)||(this.B.portSpot=t,this.p())}get alternateSetsChildPortSpot(){return this.B.setsChildPortSpot}set alternateSetsChildPortSpot(t){this.B.setsChildPortSpot!==t&&(m.s(t,"boolean",Vt,"alternateSetsChildPortSpot"),this.B.setsChildPortSpot=t,this.p())}get alternateChildPortSpot(){return this.B.childPortSpot}set alternateChildPortSpot(t){this.B.childPortSpot.equals(t)||(this.B.childPortSpot=t,this.p())}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 gs extends Ee{constructor(t){super(t)}createVertex(){return new Rt(this)}createEdge(){return new sn(this)}}class Rt extends Ie{U;dt;at;uP;dP;gP;mP;pP;yP;wP;zi;$g;Zg;Si;Mi;Xt;de;Tw;Dw;vw;Us;Fw;Rw;Ow;Iw;Ew;Uw;Vw;Bw;zw;Xw;Gw;constructor(t){super(t),this.uP=!1,this.dP=null,this.gP=[],this.mP=0,this.pP=0,this.yP=0,this.wP=0,this.zi=null,this.U=new P(0,0),this.dt=new st(0,0),this.at=new P(0,0),this.$g=null,this.Zg=null,this.Si=10,this.Mi=Ie.standardComparer,this.Xt=0,this.de=21,this.Tw=0,this.Dw=0,this.vw=20,this.Us=50,this.Fw=0,this.Rw=31,this.Ow=0,this.Iw=25,this.Ew=10,this.Uw=10,this.Vw=20,this.Bw=!0,this.zw=T.Default,this.Xw=!0,this.Gw=T.Default}copyInheritedPropertiesFrom(t){t!==null&&(this.Si=t.sorting,this.Mi=t.comparer,this.Xt=t.angle,this.de=t.alignment,this.Tw=t.nodeIndent,this.Dw=t.nodeIndentPastParent,this.vw=t.nodeSpacing,this.Us=t.layerSpacing,this.Fw=t.layerSpacingParentOverlap,this.Rw=t.compaction,this.Ow=t.breadthLimit,this.Iw=t.rowSpacing,this.Ew=t.rowIndent,this.Uw=t.commentSpacing,this.Vw=t.commentMargin,this.Bw=t.setsPortSpot,this.zw=t.portSpot,this.Xw=t.setsChildPortSpot,this.Gw=t.childPortSpot)}get initialized(){return this.uP}set initialized(t){this.uP!==t&&(m.s(t,"boolean",Rt,"initialized"),this.uP=t)}get parent(){return this.dP}set parent(t){this.dP!==t&&(this.dP=t)}get children(){return this.gP}set children(t){if(this.gP!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",Rt,"children:value"),t!==null){let e=t.length;for(let i=0;i<e;i++){let s=t[i]}}this.gP=t}}get level(){return this.mP}set level(t){this.mP!==t&&(m.s(t,"number",Rt,"level"),this.mP=t)}get descendantCount(){return this.pP}set descendantCount(t){this.pP!==t&&(m.s(t,"number",Rt,"descendantCount"),this.pP=t)}get maxChildrenCount(){return this.yP}set maxChildrenCount(t){this.yP!==t&&(m.s(t,"number",Rt,"maxChildrenCount"),this.yP=t)}get maxGenerationCount(){return this.wP}set maxGenerationCount(t){this.wP!==t&&(m.s(t,"number",Rt,"maxGenerationCount"),this.wP=t)}get comments(){return this.zi}set comments(t){if(this.zi!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",Rt,"comments:value"),t!==null){let e=t.length;for(let i=0;i<e;i++){let s=t[i]}}this.zi=t}}get sorting(){return this.Si}set sorting(t){this.Si!==t&&(this.Si=t)}get comparer(){return this.Mi}set comparer(t){this.Mi!==t&&(m.S(t,Rt,"comparer"),this.Mi=t)}get angle(){return this.Xt}set angle(t){this.Xt!==t&&(m.s(t,"number",Rt,"angle"),this.Xt=t)}get alignment(){return this.de}set alignment(t){this.de!==t&&(this.de=t)}get nodeIndent(){return this.Tw}set nodeIndent(t){this.Tw!==t&&(m.s(t,"number",Rt,"nodeIndent"),this.Tw=t)}get nodeIndentPastParent(){return this.Dw}set nodeIndentPastParent(t){this.Dw!==t&&(m.s(t,"number",Rt,"nodeIndentPastParent"),this.Dw=t)}get nodeSpacing(){return this.vw}set nodeSpacing(t){this.vw!==t&&(m.s(t,"number",Rt,"nodeSpacing"),this.vw=t)}get layerSpacing(){return this.Us}set layerSpacing(t){this.Us!==t&&(m.s(t,"number",Rt,"layerSpacing"),this.Us=t)}get layerSpacingParentOverlap(){return this.Fw}set layerSpacingParentOverlap(t){this.Fw!==t&&(m.s(t,"number",Rt,"layerSpacingParentOverlap"),this.Fw=t)}get compaction(){return this.Rw}set compaction(t){this.Rw!==t&&(this.Rw=t)}get breadthLimit(){return this.Ow}set breadthLimit(t){this.Ow!==t&&(m.s(t,"number",Rt,"breadthLimit"),this.Ow=t)}get rowSpacing(){return this.Iw}set rowSpacing(t){this.Iw!==t&&(m.s(t,"number",Rt,"rowSpacing"),this.Iw=t)}get rowIndent(){return this.Ew}set rowIndent(t){this.Ew!==t&&(m.s(t,"number",Rt,"rowIndent"),this.Ew=t)}get commentSpacing(){return this.Uw}set commentSpacing(t){this.Uw!==t&&(m.s(t,"number",Rt,"commentSpacing"),this.Uw=t)}get commentMargin(){return this.Vw}set commentMargin(t){this.Vw!==t&&(m.s(t,"number",Rt,"commentMargin"),this.Vw=t)}get setsPortSpot(){return this.Bw}set setsPortSpot(t){this.Bw!==t&&(m.s(t,"boolean",Rt,"setsPortSpot"),this.Bw=t)}get portSpot(){return this.zw}set portSpot(t){this.zw.equals(t)||(this.zw=t)}get setsChildPortSpot(){return this.Xw}set setsChildPortSpot(t){this.Xw!==t&&(m.s(t,"boolean",Rt,"setsChildPortSpot"),this.Xw=t)}get childPortSpot(){return this.Gw}set childPortSpot(t){this.Gw.equals(t)||(this.Gw=t)}get childrenCount(){return this.children.length}get relativePosition(){return this.U}set relativePosition(t){this.U.set(t)}get subtreeSize(){return this.dt}set subtreeSize(t){this.dt.set(t)}get subtreeOffset(){return this.at}set subtreeOffset(t){this.at.set(t)}}class sn extends ei{xP;constructor(t){super(t),this.xP=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.ws){case 1:i=this.fromVertex,s=this.toVertex;break;case 2:i=this.toVertex,s=this.fromVertex;break;default:m.o("Unhandled path value "+e.ws.toString())}if(i===null||s===null)return;let n=this.xP;if(n.x===0&&n.y===0){this.kU(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,u=t.isOrthogonal,c=0,d,f;if(t.startRoute(),u||l){for(c=2;t.pointsCount>4;)t.removePoint(2);d=t.getPoint(1),f=t.getPoint(2)}else{for(c=1;t.pointsCount>3;)t.removePoint(1);d=t.getPoint(0),f=t.getPoint(t.pointsCount-1)}let p=t.getPoint(t.pointsCount-1),g=0;r===0?(i.alignment===23?(g=o.bottom+n.y,n.y===0&&d.y>p.y+i.rowIndent&&(g=Math.min(g,Math.max(d.y,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.top+n.y,n.y===0&&d.y<p.y-i.rowIndent&&(g=Math.max(g,Math.min(d.y,g+e.computeNodeIndent(i))))):g=o.y+o.height/2+n.y,l?(t.insertPointAt(c,d.x,g),c++,t.insertPointAt(c,o.right+a,g),c++,t.insertPointAt(c,o.right+a+(n.x-h)/3,g),c++,t.insertPointAt(c,o.right+a+(n.x-h)*2/3,g),c++,t.insertPointAt(c,o.right+a+(n.x-h),g),c++,t.insertPointAt(c,f.x,g),c++):(u&&(t.insertPointAt(c,o.right+a/2,d.y),c++),t.insertPointAt(c,o.right+a/2,g),c++,t.insertPointAt(c,o.right+a+n.x-(u?h/2:h),g),c++,u&&(t.insertPointAt(c,t.getPoint(c-1).x,f.y),c++))):r===90?(i.alignment===23?(g=o.right+n.x,n.x===0&&d.x>p.x+i.rowIndent&&(g=Math.min(g,Math.max(d.x,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.left+n.x,n.x===0&&d.x<p.x-i.rowIndent&&(g=Math.max(g,Math.min(d.x,g+e.computeNodeIndent(i))))):g=o.x+o.width/2+n.x,l?(t.insertPointAt(c,g,d.y),c++,t.insertPointAt(c,g,o.bottom+a),c++,t.insertPointAt(c,g,o.bottom+a+(n.y-h)/3),c++,t.insertPointAt(c,g,o.bottom+a+(n.y-h)*2/3),c++,t.insertPointAt(c,g,o.bottom+a+(n.y-h)),c++,t.insertPointAt(c,g,f.y),c++):(u&&(t.insertPointAt(c,d.x,o.bottom+a/2),c++),t.insertPointAt(c,g,o.bottom+a/2),c++,t.insertPointAt(c,g,o.bottom+a+n.y-(u?h/2:h)),c++,u&&(t.insertPointAt(c,f.x,t.getPoint(c-1).y),c++))):r===180?(i.alignment===23?(g=o.bottom+n.y,n.y===0&&d.y>p.y+i.rowIndent&&(g=Math.min(g,Math.max(d.y,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.top+n.y,n.y===0&&d.y<p.y-i.rowIndent&&(g=Math.max(g,Math.min(d.y,g+e.computeNodeIndent(i))))):g=o.y+o.height/2+n.y,l?(t.insertPointAt(c,d.x,g),c++,t.insertPointAt(c,o.left-a,g),c++,t.insertPointAt(c,o.left-a+(n.x+h)/3,g),c++,t.insertPointAt(c,o.left-a+(n.x+h)*2/3,g),c++,t.insertPointAt(c,o.left-a+(n.x+h),g),c++,t.insertPointAt(c,f.x,g),c++):(u&&(t.insertPointAt(c,o.left-a/2,d.y),c++),t.insertPointAt(c,o.left-a/2,g),c++,t.insertPointAt(c,o.left-a+n.x+(u?h/2:h),g),c++,u&&(t.insertPointAt(c,t.getPoint(c-1).x,f.y),c++))):r===270?(i.alignment===23?(g=o.right+n.x,n.x===0&&d.x>p.x+i.rowIndent&&(g=Math.min(g,Math.max(d.x,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.left+n.x,n.x===0&&d.x<p.x-i.rowIndent&&(g=Math.max(g,Math.min(d.x,g+e.computeNodeIndent(i))))):g=o.x+o.width/2+n.x,l?(t.insertPointAt(c,g,d.y),c++,t.insertPointAt(c,g,o.top-a),c++,t.insertPointAt(c,g,o.top-a+(n.y+h)/3),c++,t.insertPointAt(c,g,o.top-a+(n.y+h)*2/3),c++,t.insertPointAt(c,g,o.top-a+(n.y+h)),c++,t.insertPointAt(c,g,f.y),c++):(u&&(t.insertPointAt(c,d.x,o.top-a/2),c++),t.insertPointAt(c,g,o.top-a/2),c++,t.insertPointAt(c,g,o.top-a+n.y+(u?h/2:h)),c++,u&&(t.insertPointAt(c,f.x,t.getPoint(c-1).y),c++))):m.o("Invalid angle "+r),t.commitRoute()}kU(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,u=i.isOrthogonal,c=this.fromVertex,d=s.isBusAlignment(c.alignment);if(i.startRoute(),n===0){let f=a.right+r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).y;i.setPointAt(1,f-20,i.getPoint(1).y),i.insertPointAt(2,f-20,p),i.insertPointAt(3,f,p),i.insertPointAt(4,f+20,p),i.setPointAt(5,i.getPoint(5).x,p)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,f,i.getPoint(2).y),i.setPointAt(3,f,i.getPoint(3).y)):i.pointsCount===4?i.insertPointAt(2,f,i.getPoint(2).y):i.pointsCount===3?i.setPointAt(1,f,i.getPoint(2).y):i.pointsCount===2&&i.insertPointAt(1,f,i.getPoint(1).y)}else if(n===90){let f=a.bottom+r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).x;i.setPointAt(1,i.getPoint(1).x,f-20),i.insertPointAt(2,p,f-20),i.insertPointAt(3,p,f),i.insertPointAt(4,p,f+20),i.setPointAt(5,p,i.getPoint(5).y)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,i.getPoint(2).x,f),i.setPointAt(3,i.getPoint(3).x,f)):i.pointsCount===4?i.insertPointAt(2,i.getPoint(2).x,f):i.pointsCount===3?i.setPointAt(1,i.getPoint(2).x,f):i.pointsCount===2&&i.insertPointAt(1,i.getPoint(1).x,f)}else if(n===180){let f=a.left-r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).y;i.setPointAt(1,f+20,i.getPoint(1).y),i.insertPointAt(2,f+20,p),i.insertPointAt(3,f,p),i.insertPointAt(4,f-20,p),i.setPointAt(5,i.getPoint(5).x,p)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,f,i.getPoint(2).y),i.setPointAt(3,f,i.getPoint(3).y)):i.pointsCount===4?i.insertPointAt(2,f,i.getPoint(2).y):i.pointsCount===3?i.setPointAt(1,f,i.getPoint(2).y):i.pointsCount===2&&i.insertPointAt(1,f,i.getPoint(1).y)}else if(n===270){let f=a.top-r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).x;i.setPointAt(1,i.getPoint(1).x,f+20),i.insertPointAt(2,p,f+20),i.insertPointAt(3,p,f),i.insertPointAt(4,p,f-20),i.setPointAt(5,p,i.getPoint(5).y)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,i.getPoint(2).x,f),i.setPointAt(3,i.getPoint(3).x,f)):i.pointsCount===4?i.insertPointAt(2,i.getPoint(2).x,f):i.pointsCount===3?i.setPointAt(1,i.getPoint(2).x,f):i.pointsCount===2&&i.insertPointAt(1,i.getPoint(1).x,f)}i.commitRoute()}get fromVertex(){return this.is}set fromVertex(t){this.is!==t&&(this.is=t)}get toVertex(){return this.ss}set toVertex(t){this.ss!==t&&(this.ss=t)}get relativePoint(){return this.xP}set relativePoint(t){this.xP.set(t)}}class be{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 Dt(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 Dt(5)},arrowheads:{toArrow:"Standard"}}}class Ge{hs=new Set;bu=new Mt;bP="light";kP="light";PP=!1;ML=!0;Qg="light";VF=t=>{let e=t.matches?"dark":"light";e!==this.Qg&&(this.Qg=e,this.kP==="system"&&this.updateDiagrams())};constructor(t){t&&Object.assign(this,t),t?.themeMap||(this.bu.set("light",{colors:{...be.Light.colors},fonts:{...be.Light.fonts},numbers:{...be.Light.numbers},margins:{...be.Light.margins},arrowheads:{...be.Light.arrowheads}}),this.bu.set("dark",{colors:{...be.Dark.colors},fonts:{...be.Dark.fonts},numbers:{...be.Dark.numbers},margins:{...be.Dark.margins},arrowheads:{...be.Dark.arrowheads}})),K.matchMedia&&(this.Qg=K.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}get themeMap(){return this.bu}set themeMap(t){this.bu!==t&&(this.bu=t,this.updateDiagrams())}get defaultTheme(){return this.bP}set defaultTheme(t){this.bP!==t&&(m.s(t,"string",Ge,"defaultTheme"),this.bP=t,this.updateDiagrams())}get currentTheme(){return this.kP}set currentTheme(t){this.kP!==t&&(m.s(t,"string",Ge,"currentTheme"),this.kP=t,this.updateDiagrams())}get changesDivBackground(){return this.PP}set changesDivBackground(t){if(this.PP!==t&&(this.PP=t,t))for(let e of this.hs)e.setDivBackground(this.findValue("div","","fill")),e.T("ThemeChanged",this)}get readsCssVariables(){return this.ML}set readsCssVariables(t){this.ML!==t&&(this.ML=t,this.updateDiagrams())}get preferredColorScheme(){return this.Qg}addDiagram(t){return this.hs.add(t),this.NL(t),this}removeDiagram(t){return this.hs.delete(t),this.NL(t),this}tO(){this.hs.size===0&&K.matchMedia&&K.matchMedia("(prefers-color-scheme: dark)")?.addEventListener("change",this.VF)}eO(){this.hs.size===0&&K.matchMedia&&K.matchMedia("(prefers-color-scheme: dark)")?.removeEventListener("change",this.VF)}set(t,e){t===""&&(t=this.bP),t==="system"&&(t=this.Qg);let i=this.bu.get(t);return i?i=this.BF(i,e):i=e,this.bu.set(t,i),this.updateDiagrams(),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 u=h[l];if(u!==""&&(n=n[u],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=Ge.PU.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.Qg:t)}updateDiagrams(){for(let t of this.hs)this.NL(t)}NL(t){let e=t.skipsUndoManager;t.skipsUndoManager=!0,t.updateAllThemeBindings(),this.PP&&t.setDivBackground(this.findValue("div","","fill")),t.skipsUndoManager=e,t.T("ThemeChanged",this)}BF(t,e){for(let i in e)if(m.Yw(e,i))try{e[i]?.constructor===Object?t[i]=this.BF(t[i]??{},e[i]):t[i]=e[i]}catch{delete t[i]}return t}static PU=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 nn{Pt;a;Be;bl;constructor(){this.a=Y.Rm(),this.Pt="",this.Be=!0,this.bl=!0}get name(){return this.Pt}set name(t){this.Pt=t}get isEnabled(){return this.Be}set isEnabled(t){this.Be=t}get isRealtime(){return this.bl}set isRealtime(t){this.bl=t}get diagram(){return this.a}set diagram(t){this.a!==t&&(this.a=t,t.Fl=!0,t.requestUpdate())}invalidateRouter(){this.a!==null&&(this.a.Fl=!0,this.a.requestUpdate())}canRoute(t){if(!this.isEnabled)return!1;let e=this.diagram;return!(e&&(!this.isRealtime&&e.Iu||e.animationManager.isTicking))}isRoutable(t,e){return!0}routeLinks(t,e){}toString(){return this.name!==""?this.name+" Router":m.Gn(this.constructor)}}class _n extends nn{constructor(t){super(),this.name="AvoidsNodes",t&&Object.assign(this,t)}canRoute(t){return(t instanceof Y?t.np:t.diagram?.np)?super.canRoute(t):!1}isRoutable(t,e){return!(!t.isAvoiding||t.containingGroup!==(e instanceof ht?e:null)||t.toNode===null||t.fromNode===null||t.pointsCount<4)}routeLinks(t,e){let i=e instanceof Y?null:e,s=t.iterator,n=this.diagram.getPositions(!0,i,null);for(;s.next();){let o=s.value;if(!this.isRoutable(o,e))continue;o.startRoute();let r=o.pointsCount,a=o.getPoint(1),h=o.getPoint(r-2),l=o.fromNode.actualBounds.copy();l.inflate(j.Fa,j.Fa),l.unionPoint(o.getPoint(0));let u=o.toNode.actualBounds.copy();u.inflate(j.Fa,j.Fa),u.unionPoint(o.getPoint(r-1)),this.SU(o,l,u,n)&&this.MU(o,a,o.kC,h,o.PC,l,u,n),o.commitRoute()}}SU(t,e,i,s){let n=t.diagram,o=t.pointsCount;if(n===null||!t.fromNode||!t.toNode||t.fromNode===t.toNode||!t.layer||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 u=2;u<o-3;u++){let c=t.getPoint(u),d=t.getPoint(u+1);if(!s.isUnoccupied(Math.min(c.x,d.x),Math.min(c.y,d.y),Math.abs(c.x-d.x),Math.abs(c.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))}MU(t,e,i,s,n,o,r,a){let h=t.diagram;if(h===null)return;let l=e,u=s,c=P.gn,d=P.gn;if(h.isVirtualized){let g=a.bounds.copy(),y=t.getPoint(2),b=t.getPoint(t.pointsCount-3);g.inflate(-a.cellWidth,-a.cellHeight);let v=P.l();a.og(e.x,e.y)||(C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,e.x,e.y,y.x,y.y,v)?(c=e=v.copy(),i=v.directionPoint(y)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,y.x,y.y,b.x,b.y,v)?(c=e=v.copy(),i=v.directionPoint(b)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,b.x,b.y,s.x,s.y,v)&&(c=e=v.copy(),i=v.directionPoint(s))),a.og(s.x,s.y)||(C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,s.x,s.y,b.x,b.y,v)?(d=s=v.copy(),n=b.directionPoint(v)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,b.x,b.y,y.x,y.y,v)?(d=s=v.copy(),n=y.directionPoint(v)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,y.x,y.y,e.x,e.y,v)&&(d=s=v.copy(),n=e.directionPoint(v))),P.i(v)}let f=o.copy().unionRect(r);f.inflate(a.cellWidth*a.cf,a.cellHeight*a.cf),a.pv(e,i,s,n,f,!0);let p=a.yo(s.x,s.y);if(!a.Zy&&p>=Ot.ng&&(a.TT(),f.inflate(a.cellWidth*a.I2,a.cellHeight*a.E2),a.pv(e,i,s,n,f,!1),p=a.yo(s.x,s.y)),!a.Zy&&p<Ot.ng&&!a.XE(s.x,s.y)){t.points.removeRange(2,t.pointsCount-3),this.CL(t,a,s.x,s.y,n,!0);let g=0,y=90,b=180,v=270,w=t.getPoint(2);if(t.pointsCount<4)i===g||i===b?(w.x=e.x,w.y=s.y):(w.x=s.x,w.y=e.y),t.setPointAt(2,w.x,w.y),t.insertPointAt(3,w.x,w.y);else{let k=t.getPoint(3);if(i===g||i===b)if(C.c(w.x,k.x)){let S=i===g?Math.max(w.x,e.x):Math.min(w.x,e.x);t.setPointAt(2,S,e.y),t.setPointAt(3,S,k.y)}else C.c(w.y,k.y)?(Math.abs(e.y-w.y)<=a.cellHeight/2&&(t.setPointAt(2,w.x,e.y),t.setPointAt(3,k.x,e.y)),t.insertPointAt(2,w.x,e.y)):t.setPointAt(2,e.x,w.y);else if(i===y||i===v)if(C.c(w.y,k.y)){let S=i===y?Math.max(w.y,e.y):Math.min(w.y,e.y);t.setPointAt(2,e.x,S),t.setPointAt(3,k.x,S)}else C.c(w.x,k.x)?(Math.abs(e.x-w.x)<=a.cellWidth/2&&(t.setPointAt(2,e.x,w.y),t.setPointAt(3,e.x,k.y)),t.insertPointAt(2,e.x,w.y)):t.setPointAt(2,w.x,e.y)}if(c.isReal()){let k=t.getPoint(1),S=t.getPoint(2);k.x!==S.x&&k.y!==S.y?i===g||i===b?t.insertPointAt(2,k.x,S.y):t.insertPointAt(2,S.x,k.y):i===g||i===b?t.insertPointAt(2,l.x,c.y):t.insertPointAt(2,c.x,l.y)}d.isReal()&&(n===g||n===b?t.insertPointAt(t.pointsCount-2,u.x,d.y):t.insertPointAt(t.pointsCount-2,d.x,u.y))}}CL(t,e,i,s,n,o){let r=e.cellWidth,a=e.cellHeight,h=e.yo(i,s),l=i,u=s,c=l,d=u;for(n===0?c+=r:n===90?d+=a:n===180?c-=r:d-=a,t.TC&&h>Ot.nc&&e.yo(c,d)!==h-1&&(e.yo(l-r,u)===h-1?(n=180,c=l-r,d=u):e.yo(l+r,u)===h-1?(n=0,c=l+r,d=u):e.yo(l,u-a)===h-1?(n=270,c=l,d=u-a):e.yo(l,u+a)===h-1&&(n=90,c=l,d=u+a));h>Ot.nc&&e.yo(c,d)===h-1;)l=c,u=d,n===0?c+=r:n===90?d+=a:n===180?c-=r:d-=a,h-=1;if(o?h>Ot.nc&&(n===180||n===0?l=Math.floor(l/r)*r+r/2:(n===90||n===270)&&(u=Math.floor(u/a)*a+a/2)):(l=Math.floor(l/r)*r+r/2,u=Math.floor(u/a)*a+a/2),h>Ot.nc){let f=n,p=l,g=u;if(n===0?(f=90,g+=a):n===90?(f=180,p-=r):n===180?(f=270,g-=a):n===270&&(f=0,p+=r),e.yo(p,g)===h-1)this.CL(t,e,p,g,f,!1);else{let y=l,b=u;n===0?(f=270,b-=a):n===90?(f=0,y+=r):n===180?(f=90,b+=a):n===270&&(f=180,y-=r),e.yo(y,b)===h-1&&this.CL(t,e,y,b,f,!1)}}t.insertPointAt(t.pointsCount-2,l,u)}}ne.prototype.initializeStandardTools=function(){return this.Jt("Action",new Fs,this.mouseDownTools),this.Jt("Relinking",new $e,this.mouseDownTools),this.Jt("LinkReshaping",new Je,this.mouseDownTools),this.Jt("Rotating",new De,this.mouseDownTools),this.Jt("Resizing",new Ze,this.mouseDownTools),this.Jt("Linking",new Le,this.mouseMoveTools),this.Jt("Dragging",new Tt,this.mouseMoveTools),this.Jt("DragSelecting",new ri,this.mouseMoveTools),this.Jt("Panning",new ki,this.mouseMoveTools),this.Jt("ContextMenu",new It,this.mouseUpTools),this.Jt("TextEditing",new oe,this.mouseUpTools),this.Jt("ClickCreating",new Qe,this.mouseUpTools),this.Jt("ClickSelecting",new Ds,this.mouseUpTools),this},Y.d2("GraphLinksModel",Zn),Y.d2("TreeModel",Qn);let Ai=K.go,gi={get version(){return Y.version},Group:ht,List:q,Set:V,Map:Mt,Point:P,Size:st,Rect:I,Margin:Dt,Spot:T,Geometry:wt,PathFigure:zt,PathSegment:mt,InputEvent:Qt,DiagramEvent:wi,ChangedEvent:Xe,Model:ut,GraphLinksModel:Xt,TreeModel:je,Binding:te,ThemeBinding:ii,Transaction:oi,UndoManager:vi,CommandHandler:jt,Tool:$t,DraggingTool:Tt,DraggingInfo:Ke,DraggingOptions:Pi,LinkingBaseTool:ae,LinkingTool:Le,RelinkingTool:$e,LinkReshapingTool:Je,ResizingTool:Ze,RotatingTool:De,ClickSelectingTool:Ds,ActionTool:Fs,ClickCreatingTool:Qe,HTMLInfo:fe,ContextMenuTool:It,DragSelectingTool:ri,PanningTool:ki,TextEditingTool:oe,ToolManager:ne,Animation:ye,AnimationManager:he,AnimationTrigger:ai,Layer:Et,Diagram:Y,Palette:Rn,Overview:hi,Brush:R,GraphObject:J,Panel:G,RowColumnDefinition:Kt,Shape:et,TextBlock:lt,Picture:Bt,Part:pt,Adornment:vt,Node:$,Link:j,Placeholder:le,Layout:_t,LayoutNetwork:Ee,LayoutVertex:Ie,LayoutEdge:ei,GridLayout:Ue,PanelLayout:Lt,CircularLayout:Be,CircularNetwork:Ws,CircularVertex:di,CircularEdge:$s,ForceDirectedLayout:ee,ForceDirectedNetwork:Js,ForceDirectedVertex:Ve,ForceDirectedEdge:fi,LayeredDigraphLayout:Ae,LayeredDigraphNetwork:tn,LayeredDigraphVertex:si,LayeredDigraphEdge:Se,TreeLayout:Vt,TreeNetwork:gs,TreeVertex:Rt,TreeEdge:sn,Themes:be,ThemeManager:Ge,Router:nn,AnimationStyle:Is,AutoScale:Ii,CycleMode:Vs,Flip:Ks,TextFormat:Yi,ImageStretch:ji,LayoutConditions:Gs,LinkAdjusting:Hi,Curve:$i,Routing:Wi,Orientation:Vi,TextOverflow:js,PortSpreading:qs,ScrollMode:zs,CollapsePolicy:Xs,Sizing:zi,TriggerStart:Bs,Stretch:Bi,ViewboxStretch:Us,Wrap:Ki,BrushType:Oe,ColorSpace:Ys,GeometryStretch:Ri,GeometryType:ze,SegmentType:ni,BindingMode:Ci,ChangeType:Ei,CircularArrangement:ts,CircularDirection:es,CircularNodeDiameterFormula:ss,CircularSorting:is,GridAlignment:Zi,GridArrangement:Qi,GridSorting:_i,LayeredDigraphAggressive:as,LayeredDigraphAlign:_s,LayeredDigraphCycleRemove:ns,LayeredDigraphInit:rs,LayeredDigraphLayering:os,LayeredDigraphPack:Qs,TreeAlignment:us,TreeArrangement:fs,TreeCompaction:cs,TreeLayerStyle:en,TreePath:hs,TreeSorting:ls,TreeStyle:ds,GestureMode:As,LinkingDirection:Ts,ReshapingBehavior:Ls,TextEditingAccept:Os,TextEditingStarting:Rs,TextEditingState:Es,WheelMode:Cs};for(let x in gi){let t=gi[x];m.it(t)&&t!==Yi&&(t.className=x)}m.$(Ai)&&Ai.version&&m.ne("WARNING: a `go` object on the root object is already defined. "+("Debug"in Ai?"debug ":"")+"version: "+Ai.version+", replaced with version: "+gi.version),Y.prototype.go=gi,K.go=gi})();var Eo=typeof global<"u"?global.go:self.go,H=typeof global<"u"?global.go:self.go,Io=H.Group,Bo=H.List,Vo=H.Set;var zo=H.Map;var cn=H.Point,pi=H.Size,Xo=H.Rect,ys=H.Margin,Ne=H.Spot,Ko=H.Geometry,Yo=H.PathFigure,Uo=H.PathSegment,jo=H.InputEvent,Go=H.DiagramEvent,qo=H.ChangedEvent,Ho=H.Model,dn=H.GraphLinksModel,Wo=H.TreeModel,$o=H.Binding,Jo=H.ThemeBinding,Zo=H.Transaction,Qo=H.UndoManager,_o=H.CommandHandler,tr=H.Tool,er=H.DraggingTool,ir=H.DraggingInfo,sr=H.DraggingOptions,nr=H.LinkingBaseTool,or=H.LinkingTool,rr=H.RelinkingTool,ar=H.LinkReshapingTool,hr=H.ResizingTool,lr=H.RotatingTool,ur=H.ClickSelectingTool,cr=H.ActionTool,dr=H.ClickCreatingTool,fr=H.HTMLInfo,gr=H.ContextMenuTool,mr=H.DragSelectingTool,pr=H.PanningTool,yr=H.TextEditingTool,xr=H.ToolManager,xs=H.Animation,br=H.AnimationManager,wr=H.AnimationTrigger,vr=H.Layer,Ti=H.Diagram,kr=H.Palette,Pr=H.Overview,Sr=H.Brush,Mr=H.GraphObject,qe=H.Panel,Nr=H.RowColumnDefinition,yi=H.Shape,Li=H.TextBlock,fn=H.Picture,Cr=H.Part,bs=H.Adornment,ws=H.Node,vs=H.Link,gn=H.Placeholder,Ar=H.Layout,Tr=H.LayoutNetwork,Lr=H.LayoutVertex,Dr=H.LayoutEdge,Fr=H.GridLayout,Or=H.PanelLayout,Rr=H.CircularLayout,Er=H.CircularNetwork,Ir=H.CircularVertex,Br=H.CircularEdge,Vr=H.ForceDirectedLayout,zr=H.ForceDirectedNetwork,Xr=H.ForceDirectedVertex,Kr=H.ForceDirectedEdge,mn=H.LayeredDigraphLayout,Yr=H.LayeredDigraphNetwork,Ur=H.LayeredDigraphVertex,jr=H.LayeredDigraphEdge,Gr=H.TreeLayout,qr=H.TreeNetwork,Hr=H.TreeVertex,Wr=H.TreeEdge,$r=H.Themes,Jr=H.ThemeManager,Zr=H.Router,Qr=H.version,_r=H.AnimationStyle,pn=H.AutoScale,ta=H.Curve,ea=H.CycleMode,ia=H.Flip,sa=H.ImageStretch,na=H.LayoutConditions,oa=H.LinkAdjusting,ra=H.Orientation,aa=H.PortSpreading,yn=H.Routing,xn=H.ScrollMode,ha=H.CollapsePolicy,la=H.Sizing,ua=H.TriggerStart,bn=H.Stretch,ca=H.TextFormat,ks=H.TextOverflow,da=H.ViewboxStretch,Ps=H.Wrap,fa=H.BrushType,ga=H.ColorSpace,ma=H.GeometryStretch,pa=H.GeometryType,ya=H.SegmentType,xa=H.BindingMode,ba=H.ChangeType,wa=H.CircularArrangement,va=H.CircularDirection,ka=H.CircularNodeDiameterFormula,Pa=H.CircularSorting,Sa=H.GridAlignment,Ma=H.GridArrangement,Na=H.GridSorting,Ca=H.LayeredDigraphAggressive,Aa=H.LayeredDigraphAlign,Ta=H.LayeredDigraphCycleRemove,La=H.LayeredDigraphInit,Da=H.LayeredDigraphLayering,Fa=H.LayeredDigraphPack,Oa=H.TreeAlignment,Ra=H.TreeArrangement,Ea=H.TreeCompaction,Ia=H.TreeLayerStyle,Ba=H.TreePath,Va=H.TreeSorting,za=H.TreeStyle,Xa=H.GestureMode,Ka=H.LinkingDirection,Ya=H.ReshapingBehavior,Ua=H.TextEditingAccept,ja=H.TextEditingStarting,Ga=H.TextEditingState,wn=H.WheelMode;var eo=on`#filter-bar{background-color:var(--calcite-color-foreground-1);position:absolute;top:16px;right:196px;z-index:100;box-shadow:var(--calcite-shadow-sm)}#filteredViewButtonDiv{padding:8px}#filteredViewButtonLabel{--calcite-label-margin-bottom: 0}#graph-navigation-bar{background-color:var(--calcite-color-foreground-1);position:absolute;top:16px;right:16px;z-index:100}#graph-navigation-controls{position:absolute;top:0;right:0;box-shadow:var(--calcite-shadow-sm)}.z-index-1{z-index:1}#diagram-panel{--calcite-panel-space: 0px}#diagram-shell-panel{--calcite-color-background: var(--calcite-color-foreground-1);padding:16px}`,io=15,so=15,no=10,xi=new pi(220,48),oo=1,ro=8,vn=new pi(48,48),ao=new pi(16,16),kn=new pi(153,17),ho='400 0.75rem "Avenir Next", Avenir, "Helvetica Neue", sans-serif',lo='500 0.75rem "Avenir Next", Avenir, "Helvetica Neue", sans-serif',uo="val(--calcite-color-background)",co=bi("--calcite-color-border-1"),Pn=bi("--calcite-color-foreground-1"),Di=bi("--calcite-color-text-1"),Sn=bi("--calcite-color-border-input"),fo=bi("--calcite-color-foreground-1"),Fi=1,Nn=.3,Ss=1,Cn=.2,go=1;function mo(K){let m=document.createElement("div");m.style.width="100%",m.style.height="100%",K.appendChild(m);let rt=new Ti(m,{click:Po,contentAlignment:Ne.Center,dragSelectingTool:null,hoverDelay:50,initialAutoScale:pn.Uniform,layout:new mn({columnSpacing:io,layerSpacing:so}),padding:no,scrollMode:xn.Infinite,"toolManager.hoverDelay":50,"toolManager.mouseWheelBehavior":wn.Zoom});rt.nodeTemplate=new ws("Auto",{click:So,movable:!1,opacity:Fi,toolTip:new bs("Auto",{isShadowed:!0,margin:new ys(12,16,6,16),padding:0,shadowBlur:16,shadowColor:To(Di,.05),shadowOffset:new cn(0,0)}).add(new qe("Vertical",{background:fo,margin:0}).add(new Li({margin:14,stroke:Di}).bind("text","title")))}).bind("text","title").add(new yi({desiredSize:xi,fill:Pn,geometryString:ko(xi.width,xi.height,ro,vn.width,!!Pn),height:xi.height,portId:"",stroke:co,strokeWidth:oo,width:xi.width})).add(new qe("Horizontal",{alignment:Ne.Left,stretch:bn.Horizontal}).add(new qe("Horizontal",{alignment:Ne.Left,desiredSize:vn,margin:1}).add(new qe("Horizontal",{alignment:Ne.Center,margin:16}).add(new fn({desiredSize:ao}).bind("source","",dt=>un(dt.itemType,dt.itemTypeKeywords)))),new qe("Horizontal",{alignment:Ne.Right,margin:new ys(4,8,0,8)}).add(new qe("Vertical",{}).add(new Li({alignment:Ne.Left,desiredSize:kn,font:lo,overflow:ks.Ellipsis,stroke:Di,wrap:Ps.None}).bind("text","title"),new Li({alignment:Ne.Left,desiredSize:kn,font:ho,overflow:ks.Ellipsis,stroke:Di,wrap:Ps.None}).bind("text","itemTypeForDisplay"))))),rt.commandHandler.zoomFactor=1.05,rt.setDivBackground(uo);let bt=rt.toolManager.clickSelectingTool;bt.standardMouseSelect=function(){};let Pt=rt.toolManager.draggingTool;return Pt.isEnabled=!1,rt.linkTemplate=new vs({corner:5,movable:!1,routing:yn.Orthogonal,selectable:!1}).add(new yi({opacity:Ss,stroke:Sn}),new yi({fill:Sn,opacity:Ss,stroke:null,toArrow:"Standard"})),rt}function He(K,m){K.model=new dn(m.nodes,m.links,{linkFromPortIdProperty:"fromPort",linkToPortIdProperty:"toPort"})}function po(K,m,rt,bt=!0){if(bt){let q=Mo(K,rt);q.addEventListener("calciteSwitchChange",()=>document.dispatchEvent(new CustomEvent("filteredViewChanged",{detail:q.checked})))}let{resetButton:Pt,centerButton:dt,zoomInButton:gt,zoomOutButton:kt}=No(K,rt);Pt.addEventListener("click",()=>Ao(m)),dt.addEventListener("click",()=>m.zoomToFit()),gt.addEventListener("click",()=>m.commandHandler.increaseZoom()),kt.addEventListener("click",()=>m.commandHandler.decreaseZoom())}function yo(K,m,rt){let bt=mo(K);return He(bt,m),po(K,bt,rt),bt}function An(K){let m=new Set,rt=new Set;function bt(dt){dt.findLinksInto().each(gt=>{rt.add(gt);let kt=gt.fromNode;kt&&!m.has(kt)&&(m.add(kt),bt(kt))})}bt(K);function Pt(dt){dt.findLinksOutOf().each(gt=>{rt.add(gt);let kt=gt.toNode;kt&&!m.has(kt)&&(m.add(kt),Pt(kt))})}return Pt(K),{connectedNodes:m,connectedLinks:rt}}function xo(K,m=!1,rt){let bt=[],Pt=K.map(gt=>{if(gt.type!=="Group"){let kt=vo(gt);return wo(gt,kt,m,rt)}else{bt.push(gt.id);return}}).filter(gt=>gt!==void 0),dt=[];return Pt.forEach(gt=>{(K.find(kt=>kt.id===gt.itemId)?.dependencies||[]).forEach(kt=>{let q=Pt.find(Zt=>Zt?.itemId===kt);q&&dt.push({from:q.key,fromSpot:Ne.AllSides,to:gt.key,toSpot:Ne.AllSides})})}),{nodes:Pt,links:dt,groupPseudoNodes:bt}}function bo(K,m,rt,bt=!0){let Pt=K.diagram;if(!Pt)return;let dt={};if(bt){for(let gt of Pt.nodes)dt[gt.key]=gt===K?Fi:Nn;for(let gt of Pt.links){let kt=`${gt.fromNode?.key}-${gt.toNode?.key}`;dt[kt]=Cn}{let{connectedNodes:gt,connectedLinks:kt}=An(K);for(let q of gt)dt[q.key]=Fi;for(let q of kt){let Zt=`${q.fromNode?.key}-${q.toNode?.key}`;dt[Zt]=go}}}if(rt&&(rt.adornedObject=K),bt){let gt=new xs;gt.duration=1;for(let kt of Pt.nodes)gt.add(kt,"opacity",kt.opacity,dt[kt.key]);for(let kt of Pt.links){let q=`${kt.fromNode?.key}-${kt.toNode?.key}`;gt.add(kt,"opacity",kt.opacity,dt[q])}gt.start()}}function Mn(K,m,rt,bt,Pt=!0){if(K.length===0)return;let dt=m[0].diagram;if(!dt)return;let gt={};if(Pt){for(let kt of dt.nodes){let q=K.includes(kt.key);gt[kt.key]=!rt||q?Fi:Nn}for(let kt of dt.links){let q=`${kt.fromNode?.key}-${kt.toNode?.key}`;gt[q]=rt?Cn:Ss}}if(Object.keys(bt).forEach(kt=>{bt[kt].adornedObject=null}),Pt){let kt=new xs;kt.duration=1;for(let q of dt.nodes)kt.add(q,"opacity",q.opacity,gt[q.key]);for(let q of dt.links){let Zt=`${q.fromNode?.key}-${q.toNode?.key}`;kt.add(q,"opacity",q.opacity,gt[Zt])}kt.start()}}function wo(K,m,rt=!1,bt){return{key:m,title:K.title,itemId:K.id,itemType:K.type,itemTypeForDisplay:Co(K.type,K.typeKeywords),itemTypeKeywords:K.typeKeywords,group:K.type,url:rt?`${bt}?id=${K.id}`:void 0}}function vo(K){return K.id}function ko(K,m,rt,bt=0,Pt=!1){let dt="";Pt&&(dt+="F");let gt=K-2*rt,kt=m-2*rt;return dt+=" M0 0",dt+=` h${gt}`,dt+=` a${rt} ${rt} 0 0 1 ${rt} ${rt}`,dt+=` v${kt}`,dt+=` a${rt} ${rt} 0 0 1 ${-rt} ${rt}`,dt+=` h${-gt}`,dt+=` a${rt} ${rt} 0 0 1 ${-rt} ${-rt}`,dt+=` v${-kt}`,dt+=` a${rt} ${rt} 0 0 1 ${rt} ${-rt}`,bt>0&&(dt+=` M${bt-rt} 0 v${m}`),dt}function Po(){document.dispatchEvent(new CustomEvent("clickInDiagram"))}function So(K,m){let rt=m.part;rt instanceof ws&&(rt.selectionAdorned=!1,document.dispatchEvent(new CustomEvent("clickOnNode",{detail:rt})))}function Mo(K,m){let rt=document.createElement("calcite-switch");rt.id="filteredViewButton",rt.label=m.filteredView;let bt=document.createElement("calcite-label");bt.id="filteredViewButtonLabel",bt.setAttribute("layout","inline"),bt.innerHTML=m.filteredView,bt.appendChild(rt);let Pt=document.createElement("div");Pt.id="filteredViewButtonDiv",Pt.appendChild(bt);let dt=document.createElement("calcite-action-bar");dt.id="filter-bar-controls",dt.layout="horizontal",dt.expandDisabled=!0,dt.appendChild(Pt);let gt=document.createElement("div");return gt.id="filter-bar",K.appendChild(gt),gt.appendChild(dt),rt}function No(K,m){let rt=document.createElement("calcite-action");rt.icon="reset",rt.id="showHideGrayedOutButton";let bt=document.createElement("calcite-tooltip");bt.id="resetButtonTooltip",bt.innerHTML=m.reset,bt.overlayPositioning="fixed",bt.placement="bottom",bt.referenceElement=rt.id;let Pt=document.createElement("calcite-action");Pt.icon="zoom-to-object",Pt.id="centerButton";let dt=document.createElement("calcite-tooltip");dt.id="centerButtonTooltip",dt.innerHTML=m.centerDiagram,dt.overlayPositioning="fixed",dt.placement="bottom",dt.referenceElement=Pt.id;let gt=document.createElement("calcite-action");gt.icon="plus",gt.id="zoomInButton";let kt=document.createElement("calcite-tooltip");kt.id="zoomInButtonTooltip",kt.innerHTML=m.zoomIn,kt.overlayPositioning="fixed",kt.placement="bottom",kt.referenceElement=gt.id;let q=document.createElement("calcite-action");q.appearance="solid",q.icon="minus",q.id="zoomOutButton";let Zt=document.createElement("calcite-tooltip");Zt.id="zoomOutButtonTooltip",Zt.innerHTML=m.zoomOut,Zt.overlayPositioning="fixed",Zt.placement="bottom",Zt.referenceElement=q.id;let V=document.createElement("calcite-action-bar");V.id="graph-navigation-controls",V.layout="horizontal",V.expandDisabled=!0,V.appendChild(rt),V.appendChild(bt),V.appendChild(Pt),V.appendChild(dt),V.appendChild(gt),V.appendChild(kt),V.appendChild(q),V.appendChild(Zt);let We=document.createElement("div");return We.id="graph-navigation-bar",K.appendChild(We),We.appendChild(V),{resetButton:rt,centerButton:Pt,zoomInButton:gt,zoomOutButton:q}}function Co(K,m){let rt=K;if(K==="Feature Service"){let bt=m.indexOf("View Service")>-1,Pt=m.indexOf("Table")>-1;rt=bt&&Pt?"Table (hosted, view)":Pt?"Table (hosted)":bt?"Feature Layer (hosted, view)":"Feature Layer (hosted)"}return K==="Web Mapping Application"&&(rt=m.indexOf("configurableApp")>-1?"Instant App":rt),rt=K==="Geoprocessing Service"?"Tool":rt,rt=K==="Feed"?"Feed (hosted)":rt,rt=K==="Real Time Analytic"?"Real Time Analytic (hosted)":rt,rt=K==="Big Data Analytic"?"Big Data Analytic (hosted)":rt,rt=K==="Vector Tile Service"?"Tile Layer":rt,rt}function Ao(K){K.zoomToFit(),document.dispatchEvent(new CustomEvent("reset"))}function bi(K){let m=document.body;return getComputedStyle(m).getPropertyValue(K).trim()}function To(K,m){if(K=K.replace(/^#/,""),K.length===3&&(K=K.split("").map(dt=>dt+dt).join("")),K.length!==6)throw new Error("Invalid hex color");let rt=parseInt(K.slice(0,2),16),bt=parseInt(K.slice(2,4),16),Pt=parseInt(K.slice(4,6),16);return`rgba(${rt}, ${bt}, ${Pt}, ${m})`}var Lo=8,Do=15,Fo=Ro("--calcite-color-brand"),Oo=4;function Ro(K){let m=document.documentElement;return getComputedStyle(m).getPropertyValue(K).trim()}var Ms=class{constructor(m,rt,bt,Pt){this.indexPanel=m,this.diagramPanel=rt,this.diagramTranslations=bt,this.diagramKey=Pt,this.currentSelectedGroupId="",this.currentSelectedItemId="",this.diagramNeedsRedraw=!1,this.usefilteredView=!1,this.handle_clickInDiagram=dt=>{dt.stopImmediatePropagation(),(this.currentSelectedGroupId||this.currentSelectedItemId)&&(this.currentSelectedGroupId="",this.currentSelectedItemId="",this.diagramNeedsRedraw=this.usefilteredView,this.redraw())},this.handle_clickOnNode=dt=>{dt.stopImmediatePropagation();let gt=dt.detail.data.key;this.redraw(gt,gt===this.currentSelectedItemId)},this.handle_filteredViewChanged=dt=>{this.usefilteredView=dt.detail,this.diagramNeedsRedraw=!!this.currentSelectedGroupId||!!this.currentSelectedItemId,this.redraw(this.currentSelectedItemId||this.currentSelectedGroupId)},this.handle_reset=dt=>{dt.stopImmediatePropagation(),this.reset()},this.handle_solutionItemSelect=dt=>{dt.stopImmediatePropagation();let gt=dt.detail.itemId;this.redraw(gt,gt===this.currentSelectedItemId||gt===this.currentSelectedGroupId,!1)},Ti.licenseKey===""&&(Ti.licenseKey=Pt??"")}create(m,rt){this.collection=m,this.index=document.createElement("solution-item-accordion"),this.index.linkType="action",this.index.listSelectionMode="single",this.index.typeKeywords=rt,this.index.style.overflowY="auto",this.indexPanel.appendChild(this.index),this.index.templateInfos=m,this.allNodesAndLinks=xo(m),this.diagram=yo(this.diagramPanel,this.allNodesAndLinks,this.diagramTranslations),this.diagram.addDiagramListener("LayoutCompleted",()=>{setTimeout(()=>{this.diagram.zoomToFit()},1e3)}),vs.setRoutingParameter(44,600942),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(m=!0){this.index.deselectAll(),m&&this.index.collapseAll();let rt=this.getNodesFromDiagram(this.diagram),bt=rt.map(Pt=>Pt.data.key);Mn(bt,rt,!1,this.diagramNodeHighlighterIndex)}createNodeHighlighters(){this.diagramNodeIndex={},this.diagramNodeHighlighterIndex={},this.getNodesFromDiagram(this.diagram).forEach(m=>{this.diagramNodeIndex[m.data.key]=m;let rt=new bs("Auto",{background:"transparent",margin:2});rt.add(new yi("RoundedRectangle",{fill:"transparent",parameter1:Lo,parameter2:Do,stroke:Fo,strokeWidth:Oo})),rt.add(new gn({margin:1})),this.diagramNodeHighlighterIndex[m.data.key]=rt})}getNodeById(m){return this.diagramNodeIndex[m]}getNodesFromDiagram(m){let rt=[],bt=m.nodes.iterator;for(;bt.next();)rt.push(bt.value);return rt}redraw(m="",rt=!1,bt=!0){let Pt=this.allNodesAndLinks.groupPseudoNodes.includes(m);this.diagramNeedsRedraw&&(He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),this.diagramNeedsRedraw=!1);let dt=!1;if(this.clearSelections(bt),!!m){if(Pt){if(this.currentSelectedItemId="",this.currentSelectedGroupId!==m?this.currentSelectedGroupId=m:rt&&(this.currentSelectedGroupId=this.currentSelectedGroupId?"":m,dt=this.usefilteredView&&!this.currentSelectedGroupId),this.currentSelectedGroupId){this.usefilteredView&&(He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters());let gt=this.collection.filter(q=>q.id===m)[0],kt=gt.dependencies.map(q=>this.diagramNodeIndex[q]);if(this.usefilteredView){let q=kt.map(Zt=>Zt.data);He(this.diagram,{nodes:q,links:[]})}else Mn(gt.dependencies,kt,!0,this.diagramNodeHighlighterIndex);this.index.selectItem(this.currentSelectedGroupId)}}else{this.currentSelectedGroupId="",this.currentSelectedItemId!==m?this.currentSelectedItemId=m:rt&&(this.currentSelectedItemId=this.currentSelectedItemId?"":m,dt=this.usefilteredView&&!this.currentSelectedItemId);let gt=this.getNodeById(m);if((!gt||this.usefilteredView)&&(He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),gt=this.getNodeById(m),!gt))return;if(this.currentSelectedItemId){if(this.usefilteredView){let kt=An(gt);kt.connectedNodes.add(gt);let q=Array.from(kt.connectedNodes).map(V=>V.data),Zt=Array.from(kt.connectedLinks).map(V=>V.data);if(He(this.diagram,{nodes:q,links:Zt}),this.createNodeHighlighters(),gt=this.getNodeById(m),!gt)return}gt&&setTimeout(()=>bo(gt,!0,this.diagramNodeHighlighterIndex[m]),1),this.index.selectItem(this.currentSelectedItemId)}}dt&&this.reset()}}reset(){this.diagramNeedsRedraw=!1,this.currentSelectedGroupId="",this.currentSelectedItemId="",He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),this.clearSelections()}},Ns=class extends an{constructor(){super(...arguments),this.diagramKey="",this.templateInfoGraph=[],this.typeKeywords=[],this._diagramPanel=ms(),this._diagramShell=ms(),this._translations=ln({name:"solution-item-diagram",blocking:!0})}static{this.properties={diagramKey:1,templateInfoGraph:0,typeKeywords:0,_diagramPanel:16,_diagramShell:16,_translations:16}}static{this.styles=eo}updated(){if(this.solutionDisplay&&(this.solutionDisplay.dispose(),this.solutionDisplay=void 0),this.templateInfoGraph.length>0){let m={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 Ms(this._diagramShell.value,this._diagramPanel.value,m,this.diagramKey),this.solutionDisplay.create(this.templateInfoGraph,this.typeKeywords)}requestAnimationFrame(()=>this._preventDiagramScrollbars())}disconnectedCallback(){super.disconnectedCallback(),this.solutionDisplay&&(this.solutionDisplay.dispose(),this.solutionDisplay=void 0)}render(){return rn`<calcite-shell><calcite-shell-panel id=diagram-shell-panel slot=panel-start ${ps(this._diagramShell)}></calcite-shell-panel><calcite-panel class="z-index-1" id=diagram-panel slot=panel-bottom ${ps(this._diagramPanel)}></calcite-panel></calcite-shell>`}_preventDiagramScrollbars(){if(!this._diagramPanel.value)return;let m=this._diagramPanel.value.shadowRoot;if(!m)return;let rt=m.querySelector(".content-wrapper");rt instanceof HTMLElement&&(rt.style.overflow="hidden")}};hn("solution-item-diagram",Ns);export{Ns as SolutionItemDiagram};
|
|
50
|
+
"nodeParentKeyProperty": `+this.quote(this.nodeParentKeyProperty)),t+e}aw(t){super.aw(t),t.nodeParentKeyProperty&&(this.nodeParentKeyProperty=t.nodeParentKeyProperty)}hw(t){t.nodeParentKeyProperty!==void 0&&t.nodeParentKeyProperty!==this.nodeParentKeyProperty&&m.o("applyIncrementalJson cannot change Model properties"),super.hw(t)}maybeEnsureLinkReference(t){return t}get nodeParentKeyProperty(){return this.Sl}set nodeParentKeyProperty(t){let e=this.Sl;e!==t&&(this.En(t,je,"nodeParentKeyProperty"),this.Sl=t,this.t("nodeParentKeyProperty",e,t))}getParentKeyForNodeData(t){if(t===null)return;let e=this.Sl;if(e==="")return;let i=this.Lt(t,e);if(i!==void 0){if(this.isKeyType(i))return i;m.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)&&m.si(e,"number or string",je,"setParentKeyForNodeData:key"),t===null)return;let i=this.Sl;if(i==="")return;if(e=this.maybeEnsureLinkReference(e),!this.containsNodeData(t)){this.nt(t,i,e);return}let s=this.Lt(t,i);s!==e&&(this.ln(s,t),this.nt(t,i,e),this.findNodeDataForKey(e)===null&&this.an(e,t),this.Ft("nodeParentKey",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}get parentLinkCategoryProperty(){return this.fc}set parentLinkCategoryProperty(t){let e=this.fc;e!==t&&(this.En(t,je,"parentLinkCategoryProperty"),this.fc=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.fc;if(e==="")return"";let i=this.Lt(t,e);if(i===void 0)return"";if(typeof i=="string")return i;m.o("getParentLinkCategoryForNodeData found a non-string category for "+t+": "+i)}getLinkCategoryForData(t){return this.getParentLinkCategoryForNodeData(t)}setParentLinkCategoryForNodeData(t,e){if(m.s(e,"string",je,"setParentLinkCategoryForNodeData:cat"),t===null)return;let i=this.fc;if(i==="")return;if(!this.containsNodeData(t)){this.nt(t,i,e);return}let s=this.Lt(t,i);s===void 0&&(s=""),s!==e&&(this.nt(t,i,e),this.Ft("parentLinkCategory",2,i,t,s,e),typeof i=="string"&&this.updateTargetBindings(t,i))}setLinkCategoryForData(t,e){this.setParentLinkCategoryForNodeData(t,e)}copyNodeData(t){let e=super.copyNodeData(t);return this.setParentKeyForNodeData(e,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.Lt(t,e);s!==i&&(this.nt(t,e,i),this.raiseDataChanged(t,e,s,i))}cw(t,e){super.cw(t,e);let i=this.be.iterator;for(;i.next();){let s=i.value;this.rL(s,t,e)}}rL(t,e,i){if(this.getParentKeyForNodeData(t)===e){let s=this.Sl;this.nt(t,s,i),this.Ft("nodeParentKey",2,s,t,e,i),typeof s=="string"&&this.updateTargetBindings(t,s)}}Dg(t){super.Dg(t);let e=this.getKeyForNodeData(t),i=this.iw(e);if(i!==null){let s=m.st(),n=i.iterator;for(;n.next();){let o=n.value;if(this.containsNodeData(o)&&this.getParentKeyForNodeData(o)===e){let r=this.Sl;this.Ft("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.ln(e,s[o]);m.Z(s)}}vg(t){super.vg(t);let e=this.getParentKeyForNodeData(t);e=this.maybeEnsureLinkReference(e),this.findNodeDataForKey(e)===null&&this.an(e,t)}fw(t){super.fw(t);let e=this.getParentKeyForNodeData(t);this.ln(e,t)}Tg(t,e){super.Tg(t,e),this.setParentLinkCategoryForNodeData(e,this.getParentLinkCategoryForNodeData(t)),this.setParentKeyForNodeData(e,this.getParentKeyForNodeData(t))}get type(){return"TreeModel"}Nx(){return!0}Cx(){return!0}}ut.kl(je,"TreeModel");var ts=(x=>(x[x.ConstantSpacing=0]="ConstantSpacing",x[x.ConstantDistance=1]="ConstantDistance",x[x.ConstantAngle=2]="ConstantAngle",x[x.Packed=3]="Packed",x))(ts||{}),es=(x=>(x[x.Clockwise=10]="Clockwise",x[x.Counterclockwise=11]="Counterclockwise",x[x.BidirectionalLeft=12]="BidirectionalLeft",x[x.BidirectionalRight=13]="BidirectionalRight",x))(es||{}),is=(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))(is||{}),ss=(x=>(x[x.Pythagorean=30]="Pythagorean",x[x.Circular=31]="Circular",x))(ss||{});class Be extends _t{gi;tu;Ok;Fg;Ik;Ya;lL;aL;hL;Is;uw;dw;uc;gw;eF;Rg;Og;Ig;eu;He;P;Si;Mi;In;Eg;constructor(t){super(),this.gi=0,this.tu=0,this.Ok=0,this.Fg=360,this.Ik=0,this.Ya=0,this.lL=new P,this.aL=30,this.hL=0,this.Is=0,this.uw=0,this.dw=new Hs,this.uc=0,this.gw=0,this.eF=600,this.Rg=NaN,this.Og=1,this.Ig=0,this.eu=360,this.He=0,this.P=10,this.Si=24,this.Mi=Ie.standardComparer,this.In=6,this.Eg=30,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Rg=this.Rg,t.Og=this.Og,t.Ig=this.Ig,t.eu=this.eu,t.He=this.He,t.P=this.P,t.Si=this.Si,t.Mi=this.Mi,t.In=this.In,t.Eg=this.Eg}fe(t){t in is?this.sorting=t:t in es?this.direction=t:t in ts?this.arrangement=t:t in ss?this.nodeDiameterFormula=t:super.fe(t)}createNetwork(){return new Ws(this)}u3(t,e,i){t=this.d3(t);let s=this.Ik,n=this.aL,o=this.gi,r=this.tu,a=this.Ok,h=this.Fg,l=this.Ya,u=this.hL,c=this.Is,d=this.uw;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 g=0;!(g>=t.length||(e.add(t.elt(g)),g+1>=t.length));g+=2)i.add(t.elt(g+1));this.direction===12?(this.arrangement===3&&e.reverse(),t=new q,t.addAll(e),t.addAll(i)):(this.arrangement===3&&i.reverse(),t=new q,t.addAll(i),t.addAll(e))}let f=t.length;u=0;let p=0;for(let g=0;g<t.length;g++){let y=a+h*p*(this.direction===10?1:-1)/f,b=t.elt(g).diameter;isNaN(b)&&(b=t.elt(g).Ka(y)),h<360&&(g===0||g===t.length-1)&&(b/=2),u+=b,p++}if(isNaN(o)||s===3){if(isNaN(l)&&(l=6),s!==0&&s!==3){let g=-1/0;for(let y=0;y<f;y++){let b=t.elt(y),v=t.elt(y===f-1?0:y+1);isNaN(b.diameter)&&b.Ka(0),isNaN(v.diameter)&&v.Ka(0),g=Math.max(g,(b.diameter+v.diameter)/2)}if(d=g+l,s===2){let y=2*Math.PI/f,b=(g+l)/y;r>1?(o=b,c=o*r):(c=b,o=c)}else o=this.Ek(d*(h>=360?f:f-1),r,a*Math.PI/180,h*Math.PI/180)}else o=this.Ek(u+(h>=360?f:f-1)*(s!==3?l:l*1.6),r,a*Math.PI/180,h*Math.PI/180);c=o*r}else{c=o*r;let g=this.cL(o,c,a*Math.PI/180,h*Math.PI/180);if(isNaN(l))s===0&&(l=(g-u)/(h>=360?f:f-1));else if(s===0){let y=(g-u)/(h>=360?f:f-1);y<l?(o=this.Ek(u+l*(h>=360?f:f-1),r,a*Math.PI/180,h*Math.PI/180),c=o*r):l=y}else{let y=-1/0;for(let w=0;w<f;w++){let k=t.elt(w),S=t.elt(w===f-1?0:w+1);isNaN(k.diameter)&&k.Ka(0),isNaN(S.diameter)&&S.Ka(0),y=Math.max(y,(k.diameter+S.diameter)/2)}let b=y+l,v=this.Ek(b*(h>=360?f:f-1),r,a*Math.PI/180,h*Math.PI/180);v>o?(o=v,c=o*r,d=b):d=g/(h>=360?f:f-1)}}return this.Ik=s,this.aL=n,this.gi=o,this.tu=r,this.Ok=a,this.Fg=h,this.Ya=l,this.hL=u,this.Is=c,this.uw=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 q;i.addAll(e.iterator);let s=new q,n=new q;i=this.u3(i,s,n);let o=this.Ik,r=this.gi,a=this.Ok,h=this.Fg,l=this.Ya,u=this.Is,c=this.uw;if((this.direction===12||this.direction===13)&&o===3)this.iF(i,h,a-h/2,10);else if(this.direction===12||this.direction===13){let d=0;switch(o){case 1:d=this.Uk(r,u,a,c)*180/Math.PI;break;case 0:{let f=0,p=0,g=s.first();g!==null&&(f=g.Ka(Math.PI/2));let y=n.first();y!==null&&(p=y.Ka(Math.PI/2)),d=this.Uk(r,u,a,l+(f+p)/2)*180/Math.PI;break}case 2:d=h/i.length;break}if(this.direction===12){switch(o){case 1:this.mw(s,h/2,a,11);break;case 0:this.pw(s,h/2,a,11);break;case 2:this.yw(s,h/2,a,11);break}switch(o){case 1:this.mw(n,h/2,a+d,10);break;case 0:this.pw(n,h/2,a+d,10);break;case 2:this.yw(n,h/2,a+d,10);break}}else{switch(o){case 1:this.mw(n,h/2,a,11);break;case 0:this.pw(n,h/2,a,11);break;case 2:this.yw(n,h/2,a,11);break}switch(o){case 1:this.mw(s,h/2,a+d,10);break;case 0:this.pw(s,h/2,a+d,10);break;case 2:this.yw(s,h/2,a+d,10);break}}}else switch(o){case 1:this.mw(i,h,a,this.direction);break;case 0:this.pw(i,h,a,this.direction);break;case 2:this.yw(i,h,a,this.direction);break;case 3:this.iF(i,h,a,this.direction);break}this.updateParts(),this.network=null,this.isValidLayout=!0}yw(t,e,i,s){let n=this.Fg,o=this.gi,r=this.Is,a=i*Math.PI/180,h=e*Math.PI/180,l=t.length;for(let u=0;u<l;u++){let c=a+(s===10?u*h/(n>=360?l:l-1):-(u*h)/l),d=t.elt(u),f=o*Math.tan(c)/r,p=Math.sqrt((o*o+r*r*f*f)/(1+f*f));d.centerX=p*Math.cos(c),d.centerY=p*Math.sin(c),d.actualAngle=c*180/Math.PI}}pw(t,e,i,s){let n=this.gi,o=this.Is,r=this.Ya,a=i*Math.PI/180,h=t.length;for(let l=0;l<h;l++){let u=t.elt(l),c=t.elt(l===h-1?0:l+1),d=n*Math.cos(a),f=o*Math.sin(a);u.centerX=d,u.centerY=f,u.actualAngle=a*180/Math.PI,isNaN(u.diameter)&&u.Ka(0),isNaN(c.diameter)&&c.Ka(0);let p=(u.diameter+c.diameter)/2,g=this.Uk(n,o,s===10?a:-a,p+r);a+=s===10?g:-g}}mw(t,e,i,s){let n=this.gi,o=this.Is,r=this.uw,a=i*Math.PI/180,h=t.length;for(let l=0;l<h;l++){let u=t.elt(l);u.centerX=n*Math.cos(a),u.centerY=o*Math.sin(a),u.actualAngle=a*180/Math.PI;let c=this.Uk(n,o,s===10?a:-a,r);a+=s===10?c:-c}}iF(t,e,i,s){let n=this.gw,o=this.Fg;if(this.uc=0,this.dw=new Hs,e<360){for(n=i+(s===10?o:-o);n<0;)n+=360;n%=360,n>180&&(n-=360),n*=Math.PI/180,this.gw=n,this.sF(t,e,i,s)}else this.nF(t,e,i,s);this.dw.commit(t)}nF(t,e,i,s){let n=this.gi,o=this.Is,r=this.Ya,a=this.tu,h=n*Math.cos(i*Math.PI/180),l=o*Math.sin(i*Math.PI/180),u=t.toArray();if(u.length===3){u[0].centerX=n,u[0].centerY=0,u[1].centerX=u[0].centerX-u[0].width/2-u[1].width/2-r,u[1].y=u[0].y,u[2].centerX=(u[0].centerX+u[1].centerX)/2,u[2].y=u[0].y-u[2].height-r;return}else if(u.length===4){u[0].centerX=n,u[0].centerY=0,u[2].centerX=-u[0].centerX,u[2].centerY=u[0].centerY,u[1].centerX=0,u[1].y=Math.min(u[0].y,u[2].y)-u[1].height-r,u[3].centerX=0,u[3].y=Math.max(u[0].y+u[0].height+r,u[2].y+u[2].height+r);return}let c=P.l();for(let k=0;k<u.length&&(u[k].centerX=h,u[k].centerY=l,!(k>=u.length-1));k++)this.oF(h,l,u,k,s,c)||this.rF(h,l,u,k,s,c),h=c.x,l=c.y;if(P.i(c),this.uc++,this.uc>23)return;let d=u[0].centerX,f=u[0].centerY,p=u[u.length-1].centerX,g=u[u.length-1].centerY,y=Math.abs(d-p)-((u[0].width+u[u.length-1].width)/2+r),b=Math.abs(f-g)-((u[0].height+u[u.length-1].height)/2+r),v=0;if(Math.abs(b)<1){let k=Math.abs(d-p),S=(u[0].width+u[u.length-1].width)/2;k<S&&(v=0),y=k-S}else b>0?v=b:Math.abs(y)<1?v=0:v=y;let w=!1;Math.abs(p)>Math.abs(g)?w=p>0!=f>g:w=g>0!=d<p,w=s===10?w:!w,w&&(v=-Math.abs(v),v=Math.min(v,-u[u.length-1].width),v=Math.min(v,-u[u.length-1].height)),this.dw.g3(v,u),Math.abs(v)>1&&(this.uc<8?this.gi-=v/(2*Math.PI):u.length<5&&v>10?this.gi/=2:this.gi-=v>0?1.7:-2.3,this.Is=this.gi*a,this.nF(t,e,i,s))}sF(t,e,i,s){let n=this.gi,o=this.Is,r=this.tu,a=n*Math.cos(i*Math.PI/180),h=o*Math.sin(i*Math.PI/180),l=P.l(),u=t.toArray();for(let p=0;p<u.length&&(u[p].centerX=a,u[p].centerY=h,!(p>=u.length-1));p++)this.oF(a,h,u,p,s,l)||this.rF(a,h,u,p,s,l),a=l.x,h=l.y;if(P.i(l),this.uc++,this.uc>23)return;let c=Math.atan2(h,a),d=s===10?this.gw-c:c-this.gw;d=Math.abs(d)<Math.abs(d-2*Math.PI)?d:d-2*Math.PI;let f=d*(n+o)/2;this.dw.m3(f,u),Math.abs(f)>1&&(this.uc<8?this.gi-=f/(2*Math.PI):this.gi-=f>0?1.7:-2.3,this.Is=this.gi*r,this.sF(t,e,i,s))}oF(t,e,i,s,n,o){let r=this.Ya,a=this.gi,h=this.Is,l=0,u=0,c=(i[s].width+i[s+1].width)/2+r,d=!1;if(e>=0!=(n===10)){if(l=t+c,l>a){if(l=t-c,l<-a)return o.x=l,o.y=u,!1;d=!0}}else if(l=t-c,l<-a){if(l=t+c,l>a)return o.x=l,o.y=u,!1;d=!0}return u=Math.sqrt(1-Math.min(1,l*l/(a*a)))*h,e<0!==d&&(u=-u),Math.abs(e-u)>(i[s].height+i[s+1].height)/2?(o.x=l,o.y=u,!1):(o.x=l,o.y=u,!0)}rF(t,e,i,s,n,o){let r=this.Ya,a=this.gi,h=this.Is,l=0,u=0,c=(i[s].height+i[s+1].height)/2+r,d=!1;if(t>=0!=(n===10)){if(u=e-c,u<-h){if(u=e+c,u>h)return o.x=l,o.y=u,!1;d=!0}}else if(u=e+c,u>h){if(u=e-c,u<-h)return o.x=l,o.y=u,!1;d=!0}return l=Math.sqrt(1-Math.min(1,u*u/(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=u,!1):(o.x=l,o.y=u,!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;if(t?i=new P(0,0):(i.x=this.arrangementOrigin.x+this.gi,i.y=this.arrangementOrigin.y+this.Is),this.network!==null){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&&e){this.group.ensureBounds();let s=this.group.position.copy(),n=this.group.location.copy(),o=e.subtract(n.subtract(s));this.group.move(o),this.lL=o.subtract(s)}}commitLinks(){if(this.network!==null){let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}}cL(t,e,i,s){let n=this.eF;if(Math.abs(this.tu-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 u=Math.sin(h);r+=Math.sqrt(1-o*o*u*u)*a}return i!==void 0&&s!==void 0?(t>e?t:e)*r:4*(t>e?t:e)*r}Ek(t,e,i,s){let n=0;return i!==void 0&&s!==void 0?n=this.cL(1,e,i,s):n=this.cL(1,e),t/n}Uk(t,e,i,s){if(Math.abs(this.tu-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}}d3(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.p3(this.y3(t));default:m.o("Invalid sorting type.")}return t}y3(t){let e=[];for(let s=0;s<t.length;s++)e.push(0);let i=new q;for(let s=0;s<t.length;s++){let n=-1,o=-1;if(s===0)for(let u=0;u<t.length;u++){let c=t.elt(u).edgesCount;c>n&&(n=c,o=u)}else for(let u=0;u<t.length;u++){let c=e[u];c>n&&(n=c,o=u)}i.add(t.elt(o)),e[o]=-1;let r=t.elt(o),a=0,h=r.sourceEdges;for(;h.next();){let u=h.value.fromVertex;a=t.indexOf(u),!(a<0)&&e[a]>=0&&e[a]++}let l=r.destinationEdges;for(;l.next();){let u=l.value.toVertex;a=t.indexOf(u),!(a<0)&&e[a]>=0&&e[a]++}}return i}p3(t){let e=[];for(let c=0;c<t.length;c++){let d=t.elt(c);e[c]=[];let f=0,p=d.destinationEdges;for(;p.next();){let y=p.value.toVertex;f=t.indexOf(y),f!==c&&e[c].indexOf(f)<0&&e[c].push(f)}let g=d.sourceEdges;for(;g.next();){let y=g.value.fromVertex;f=t.indexOf(y),f!==c&&e[c].indexOf(f)<0&&e[c].push(f)}}let i=[];for(let c=0;c<e.length;c++)i[c]=0;let s=[],n=[],o=[],r=[],a=new q,h=0;for(let c=0;c<e.length;c++){let d=e[c].length;if(d===1){r.push(c);continue}if(d===0){a.add(t.elt(c));continue}if(h===0){s.push(c),h++;continue}let f=1/0,p=1/0,g=-1,y=[];for(let b=0;b<s.length;b++)e[s[b]].indexOf(s[b===s.length-1?0:b+1])<0&&y.push(b===s.length-1?0:b+1);if(y.length===0)for(let b=0;b<s.length;b++)y.push(b);for(let b=0;b<y.length;b++){let v=y[b],w=this.w3(e[c],n,o,i,v,s),k=0;for(let S=0;S<e[c].length;S++){let N=e[c][S],D=s.indexOf(N);if(D>=0){let L=Math.abs(v-(D>=v?D+1:D));k+=L<s.length+1-L?L:s.length+1-L}}for(let S=0;S<n.length;S++){let N=i[n[S]],D=i[o[S]];if(N>=v&&N++,D>=v&&D++,N>D){let L=D;D=N,N=L}D-N<(s.length+2)/2==(N<v&&v<=D)&&k++}(w<f||w===f&&k<p)&&(f=w,p=k,g=v)}s.splice(g,0,c);for(let b=0;b<s.length;b++)i[s[b]]=b;for(let b=0;b<e[c].length;b++){let v=e[c][b];s.indexOf(v)>=0&&(n.push(c),o.push(v))}h++}let l=!1,u=s.length;for(;;){l=!0;for(let c=0;c<r.length;c++){let d=r[c],f=e[d][0],p=s.indexOf(f);if(p>=0){let g=0;for(let y=0;y<e[f].length;y++){let b=e[f][y],v=s.indexOf(b);if(v<0||v===p)continue;let w=v>p?v-p:p-v,k=u-w;g+=v<p!=w>k?1:-1}s.splice(g<0?p:p+1,0,d),r.splice(c,1),c--}else l=!1}if(l)break;s.push(r[0]),r.splice(0,1)}for(let c=0;c<s.length;c++){let d=s[c];a.add(t.elt(d))}return a}w3(t,e,i,s,n,o){let r=0;for(let a=0;a<e.length;a++){let h=e[a],l=i[a],u=s[h],c=s[l],d=0,f=0;if(u<c?(d=u,f=c):(d=c,f=u),d<n&&n<=f)for(let p=0;p<t.length;p++){let g=t[p];o.indexOf(g)<0||d<s[g]&&s[g]<f||d===s[g]||f===s[g]||r++}else for(let p=0;p<t.length;p++){let g=t[p];o.indexOf(g)<0||!(d<s[g]&&s[g]<f)||d===s[g]||f===s[g]||r++}}return r}get radius(){return this.Rg}set radius(t){this.Rg!==t&&(m.s(t,"number",Be,"radius"),(t>0||isNaN(t))&&(this.Rg=t,this.p()))}get aspectRatio(){return this.Og}set aspectRatio(t){this.Og!==t&&(m.s(t,"number",Be,"aspectRatio"),t>0&&(this.Og=t,this.p()))}get startAngle(){return this.Ig}set startAngle(t){this.Ig!==t&&(m.s(t,"number",Be,"startAngle"),this.Ig=t,this.p())}get sweepAngle(){return this.eu}set sweepAngle(t){this.eu!==t&&(m.s(t,"number",Be,"sweepAngle"),t>0&&t<=360?this.eu=t:this.eu=360,this.p())}get arrangement(){return this.He}set arrangement(t){this.He!==t&&(t===3||t===0||t===1||t===2)&&(this.He=t,this.p())}get direction(){return this.P}set direction(t){this.P!==t&&(t===10||t===11||t===12||t===13)&&(this.P=t,this.p())}get sorting(){return this.Si}set sorting(t){this.Si!==t&&(this.Si=t,this.p())}get comparer(){return this.Mi}set comparer(t){this.Mi!==t&&(m.S(t,Be,"comparer"),this.Mi=t,this.p())}get spacing(){return this.In}set spacing(t){this.In!==t&&(m.s(t,"number",Be,"spacing"),this.In=t,this.p())}get nodeDiameterFormula(){return this.Eg}set nodeDiameterFormula(t){this.Eg!==t&&(t===30||t===31)&&(this.Eg=t,this.p())}get actualXRadius(){return this.gi}get actualYRadius(){return this.Is}get actualSpacing(){return this.Ya}get actualCenter(){return this.lL}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 Hs{iu;dc;su;constructor(){this.iu=-1/0,this.dc=null,this.su=null}g3(t,e){if(t>0&&this.iu<0||Math.abs(t)<Math.abs(this.iu)&&!(t<0&&this.iu>0)){this.iu=t,this.dc=[],this.su=[];for(let i=0;i<e.length;i++)this.dc[i]=e[i].bounds.x,this.su[i]=e[i].bounds.y}}m3(t,e){if(Math.abs(t)<Math.abs(this.iu)){this.iu=t,this.dc=[],this.su=[];for(let i=0;i<e.length;i++)this.dc[i]=e[i].bounds.x,this.su[i]=e[i].bounds.y}}commit(t){if(!(this.dc===null||this.su===null))for(let e=0;e<this.dc.length;e++){let i=t.elt(e);i.x=this.dc[e],i.y=this.su[e]}}}class Ws extends Ee{constructor(t){super(t)}createVertex(){return new di(this)}createEdge(){return new $s(this)}}class di extends Ie{Co;Vk;constructor(t){super(t),this.Co=NaN,this.Vk=NaN}Ka(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.Co=Math.max(this.width,this.height),this.Co;{let s=Math.abs(Math.sin(t)),n=Math.abs(Math.cos(t));return s===0?this.width:n===0?this.height:(this.Co=Math.min(this.height/s,this.width/n),this.Co)}}else return i.nodeDiameterFormula===31?(this.Co=Math.max(this.width,this.height),this.Co):(this.Co=Math.sqrt(this.width*this.width+this.height*this.height),this.Co)}get diameter(){return this.Co}set diameter(t){this.Co!==t&&(m.s(t,"number",di,"diameter"),this.Co=t)}get actualAngle(){return this.Vk}set actualAngle(t){this.Vk!==t&&(m.s(t,"number",di,"actualAngle"),this.Vk=t)}}class $s extends ei{constructor(t){super(t)}}class ee extends _t{ww;Ha;Es;Ug;Un;zi;Vg;Bg;zg;nu;Xg;Gg;ou;ru;lu;au;Yg;Kg;hu;gc;constructor(t){super(),this.ww=0,this.Ha=0,this.Es=new st(100,100).k(),this.Ug=!1,this.Un=!0,this.zi=!1,this.Vg=100,this.Bg=300,this.zg=1,this.nu=1e3,this.Xg=10,this.Gg=Math,this.ou=.05,this.ru=50,this.lu=150,this.au=0,this.Yg=10,this.Kg=5,this.hu=NaN,this.gc=10,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Es.h(this.Es),t.Ug=this.Ug,t.Un=this.Un,t.zi=this.zi,t.Vg=this.Vg,t.Bg=this.Bg,t.zg=this.zg,t.nu=this.nu,t.Xg=this.Xg,t.Gg=this.Gg,t.ou=this.ou,t.ru=this.ru,t.lu=this.lu,t.au=this.au,t.Yg=this.Yg,t.Kg=this.Kg,t.hu=this.hu,t.gc=this.gc}createNetwork(){return new Js(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.fL(),this.Ha=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.x3(r,n),r=o.iterator;r.next();){let a=r.value,h=a.vertexes.iterator;for(;h.next();){let u=h.value;n.addVertex(u)}let l=a.edges.iterator;for(;l.next();){let u=l.value;n.addEdge(u)}}}else this.lF(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.hu;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 Zs(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.b3(i,r,this.maxPrelayoutIterations,t.vertexes.count),this.lF(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 c=l.value;i.has(c.idInCluster)||c.hierarchicalVertexes.length<a&&(a=c.hierarchicalVertexes.length,h=c)}let u=e.createVertex();u.hierarchicalVertexes.addAll(r.hierarchicalVertexes),h!=null&&u.hierarchicalVertexes.addAll(h.hierarchicalVertexes),i.set(r.idInCluster,u),h!=null&&i.set(h.idInCluster,u),e.addVertex(u)}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}nx(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}x3(t,e){let i=this.arrangementSpacing,s=t.count,n=!0,o=0,r=0,a=m.st();for(let c=0;c<s+e.vertexes.count+2;c++)a[c]=null;let h=0;t.reset();let l=I.l(),u;for(;t.next();){let c=t.value;if(this.nx(c,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.aF(a,h,o,r,l.width,l.height,i),f=a[d],p=new P(f.x+l.width+i.width,f.y),g=new P(f.x,f.y+l.height+i.height);d+1<h&&a.splice(d+1,0,null),a[d]=p,a[d+1]=g,h++;let y=f.x-l.x,b=f.y-l.y;for(u=c.vertexes.iterator;u.next();){let v=u.value;this.isFixed(v)||(v.centerX+=y,v.centerY+=b)}}}for(I.i(l),u=e.vertexes.iterator;u.next();){let c=u.value,d=c.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 f=this.aF(a,h,o,r,d.width,d.height,i),p=a[f],g=new P(p.x+d.width+i.width,p.y),y=new P(p.x,p.y+d.height+i.height);f+1<h&&a.splice(f+1,0,null),a[f]=g,a[f+1]=y,h++,this.isFixed(c)||(c.centerX=p.x+c.width/2,c.centerY=p.y+c.height/2)}m.Z(a)}aF(t,e,i,s,n,o,r){let a=9e19,h=-1;t:for(let l=0;l<e;l++){let u=t[l],c=u.x-i,d=u.y-s,f=c*c+d*d;if(f<a){for(let p=l-1;p>=0;p--)if(t[p].y>u.y&&t[p].x-u.x<n+r.width)continue t;for(let p=l+1;p<e;p++)if(t[p].x>u.x&&t[p].y-u.y<o+r.height)continue t;h=l,a=f}}return h}fL(){if(this.network===null||!this.comments)return;let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value;this.addComments(e)}}addComments(t){if(this.network===null)return;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}}}hF(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,u=a.width,c=a.height;if(s+o<h)if(n>l+c){let d=s+o-h,f=n-l-c;return C._w(d*d+f*f)}else if(n+r<l){let d=s+o-h,f=n+r-l;return C._w(d*d+f*f)}else return h-(s+o);else if(s>h+u)if(n>l+c){let d=s-h-u,f=n-l-c;return C._w(d*d+f*f)}else if(n+r<l){let d=s-h-u,f=n+r-l;return C._w(d*d+f*f)}else return s-(h+u);else return n>l+c?n-(l+c):n+r<l?l-(n+r):.1}lF(t,e){let i=this.Ha+e;for(;this.Ha<i&&(this.Ha++,!!this.k3(t)););}k3(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 g=e[p];g.forceX=0,g.forceY=0;let y=g.centerX,b=g.centerY;s=Math.min(s,y),n=Math.max(n,y),o=Math.min(o,b),r=Math.max(r,b)}let a=n-s>r-o;a?e.sort((p,g)=>p===null||g===null||p===g?0:p.centerX-g.centerX):e.sort((p,g)=>p===null||g===null||p===g?0:p.centerY-g.centerY);let h=this.nu,l=0,u=0,c=0;for(let p=0;p<e.length;p++){let g=e[p],y=g.bounds,b=g.focus,v=y.x+b.x,w=y.y+b.y;u=g.charge*this.electricalFieldX(v,w),c=g.charge*this.electricalFieldY(v,w),u+=g.mass*this.gravitationalFieldX(v,w),c+=g.mass*this.gravitationalFieldY(v,w),g.forceX+=u,g.forceY+=c;for(let k=p+1;k<e.length;k++){let S=e[k];if(!this.shouldInteract(g,S)||k===p)continue;let N=S.bounds,D=S.focus,L=N.x+D.x,M=N.y+D.y;if(v-L>h||L-v>h){if(a)break;continue}if(w-M>h||M-w>h){if(!a)break;continue}let A=this.hF(g,S),F=2*g.charge,O=2*S.charge;if(A>1)l=F*O/(A*A),u=l*(v-L)/A,c=l*(w-M)/A;else{let E=this.randomNumberGenerator;E===null&&(this.randomNumberGenerator=E=new Zs(0));let B=E.random(),X=E.random();if(v>L)u=Math.abs(S.bounds.right-g.bounds.x),u=F*O*(1+u)*B;else if(v<L)u=Math.abs(S.bounds.x-g.bounds.right),u=-(F*O)*(1+u)*B;else{let z=Math.max(S.width,g.width);u=F*O*((1+z)*B-z/2)}if(w>M)c=Math.abs(S.bounds.bottom-g.bounds.y),c=F*O*(1+c)*X;else if(v<L)c=Math.abs(S.bounds.y-g.bounds.bottom),c=-(F*O)*(1+c)*X;else{let z=Math.max(S.height,g.height);c=F*O*((1+z)*X-z/2)}}g.forceX+=u,g.forceY+=c,S.forceX-=u,S.forceY-=c}}let d=t.edges.iterator;for(;d.next();){let p=d.value,g=p.fromVertex,y=p.toVertex,b=g.bounds,v=g.focus,w=b.x+v.x,k=b.y+v.y,S=y.bounds,N=y.focus,D=S.x+N.x,L=S.y+N.y,M=this.hF(g,y);M>1&&(l=.1*p.stiffness*(M-p.length),u=l*.5*(g.width+y.height)*(w-D)/M,c=l*.5*(g.width+y.height)*(k-L)/M),g.forceX-=u,g.forceY-=c,y.forceX+=u,y.forceY+=c}let f=0;for(let p=0;p<e.length;p++){let g=e[p];this.isFixed(g)?this.moveFixedVertex(g):f=Math.max(f,this.moveVertex(g)||0)}return f>this.epsilonDistance*this.epsilonDistance}b3(t,e,i,s){let n=this.Ha+i,o=Math.sqrt(s);this.ww=this.gc*t.vertexes.count;let r=t.vertexes.toArray(),a=0,h=0,l=0;for(;this.Ha<n;){this.Ha++,h=a,a=0;for(let u=0;u<r.length;u++){r[u].forceX=0,r[u].forceY=0;for(let d=0;d<r.length;d++){if(u===d)continue;let f=Math.sqrt((r[u].centerX-r[d].centerX)**2+(r[u].centerY-r[d].centerY)**2),p=e[r[u].idInCluster][r[d].idInCluster],g=(f-this.gc*o*p)/f;r[u].forceX+=g*(r[d].x-r[u].x),r[u].forceY+=g*(r[d].y-r[u].y)}let c=Math.sqrt(r[u].forceX*r[u].forceX+r[u].forceY*r[u].forceY);if(c>0){r[u].forceX=this.ww*r[u].forceX/c,r[u].forceY=this.ww*r[u].forceY/c,this.isFixed(r[u])||(r[u].x+=r[u].forceX,r[u].y+=r[u].forceY);let d=r[u].hierarchicalVertexes.iterator;for(;d.next();){let f=d.value;this.isFixed(f)||(f.centerX+=r[u].forceX,f.centerY+=r[u].forceY)}}a+=c*c}if(a>=h){if(l++,l>=5)break}else l=0;this.ww*=.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.xw(),this.commitNodes(),this.isRouting&&this.commitLinks()}xw(){if(this.network===null||!this.setsPortSpots)return;let t=this.network.edges.iterator;for(;t.next();){let e=t.value.link;e!==null&&(e.fromSpot=T.Default,e.toSpot=T.Default)}}commitNodes(){if(!this.network)return;let t=0,e=0;if(this.arrangesToOrigin){let n=I.l();this.nx(this.network,n);let o=this.arrangementOrigin;t=o.x-n.x,e=o.y-n.y,I.i(n)}let i=I.l(),s=this.network.vertexes.iterator;for(;s.next();){let n=s.value;(t!==0||e!==0)&&(i.h(n.bounds),i.x+=t,i.y+=e,n.bounds=i),n.commit()}I.i(i)}commitLinks(){if(!this.network)return;let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}springStiffness(t){let e=t.stiffness;return isNaN(e)?this.ou:e}springLength(t){let e=t.length;return isNaN(e)?this.ru:e}electricalCharge(t){let e=t.charge;return isNaN(e)?this.lu:e}electricalFieldX(t,e){return 0}electricalFieldY(t,e){return 0}gravitationalMass(t){let e=t.mass;return isNaN(e)?this.au:e}gravitationalFieldX(t,e){return 0}gravitationalFieldY(t,e){return 0}isFixed(t){return t.isFixed}get currentIteration(){return this.Ha}get arrangementSpacing(){return this.Es}set arrangementSpacing(t){this.Es.equals(t)||(this.Es.h(t),this.p())}get arrangesToOrigin(){return this.Ug}set arrangesToOrigin(t){this.Ug!==t&&(m.s(t,"boolean",ee,"arrangesToOrigin"),this.Ug=t,this.p())}get setsPortSpots(){return this.Un}set setsPortSpots(t){this.Un!==t&&(m.s(t,"boolean",ee,"setsPortSpots"),this.Un=t,this.p())}get comments(){return this.zi}set comments(t){this.zi!==t&&(m.s(t,"boolean",ee,"comments"),this.zi=t,this.p())}get maxPrelayoutIterations(){return this.Vg}set maxPrelayoutIterations(t){this.Vg!==t&&(m.s(t,"number",ee,"maxPrelayoutIterations"),t>=0&&(this.Vg=t,this.p()))}get maxIterations(){return this.Bg}set maxIterations(t){this.Bg!==t&&(m.s(t,"number",ee,"maxIterations"),t>=0&&(this.Bg=t,this.p()))}get epsilonDistance(){return this.zg}set epsilonDistance(t){this.zg!==t&&(m.s(t,"number",ee,"epsilonDistance"),t>0&&(this.zg=t,this.p()))}get infinityDistance(){return this.nu}set infinityDistance(t){this.nu!==t&&(m.s(t,"number",ee,"infinityDistance"),t>1&&(this.nu=t,this.p()))}get moveLimit(){return this.Xg}set moveLimit(t){this.Xg!==t&&(m.s(t,"number",ee,"moveLimit"),this.Xg=t,this.p())}get randomNumberGenerator(){return this.Gg}set randomNumberGenerator(t){this.Gg!==t&&(t!==null&&!m.it(t.random)&&m.o('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+t),this.Gg=t)}get defaultSpringStiffness(){return this.ou}set defaultSpringStiffness(t){this.ou!==t&&(m.s(t,"number",ee,"defaultSpringStiffness"),this.ou=t,this.p())}get defaultSpringLength(){return this.ru}set defaultSpringLength(t){this.ru!==t&&(m.s(t,"number",ee,"defaultSpringLength"),this.ru=t,this.p())}get defaultElectricalCharge(){return this.lu}set defaultElectricalCharge(t){this.lu!==t&&(m.s(t,"number",ee,"defaultElectricalCharge"),this.lu=t,this.p())}get defaultGravitationalMass(){return this.au}set defaultGravitationalMass(t){this.au!==t&&(m.s(t,"number",ee,"defaultGravitationalMass"),this.au=t,this.p())}get defaultCommentSpringLength(){return this.Yg}set defaultCommentSpringLength(t){this.Yg!==t&&(m.s(t,"number",ee,"defaultCommentSpringLength"),this.Yg=t,this.p())}get defaultCommentElectricalCharge(){return this.Kg}set defaultCommentElectricalCharge(t){this.Kg!==t&&(m.s(t,"number",ee,"defaultCommentElectricalCharge"),this.Kg=t,this.p())}get prelayoutQuality(){return this.hu}set prelayoutQuality(t){this.hu!==t&&(m.s(t,"number",ee,"prelayoutQuality"),this.hu=t,this.p())}get prelayoutSpread(){return this.gc}set prelayoutSpread(t){this.gc!==t&&(m.s(t,"number",ee,"prelayoutSpread"),this.gc=t,this.p())}}class Js extends Ee{constructor(t){super(t)}createVertex(){return new Ve(this)}createEdge(){return new fi(this)}}class Ve extends Ie{Bk;zk;Xk;Gk;Yk;hierarchicalVertexes;idInCluster;constructor(t){super(t),this.Bk=!1,this.zk=NaN,this.Xk=NaN,this.Gk=0,this.Yk=0,this.hierarchicalVertexes=new q,this.idInCluster=-1}get isFixed(){return this.Bk}set isFixed(t){this.Bk!==t&&(m.s(t,"boolean",Ve,"isFixed"),this.Bk=t)}get charge(){return this.zk}set charge(t){this.zk!==t&&(m.s(t,"number",Ve,"charge"),this.zk=t)}get mass(){return this.Xk}set mass(t){this.Xk!==t&&(m.s(t,"number",Ve,"mass"),this.Xk=t)}get forceX(){return this.Gk}set forceX(t){this.Gk!==t&&(m.s(t,"number",Ve,"forceX"),this.Gk=t)}get forceY(){return this.Yk}set forceY(t){this.Yk!==t&&(m.s(t,"number",Ve,"forceY"),this.Yk=t)}}class fi extends ei{Kk;Hk;constructor(t){super(t),this.Kk=NaN,this.Hk=NaN}get stiffness(){return this.Kk}set stiffness(t){this.Kk!==t&&(m.s(t,"number",fi,"stiffness"),this.Kk=t)}get length(){return this.Hk}set length(t){this.Hk!==t&&(m.s(t,"number",fi,"length"),this.Hk=t)}}class Zs{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 ns=(x=>(x[x.DepthFirst=0]="DepthFirst",x[x.Greedy=1]="Greedy",x[x.FromLayers=2]="FromLayers",x))(ns||{}),os=(x=>(x[x.OptimalLinkLength=10]="OptimalLinkLength",x[x.LongestPathSink=11]="LongestPathSink",x[x.LongestPathSource=12]="LongestPathSource",x))(os||{}),rs=(x=>(x[x.DepthFirstOut=20]="DepthFirstOut",x[x.DepthFirstIn=21]="DepthFirstIn",x[x.Naive=22]="Naive",x))(rs||{}),as=(x=>(x[x.None=30]="None",x[x.Less=31]="Less",x[x.More=32]="More",x))(as||{}),Qs=(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))(Qs||{}),_s=(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))(_s||{});class Ae extends _t{Us;ti;P;cu;fu;uu;mc;du;lr;gu;Un;_;bw;zt;Hg;Vs;ie;Bs;ms;ps;Rt;qg;jg;qk;cn;mu;ar;Vn;Bn;uL;qa;constructor(t){super(),this.Us=25,this.ti=25,this.P=0,this.cu=0,this.fu=10,this.uu=20,this.mc=4,this.du=31,this.lr=15,this.gu=10,this.Un=!0,this._=-1,this.bw=-1,this.zt=-1,this.Hg=0,this.Vs=0,this.ie=new Int16Array(0),this.Bs=new Float32Array(0),this.ms=new Float32Array(0),this.ps=new Float32Array(0),this.Rt=new Float32Array(0),this.qg=0,this.jg=new Int16Array(0),this.qk=new Int16Array(0),this.cn=0,this.mu=null,this.ar=new P,this.Vn=[],this.Vn.length=100,this.Bn=15,this.uL=0,this.qa=!0,t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Us=this.Us,t.ti=this.ti,t.P=this.P,t.cu=this.cu,t.fu=this.fu,t.uu=this.uu,t.mc=this.mc,t.du=this.du,t.lr=this.lr,t.gu=this.gu,t.Un=this.Un,t.Bn=this.Bn,t.qa=this.qa}fe(t){t in as?this.aggressiveOption=t:t in ns?this.cycleRemoveOption=t:t in rs?this.initializeOption=t:t in os?this.layeringOption=t:super.fe(t)}createNetwork(){return new tn(this)}doLayout(t){this.network===null&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin),this.P3(),this.network.vertexes.count>0&&(this.network.deleteSelfEdges(),this.cycleRemoveOption!==2&&this.removeCycles(),this.S3(),this.cycleRemoveOption===2&&this.removeCycles(),this.M3(),this.N3(),this.C3(),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.P===90||this.P===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.jk:t.Wk;if(i!==null)return i;let s=this.P;return s===90||s===270?e?t.jk=t.focus.x/this.ti+1|0:t.Wk=(t.bounds.width-t.focus.x)/this.ti+1|0:e?t.jk=t.focus.y/this.ti+1|0:t.Wk=(t.bounds.height-t.focus.y)/this.ti+1|0}ei(){let t=this.network.vertexes.count;this.jg.length<t*2&&(this.jg=new Int16Array(t*2));let e=0,i=this.network.vertexes.iterator;for(;i.next();){let s=i.value;this.jg[e]=s.column,e++,this.jg[e]=s.index,e++}return this.jg}ns(t){let e=0,i=this.network.vertexes.iterator;for(;i.next();){let s=i.value;s.column=t[e],e++,s.index=t[e],e++}}cF(t,e){let i=this.ja(t),s=this.ie[t];this.qk.length<s*s&&(this.qk=new Int16Array(s*s));let n=this.qk;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 u,c=0,d,f=0,p=0,g=0,y,b=0,v,w=0,k=0,S=0,N;if(e>=0){for(u=i[o].ko,c=0;c<u.length;c++)if(d=u[c],d.valid&&d.fromVertex.layer!==t)for(f=d.fromVertex.index,p=d.portToPos,g=d.portFromPos,b=c+1;b<u.length;b++)v=u[b],v.valid&&v.fromVertex.layer!==t&&(w=v.fromVertex.index,k=v.portToPos,S=v.portFromPos,p<k&&(f>w||f===w&&g>S)&&r++,k<p&&(w>f||w===f&&S>g)&&r++)}if(e<=0){for(u=i[o].sr,c=0;c<u.length;c++)if(d=u[c],d.valid&&d.toVertex.layer!==t)for(f=d.toVertex.index,p=d.portToPos,g=d.portFromPos,b=c+1;b<u.length;b++)v=u[b],v.valid&&v.toVertex.layer!==t&&(w=v.toVertex.index,k=v.portToPos,S=v.portFromPos,g<S&&(f>w||f===w&&p>k)&&r++,S<g&&(w>f||w===f&&k>p)&&r++)}for(n[o*s+o]=r,l=o+1;l<s;l++){let D=0,L=0;if(e>=0){for(y=i[o].ko,N=i[l].ko,c=0;c<y.length;c++)if(d=y[c],d.valid&&d.fromVertex.layer!==t)for(f=d.fromVertex.index,p=d.portToPos,g=d.portFromPos,b=0;b<N.length;b++)v=N[b],v.valid&&v.fromVertex.layer!==t&&(w=v.fromVertex.index,k=v.portToPos,S=v.portFromPos,(f<w||f===w&&g<S)&&L++,(w<f||w===f&&S<g)&&D++)}if(e<=0){for(y=i[o].sr,N=i[l].sr,c=0;c<y.length;c++)if(d=y[c],d.valid&&d.toVertex.layer!==t)for(f=d.toVertex.index,p=d.portToPos,g=d.portFromPos,b=0;b<N.length;b++)v=N[b],v.valid&&v.toVertex.layer!==t&&(w=v.toVertex.index,k=v.portToPos,S=v.portFromPos,(f<w||f===w&&p<k)&&L++,(w<f||w===f&&k<p)&&D++)}n[o*s+l]=D,n[l*s+o]=L}}return this.Wa(t,i),n}countCrossings(){let t=0;for(let e=0;e<=this._;e++){let i=this.cF(e,1),s=this.ie[e];for(let n=0;n<s;n++)for(let o=n;o<s;o++)t+=i[n*s+o]}return t}L3(t,e,i){let s=this.ja(t),n=this.ie[t],o=0;for(let r=0;r<n;r++){let a=null;e<=0&&(a=s[r].ko);let h=null;e>=0&&(h=s[r].sr);let l,u=0,c=0;if(a!==null)for(let d=0;d<a.length;d++)l=a[d],l.valid&&l.fromVertex.layer!==t&&(u=l.fromVertex.column+l.portFromColOffset,c=l.toVertex.column+l.portToColOffset,i?o+=Math.abs(u-c)*this.linkStraightenWeight(l):o+=Math.abs(u-c));if(h!==null)for(let d=0;d<h.length;d++)l=h[d],l.valid&&l.toVertex.layer!==t&&(u=l.fromVertex.column+l.portFromColOffset,c=l.toVertex.column+l.portToColOffset,i?o+=(Math.abs(u-c)+1)*this.linkStraightenWeight(l):o+=Math.abs(u-c))}return this.Wa(t,s),o}Jk(t){let e=0;for(let i=0;i<=this._;i++)e+=this.L3(i,1,t);return e}kw(){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}Pw(t,e){let i=this.ja(t),s=this.ie[t],n=new Float32Array(s);for(let o=0;o<s;o++){let r=i[o],a=null;e<=0&&(a=r.ko);let h=null;e>=0&&(h=r.sr);let l=0,u=0,c=r.near;c!==null&&c.layer===r.layer&&(l+=c.column-1,u++);let d;if(a!==null)for(let f=0;f<a.length;f++){d=a[f];let p=d.fromVertex;d.valid&&!d.rev&&p.layer!==t&&(l+=p.column,u++)}if(h!==null)for(let f=0;f<h.length;f++){d=h[f];let p=d.toVertex;d.valid&&!d.rev&&p.layer!==t&&(l+=p.column,u++)}u===0?n[o]=-1:n[o]=l/u}return this.Wa(t,i),n}fF(t,e){let i=this.ja(t),s=this.ie[t],n=new Int16Array(s);for(let o=0;o<s;o++){let r=i[o],a=null;e<=0&&(a=r.ko);let h=null;e>=0&&(h=r.sr);let l=0,u=[],c=r.near;c!==null&&c.layer===r.layer&&(u[l]=c.column-1,l++);let d;if(a!==null)for(let f=0;f<a.length;f++){d=a[f];let p=d.fromVertex;d.valid&&!d.rev&&p.layer!==t&&(u[l]=p.column+d.portFromColOffset,l++)}if(h!==null)for(let f=0;f<h.length;f++){d=h[f];let p=d.toVertex;d.valid&&!d.rev&&p.layer!==t&&(u[l]=p.column+d.portToColOffset,l++)}if(l===0)n[o]=-1;else{u.sort((p,g)=>p-g);let f=l>>1;(l&1)!==0?n[o]=u[f]:n[o]=u[f-1]+u[f]>>1}}return this.Wa(t,i),n}Sw(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.Sw(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.Sw(l,e,i,s,n)}}}}dL(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.dL(r,e,i,s,n)}}if(n){let o=t.sourceEdges;for(;o.next();){let r=o.value.fromVertex;this.dL(r,e,i,s,n)}}}}removeCycles(){let t=this.network.edges.iterator;for(;t.next();){let e=t.value;e.rev=!1}switch(this.cu){default:case 1:this.A3();break;case 0:this.T3();break;case 2:this.D3();break}}D3(){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)}}}A3(){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.ii=!0}for(;this.v3(t)!==null;){let r;for(r=this.uF(t);r!==null;)s[i]=r,i--,r.ii=!1,r=this.uF(t);for(r=this.dF(t);r!==null;)s[e]=r,e++,r.ii=!1,r=this.dF(t);r=this.F3(t),r!==null&&(s[e]=r,e++,r.ii=!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)}}v3(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.ii)return i}return null}uF(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.ii){let s=!0,n=i.destinationEdges;for(;n.next();)if(n.value.toVertex.ii){s=!1;break}if(s)return i}}return null}dF(t){let e=t.vertexes.iterator;for(;e.next();){let i=e.value;if(i.ii){let s=!0,n=i.sourceEdges;for(;n.next();)if(n.value.fromVertex.ii){s=!1;break}if(s)return i}}return null}F3(t){let e=null,i=0,s=this.network.vertexes.iterator;for(;s.next();){let n=s.value;if(n.ii){let o=0,r=n.destinationEdges;for(;r.next();)r.value.toVertex.ii&&o++;let a=0,h=n.sourceEdges;for(;h.next();)h.value.fromVertex.ii&&a++;(e===null||i<o-a)&&(e=n,i=o-a)}}return e}T3(){let t=this.network.vertexes.iterator;for(;t.next();){let i=t.value;i.pu=-1,i.Zn=-1}let e=this.network.edges.iterator;for(;e.next();){let i=e.value;i.forest=!1}for(this.qg=0,t.reset();t.next();){let i=t.value;i.sourceEdges.count===0&&this.gL(i)}for(t.reset();t.next();){let i=t.value;i.pu===-1&&this.gL(i)}for(e.reset();e.next();){let i=e.value;if(!i.forest){let s=i.fromVertex,n=s.pu,o=s.Zn,r=i.toVertex,a=r.pu,h=r.Zn;a<n&&o<h&&(this.network.reverseEdge(i),i.rev=!0)}}}gL(t){t.pu=this.qg,this.qg++;let e=t.destinationEdges;for(;e.next();){let i=e.value,s=i.toVertex;s.pu===-1&&(i.forest=!0,this.gL(s))}t.Zn=this.qg,this.qg++}S3(){let t=this.network.vertexes.iterator;for(;t.next();){let s=t.value;s.layer=-1}for(this._=-1,this.assignLayers(),t.reset();t.next();){let s=t.value;this._=Math.max(this._,s.layer)}this._>=9999&&m.o("LayeredDigraphLayout, too many layers: "+this._);let e=this.direction==0||this.direction==180,i=[];for(let s=this.network.vertexes.iterator;s.next();){let n=s.value;if(n.node===null||n.centered)continue;let o=n.layer,r=i[o];r===void 0&&(r=0);let a=e?n.width:n.height;a>r&&(i[o]=a)}for(let s=this.network.vertexes.iterator;s.next();){let n=s.value;if(n.node===null||n.centered)continue;let o=i[n.layer];e?(n.focusX=o/2,n.focusY=n.focus.y,n.width=o):(n.focusX=n.focus.x,n.focusY=o/2,n.height=o)}}assignLayers(){switch(this.fu){case 11:this.gF();break;case 12:this.R3();break;default:case 10:this.O3();break}}gF(){let t=this.network.vertexes.iterator;for(;t.next();){let e=t.value,i=this.mF(e);this._=Math.max(i,this._)}}mF(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.mF(n)+o)}t.layer=e}else e=t.layer;return e}R3(){let t=0,e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;t=this.pF(i),this._=Math.max(t,this._)}for(e.reset();e.next();){let i=e.value;i.layer=this._-i.layer}}pF(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.pF(n)+o)}t.layer=e}else e=t.layer;return e}O3(){this.gF();let t=this.network.vertexes.iterator;for(;t.next();){let i=t.value;i.ii=!1}for(t.reset();t.next();){let i=t.value;i.sourceEdges.count===0&&this.yF(i)}let e=1/0;for(t.reset();t.next();){let i=t.value;e=Math.min(e,i.layer)}for(this._=-1,t.reset();t.next();){let i=t.value;i.layer-=e,this._=Math.max(this._,i.layer)}}yF(t){if(!t.ii){t.ii=!0;let e=t.destinationEdges;for(;e.next();){let i=e.value.toVertex;this.yF(i)}this.I3(t),this.E3(t)}}I3(t){let e=this.network.vertexes.iterator;for(;e.next();){let r=e.value;r.component=-1}let i=0,s=1,n=t.ko,o=n.length;for(let r=0;r<o;r++){let a=n[r],h=a.fromVertex,l=a.toVertex,u=this.linkMinLength(a);h.layer-l.layer>u&&this.Sw(h,i,-1,!0,!1)}for(this.Sw(t,s,-1,!0,!0);t.component!==i;){let r=0,a=1/0,h=0,l=null,u=this.network.vertexes.iterator;for(;u.next();){let c=u.value;if(c.component===s){let d=0,f=!1,p=c.ko;o=p.length;for(let y=0;y<o;y++){let b=p[y],v=b.fromVertex;if(d+=this.linkLengthWeight(b),v.component!==s){r+=this.linkLengthWeight(b);let w=v.layer-c.layer,k=this.linkMinLength(b);a=Math.min(a,w-k)}}let g=c.sr;o=g.length;for(let y=0;y<o;y++){let b=g[y],v=b.toVertex;d-=this.linkLengthWeight(b),v.component!==s?r-=this.linkLengthWeight(b):f=!0}(l===null||d<h)&&!f&&(l=c,h=d)}}if(r>0){for(e.reset();e.next();){let c=e.value;c.component===s&&(c.layer+=a)}t.component=i}else l.component=i}}E3(t){let e=this.network.vertexes.iterator;for(;e.next();){let n=e.value;n.component=-1}let i=0,s=1;for(this.Sw(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 u=0,c=!1,d=l.ko,f=d.length;for(let g=0;g<f;g++){let y=d[g],b=y.fromVertex;u+=this.linkLengthWeight(y),b.component!==s?n+=this.linkLengthWeight(y):c=!0}let p=l.sr;f=p.length;for(let g=0;g<f;g++){let y=p[g],b=y.toVertex;if(u-=this.linkLengthWeight(y),b.component!==s){n-=this.linkLengthWeight(y);let v=l.layer-b.layer,w=this.linkMinLength(y);o=Math.min(o,v-w)}}(a===null||u>r)&&!c&&(a=l,r=u)}}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}}M3(){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,u=0;if(n.link!==null){let S=n.link;if(S===null)continue;let N=o.node,D=r.node;if(N===null||D===null)continue;let L=S.fromNode,M=S.toNode,A=S.fromPort;for(;A!==null&&!A.isVisibleObject();)A=A.panel;let F=S.toPort;for(;F!==null&&!F.isVisibleObject();)F=F.panel;if(n.rev){let tt=L,nt=A;L=M,A=F,M=tt,F=nt}let O=o.focus,E=r.focus,B=n.rev?r.bounds:o.bounds,X=P.l();N!==L?B.isReal()&&L.isVisible()?L.actualBounds.isReal()?(L.getRelativePoint(A,T.Center,X),X.x+=L.actualBounds.x-B.x,X.y+=L.actualBounds.y-B.y):(L.getRelativePoint(A,T.Center,X),X.isReal()||X.h(O)):X.h(O):B.isReal()?(L.getRelativePoint(A,T.Center,X),X.isReal()||X.h(O)):X.h(O);let z=n.rev?o.bounds:r.bounds,U=P.l();D!==M?z.isReal()&&M.isVisible()?M.actualBounds.isReal()?(M.getRelativePoint(F,T.Center,U),U.x+=M.actualBounds.x-z.x,U.y+=M.actualBounds.y-z.y):(M.getRelativePoint(F,T.Center,U),U.isReal()||U.h(E)):U.h(E):z.isReal()?(M.getRelativePoint(F,T.Center,U),U.isReal()||U.h(E)):U.h(E),this.P===90||this.P===270?(a=Math.round((X.x-O.x)/this.ti),l=X.x,h=Math.round((U.x-E.x)/this.ti),u=U.x):(a=Math.round((X.y-O.y)/this.ti),l=X.y,h=Math.round((U.y-E.y)/this.ti),u=U.y),P.i(X),P.i(U),n.portFromColOffset=a,n.portFromPos=l,n.portToColOffset=h,n.portToPos=u}else n.portFromColOffset=0,n.portFromPos=0,n.portToColOffset=0,n.portToPos=0;let c=o.layer,d=r.layer,f=this.U3(n),p=f===1||f===3,g=f===2||f===3,y,b,v=null,w;g&&(v=this.V3(o,r),w=1,b=t.createVertex(),b.node=null,b.$k=1,b.layer=c,b.near=o,t.addVertex(b),y=t.linkVertexes(o,b,n.link),y.valid=!1,y.rev=n.rev,y.portFromColOffset=a,y.portToColOffset=0,y.portFromPos=l,y.portToPos=0,o=b);let k=1;if(p&&k--,c-d>k&&c>0){for(n.valid=!1,b=t.createVertex(),b.node=null,b.$k=2,b.layer=c-1,v&&w<v.length&&b.layer===v[w].layer&&(b.near=v[w++]),t.addVertex(b),y=t.linkVertexes(o,b,n.link),y.valid=!0,y.rev=n.rev,y.portFromColOffset=g?0:a,y.portToColOffset=0,y.portFromPos=g?0:l,y.portToPos=0,o=b,c--;c-d>k&&c>0;)b=t.createVertex(),b.node=null,b.$k=3,b.layer=c-1,v&&w<v.length&&b.layer===v[w].layer&&(b.near=v[w++]),t.addVertex(b),y=t.linkVertexes(o,b,n.link),y.valid=!0,y.rev=n.rev,y.portFromColOffset=0,y.portToColOffset=0,y.portFromPos=0,y.portToPos=0,o=b,c--;y=t.linkVertexes(b,r,n.link),y.valid=!p,p&&(b.near=r),y.rev=n.rev,y.portFromColOffset=0,y.portToColOffset=h,y.portFromPos=0,y.portToPos=u}else n.valid=!0}}U3(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.Zk(!0),h=this.Zk(!1),l=this.setsPortSpots?a:i.computeSpot(!0,s),u=this.setsPortSpots?h:i.computeSpot(!1,n),c=i.isOrthogonal;if(l.isSide()&&l.includesSide(h)&&u.isSide()&&u.includesSide(a))return 0;let d=i.getLinkPoint(o,s,l,!0,c,r,n,P.l()),f=i.getLinkDirection(o,s,d,l,!0,c,r,n);P.i(d),(!l.isNone()&&f===this.wF(t,!0)||this.setsPortSpots&&o!==null&&o.ports.count===1&&t.rev)&&(e+=1);let p=i.getLinkPoint(r,n,u,!1,c,o,s,P.l()),g=i.getLinkDirection(r,n,p,u,!1,c,o,s);P.i(p),(!u.isNone()&&g===this.wF(t,!1)||this.setsPortSpots&&r!==null&&r.ports.count===1&&t.rev)&&(e+=2)}}}return e}wF(t,e){return this.P===90?e&&!t.rev||!e&&t.rev?270:90:this.P===180?e&&!t.rev||!e&&t.rev?0:180:this.P===270?e&&!t.rev||!e&&t.rev?90:270:e&&!t.rev||!e&&t.rev?180:0}V3(t,e){let i=[];return i.push(e),this.xF(t,i)?i.reverse():[]}xF(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.xF(t,e))return!0;e.pop()}return!1}N3(){this.ie.length!==this._+1&&(this.ie=new Int16Array(this._+1));let t=this.ie;for(let i=0;i<=this._;i++)t[i]=0;let e=this.network.vertexes.iterator;for(;e.next();){let i=e.value;i.index=-1}this.initializeIndices(),this.bw=-1,this.Hg=0,this.Vs=0;for(let i=0;i<=this._;i++)t[i]>t[this.Vs]&&(this.bw=t[i]-1,this.Vs=i),t[i]<t[this.Hg]&&(this.Hg=i);this.mu=[];for(let i=0;i<t.length;i++)this.mu[i]=[];for(e.reset();e.next();){let i=e.value,s=i.layer,n=this.mu[s];n[i.index]=i}}initializeIndices(){switch(this.uu){default:case 22:this.B3();break;case 20:this.z3();break;case 21:this.X3();break}}B3(){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.ie[s],this.ie[s]++,!t)continue;let n=t.get(i);Array.isArray(n)&&n.forEach(o=>{o.index=this.ie[s],this.ie[s]++})}}z3(){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._;i>=0;i--)for(e.reset();e.next();){let s=e.value;s.layer===i&&s.index===-1&&this.bF(s,t)}}bF(t,e){if(t.near)return;let i=t.layer;if(t.index=this.ie[i],this.ie[i]++,e){let o=e.get(t);Array.isArray(o)&&o.forEach(r=>{r.index=this.ie[i],this.ie[i]++})}let s=t.sr,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.bF(a,e)}}}X3(){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._;i++)for(e.reset();e.next();){let s=e.value;s.layer===i&&s.index===-1&&this.kF(s,t)}}kF(t,e){if(t.near)return;let i=t.layer;if(t.index=this.ie[i],this.ie[i]++,e){let h=e.get(t);Array.isArray(h)&&h.forEach(l=>{l.index=this.ie[i],this.ie[i]++})}let s=t.ko,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.kF(r,e))}C3(){this.zt=-1;for(let t=0;t<=this._;t++){let e=this.ja(t),i=0,s=this.ie[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.Wa(t,e)}}reduceCrossings(){let t=this.countCrossings(),e=this.ei(),i=0,s=0,n=0;for(i=0;i<this.mc;i++){for(s=0;s<=this._;s++)this.Qk(s,1),this.ys(s,1,!1,1);for(n=this.countCrossings(),n<t&&(t=n,e=this.ei()),s=this._;s>=0;s--)this.Qk(s,-1),this.ys(s,-1,!1,-1);n=this.countCrossings(),n<t&&(t=n,e=this.ei())}for(this.ns(e),i=0;i<this.mc;i++){for(s=0;s<=this._;s++)this.Qk(s,0),this.ys(s,0,!1,0);for(n=this.countCrossings(),n<t&&(t=n,e=this.ei()),s=this._;s>=0;s--)this.Qk(s,0),this.ys(s,0,!1,0);n=this.countCrossings(),n<t&&(t=n,e=this.ei())}this.ns(e);let o=!1,r=0,a=0,h=0,l=0;switch(this.du){case 30:break;case 32:for(h=t+1;(l=this.countCrossings())<h;)for(h=l,r=this._;r>=0;r--)for(a=0;a<=r;a++){for(o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,-1,!1,-1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,1,!1,1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,1,!1,1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,-1,!1,-1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,0,!1,0)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,0,!1,0)||o;n>=t?this.ns(e):(t=n,e=this.ei())}break;default:case 31:for(r=this._,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.ys(s,-1,!1,-1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,1,!1,1)||o;for(n=this.countCrossings(),n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,1,!1,1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,-1,!1,-1)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=r;s>=a;s--)o=this.ys(s,0,!1,0)||o;for(n>=t?this.ns(e):(t=n,e=this.ei()),o=!0;o;)for(o=!1,s=a;s<=r;s++)o=this.ys(s,0,!1,0)||o;n>=t?this.ns(e):(t=n,e=this.ei())}break}this.ns(e)}Qk(t,e){let i=0,s=!1,n=this.ja(t),o=this.ie[t],r=this.fF(t,e),a=this.Pw(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 c=r[i];r[i]=r[i+1],r[i+1]=c;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 u=0;for(i=0;i<o;i++)l=n[i],l.index=i,u+=this.nodeMinColumnSpace(l,!0),l.column=u,u+=1,u+=this.nodeMinColumnSpace(l,!1);return this.Wa(t,n),s}ys(t,e,i,s){let n=this.ja(t),o=this.ie[t],r=this.cF(t,e),a=0,h;if(!i||s>0)for(h=new Float32Array(o),a=0;a<o;a++)h[a]=-1;else h=this.Pw(t,-1);let l;if(!i||s<0)for(l=new Float32Array(o),a=0;a<o;a++)l[a]=-1;else l=this.Pw(t,1);let u=!1,c=!0;for(;c;)for(c=!1,a=0;a<o-1;a++){let d=r[n[a].index*o+n[a+1].index],f=r[n[a+1].index*o+n[a].index],p=0,g=0,y=n[a].column,b=n[a+1].column,v=this.nodeMinColumnSpace(n[a],!0),w=this.nodeMinColumnSpace(n[a],!1),k=this.nodeMinColumnSpace(n[a+1],!0),S=this.nodeMinColumnSpace(n[a+1],!1),N=y-v+k,D=b-w+S,L=0,M=0,A=0,F=0,O=0,E=0,B=0,X,z=0,U,tt=0,nt=n[a].sourceEdges.iterator;if(i&&s<=0)for(;nt.next();){let bt=nt.value;X=bt.fromVertex,bt.valid&&X.layer!==t&&(A=this.linkStraightenWeight(bt),F=bt.portFromColOffset,O=bt.portToColOffset,E=X.column,L+=(Math.abs(y+O-(E+F))+1)*A,M+=(Math.abs(D+O-(E+F))+1)*A)}for(nt.reset();nt.next();){let bt=nt.value;if(X=bt.fromVertex,bt.valid&&X.layer===t){for(z=0;z<n.length&&n[z]!==X;)z++;z<a&&(p+=2*(a-z),g+=2*(a+1-z)),z===a+1&&(p+=1),z>a+1&&(p+=4*(z-a),g+=4*(z-(a+1)))}}let Z=n[a].destinationEdges.iterator;if(i&&s>=0)for(;Z.next();){let bt=Z.value;U=bt.toVertex,bt.valid&&U.layer!==t&&(A=this.linkStraightenWeight(bt),F=bt.portFromColOffset,O=bt.portToColOffset,B=U.column,L+=(Math.abs(y+F-(B+O))+1)*A,M+=(Math.abs(D+F-(B+O))+1)*A)}for(Z.reset();Z.next();){let bt=Z.value;if(U=bt.toVertex,bt.valid&&U.layer===t){for(tt=0;tt<n.length&&n[tt]!==U;)tt++;tt===a+1&&(g+=1)}}let it=n[a+1].sourceEdges.iterator;if(i&&s<=0)for(;it.next();){let bt=it.value;X=bt.fromVertex,bt.valid&&X.layer!==t&&(A=this.linkStraightenWeight(bt),F=bt.portFromColOffset,O=bt.portToColOffset,E=X.column,L+=(Math.abs(b+O-(E+F))+1)*A,M+=(Math.abs(N+O-(E+F))+1)*A)}for(it.reset();it.next();){let bt=it.value;if(X=bt.fromVertex,bt.valid&&X.layer===t){for(z=0;z<n.length&&n[z]!==X;)z++;z<a&&(p+=2*(a+1-z),g+=2*(a-z)),z===a&&(g+=1),z>a+1&&(p+=4*(z-(a+1)),g+=4*(z-a))}}let _=n[a+1].destinationEdges.iterator;if(i&&s>=0)for(;_.next();){let bt=_.value;U=bt.toVertex,bt.valid&&U.layer!==t&&(A=this.linkStraightenWeight(bt),F=bt.portFromColOffset,O=bt.portToColOffset,B=U.column,L+=(Math.abs(b+F-(B+O))+1)*A,M+=(Math.abs(N+F-(B+O))+1)*A)}for(_.reset();_.next();){let bt=_.value;if(U=bt.toVertex,bt.valid&&U.layer===t){for(tt=0;tt<n.length&&n[tt]!==U;)tt++;tt===a&&(p+=1)}}let at=0,ct=0,xt=h[n[a].index],Ct=l[n[a].index],Q=h[n[a+1].index],Pt=l[n[a+1].index];if(xt!==-1&&(at+=Math.abs(xt-y),ct+=Math.abs(xt-D)),Ct!==-1&&(at+=Math.abs(Ct-y),ct+=Math.abs(Ct-D)),Q!==-1&&(at+=Math.abs(Q-b),ct+=Math.abs(Q-N)),Pt!==-1&&(at+=Math.abs(Pt-b),ct+=Math.abs(Pt-N)),g<p-.5||g===p&&f<d-.5||g===p&&f===d&&M<L-.5||g===p&&f===d&&M===L&&ct<at-.5){u=!0,c=!0,n[a].column=D,n[a+1].column=N;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.Wa(t,n),u}straightenAndPack(){if(this.Bn!==0){this.G3();return}let t=0,e=!1,i=(this.lr&1)!==0,s=(this.lr&8)!==0;if(this.network.edges.count>1e3&&s&&(i=!1),i){let n=[],o=0;for(o=0;o<=this._;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 u=this.nodeMinColumnSpace(l,!1);n[t]=Math.max(n[t],r+u)}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.lr&2)!==0){e=!0;let n=0;for(;e&&n<this.gu;){for(e=!1,t=this.Vs+1;t<=this._;t++)e=this.Wg(t,1)||e;for(t=this.Vs-1;t>=0;t--)e=this.Wg(t,-1)||e;e=this.Wg(this.Vs,0)||e,n++}}if((this.lr&4)!==0){for(t=this.Vs+1;t<=this._;t++)this.mL(t,1);for(t=this.Vs-1;t>=0;t--)this.mL(t,-1);this.mL(this.Vs,0)}if(i&&(this.PF(-1),this.PF(1)),(this.lr&2)!==0){e=!0;let n=0;for(;e&&n<this.gu;){for(e=!1,e=this.Wg(this.Vs,0)||e,t=this.Vs+1;t<=this._;t++)e=this.Wg(t,0)||e;for(t=this.Vs-1;t>=0;t--)e=this.Wg(t,0)||e;n++}}}Wg(t,e){let i=!1;for(;this.Y3(t,e);)i=!0;return i}Y3(t,e){let i=0,s=this.ja(t),n=this.ie[t],o=this.Pw(t,-1);if(e>0)for(i=0;i<n;i++)o[i]=-1;let r=this.Pw(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,u=this.nodeMinColumnSpace(s[i],!0),c=this.nodeMinColumnSpace(s[i],!1),d=0;i-1<0||l-s[i-1].column-1>u+this.nodeMinColumnSpace(s[i-1],!1)?d=l-1:d=l;let f=0;i+1>=n||s[i+1].column-l-1>c+this.nodeMinColumnSpace(s[i+1],!0)?f=l+1:f=l;let p=0,g=0,y=0,b=0,v=0,w=0;if(e<=0){let M=s[i].sourceEdges.iterator;for(;M.next();){let A=M.value,F=A.fromVertex;if(A.valid&&F.layer!==t){b=this.linkStraightenWeight(A),v=A.portFromColOffset,w=A.portToColOffset;let O=F.column;p+=(Math.abs(l+w-(O+v))+1)*b,g+=(Math.abs(d+w-(O+v))+1)*b,y+=(Math.abs(f+w-(O+v))+1)*b}}}if(e>=0){let M=s[i].destinationEdges.iterator;for(;M.next();){let A=M.value,F=A.toVertex;if(A.valid&&F.layer!==t){b=this.linkStraightenWeight(A),v=A.portFromColOffset,w=A.portToColOffset;let O=F.column;p+=(Math.abs(l+v-(O+w))+1)*b,g+=(Math.abs(d+v-(O+w))+1)*b,y+=(Math.abs(f+v-(O+w))+1)*b}}}let k=0,S=0,N=0,D=o[s[i].index],L=r[s[i].index];D!==-1&&(k+=Math.abs(D-l),S+=Math.abs(D-d),N+=Math.abs(D-f)),L!==-1&&(k+=Math.abs(L-l),S+=Math.abs(L-d),N+=Math.abs(L-f)),g<p||g===p&&S<k?(a=!0,h=!0,s[i].column=d):(y<p||y===p&&N<k)&&(a=!0,h=!0,s[i].column=f)}return this.Wa(t,s),this.kw(),a}mL(t,e){let i=0,s=this.ja(t),n=this.ie[t],o=this.fF(t,e),r=new Int16Array(o),a=!1,h=!0;for(;h;)for(h=!1,i=0;i<n;i++){let l=s[i].column,u=this.nodeMinColumnSpace(s[i],!0),c=this.nodeMinColumnSpace(s[i],!1),d=0,f=0,p=0,g=0,y=0;r[i]===-1?i===0&&i===n-1?d=l:i===0?(f=s[i+1].column,f-l===c+this.nodeMinColumnSpace(s[i+1],!0)?d=l-1:d=l):i===n-1?(p=s[i-1].column,l-p===u+this.nodeMinColumnSpace(s[i-1],!1)?d=l+1:d=l):(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+u+1,f=s[i+1].column,g=f-this.nodeMinColumnSpace(s[i+1],!0)-c-1,d=(y+g)/2|0):i===0&&i===n-1?d=r[i]:i===0?(f=s[i+1].column,g=f-this.nodeMinColumnSpace(s[i+1],!0)-c-1,d=Math.min(r[i],g)):i===n-1?(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+u+1,d=Math.max(r[i],y)):(p=s[i-1].column,y=p+this.nodeMinColumnSpace(s[i-1],!1)+u+1,f=s[i+1].column,g=f-this.nodeMinColumnSpace(s[i+1],!0)-c-1,y<r[i]&&r[i]<g?d=r[i]:y>=r[i]?d=y:g<=r[i]&&(d=g)),d!==l&&(a=!0,h=!0,s[i].column=d)}return this.Wa(t,s),this.kw(),a}K3(){for(let t=0;t<=this.zt;t++)for(;this.H3(t,1););this.kw()}H3(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}q3(){this.K3();for(let t=0;t<this.zt;t++)for(;this.j3(t,1););this.kw()}j3(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._;s++)n[s]=!1,o[s]=!1;let r=this.network.vertexes.iterator;for(;r.next();){let l=r.value,u=l.column-this.nodeMinColumnSpace(l,!0),c=l.column+this.nodeMinColumnSpace(l,!1);u<=t&&c>=t&&(n[l.layer]=!0),u<=i&&c>=i&&(o[l.layer]=!0)}let a=!0,h=!1;for(s=0;s<=this._;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}PF(t){this.q3();let e=0,i,s=0,n=0,o=0;if(t>0)for(e=0;e<=this.zt;e++)for(i=this.ei(),s=this.Jk(!0),n=s+1;s<n;)n=s,this.SF(e,1),o=this.Jk(!0),o>s?this.ns(i):o<s&&(s=o,i=this.ei());if(t<0)for(e=this.zt;e>=0;e--)for(i=this.ei(),s=this.Jk(!0),n=s+1;s<n;)n=s,this.SF(e,-1),o=this.Jk(!0),o>s?this.ns(i):o<s&&(s=o,i=this.ei());this.kw()}SF(t,e){this.cn=0;let i=this.network.vertexes.iterator;for(;i.next();){let u=i.value;u.component=-1}if(e>0)for(i.reset();i.next();){let u=i.value;u.column-this.nodeMinColumnSpace(u,!0)<=t&&(u.component=this.cn)}if(e<0)for(i.reset();i.next();){let u=i.value;u.column+this.nodeMinColumnSpace(u,!1)>=t&&(u.component=this.cn)}for(this.cn++,i.reset();i.next();){let u=i.value;u.component===-1&&(this.dL(u,this.cn,-1,!0,!0),this.cn++)}let s=0,n=[];for(s=0;s<this.cn*this.cn;s++)n[s]=!1;let o=[];for(s=0;s<(this._+1)*(this.zt+1);s++)o[s]=-1;for(i.reset();i.next();){let u=i.value,c=u.layer,d=Math.max(0,u.column-this.nodeMinColumnSpace(u,!0)),f=Math.min(this.zt,u.column+this.nodeMinColumnSpace(u,!1));for(let p=d;p<=f;p++)o[c*(this.zt+1)+p]=u.component}for(let u=0;u<=this._;u++){if(e>0)for(let c=0;c<this.zt;c++)o[u*(this.zt+1)+c]!==-1&&o[u*(this.zt+1)+c+1]!==-1&&o[u*(this.zt+1)+c]!==o[u*(this.zt+1)+c+1]&&(n[o[u*(this.zt+1)+c]*this.cn+o[u*(this.zt+1)+c+1]]=!0);if(e<0)for(let c=this.zt;c>0;c--)o[u*(this.zt+1)+c]!==-1&&o[u*(this.zt+1)+c-1]!==-1&&o[u*(this.zt+1)+c]!==o[u*(this.zt+1)+c-1]&&(n[o[u*(this.zt+1)+c]*this.cn+o[u*(this.zt+1)+c-1]]=!0)}let r=[];for(s=0;s<this.cn;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.cn;s++)n[h*this.cn+s]&&a.splice(0,0,s);let l=!1;if(e>0)for(i.reset();i.next();){let u=i.value;r[u.component]&&(u.column-=1,l=!0)}if(e<0)for(i.reset();i.next();){let u=i.value;r[u.component]&&(u.column+=1,l=!0)}return l}G3(){let t=m.st(),e=this.mu.length;for(let d=0;d<=e;d++)t[d]=[];let i=this.network.vertexes.iterator;for(;i.next();){let d=i.value,f=e-d.layer,p=t[f];p[d.index]=d}let s=new V;this.W3(t,s);let n=null,o=null,r=null,a=null,h=(this.Bn&1)!==0,l=(this.Bn&2)!==0,u=(this.Bn&4)!==0,c=(this.Bn&8)!==0;h&&(this.rl(t,s,!0),n=this._k(t,!0,!1)),t.reverse(),u&&(this.rl(t,s,!1),r=this._k(t,!1,!1));for(let d of t)d.reverse();c&&(this.rl(t,s,!1),a=this._k(t,!1,!0)),t.reverse(),l&&(this.rl(t,s,!0),o=this._k(t,!0,!0)),m.Z(t),this.J3(n,o,r,a),this.network.vertexes.each(d=>{let f=d,p=m.st();h&&p.push(n.get(f)),l&&p.push(o.get(f)),u&&p.push(r.get(f)),c&&p.push(a.get(f)),p.sort((w,k)=>w-k);let g=p.length,y=Math.floor((g-1)/2),b=Math.ceil((g-1)/2),v=(p[y]+p[b])/2;m.Z(p),f.mi=v})}W3(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],u=this.$3(l);if(h===a.length-1||u){let c=r.length-1;for(u&&(c=l.getProperSourceVertexes()[0].index);o<=h;){let d=a[o].getProperSourceEdges();for(let f of d){let p=f.fromVertex.index;(p<n||p>c)&&e.add(f)}o++}n=c}}}}$3(t){if(t.node===null){let e=t.getProperSourceVertexes();if(e.length>0)return e[0].node===null}return!1}rl(t,e,i){this.Z3(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,u)=>l.Ja-u.Ja);let h=(a-1)/2;for(let l=Math.floor(h),u=Math.ceil(h);l<=u;l++)if(o.zn===o){let c=r[l],d;i?d=c.getDestinationEdge(o):d=o.getDestinationEdge(c),!e.has(d)&&n<c.Ja&&(c.zn=o,o.pc=c.pc,o.zn=c.pc,n=c.Ja)}}}}}Z3(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.pc=n,n.zn=n,n.MF=e,n.Ja=s}}}_k(t,e,i){let s=this.P===90||this.P===270;for(let o of t)for(let r of o)r.os=r,r.yu=1/0,r.mi=NaN,r.Xn=0;this.Q3(t,e,i);for(let o of t)for(let r of o)r.pc===r&&this.NF(r,t);for(let o=0;o<t.length;o++){if(t[o].length<=0)continue;let r=t[o][0];if(r.os===r){r.os.yu===1/0&&(r.os.yu=0);let a=o,h=0,l;do{for(l=t[a][h];l.zn!==l.pc;)if(l=l.zn,a++,l.Ja>0){let u=this.CF(l,t),c=s?u.width:u.height,d=l.os.yu+l.mi+l.Xn-(u.mi+u.Xn+c+this.columnSpacing);u.os.yu=Math.min(u.os.yu,d)}h=l.Ja+1}while(a<t.length&&h<t[a].length&&l.os===t[a][h].os)}}let n=new Mt;for(let o of t)for(let r of o){r.mi=r.mi+r.os.yu+r.Xn;let a=s?r.width:r.height;n.set(r,i?-r.mi-a:r.mi)}return n}Q3(t,e,i){let s=this.P===90||this.P===270;for(let n of t)for(let o of n)if(o.pc===o){let r=0,a=o;for(;a.zn!==o;){let h=a.zn,l=s?a.width:a.height,u=s?h.width:h.height,c,d,f,p;e?(f=a.getDestinationEdge(h),c=f.portFromPos,d=f.portToPos,f.link!==null&&(a.node&&a.node!==f.link.fromNode&&(c=s?a.focusX:a.focusY),h.node&&h.node!==f.link.toNode&&(d=s?h.focusX:h.focusY)),i?p=a.Xn+(l-c)-(u-d):p=a.Xn+c-d):(f=h.getDestinationEdge(a),c=f.portToPos,d=f.portFromPos,f.link!==null&&(a.node&&a.node!==f.link.toNode&&(c=s?a.focusX:a.focusY),h.node&&h.node!==f.link.fromNode&&(d=s?h.focusX:h.focusY)),i?p=a.Xn+(l-c)-(u-d):p=a.Xn+c-d),h.Xn=p,r=Math.min(r,p),a=a.zn}a=o;do a.Xn=a.Xn-r,a=a.zn;while(a!==o)}}NF(t,e){if(!isNaN(t.mi))return;t.mi=0;let i=t;do{if(i.Ja>0){let s=this.CF(i,e),n=s.pc;this.NF(n,e),t.os===t&&(t.os=n.os);let o=this.P===90||this.P===270?s.width:s.height;if(t.os===n.os){let r=n.mi+s.Xn+o-i.Xn+this.columnSpacing;t.mi=Math.max(t.mi,r)}}i=i.zn}while(i!==t);for(;i.zn!==t;)i=i.zn,i.mi=t.mi,i.os=t.os}CF(t,e){let i=t.MF,s=t.Ja;return s<1&&m.o("Could not determine previous vertex in layer"),e[i][s-1]}J3(...t){let e=-1,i=m.st(),s=m.st(),n=1/0;for(let o=0;o<4;o++){if(!t[o])continue;let r=this._3(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)})}m.Z(i),m.Z(s)}_3(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.P===90||this.P===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.xw(),this.commitNodes(),this.pL(),this.isRouting&&this.commitLinks()}xw(){if(!this.setsPortSpots)return;let t=this.Zk(!0),e=this.Zk(!1),i=this.network.edges.iterator;for(;i.next();){let s=i.value.link;s!==null&&(s.fromSpot=t,s.toSpot=e)}}Zk(t){return this.P===270?t?T.MiddleTop:T.MiddleBottom:this.P===90?t?T.MiddleBottom:T.MiddleTop:this.P===180?t?T.MiddleLeft:T.MiddleRight:t?T.MiddleRight:T.MiddleLeft}commitNodes(){this.Bs.length!==this._+1&&(this.Bs=new Float32Array(this._+1)),this.ms.length!==this._+1&&(this.ms=new Float32Array(this._+1)),this.ps.length!==this._+1&&(this.ps=new Float32Array(this._+1)),this.Rt.length!==this._+1&&(this.Rt=new Float32Array(this._+1));for(let f=0;f<=this._;f++)this.Bs[f]=0,this.ms[f]=0,this.ps[f]=0,this.Rt[f]=0;let t=this.network.vertexes.iterator;for(;t.next();){let f=t.value,p=f.layer;this.Bs[p]=Math.max(this.Bs[p],this.nodeMinLayerSpace(f,!0)),this.ms[p]=Math.max(this.ms[p],this.nodeMinLayerSpace(f,!1))}let e=0,i=this.Us;for(let f=0;f<=this._;f++){let p=i;this.Bs[f]+this.ms[f]<=0&&(p=0),f>0&&(e+=p/2),this.P===90||this.P===0?(e+=this.ms[f],this.ps[f]=e,e+=this.Bs[f]):(e+=this.Bs[f],this.ps[f]=e,e+=this.ms[f]),f<this._&&(e+=p/2),this.Rt[f]=e}let s=e,n=this.arrangementOrigin;for(let f=0;f<=this._;f++)this.P===270?this.ps[f]=n.y+this.ps[f]:this.P===90?(this.ps[f]=n.y+s-this.ps[f],this.Rt[f]=s-this.Rt[f]):this.P===180?this.ps[f]=n.x+this.ps[f]:(this.ps[f]=n.x+s-this.ps[f],this.Rt[f]=s-this.Rt[f]);let o=this.Bn!==0;t.reset();let r=this.P===270||this.P===90,a=1/0,h=1/0,l=1/0,u=-1/0;for(;t.next();){let f=t.value,p=f.layer,g=f.column|0,y=0,b=0;r?(y=n.x+this.ti*g,b=this.ps[p]):(y=this.ps[p],b=n.y+this.ti*g),f.centerX=y,f.centerY=b,o&&isFinite(f.mi)&&(r?f.node?f.x=n.x+f.mi:f.centerX=n.x+f.mi:f.node?f.y=n.y+f.mi:f.centerY=n.y+f.mi),a=Math.min(f.x,a),h=Math.min(f.y,h),r?(l=a,u=Math.max(u,f.bounds.right)):(l=h,u=Math.max(u,f.bounds.bottom))}this.uL=u-l;let c=n.x-a,d=n.y-h;for(this.ar=new P(o&&r?0:c,o&&!r?0:d),t.reset();t.next();){let f=t.value;f.x+=c,f.y+=d,f.commit()}}pL(){let t=0,e=this.Us;for(let n=0;n<=this._;n++)t+=this.Bs[n],t+=this.ms[n];t+=this._*e;let i=[],s=this.Bn!==0?this.uL:this.ti*this.zt;for(let n=this.maxLayer;n>=0;n--)this.P===270?n===0?i.push(new I(0,0,s,Math.abs(this.Rt[0]))):i.push(new I(0,this.Rt[n-1],s,Math.abs(this.Rt[n-1]-this.Rt[n]))):this.P===90?n===0?i.push(new I(0,this.Rt[0],s,Math.abs(this.Rt[0]-t))):i.push(new I(0,this.Rt[n],s,Math.abs(this.Rt[n-1]-this.Rt[n]))):this.P===180?n===0?i.push(new I(0,0,Math.abs(this.Rt[0]),s)):i.push(new I(this.Rt[n-1],0,Math.abs(this.Rt[n-1]-this.Rt[n]),s)):n===0?i.push(new I(this.Rt[0],0,Math.abs(this.Rt[0]-t),s)):i.push(new I(this.Rt[n],0,Math.abs(this.Rt[n-1]-this.Rt[n]),s));this.commitLayers(i,this.ar)}commitLayers(t,e){}commitLinks(){let t=this.network.edges.iterator,e=null;for(;t.next();)e=t.value.link,e!==null&&e.pointsCount>0&&(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 A=n.findVisibleNode();A!==null&&A!==n&&(n=A,r=A.port)}if(o!==null){let A=o.findVisibleNode();A!==null&&A!==o&&(o=A,a=A.port)}let h=e.computeSpot(!0,r),l=e.computeSpot(!1,a),u=i.fromVertex,c=i.toVertex;if(i.valid){if(e.curve===9&&e.pointsCount===4)if(u.column===c.column&&this.alignOption===0){let A=e.getLinkPoint(n,r,h,!0,!1,o,a),F=e.getLinkPoint(o,a,l,!1,!1,n,r);A.isReal()||A.set(n.actualBounds.center),F.isReal()||F.set(o.actualBounds.center),e.clearPoints(),e.addPointAt(A.x,A.y),e.addPointAt((2*A.x+F.x)/3,(2*A.y+F.y)/3),e.addPointAt((A.x+2*F.x)/3,(A.y+2*F.y)/3),e.addPointAt(F.x,F.y)}else{let A=!1,F=!1;if(r!==null&&e.wl(h)&&(A=!0),a!==null&&e.wl(l)&&(F=!0),A||F){let O=null;A&&(O=e.getLinkPointFromPoint(n,r,r.getDocumentPoint(T.Center),e.getPoint(3),!0),O.isReal()||O.set(n.actualBounds.center),e.setPointAt(0,O.x,O.y));let E=null;if(F&&(E=e.getLinkPointFromPoint(o,a,a.getDocumentPoint(T.Center),e.getPoint(0),!1),E.isReal()||E.set(o.actualBounds.center),e.setPointAt(3,E.x,E.y)),O){let B=e.getPoint(2);e.setPointAt(1,(O.x*2+B.x)/3,(O.y*2+B.y)/3)}if(E){let B=e.getPoint(1);e.setPointAt(2,(E.x*2+B.x)/3,(E.y*2+B.y)/3)}}}e.commitRoute();continue}if(u.layer===c.layer){e.commitRoute();continue}let d=!1,f=!1,p=this.Us,g=0,y=e.firstPickIndex+1;if(e.isOrthogonal)f=!0,g=e.pointsCount,g>4&&e.points.removeRange(2,g-3);else if(e.curve===9)d=!0,g=e.pointsCount,g>4&&e.points.removeRange(2,g-3),g===4&&(y=2);else{g=e.pointsCount;let A=h===T.None,F=l===T.None;g>2&&A&&F?e.points.removeRange(1,g-2):g>3&&A&&!F?e.points.removeRange(1,g-3):g>3&&!A&&F?e.points.removeRange(2,g-2):g>4&&!A&&!F&&e.points.removeRange(2,g-3)}let b,v,w=0,k=0,S=0,N=0,D=0,L=0,M=0;if(i.rev){let A=0;for(;c!==null&&u!==c;){b=null,v=null;let F=c.sourceEdges.iterator;for(;F.next();){let O=F.value;if(O.link===i.link&&(b=O.fromVertex,v=O.toVertex,b.node===null))break}if(b===null)break;if(b!==u)if(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=b.centerX,N=b.centerY,f)this.P===180||this.P===0?y===e.firstPickIndex+1?(e.insertPointAt(y++,w,k),e.insertPointAt(y++,w,N)):(v!==null?v.centerY:k)!==N&&(D=this.Rt[b.layer-1]+this.ar.x,e.insertPointAt(y++,D,k),e.insertPointAt(y++,D,N)):y===e.firstPickIndex+1?(e.insertPointAt(y++,w,k),e.insertPointAt(y++,S,k)):(v!==null?v.centerX:w)!==S&&(D=this.Rt[b.layer-1]+this.ar.y,e.insertPointAt(y++,w,D),e.insertPointAt(y++,S,D));else if(y===e.firstPickIndex+1)if(L=Math.max(10,this.Bs[c.layer]),M=Math.max(10,this.ms[c.layer]),d)this.P===180?S<=c.bounds.x?(A=c.bounds.x,e.insertPointAt(y++,A-L,N),e.insertPointAt(y++,A,N),e.insertPointAt(y++,A+M,N)):(e.insertPointAt(y++,S-L,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S+M,N)):this.P===90?N>=c.bounds.bottom?(A=c.bounds.y+c.bounds.height,e.insertPointAt(y++,S,A+M),e.insertPointAt(y++,S,A),e.insertPointAt(y++,S,A-L)):(e.insertPointAt(y++,S,N+M),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N-L)):this.P===270?N<=c.bounds.y?(A=c.bounds.y,e.insertPointAt(y++,S,A-L),e.insertPointAt(y++,S,A),e.insertPointAt(y++,S,A+M)):(e.insertPointAt(y++,S,N-L),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N+M)):this.P===0&&(S>=c.bounds.right?(A=c.bounds.x+c.bounds.width,e.insertPointAt(y++,A+M,N),e.insertPointAt(y++,A,N),e.insertPointAt(y++,A-L,N)):(e.insertPointAt(y++,S+M,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S-L,N)));else{e.insertPointAt(y++,w,k);let O=0;this.P===180||this.P===0?((this.P===180?S>=c.bounds.right:S<=c.bounds.x)&&(O=(this.P===0?-L:M)/2),e.insertPointAt(y++,w+O,N)):((this.P===270?N>=c.bounds.bottom:N<=c.bounds.y)&&(O=(this.P===90?-L:M)/2),e.insertPointAt(y++,S,k+O)),e.insertPointAt(y++,S,N)}else L=Math.max(10,this.Bs[b.layer]),M=Math.max(10,this.ms[b.layer]),d?this.P===180?(e.insertPointAt(y++,S-L-Math.max(10,p),N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S+M+p,N)):this.P===90?(e.insertPointAt(y++,S,N+M+Math.max(10,p)),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N-L-p)):this.P===270?(e.insertPointAt(y++,S,N-L-Math.max(10,p)),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N+M+p)):(e.insertPointAt(y++,S+M+Math.max(10,p),N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S-L-p,N)):(this.P===180||this.P===90||this.P,e.insertPointAt(y++,S,N));c=b}if(a===null||h!==T.None||f)if(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=e.getPoint(y).x,N=e.getPoint(y).y,f){let F=this.ms[u.layer],O=0;this.P===180||this.P===0?(O=k,O>=u.bounds.y&&O<=u.bounds.bottom&&(this.P===180?S>=u.bounds.x:S<=u.bounds.right)&&(A=u.centerX+(this.P===180?-F:F),O<u.bounds.y+u.bounds.height/2?O=u.bounds.y-this.ti/2:O=u.bounds.bottom+this.ti/2,e.insertPointAt(y++,A,k),e.insertPointAt(y++,A,O)),e.insertPointAt(y++,S,O),e.insertPointAt(y++,S,N)):(O=w,O>=u.bounds.x&&O<=u.bounds.right&&(this.P===270?N>=u.bounds.y:N<=u.bounds.bottom)&&(A=u.centerY+(this.P===270?-F:F),O<u.bounds.x+u.bounds.width/2?O=u.bounds.x-this.ti/2:O=u.bounds.right+this.ti/2,e.insertPointAt(y++,w,A),e.insertPointAt(y++,O,A)),e.insertPointAt(y++,O,N),e.insertPointAt(y++,S,N))}else if(d)L=Math.max(10,this.Bs[u.layer]),M=Math.max(10,this.ms[u.layer]),this.P===180&&S>=u.bounds.x?(A=u.bounds.x+u.bounds.width,e.setPointAt(y-2,A,k),e.setPointAt(y-1,A+M,k)):this.P===90&&N<=u.bounds.bottom?(A=u.bounds.y,e.setPointAt(y-2,w,A),e.setPointAt(y-1,w,A-L)):this.P===270&&N>=u.bounds.y?(A=u.bounds.y+u.bounds.height,e.setPointAt(y-2,w,A),e.setPointAt(y-1,w,A+M)):this.P===0&&S<=u.bounds.right&&(A=u.bounds.x,e.setPointAt(y-2,A,k),e.setPointAt(y-1,A-L,k));else{L=Math.max(10,this.Bs[u.layer]),M=Math.max(10,this.ms[u.layer]);let F=0;this.P===180||this.P===0?((this.P===180?S<=u.bounds.x:S>=u.bounds.right)&&(F=(this.P===0?M:-L)/2),e.insertPointAt(y++,S+F,k)):((this.P===270?N<=u.bounds.y:N>=u.bounds.bottom)&&(F=(this.P===90?M:-L)/2),e.insertPointAt(y++,w,N+F)),e.insertPointAt(y++,S,N)}}else{for(;u!==null&&u!==c;){b=null,v=null;let A=u.destinationEdges.iterator;for(;A.next();){let F=A.value;if(F.link===i.link&&(b=F.toVertex,v=F.fromVertex,v.node!==null&&(v=null),b.node===null))break}if(b===null)break;b!==c&&(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=b.centerX,N=b.centerY,f?this.P===180||this.P===0?(v!==null?v.centerY:k)!==N&&(D=this.Rt[b.layer]+this.ar.x,y===e.firstPickIndex+1&&(this.P===0?D=Math.max(D,w):D=Math.min(D,w)),e.insertPointAt(y++,D,k),e.insertPointAt(y++,D,N)):(v!==null?v.centerX:w)!==S&&(D=this.Rt[b.layer]+this.ar.y,y===e.firstPickIndex+1&&(this.P===90?D=Math.max(D,k):D=Math.min(D,k)),e.insertPointAt(y++,w,D),e.insertPointAt(y++,S,D)):(L=Math.max(10,this.Bs[b.layer]),M=Math.max(10,this.ms[b.layer]),d?this.P===180?(e.insertPointAt(y++,S+M+Math.max(10,p),N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S-L-p,N)):this.P===90?(e.insertPointAt(y++,S,N-L-Math.max(10,p)),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N+M+p)):this.P===270?(e.insertPointAt(y++,S,N+M+Math.max(10,p)),e.insertPointAt(y++,S,Math.max(N+M-p/2,N)),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,Math.min(N-L+p/2,N)),e.insertPointAt(y++,S,N-L-p)):(e.insertPointAt(y++,S-L-Math.max(10,p),N),e.insertPointAt(y++,Math.min(S-L+p/2,S),N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,S,N),e.insertPointAt(y++,Math.max(S+M-p/2,S),N),e.insertPointAt(y++,S+M+p,N)):this.P===180?(e.insertPointAt(y++,S+M,N),e.insertPointAt(y++,S-L,N)):this.P===90?(e.insertPointAt(y++,S,N-L),e.insertPointAt(y++,S,N+M)):this.P===270?(e.insertPointAt(y++,S,N+M),e.insertPointAt(y++,S,N-L)):(e.insertPointAt(y++,S-L,N),e.insertPointAt(y++,S+M,N)))),u=b}f&&(w=e.getPoint(y-1).x,k=e.getPoint(y-1).y,S=e.getPoint(y).x,N=e.getPoint(y).y,this.P===180||this.P===0?k!==N&&(this.P===0?D=Math.min(Math.max((S+w)/2,this.Rt[c.layer]+this.ar.x),S):D=Math.max(Math.min((S+w)/2,this.Rt[c.layer]+this.ar.x),S),e.insertPointAt(y++,D,k),e.insertPointAt(y++,D,N)):w!==S&&(this.P===90?D=Math.min(Math.max((N+k)/2,this.Rt[c.layer]+this.ar.y),N):D=Math.max(Math.min((N+k)/2,this.Rt[c.layer]+this.ar.y),N),e.insertPointAt(y++,w,D),e.insertPointAt(y++,S,D)))}if(s!==null&&d&&e.pointsCount>=4){if(n!==null&&r!==null&&s.wl(h)){let A=r.getDocumentPoint(T.Center);A.isReal()||A.setTo(n.actualBounds.centerX,n.actualBounds.centerY);let F=e.getPoint(3),O=e.getPoint(2);this.direction===90||this.direction===270?(e.setPointAt(1,F.x,(O.y+F.y)/2),e.setPointAt(2,F.x,(O.y+F.y)/2)):(e.setPointAt(1,(O.x+F.x)/2,F.y),e.setPointAt(2,(O.x+F.x)/2,F.y));let E=e.getLinkPointFromPoint(n,r,A,e.getPoint(1),!0);e.setPointAt(0,E.x,E.y)}if(o!==null&&a!==null&&s.wl(l)){let A=a.getDocumentPoint(T.Center);A.isReal()||A.setTo(o.actualBounds.centerX,o.actualBounds.centerY);let F=e.getPoint(e.pointsCount-4),O=e.getLinkPointFromPoint(o,a,A,F,!1),E=e.getPoint(e.pointsCount-3);this.direction===90||this.direction===270?(e.setPointAt(e.pointsCount-2,F.x,(E.y+O.y)/2),e.setPointAt(e.pointsCount-3,F.x,(E.y+O.y)/2)):(e.setPointAt(e.pointsCount-2,(E.x+O.x)/2,F.y),e.setPointAt(e.pointsCount-3,(E.x+O.x)/2,F.y));let B=e.getLinkPointFromPoint(o,a,A,e.getPoint(e.pointsCount-2),!1);e.setPointAt(e.pointsCount-1,B.x,B.y)}}e.commitRoute(),i.commit()}}P3(){this.bw=-1,this.Hg=0,this.Vs=0,this.mu=null;for(let t=0;t<this.Vn.length;t++)this.Vn[t]=null}ja(t){let e,i=this.ie[t];if(i>=this.Vn.length){let n=[];for(let o=0;o<this.Vn.length;o++)n[o]=this.Vn[o];this.Vn=n}this.Vn[i]===void 0||this.Vn[i]===null?e=[]:(e=this.Vn[i],this.Vn[i]=null);let s=this.mu[t];for(let n=0;n<s.length;n++){let o=s[n];e[o.index]=o}return e}Wa(t,e){this.Vn[this.ie[t]]=e}get layerSpacing(){return this.Us}set layerSpacing(t){this.Us!==t&&(m.s(t,"number",Ae,"layerSpacing"),t>=0&&(this.Us=t,this.p()))}get columnSpacing(){return this.ti}set columnSpacing(t){this.ti!==t&&(m.s(t,"number",Ae,"columnSpacing"),t>0&&(this.ti=t,this.p()))}get direction(){return this.P}set direction(t){this.P!==t&&(m.s(t,"number",Ae,"direction"),t===0||t===90||t===180||t===270?(this.P=t,this.p()):m.o("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}get cycleRemoveOption(){return this.cu}set cycleRemoveOption(t){this.cu!==t&&(t===1||t===0||t===2)&&(this.cu=t,this.p())}get layeringOption(){return this.fu}set layeringOption(t){this.fu!==t&&(t===10||t===11||t===12)&&(this.fu=t,this.p())}get initializeOption(){return this.uu}set initializeOption(t){this.uu!==t&&(t===20||t===21||t===22)&&(this.uu=t,this.p())}get iterations(){return this.mc}set iterations(t){this.mc!==t&&t>=0&&(this.mc=t,this.p())}get aggressiveOption(){return this.du}set aggressiveOption(t){this.du!==t&&(t===30||t===31||t===32)&&(this.du=t,this.p())}get packOption(){return this.lr}set packOption(t){this.lr!==t&&(m.s(t,"number",Ae,"packOption"),t>=0&&t<8&&(this.lr=t,this.p()))}get packIterations(){return this.gu}set packIterations(t){this.gu=t}get alignOption(){return this.Bn}set alignOption(t){this.Bn!==t&&(m.s(t,"number",Ae,"align"),t>=0&&t<16&&(this.Bn=t,this.p()))}get centered(){return this.qa}set centered(t){this.centered!==t&&(m.s(t,"boolean",Ae,"centered"),this.qa=t,this.p())}get setsPortSpots(){return this.Un}set setsPortSpots(t){this.Un!==t&&(m.s(t,"boolean",Ae,"setsPortSpots"),this.Un=t,this.p())}get maxLayer(){return this._}get maxIndex(){return this.bw}get maxColumn(){return this.zt}get minIndexLayer(){return this.Hg}get maxIndexLayer(){return this.Vs}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 tn extends Ee{constructor(t){super(t)}createVertex(){let t=new si(this);return t.centered=this.layout.centered,t}createEdge(){return new Se(this)}}class si extends Ie{ul;pa;Tt;tP;eP;qa;ii;pu;Zn;$k;jk;Wk;pc;zn;MF;Ja;os;yu;mi;Xn;Mw=null;Nw=null;Cw=null;Lw=null;constructor(t){super(t),this.ul=-1,this.pa=-1,this.Tt=-1,this.tP=NaN,this.eP=null,this.qa=!0,this.ii=!1,this.pu=NaN,this.Zn=NaN,this.$k=0,this.jk=null,this.Wk=null}static LF(t,e){return t.index-e.index}getProperSourceEdges(){if(!this.Cw){let t=[];for(let e of this.ko){let i=e;i.valid&&t.push(i)}this.Cw=t}return this.Cw}getProperDestinationEdges(){if(!this.Lw){let t=[];for(let e of this.sr){let i=e;i.valid&&t.push(i)}this.Lw=t}return this.Lw}getDestinationEdge(t){let e=this.getProperDestinationEdges();for(let i of e)if(i.toVertex===t)return i;m.o("Unable to find destination edge to given vertex")}getProperSourceVertexes(){if(!this.Mw){let t=[];for(let e of this.ko){let i=e;!i.valid||i.fromVertex.layer<=i.toVertex.layer||t.push(i.fromVertex)}t.sort(si.LF),this.Mw=t}return this.Mw}getProperDestinationVertexes(){if(!this.Nw){let t=[];for(let e of this.sr){let i=e;!i.valid||i.fromVertex.layer<=i.toVertex.layer||t.push(i.toVertex)}t.sort(si.LF),this.Nw=t}return this.Nw}addSourceEdge(t){super.addSourceEdge(t),this.Mw=null,this.Cw=null}deleteSourceEdge(t){super.deleteSourceEdge(t),this.Mw=null,this.Cw=null}addDestinationEdge(t){super.addDestinationEdge(t),this.Nw=null,this.Lw=null}deleteDestinationEdge(t){super.deleteDestinationEdge(t),this.Nw=null,this.Lw=null}commit(){if(this.centered)super.commit();else{let t=this.node;if(t!==null){let e=this.network.layout;if(!e)return;e.direction===180||e.direction===270?t.moveTo(this.bounds.right-t.actualBounds.width,this.bounds.bottom-t.actualBounds.height):t.moveTo(this.bounds.x,this.bounds.y)}}}get layer(){return this.ul}set layer(t){this.ul=t}get column(){return this.pa}set column(t){this.pa=t}get index(){return this.Tt}set index(t){this.Tt=t}get component(){return this.tP}set component(t){this.tP!==t&&(m.s(t,"number",si,"component"),this.tP=t)}get near(){return this.eP}set near(t){this.eP!==t&&(this.eP=t)}get centered(){return this.qa}set centered(t){this.qa=t}}class Se extends ei{ii;iP;sP;nP;oP;rP;lP;constructor(t){super(t),this.ii=!1,this.iP=!1,this.sP=!1,this.nP=NaN,this.oP=NaN,this.rP=0,this.lP=0}get fromVertex(){return this.is}set fromVertex(t){this.is!==t&&(this.is=t)}get toVertex(){return this.ss}set toVertex(t){this.ss!==t&&(this.ss=t)}get valid(){return this.ii}set valid(t){this.ii!==t&&(m.s(t,"boolean",Se,"valid"),this.ii=t)}get rev(){return this.iP}set rev(t){this.iP!==t&&(m.s(t,"boolean",Se,"rev"),this.iP=t)}get forest(){return this.sP}set forest(t){this.sP!==t&&(m.s(t,"boolean",Se,"forest"),this.sP=t)}get portFromPos(){return this.nP}set portFromPos(t){this.nP!==t&&(m.s(t,"number",Se,"portFromPos"),this.nP=t)}get portToPos(){return this.oP}set portToPos(t){this.oP!==t&&(m.s(t,"number",Se,"portToPos"),this.oP=t)}get portFromColOffset(){return this.rP}set portFromColOffset(t){this.rP!==t&&(m.s(t,"number",Se,"portFromColOffset"),this.rP=t)}get portToColOffset(){return this.lP}set portToColOffset(t){this.lP!==t&&(m.s(t,"number",Se,"portToColOffset"),this.lP=t)}}var hs=(x=>(x[x.Default=0]="Default",x[x.Destination=1]="Destination",x[x.Source=2]="Source",x))(hs||{}),ls=(x=>(x[x.Forwards=10]="Forwards",x[x.Reverse=11]="Reverse",x[x.Ascending=12]="Ascending",x[x.Descending=13]="Descending",x))(ls||{}),us=(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))(us||{}),cs=(x=>(x[x.None=30]="None",x[x.Block=31]="Block",x))(cs||{}),ds=(x=>(x[x.Layered=40]="Layered",x[x.LastParents=41]="LastParents",x[x.Alternating=42]="Alternating",x[x.RootOnly=43]="RootOnly",x))(ds||{}),fs=(x=>(x[x.Vertical=50]="Vertical",x[x.Horizontal=51]="Horizontal",x[x.FixedRoots=52]="FixedRoots",x))(fs||{}),en=(x=>(x[x.Individual=60]="Individual",x[x.Siblings=61]="Siblings",x[x.Uniform=62]="Uniform",x))(en||{});class Vt extends _t{Ie;Fe;wu;Jg;yL;zi;He;Es;V;B;aP;ws;constructor(t){super(),this.Ie=new V,this.Fe=0,this.ws=1,this.wu=40,this.Jg=60,this.yL=[],this.zi=!0,this.He=50,this.Es=new st(10,10).k();let e=new gs(this);this.V=new Rt(e),this.B=new Rt(e),this.aP=[],t&&Object.assign(this,t)}cloneProtected(t){super.cloneProtected(t),t.Fe=this.Fe,t.wu=this.wu,t.Jg=this.Jg,t.zi=this.zi,t.He=this.He,t.Es.h(this.Es),t.V.copyInheritedPropertiesFrom(this.V),t.B.copyInheritedPropertiesFrom(this.B)}fe(t){t in us?this.alignment=t:t in fs?this.arrangement=t:t in cs?this.compaction=t:t in hs?this.path=t:t in ls?this.sorting=t:t in ds?this.treeStyle=t:super.fe(t)}createNetwork(){return new gs(this)}makeNetwork(t){let e=this.createNetwork(),i=s=>{if(s instanceof $)return!s.isLinkLabel&&s.category!=="Comment";if(s instanceof j){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 Y?(e.addParts(t.nodes,!0,i),e.addParts(t.links,!0,i)):t instanceof ht?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 Y&&(e=t),this.path===0&&e!==null?this.ws=e.isTreePathToChildren?1:2:this.ws=this.path===0?1:this.path,this.network.vertexes.count>0&&(this.nU(),this.oU(),this.rU(),this.lU(),this.fL(),this.aU(),this.arrangeTrees(),this.updateParts()),this.network=null,this.Ie=new V,this.isValidLayout=!0}nU(){if(this.network===null)return;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.Ie.count>0){let n=new V,o=this.Ie.iterator;for(;o.next();){let r=o.value;if(r instanceof $){let a=this.network.findVertex(r);a!==null&&n.add(a)}else r instanceof Rt&&n.add(r)}this.Ie=n}this.Ie.count===0&&this.findRoots();let e=this.Ie.copy().iterator;for(;e.next();){let n=e.value;n.initialized||(n.initialized=!0,this.wL(n))}let i=this.network.vertexes,s=null;for(;s=this.hU(i),s.count>0;){let n=this.AF(s);n!==null&&(this.Ie.add(n),n.initialized=!0,this.wL(n)),i=s}}hU(t){let e=new V,i=t.iterator;for(;i.next();){let s=i.value;s.initialized||e.add(s)}return e}findRoots(){if(this.network===null)return;let t=this.network.vertexes,e=t.iterator;for(;e.next();){let i=e.value;switch(this.ws){case 1:i.sourceEdges.count===0&&this.Ie.add(i);break;case 2:i.destinationEdges.count===0&&this.Ie.add(i);break;default:m.o("Unhandled path value "+this.ws.toString())}}if(this.Ie.count===0){let i=this.AF(t);i!==null&&this.Ie.add(i)}}AF(t){let e=999999,i=null,s=t.iterator;for(;s.next();){let n=s.value;switch(this.ws){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:m.o("Unhandled path value "+this.ws.toString())}}return i}wL(t){if(t===null)return;switch(this.ws){case 1:if(t.destinationEdges.count>0){let s=new q,n=t.destinationVertexes;for(;n.next();){let o=n.value;this.TF(t,o)&&s.add(o)}s.count>0&&(t.children=s.toArray())}break;case 2:if(t.sourceEdges.count>0){let s=new q,n=t.sourceVertexes;for(;n.next();){let o=n.value;this.TF(t,o)&&s.add(o)}s.count>0&&(t.children=s.toArray())}break;default:m.o("Unhandled path value"+this.ws.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.Ie.delete(n)}for(let s=0;s<i;s++){let n=e[s];this.wL(n)}}TF(t,e){return e.initialized?this.cU(e,t)||e.level>t.level?!1:(this.fU(e.parent,e),!0):!0}cU(t,e){if(e===null)return!1;let i=e.parent;for(;i!==null&&i!==t;)i=i.parent;return i===t}fU(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}}oU(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.DF(e)}}DF(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.DF(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}uU(t){switch(this.wu){default:case 40:return t.parent!==null?t.parent:this.V;case 43:return t.parent===null?this.V:t.parent.parent===null?this.B:t.parent;case 42:return t.parent!==null?t.parent.parent!==null?t.parent.parent:this.B:this.V;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.V}}}initializeTreeVertexValues(t){let e=this.uU(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}rU(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.vF(e)}}vF(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.vF(n)}}assignTreeVertexValues(t){}lU(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.FF(e)}}FF(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.FF(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}}fL(){if(!this.comments||this.network===null)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,u=0,c=0,d=t.commentSpacing;if(t.node!==null){let f=t.node.findNodesConnected();for(;f.next();){let p=f.value;if(p.category!=="Comment"||!p.canLayout())continue;t.comments===null&&(t.comments=[]),t.comments.push(p),p.ensureBounds();let g=p.measuredBounds;r&&!h||!o&&!a&&h||o&&a&&h?(l=Math.max(l,g.width),u+=g.height+Math.abs(c)):(l+=g.width+Math.abs(c),u=Math.max(u,g.height)),c=d}}if(t.comments!==null){r&&!h||!o&&!a&&h||o&&a&&h?(l+=Math.abs(t.commentMargin),u=Math.max(0,u-t.height)):(u+=Math.abs(t.commentMargin),l=Math.max(0,l-t.width));let f=I.z(0,0,t.bounds.width+l,t.bounds.height+u);t.bounds=f,I.i(f)}}isBusAlignment(t){return t===24||t===25||t===26||t===27}Aw(t){return t===24||t===25}xL(t){let e=t.parent;if(e!==null){let i=e.alignment;if(this.isBusAlignment(i))if(this.Aw(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,u=this.xL(t),c=0,d=t.comments,f=d.length,p=P.l();for(let y=0;y<f;y++){let b=d[y],v=b.measuredBounds;if(a&&!l||!r&&!h&&l||r&&h&&l){if(n>135&&!r||h&&u)if(t.commentMargin>=0){p.e(t.bounds.x-t.commentMargin-v.width,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleLeft,k.toSpot=T.MiddleRight}}else{p.e(t.bounds.x+t.focus.x*2-t.commentMargin,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleRight,k.toSpot=T.MiddleLeft}}else if(t.commentMargin>=0){p.e(t.bounds.x+t.focus.x*2+t.commentMargin,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleRight,k.toSpot=T.MiddleLeft}}else{p.e(t.bounds.x+t.commentMargin-v.width,t.bounds.y+c),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleLeft,k.toSpot=T.MiddleRight}}t.commentSpacing>=0?c+=v.height+t.commentSpacing:c+=t.commentSpacing-v.height}else{if(n>135&&!r||!h&&u)if(t.commentMargin>=0){p.e(t.bounds.x+c,t.bounds.y-t.commentMargin-v.height),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleTop,k.toSpot=T.MiddleBottom}}else{p.e(t.bounds.x+c,t.bounds.y+t.focus.y*2-t.commentMargin),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleBottom,k.toSpot=T.MiddleTop}}else if(t.commentMargin>=0){p.e(t.bounds.x+c,t.bounds.y+t.focus.y*2+t.commentMargin),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleBottom,k.toSpot=T.MiddleTop}}else{p.e(t.bounds.x+c,t.bounds.y+t.commentMargin-v.height),b.move(p);let w=b.findLinksInto();for(;w.next();){let k=w.value;k.fromSpot=T.MiddleTop,k.toSpot=T.MiddleBottom}}t.commentSpacing>=0?c+=v.width+t.commentSpacing:c+=t.commentSpacing-v.width}}P.i(p);let g=c-t.commentSpacing-(a?e.height:e.width);if(this.ws===1){let y=t.destinationEdges;for(;y.next();){let b=y.value.link;b!==null&&!b.isAvoiding&&(b.fromEndSegmentLength=g>0?g:NaN)}}else{let y=t.sourceEdges;for(;y.next();){let b=y.value.link;b!==null&&!b.isAvoiding&&(b.toEndSegmentLength=g>0?g:NaN)}}}}aU(){if(this.network===null)return;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.yL=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.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&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.RF(t);break;default:case 31:t.alignment===25?this.RF(t):this.dU(t);break}}RF(t){if(t.childrenCount===0){let X=!1,z=0,U=21;t.parent!==null&&(z=t.parent.angle,U=t.parent.alignment,X=this.isBusAlignment(U));let tt=this.xL(t);t.U.e(0,0),t.dt.e(t.width,t.height),t.parent!==null&&t.comments!==null&&((z===180||z===270)&&!X||tt)?z===180&&!X||(z===90||z===270)&&tt?t.at.e(t.width-t.focus.x*2,0):t.at.e(0,t.height-t.focus.y*2):t.at.e(0,0);return}let e=this.orthoAngle(t),i=e===90||e===270,s=0,n=t.children,o=n.length;for(let X=0;X<o;X++){let z=n[X];s=Math.max(s,i?z.dt.width:z.dt.height)}let r=t.alignment,a=r===22,h=r===23,l=this.isBusAlignment(r),u=Math.max(0,t.breadthLimit),c=this.computeLayerSpacing(t),d=t.nodeSpacing,f=this.computeNodeIndent(t),p=a||h?0:f/2,g=t.rowSpacing,y=0;(a||h)&&(y=Math.max(0,t.rowIndent));let b=t.width,v=t.height,w=0,k=0,S=0,N=0,D=0,L=0,M=0,A=0,F=0,O=0;if(l&&!this.Aw(r)&&e>135&&n.reverse(),this.Aw(r))if(o>1)for(let X=0;X<o;X++){let z=n[X],U=z.dt;X%2===0&&X!==o-1?F=Math.max(F,(i?U.width:U.height)+this.computeBusNodeSpacing(z)-d):X%2!==0&&(O=Math.max(O,(i?U.width:U.height)+this.computeBusNodeSpacing(z)-d))}else o===1&&(F=i?n[0].dt.width:n[0].dt.height);if(l)switch(r){case 24:case 25:let X=I.l();e<135?this.OF(t,n,F,O,w,k,X):this.IF(t,n,F,O,w,k,X),F=X.x,w=X.width,k=X.height,I.i(X);break;case 26:for(let z=0;z<o;z++){let U=n[z],tt=U.dt,nt=M===0?0:g;i?(U.U.e(s-tt.width,D+nt),w=Math.max(w,tt.width),k=Math.max(k,D+nt+tt.height),D+=nt+tt.height):(U.U.e(N+nt,s-tt.height),w=Math.max(w,N+nt+tt.width),k=Math.max(k,tt.height),N+=nt+tt.width),M++}break;case 27:for(let z=0;z<o;z++){let U=n[z],tt=U.dt,nt=M===0?0:g;i?(U.U.e(d/2+t.focus.x,D+nt),w=Math.max(w,tt.width),k=Math.max(k,D+nt+tt.height),D+=nt+tt.height):(U.U.e(N+nt,d/2+t.focus.y),w=Math.max(w,N+nt+tt.width),k=Math.max(k,tt.height),N+=nt+tt.width),M++}break}else for(let X=0;X<o;X++){let z=n[X],U=z.dt;if(i){u>0&&M>0&&N+d+U.width>u&&(N<s&&this.yc(t,r,s-N,0,A,X-1),L++,M=0,A=X,S=k,N=0,D=e>135?-k-g:k+g);let tt=M===0?p:d;this.hP(z,0,D),z.U.e(N+tt,D),w=Math.max(w,N+tt+U.width),k=Math.max(k,S+(L===0?0:g)+U.height),N+=tt+U.width}else{u>0&&M>0&&D+d+U.height>u&&(D<s&&this.yc(t,r,0,s-D,A,X-1),L++,M=0,A=X,S=w,D=0,N=e>135?-w-g:w+g);let tt=M===0?p:d;this.hP(z,N,0),z.U.e(N,D+tt),k=Math.max(k,D+tt+U.height),w=Math.max(w,S+(L===0?0:g)+U.width),D+=tt+U.height}M++}L>0&&(i?(k+=Math.max(0,c),N<w&&this.yc(t,r,w-N,0,A,o-1),y>0&&(h||this.xu(t,y,0,0,o-1),w+=y)):(w+=Math.max(0,c),D<k&&this.yc(t,r,0,k-D,A,o-1),y>0&&(h||this.xu(t,0,y,0,o-1),k+=y)));let E=0,B=0;switch(r){case 20:i?E+=w/2-t.focus.x-f/2:B+=k/2-t.focus.y-f/2;break;default:case 21:if(L>0)i?E+=w/2-t.focus.x-f/2:B+=k/2-t.focus.y-f/2;else{let z=o;if(i){let U=n[0].U.x+n[0].at.x,tt=n[z-1].U.x+n[z-1].at.x+n[z-1].focus.x*2;E+=U+(tt-U)/2-t.focus.x-f/2}else{let U=n[0].U.y+n[0].at.y,tt=n[z-1].U.y+n[z-1].at.y+n[z-1].focus.y*2;B+=U+(tt-U)/2-t.focus.y-f/2}}break;case 22:i?(E-=f,w+=f):(B-=f,k+=f);break;case 23:i?(E+=w-t.width+f,w+=f):(B+=k-t.height+f,k+=f);break;case 24:case 25:i?o>1?E+=F+d/2-t.focus.x:E+=n[0].focus.x-t.focus.x+n[0].at.x:o>1?B+=F+d/2-t.focus.y:B+=n[0].focus.y-t.focus.y+n[0].at.y;break;case 26:i?E+=w+d/2-t.focus.x:B+=k+d/2-t.focus.y;break;case 27:break;case 28:let X=this.customAlignment(t,E,B,w,k);E=X[0],B=X[1],w=X[2],k=X[3];break}for(let X=0;X<o;X++){let z=n[X];i?z.U.e(z.U.x+z.at.x-E,z.U.y+(e>135?(l?-k:-z.dt.height)+z.at.y-c:v+c+z.at.y)):z.U.e(z.U.x+(e>135?(l?-w:-z.dt.width)+z.at.x-c:b+c+z.at.x),z.U.y+z.at.y-B)}i?(w=this.bL(t,w,E),E<0&&(E=0),e>135&&(B+=k+c),k=Math.max(Math.max(k,v),k+v+c)):(e>135&&(E+=w+c),w=Math.max(Math.max(w,b),w+b+c),k=this.kL(t,k,B),B<0&&(B=0)),t.at.e(E,B),t.dt.e(w,k)}customAlignment(t,e,i,s,n){return[e,i,s,n]}OF(t,e,i,s,n,o,r){let a=e.length;if(a===0)return r.e(i,0,n,o),r;if(a===1){let y=e[0];return n=y.dt.width,o=y.dt.height,r.e(i,0,n,o),r}let h=t.nodeSpacing,l=t.rowSpacing,u=this.orthoAngle(t)===90,c=0,d=0,f=0;for(let y=0;y<a;y++){if(y%2!==0||a>1&&y===a-1)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;b.U.e(i-(v.width+k),f+w),n=Math.max(n,v.width+k),o=Math.max(o,f+w+v.height),f+=w+v.height}else{let k=this.computeBusNodeSpacing(b)-h;b.U.e(d+w,i-(v.height+k)),o=Math.max(o,v.height+k),n=Math.max(n,d+w+v.width),d+=w+v.width}c++}c=0;let p=d,g=f;u?(d=i+h,f=0):(d=0,f=i+h);for(let y=0;y<a;y++){if(y%2===0)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;b.U.e(d+k,f+w),n=Math.max(n,d+v.width+k),o=Math.max(o,f+w+v.height),f+=w+v.height}else{let k=this.computeBusNodeSpacing(b)-h;b.U.e(d+w,f+k),n=Math.max(n,d+w+v.width),o=Math.max(o,f+v.height+k),d+=w+v.width}c++}if(a>1&&a%2===1){let y=e[a-1],b=y.dt,v=this.computeBusLastRowSpacing(y,u?Math.max(Math.abs(g),Math.abs(f)):Math.max(Math.abs(p),Math.abs(d)));if(u){y.U.e(i+h/2-y.focus.x-y.at.x,o+v);let w=i+h/2-y.focus.x-y.at.x;n=Math.max(n,w+b.width),w<0&&(n-=w),o=Math.max(o,Math.max(g,f)+v+b.height),y.U.x<0&&(i=this.cP(t,y.U.x,!1,i,h))}else{y.U.e(n+v,i+h/2-y.focus.y-y.at.y),n=Math.max(n,Math.max(p,d)+v+b.width);let w=i+h/2-y.focus.y-y.at.y;o=Math.max(o,w+b.height),w<0&&(o-=w),y.U.y<0&&(i=this.cP(t,y.U.y,!0,i,h))}}return r.e(i,0,n,o),r}IF(t,e,i,s,n,o,r){let a=e.length;if(a===0)return r.e(i,0,n,o),r;if(a===1){let y=e[0];return n=y.dt.width,o=y.dt.height,r.e(i,0,n,o),r}let h=t.nodeSpacing,l=t.rowSpacing,u=this.orthoAngle(t)===270,c=0,d=0,f=0;for(let y=0;y<a;y++){if(y%2!==0||a>1&&y===a-1)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;f-=w+v.height,b.U.e(i-(v.width+k),f),n=Math.max(n,v.width+k),o=Math.max(o,Math.abs(f))}else{let k=this.computeBusNodeSpacing(b)-h;d-=w+v.width,b.U.e(d,i-(v.height+k)),o=Math.max(o,v.height+k),n=Math.max(n,Math.abs(d))}c++}c=0;let p=d,g=f;u?(d=i+h,f=0):(d=0,f=i+h);for(let y=0;y<a;y++){if(y%2===0)continue;let b=e[y],v=b.dt,w=c===0?0:l;if(u){let k=this.computeBusNodeSpacing(b)-h;f-=w+v.height,b.U.e(d+k,f),n=Math.max(n,d+v.width+k),o=Math.max(o,Math.abs(f))}else{let k=this.computeBusNodeSpacing(b)-h;d-=w+v.width,b.U.e(d,f+k),o=Math.max(o,f+v.height+k),n=Math.max(n,Math.abs(d))}c++}if(a>1&&a%2===1){let y=e[a-1],b=y.dt,v=this.computeBusLastRowSpacing(y,u?Math.max(Math.abs(g),Math.abs(f)):Math.max(Math.abs(p),Math.abs(d)));if(u){y.U.e(i+h/2-y.focus.x-y.at.x,-o-b.height-v);let w=i+h/2-y.focus.x-y.at.x;n=Math.max(n,w+b.width),w<0&&(n-=w),o=Math.max(o,Math.abs(Math.min(g,f))+v+b.height),y.U.x<0&&(i=this.cP(t,y.U.x,!1,i,h))}else{y.U.e(-n-b.width-v,i+h/2-y.focus.y-y.at.y),n=Math.max(n,Math.abs(Math.min(p,d))+v+b.width);let w=i+h/2-y.focus.y-y.at.y;o=Math.max(o,w+b.height),w<0&&(o-=w),y.U.y<0&&(i=this.cP(t,y.U.y,!0,i,h))}}for(let y=0;y<a;y++){let b=e[y];u?b.U.e(b.U.x,b.U.y+o):b.U.e(b.U.x+n,b.U.y)}return r.e(i,0,n,o),r}computeBusNodeSpacing(t){return t.parent===null?0:t.parent.nodeSpacing}computeBusLastRowSpacing(t,e){return t.parent===null?0:t.parent.rowSpacing}cP(t,e,i,s,n){let o=t.children,r=o.length;for(let h=0;h<r;h++)i?o[h].U.e(o[h].U.x,o[h].U.y-e):o[h].U.e(o[h].U.x-e,o[h].U.y);let a=o[r-1];return Math.max(s,i?a.at.y+a.focus.y-n/2:a.at.x+a.focus.x-n/2)}bL(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}}kL(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}}PL(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:m.o("Unhandled alignment value "+t.toString())}return new P(e,i)}yc(t,e,i,s,n,o){let r=this.PL(e,i,s);this.xu(t,r.x,r.y,n,o)}xu(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].U;a.x+=e,a.y+=i}}hP(t,e,i){let s=t.parent;switch(this.ws){case 1:{let n=t.sourceEdges;for(;n.next();){let o=n.value;o.fromVertex===s&&o.relativePoint.e(e,i)}break}case 2:{let n=t.destinationEdges;for(;n.next();){let o=n.value;o.toVertex===s&&o.relativePoint.e(e,i)}break}default:m.o("Unhandled path value "+this.ws.toString())}}dU(t){if(t.childrenCount===0){let _=t.parent,at=!1,ct=0,xt=21;_!==null&&(ct=_.angle,xt=_.alignment,at=this.isBusAlignment(xt));let Ct=this.xL(t);t.U.e(0,0),t.dt.e(t.width,t.height),t.parent!==null&&t.comments!==null&&((ct===180||ct===270)&&!at||Ct)?ct===180&&!at||(ct===90||ct===270)&&Ct?t.at.e(t.width-t.focus.x*2,0):t.at.e(0,t.height-t.focus.y*2):t.at.e(0,0),t.$g=null,t.Zg=null;return}let e=this.orthoAngle(t),i=e===90||e===270,s=0,n=t.children,o=n.length;for(let _=0;_<o;_++){let at=n[_];s=Math.max(s,i?at.dt.width:at.dt.height)}let r=t.alignment,a=r===22,h=r===23,l=this.isBusAlignment(r),u=Math.max(0,t.breadthLimit),c=this.computeLayerSpacing(t),d=t.nodeSpacing,f=this.computeNodeIndent(t),p=t.rowSpacing,g=0;(a||h)&&(g=Math.max(0,t.rowIndent));let y=t.width,b=t.height,v=0,w=0,k=0,S=null,N=null,D=0,L=0,M=0,A=0,F=0,O=0,E=0,B=0,X=0;if(l&&!this.Aw(r)&&e>135&&n.reverse(),this.Aw(r))if(o>1)for(let _=0;_<o;_++)_%2===0&&_!==o-1?B=Math.max(B,i?n[_].dt.width:n[_].dt.height):_%2!==0&&(X=Math.max(X,i?n[_].dt.width:n[_].dt.height));else o===1&&(B=i?n[0].dt.width:n[0].dt.height);if(l){switch(r){case 24:let _=I.l();e<135?this.OF(t,n,B,X,v,w,_):this.IF(t,n,B,X,v,w,_),B=_.x,v=_.width,w=_.height,I.i(_);break;case 26:for(let at=0;at<o;at++){let ct=n[at],xt=ct.dt,Ct=O===0?0:p;i?(ct.U.e(s-xt.width,A+Ct),v=Math.max(v,xt.width),w=Math.max(w,A+Ct+xt.height),A+=Ct+xt.height):(ct.U.e(M+Ct,s-xt.height),v=Math.max(v,M+Ct+xt.width),w=Math.max(w,xt.height),M+=Ct+xt.width),O++}break;case 27:for(let at=0;at<o;at++){let ct=n[at],xt=ct.dt,Ct=O===0?0:p;i?(ct.U.e(d/2+t.focus.x,A+Ct),v=Math.max(v,xt.width),w=Math.max(w,A+Ct+xt.height),A+=Ct+xt.height):(ct.U.e(M+Ct,d/2+t.focus.y),v=Math.max(v,M+Ct+xt.width),w=Math.max(w,xt.height),M+=Ct+xt.width),O++}break}S=this.pi(2),N=this.pi(2),i?(S[0].e(0,0),S[1].e(0,w),N[0].e(v,0),N[1].e(v,w)):(S[0].e(0,0),S[1].e(v,0),N[0].e(0,w),N[1].e(v,w))}else for(let _=0;_<o;_++){let at=n[_],ct=at.dt;if(i){u>0&&O>0&&M+d+ct.width>u&&(M<s&&this.yc(t,r,s-M,0,E,_-1),F++,O=0,E=_,k=w,M=0,A=e>135?-w-p:w+p),this.hP(at,0,A);let xt=0;if(O===0)S=at.$g,N=at.Zg,D=ct.width,L=ct.height,(S===null||N===null||e!==this.orthoAngle(at))&&(S=this.pi(2),N=this.pi(2),S[0].e(0,0),S[1].e(0,L),N[0].e(D,0),N[1].e(D,L));else{let Ct=m.st(),Q=I.l();this.EF(t,at,S,N,D,L,Ct,Q),xt=Q.x,S=Ct[0],N=Ct[1],D=Q.width,L=Q.height,m.Z(Ct),M<ct.width&&xt<0&&(this.xu(t,-xt,0,E,_-1),this.fP(S,-xt,0),this.fP(N,-xt,0),xt=0),I.i(Q)}at.U.e(xt,A),v=Math.max(v,D),w=Math.max(w,k+(F===0?0:p)+ct.height),M=D}else{u>0&&O>0&&A+d+ct.height>u&&(A<s&&this.yc(t,r,0,s-A,E,_-1),F++,O=0,E=_,k=v,A=0,M=e>135?-v-p:v+p),this.hP(at,M,0);let xt=0;if(O===0)S=at.$g,N=at.Zg,D=ct.width,L=ct.height,(S===null||N===null||e!==this.orthoAngle(at))&&(S=this.pi(2),N=this.pi(2),S[0].e(0,0),S[1].e(D,0),N[0].e(0,L),N[1].e(D,L));else{let Ct=m.st(),Q=I.l();this.EF(t,at,S,N,D,L,Ct,Q),xt=Q.x,S=Ct[0],N=Ct[1],D=Q.width,L=Q.height,m.Z(Ct),A<ct.height&&xt<0&&(this.xu(t,0,-xt,E,_-1),this.fP(S,0,-xt),this.fP(N,0,-xt),xt=0),I.i(Q)}at.U.e(M,xt),w=Math.max(w,L),v=Math.max(v,k+(F===0?0:p)+ct.width),A=L}O++}F>0&&(i?(w+=Math.max(0,c),M<v&&this.yc(t,r,v-M,0,E,o-1),g>0&&(h||this.xu(t,g,0,0,o-1),v+=g)):(v+=Math.max(0,c),A<w&&this.yc(t,r,0,w-A,E,o-1),g>0&&(h||this.xu(t,0,g,0,o-1),w+=g)));let z=0,U=0;switch(r){case 20:i?z+=v/2-t.focus.x-f/2:U+=w/2-t.focus.y-f/2;break;default:case 21:if(F>0)i?z+=v/2-t.focus.x-f/2:U+=w/2-t.focus.y-f/2;else{let at=o;if(i){let ct=n[0].U.x+n[0].at.x,xt=n[at-1].U.x+n[at-1].at.x+n[at-1].focus.x*2;z+=ct+(xt-ct)/2-t.focus.x-f/2}else{let ct=n[0].U.y+n[0].at.y,xt=n[at-1].U.y+n[at-1].at.y+n[at-1].focus.y*2;U+=ct+(xt-ct)/2-t.focus.y-f/2}}break;case 22:i?(z-=f,v+=f):(U-=f,w+=f);break;case 23:i?(z+=v-t.width+f,v+=f):(U+=w-t.height+f,w+=f);break;case 24:i?o>1?z+=B+d/2-t.focus.x:z+=n[0].focus.x-t.focus.x+n[0].at.x:o>1?U+=B+d/2-t.focus.y:U+=n[0].focus.y-t.focus.y+n[0].at.y;break;case 26:i?z+=v+d/2-t.focus.x:U+=w+d/2-t.focus.y;break;case 27:break;case 28:let _=this.customAlignment(t,z,U,v,w);z=_[0],U=_[1],v=_[2],w=_[3];break}for(let _=0;_<o;_++){let at=n[_];i?at.U.e(at.U.x+at.at.x-z,at.U.y+(e>135?(l?-w:-at.dt.height)+at.at.y-c:b+c+at.at.y)):at.U.e(at.U.x+(e>135?(l?-v:-at.dt.width)+at.at.x-c:y+c+at.at.x),at.U.y+at.at.y-U)}let tt=0,nt=0;if(l)i?(v=this.bL(t,v,z),z<0&&(z=0),e>135&&(U+=w+c),w+=b+c,r===27&&(tt+=d/2+t.focus.x),nt+=b+c):(e>135&&(z+=v+c),v+=y+c,w=this.kL(t,w,U),U<0&&(U=0),r===27&&(nt+=d/2+t.focus.y),tt+=y+c);else if(i){if(t.comments===null){if(y>v){let _=this.PL(r,y-v,0);tt=_.x,nt=_.y,v=y,z=0}}else v=this.bL(t,v,z);z<0&&(tt-=z,z=0),e>135&&(U+=w+c),w=Math.max(Math.max(w,b),w+b+c),nt+=b+c}else{if(e>135&&(z+=v+c),v=Math.max(Math.max(v,y),v+y+c),t.comments===null){if(b>w){let _=this.PL(r,0,b-w);tt=_.x,nt=_.y,w=b,U=0}}else w=this.kL(t,w,U);U<0&&(nt-=U,U=0),tt+=y+c}let Z,it;if(F>0)Z=this.pi(4),it=this.pi(4),i?(Z[2].e(0,b+c),Z[3].e(Z[2].x,w),it[2].e(v,Z[2].y),it[3].e(it[2].x,Z[3].y)):(Z[2].e(y+c,0),Z[3].e(v,Z[2].y),it[2].e(Z[2].x,w),it[3].e(Z[3].x,it[2].y));else{Z=this.pi(S.length+2),it=this.pi(N.length+2);for(let _=0;_<S.length;_++){let at=S[_];Z[_+2].e(at.x+tt,at.y+nt)}for(let _=0;_<N.length;_++){let at=N[_];it[_+2].e(at.x+tt,at.y+nt)}}i?(Z[0].e(z,0),Z[1].e(Z[0].x,b),Z[2].y<Z[1].y&&(Z[2].x>Z[0].x?Z[2].h(Z[1]):Z[1].h(Z[2])),Z[3].y<Z[2].y&&(Z[3].x>Z[0].x?Z[3].h(Z[2]):Z[2].h(Z[3])),it[0].e(z+y,0),it[1].e(it[0].x,b),it[2].y<it[1].y&&(it[2].x<it[0].x?it[2].h(it[1]):it[1].h(it[2])),it[3].y<it[2].y&&(it[3].x<it[0].x?it[3].h(it[2]):it[2].h(it[3])),Z[2].y-=c/2,it[2].y-=c/2):(Z[0].e(0,U),Z[1].e(y,Z[0].y),Z[2].x<Z[1].x&&(Z[2].y>Z[0].y?Z[2].h(Z[1]):Z[1].h(Z[2])),Z[3].x<Z[2].x&&(Z[3].y>Z[0].y?Z[3].h(Z[2]):Z[2].h(Z[3])),it[0].e(0,U+b),it[1].e(y,it[0].y),it[2].x<it[1].x&&(it[2].y<it[0].y?it[2].h(it[1]):it[1].h(it[2])),it[3].x<it[2].x&&(it[3].y<it[0].y?it[3].h(it[2]):it[2].h(it[3])),Z[2].x-=c/2,it[2].x-=c/2),this.fn(S),this.fn(N),t.$g=Z,t.Zg=it,t.at.e(z,U),t.dt.e(v,w)}fP(t,e,i){for(let s=0;s<t.length;s++){let n=t[s];n.x+=e,n.y+=i}}EF(t,e,i,s,n,o,r,a){let h=this.orthoAngle(t),l=h===90||h===270,u=t.nodeSpacing,c=i,d=s,f=n,p=o,g=e.$g,y=e.Zg,b=e.dt,v=l?Math.max(p,b.height):Math.max(f,b.width);if((g===null||h!==this.orthoAngle(e))&&(g=this.pi(2),y=this.pi(2),l?(g[0].e(0,0),g[1].e(0,b.height),y[0].e(b.width,0),y[1].e(y[0].x,g[1].y)):(g[0].e(0,0),g[1].e(b.width,0),y[0].e(0,b.height),y[1].e(g[1].x,y[0].y))),l){let w=f,k=w-this.gU(d,g,w);return k+=u,i=this.mU(c,g,k),s=this.pU(d,y,k),n=Math.max(0,k)+b.width,o=v,this.fn(c),this.fn(g),this.fn(d),this.fn(y),r[0]=i,r[1]=s,a.e(k,0,n,o),a}else{let w=p,k=w-this.yU(d,g,w);return k+=u,i=this.wU(c,g,k),s=this.xU(d,y,k),n=v,o=Math.max(0,k)+b.height,this.fn(c),this.fn(g),this.fn(d),this.fn(y),r[0]=i,r[1]=s,a.e(k,0,n,o),a}}wU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x,l.y+i)}for(;n<t.length;){let l=t[n++];s[r++].e(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++].e(l.x,l.y+i)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}mU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x+i,l.y)}for(;n<t.length;){let l=t[n++];s[r++].e(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++].e(l.x+i,l.y)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}xU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x,l.y)}for(;o<e.length;){let l=e[o++];s[r++].e(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++].e(l.x,l.y)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}pU(t,e,i){if(t===null||t.length<2||e===null||e.length<2)return null;let s=this.pi(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++].e(l.x,l.y)}for(;o<e.length;){let l=e[o++];s[r++].e(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++].e(l.x,l.y)}let h=this.pi(r);for(n=0;n<r;n++)h[n].h(s[n]);return this.fn(s),h}yU(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 u=r;n+1<t.length&&(u=t[n+1]);let c=a,d=c.x,f=c.y;o+1<e.length&&(c=e[o+1],d=c.x,f=c.y,f+=i);let p=s;r.x===h?p=l-r.y:r.x>h&&r.x<d?p=l+(r.x-h)/(d-h)*(f-l)-r.y:h>r.x&&h<u.x&&(p=l-(r.y+(h-r.x)/(u.x-r.x)*(u.y-r.y))),p<s&&(s=p),u.x<=r.x?n++:d<=h?o++:(u.x<=d&&n++,d<=u.x&&o++)}return s}gU(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 u=r;n+1<t.length&&(u=t[n+1]);let c=a,d=c.x,f=c.y;o+1<e.length&&(c=e[o+1],d=c.x,f=c.y,d+=i);let p=s;r.y===l?p=h-r.x:r.y>l&&r.y<f?p=h+(r.y-l)/(f-l)*(d-h)-r.x:l>r.y&&l<u.y&&(p=h-(r.x+(l-r.y)/(u.y-r.y)*(u.x-r.x))),p<s&&(s=p),u.y<=r.y?n++:f<=l?o++:(u.y<=f&&n++,f<=u.y&&o++)}return s}pi(t){let e=this.aP[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}fn(t){if(!t)return;let e=t.length,i=this.aP[e];i===void 0&&(i=[],this.aP[e]=i),i.push(t)}arrangeTrees(){if(this.He===52){let t=this.Ie.iterator;for(;t.next();){let e=t.value;if(!(e instanceof Rt))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.SL(e,n,o)}}else{let t=[],e=this.Ie.iterator;for(;e.next();){let o=e.value;o instanceof Rt&&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.SL(r,s+r.at.x,n+r.at.y),this.He){case 50:n+=r.dt.height+this.Es.height;break;default:case 51:s+=r.dt.width+this.Es.width;break}}}}SL(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.SL(r,e+r.U.x,i+r.U.y)}}commitLayout(){this.xw(),this.commitNodes(),this.pL(),this.isRouting&&this.commitLinks()}commitNodes(){if(this.network===null)return;let t=this.network.vertexes.iterator;for(;t.next();)t.value.commit();for(t.reset();t.next();){let e=t.value;this.layoutComments(e)}}pL(){if(this.network===null||this.layerStyle!==62)return;let t=this.yL,e=[],i,s=this.network.vertexes.iterator;for(;s.next();){let h=s.value;i===void 0?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}if(!i)return;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 I(0,a,r,l))):this.angle===90?(o.push(new I(0,a,r,l)),a+=l):this.angle===180?(a-=l,o.push(new I(a,0,l,r))):(o.push(new I(a,0,l,r)),a+=l)}this.commitLayers(o,n)}commitLayers(t,e){}commitLinks(){if(this.network===null)return;let t=this.network.edges.iterator;for(;t.next();)t.value.commit()}xw(){let t=this.Ie.iterator;for(;t.next();){let e=t.value;e instanceof Rt&&this.UF(e)}}UF(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.UF(n)}}setPortSpots(t){let e=t.alignment;if(this.isBusAlignment(e))this.bU(t,e);else{let i=this.orthoAngle(t);if(this.ws===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=T.MiddleRight;break;case 90:n.fromSpot=T.MiddleBottom;break;case 180:n.fromSpot=T.MiddleLeft;break;default:n.fromSpot=T.MiddleTop;break}else n.fromSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.isDefault())switch(i){case 0:n.toSpot=T.MiddleLeft;break;case 90:n.toSpot=T.MiddleTop;break;case 180:n.toSpot=T.MiddleRight;break;default:n.toSpot=T.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=T.MiddleRight;break;case 90:n.toSpot=T.MiddleBottom;break;case 180:n.toSpot=T.MiddleLeft;break;default:n.toSpot=T.MiddleTop;break}else n.toSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.isDefault())switch(i){case 0:n.fromSpot=T.MiddleLeft;break;case 90:n.fromSpot=T.MiddleTop;break;case 180:n.fromSpot=T.MiddleRight;break;default:n.fromSpot=T.MiddleBottom;break}else n.fromSpot=t.childPortSpot}}}}}bU(t,e){let i=this.ws===1,s=this.orthoAngle(t),n;switch(s){case 0:n=T.MiddleRight;break;case 90:n=T.MiddleBottom;break;case 180:n=T.MiddleLeft;break;default:n=T.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 u=l.link;if(u!==null){let c=s===90||s===270?T.MiddleLeft:T.MiddleTop;if(r===1||a===r-1&&r%2===1)switch(s){case 0:c=T.MiddleLeft;break;case 90:c=T.MiddleTop;break;case 180:c=T.MiddleRight;break;default:c=T.MiddleBottom;break}else a%2===0&&(c=s===90||s===270?T.MiddleRight:T.MiddleBottom);i?(t.setsPortSpot&&(u.fromSpot=n),t.setsChildPortSpot&&(u.toSpot=c)):(t.setsPortSpot&&(u.fromSpot=c),t.setsChildPortSpot&&(u.toSpot=n))}}break}case 26:{let a=s===90||s===270?T.MiddleRight:T.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?T.MiddleLeft:T.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.Ie}set roots(t){this.Ie!==t&&(this.Ie=t,this.p())}get path(){return this.Fe}set path(t){this.Fe!==t&&(this.Fe=t,this.p())}get treeStyle(){return this.wu}set treeStyle(t){this.wu!==t&&(t===40||t===42||t===41||t===43)&&(this.wu=t,this.p())}get layerStyle(){return this.Jg}set layerStyle(t){this.Jg!==t&&(t===60||t===61||t===62)&&(this.Jg=t,this.p())}get comments(){return this.zi}set comments(t){this.zi!==t&&(m.s(t,"boolean",Vt,"comments"),this.zi=t,this.p())}get arrangement(){return this.He}set arrangement(t){this.He!==t&&(t===50||t===51||t===52)&&(this.He=t,this.p())}get arrangementSpacing(){return this.Es}set arrangementSpacing(t){this.Es.equals(t)||(this.Es.h(t),this.p())}get rootDefaults(){return this.V}set rootDefaults(t){this.V!==t&&(this.V=t,this.p())}get alternateDefaults(){return this.B}set alternateDefaults(t){this.B!==t&&(this.B=t,this.p())}get sorting(){return this.V.sorting}set sorting(t){this.V.sorting!==t&&(this.V.sorting=t,this.p())}get comparer(){return this.V.comparer}set comparer(t){this.V.comparer!==t&&(m.S(t,Vt,"comparer"),this.V.comparer=t,this.p())}get angle(){return this.V.angle}set angle(t){this.V.angle!==t&&(m.s(t,"number",Vt,"angle"),t===0||t===90||t===180||t===270?(this.V.angle=t,this.p()):m.o("TreeLayout.angle must be 0, 90, 180, or 270"))}get alignment(){return this.V.alignment}set alignment(t){this.V.alignment!==t&&(this.V.alignment=t,this.p())}get nodeIndent(){return this.V.nodeIndent}set nodeIndent(t){this.V.nodeIndent!==t&&(m.s(t,"number",Vt,"nodeIndent"),t>=0&&(this.V.nodeIndent=t,this.p()))}get nodeIndentPastParent(){return this.V.nodeIndentPastParent}set nodeIndentPastParent(t){this.V.nodeIndentPastParent!==t&&(m.s(t,"number",Vt,"nodeIndentPastParent"),t>=0&&t<=1&&(this.V.nodeIndentPastParent=t,this.p()))}get nodeSpacing(){return this.V.nodeSpacing}set nodeSpacing(t){this.V.nodeSpacing!==t&&(m.s(t,"number",Vt,"nodeSpacing"),this.V.nodeSpacing=t,this.p())}get layerSpacing(){return this.V.layerSpacing}set layerSpacing(t){this.V.layerSpacing!==t&&(m.s(t,"number",Vt,"layerSpacing"),this.V.layerSpacing=t,this.p())}get layerSpacingParentOverlap(){return this.V.layerSpacingParentOverlap}set layerSpacingParentOverlap(t){this.V.layerSpacingParentOverlap!==t&&(m.s(t,"number",Vt,"layerSpacingParentOverlap"),t>=0&&t<=1&&(this.V.layerSpacingParentOverlap=t,this.p()))}get compaction(){return this.V.compaction}set compaction(t){this.V.compaction!==t&&(t===30||t===31)&&(this.V.compaction=t,this.p())}get breadthLimit(){return this.V.breadthLimit}set breadthLimit(t){this.V.breadthLimit!==t&&(m.s(t,"number",Vt,"breadthLimit"),t>=0&&(this.V.breadthLimit=t,this.p()))}get rowSpacing(){return this.V.rowSpacing}set rowSpacing(t){this.V.rowSpacing!==t&&(m.s(t,"number",Vt,"rowSpacing"),this.V.rowSpacing=t,this.p())}get rowIndent(){return this.V.rowIndent}set rowIndent(t){this.V.rowIndent!==t&&(m.s(t,"number",Vt,"rowIndent"),t>=0&&(this.V.rowIndent=t,this.p()))}get commentSpacing(){return this.V.commentSpacing}set commentSpacing(t){this.V.commentSpacing!==t&&(m.s(t,"number",Vt,"commentSpacing"),this.V.commentSpacing=t,this.p())}get commentMargin(){return this.V.commentMargin}set commentMargin(t){this.V.commentMargin!==t&&(m.s(t,"number",Vt,"commentMargin"),this.V.commentMargin=t,this.p())}get setsPortSpot(){return this.V.setsPortSpot}set setsPortSpot(t){this.V.setsPortSpot!==t&&(m.s(t,"boolean",Vt,"setsPortSpot"),this.V.setsPortSpot=t,this.p())}get portSpot(){return this.V.portSpot}set portSpot(t){this.V.portSpot.equals(t)||(this.V.portSpot=t,this.p())}get setsChildPortSpot(){return this.V.setsChildPortSpot}set setsChildPortSpot(t){this.V.setsChildPortSpot!==t&&(m.s(t,"boolean",Vt,"setsChildPortSpot"),this.V.setsChildPortSpot=t,this.p())}get childPortSpot(){return this.V.childPortSpot}set childPortSpot(t){this.V.childPortSpot.equals(t)||(this.V.childPortSpot=t,this.p())}get alternateSorting(){return this.B.sorting}set alternateSorting(t){this.B.sorting!==t&&(this.B.sorting=t,this.p())}get alternateComparer(){return this.B.comparer}set alternateComparer(t){this.B.comparer!==t&&(m.S(t,Vt,"alternateComparer"),this.B.comparer=t,this.p())}get alternateAngle(){return this.B.angle}set alternateAngle(t){this.B.angle!==t&&(m.s(t,"number",Vt,"alternateAngle"),(t===0||t===90||t===180||t===270)&&(this.B.angle=t,this.p()))}get alternateAlignment(){return this.B.alignment}set alternateAlignment(t){this.B.alignment!==t&&(this.B.alignment=t,this.p())}get alternateNodeIndent(){return this.B.nodeIndent}set alternateNodeIndent(t){this.B.nodeIndent!==t&&(m.s(t,"number",Vt,"alternateNodeIndent"),t>=0&&(this.B.nodeIndent=t,this.p()))}get alternateNodeIndentPastParent(){return this.B.nodeIndentPastParent}set alternateNodeIndentPastParent(t){this.B.nodeIndentPastParent!==t&&(m.s(t,"number",Vt,"alternateNodeIndentPastParent"),t>=0&&t<=1&&(this.B.nodeIndentPastParent=t,this.p()))}get alternateNodeSpacing(){return this.B.nodeSpacing}set alternateNodeSpacing(t){this.B.nodeSpacing!==t&&(m.s(t,"number",Vt,"alternateNodeSpacing"),this.B.nodeSpacing=t,this.p())}get alternateLayerSpacing(){return this.B.layerSpacing}set alternateLayerSpacing(t){this.B.layerSpacing!==t&&(m.s(t,"number",Vt,"alternateLayerSpacing"),this.B.layerSpacing=t,this.p())}get alternateLayerSpacingParentOverlap(){return this.B.layerSpacingParentOverlap}set alternateLayerSpacingParentOverlap(t){this.B.layerSpacingParentOverlap!==t&&(m.s(t,"number",Vt,"alternateLayerSpacingParentOverlap"),t>=0&&t<=1&&(this.B.layerSpacingParentOverlap=t,this.p()))}get alternateCompaction(){return this.B.compaction}set alternateCompaction(t){this.B.compaction!==t&&(t===30||t===31)&&(this.B.compaction=t,this.p())}get alternateBreadthLimit(){return this.B.breadthLimit}set alternateBreadthLimit(t){this.B.breadthLimit!==t&&(m.s(t,"number",Vt,"alternateBreadthLimit"),t>=0&&(this.B.breadthLimit=t,this.p()))}get alternateRowSpacing(){return this.B.rowSpacing}set alternateRowSpacing(t){this.B.rowSpacing!==t&&(m.s(t,"number",Vt,"alternateRowSpacing"),this.B.rowSpacing=t,this.p())}get alternateRowIndent(){return this.B.rowIndent}set alternateRowIndent(t){this.B.rowIndent!==t&&(m.s(t,"number",Vt,"alternateRowIndent"),t>=0&&(this.B.rowIndent=t,this.p()))}get alternateCommentSpacing(){return this.B.commentSpacing}set alternateCommentSpacing(t){this.B.commentSpacing!==t&&(m.s(t,"number",Vt,"alternateCommentSpacing"),this.B.commentSpacing=t,this.p())}get alternateCommentMargin(){return this.B.commentMargin}set alternateCommentMargin(t){this.B.commentMargin!==t&&(m.s(t,"number",Vt,"alternateCommentMargin"),this.B.commentMargin=t,this.p())}get alternateSetsPortSpot(){return this.B.setsPortSpot}set alternateSetsPortSpot(t){this.B.setsPortSpot!==t&&(m.s(t,"boolean",Vt,"alternateSetsPortSpot"),this.B.setsPortSpot=t,this.p())}get alternatePortSpot(){return this.B.portSpot}set alternatePortSpot(t){this.B.portSpot.equals(t)||(this.B.portSpot=t,this.p())}get alternateSetsChildPortSpot(){return this.B.setsChildPortSpot}set alternateSetsChildPortSpot(t){this.B.setsChildPortSpot!==t&&(m.s(t,"boolean",Vt,"alternateSetsChildPortSpot"),this.B.setsChildPortSpot=t,this.p())}get alternateChildPortSpot(){return this.B.childPortSpot}set alternateChildPortSpot(t){this.B.childPortSpot.equals(t)||(this.B.childPortSpot=t,this.p())}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 gs extends Ee{constructor(t){super(t)}createVertex(){return new Rt(this)}createEdge(){return new sn(this)}}class Rt extends Ie{U;dt;at;uP;dP;gP;mP;pP;yP;wP;zi;$g;Zg;Si;Mi;Xt;de;Tw;Dw;vw;Us;Fw;Rw;Ow;Iw;Ew;Uw;Vw;Bw;zw;Xw;Gw;constructor(t){super(t),this.uP=!1,this.dP=null,this.gP=[],this.mP=0,this.pP=0,this.yP=0,this.wP=0,this.zi=null,this.U=new P(0,0),this.dt=new st(0,0),this.at=new P(0,0),this.$g=null,this.Zg=null,this.Si=10,this.Mi=Ie.standardComparer,this.Xt=0,this.de=21,this.Tw=0,this.Dw=0,this.vw=20,this.Us=50,this.Fw=0,this.Rw=31,this.Ow=0,this.Iw=25,this.Ew=10,this.Uw=10,this.Vw=20,this.Bw=!0,this.zw=T.Default,this.Xw=!0,this.Gw=T.Default}copyInheritedPropertiesFrom(t){t!==null&&(this.Si=t.sorting,this.Mi=t.comparer,this.Xt=t.angle,this.de=t.alignment,this.Tw=t.nodeIndent,this.Dw=t.nodeIndentPastParent,this.vw=t.nodeSpacing,this.Us=t.layerSpacing,this.Fw=t.layerSpacingParentOverlap,this.Rw=t.compaction,this.Ow=t.breadthLimit,this.Iw=t.rowSpacing,this.Ew=t.rowIndent,this.Uw=t.commentSpacing,this.Vw=t.commentMargin,this.Bw=t.setsPortSpot,this.zw=t.portSpot,this.Xw=t.setsChildPortSpot,this.Gw=t.childPortSpot)}get initialized(){return this.uP}set initialized(t){this.uP!==t&&(m.s(t,"boolean",Rt,"initialized"),this.uP=t)}get parent(){return this.dP}set parent(t){this.dP!==t&&(this.dP=t)}get children(){return this.gP}set children(t){if(this.gP!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",Rt,"children:value"),t!==null){let e=t.length;for(let i=0;i<e;i++){let s=t[i]}}this.gP=t}}get level(){return this.mP}set level(t){this.mP!==t&&(m.s(t,"number",Rt,"level"),this.mP=t)}get descendantCount(){return this.pP}set descendantCount(t){this.pP!==t&&(m.s(t,"number",Rt,"descendantCount"),this.pP=t)}get maxChildrenCount(){return this.yP}set maxChildrenCount(t){this.yP!==t&&(m.s(t,"number",Rt,"maxChildrenCount"),this.yP=t)}get maxGenerationCount(){return this.wP}set maxGenerationCount(t){this.wP!==t&&(m.s(t,"number",Rt,"maxGenerationCount"),this.wP=t)}get comments(){return this.zi}set comments(t){if(this.zi!==t){if(t!==null&&!Array.isArray(t)&&m.si(t,"Array",Rt,"comments:value"),t!==null){let e=t.length;for(let i=0;i<e;i++){let s=t[i]}}this.zi=t}}get sorting(){return this.Si}set sorting(t){this.Si!==t&&(this.Si=t)}get comparer(){return this.Mi}set comparer(t){this.Mi!==t&&(m.S(t,Rt,"comparer"),this.Mi=t)}get angle(){return this.Xt}set angle(t){this.Xt!==t&&(m.s(t,"number",Rt,"angle"),this.Xt=t)}get alignment(){return this.de}set alignment(t){this.de!==t&&(this.de=t)}get nodeIndent(){return this.Tw}set nodeIndent(t){this.Tw!==t&&(m.s(t,"number",Rt,"nodeIndent"),this.Tw=t)}get nodeIndentPastParent(){return this.Dw}set nodeIndentPastParent(t){this.Dw!==t&&(m.s(t,"number",Rt,"nodeIndentPastParent"),this.Dw=t)}get nodeSpacing(){return this.vw}set nodeSpacing(t){this.vw!==t&&(m.s(t,"number",Rt,"nodeSpacing"),this.vw=t)}get layerSpacing(){return this.Us}set layerSpacing(t){this.Us!==t&&(m.s(t,"number",Rt,"layerSpacing"),this.Us=t)}get layerSpacingParentOverlap(){return this.Fw}set layerSpacingParentOverlap(t){this.Fw!==t&&(m.s(t,"number",Rt,"layerSpacingParentOverlap"),this.Fw=t)}get compaction(){return this.Rw}set compaction(t){this.Rw!==t&&(this.Rw=t)}get breadthLimit(){return this.Ow}set breadthLimit(t){this.Ow!==t&&(m.s(t,"number",Rt,"breadthLimit"),this.Ow=t)}get rowSpacing(){return this.Iw}set rowSpacing(t){this.Iw!==t&&(m.s(t,"number",Rt,"rowSpacing"),this.Iw=t)}get rowIndent(){return this.Ew}set rowIndent(t){this.Ew!==t&&(m.s(t,"number",Rt,"rowIndent"),this.Ew=t)}get commentSpacing(){return this.Uw}set commentSpacing(t){this.Uw!==t&&(m.s(t,"number",Rt,"commentSpacing"),this.Uw=t)}get commentMargin(){return this.Vw}set commentMargin(t){this.Vw!==t&&(m.s(t,"number",Rt,"commentMargin"),this.Vw=t)}get setsPortSpot(){return this.Bw}set setsPortSpot(t){this.Bw!==t&&(m.s(t,"boolean",Rt,"setsPortSpot"),this.Bw=t)}get portSpot(){return this.zw}set portSpot(t){this.zw.equals(t)||(this.zw=t)}get setsChildPortSpot(){return this.Xw}set setsChildPortSpot(t){this.Xw!==t&&(m.s(t,"boolean",Rt,"setsChildPortSpot"),this.Xw=t)}get childPortSpot(){return this.Gw}set childPortSpot(t){this.Gw.equals(t)||(this.Gw=t)}get childrenCount(){return this.children.length}get relativePosition(){return this.U}set relativePosition(t){this.U.set(t)}get subtreeSize(){return this.dt}set subtreeSize(t){this.dt.set(t)}get subtreeOffset(){return this.at}set subtreeOffset(t){this.at.set(t)}}class sn extends ei{xP;constructor(t){super(t),this.xP=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.ws){case 1:i=this.fromVertex,s=this.toVertex;break;case 2:i=this.toVertex,s=this.fromVertex;break;default:m.o("Unhandled path value "+e.ws.toString())}if(i===null||s===null)return;let n=this.xP;if(n.x===0&&n.y===0){this.kU(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,u=t.isOrthogonal,c=0,d,f;if(t.startRoute(),u||l){for(c=2;t.pointsCount>4;)t.removePoint(2);d=t.getPoint(1),f=t.getPoint(2)}else{for(c=1;t.pointsCount>3;)t.removePoint(1);d=t.getPoint(0),f=t.getPoint(t.pointsCount-1)}let p=t.getPoint(t.pointsCount-1),g=0;r===0?(i.alignment===23?(g=o.bottom+n.y,n.y===0&&d.y>p.y+i.rowIndent&&(g=Math.min(g,Math.max(d.y,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.top+n.y,n.y===0&&d.y<p.y-i.rowIndent&&(g=Math.max(g,Math.min(d.y,g+e.computeNodeIndent(i))))):g=o.y+o.height/2+n.y,l?(t.insertPointAt(c,d.x,g),c++,t.insertPointAt(c,o.right+a,g),c++,t.insertPointAt(c,o.right+a+(n.x-h)/3,g),c++,t.insertPointAt(c,o.right+a+(n.x-h)*2/3,g),c++,t.insertPointAt(c,o.right+a+(n.x-h),g),c++,t.insertPointAt(c,f.x,g),c++):(u&&(t.insertPointAt(c,o.right+a/2,d.y),c++),t.insertPointAt(c,o.right+a/2,g),c++,t.insertPointAt(c,o.right+a+n.x-(u?h/2:h),g),c++,u&&(t.insertPointAt(c,t.getPoint(c-1).x,f.y),c++))):r===90?(i.alignment===23?(g=o.right+n.x,n.x===0&&d.x>p.x+i.rowIndent&&(g=Math.min(g,Math.max(d.x,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.left+n.x,n.x===0&&d.x<p.x-i.rowIndent&&(g=Math.max(g,Math.min(d.x,g+e.computeNodeIndent(i))))):g=o.x+o.width/2+n.x,l?(t.insertPointAt(c,g,d.y),c++,t.insertPointAt(c,g,o.bottom+a),c++,t.insertPointAt(c,g,o.bottom+a+(n.y-h)/3),c++,t.insertPointAt(c,g,o.bottom+a+(n.y-h)*2/3),c++,t.insertPointAt(c,g,o.bottom+a+(n.y-h)),c++,t.insertPointAt(c,g,f.y),c++):(u&&(t.insertPointAt(c,d.x,o.bottom+a/2),c++),t.insertPointAt(c,g,o.bottom+a/2),c++,t.insertPointAt(c,g,o.bottom+a+n.y-(u?h/2:h)),c++,u&&(t.insertPointAt(c,f.x,t.getPoint(c-1).y),c++))):r===180?(i.alignment===23?(g=o.bottom+n.y,n.y===0&&d.y>p.y+i.rowIndent&&(g=Math.min(g,Math.max(d.y,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.top+n.y,n.y===0&&d.y<p.y-i.rowIndent&&(g=Math.max(g,Math.min(d.y,g+e.computeNodeIndent(i))))):g=o.y+o.height/2+n.y,l?(t.insertPointAt(c,d.x,g),c++,t.insertPointAt(c,o.left-a,g),c++,t.insertPointAt(c,o.left-a+(n.x+h)/3,g),c++,t.insertPointAt(c,o.left-a+(n.x+h)*2/3,g),c++,t.insertPointAt(c,o.left-a+(n.x+h),g),c++,t.insertPointAt(c,f.x,g),c++):(u&&(t.insertPointAt(c,o.left-a/2,d.y),c++),t.insertPointAt(c,o.left-a/2,g),c++,t.insertPointAt(c,o.left-a+n.x+(u?h/2:h),g),c++,u&&(t.insertPointAt(c,t.getPoint(c-1).x,f.y),c++))):r===270?(i.alignment===23?(g=o.right+n.x,n.x===0&&d.x>p.x+i.rowIndent&&(g=Math.min(g,Math.max(d.x,g-e.computeNodeIndent(i))))):i.alignment===22?(g=o.left+n.x,n.x===0&&d.x<p.x-i.rowIndent&&(g=Math.max(g,Math.min(d.x,g+e.computeNodeIndent(i))))):g=o.x+o.width/2+n.x,l?(t.insertPointAt(c,g,d.y),c++,t.insertPointAt(c,g,o.top-a),c++,t.insertPointAt(c,g,o.top-a+(n.y+h)/3),c++,t.insertPointAt(c,g,o.top-a+(n.y+h)*2/3),c++,t.insertPointAt(c,g,o.top-a+(n.y+h)),c++,t.insertPointAt(c,g,f.y),c++):(u&&(t.insertPointAt(c,d.x,o.top-a/2),c++),t.insertPointAt(c,g,o.top-a/2),c++,t.insertPointAt(c,g,o.top-a+n.y+(u?h/2:h)),c++,u&&(t.insertPointAt(c,f.x,t.getPoint(c-1).y),c++))):m.o("Invalid angle "+r),t.commitRoute()}kU(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,u=i.isOrthogonal,c=this.fromVertex,d=s.isBusAlignment(c.alignment);if(i.startRoute(),n===0){let f=a.right+r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).y;i.setPointAt(1,f-20,i.getPoint(1).y),i.insertPointAt(2,f-20,p),i.insertPointAt(3,f,p),i.insertPointAt(4,f+20,p),i.setPointAt(5,i.getPoint(5).x,p)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,f,i.getPoint(2).y),i.setPointAt(3,f,i.getPoint(3).y)):i.pointsCount===4?i.insertPointAt(2,f,i.getPoint(2).y):i.pointsCount===3?i.setPointAt(1,f,i.getPoint(2).y):i.pointsCount===2&&i.insertPointAt(1,f,i.getPoint(1).y)}else if(n===90){let f=a.bottom+r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).x;i.setPointAt(1,i.getPoint(1).x,f-20),i.insertPointAt(2,p,f-20),i.insertPointAt(3,p,f),i.insertPointAt(4,p,f+20),i.setPointAt(5,p,i.getPoint(5).y)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,i.getPoint(2).x,f),i.setPointAt(3,i.getPoint(3).x,f)):i.pointsCount===4?i.insertPointAt(2,i.getPoint(2).x,f):i.pointsCount===3?i.setPointAt(1,i.getPoint(2).x,f):i.pointsCount===2&&i.insertPointAt(1,i.getPoint(1).x,f)}else if(n===180){let f=a.left-r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).y;i.setPointAt(1,f+20,i.getPoint(1).y),i.insertPointAt(2,f+20,p),i.insertPointAt(3,f,p),i.insertPointAt(4,f-20,p),i.setPointAt(5,i.getPoint(5).x,p)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,f,i.getPoint(2).y),i.setPointAt(3,f,i.getPoint(3).y)):i.pointsCount===4?i.insertPointAt(2,f,i.getPoint(2).y):i.pointsCount===3?i.setPointAt(1,f,i.getPoint(2).y):i.pointsCount===2&&i.insertPointAt(1,f,i.getPoint(1).y)}else if(n===270){let f=a.top-r/2;if(l){if(i.pointsCount===4){let p=i.getPoint(3).x;i.setPointAt(1,i.getPoint(1).x,f+20),i.insertPointAt(2,p,f+20),i.insertPointAt(3,p,f),i.insertPointAt(4,p,f-20),i.setPointAt(5,p,i.getPoint(5).y)}}else u?d?i.setPointAt(3,i.getPoint(2).x,i.getPoint(4).y):i.pointsCount===6&&(i.setPointAt(2,i.getPoint(2).x,f),i.setPointAt(3,i.getPoint(3).x,f)):i.pointsCount===4?i.insertPointAt(2,i.getPoint(2).x,f):i.pointsCount===3?i.setPointAt(1,i.getPoint(2).x,f):i.pointsCount===2&&i.insertPointAt(1,i.getPoint(1).x,f)}i.commitRoute()}get fromVertex(){return this.is}set fromVertex(t){this.is!==t&&(this.is=t)}get toVertex(){return this.ss}set toVertex(t){this.ss!==t&&(this.ss=t)}get relativePoint(){return this.xP}set relativePoint(t){this.xP.set(t)}}class be{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 Dt(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 Dt(5)},arrowheads:{toArrow:"Standard"}}}class Ge{hs=new Set;bu=new Mt;bP="light";kP="light";PP=!1;ML=!0;Qg="light";VF=t=>{let e=t.matches?"dark":"light";e!==this.Qg&&(this.Qg=e,this.kP==="system"&&this.updateDiagrams())};constructor(t){t&&Object.assign(this,t),t?.themeMap||(this.bu.set("light",{colors:{...be.Light.colors},fonts:{...be.Light.fonts},numbers:{...be.Light.numbers},margins:{...be.Light.margins},arrowheads:{...be.Light.arrowheads}}),this.bu.set("dark",{colors:{...be.Dark.colors},fonts:{...be.Dark.fonts},numbers:{...be.Dark.numbers},margins:{...be.Dark.margins},arrowheads:{...be.Dark.arrowheads}})),K.matchMedia&&(this.Qg=K.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}get themeMap(){return this.bu}set themeMap(t){this.bu!==t&&(this.bu=t,this.updateDiagrams())}get defaultTheme(){return this.bP}set defaultTheme(t){this.bP!==t&&(m.s(t,"string",Ge,"defaultTheme"),this.bP=t,this.updateDiagrams())}get currentTheme(){return this.kP}set currentTheme(t){this.kP!==t&&(m.s(t,"string",Ge,"currentTheme"),this.kP=t,this.updateDiagrams())}get changesDivBackground(){return this.PP}set changesDivBackground(t){if(this.PP!==t&&(this.PP=t,t))for(let e of this.hs)e.setDivBackground(this.findValue("div","","fill")),e.T("ThemeChanged",this)}get readsCssVariables(){return this.ML}set readsCssVariables(t){this.ML!==t&&(this.ML=t,this.updateDiagrams())}get preferredColorScheme(){return this.Qg}addDiagram(t){return this.hs.add(t),this.NL(t),this}removeDiagram(t){return this.hs.delete(t),this.NL(t),this}tO(){this.hs.size===0&&K.matchMedia&&K.matchMedia("(prefers-color-scheme: dark)")?.addEventListener("change",this.VF)}eO(){this.hs.size===0&&K.matchMedia&&K.matchMedia("(prefers-color-scheme: dark)")?.removeEventListener("change",this.VF)}set(t,e){t===""&&(t=this.bP),t==="system"&&(t=this.Qg);let i=this.bu.get(t);return i?i=this.BF(i,e):i=e,this.bu.set(t,i),this.updateDiagrams(),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 u=h[l];if(u!==""&&(n=n[u],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=Ge.PU.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.Qg:t)}updateDiagrams(){for(let t of this.hs)this.NL(t)}NL(t){let e=t.skipsUndoManager;t.skipsUndoManager=!0,t.updateAllThemeBindings(),this.PP&&t.setDivBackground(this.findValue("div","","fill")),t.skipsUndoManager=e,t.T("ThemeChanged",this)}BF(t,e){for(let i in e)if(m.Yw(e,i))try{e[i]?.constructor===Object?t[i]=this.BF(t[i]??{},e[i]):t[i]=e[i]}catch{delete t[i]}return t}static PU=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 nn{Pt;a;Be;bl;constructor(){this.a=Y.Rm(),this.Pt="",this.Be=!0,this.bl=!0}get name(){return this.Pt}set name(t){this.Pt=t}get isEnabled(){return this.Be}set isEnabled(t){this.Be=t}get isRealtime(){return this.bl}set isRealtime(t){this.bl=t}get diagram(){return this.a}set diagram(t){this.a!==t&&(this.a=t,t.Fl=!0,t.requestUpdate())}invalidateRouter(){this.a!==null&&(this.a.Fl=!0,this.a.requestUpdate())}canRoute(t){if(!this.isEnabled)return!1;let e=this.diagram;return!(e&&(!this.isRealtime&&e.Iu||e.animationManager.isTicking))}isRoutable(t,e){return!0}routeLinks(t,e){}toString(){return this.name!==""?this.name+" Router":m.Gn(this.constructor)}}class _n extends nn{constructor(t){super(),this.name="AvoidsNodes",t&&Object.assign(this,t)}canRoute(t){return(t instanceof Y?t.np:t.diagram?.np)?super.canRoute(t):!1}isRoutable(t,e){return!(!t.isAvoiding||t.containingGroup!==(e instanceof ht?e:null)||t.toNode===null||t.fromNode===null||t.pointsCount<4)}routeLinks(t,e){let i=e instanceof Y?null:e,s=t.iterator,n=this.diagram.getPositions(!0,i,null);for(;s.next();){let o=s.value;if(!this.isRoutable(o,e))continue;o.startRoute();let r=o.pointsCount,a=o.getPoint(1),h=o.getPoint(r-2),l=o.fromNode.actualBounds.copy();l.inflate(j.Fa,j.Fa),l.unionPoint(o.getPoint(0));let u=o.toNode.actualBounds.copy();u.inflate(j.Fa,j.Fa),u.unionPoint(o.getPoint(r-1)),this.SU(o,l,u,n)&&this.MU(o,a,o.kC,h,o.PC,l,u,n),o.commitRoute()}}SU(t,e,i,s){let n=t.diagram,o=t.pointsCount;if(n===null||!t.fromNode||!t.toNode||t.fromNode===t.toNode||!t.layer||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 u=2;u<o-3;u++){let c=t.getPoint(u),d=t.getPoint(u+1);if(!s.isUnoccupied(Math.min(c.x,d.x),Math.min(c.y,d.y),Math.abs(c.x-d.x),Math.abs(c.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))}MU(t,e,i,s,n,o,r,a){let h=t.diagram;if(h===null)return;let l=e,u=s,c=P.gn,d=P.gn;if(h.isVirtualized){let g=a.bounds.copy(),y=t.getPoint(2),b=t.getPoint(t.pointsCount-3);g.inflate(-a.cellWidth,-a.cellHeight);let v=P.l();a.og(e.x,e.y)||(C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,e.x,e.y,y.x,y.y,v)?(c=e=v.copy(),i=v.directionPoint(y)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,y.x,y.y,b.x,b.y,v)?(c=e=v.copy(),i=v.directionPoint(b)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,b.x,b.y,s.x,s.y,v)&&(c=e=v.copy(),i=v.directionPoint(s))),a.og(s.x,s.y)||(C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,s.x,s.y,b.x,b.y,v)?(d=s=v.copy(),n=b.directionPoint(v)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,b.x,b.y,y.x,y.y,v)?(d=s=v.copy(),n=y.directionPoint(v)):C.Cl(g.x,g.y,g.x+g.width,g.y+g.height,y.x,y.y,e.x,e.y,v)&&(d=s=v.copy(),n=e.directionPoint(v))),P.i(v)}let f=o.copy().unionRect(r);f.inflate(a.cellWidth*a.cf,a.cellHeight*a.cf),a.pv(e,i,s,n,f,!0);let p=a.yo(s.x,s.y);if(!a.Zy&&p>=Ot.ng&&(a.TT(),f.inflate(a.cellWidth*a.I2,a.cellHeight*a.E2),a.pv(e,i,s,n,f,!1),p=a.yo(s.x,s.y)),!a.Zy&&p<Ot.ng&&!a.XE(s.x,s.y)){t.points.removeRange(2,t.pointsCount-3),this.CL(t,a,s.x,s.y,n,!0);let g=0,y=90,b=180,v=270,w=t.getPoint(2);if(t.pointsCount<4)i===g||i===b?(w.x=e.x,w.y=s.y):(w.x=s.x,w.y=e.y),t.setPointAt(2,w.x,w.y),t.insertPointAt(3,w.x,w.y);else{let k=t.getPoint(3);if(i===g||i===b)if(C.c(w.x,k.x)){let S=i===g?Math.max(w.x,e.x):Math.min(w.x,e.x);t.setPointAt(2,S,e.y),t.setPointAt(3,S,k.y)}else C.c(w.y,k.y)?(Math.abs(e.y-w.y)<=a.cellHeight/2&&(t.setPointAt(2,w.x,e.y),t.setPointAt(3,k.x,e.y)),t.insertPointAt(2,w.x,e.y)):t.setPointAt(2,e.x,w.y);else if(i===y||i===v)if(C.c(w.y,k.y)){let S=i===y?Math.max(w.y,e.y):Math.min(w.y,e.y);t.setPointAt(2,e.x,S),t.setPointAt(3,k.x,S)}else C.c(w.x,k.x)?(Math.abs(e.x-w.x)<=a.cellWidth/2&&(t.setPointAt(2,e.x,w.y),t.setPointAt(3,e.x,k.y)),t.insertPointAt(2,e.x,w.y)):t.setPointAt(2,w.x,e.y)}if(c.isReal()){let k=t.getPoint(1),S=t.getPoint(2);k.x!==S.x&&k.y!==S.y?i===g||i===b?t.insertPointAt(2,k.x,S.y):t.insertPointAt(2,S.x,k.y):i===g||i===b?t.insertPointAt(2,l.x,c.y):t.insertPointAt(2,c.x,l.y)}d.isReal()&&(n===g||n===b?t.insertPointAt(t.pointsCount-2,u.x,d.y):t.insertPointAt(t.pointsCount-2,d.x,u.y))}}CL(t,e,i,s,n,o){let r=e.cellWidth,a=e.cellHeight,h=e.yo(i,s),l=i,u=s,c=l,d=u;for(n===0?c+=r:n===90?d+=a:n===180?c-=r:d-=a,t.TC&&h>Ot.nc&&e.yo(c,d)!==h-1&&(e.yo(l-r,u)===h-1?(n=180,c=l-r,d=u):e.yo(l+r,u)===h-1?(n=0,c=l+r,d=u):e.yo(l,u-a)===h-1?(n=270,c=l,d=u-a):e.yo(l,u+a)===h-1&&(n=90,c=l,d=u+a));h>Ot.nc&&e.yo(c,d)===h-1;)l=c,u=d,n===0?c+=r:n===90?d+=a:n===180?c-=r:d-=a,h-=1;if(o?h>Ot.nc&&(n===180||n===0?l=Math.floor(l/r)*r+r/2:(n===90||n===270)&&(u=Math.floor(u/a)*a+a/2)):(l=Math.floor(l/r)*r+r/2,u=Math.floor(u/a)*a+a/2),h>Ot.nc){let f=n,p=l,g=u;if(n===0?(f=90,g+=a):n===90?(f=180,p-=r):n===180?(f=270,g-=a):n===270&&(f=0,p+=r),e.yo(p,g)===h-1)this.CL(t,e,p,g,f,!1);else{let y=l,b=u;n===0?(f=270,b-=a):n===90?(f=0,y+=r):n===180?(f=90,b+=a):n===270&&(f=180,y-=r),e.yo(y,b)===h-1&&this.CL(t,e,y,b,f,!1)}}t.insertPointAt(t.pointsCount-2,l,u)}}ne.prototype.initializeStandardTools=function(){return this.Jt("Action",new Fs,this.mouseDownTools),this.Jt("Relinking",new $e,this.mouseDownTools),this.Jt("LinkReshaping",new Je,this.mouseDownTools),this.Jt("Rotating",new De,this.mouseDownTools),this.Jt("Resizing",new Ze,this.mouseDownTools),this.Jt("Linking",new Le,this.mouseMoveTools),this.Jt("Dragging",new Tt,this.mouseMoveTools),this.Jt("DragSelecting",new ri,this.mouseMoveTools),this.Jt("Panning",new ki,this.mouseMoveTools),this.Jt("ContextMenu",new It,this.mouseUpTools),this.Jt("TextEditing",new oe,this.mouseUpTools),this.Jt("ClickCreating",new Qe,this.mouseUpTools),this.Jt("ClickSelecting",new Ds,this.mouseUpTools),this},Y.d2("GraphLinksModel",Zn),Y.d2("TreeModel",Qn);let Ai=K.go,gi={get version(){return Y.version},Group:ht,List:q,Set:V,Map:Mt,Point:P,Size:st,Rect:I,Margin:Dt,Spot:T,Geometry:wt,PathFigure:zt,PathSegment:mt,InputEvent:Qt,DiagramEvent:wi,ChangedEvent:Xe,Model:ut,GraphLinksModel:Xt,TreeModel:je,Binding:te,ThemeBinding:ii,Transaction:oi,UndoManager:vi,CommandHandler:jt,Tool:$t,DraggingTool:Tt,DraggingInfo:Ke,DraggingOptions:Pi,LinkingBaseTool:ae,LinkingTool:Le,RelinkingTool:$e,LinkReshapingTool:Je,ResizingTool:Ze,RotatingTool:De,ClickSelectingTool:Ds,ActionTool:Fs,ClickCreatingTool:Qe,HTMLInfo:fe,ContextMenuTool:It,DragSelectingTool:ri,PanningTool:ki,TextEditingTool:oe,ToolManager:ne,Animation:ye,AnimationManager:he,AnimationTrigger:ai,Layer:Et,Diagram:Y,Palette:Rn,Overview:hi,Brush:R,GraphObject:J,Panel:G,RowColumnDefinition:Kt,Shape:et,TextBlock:lt,Picture:Bt,Part:pt,Adornment:vt,Node:$,Link:j,Placeholder:le,Layout:_t,LayoutNetwork:Ee,LayoutVertex:Ie,LayoutEdge:ei,GridLayout:Ue,PanelLayout:Lt,CircularLayout:Be,CircularNetwork:Ws,CircularVertex:di,CircularEdge:$s,ForceDirectedLayout:ee,ForceDirectedNetwork:Js,ForceDirectedVertex:Ve,ForceDirectedEdge:fi,LayeredDigraphLayout:Ae,LayeredDigraphNetwork:tn,LayeredDigraphVertex:si,LayeredDigraphEdge:Se,TreeLayout:Vt,TreeNetwork:gs,TreeVertex:Rt,TreeEdge:sn,Themes:be,ThemeManager:Ge,Router:nn,AnimationStyle:Is,AutoScale:Ii,CycleMode:Vs,Flip:Ks,TextFormat:Yi,ImageStretch:ji,LayoutConditions:Gs,LinkAdjusting:Hi,Curve:$i,Routing:Wi,Orientation:Vi,TextOverflow:js,PortSpreading:qs,ScrollMode:zs,CollapsePolicy:Xs,Sizing:zi,TriggerStart:Bs,Stretch:Bi,ViewboxStretch:Us,Wrap:Ki,BrushType:Oe,ColorSpace:Ys,GeometryStretch:Ri,GeometryType:ze,SegmentType:ni,BindingMode:Ci,ChangeType:Ei,CircularArrangement:ts,CircularDirection:es,CircularNodeDiameterFormula:ss,CircularSorting:is,GridAlignment:Zi,GridArrangement:Qi,GridSorting:_i,LayeredDigraphAggressive:as,LayeredDigraphAlign:_s,LayeredDigraphCycleRemove:ns,LayeredDigraphInit:rs,LayeredDigraphLayering:os,LayeredDigraphPack:Qs,TreeAlignment:us,TreeArrangement:fs,TreeCompaction:cs,TreeLayerStyle:en,TreePath:hs,TreeSorting:ls,TreeStyle:ds,GestureMode:As,LinkingDirection:Ts,ReshapingBehavior:Ls,TextEditingAccept:Os,TextEditingStarting:Rs,TextEditingState:Es,WheelMode:Cs};for(let x in gi){let t=gi[x];m.it(t)&&t!==Yi&&(t.className=x)}m.$(Ai)&&Ai.version&&m.ne("WARNING: a `go` object on the root object is already defined. "+("Debug"in Ai?"debug ":"")+"version: "+Ai.version+", replaced with version: "+gi.version),Y.prototype.go=gi,K.go=gi})();var Eo=typeof global<"u"?global.go:self.go,H=typeof global<"u"?global.go:self.go,Io=H.Group,Bo=H.List,Vo=H.Set;var zo=H.Map;var cn=H.Point,pi=H.Size,Xo=H.Rect,ys=H.Margin,Ne=H.Spot,Ko=H.Geometry,Yo=H.PathFigure,Uo=H.PathSegment,jo=H.InputEvent,Go=H.DiagramEvent,qo=H.ChangedEvent,Ho=H.Model,dn=H.GraphLinksModel,Wo=H.TreeModel,$o=H.Binding,Jo=H.ThemeBinding,Zo=H.Transaction,Qo=H.UndoManager,_o=H.CommandHandler,tr=H.Tool,er=H.DraggingTool,ir=H.DraggingInfo,sr=H.DraggingOptions,nr=H.LinkingBaseTool,or=H.LinkingTool,rr=H.RelinkingTool,ar=H.LinkReshapingTool,hr=H.ResizingTool,lr=H.RotatingTool,ur=H.ClickSelectingTool,cr=H.ActionTool,dr=H.ClickCreatingTool,fr=H.HTMLInfo,gr=H.ContextMenuTool,mr=H.DragSelectingTool,pr=H.PanningTool,yr=H.TextEditingTool,xr=H.ToolManager,xs=H.Animation,br=H.AnimationManager,wr=H.AnimationTrigger,vr=H.Layer,Ti=H.Diagram,kr=H.Palette,Pr=H.Overview,Sr=H.Brush,Mr=H.GraphObject,qe=H.Panel,Nr=H.RowColumnDefinition,yi=H.Shape,Li=H.TextBlock,fn=H.Picture,Cr=H.Part,bs=H.Adornment,ws=H.Node,vs=H.Link,gn=H.Placeholder,Ar=H.Layout,Tr=H.LayoutNetwork,Lr=H.LayoutVertex,Dr=H.LayoutEdge,Fr=H.GridLayout,Or=H.PanelLayout,Rr=H.CircularLayout,Er=H.CircularNetwork,Ir=H.CircularVertex,Br=H.CircularEdge,Vr=H.ForceDirectedLayout,zr=H.ForceDirectedNetwork,Xr=H.ForceDirectedVertex,Kr=H.ForceDirectedEdge,mn=H.LayeredDigraphLayout,Yr=H.LayeredDigraphNetwork,Ur=H.LayeredDigraphVertex,jr=H.LayeredDigraphEdge,Gr=H.TreeLayout,qr=H.TreeNetwork,Hr=H.TreeVertex,Wr=H.TreeEdge,$r=H.Themes,Jr=H.ThemeManager,Zr=H.Router,Qr=H.version,_r=H.AnimationStyle,pn=H.AutoScale,ta=H.Curve,ea=H.CycleMode,ia=H.Flip,sa=H.ImageStretch,na=H.LayoutConditions,oa=H.LinkAdjusting,ra=H.Orientation,aa=H.PortSpreading,yn=H.Routing,xn=H.ScrollMode,ha=H.CollapsePolicy,la=H.Sizing,ua=H.TriggerStart,bn=H.Stretch,ca=H.TextFormat,ks=H.TextOverflow,da=H.ViewboxStretch,Ps=H.Wrap,fa=H.BrushType,ga=H.ColorSpace,ma=H.GeometryStretch,pa=H.GeometryType,ya=H.SegmentType,xa=H.BindingMode,ba=H.ChangeType,wa=H.CircularArrangement,va=H.CircularDirection,ka=H.CircularNodeDiameterFormula,Pa=H.CircularSorting,Sa=H.GridAlignment,Ma=H.GridArrangement,Na=H.GridSorting,Ca=H.LayeredDigraphAggressive,Aa=H.LayeredDigraphAlign,Ta=H.LayeredDigraphCycleRemove,La=H.LayeredDigraphInit,Da=H.LayeredDigraphLayering,Fa=H.LayeredDigraphPack,Oa=H.TreeAlignment,Ra=H.TreeArrangement,Ea=H.TreeCompaction,Ia=H.TreeLayerStyle,Ba=H.TreePath,Va=H.TreeSorting,za=H.TreeStyle,Xa=H.GestureMode,Ka=H.LinkingDirection,Ya=H.ReshapingBehavior,Ua=H.TextEditingAccept,ja=H.TextEditingStarting,Ga=H.TextEditingState,wn=H.WheelMode;var eo=on`/** @license
|
|
51
|
+
* Copyright 2025 Esri
|
|
52
|
+
*
|
|
53
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
54
|
+
* you may not use this file except in compliance with the License.
|
|
55
|
+
* You may obtain a copy of the License at
|
|
56
|
+
*
|
|
57
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
58
|
+
*
|
|
59
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
60
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
61
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
62
|
+
* See the License for the specific language governing permissions and
|
|
63
|
+
* limitations under the License.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
#filter-bar {
|
|
67
|
+
background-color: var(--calcite-color-foreground-1);
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 16px;
|
|
70
|
+
right: 196px;
|
|
71
|
+
z-index: 100;
|
|
72
|
+
box-shadow: var(--calcite-shadow-sm);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#filteredViewButtonDiv {
|
|
76
|
+
padding: 8px 8px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#filteredViewButtonLabel {
|
|
80
|
+
--calcite-label-margin-bottom: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#graph-navigation-bar {
|
|
84
|
+
background-color: var(--calcite-color-foreground-1);
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: 16px;
|
|
87
|
+
right: 16px;
|
|
88
|
+
z-index: 100;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#graph-navigation-controls {
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: 0;
|
|
94
|
+
right: 0;
|
|
95
|
+
box-shadow: var(--calcite-shadow-sm);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.z-index-1 {
|
|
99
|
+
z-index: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#diagram-panel {
|
|
103
|
+
--calcite-panel-space: 0px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#diagram-shell-panel {
|
|
107
|
+
--calcite-color-background: var(--calcite-color-foreground-1);
|
|
108
|
+
padding: 16px;
|
|
109
|
+
}`,io=15,so=15,no=10,xi=new pi(220,48),oo=1,ro=8,vn=new pi(48,48),ao=new pi(16,16),kn=new pi(153,17),ho='400 0.75rem "Avenir Next", Avenir, "Helvetica Neue", sans-serif',lo='500 0.75rem "Avenir Next", Avenir, "Helvetica Neue", sans-serif',uo="val(--calcite-color-background)",co=bi("--calcite-color-border-1"),Pn=bi("--calcite-color-foreground-1"),Di=bi("--calcite-color-text-1"),Sn=bi("--calcite-color-border-input"),fo=bi("--calcite-color-foreground-1"),Fi=1,Nn=.3,Ss=1,Cn=.2,go=1;function mo(K){let m=document.createElement("div");m.style.width="100%",m.style.height="100%",K.appendChild(m);let rt=new Ti(m,{click:Po,contentAlignment:Ne.Center,dragSelectingTool:null,hoverDelay:50,initialAutoScale:pn.Uniform,layout:new mn({columnSpacing:io,layerSpacing:so}),padding:no,scrollMode:xn.Infinite,"toolManager.hoverDelay":50,"toolManager.mouseWheelBehavior":wn.Zoom});rt.nodeTemplate=new ws("Auto",{click:So,movable:!1,opacity:Fi,toolTip:new bs("Auto",{isShadowed:!0,margin:new ys(12,16,6,16),padding:0,shadowBlur:16,shadowColor:To(Di,.05),shadowOffset:new cn(0,0)}).add(new qe("Vertical",{background:fo,margin:0}).add(new Li({margin:14,stroke:Di}).bind("text","title")))}).bind("text","title").add(new yi({desiredSize:xi,fill:Pn,geometryString:ko(xi.width,xi.height,ro,vn.width,!!Pn),height:xi.height,portId:"",stroke:co,strokeWidth:oo,width:xi.width})).add(new qe("Horizontal",{alignment:Ne.Left,stretch:bn.Horizontal}).add(new qe("Horizontal",{alignment:Ne.Left,desiredSize:vn,margin:1}).add(new qe("Horizontal",{alignment:Ne.Center,margin:16}).add(new fn({desiredSize:ao}).bind("source","",dt=>un(dt.itemType,dt.itemTypeKeywords)))),new qe("Horizontal",{alignment:Ne.Right,margin:new ys(4,8,0,8)}).add(new qe("Vertical",{}).add(new Li({alignment:Ne.Left,desiredSize:kn,font:lo,overflow:ks.Ellipsis,stroke:Di,wrap:Ps.None}).bind("text","title"),new Li({alignment:Ne.Left,desiredSize:kn,font:ho,overflow:ks.Ellipsis,stroke:Di,wrap:Ps.None}).bind("text","itemTypeForDisplay"))))),rt.commandHandler.zoomFactor=1.05,rt.setDivBackground(uo);let yt=rt.toolManager.clickSelectingTool;yt.standardMouseSelect=function(){};let kt=rt.toolManager.draggingTool;return kt.isEnabled=!1,rt.linkTemplate=new vs({corner:5,movable:!1,routing:yn.Orthogonal,selectable:!1}).add(new yi({opacity:Ss,stroke:Sn}),new yi({fill:Sn,opacity:Ss,stroke:null,toArrow:"Standard"})),rt}function He(K,m){K.model=new dn(m.nodes,m.links,{linkFromPortIdProperty:"fromPort",linkToPortIdProperty:"toPort"})}function po(K,m,rt,yt=!0){if(yt){let q=Mo(K,rt);q.addEventListener("calciteSwitchChange",()=>document.dispatchEvent(new CustomEvent("filteredViewChanged",{detail:q.checked})))}let{resetButton:kt,centerButton:dt,zoomInButton:gt,zoomOutButton:St}=No(K,rt);kt.addEventListener("click",()=>Ao(m)),dt.addEventListener("click",()=>m.zoomToFit()),gt.addEventListener("click",()=>m.commandHandler.increaseZoom()),St.addEventListener("click",()=>m.commandHandler.decreaseZoom())}function yo(K,m,rt){let yt=mo(K);return He(yt,m),po(K,yt,rt),yt}function An(K){let m=new Set,rt=new Set;function yt(dt){dt.findLinksInto().each(gt=>{rt.add(gt);let St=gt.fromNode;St&&!m.has(St)&&(m.add(St),yt(St))})}yt(K);function kt(dt){dt.findLinksOutOf().each(gt=>{rt.add(gt);let St=gt.toNode;St&&!m.has(St)&&(m.add(St),kt(St))})}return kt(K),{connectedNodes:m,connectedLinks:rt}}function xo(K,m=!1,rt){let yt=[],kt=K.map(gt=>{if(gt.type!=="Group"){let St=vo(gt);return wo(gt,St,m,rt)}else{yt.push(gt.id);return}}).filter(gt=>gt!==void 0),dt=[];return kt.forEach(gt=>{(K.find(q=>q.id===gt.itemId)?.dependencies||[]).forEach(q=>{let Jt=kt.find(V=>V?.itemId===q);Jt&&dt.push({from:Jt.key,fromSpot:Ne.AllSides,to:gt.key,toSpot:Ne.AllSides})})}),{nodes:kt,links:dt,groupPseudoNodes:yt}}function bo(K,m,rt,yt=!0){let kt=K.diagram;if(!kt)return;let dt={};if(yt){for(let gt of kt.nodes)dt[gt.key]=gt===K?Fi:Nn;for(let gt of kt.links){let St=`${gt.fromNode?.key}-${gt.toNode?.key}`;dt[St]=Cn}{let{connectedNodes:gt,connectedLinks:St}=An(K);for(let q of gt)dt[q.key]=Fi;for(let q of St){let Jt=`${q.fromNode?.key}-${q.toNode?.key}`;dt[Jt]=go}}}if(rt&&(rt.adornedObject=K),yt){let gt=new xs;gt.duration=1;for(let St of kt.nodes)gt.add(St,"opacity",St.opacity,dt[St.key]);for(let St of kt.links){let q=`${St.fromNode?.key}-${St.toNode?.key}`;gt.add(St,"opacity",St.opacity,dt[q])}gt.start()}}function Mn(K,m,rt,yt,kt=!0){if(K.length===0)return;let dt=m[0].diagram;if(!dt)return;let gt={};if(kt){for(let St of dt.nodes){let q=K.includes(St.key);gt[St.key]=!rt||q?Fi:Nn}for(let St of dt.links){let q=`${St.fromNode?.key}-${St.toNode?.key}`;gt[q]=rt?Cn:Ss}}if(Object.keys(yt).forEach(St=>{yt[St].adornedObject=null}),kt){let St=new xs;St.duration=1;for(let q of dt.nodes)St.add(q,"opacity",q.opacity,gt[q.key]);for(let q of dt.links){let Jt=`${q.fromNode?.key}-${q.toNode?.key}`;St.add(q,"opacity",q.opacity,gt[Jt])}St.start()}}function wo(K,m,rt=!1,yt){return{key:m,title:K.title,itemId:K.id,itemType:K.type,itemTypeForDisplay:Co(K.type,K.typeKeywords),itemTypeKeywords:K.typeKeywords,group:K.type,url:rt?`${yt}?id=${K.id}`:void 0}}function vo(K){return K.id}function ko(K,m,rt,yt=0,kt=!1){let dt="";kt&&(dt+="F");let gt=K-2*rt,St=m-2*rt;return dt+=" M0 0",dt+=` h${gt}`,dt+=` a${rt} ${rt} 0 0 1 ${rt} ${rt}`,dt+=` v${St}`,dt+=` a${rt} ${rt} 0 0 1 ${-rt} ${rt}`,dt+=` h${-gt}`,dt+=` a${rt} ${rt} 0 0 1 ${-rt} ${-rt}`,dt+=` v${-St}`,dt+=` a${rt} ${rt} 0 0 1 ${rt} ${-rt}`,yt>0&&(dt+=` M${yt-rt} 0 v${m}`),dt}function Po(){document.dispatchEvent(new CustomEvent("clickInDiagram"))}function So(K,m){let rt=m.part;rt instanceof ws&&(rt.selectionAdorned=!1,document.dispatchEvent(new CustomEvent("clickOnNode",{detail:rt})))}function Mo(K,m){let rt=document.createElement("calcite-switch");rt.id="filteredViewButton",rt.label=m.filteredView;let yt=document.createElement("calcite-label");yt.id="filteredViewButtonLabel",yt.setAttribute("layout","inline"),yt.innerHTML=m.filteredView,yt.appendChild(rt);let kt=document.createElement("div");kt.id="filteredViewButtonDiv",kt.appendChild(yt);let dt=document.createElement("calcite-action-bar");dt.id="filter-bar-controls",dt.layout="horizontal",dt.expandDisabled=!0,dt.appendChild(kt);let gt=document.createElement("div");return gt.id="filter-bar",K.appendChild(gt),gt.appendChild(dt),rt}function No(K,m){let rt=document.createElement("calcite-action");rt.icon="reset",rt.id="showHideGrayedOutButton";let yt=document.createElement("calcite-tooltip");yt.id="resetButtonTooltip",yt.innerHTML=m.reset,yt.overlayPositioning="fixed",yt.placement="bottom",yt.referenceElement=rt.id;let kt=document.createElement("calcite-action");kt.icon="zoom-to-object",kt.id="centerButton";let dt=document.createElement("calcite-tooltip");dt.id="centerButtonTooltip",dt.innerHTML=m.centerDiagram,dt.overlayPositioning="fixed",dt.placement="bottom",dt.referenceElement=kt.id;let gt=document.createElement("calcite-action");gt.icon="plus",gt.id="zoomInButton";let St=document.createElement("calcite-tooltip");St.id="zoomInButtonTooltip",St.innerHTML=m.zoomIn,St.overlayPositioning="fixed",St.placement="bottom",St.referenceElement=gt.id;let q=document.createElement("calcite-action");q.appearance="solid",q.icon="minus",q.id="zoomOutButton";let Jt=document.createElement("calcite-tooltip");Jt.id="zoomOutButtonTooltip",Jt.innerHTML=m.zoomOut,Jt.overlayPositioning="fixed",Jt.placement="bottom",Jt.referenceElement=q.id;let V=document.createElement("calcite-action-bar");V.id="graph-navigation-controls",V.layout="horizontal",V.expandDisabled=!0,V.appendChild(rt),V.appendChild(yt),V.appendChild(kt),V.appendChild(dt),V.appendChild(gt),V.appendChild(St),V.appendChild(q),V.appendChild(Jt);let We=document.createElement("div");return We.id="graph-navigation-bar",K.appendChild(We),We.appendChild(V),{resetButton:rt,centerButton:kt,zoomInButton:gt,zoomOutButton:q}}function Co(K,m){let rt=K;if(K==="Feature Service"){let yt=m.indexOf("View Service")>-1,kt=m.indexOf("Table")>-1;rt=yt&&kt?"Table (hosted, view)":kt?"Table (hosted)":yt?"Feature Layer (hosted, view)":"Feature Layer (hosted)"}return K==="Web Mapping Application"&&(rt=m.indexOf("configurableApp")>-1?"Instant App":rt),rt=K==="Geoprocessing Service"?"Tool":rt,rt=K==="Feed"?"Feed (hosted)":rt,rt=K==="Real Time Analytic"?"Real Time Analytic (hosted)":rt,rt=K==="Big Data Analytic"?"Big Data Analytic (hosted)":rt,rt=K==="Vector Tile Service"?"Tile Layer":rt,rt}function Ao(K){K.zoomToFit(),document.dispatchEvent(new CustomEvent("reset"))}function bi(K){let m=document.body;return getComputedStyle(m).getPropertyValue(K).trim()}function To(K,m){if(K=K.replace(/^#/,""),K.length===3&&(K=K.split("").map(dt=>dt+dt).join("")),K.length!==6)throw new Error("Invalid hex color");let rt=parseInt(K.slice(0,2),16),yt=parseInt(K.slice(2,4),16),kt=parseInt(K.slice(4,6),16);return`rgba(${rt}, ${yt}, ${kt}, ${m})`}var Lo=8,Do=15,Fo=Ro("--calcite-color-brand"),Oo=4;function Ro(K){let m=document.documentElement;return getComputedStyle(m).getPropertyValue(K).trim()}var Ms=class{constructor(m,rt,yt,kt){this.indexPanel=m,this.diagramPanel=rt,this.diagramTranslations=yt,this.diagramKey=kt,this.currentSelectedGroupId="",this.currentSelectedItemId="",this.diagramNeedsRedraw=!1,this.usefilteredView=!1,this.handle_clickInDiagram=dt=>{dt.stopImmediatePropagation(),(this.currentSelectedGroupId||this.currentSelectedItemId)&&(this.currentSelectedGroupId="",this.currentSelectedItemId="",this.diagramNeedsRedraw=this.usefilteredView,this.redraw())},this.handle_clickOnNode=dt=>{dt.stopImmediatePropagation();let gt=dt.detail.data.key;this.redraw(gt,gt===this.currentSelectedItemId)},this.handle_filteredViewChanged=dt=>{this.usefilteredView=dt.detail,this.diagramNeedsRedraw=!!this.currentSelectedGroupId||!!this.currentSelectedItemId,this.redraw(this.currentSelectedItemId||this.currentSelectedGroupId)},this.handle_reset=dt=>{dt.stopImmediatePropagation(),this.reset()},this.handle_solutionItemSelect=dt=>{dt.stopImmediatePropagation();let gt=dt.detail.itemId;this.redraw(gt,gt===this.currentSelectedItemId||gt===this.currentSelectedGroupId,!1)},Ti.licenseKey===""&&(Ti.licenseKey=kt??"")}create(m,rt){this.collection=m,this.index=document.createElement("solution-item-accordion"),this.index.linkType="action",this.index.listSelectionMode="single",this.index.typeKeywords=rt,this.index.style.overflowY="auto",this.indexPanel.appendChild(this.index),this.index.templateInfos=m,this.allNodesAndLinks=xo(m),this.diagram=yo(this.diagramPanel,this.allNodesAndLinks,this.diagramTranslations),this.diagram.addDiagramListener("LayoutCompleted",()=>{setTimeout(()=>{this.diagram.zoomToFit()},1e3)}),vs.setRoutingParameter(44,600942),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(m=!0){this.index.deselectAll(),m&&this.index.collapseAll();let rt=this.getNodesFromDiagram(this.diagram),yt=rt.map(kt=>kt.data.key);Mn(yt,rt,!1,this.diagramNodeHighlighterIndex)}createNodeHighlighters(){this.diagramNodeIndex={},this.diagramNodeHighlighterIndex={},this.getNodesFromDiagram(this.diagram).forEach(rt=>{this.diagramNodeIndex[rt.data.key]=rt;let yt=new bs("Auto",{background:"transparent",margin:2});yt.add(new yi("RoundedRectangle",{fill:"transparent",parameter1:Lo,parameter2:Do,stroke:Fo,strokeWidth:Oo})),yt.add(new gn({margin:1})),this.diagramNodeHighlighterIndex[rt.data.key]=yt})}getNodeById(m){return this.diagramNodeIndex[m]}getNodesFromDiagram(m){let rt=[],yt=m.nodes.iterator;for(;yt.next();)rt.push(yt.value);return rt}redraw(m="",rt=!1,yt=!0){let kt=this.allNodesAndLinks.groupPseudoNodes.includes(m);this.diagramNeedsRedraw&&(He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),this.diagramNeedsRedraw=!1);let dt=!1;if(this.clearSelections(yt),!!m){if(kt){if(this.currentSelectedItemId="",this.currentSelectedGroupId!==m?this.currentSelectedGroupId=m:rt&&(this.currentSelectedGroupId=this.currentSelectedGroupId?"":m,dt=this.usefilteredView&&!this.currentSelectedGroupId),this.currentSelectedGroupId){this.usefilteredView&&(He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters());let gt=this.collection.filter(q=>q.id===m)[0],St=gt.dependencies.map(q=>this.diagramNodeIndex[q]);if(this.usefilteredView){let q=St.map(Jt=>Jt.data);He(this.diagram,{nodes:q,links:[]})}else Mn(gt.dependencies,St,!0,this.diagramNodeHighlighterIndex);this.index.selectItem(this.currentSelectedGroupId)}}else{this.currentSelectedGroupId="",this.currentSelectedItemId!==m?this.currentSelectedItemId=m:rt&&(this.currentSelectedItemId=this.currentSelectedItemId?"":m,dt=this.usefilteredView&&!this.currentSelectedItemId);let gt=this.getNodeById(m);if((!gt||this.usefilteredView)&&(He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),gt=this.getNodeById(m),!gt))return;if(this.currentSelectedItemId){if(this.usefilteredView){let St=An(gt);St.connectedNodes.add(gt);let q=Array.from(St.connectedNodes).map(V=>V.data),Jt=Array.from(St.connectedLinks).map(V=>V.data);if(He(this.diagram,{nodes:q,links:Jt}),this.createNodeHighlighters(),gt=this.getNodeById(m),!gt)return}gt&&setTimeout(()=>bo(gt,!0,this.diagramNodeHighlighterIndex[m]),1),this.index.selectItem(this.currentSelectedItemId)}}dt&&this.reset()}}reset(){this.diagramNeedsRedraw=!1,this.currentSelectedGroupId="",this.currentSelectedItemId="",He(this.diagram,this.allNodesAndLinks),this.createNodeHighlighters(),this.clearSelections()}},Ns=class extends an{constructor(){super(...arguments),this.diagramKey="",this.templateInfoGraph=[],this.typeKeywords=[],this._diagramPanel=ms(),this._diagramShell=ms(),this._translations=ln({name:"solution-item-diagram",blocking:!0})}static{this.properties={diagramKey:1,templateInfoGraph:[0,{},{attribute:!1}],typeKeywords:[0,{},{attribute:!1}],_diagramPanel:[16,{},{state:!0}],_diagramShell:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=eo}updated(){if(this.solutionDisplay&&(this.solutionDisplay.dispose(),this.solutionDisplay=void 0),this.templateInfoGraph.length>0){let m={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 Ms(this._diagramShell.value,this._diagramPanel.value,m,this.diagramKey),this.solutionDisplay.create(this.templateInfoGraph,this.typeKeywords)}requestAnimationFrame(()=>this._preventDiagramScrollbars())}disconnectedCallback(){super.disconnectedCallback(),this.solutionDisplay&&(this.solutionDisplay.dispose(),this.solutionDisplay=void 0)}render(){return rn`<calcite-shell><calcite-shell-panel id=diagram-shell-panel slot=panel-start ${ps(this._diagramShell)}></calcite-shell-panel><calcite-panel class="z-index-1" id=diagram-panel slot=panel-bottom ${ps(this._diagramPanel)}></calcite-panel></calcite-shell>`}_preventDiagramScrollbars(){if(!this._diagramPanel.value)return;let m=this._diagramPanel.value.shadowRoot;if(!m)return;let rt=m.querySelector(".content-wrapper");rt instanceof HTMLElement&&(rt.style.overflow="hidden")}};hn("solution-item-diagram",Ns);export{Ns as SolutionItemDiagram};
|